rizzo-css 0.0.19 → 0.0.20

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.
Files changed (36) hide show
  1. package/README.md +1 -1
  2. package/bin/rizzo-css.js +22 -13
  3. package/package.json +1 -1
  4. package/scaffold/astro/Navbar.astro +17 -0
  5. package/scaffold/astro/Search.astro +16 -0
  6. package/scaffold/astro/Settings.astro +13 -0
  7. package/scaffold/svelte/Navbar.svelte +27 -0
  8. package/scaffold/svelte/Search.svelte +41 -0
  9. package/scaffold/svelte/Settings.svelte +25 -0
  10. package/scaffold/vanilla/README.md +1 -1
  11. package/scaffold/vanilla/components/accordion.html +6 -0
  12. package/scaffold/vanilla/components/alert.html +6 -0
  13. package/scaffold/vanilla/components/avatar.html +6 -0
  14. package/scaffold/vanilla/components/badge.html +6 -0
  15. package/scaffold/vanilla/components/breadcrumb.html +6 -0
  16. package/scaffold/vanilla/components/button.html +6 -0
  17. package/scaffold/vanilla/components/cards.html +6 -0
  18. package/scaffold/vanilla/components/copy-to-clipboard.html +6 -0
  19. package/scaffold/vanilla/components/divider.html +6 -0
  20. package/scaffold/vanilla/components/dropdown.html +6 -0
  21. package/scaffold/vanilla/components/forms.html +6 -0
  22. package/scaffold/vanilla/components/icons.html +6 -0
  23. package/scaffold/vanilla/components/index.html +6 -0
  24. package/scaffold/vanilla/components/modal.html +6 -0
  25. package/scaffold/vanilla/components/navbar.html +6 -0
  26. package/scaffold/vanilla/components/pagination.html +6 -0
  27. package/scaffold/vanilla/components/progress-bar.html +6 -0
  28. package/scaffold/vanilla/components/search.html +6 -0
  29. package/scaffold/vanilla/components/settings.html +6 -0
  30. package/scaffold/vanilla/components/spinner.html +6 -0
  31. package/scaffold/vanilla/components/table.html +6 -0
  32. package/scaffold/vanilla/components/tabs.html +6 -0
  33. package/scaffold/vanilla/components/theme-switcher.html +6 -0
  34. package/scaffold/vanilla/components/toast.html +6 -0
  35. package/scaffold/vanilla/components/tooltip.html +6 -0
  36. package/scaffold/vanilla/index.html +6 -0
package/README.md CHANGED
@@ -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.19 or any version) -->
59
+ <!-- unpkg (pin version: replace @latest with @0.0.20 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
@@ -91,12 +91,14 @@ const SVELTE_COMPONENTS = [
91
91
  'Breadcrumb', 'FormGroup', 'Input', 'Checkbox', 'Textarea', 'Select', 'Radio',
92
92
  'CopyToClipboard', 'Tooltip', 'Pagination', 'Tabs', 'Accordion', 'Dropdown',
93
93
  'Modal', 'Toast', 'Table', 'ThemeSwitcher',
94
+ 'Navbar', 'Settings', 'Search', 'Icons',
94
95
  ];
95
96
  const ASTRO_COMPONENTS = [
96
97
  'Button', 'Badge', 'Card', 'Divider', 'Spinner', 'ProgressBar', 'Avatar', 'Alert',
97
98
  'Breadcrumb', 'FormGroup', 'Input', 'Checkbox', 'Textarea', 'Select', 'Radio',
98
99
  'CopyToClipboard', 'Tooltip', 'Pagination', 'Tabs', 'Accordion', 'Dropdown',
99
100
  'Modal', 'Toast', 'Table', 'ThemeSwitcher',
101
+ 'Navbar', 'Settings', 'Search', 'Icons',
100
102
  ];
101
103
 
102
104
  // Recommended subset for Full/Minimal (same for Astro, Svelte, Vanilla)
@@ -104,13 +106,14 @@ const RECOMMENDED_COMPONENTS = [
104
106
  'Button', 'Badge', 'Card', 'Modal', 'Tabs', 'ThemeSwitcher', 'FormGroup', 'Alert', 'Toast', 'Dropdown',
105
107
  ];
106
108
 
107
- // Vanilla scaffold: component name (same as ASTRO_COMPONENTS) -> components/*.html slug
109
+ // Vanilla scaffold: component name (same as ASTRO_COMPONENTS) -> components/*.html slug. Navbar, Settings, Search, Icons are vanilla-only.
108
110
  const VANILLA_COMPONENT_SLUGS = {
109
111
  Button: 'button', Badge: 'badge', Card: 'cards', Divider: 'divider', Spinner: 'spinner', ProgressBar: 'progress-bar',
110
112
  Avatar: 'avatar', Alert: 'alert', Breadcrumb: 'breadcrumb', FormGroup: 'forms', Input: 'forms', Checkbox: 'forms',
111
113
  Textarea: 'forms', Select: 'forms', Radio: 'forms', CopyToClipboard: 'copy-to-clipboard', Tooltip: 'tooltip',
112
114
  Pagination: 'pagination', Tabs: 'tabs', Accordion: 'accordion', Dropdown: 'dropdown', Modal: 'modal',
113
115
  Toast: 'toast', Table: 'table', ThemeSwitcher: 'theme-switcher',
116
+ Navbar: 'navbar', Settings: 'settings', Search: 'search', Icons: 'icons',
114
117
  };
115
118
 
116
119
  // ANSI colors for CLI (framework logo colors)
@@ -867,8 +870,9 @@ function copySvelteComponents(projectDir, selectedNames) {
867
870
  }
868
871
  const files = readdirSync(scaffoldDir);
869
872
  const available = files.filter((f) => f.endsWith('.svelte')).map((f) => f.replace('.svelte', ''));
870
- const toCopy = selectedNames.filter((n) => available.includes(n));
871
- if (toCopy.length === 0) {
873
+ const toCopy = selectedNames.filter((n) => n !== 'Icons' && available.includes(n));
874
+ const copyIconsOnly = selectedNames.includes('Icons') && toCopy.length === 0;
875
+ if (toCopy.length === 0 && !copyIconsOnly) {
872
876
  console.log('\n No matching component files in scaffold; use CSS only or copy from repo.');
873
877
  return;
874
878
  }
@@ -883,7 +887,7 @@ function copySvelteComponents(projectDir, selectedNames) {
883
887
  }
884
888
  }
885
889
  const iconsSrc = join(scaffoldDir, 'icons');
886
- if (existsSync(iconsSrc)) {
890
+ if (existsSync(iconsSrc) && (toCopy.length > 0 || copyIconsOnly)) {
887
891
  copyDirRecursive(iconsSrc, join(targetDir, 'icons'));
888
892
  }
889
893
  if (toCopy.includes('ThemeSwitcher')) {
@@ -892,10 +896,13 @@ function copySvelteComponents(projectDir, selectedNames) {
892
896
  if (existsSync(themesSrc)) copyFileSync(themesSrc, join(targetDir, 'themes.ts'));
893
897
  if (existsSync(themeSrc)) copyFileSync(themeSrc, join(targetDir, 'theme.ts'));
894
898
  }
895
- if (exports.length > 0) {
896
- const indexContent = `/** Rizzo CSS Svelte components — selected via npx rizzo-css init */\n${exports.join('\n')}\n`;
897
- writeFileSync(join(targetDir, 'index.ts'), indexContent, 'utf8');
898
- console.log('\n ✓ ' + exports.length + ' Svelte components copied to ' + targetDir + (existsSync(iconsSrc) ? ' + icons' : ''));
899
+ if (exports.length > 0 || copyIconsOnly) {
900
+ if (exports.length > 0) {
901
+ const indexContent = `/** Rizzo CSS Svelte components — selected via npx rizzo-css init */\n${exports.join('\n')}\n`;
902
+ writeFileSync(join(targetDir, 'index.ts'), indexContent, 'utf8');
903
+ }
904
+ const msg = copyIconsOnly ? 'Icons' : exports.length + ' Svelte components' + (existsSync(iconsSrc) ? ' + icons' : '');
905
+ console.log('\n ✓ ' + msg + ' copied to ' + targetDir);
899
906
  console.log(' Import in your app: import { Button, Badge, ... } from \'$lib/rizzo\';\n');
900
907
  }
901
908
  }
@@ -908,8 +915,9 @@ function copyAstroComponents(projectDir, selectedNames) {
908
915
  }
909
916
  const files = readdirSync(scaffoldDir).filter((f) => f.endsWith('.astro'));
910
917
  const available = files.map((f) => f.replace('.astro', ''));
911
- const toCopy = selectedNames.filter((n) => available.includes(n));
912
- if (toCopy.length === 0) {
918
+ const toCopy = selectedNames.filter((n) => n !== 'Icons' && available.includes(n));
919
+ const copyIconsOnly = selectedNames.includes('Icons') && toCopy.length === 0;
920
+ if (toCopy.length === 0 && !copyIconsOnly) {
913
921
  console.log('\n No matching Astro components in scaffold; use CSS only or copy from repo.');
914
922
  return;
915
923
  }
@@ -924,7 +932,7 @@ function copyAstroComponents(projectDir, selectedNames) {
924
932
  }
925
933
  }
926
934
  const iconsSrc = join(scaffoldDir, 'icons');
927
- if (existsSync(iconsSrc)) {
935
+ if (existsSync(iconsSrc) && (toCopy.length > 0 || copyIconsOnly)) {
928
936
  copyDirRecursive(iconsSrc, join(targetDir, 'icons'));
929
937
  }
930
938
  if (toCopy.includes('ThemeSwitcher')) {
@@ -933,8 +941,9 @@ function copyAstroComponents(projectDir, selectedNames) {
933
941
  copyFileSync(themesSrc, join(targetDir, 'themes.ts'));
934
942
  }
935
943
  }
936
- if (count > 0) {
937
- console.log('\n ✓ ' + count + ' Astro components + icons copied to ' + targetDir);
944
+ if (count > 0 || copyIconsOnly) {
945
+ const msg = copyIconsOnly ? 'Icons' : count + ' Astro components + icons';
946
+ console.log('\n ✓ ' + msg + ' copied to ' + targetDir);
938
947
  console.log(' Import in your pages: import Button from \'../components/rizzo/Button.astro\';\n');
939
948
  }
940
949
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rizzo-css",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "scripts": {
5
5
  "prepublishOnly": "cd ../.. && pnpm run lint:css:fix && pnpm run build:css && node scripts/copy-scaffold.js && node scripts/prepare-vanilla-scaffold.js"
6
6
  },
@@ -0,0 +1,17 @@
1
+ ---
2
+ interface Props { siteName?: string; }
3
+ const { siteName = 'Site' } = Astro.props;
4
+ ---
5
+ <nav class="navbar" role="navigation" aria-label="Main navigation">
6
+ <div class="navbar__container">
7
+ <div class="navbar__brand">
8
+ <a href="/" class="navbar__brand-link">{siteName}</a>
9
+ </div>
10
+ <button type="button" class="navbar__toggle" aria-label="Toggle menu" aria-expanded="false">
11
+ <span class="navbar__toggle-icon" aria-hidden="true"><span></span><span></span><span></span></span>
12
+ </button>
13
+ <div class="navbar__menu" aria-hidden="true">
14
+ <a href="/" class="navbar__link">Home</a>
15
+ </div>
16
+ </div>
17
+ </nav>
@@ -0,0 +1,16 @@
1
+ ---
2
+ interface Props { id?: string; }
3
+ const { id = 'search-main' } = Astro.props;
4
+ ---
5
+ <div class="search" data-search>
6
+ <div class="search__trigger-wrapper">
7
+ <button type="button" class="search__trigger" aria-label="Open search" aria-expanded="false" aria-controls="{id}-panel">
8
+ <span class="search__trigger-text">Search</span>
9
+ </button>
10
+ </div>
11
+ <div class="search__overlay" id="{id}-panel" aria-hidden="true" role="dialog" aria-modal="true" data-search-overlay>
12
+ <div class="search__panel">
13
+ <input type="search" class="search__input" placeholder="Search…" aria-label="Search" />
14
+ </div>
15
+ </div>
16
+ </div>
@@ -0,0 +1,13 @@
1
+ ---
2
+ interface Props {}
3
+ ---
4
+ <div class="settings" data-settings aria-hidden="true">
5
+ <div class="settings__overlay" data-settings-overlay aria-hidden="true"></div>
6
+ <div class="settings__panel" role="dialog" aria-modal="true" aria-labelledby="settings-title" aria-hidden="true">
7
+ <div class="settings__header">
8
+ <h2 id="settings-title" class="settings__title">Settings</h2>
9
+ <button type="button" class="settings__close" data-settings-close aria-label="Close">×</button>
10
+ </div>
11
+ <div class="settings__content"><p>Theme, font size, and accessibility options. Wire to your state and <code>window.openSettings</code>.</p></div>
12
+ </div>
13
+ </div>
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ interface Props {
3
+ siteName?: string;
4
+ }
5
+ let { siteName = 'Site' }: Props = $props();
6
+ let menuOpen = $state(false);
7
+ </script>
8
+
9
+ <nav class="navbar" role="navigation" aria-label="Main navigation">
10
+ <div class="navbar__container">
11
+ <div class="navbar__brand">
12
+ <a href="/" class="navbar__brand-link">{siteName}</a>
13
+ </div>
14
+ <button
15
+ type="button"
16
+ class="navbar__toggle"
17
+ aria-label="Toggle menu"
18
+ aria-expanded={menuOpen}
19
+ onclick={() => (menuOpen = !menuOpen)}
20
+ >
21
+ <span class="navbar__toggle-icon" aria-hidden="true"><span></span><span></span><span></span></span>
22
+ </button>
23
+ <div class="navbar__menu" class:navbar__menu--open={menuOpen} aria-hidden={!menuOpen}>
24
+ <a href="/" class="navbar__link">Home</a>
25
+ </div>
26
+ </div>
27
+ </nav>
@@ -0,0 +1,41 @@
1
+ <script lang="ts">
2
+ interface Props {
3
+ id?: string;
4
+ }
5
+ let { id = 'search-main' }: Props = $props();
6
+ let open = $state(false);
7
+ let query = $state('');
8
+ </script>
9
+
10
+ <div class="search" data-search>
11
+ <div class="search__trigger-wrapper">
12
+ <button
13
+ type="button"
14
+ class="search__trigger"
15
+ aria-label="Open search"
16
+ aria-expanded={open}
17
+ aria-controls="{id}-panel"
18
+ onclick={() => (open = !open)}
19
+ >
20
+ <span class="search__trigger-text">Search</span>
21
+ </button>
22
+ </div>
23
+ <div
24
+ class="search__overlay"
25
+ id="{id}-panel"
26
+ aria-hidden={!open}
27
+ role="dialog"
28
+ aria-modal="true"
29
+ data-search-overlay
30
+ >
31
+ <div class="search__panel">
32
+ <input
33
+ type="search"
34
+ class="search__input"
35
+ placeholder="Search…"
36
+ aria-label="Search"
37
+ bind:value={query}
38
+ />
39
+ </div>
40
+ </div>
41
+ </div>
@@ -0,0 +1,25 @@
1
+ <script lang="ts">
2
+ interface Props {
3
+ open?: boolean;
4
+ }
5
+ let { open = false }: Props = $props();
6
+ </script>
7
+
8
+ <div class="settings" data-settings aria-hidden={!open}>
9
+ <div class="settings__overlay" data-settings-overlay aria-hidden={!open}></div>
10
+ <div
11
+ class="settings__panel"
12
+ role="dialog"
13
+ aria-modal="true"
14
+ aria-labelledby="settings-title"
15
+ aria-hidden={!open}
16
+ >
17
+ <div class="settings__header">
18
+ <h2 id="settings-title" class="settings__title">Settings</h2>
19
+ <button type="button" class="settings__close" data-settings-close aria-label="Close">×</button>
20
+ </div>
21
+ <div class="settings__content">
22
+ <p>Theme, font size, and accessibility options. Wire to your state and <code>window.openSettings</code>.</p>
23
+ </div>
24
+ </div>
25
+ </div>
@@ -13,7 +13,7 @@ If you prefer to load CSS from a CDN instead of the local file, replace the `<li
13
13
  - `<link rel="stylesheet" href="https://unpkg.com/rizzo-css@latest/dist/rizzo.min.css" />`
14
14
  - Or jsDelivr: `https://cdn.jsdelivr.net/npm/rizzo-css@latest/dist/rizzo.min.css`
15
15
 
16
- (Replace `@latest` with a specific version, e.g. `@0.0.19`, in production.)
16
+ (Replace `@latest` with a specific version, e.g. `@0.0.20`, in production.)
17
17
 
18
18
  The CLI replaces placeholders in `index.html` (e.g. `{{DATA_THEME}}`, `{{TITLE}}`) when you run `rizzo-css init`. The theme selected during init is used on first load when you have no saved preference in the browser.
19
19