rizzo-css 0.0.15 → 0.0.17
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 +381 -120
- package/dist/rizzo.min.css +8 -5
- package/package.json +3 -2
- package/scaffold/astro/ThemeIcon.astro +50 -0
- package/scaffold/astro-app/src/components/CliCommandTabs.astro +90 -0
- package/scaffold/astro-app/src/components/PackageInstallTabs.astro +87 -0
- package/scaffold/astro-app/src/components/ThemeIcon.astro +50 -0
- package/scaffold/astro-app/src/pages/components/theme-switcher.astro +1 -0
- package/scaffold/svelte/ThemeIcon.svelte +54 -0
- package/scaffold/svelte/index.ts +2 -0
- package/scaffold/svelte-app/src/lib/rizzo/ThemeIcon.svelte +54 -0
- package/scaffold/svelte-app/src/lib/rizzo/index.ts +2 -0
- package/scaffold/svelte-app/src/lib/rizzo-docs/pages/ThemeSwitcherDoc.svelte +8 -0
- package/scaffold/vanilla/README.md +1 -1
- package/scaffold/vanilla/components/accordion.html +16 -0
- package/scaffold/vanilla/components/alert.html +16 -0
- package/scaffold/vanilla/components/avatar.html +16 -0
- package/scaffold/vanilla/components/badge.html +16 -0
- package/scaffold/vanilla/components/breadcrumb.html +16 -0
- package/scaffold/vanilla/components/button.html +16 -0
- package/scaffold/vanilla/components/cards.html +16 -0
- package/scaffold/vanilla/components/copy-to-clipboard.html +16 -0
- package/scaffold/vanilla/components/divider.html +16 -0
- package/scaffold/vanilla/components/dropdown.html +16 -0
- package/scaffold/vanilla/components/forms.html +16 -0
- package/scaffold/vanilla/components/icons.html +16 -0
- package/scaffold/vanilla/components/index.html +16 -0
- package/scaffold/vanilla/components/modal.html +16 -0
- package/scaffold/vanilla/components/navbar.html +16 -0
- package/scaffold/vanilla/components/pagination.html +16 -0
- package/scaffold/vanilla/components/progress-bar.html +16 -0
- package/scaffold/vanilla/components/search.html +16 -0
- package/scaffold/vanilla/components/settings.html +16 -0
- package/scaffold/vanilla/components/spinner.html +16 -0
- package/scaffold/vanilla/components/table.html +16 -0
- package/scaffold/vanilla/components/tabs.html +16 -0
- package/scaffold/vanilla/components/theme-switcher.html +16 -0
- package/scaffold/vanilla/components/toast.html +16 -0
- package/scaffold/vanilla/components/tooltip.html +16 -0
- package/scaffold/vanilla/index.html +16 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Tabs from './Tabs.astro';
|
|
3
|
+
import CodeBlock from './CodeBlock.astro';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
/** Package name to install, e.g. "rizzo-css" */
|
|
7
|
+
packageName?: string;
|
|
8
|
+
/** Optional default tab id (npm, pnpm, yarn, bun) */
|
|
9
|
+
defaultTab?: string;
|
|
10
|
+
/** Optional class for the wrapper */
|
|
11
|
+
class?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const { packageName = 'rizzo-css', defaultTab = 'npm', class: className = '' } = Astro.props;
|
|
15
|
+
|
|
16
|
+
const commands = {
|
|
17
|
+
npm: `npm install ${packageName}`,
|
|
18
|
+
pnpm: `pnpm add ${packageName}`,
|
|
19
|
+
yarn: `yarn add ${packageName}`,
|
|
20
|
+
bun: `bun add ${packageName}`,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const tabs = [
|
|
24
|
+
{ id: 'npm', label: 'npm' },
|
|
25
|
+
{ id: 'pnpm', label: 'pnpm' },
|
|
26
|
+
{ id: 'yarn', label: 'yarn' },
|
|
27
|
+
{ id: 'bun', label: 'bun' },
|
|
28
|
+
];
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<div class={`package-install-tabs ${className}`.trim()} data-package={packageName}>
|
|
32
|
+
<p class="package-install-tabs__hint">Choose your package manager — click a tab to select, then copy the command.</p>
|
|
33
|
+
<Tabs tabs={tabs} defaultTab={defaultTab} id={`pkg-tabs-${packageName.replace(/\s+/g, '-')}`} class="package-install-tabs__tabs">
|
|
34
|
+
<div class="package-install-tabs__panel">
|
|
35
|
+
<CodeBlock code={commands.npm} language="bash" />
|
|
36
|
+
</div>
|
|
37
|
+
<div class="package-install-tabs__panel">
|
|
38
|
+
<CodeBlock code={commands.pnpm} language="bash" />
|
|
39
|
+
</div>
|
|
40
|
+
<div class="package-install-tabs__panel">
|
|
41
|
+
<CodeBlock code={commands.yarn} language="bash" />
|
|
42
|
+
</div>
|
|
43
|
+
<div class="package-install-tabs__panel">
|
|
44
|
+
<CodeBlock code={commands.bun} language="bash" />
|
|
45
|
+
</div>
|
|
46
|
+
</Tabs>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<style>
|
|
50
|
+
.package-install-tabs {
|
|
51
|
+
margin: var(--spacing-2) 0;
|
|
52
|
+
}
|
|
53
|
+
.package-install-tabs__hint {
|
|
54
|
+
font-size: var(--font-size-sm);
|
|
55
|
+
color: var(--text-dim);
|
|
56
|
+
margin-bottom: var(--spacing-1);
|
|
57
|
+
}
|
|
58
|
+
.package-install-tabs__tabs {
|
|
59
|
+
margin-top: 0;
|
|
60
|
+
}
|
|
61
|
+
.package-install-tabs :global(.tabs__list) {
|
|
62
|
+
overflow-x: visible;
|
|
63
|
+
overflow-y: visible;
|
|
64
|
+
flex-wrap: nowrap;
|
|
65
|
+
scrollbar-width: none;
|
|
66
|
+
margin-bottom: var(--spacing-2);
|
|
67
|
+
}
|
|
68
|
+
.package-install-tabs :global(.tabs__list)::-webkit-scrollbar {
|
|
69
|
+
display: none;
|
|
70
|
+
}
|
|
71
|
+
.package-install-tabs :global(.tabs__panel) {
|
|
72
|
+
padding: 0;
|
|
73
|
+
min-height: 0;
|
|
74
|
+
}
|
|
75
|
+
.package-install-tabs__panel {
|
|
76
|
+
padding-top: var(--spacing-1);
|
|
77
|
+
}
|
|
78
|
+
.package-install-tabs__panel :global(.code-block) {
|
|
79
|
+
margin: 0;
|
|
80
|
+
}
|
|
81
|
+
.package-install-tabs__panel :global(.code-block__header) {
|
|
82
|
+
padding: var(--spacing-1) var(--spacing-2);
|
|
83
|
+
}
|
|
84
|
+
.package-install-tabs__panel :global(.code-block pre) {
|
|
85
|
+
padding: var(--spacing-2);
|
|
86
|
+
}
|
|
87
|
+
</style>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ThemeIconKey } from '../config/themes';
|
|
3
|
+
import { ALL_THEMES } from '../config/themes';
|
|
4
|
+
import Owl from './icons/Owl.astro';
|
|
5
|
+
import Palette from './icons/Palette.astro';
|
|
6
|
+
import Flame from './icons/Flame.astro';
|
|
7
|
+
import Sunset from './icons/Sunset.astro';
|
|
8
|
+
import Zap from './icons/Zap.astro';
|
|
9
|
+
import Shield from './icons/Shield.astro';
|
|
10
|
+
import Heart from './icons/Heart.astro';
|
|
11
|
+
import Sun from './icons/Sun.astro';
|
|
12
|
+
import Cake from './icons/Cake.astro';
|
|
13
|
+
import Lemon from './icons/Lemon.astro';
|
|
14
|
+
import Rainbow from './icons/Rainbow.astro';
|
|
15
|
+
import Leaf from './icons/Leaf.astro';
|
|
16
|
+
import Cherry from './icons/Cherry.astro';
|
|
17
|
+
import Brush from './icons/Brush.astro';
|
|
18
|
+
|
|
19
|
+
const iconMap: Record<ThemeIconKey, typeof Owl> = {
|
|
20
|
+
gear: Owl, // fallback; theme pages don't use 'gear'
|
|
21
|
+
owl: Owl,
|
|
22
|
+
palette: Palette,
|
|
23
|
+
flame: Flame,
|
|
24
|
+
sunset: Sunset,
|
|
25
|
+
zap: Zap,
|
|
26
|
+
shield: Shield,
|
|
27
|
+
heart: Heart,
|
|
28
|
+
sun: Sun,
|
|
29
|
+
cake: Cake,
|
|
30
|
+
lemon: Lemon,
|
|
31
|
+
rainbow: Rainbow,
|
|
32
|
+
leaf: Leaf,
|
|
33
|
+
cherry: Cherry,
|
|
34
|
+
brush: Brush,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
interface Props {
|
|
38
|
+
themeId: string;
|
|
39
|
+
size?: number;
|
|
40
|
+
class?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const { themeId, size = 24, class: className = '' } = Astro.props;
|
|
44
|
+
const theme = ALL_THEMES.find((t) => t.value === themeId);
|
|
45
|
+
const IconComponent = theme ? iconMap[theme.iconKey] : null;
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
{IconComponent ? (
|
|
49
|
+
<IconComponent width={size} height={size} class={className} />
|
|
50
|
+
) : null}
|
|
@@ -63,6 +63,7 @@ import ThemeSwitcher from '../../components/ThemeSwitcher.astro';
|
|
|
63
63
|
<li>Constants: <code>THEME_SYSTEM</code>, <code>DEFAULT_THEME_DARK</code>, <code>DEFAULT_THEME_LIGHT</code>.</li>
|
|
64
64
|
</ul>
|
|
65
65
|
<p><strong>Theme IDs:</strong> Run <code>npx rizzo-css theme</code> to list all 14 ids, or see <a href="/docs/theming#available-themes">Theming – Available themes</a>. To sync a custom UI when the theme changes elsewhere, listen for the <code>rizzo-theme-change</code> event.</p>
|
|
66
|
+
<p><strong>ThemeIcon:</strong> To show the same icon as the switcher elsewhere (e.g. theme pages, cards), use <strong>Astro</strong> <code><ThemeIcon themeId="github-dark-classic" size={24} /></code> or <strong>Svelte</strong> <code><ThemeIcon themeId="github-dark-classic" size={24} /></code>. Props: <code>themeId</code>, optional <code>size</code> (default 24), optional <code>class</code>. Vanilla: use the icon SVGs from the Icons section and map theme id to icon via <code>themes.ts</code> <code>iconKey</code>.</p>
|
|
66
67
|
<p><strong>Svelte & Vanilla:</strong> <a href="/docs/svelte/components/theme-switcher">Svelte</a> (live Svelte component) · <a href="/docs/vanilla/components/theme-switcher">Vanilla</a> (live example + copyable HTML). Or use theme utilities (<code>applyTheme</code>, <code>getThemeLabel</code>) and see <a href="/docs/theming#building-your-own-theme-switcher">Building your own theme switcher</a>.</p>
|
|
67
68
|
</section>
|
|
68
69
|
</DocsLayout>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
themeId: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
class?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let { themeId, size = 24, class: className = '' }: Props = $props();
|
|
9
|
+
|
|
10
|
+
/** Same icon SVGs as ThemeSwitcher (one per theme). */
|
|
11
|
+
const THEME_ICON_SVG: Record<string, string> = {
|
|
12
|
+
'github-dark-classic':
|
|
13
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M16 7h.01" /><path d="M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20" /><path d="m20 7 2 .5-2 .5" /><path d="M10 18v3" /><path d="M14 17.75V21" /><path d="M7 18a6 6 0 0 0 3.84-10.61" /></svg>',
|
|
14
|
+
'github-light':
|
|
15
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41" /></svg>',
|
|
16
|
+
'red-velvet-cupcake':
|
|
17
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8" /><path d="M4 16s1-1 4-1 5 2 8 2 4-1 4-1V4" /><path d="M2 16v4M22 16v4M8 8h.01M16 8h.01M8 12h.01M16 12h.01" /></svg>',
|
|
18
|
+
'orangy-one-light':
|
|
19
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15.5 6.5c.5-2.5 2.5-4 5-4 1.5 0 2.5.5 3 1" /><path d="M12 12c-2 2-3 4-3 6 0 3 2 5 5 5 2 0 4-1 6-3" /><path d="M18 12c2 2 3 4 3 6 0 3-2 5-5 5-2 0-4-1-6-3" /></svg>',
|
|
20
|
+
sunflower:
|
|
21
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 17a10 10 0 0 0-20 0" /><path d="M6 17a6 6 0 0 1 12 0" /><path d="M10 17a2 2 0 0 1 4 0" /></svg>',
|
|
22
|
+
'shades-of-purple':
|
|
23
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25"/><path d="M7.5 10.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"/><path d="M11.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"/><path d="M15.5 10.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"/></svg>',
|
|
24
|
+
'sandstorm-classic':
|
|
25
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z" /></svg>',
|
|
26
|
+
'rocky-blood-orange':
|
|
27
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 10V2M4.93 10.93l1.41 1.41M2 18h2M20 18h2M17.66 10.93l1.41-1.41M22 22H2M8 6l4-4 4 4M16 18a4 4 0 0 0-8 0" /><path d="M12 22v-4" /></svg>',
|
|
28
|
+
'minimal-dark-neon-yellow':
|
|
29
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13 2 3 14h9l-1 8 10-12h-9l1-8z" /></svg>',
|
|
30
|
+
'hack-the-box':
|
|
31
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" /></svg>',
|
|
32
|
+
'green-breeze-light':
|
|
33
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z" /><path d="M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12" /></svg>',
|
|
34
|
+
'pink-cat-boo':
|
|
35
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19.5 12.572l-7.5 7.428l-7.5 -7.428a5 5 0 1 1 7.5 -6.566a5 5 0 1 1 7.5 6.572" /></svg>',
|
|
36
|
+
'cute-pink':
|
|
37
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 18c0-2 1.5-4 4-4s4 2 4 4c0 2-1.5 4-4 4s-4-2-4-4Z" /><path d="M15 18c0-2 1.5-4 4-4s4 2 4 4c0 2-1.5 4-4 4s-4-2-4-4Z" /><path d="M12 8v4M10 10l-2 2M14 10l2 2" /></svg>',
|
|
38
|
+
'semi-light-purple':
|
|
39
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08" /><path d="M7.87 14.14c-.32.32-.67.68-1.06 1.06a5.04 5.04 0 0 1-2.17 1.22c-.47.15-.85.2-1.15.2-.16 0-.3-.02-.41-.03a1 1 0 0 1-.63-.97c-.01-.14.02-.31.07-.51.1-.41.3-.95.6-1.59.3-.64.67-1.33 1.08-2.05" /></svg>',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const iconSvg = $derived(THEME_ICON_SVG[themeId] ?? null);
|
|
43
|
+
const sizedSvg = $derived(
|
|
44
|
+
iconSvg
|
|
45
|
+
? iconSvg.replace(/width="16"/, `width="${size}"`).replace(/height="16"/, `height="${size}"`)
|
|
46
|
+
: null
|
|
47
|
+
);
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
{#if sizedSvg}
|
|
51
|
+
<span class={className} style="display: inline-flex; vertical-align: middle;">
|
|
52
|
+
{@html sizedSvg}
|
|
53
|
+
</span>
|
|
54
|
+
{/if}
|
package/scaffold/svelte/index.ts
CHANGED
|
@@ -31,3 +31,5 @@ export { default as Modal } from './Modal.svelte';
|
|
|
31
31
|
export { default as Toast } from './Toast.svelte';
|
|
32
32
|
export { default as Table } from './Table.svelte';
|
|
33
33
|
export type { TableColumn } from './Table.svelte';
|
|
34
|
+
export { default as ThemeIcon } from './ThemeIcon.svelte';
|
|
35
|
+
export { default as ThemeSwitcher } from './ThemeSwitcher.svelte';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
themeId: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
class?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let { themeId, size = 24, class: className = '' }: Props = $props();
|
|
9
|
+
|
|
10
|
+
/** Same icon SVGs as ThemeSwitcher (one per theme). */
|
|
11
|
+
const THEME_ICON_SVG: Record<string, string> = {
|
|
12
|
+
'github-dark-classic':
|
|
13
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M16 7h.01" /><path d="M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20" /><path d="m20 7 2 .5-2 .5" /><path d="M10 18v3" /><path d="M14 17.75V21" /><path d="M7 18a6 6 0 0 0 3.84-10.61" /></svg>',
|
|
14
|
+
'github-light':
|
|
15
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41" /></svg>',
|
|
16
|
+
'red-velvet-cupcake':
|
|
17
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8" /><path d="M4 16s1-1 4-1 5 2 8 2 4-1 4-1V4" /><path d="M2 16v4M22 16v4M8 8h.01M16 8h.01M8 12h.01M16 12h.01" /></svg>',
|
|
18
|
+
'orangy-one-light':
|
|
19
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15.5 6.5c.5-2.5 2.5-4 5-4 1.5 0 2.5.5 3 1" /><path d="M12 12c-2 2-3 4-3 6 0 3 2 5 5 5 2 0 4-1 6-3" /><path d="M18 12c2 2 3 4 3 6 0 3-2 5-5 5-2 0-4-1-6-3" /></svg>',
|
|
20
|
+
sunflower:
|
|
21
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 17a10 10 0 0 0-20 0" /><path d="M6 17a6 6 0 0 1 12 0" /><path d="M10 17a2 2 0 0 1 4 0" /></svg>',
|
|
22
|
+
'shades-of-purple':
|
|
23
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25"/><path d="M7.5 10.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"/><path d="M11.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"/><path d="M15.5 10.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"/></svg>',
|
|
24
|
+
'sandstorm-classic':
|
|
25
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z" /></svg>',
|
|
26
|
+
'rocky-blood-orange':
|
|
27
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 10V2M4.93 10.93l1.41 1.41M2 18h2M20 18h2M17.66 10.93l1.41-1.41M22 22H2M8 6l4-4 4 4M16 18a4 4 0 0 0-8 0" /><path d="M12 22v-4" /></svg>',
|
|
28
|
+
'minimal-dark-neon-yellow':
|
|
29
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13 2 3 14h9l-1 8 10-12h-9l1-8z" /></svg>',
|
|
30
|
+
'hack-the-box':
|
|
31
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" /></svg>',
|
|
32
|
+
'green-breeze-light':
|
|
33
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z" /><path d="M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12" /></svg>',
|
|
34
|
+
'pink-cat-boo':
|
|
35
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19.5 12.572l-7.5 7.428l-7.5 -7.428a5 5 0 1 1 7.5 -6.566a5 5 0 1 1 7.5 6.572" /></svg>',
|
|
36
|
+
'cute-pink':
|
|
37
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 18c0-2 1.5-4 4-4s4 2 4 4c0 2-1.5 4-4 4s-4-2-4-4Z" /><path d="M15 18c0-2 1.5-4 4-4s4 2 4 4c0 2-1.5 4-4 4s-4-2-4-4Z" /><path d="M12 8v4M10 10l-2 2M14 10l2 2" /></svg>',
|
|
38
|
+
'semi-light-purple':
|
|
39
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08" /><path d="M7.87 14.14c-.32.32-.67.68-1.06 1.06a5.04 5.04 0 0 1-2.17 1.22c-.47.15-.85.2-1.15.2-.16 0-.3-.02-.41-.03a1 1 0 0 1-.63-.97c-.01-.14.02-.31.07-.51.1-.41.3-.95.6-1.59.3-.64.67-1.33 1.08-2.05" /></svg>',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const iconSvg = $derived(THEME_ICON_SVG[themeId] ?? null);
|
|
43
|
+
const sizedSvg = $derived(
|
|
44
|
+
iconSvg
|
|
45
|
+
? iconSvg.replace(/width="16"/, `width="${size}"`).replace(/height="16"/, `height="${size}"`)
|
|
46
|
+
: null
|
|
47
|
+
);
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
{#if sizedSvg}
|
|
51
|
+
<span class={className} style="display: inline-flex; vertical-align: middle;">
|
|
52
|
+
{@html sizedSvg}
|
|
53
|
+
</span>
|
|
54
|
+
{/if}
|
|
@@ -31,3 +31,5 @@ export { default as Modal } from './Modal.svelte';
|
|
|
31
31
|
export { default as Toast } from './Toast.svelte';
|
|
32
32
|
export { default as Table } from './Table.svelte';
|
|
33
33
|
export type { TableColumn } from './Table.svelte';
|
|
34
|
+
export { default as ThemeIcon } from './ThemeIcon.svelte';
|
|
35
|
+
export { default as ThemeSwitcher } from './ThemeSwitcher.svelte';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import ThemeSwitcher from '$lib/rizzo/ThemeSwitcher.svelte';
|
|
3
|
+
import ThemeIcon from '$lib/rizzo/ThemeIcon.svelte';
|
|
3
4
|
import CodeBlock from '$lib/rizzo-docs/CodeBlock.svelte';
|
|
4
5
|
</script>
|
|
5
6
|
|
|
@@ -55,6 +56,13 @@
|
|
|
55
56
|
</ul>
|
|
56
57
|
<p>Theme IDs: run <code>npx rizzo-css theme</code> or see <a href="/docs/theming#available-themes">Theming – Available themes</a>. Listen for <code>rizzo-theme-change</code> to sync other UI when the theme changes.</p>
|
|
57
58
|
|
|
59
|
+
<h3>ThemeIcon</h3>
|
|
60
|
+
<p>To show the same icon as the switcher elsewhere (e.g. theme pages, cards), use <code><ThemeIcon themeId="github-dark-classic" size={24} /></code>. Props: <code>themeId</code>, optional <code>size</code> (default 24), optional <code>class</code>.</p>
|
|
61
|
+
<div class="example">
|
|
62
|
+
<div class="example-title">Example: theme icons</div>
|
|
63
|
+
<p><ThemeIcon themeId="github-dark-classic" size={24} /> GitHub Dark Classic · <ThemeIcon themeId="sunflower" size={20} /> Sunflower · <ThemeIcon themeId="shades-of-purple" size={28} /> Shades of Purple</p>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
58
66
|
<h3>Structure example (simplified)</h3>
|
|
59
67
|
<CodeBlock
|
|
60
68
|
code={`<div class="theme-switcher" data-theme-switcher>
|
|
@@ -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.17`, 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
|
|