Skip to content

Commit 5c88a7d

Browse files
committed
Enhance project to support SolidJS runtime and update documentation
- Added SolidJS as a new runtime option in the code generation process, allowing for idiomatic SolidJS components to be generated alongside existing runtimes. - Updated package.json and bun.lock to include necessary SolidJS dependencies and configurations. - Revised README and other documentation to reflect the addition of SolidJS, including updated runtime descriptions and usage instructions. - Enhanced CLI commands and scripts to support SolidJS development and integration. - Improved test coverage for SolidJS components to ensure parity with other runtimes. These changes aim to expand the capabilities of the UI8Kit codegen engine and provide developers with more options for rendering components.
1 parent 3a7f4da commit 5c88a7d

30 files changed

Lines changed: 1040 additions & 48 deletions

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# UI8Kit Codegen
22

3-
**One brick definition → six identical runtimes.**
3+
**One brick definition → seven identical runtimes.**
44

5-
Spec-driven codegen for UI8Kit `ui/` primitives. Define props, variants, and a render tree once; emit idiomatic Templ, React, Svelte, Vue, Latte, and Twig with the same DOM, design tokens, and ARIA contract — verified by parity tests, not by review.
5+
Spec-driven codegen for UI8Kit `ui/` primitives. Define props, variants, and a render tree once; emit idiomatic Templ, React, Svelte, Vue, SolidJS, Latte, and Twig with the same DOM, design tokens, and ARIA contract — verified by parity tests, not by review.
66

77
| Fact | Value |
88
|------|-------|
9-
| **Inventory** | 33 bricks · 63 parts · 6 runtimes |
9+
| **Inventory** | 33 bricks · 63 parts · 7 runtimes |
1010
| **PHP templates** | 60 / 63 parts (3 skipped by structural predicate) |
1111
| **License** | MIT |
1212

@@ -20,6 +20,7 @@ Spec-driven codegen for UI8Kit `ui/` primitives. Define props, variants, and a r
2020
| **React 19** | `ui/<brick>/<brick>.tsx` | `forwardRef`, `asChild` / `Slot` |
2121
| **Svelte 5** | `ui/<brick>/<Part>.svelte` | runes, snippets, `<svelte:element>` |
2222
| **Vue 3** | `ui/<brick>/<Part>.vue` | `<script setup>`, slots, `<component :is>` |
23+
| **SolidJS** | `ui/<brick>/<brick>.solid.tsx` | `splitProps`, `Dynamic`, `*Classes()` |
2324
| **Latte** | `ui/<brick>/<Part>.latte` | typed `{parameters}`, `n:attr` |
2425
| **Twig** | `ui/<brick>/<Part>.html.twig` | `ui8kit_attr_str`, `include with` |
2526

@@ -33,7 +34,7 @@ All runtimes share the same colocated `*.variants.json` (CVA-style recipes). Att
3334

3435
## Why codegen?
3536

36-
Hand-writing `.templ` + `.tsx` (and then Svelte, Vue, Latte, Twig) multiplies drift. This engine inverts the workflow:
37+
Hand-writing `.templ` + `.tsx` (and then Svelte, Vue, Solid, Latte, Twig) multiplies drift. This engine inverts the workflow:
3738

3839
1. **Brick definitions** (`bricks/<name>/<name>.def.ts`) — single source of truth
3940
2. **Canonical renderer** (`src/domain/render.ts`) — executable DOM spec
@@ -51,14 +52,14 @@ Identity across runtimes is a property of the test suite, not a convention.
5152
```bash
5253
bun install
5354
bun run check # validate all brick definitions
54-
bun run generate # emit all six runtimes → generated/
55+
bun run generate # emit all seven runtimes → generated/
5556
bun test # domain units + DOM parity
5657
bun run verify # check + typecheck + tests (CI equivalent)
5758
```
5859

5960
### Local previews
6061

61-
Seven welcome screens (generated primitives + shadcn tokens) live in [`examples/`](examples/):
62+
Eight welcome screens (generated primitives + shadcn tokens) live in [`examples/`](examples/):
6263

6364
```bash
6465
bun run generate && cd examples && bun install && bun run build:css
@@ -69,6 +70,7 @@ bun run dev:svelte # :5174
6970
bun run dev:vue # :5175
7071
bun run dev:latte # :5176
7172
bun run dev:twig # :5177
73+
bun run dev:solid # :5178
7274
bun run build:html # → examples/html/
7375
```
7476

@@ -78,7 +80,7 @@ bun run build:html # → examples/html/
7880
bun src/infrastructure/cli.ts generate \
7981
--out generated \
8082
--go-module github.com/ui8kit/ui \
81-
--runtimes templ,react,svelte,vue,latte,twig
83+
--runtimes templ,react,svelte,vue,solid,latte,twig
8284
```
8385

8486
Also available: `bun run generate:latte-bundle` for a Latte-only package — see [docs/latte-bundle.md](docs/latte-bundle.md).
@@ -94,17 +96,17 @@ generated/
9496
php/UI8Kit/ # Rt.php, Classes.php, TwigExtension.php
9597
utils/ # shared runtime support (Go + TS)
9698
ui/
97-
index.ts | index.svelte.ts | index.vue.ts
99+
index.ts | index.svelte.ts | index.vue.ts | index.solid.ts
98100
button/
99101
button.variants.json # shared CVA recipe
100102
button.shared.ts # TS types + classes helpers
101-
button.templ | button.tsx | Button.svelte | Button.vue
103+
button.templ | button.tsx | button.solid.tsx | Button.svelte | Button.vue
102104
Button.latte | Button.html.twig
103105
```
104106

105-
**Consume:** Templ → `templ generate && go build` · TS → Vite (`@vitejs/plugin-vue`, `@sveltejs/vite-plugin-svelte`) · PHP → `composer install` in `generated/` with a loader rooted at `generated/ui`.
107+
**Consume:** Templ → `templ generate && go build` · TS → Vite (`@vitejs/plugin-vue`, `@sveltejs/vite-plugin-svelte`, `vite-plugin-solid`) · PHP → `composer install` in `generated/` with a loader rooted at `generated/ui`.
106108

107-
Peer deps: `react` / `svelte` / `vue` + `clsx` + `tailwind-merge`; PHP: `latte/latte ^3` or `twig/twig ^3`.
109+
Peer deps: `react` / `svelte` / `vue` / `solid-js` + `clsx` + `tailwind-merge`; PHP: `latte/latte ^3` or `twig/twig ^3`.
108110

109111
---
110112

@@ -119,7 +121,7 @@ src/
119121
infrastructure/ # CLI
120122
runtime/ # support files copied into generated/utils
121123
tests/ # domain units + cross-runtime parity
122-
examples/ # seven welcome previews
124+
examples/ # eight welcome previews
123125
docs/ # full documentation
124126
```
125127

bun.lock

Lines changed: 114 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# UI8Kit Codegen — Documentation
22

3-
Spec-driven codegen engine for UI8Kit `ui/` primitives. One typed render contract per brick, six generated runtimes (plus a static HTML export), and DOM parity verified by tests.
3+
Spec-driven codegen engine for UI8Kit `ui/` primitives. One typed render contract per brick, seven generated runtimes (plus a static HTML export), and DOM parity verified by tests.
44

55
## Contents
66

docs/cli-and-scripts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Entry: `src/infrastructure/cli.ts` (also exposed as `ui8kit-codegen` bin when pu
1818
|------|---------|-------------|
1919
| `--out <dir>` | `generated` | Output directory |
2020
| `--go-module <module>` | `github.com/ui8kit/ui` | Go module path in `go.mod` |
21-
| `--runtimes <list>` | all six | Comma-separated: `templ,react,svelte,vue,latte,twig` |
21+
| `--runtimes <list>` | all seven | Comma-separated: `templ,react,svelte,vue,solid,latte,twig` |
2222

2323
### Examples
2424

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ bun install
2323

2424
```bash
2525
bun run check # validate all brick definitions (no I/O)
26-
bun run generate # emit all six runtimes into generated/
26+
bun run generate # emit all seven runtimes into generated/
2727
```
2828

2929
Generate with custom options:

docs/overview.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ UI8Kit Codegen is a **spec-driven codegen engine** for UI8Kit `ui/` primitives.
66

77
1. **Validates** definitions before emitting anything.
88
2. **Renders** a canonical reference DOM via `src/domain/render.ts` — the executable specification.
9-
3. **Emits** idiomatic code for six runtimes from the same definition.
9+
3. **Emits** idiomatic code for seven runtimes from the same definition.
1010
4. **Tests** that every generated runtime produces identical normalized DOM for every part and showcase fixture.
1111

1212
Identity across runtimes is not a review convention — it is enforced by the test suite.
@@ -19,6 +19,7 @@ Identity across runtimes is not a review convention — it is enforced by the te
1919
| **React 19** | `ui/<brick>/<brick>.tsx` | `forwardRef`, `asChild` via `Slot`, rest props |
2020
| **Svelte 5** | `ui/<brick>/<Part>.svelte` | runes, snippets, `<svelte:element>` |
2121
| **Vue 3** | `ui/<brick>/<Part>.vue` | `<script setup>`, slots, `<component :is>` |
22+
| **SolidJS** | `ui/<brick>/<brick>.solid.tsx` | `splitProps`, `Dynamic`, shared `*Classes()` |
2223
| **Latte** | `ui/<brick>/<Part>.latte` | typed `{parameters}`, `n:attr`, children as HTML string |
2324
| **Twig** | `ui/<brick>/<Part>.html.twig` | `ui8kit_attr_str`, `include with`, children as HTML string |
2425

@@ -53,7 +54,7 @@ Codegen/
5354
├── runtime/ # support files copied into generated/ (Go, TS, PHP)
5455
├── generated/ # codegen output (gitignored; created by `bun run generate`)
5556
├── tests/ # domain units + cross-runtime parity suites
56-
├── examples/ # seven welcome previews + static HTML export
57+
├── examples/ # eight welcome previews + static HTML export
5758
├── docs/ # this documentation
5859
└── .github/workflows/ # CI
5960
```
@@ -68,7 +69,7 @@ Codegen/
6869

6970
## Why an IR instead of hand-written runtimes
7071

71-
The upstream registry hand-writes `.templ` and `.tsx` pairs against a shared spec. Adding Svelte, Vue, Latte, and Twig by hand multiplies drift surface. This engine inverts the workflow: definitions are data, the canonical renderer is the spec, emitters are printers, parity tests are the gate.
72+
The upstream registry hand-writes `.templ` and `.tsx` pairs against a shared spec. Adding Svelte, Vue, Solid, Latte, and Twig by hand multiplies drift surface. This engine inverts the workflow: definitions are data, the canonical renderer is the spec, emitters are printers, parity tests are the gate.
7273

7374
## License
7475

docs/runtimes.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,25 @@ Bun test preload compiles `.svelte` with `generate: "server"` for parity tests (
7070

7171
**Peer deps:** `vue`, `clsx`, `tailwind-merge`.
7272

73+
## SolidJS
74+
75+
**Output:** `ui/<brick>/<brick>.solid.tsx` (all parts in one file; `.solid.tsx` avoids colliding with React)
76+
77+
| Feature | Implementation |
78+
|---------|----------------|
79+
| Children | `children` prop (`JSX.Element`) |
80+
| Prop naming | camelCase variants; HTML-native `class` (+ `className` alias) |
81+
| Dynamic tags | `<Dynamic component={…}>` from `solid-js/web` |
82+
| Rest props | `splitProps``{...rest}` spread last |
83+
| Class merge | shared `*Classes()` helpers (no `asChild`) |
84+
| Shared types | `<brick>.shared.ts` — same as React/Svelte/Vue |
85+
86+
**Composition:** no Radix-style `asChild`. Style another element via `buttonClasses()` / `*Classes()` — same substitute as Svelte/Vue.
87+
88+
**Peer deps:** `solid-js`, `clsx`, `tailwind-merge`.
89+
90+
Bun/Vitest transform `*.solid.tsx` with `babel-preset-solid` / `vite-plugin-solid` (`generate: "ssr"`) for parity tests.
91+
7392
## Latte (PHP)
7493

7594
**Output:** `ui/<brick>/<Part>.latte`
@@ -147,13 +166,13 @@ Writes `examples/html/index.html`, `examples/html/about/index.html` with relativ
147166
bun src/infrastructure/cli.ts generate --runtimes react,svelte
148167
```
149168

150-
Valid values: `templ`, `react`, `svelte`, `vue`, `latte`, `twig` (comma-separated). Default: all six.
169+
Valid values: `templ`, `react`, `svelte`, `vue`, `solid`, `latte`, `twig` (comma-separated). Default: all seven.
151170

152171
## Parity policy per runtime
153172

154173
| Runtime | Parity test | Skipped when |
155174
|---------|-------------|--------------|
156-
| React, Svelte, Vue | `tests/parity.test.ts` | never (always run) |
175+
| React, Svelte, Vue, Solid | `tests/parity.test.ts` | never (always run) |
157176
| Go Templ | `tests/parity.templ.test.ts` | `go` not on PATH |
158177
| Latte | `tests/parity.latte.test.ts` | PHP or Composer unavailable |
159178
| Twig | `tests/parity.twig.test.ts` | PHP or Composer unavailable |

examples/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Codegen examples — seven welcome screens
1+
# Codegen examples — eight welcome screens
22

33
Local preview for **generated** `ui/` primitives. Same shadcn tokens and
4-
welcome layout on all seven runtimes.
4+
welcome layout on all eight surfaces (seven codegen runtimes + static HTML).
55

66
| Path | Runtime | Dev command | URL |
77
|------|---------|-------------|-----|
@@ -12,6 +12,7 @@ welcome layout on all seven runtimes.
1212
| [`vue/`](vue/) | Vue 3 + Vite | `bun run dev:vue` | http://127.0.0.1:5175 |
1313
| [`latte/`](latte/) | Latte + PHP server | `bun run dev:latte` | http://127.0.0.1:5176 |
1414
| [`twig/`](twig/) | Twig + PHP server | `bun run dev:twig` | http://127.0.0.1:5177 |
15+
| [`solid/`](solid/) | SolidJS + Vite | `bun run dev:solid` | http://127.0.0.1:5178 |
1516

1617
Shared assets live under [`web/static/`](web/static/) (CSS tokens, Tailwind
1718
output). Copy and feature text in [`data/welcome.json`](data/welcome.json).
@@ -34,7 +35,7 @@ From `ui8kit-codegen/`:
3435
bun run generate # emit generated/ui (if missing)
3536
cd examples && bun install
3637
bun run build:css # Tailwind → web/static/css/app.css
37-
bun run dev:templ # or dev:react / dev:svelte / dev:vue
38+
bun run dev:templ # or dev:react / dev:svelte / dev:vue / dev:solid
3839
```
3940

4041
Or from `ui8kit-codegen/` root (after `examples` deps are installed):
@@ -44,6 +45,7 @@ bun run dev:templ
4445
bun run dev:react
4546
bun run dev:svelte
4647
bun run dev:vue
48+
bun run dev:solid
4749
```
4850

4951
## Layout
@@ -58,5 +60,6 @@ bun run dev:vue
5860
| `react/script/generate-static.tsx` | Static HTML export (routes + relative links) |
5961
| `svelte/src/Welcome.svelte` | Svelte twin |
6062
| `vue/src/Welcome.vue` | Vue twin |
63+
| `solid/src/Welcome.tsx` | Solid twin |
6164
| `latte/templates/welcome.latte` | Latte twin (generated `.latte` includes) |
6265
| `twig/templates/welcome.html.twig` | Twig twin (generated `.html.twig` includes) |

examples/data/welcome.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
{
1010
"title": "Seven runtimes",
11-
"description": "Go Templ, React 19, Svelte 5, Vue 3, Latte, Twig, and static HTML from the same source."
11+
"description": "Go Templ, React 19, Svelte 5, Vue 3, SolidJS, Latte, and Twig from the same source."
1212
},
1313
{
1414
"title": "DOM parity",
@@ -21,6 +21,7 @@
2121
{ "id": "svelte", "label": "Svelte 5", "port": 5174 },
2222
{ "id": "vue", "label": "Vue 3", "port": 5175 },
2323
{ "id": "latte", "label": "Latte", "port": 5176 },
24-
{ "id": "twig", "label": "Twig", "port": 5177 }
24+
{ "id": "twig", "label": "Twig", "port": 5177 },
25+
{ "id": "solid", "label": "SolidJS", "port": 5178 }
2526
]
2627
}

examples/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"dev:react": "bun run build:css && vite --config react/vite.config.ts",
1111
"dev:svelte": "bun run build:css && vite --config svelte/vite.config.ts",
1212
"dev:vue": "bun run build:css && vite --config vue/vite.config.ts",
13+
"dev:solid": "bun run build:css && vite --config solid/vite.config.ts",
1314
"dev:latte": "bun run composer:install && bun run build:css && bun scripts/php-server.mjs latte 5176",
1415
"dev:twig": "bun run composer:install && bun run build:css && bun scripts/php-server.mjs twig 5177",
1516
"build:html": "bun run build:css && bun react/script/generate-static.tsx"
@@ -18,6 +19,7 @@
1819
"clsx": "^2.1.1",
1920
"react": "^19.0.0",
2021
"react-dom": "^19.0.0",
22+
"solid-js": "^1.9.5",
2123
"svelte": "^5.19.0",
2224
"tailwind-merge": "^2.6.0",
2325
"vue": "^3.5.13"
@@ -32,6 +34,7 @@
3234
"sirv": "^3.0.1",
3335
"tailwindcss": "^4.2.1",
3436
"typescript": "^5.7.3",
35-
"vite": "^6.3.5"
37+
"vite": "^6.3.5",
38+
"vite-plugin-solid": "^2.11.6"
3639
}
3740
}

0 commit comments

Comments
 (0)