rizzo-css 0.0.22 → 0.0.23
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 +57 -21
- package/package.json +1 -1
- package/scaffold/astro-minimal/{RIZZO-README.md → README-RIZZO.md} +2 -2
- package/scaffold/astro-minimal/src/layouts/Layout.astro +1 -2
- package/scaffold/svelte-minimal/{RIZZO-README.md → README-RIZZO.md} +4 -4
- package/scaffold/vanilla/{RIZZO-README.md → README-RIZZO.md} +3 -3
- 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
|
@@ -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 in the package: `scaffold/vanilla/` (Full or Manual), `scaffold/astro-minimal/`, `scaffold/svelte-minimal/`, plus `scaffold/astro/` and `scaffold/svelte/` (component templates for hand-pick). Use `npx rizzo-css init` and choose **Create new project** to get a **Full** or **Manual** scaffold; the stylesheet link is in the layout. **Add to existing** (or `add` command) drops in CSS + hand-pick components; **you must add the stylesheet `<link>` yourself** — the CLI prints the exact tag. Every scaffold includes RIZZO
|
|
44
|
+
Scaffolds in the package: `scaffold/vanilla/` (Full or Manual), `scaffold/astro-minimal/`, `scaffold/svelte-minimal/`, plus `scaffold/astro/` and `scaffold/svelte/` (component templates for hand-pick). Use `npx rizzo-css init` and choose **Create new project** to get a **Full** or **Manual** scaffold; the stylesheet link is in the layout. **Add to existing** (or `add` command) drops in CSS + hand-pick components; **you must add the stylesheet `<link>` yourself** — the CLI prints the exact tag. Every scaffold includes LICENSE-RIZZO and README-RIZZO.md (does not overwrite your project LICENSE/README); Astro/Svelte minimal include package.json and .env.example.
|
|
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.23 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 -->
|
|
@@ -65,7 +65,7 @@ import 'rizzo-css';
|
|
|
65
65
|
|
|
66
66
|
Short URLs also work: `https://unpkg.com/rizzo-css@latest` and `https://cdn.jsdelivr.net/npm/rizzo-css@latest` (CDNs serve the default file from package.json). To verify after publish: open the URL in a browser or run `curl -I https://unpkg.com/rizzo-css@latest/dist/rizzo.min.css` and expect `200 OK`.
|
|
67
67
|
|
|
68
|
-
Use the same class names and HTML structure as in the [component docs](https://rizzo-css.vercel.app/docs/components). **Vanilla JS**, Astro, and Svelte all use the same CSS and BEM markup; Astro/Svelte add framework component files when you hand-pick. Each scaffold has RIZZO
|
|
68
|
+
Use the same class names and HTML structure as in the [component docs](https://rizzo-css.vercel.app/docs/components). **Vanilla JS**, Astro, and Svelte all use the same CSS and BEM markup; Astro/Svelte add framework component files when you hand-pick. Each scaffold has README-RIZZO.md; every install includes LICENSE-RIZZO. The **Navbar** component in the scaffold includes the default Cat logo in the brand link (optional `logo` prop for a custom image). The **Vanilla** Full includes a Settings panel and toast; **Astro** and **Svelte** Full scaffolds include theme persistence and toast (`showToast`, `removeToast`, `removeAllToasts`).
|
|
69
69
|
|
|
70
70
|
## Themes
|
|
71
71
|
|
package/bin/rizzo-css.js
CHANGED
|
@@ -7,9 +7,9 @@ const readline = require('readline');
|
|
|
7
7
|
|
|
8
8
|
const RIZZO_CONFIG_FILE = 'rizzo-css.json';
|
|
9
9
|
/** Scaffold README filename; avoids overwriting an existing project README.md. */
|
|
10
|
-
const SCAFFOLD_README_FILENAME = 'RIZZO
|
|
10
|
+
const SCAFFOLD_README_FILENAME = 'README-RIZZO.md';
|
|
11
11
|
/** Scaffold license filename; avoids overwriting an existing project LICENSE. */
|
|
12
|
-
const SCAFFOLD_LICENSE_FILENAME = 'RIZZO
|
|
12
|
+
const SCAFFOLD_LICENSE_FILENAME = 'LICENSE-RIZZO';
|
|
13
13
|
|
|
14
14
|
const COMMANDS = ['init', 'add', 'theme', 'help'];
|
|
15
15
|
const FRAMEWORKS = ['vanilla', 'astro', 'svelte'];
|
|
@@ -185,7 +185,30 @@ function copyRizzoCssAndFontsForAstro(projectDir, cssSource) {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
/**
|
|
188
|
+
/** SvelteKit only: copy rizzo.min.css to static/css with font URLs rewritten to /assets/fonts/, and copy fonts to static/assets/fonts. */
|
|
189
|
+
function copyRizzoCssAndFontsForSvelte(projectDir, cssSource) {
|
|
190
|
+
const cssDir = join(projectDir, 'static', 'css');
|
|
191
|
+
const cssTarget = join(cssDir, 'rizzo.min.css');
|
|
192
|
+
const fontsDest = join(projectDir, 'static', 'assets', 'fonts');
|
|
193
|
+
mkdirSync(cssDir, { recursive: true });
|
|
194
|
+
mkdirSync(fontsDest, { recursive: true });
|
|
195
|
+
copyFileSync(cssSource, cssTarget);
|
|
196
|
+
let css = readFileSync(cssTarget, 'utf8');
|
|
197
|
+
css = css.replace(/url\(['"]?\.\/fonts\//g, "url('/assets/fonts/");
|
|
198
|
+
writeFileSync(cssTarget, css, 'utf8');
|
|
199
|
+
const fontsSrc = join(getPackageRoot(), 'dist', 'fonts');
|
|
200
|
+
if (existsSync(fontsSrc)) {
|
|
201
|
+
const entries = readdirSync(fontsSrc, { withFileTypes: true });
|
|
202
|
+
for (const e of entries) {
|
|
203
|
+
const srcPath = join(fontsSrc, e.name);
|
|
204
|
+
const destPath = join(fontsDest, e.name);
|
|
205
|
+
if (e.isDirectory()) copyDirRecursive(srcPath, destPath);
|
|
206
|
+
else copyFileSync(srcPath, destPath);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** Copy the package LICENSE into the project dir as LICENSE-RIZZO so we do not overwrite an existing LICENSE. */
|
|
189
212
|
function copyPackageLicense(projectDir) {
|
|
190
213
|
const licensePath = join(getPackageRoot(), 'LICENSE');
|
|
191
214
|
if (existsSync(licensePath)) {
|
|
@@ -208,11 +231,17 @@ function readRizzoConfig(cwd) {
|
|
|
208
231
|
} catch (_) { return null; }
|
|
209
232
|
}
|
|
210
233
|
|
|
211
|
-
/** Write rizzo-css.json to cwd. config: { targetDir?, framework?, packageManager? }. */
|
|
234
|
+
/** Write rizzo-css.json to cwd. config: { targetDir?, framework?, packageManager? }. Preserves unknown keys from existing file. */
|
|
212
235
|
function writeRizzoConfig(cwd, config) {
|
|
213
236
|
if (!cwd || !existsSync(cwd)) return;
|
|
214
237
|
const configPath = join(cwd, RIZZO_CONFIG_FILE);
|
|
215
|
-
|
|
238
|
+
let obj = {};
|
|
239
|
+
if (existsSync(configPath)) {
|
|
240
|
+
try {
|
|
241
|
+
const raw = JSON.parse(readFileSync(configPath, 'utf8'));
|
|
242
|
+
if (raw && typeof raw === 'object') obj = { ...raw };
|
|
243
|
+
} catch (_) { /* ignore */ }
|
|
244
|
+
}
|
|
216
245
|
if (config.targetDir != null) obj.targetDir = config.targetDir;
|
|
217
246
|
if (config.framework != null) obj.framework = config.framework;
|
|
218
247
|
if (config.packageManager != null) obj.packageManager = config.packageManager;
|
|
@@ -611,6 +640,8 @@ function printHelp() {
|
|
|
611
640
|
console.log(`
|
|
612
641
|
rizzo-css CLI — Add Rizzo CSS to your project (Vanilla, Astro, Svelte)
|
|
613
642
|
|
|
643
|
+
Available commands: init, add, theme, help
|
|
644
|
+
|
|
614
645
|
Usage (use your package manager):
|
|
615
646
|
npx rizzo-css <command> [options]
|
|
616
647
|
pnpm dlx rizzo-css <command> [options]
|
|
@@ -757,12 +788,12 @@ function detectFramework(cwd) {
|
|
|
757
788
|
/**
|
|
758
789
|
* Framework-specific paths for CSS and static assets. Use these so fonts, sounds, images
|
|
759
790
|
* go in the right place per framework (Astro: public/, SvelteKit: static/, Vanilla: project root).
|
|
760
|
-
* - targetDir: where rizzo.min.css is copied. Fonts:
|
|
761
|
-
* - assetsRoot: root for static assets (Astro: public;
|
|
791
|
+
* - targetDir: where rizzo.min.css is copied. Fonts: Astro public/assets/fonts, Svelte static/assets/fonts (CLI rewrites URLs); Vanilla targetDir/fonts.
|
|
792
|
+
* - assetsRoot: root for static assets (Astro: public; Svelte: static; Vanilla: '').
|
|
762
793
|
*/
|
|
763
794
|
function getFrameworkCssPaths(framework) {
|
|
764
795
|
if (framework === 'svelte') {
|
|
765
|
-
return { targetDir: 'static/css', linkHref: '/css/rizzo.min.css', fontsDir: 'static/
|
|
796
|
+
return { targetDir: 'static/css', linkHref: '/css/rizzo.min.css', fontsDir: 'static/assets/fonts', assetsRoot: 'static' };
|
|
766
797
|
}
|
|
767
798
|
if (framework === 'astro') {
|
|
768
799
|
return { targetDir: 'public/css', linkHref: '/css/rizzo.min.css', fontsDir: 'public/assets/fonts', assetsRoot: 'public' };
|
|
@@ -1127,6 +1158,9 @@ async function runAddToExisting(frameworkOverride, options) {
|
|
|
1127
1158
|
if (framework === 'astro') {
|
|
1128
1159
|
copyRizzoCssAndFontsForAstro(cwd, cssSource);
|
|
1129
1160
|
cssTarget = join(cwd, 'public', 'css', 'rizzo.min.css');
|
|
1161
|
+
} else if (framework === 'svelte') {
|
|
1162
|
+
copyRizzoCssAndFontsForSvelte(cwd, cssSource);
|
|
1163
|
+
cssTarget = join(cwd, 'static', 'css', 'rizzo.min.css');
|
|
1130
1164
|
} else {
|
|
1131
1165
|
const targetDir = join(cwd, targetDirRaw);
|
|
1132
1166
|
cssTarget = join(targetDir, 'rizzo.min.css');
|
|
@@ -1146,7 +1180,7 @@ async function runAddToExisting(frameworkOverride, options) {
|
|
|
1146
1180
|
copyVanillaComponents(cwd, selectedComponents, vanillaRepl);
|
|
1147
1181
|
}
|
|
1148
1182
|
|
|
1149
|
-
const linkHref = (options && options.targetDir) ? getLinkHrefForTargetDir(framework, options.targetDir) : paths.linkHref;
|
|
1183
|
+
const linkHref = (framework === 'astro' || framework === 'svelte') ? paths.linkHref : ((options && options.targetDir) ? getLinkHrefForTargetDir(framework, options.targetDir) : paths.linkHref);
|
|
1150
1184
|
const pmFromOption = options && options.packageManager && VALID_PACKAGE_MANAGERS.includes(options.packageManager);
|
|
1151
1185
|
const pm = pmFromOption
|
|
1152
1186
|
? getPackageManagerCommands({ agent: options.packageManager, command: options.packageManager })
|
|
@@ -1154,7 +1188,8 @@ async function runAddToExisting(frameworkOverride, options) {
|
|
|
1154
1188
|
? getPackageManagerCommands({ agent: config.packageManager, command: config.packageManager })
|
|
1155
1189
|
: resolvePackageManager(cwd);
|
|
1156
1190
|
const cliExample = pm.dlx('rizzo-css theme');
|
|
1157
|
-
|
|
1191
|
+
const configTargetDir = framework === 'astro' ? 'public/css' : framework === 'svelte' ? 'static/css' : targetDirRaw;
|
|
1192
|
+
writeRizzoConfig(cwd, { targetDir: configTargetDir, framework, packageManager: pm.agent });
|
|
1158
1193
|
console.log('\n✓ Rizzo CSS added to your existing project');
|
|
1159
1194
|
console.log(' - ' + cssTarget);
|
|
1160
1195
|
console.log(' - Wrote ' + RIZZO_CONFIG_FILE);
|
|
@@ -1363,10 +1398,8 @@ async function cmdInit(argv) {
|
|
|
1363
1398
|
} else if (useHandpickSvelte) {
|
|
1364
1399
|
mkdirSync(projectDir, { recursive: true });
|
|
1365
1400
|
copyDirRecursiveWithReplacements(svelteMinimalDir, projectDir, replacements);
|
|
1366
|
-
|
|
1401
|
+
copyRizzoCssAndFontsForSvelte(projectDir, cssSource);
|
|
1367
1402
|
cssTarget = join(projectDir, 'static', 'css', 'rizzo.min.css');
|
|
1368
|
-
copyFileSync(cssSource, cssTarget);
|
|
1369
|
-
copyRizzoFonts(dirname(cssTarget));
|
|
1370
1403
|
if (statSync(cssTarget).size < 5000) {
|
|
1371
1404
|
console.warn('\nWarning: rizzo.min.css is very small. From repo root run: pnpm build:css');
|
|
1372
1405
|
}
|
|
@@ -1378,10 +1411,8 @@ async function cmdInit(argv) {
|
|
|
1378
1411
|
} else if (useSvelteBase) {
|
|
1379
1412
|
mkdirSync(projectDir, { recursive: true });
|
|
1380
1413
|
copyDirRecursiveWithReplacements(svelteMinimalDir, projectDir, replacements);
|
|
1381
|
-
|
|
1414
|
+
copyRizzoCssAndFontsForSvelte(projectDir, cssSource);
|
|
1382
1415
|
cssTarget = join(projectDir, 'static', 'css', 'rizzo.min.css');
|
|
1383
|
-
copyFileSync(cssSource, cssTarget);
|
|
1384
|
-
copyRizzoFonts(dirname(cssTarget));
|
|
1385
1416
|
if (statSync(cssTarget).size < 5000) {
|
|
1386
1417
|
console.warn('\nWarning: rizzo.min.css is very small. From repo root run: pnpm build:css');
|
|
1387
1418
|
}
|
|
@@ -1449,11 +1480,16 @@ async function cmdInit(argv) {
|
|
|
1449
1480
|
writeFileSync(join(projectDir, SCAFFOLD_README_FILENAME), VANILLA_MINIMAL_README, 'utf8');
|
|
1450
1481
|
copyPackageLicense(projectDir);
|
|
1451
1482
|
} else {
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1483
|
+
if (framework === 'svelte') {
|
|
1484
|
+
copyRizzoCssAndFontsForSvelte(projectDir, cssSource);
|
|
1485
|
+
cssTarget = join(projectDir, 'static', 'css', 'rizzo.min.css');
|
|
1486
|
+
} else {
|
|
1487
|
+
const cssDir = join(projectDir, pathsForScaffold.targetDir);
|
|
1488
|
+
cssTarget = join(cssDir, 'rizzo.min.css');
|
|
1489
|
+
mkdirSync(cssDir, { recursive: true });
|
|
1490
|
+
copyFileSync(cssSource, cssTarget);
|
|
1491
|
+
copyRizzoFonts(dirname(cssTarget));
|
|
1492
|
+
}
|
|
1457
1493
|
if (statSync(cssTarget).size < 5000) {
|
|
1458
1494
|
console.warn('\nWarning: rizzo.min.css is very small. From repo root run: pnpm build:css');
|
|
1459
1495
|
}
|
package/package.json
CHANGED
|
@@ -28,8 +28,8 @@ Minimal Astro project with Rizzo CSS. Scaffolded with `npx rizzo-css init --fram
|
|
|
28
28
|
- `src/pages/index.astro` — Home page
|
|
29
29
|
- `public/css/rizzo.min.css` — Rizzo CSS bundle (added by CLI; font URLs point to `/assets/fonts/`)
|
|
30
30
|
- `public/assets/fonts/` — Rizzo font files (added by CLI)
|
|
31
|
-
- `RIZZO
|
|
32
|
-
- `RIZZO
|
|
31
|
+
- `README-RIZZO.md` — This file (scaffold docs; does not replace your project README)
|
|
32
|
+
- `LICENSE-RIZZO` — Rizzo CSS license (does not replace your project LICENSE)
|
|
33
33
|
|
|
34
34
|
## Commands
|
|
35
35
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
/* Placeholders replaced by rizzo-css CLI when scaffolding */
|
|
3
|
+
/* {{THEME_LIST_COMMENT}} */
|
|
3
4
|
const DATA_THEME = '{{DATA_THEME}}';
|
|
4
|
-
const THEME_LIST_COMMENT = '{{THEME_LIST_COMMENT}}';
|
|
5
5
|
/** @type {{ title?: string }} */
|
|
6
6
|
const { title = '{{TITLE}}' } = Astro.props;
|
|
7
7
|
---
|
|
8
8
|
<!doctype html>
|
|
9
9
|
<html lang="en" data-theme={DATA_THEME}>
|
|
10
|
-
{THEME_LIST_COMMENT}
|
|
11
10
|
<head>
|
|
12
11
|
<meta charset="UTF-8" />
|
|
13
12
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
@@ -26,10 +26,10 @@ Minimal SvelteKit project with Rizzo CSS. Scaffolded with `npx rizzo-css init --
|
|
|
26
26
|
- `src/app.html` — HTML shell with Rizzo CSS and theme (edit `data-theme` for default)
|
|
27
27
|
- `src/routes/+layout.svelte` — Root layout
|
|
28
28
|
- `src/routes/+page.svelte` — Home page
|
|
29
|
-
- `static/css/rizzo.min.css` — Rizzo CSS bundle (added by CLI)
|
|
30
|
-
- `static/
|
|
31
|
-
- `RIZZO
|
|
32
|
-
- `RIZZO
|
|
29
|
+
- `static/css/rizzo.min.css` — Rizzo CSS bundle (added by CLI; font URLs point to `/assets/fonts/`)
|
|
30
|
+
- `static/assets/fonts/` — Rizzo font files (added by CLI)
|
|
31
|
+
- `README-RIZZO.md` — This file (scaffold docs; does not replace your project README)
|
|
32
|
+
- `LICENSE-RIZZO` — Rizzo CSS license (does not replace your project LICENSE)
|
|
33
33
|
|
|
34
34
|
## Commands
|
|
35
35
|
|
|
@@ -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.
|
|
16
|
+
(Replace `@latest` with a specific version, e.g. `@0.0.23`, 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
|
|
|
@@ -48,7 +48,7 @@ pnpm dlx serve .
|
|
|
48
48
|
|
|
49
49
|
## Other scaffolds
|
|
50
50
|
|
|
51
|
-
- **Astro:** `scaffold/astro-minimal/` — minimal Astro app; optional components from `scaffold/astro/` (see RIZZO
|
|
52
|
-
- **Svelte:** `scaffold/svelte-minimal/` — minimal SvelteKit app; optional components from `scaffold/svelte/` (see RIZZO
|
|
51
|
+
- **Astro:** `scaffold/astro-minimal/` — minimal Astro app; optional components from `scaffold/astro/` (see README-RIZZO.md).
|
|
52
|
+
- **Svelte:** `scaffold/svelte-minimal/` — minimal SvelteKit app; optional components from `scaffold/svelte/` (see README-RIZZO.md).
|
|
53
53
|
|
|
54
54
|
Docs: [rizzo-css.vercel.app](https://rizzo-css.vercel.app)
|