@ludoloops/svelteforge 0.1.0
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 +174 -0
- package/dist/index-CqCposFO.d.ts +18 -0
- package/dist/index.js +270 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# SvelteForge
|
|
2
|
+
|
|
3
|
+
**sv community addon** — UI/UX layer on top of `sv create`. Adds 34 production-ready components, a 3-layer theme system, admin dashboard, notification system, and Zod schemas to SvelteKit projects. Auth (better-auth) and database (Drizzle + SQLite) come from `sv` add-ons.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Full stack (UI + auth + DB)
|
|
9
|
+
sv create my-app --template minimal --types ts --add tailwindcss @lelabdev/svelteforge
|
|
10
|
+
|
|
11
|
+
# Or add to an existing project
|
|
12
|
+
cd my-app
|
|
13
|
+
sv add @lelabdev/svelteforge
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The addon prompts for a template mode:
|
|
17
|
+
|
|
18
|
+
- **Landing Page** — UI components + theme + landing page (no auth/DB)
|
|
19
|
+
- **Full Stack** — UI + dashboard + auth + DB (via sv add-ons)
|
|
20
|
+
|
|
21
|
+
## Post-Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cd my-app
|
|
25
|
+
bun dev # → http://localhost:5173
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`sv create` handles `.env` generation (auth secret, DB path). No extra setup step needed.
|
|
29
|
+
|
|
30
|
+
## What's Included
|
|
31
|
+
|
|
32
|
+
### Full Stack Mode
|
|
33
|
+
|
|
34
|
+
| Layer | Technology |
|
|
35
|
+
|-------|-----------|
|
|
36
|
+
| Framework | **SvelteKit 2** + **Svelte 5** (runes) |
|
|
37
|
+
| Styling | **Tailwind CSS v4** + **Skeleton UI v4** |
|
|
38
|
+
| Auth | via **sv add-on** (better-auth — email/password, admin plugin, sessions) |
|
|
39
|
+
| Database | via **sv add-on** (SQLite `libsql` + Drizzle ORM) |
|
|
40
|
+
| Forms | **SuperForms v2** + **Zod v4** |
|
|
41
|
+
| Rich Text | **Tiptap** — editor & preview |
|
|
42
|
+
| Icons | **Phosphor** (via Icon wrapper component) |
|
|
43
|
+
| Logging | **Pino** |
|
|
44
|
+
| Testing | **Vitest** + `@testing-library/svelte` |
|
|
45
|
+
|
|
46
|
+
### 34 UI Components
|
|
47
|
+
|
|
48
|
+
All theme-aware, built on Skeleton UI v4:
|
|
49
|
+
|
|
50
|
+
**Surfaces** — Card, AuthCard, Modal, Sheet, PopOver, Carousel
|
|
51
|
+
**Feedback** — Toast, ErrorAlert, SuccessAlert, Loader, Progress, SkeletonLoader, NavigationLoader
|
|
52
|
+
**Navigation** — Tabs, Breadcrumb, Stepper, Menu
|
|
53
|
+
**Data** — DataTable, EmptyState, NotificationBadge, Badge, Avatar
|
|
54
|
+
**Controls** — Button, Switch, Divider, Accordion, Tooltip, RadioGroup, SearchInput, ThemeToggle, ConfirmDialog
|
|
55
|
+
**Forms** — Input, PasswordInput (with strength meter), TextArea, Select, Checkbox, FormField, SubmitButton
|
|
56
|
+
**Rich Text** — RichTextEditor, RichTextPreview
|
|
57
|
+
|
|
58
|
+
### Admin Dashboard (Full Stack only)
|
|
59
|
+
|
|
60
|
+
Full admin area with collapsible sidebar:
|
|
61
|
+
|
|
62
|
+
- **User Management** — DataTable with search, role filter, pagination, role change
|
|
63
|
+
- **Settings** — Tabbed config (General, Auth, Notifications)
|
|
64
|
+
- **Notifications** — Create + manage notifications for users
|
|
65
|
+
- **Role Guard** — Admin-only access enforced at layout level
|
|
66
|
+
|
|
67
|
+
### Theme System
|
|
68
|
+
|
|
69
|
+
Three-layer theming — change the look without touching components:
|
|
70
|
+
|
|
71
|
+
| Layer | File | Purpose |
|
|
72
|
+
|-------|------|---------|
|
|
73
|
+
| Colors | `svelteForge.css` | 7 domains × 10 shades (oklch) |
|
|
74
|
+
| Spacing | `tokens.css` | 60+ semantic tokens (padding, radius, sizing, typography) |
|
|
75
|
+
| Fonts | `fonts.css` | Inter, Space Grotesk, Manrope, Fira Code |
|
|
76
|
+
|
|
77
|
+
**To create a theme:** copy `svelteForge.css` + `tokens.css`, change the `[data-theme]` name and values. Done. Every component adapts automatically.
|
|
78
|
+
|
|
79
|
+
### What SvelteForge Adds vs. `sv create`
|
|
80
|
+
|
|
81
|
+
| | `sv create` | + SvelteForge |
|
|
82
|
+
|--|:-----------:|:-------------:|
|
|
83
|
+
| SvelteKit + Tailwind + ESLint + Prettier | ✓ | ✓ |
|
|
84
|
+
| Auth (better-auth) | ✓ (add-on) | ✓ |
|
|
85
|
+
| Database (Drizzle + SQLite) | ✓ (add-on) | ✓ |
|
|
86
|
+
| 34 UI components | — | ✓ |
|
|
87
|
+
| 3-layer theme system | — | ✓ |
|
|
88
|
+
| Layout (Navbar, Footer, MobileMenu, AuthButtons) | — | ✓ |
|
|
89
|
+
| Admin dashboard (sidebar, users, settings, notifications) | — | ✓ |
|
|
90
|
+
| Zod validation schemas | — | ✓ |
|
|
91
|
+
| Utils (cn, formatters, theme store) | — | ✓ |
|
|
92
|
+
| Tests (Vitest + testing-library) | — | ✓ |
|
|
93
|
+
|
|
94
|
+
### Project Structure (Generated)
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
src/
|
|
98
|
+
├── lib/
|
|
99
|
+
│ ├── components/
|
|
100
|
+
│ │ ├── ui/ # 34 components
|
|
101
|
+
│ │ ├── layout/ # Navbar, Footer, AuthButtons, MobileMenu, AdminSidebar
|
|
102
|
+
│ │ └── icons/ # Phosphor wrapper (Icon.svelte)
|
|
103
|
+
│ ├── schemas/ # Zod v4 validation
|
|
104
|
+
│ ├── stores/ # notification-store.svelte.ts
|
|
105
|
+
│ ├── styles/ # Theme + tokens + fonts
|
|
106
|
+
│ └── utils/ # cn, formatters, theme store
|
|
107
|
+
├── routes/
|
|
108
|
+
│ ├── (public)/ # login, signup
|
|
109
|
+
│ ├── (protected)/ # dashboard
|
|
110
|
+
│ │ └── admin/ # sidebar layout, users, settings, notifications
|
|
111
|
+
│ └── (legal)/ # privacy, legal
|
|
112
|
+
└── tests-setup.ts # Vitest + jest-dom setup
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Auth config, DB connection, Drizzle schemas, `hooks.server.ts`, and API routes are provided by `sv` — SvelteForge does not override them.
|
|
116
|
+
|
|
117
|
+
## Modes
|
|
118
|
+
|
|
119
|
+
| Mode | UI + Forms | Auth + DB |
|
|
120
|
+
|------|:----------:|:---------:|
|
|
121
|
+
| **Full Stack** (default) | ✓ | ✓ (via sv) |
|
|
122
|
+
| **Landing Page** | ✓ | ✗ |
|
|
123
|
+
|
|
124
|
+
## Architecture
|
|
125
|
+
|
|
126
|
+
SvelteForge is an **sv community addon**. It uses the `sv` addon API (`defineAddon`, `sv.dependency()`, `sv.file()`) to inject files and dependencies into the user's project.
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
svelteforge/ ← this repo (addon package)
|
|
130
|
+
├── src/
|
|
131
|
+
│ ├── index.ts ← defineAddon() entry point
|
|
132
|
+
│ ├── templates.ts ← auto-generated (file contents as JSON)
|
|
133
|
+
│ └── modes/
|
|
134
|
+
│ ├── fullstack.ts ← fullstack file injection logic
|
|
135
|
+
│ └── landing.ts ← landing file injection + filtering
|
|
136
|
+
├── templates/
|
|
137
|
+
│ ├── fullstack/ ← fullstack mode source files
|
|
138
|
+
│ └── landing/ ← landing mode source files
|
|
139
|
+
├── scripts/
|
|
140
|
+
│ └── prebuild.ts ← reads templates/ → generates src/templates.ts
|
|
141
|
+
├── tsdown.config.ts ← bundler (bundles everything into dist/index.js)
|
|
142
|
+
├── package.json ← @lelabdev/svelteforge
|
|
143
|
+
├── AGENTS.md
|
|
144
|
+
└── README.md
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Build pipeline
|
|
148
|
+
|
|
149
|
+
1. `bun run prebuild` — reads `templates/` directories, inlines all file contents into `src/templates.ts`
|
|
150
|
+
2. `tsdown` — bundles `src/index.ts` + modes + templates into a single `dist/index.js`
|
|
151
|
+
3. Published on npm as `@lelabdev/svelteforge`
|
|
152
|
+
|
|
153
|
+
## Development
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Build the addon
|
|
157
|
+
bun run build
|
|
158
|
+
|
|
159
|
+
# Test locally with bun link
|
|
160
|
+
bun link
|
|
161
|
+
mkdir /tmp/test-app && cd /tmp/test-app
|
|
162
|
+
sv create my-app --template minimal --types ts --add tailwindcss @lelabdev/svelteforge
|
|
163
|
+
cd my-app
|
|
164
|
+
bun dev
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Requirements
|
|
168
|
+
|
|
169
|
+
- [Bun](https://bun.sh) >= 1.0.0
|
|
170
|
+
- [sv](https://github.com/sveltejs/cli) >= 0.13.0
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
MIT
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as sv0 from "sv";
|
|
2
|
+
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
declare const _default: sv0.Addon<{
|
|
5
|
+
template: sv0.Question<Record<"template", {
|
|
6
|
+
readonly question: "Which SvelteForge template?";
|
|
7
|
+
readonly type: "select";
|
|
8
|
+
readonly options: [{
|
|
9
|
+
readonly value: "landing";
|
|
10
|
+
readonly label: "Landing Page — UI only";
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: "fullstack";
|
|
13
|
+
readonly label: "Full Stack — dashboard + auth + DB";
|
|
14
|
+
}];
|
|
15
|
+
}>>;
|
|
16
|
+
}, "svelteforge">;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { _default as default };
|