rizzo-css 0.0.13 → 0.0.14
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 +3 -3
- package/bin/rizzo-css.js +75 -44
- package/package.json +2 -2
- package/scaffold/astro/ThemeSwitcher.astro +504 -0
- package/scaffold/astro/themes.ts +54 -0
- package/scaffold/astro-app/README.md +1 -1
- package/scaffold/astro-app/src/pages/components.astro +1 -1
- package/scaffold/svelte/ThemeSwitcher.svelte +315 -0
- package/scaffold/svelte/theme.ts +65 -0
- package/scaffold/svelte/themes.ts +54 -0
- package/scaffold/svelte-app/README.md +1 -1
- package/scaffold/vanilla/README.md +2 -2
- 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` —
|
|
15
|
+
**Quick start (no install):** `npx rizzo-css init` — choose **framework** (Vanilla, Astro, or Svelte), then **add to existing** or **create new**. For Astro/Svelte: **What to include?** — CSS only, Recommended set, All (25 components), or Pick. Add to existing: you must add the stylesheet `<link>` yourself (CLI prints the exact tag). New: full scaffold. All get the **same CSS and component styles**. To use the **official Svelte or Astro scaffold** plus Rizzo CSS, create the app with their CLI 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
|
|
@@ -41,7 +41,7 @@ You install **the same package** for every framework: `npm install rizzo-css`. N
|
|
|
41
41
|
|
|
42
42
|
With `npx rizzo-css add --path <dir>`, the CLI still suggests the correct href for your framework (e.g. Astro/Svelte get a leading `/` path).
|
|
43
43
|
|
|
44
|
-
Scaffolds (full starter apps) are in the package: `scaffold/vanilla/`, `scaffold/astro-app/`, `scaffold/svelte-app/`. Use `npx rizzo-css init` and choose **Create new project** to get the full clone (navbar/chrome + component showcase) for the chosen framework. **Add to existing** only adds the CSS and optional components (no full scaffold). Each scaffold folder has a README with setup and instructions for editing the cloned site.
|
|
44
|
+
Scaffolds (full starter apps) are in the package: `scaffold/vanilla/`, `scaffold/astro-app/`, `scaffold/svelte-app/`. Use `npx rizzo-css init` and choose **Create new project** to get the full clone (navbar/chrome + component showcase) for the chosen framework; the stylesheet link is already in the layout. **Add to existing** only adds the CSS and optional components (no full scaffold); **you must add the stylesheet `<link>` to your layout yourself** — the CLI prints the exact tag for your framework (e.g. Svelte/Astro: `/css/rizzo.min.css`; Vanilla: `css/rizzo.min.css`). Each scaffold folder has a README with setup and instructions for editing the cloned site.
|
|
45
45
|
|
|
46
46
|
## Use
|
|
47
47
|
|
|
@@ -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.14 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
|
@@ -31,13 +31,18 @@ const SVELTE_COMPONENTS = [
|
|
|
31
31
|
'Button', 'Badge', 'Card', 'Divider', 'Spinner', 'ProgressBar', 'Avatar', 'Alert',
|
|
32
32
|
'Breadcrumb', 'FormGroup', 'Input', 'Checkbox', 'Textarea', 'Select', 'Radio',
|
|
33
33
|
'CopyToClipboard', 'Tooltip', 'Pagination', 'Tabs', 'Accordion', 'Dropdown',
|
|
34
|
-
'Modal', 'Toast', 'Table',
|
|
34
|
+
'Modal', 'Toast', 'Table', 'ThemeSwitcher',
|
|
35
35
|
];
|
|
36
36
|
const ASTRO_COMPONENTS = [
|
|
37
37
|
'Button', 'Badge', 'Card', 'Divider', 'Spinner', 'ProgressBar', 'Avatar', 'Alert',
|
|
38
38
|
'Breadcrumb', 'FormGroup', 'Input', 'Checkbox', 'Textarea', 'Select', 'Radio',
|
|
39
39
|
'CopyToClipboard', 'Tooltip', 'Pagination', 'Tabs', 'Accordion', 'Dropdown',
|
|
40
|
-
'Modal', 'Toast', 'Table',
|
|
40
|
+
'Modal', 'Toast', 'Table', 'ThemeSwitcher',
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
// Recommended subset for "Recommended set" option (keeps CLI simple; power users can pick)
|
|
44
|
+
const RECOMMENDED_COMPONENTS = [
|
|
45
|
+
'Button', 'Badge', 'Card', 'Modal', 'Tabs', 'ThemeSwitcher', 'FormGroup', 'Alert', 'Toast', 'Dropdown',
|
|
41
46
|
];
|
|
42
47
|
|
|
43
48
|
// ANSI colors for CLI (framework logo colors)
|
|
@@ -393,6 +398,31 @@ async function promptThemes() {
|
|
|
393
398
|
return { theme, defaultDark: DARK_THEMES.includes(defaultDark) ? defaultDark : DARK_THEMES[0], defaultLight: LIGHT_THEMES.includes(defaultLight) ? defaultLight : LIGHT_THEMES[0] };
|
|
394
399
|
}
|
|
395
400
|
|
|
401
|
+
/** Ask what to include: CSS only, recommended set, all components, or pick. Returns array of component names. Only call when componentList.length > 0. */
|
|
402
|
+
async function promptComponentChoice(componentList, framework) {
|
|
403
|
+
const recommended = RECOMMENDED_COMPONENTS.filter((c) => componentList.includes(c));
|
|
404
|
+
const choice = await selectMenu(
|
|
405
|
+
[
|
|
406
|
+
{ value: 'none', label: 'CSS only — no components' },
|
|
407
|
+
{ value: 'recommended', label: 'Recommended set (' + recommended.length + ' components: Button, Badge, Card, Modal, Tabs, ThemeSwitcher, FormGroup, Alert, Toast, Dropdown)' },
|
|
408
|
+
{ value: 'all', label: 'All components (' + componentList.length + ')' },
|
|
409
|
+
{ value: 'pick', label: 'Pick components (choose each one)' },
|
|
410
|
+
],
|
|
411
|
+
'? What to include?'
|
|
412
|
+
);
|
|
413
|
+
if (choice === 'none') return [];
|
|
414
|
+
if (choice === 'recommended') return recommended;
|
|
415
|
+
if (choice === 'all') return [...componentList];
|
|
416
|
+
return multiSelectMenu(
|
|
417
|
+
[
|
|
418
|
+
{ value: SENTINEL_ALL, label: 'Select all components' },
|
|
419
|
+
{ value: SENTINEL_NONE, label: 'Select no components' },
|
|
420
|
+
...componentList.map((c) => ({ value: c, label: c })),
|
|
421
|
+
],
|
|
422
|
+
'? Components — Space to toggle, Enter to confirm'
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
|
|
396
426
|
/** Detect framework from cwd: "svelte" | "astro" | null. */
|
|
397
427
|
function detectFramework(cwd) {
|
|
398
428
|
if (existsSync(join(cwd, 'svelte.config.js')) || existsSync(join(cwd, 'svelte.config.ts'))) return 'svelte';
|
|
@@ -587,6 +617,12 @@ function copySvelteComponents(projectDir, selectedNames) {
|
|
|
587
617
|
if (existsSync(iconsSrc)) {
|
|
588
618
|
copyDirRecursive(iconsSrc, join(targetDir, 'icons'));
|
|
589
619
|
}
|
|
620
|
+
if (toCopy.includes('ThemeSwitcher')) {
|
|
621
|
+
const themesSrc = join(scaffoldDir, 'themes.ts');
|
|
622
|
+
const themeSrc = join(scaffoldDir, 'theme.ts');
|
|
623
|
+
if (existsSync(themesSrc)) copyFileSync(themesSrc, join(targetDir, 'themes.ts'));
|
|
624
|
+
if (existsSync(themeSrc)) copyFileSync(themeSrc, join(targetDir, 'theme.ts'));
|
|
625
|
+
}
|
|
590
626
|
if (exports.length > 0) {
|
|
591
627
|
const indexContent = `/** Rizzo CSS Svelte components — selected via npx rizzo-css init */\n${exports.join('\n')}\n`;
|
|
592
628
|
writeFileSync(join(targetDir, 'index.ts'), indexContent, 'utf8');
|
|
@@ -622,6 +658,12 @@ function copyAstroComponents(projectDir, selectedNames) {
|
|
|
622
658
|
if (existsSync(iconsSrc)) {
|
|
623
659
|
copyDirRecursive(iconsSrc, join(targetDir, 'icons'));
|
|
624
660
|
}
|
|
661
|
+
if (toCopy.includes('ThemeSwitcher')) {
|
|
662
|
+
const themesSrc = join(scaffoldDir, 'themes.ts');
|
|
663
|
+
if (existsSync(themesSrc)) {
|
|
664
|
+
copyFileSync(themesSrc, join(targetDir, 'themes.ts'));
|
|
665
|
+
}
|
|
666
|
+
}
|
|
625
667
|
if (count > 0) {
|
|
626
668
|
console.log('\n ✓ ' + count + ' Astro components + icons copied to ' + targetDir);
|
|
627
669
|
console.log(' Import in your pages: import Button from \'../components/rizzo/Button.astro\';\n');
|
|
@@ -646,29 +688,35 @@ async function runAddToExisting(frameworkOverride) {
|
|
|
646
688
|
framework = await selectMenu(frameworkOptions, frameworkPrompt);
|
|
647
689
|
}
|
|
648
690
|
|
|
649
|
-
const { theme, defaultDark, defaultLight } = await promptThemes();
|
|
650
|
-
|
|
651
|
-
let selectedComponents = [];
|
|
652
691
|
const componentList = framework === 'svelte' ? SVELTE_COMPONENTS : framework === 'astro' ? ASTRO_COMPONENTS : [];
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
692
|
+
const selectedComponents = componentList.length > 0
|
|
693
|
+
? await promptComponentChoice(componentList, framework)
|
|
694
|
+
: [];
|
|
695
|
+
|
|
696
|
+
let theme, defaultDark, defaultLight;
|
|
697
|
+
const wantsThemeSwitcher = selectedComponents.includes('ThemeSwitcher');
|
|
698
|
+
if (wantsThemeSwitcher) {
|
|
699
|
+
const setDefaults = await selectMenu(
|
|
656
700
|
[
|
|
657
|
-
{ value:
|
|
658
|
-
{ value:
|
|
701
|
+
{ value: true, label: 'Yes — choose default dark, default light, and initial theme' },
|
|
702
|
+
{ value: false, label: 'No — use defaults (github-dark-classic / github-light)' },
|
|
659
703
|
],
|
|
660
|
-
'?
|
|
704
|
+
'? Set default themes for ThemeSwitcher? (same as create-new flow)'
|
|
661
705
|
);
|
|
662
|
-
if (
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
706
|
+
if (setDefaults) {
|
|
707
|
+
const out = await promptThemes();
|
|
708
|
+
theme = out.theme;
|
|
709
|
+
defaultDark = out.defaultDark;
|
|
710
|
+
defaultLight = out.defaultLight;
|
|
711
|
+
} else {
|
|
712
|
+
theme = DARK_THEMES[0];
|
|
713
|
+
defaultDark = DARK_THEMES[0];
|
|
714
|
+
defaultLight = LIGHT_THEMES[0];
|
|
671
715
|
}
|
|
716
|
+
} else {
|
|
717
|
+
theme = DARK_THEMES[0];
|
|
718
|
+
defaultDark = DARK_THEMES[0];
|
|
719
|
+
defaultLight = LIGHT_THEMES[0];
|
|
672
720
|
}
|
|
673
721
|
|
|
674
722
|
const cssSource = getCssPath();
|
|
@@ -693,8 +741,9 @@ async function runAddToExisting(frameworkOverride) {
|
|
|
693
741
|
const linkHref = paths.linkHref;
|
|
694
742
|
console.log('\n✓ Rizzo CSS added to your existing project');
|
|
695
743
|
console.log(' - ' + cssTarget);
|
|
744
|
+
console.log('\nYou must add the stylesheet link yourself — it is not added automatically.');
|
|
696
745
|
if (framework === 'svelte') {
|
|
697
|
-
console.log('\
|
|
746
|
+
console.log('\nIn your root layout (e.g. src/app.html), add:');
|
|
698
747
|
console.log(' <link rel="stylesheet" href="' + linkHref + '" />');
|
|
699
748
|
console.log('\nSet a theme on <html>: data-theme="' + theme + '" (see: npx rizzo-css theme)');
|
|
700
749
|
console.log(' For theme "system": default dark ' + defaultDark + ', default light ' + defaultLight);
|
|
@@ -702,7 +751,7 @@ async function runAddToExisting(frameworkOverride) {
|
|
|
702
751
|
console.log(' Components are in src/lib/rizzo — import from \'$lib/rizzo\'.');
|
|
703
752
|
}
|
|
704
753
|
} else if (framework === 'astro') {
|
|
705
|
-
console.log('\
|
|
754
|
+
console.log('\nIn your layout (e.g. src/layouts/Layout.astro), add:');
|
|
706
755
|
console.log(' <link rel="stylesheet" href="' + linkHref + '" />');
|
|
707
756
|
console.log('\nSet a theme on <html>: data-theme="' + theme + '" (see: npx rizzo-css theme)');
|
|
708
757
|
console.log(' For theme "system": default dark ' + defaultDark + ', default light ' + defaultLight);
|
|
@@ -710,7 +759,7 @@ async function runAddToExisting(frameworkOverride) {
|
|
|
710
759
|
console.log(' Components are in src/components/rizzo — import from there.');
|
|
711
760
|
}
|
|
712
761
|
} else {
|
|
713
|
-
console.log('\
|
|
762
|
+
console.log('\nIn your HTML or layout, add:');
|
|
714
763
|
console.log(' <link rel="stylesheet" href="' + linkHref + '" />');
|
|
715
764
|
console.log('\nSet a theme on <html>: data-theme="' + theme + '" (see: npx rizzo-css theme)');
|
|
716
765
|
console.log(' For theme "system": default dark ' + defaultDark + ', default light ' + defaultLight);
|
|
@@ -752,28 +801,10 @@ async function cmdInit() {
|
|
|
752
801
|
|
|
753
802
|
const { theme, defaultDark, defaultLight } = await promptThemes();
|
|
754
803
|
|
|
755
|
-
let selectedComponents = [];
|
|
756
804
|
const componentList = framework === 'svelte' ? SVELTE_COMPONENTS : framework === 'astro' ? ASTRO_COMPONENTS : [];
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
[
|
|
761
|
-
{ value: 'none', label: 'None' },
|
|
762
|
-
{ value: 'pick', label: 'Yes, pick ' + includeLabel + ' components' },
|
|
763
|
-
],
|
|
764
|
-
'? Include ' + includeLabel + ' components?'
|
|
765
|
-
);
|
|
766
|
-
if (includeChoice === 'pick') {
|
|
767
|
-
selectedComponents = await multiSelectMenu(
|
|
768
|
-
[
|
|
769
|
-
{ value: SENTINEL_ALL, label: 'Select all components' },
|
|
770
|
-
{ value: SENTINEL_NONE, label: 'Select no components' },
|
|
771
|
-
...componentList.map((c) => ({ value: c, label: c })),
|
|
772
|
-
],
|
|
773
|
-
'? Components — pick individuals (Space to toggle) or choose Select all/none below. Enter=confirm'
|
|
774
|
-
);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
805
|
+
const selectedComponents = componentList.length > 0
|
|
806
|
+
? await promptComponentChoice(componentList, framework)
|
|
807
|
+
: [];
|
|
777
808
|
|
|
778
809
|
const projectDir = name ? join(process.cwd(), name) : process.cwd();
|
|
779
810
|
const cssSource = getCssPath();
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rizzo-css",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"scripts": {
|
|
5
|
-
"prepublishOnly": "cd ../.. && pnpm build:css && node scripts/copy-scaffold.js && node scripts/prepare-astro-scaffold.js && node scripts/prepare-vanilla-scaffold.js && node scripts/prepare-svelte-scaffold.js"
|
|
5
|
+
"prepublishOnly": "cd ../.. && pnpm run lint:css:fix && pnpm run build:css && node scripts/copy-scaffold.js && node scripts/prepare-astro-scaffold.js && node scripts/prepare-vanilla-scaffold.js && node scripts/prepare-svelte-scaffold.js"
|
|
6
6
|
},
|
|
7
7
|
"description": "A modern CSS design system with semantic theming, 14 themes, and accessible components (BEM). Use with Astro, Svelte, or any framework.",
|
|
8
8
|
"style": "dist/rizzo.min.css",
|