Update kjol website with C documentation
This commit is contained in:
@@ -13,8 +13,8 @@ build the site out of both.
|
||||
|
||||
```sh
|
||||
cd go/cmd/kjol-web
|
||||
go run ./build # cold build: both halves
|
||||
go run ./server # SSR + /rsc + hot reload at http://localhost:8085
|
||||
go run ./server -build # cold build, then exit
|
||||
go run ./server # build, then SSR + /rsc + hot reload at http://localhost:8085
|
||||
```
|
||||
|
||||
`go run ./server` performs that same build on every save and hot-swaps the result into
|
||||
@@ -28,8 +28,8 @@ terminal you were not looking at.
|
||||
| Path | Rendered by | What it is |
|
||||
|---|---|---|
|
||||
| `/`, `/about` | Go → WebAssembly, SSR'd | The landing page. The **Layers** menu is the site's primary navigation. |
|
||||
| `/wasm/*` | Go → WebAssembly | **Kjol Wasm Web** — the gowasm engine: SSR + hydration, server components, the `webui` kit, overlays, AutoTable, charts, client fetching. |
|
||||
| `/js/*` | Solid → esbuild, client-rendered | **Kjol JS Web** — the Solid kit: components, forms, AutoTable, theming. |
|
||||
| `/wasm/*` | Go → WebAssembly | **Kjol Wasm Web** — the gowasm engine: SSR + hydration, server components, data fetching, and the whole `webui` kit on one page (`/wasm/components`). |
|
||||
| `/js/*` | Solid → esbuild, client-rendered | **Kjol JS Web** — the Solid kit, all of it on one page (`/js/components`), with a sidebar that jumps to each group. |
|
||||
| `/js/ssr` | Solid → **goja, at request time** | A public page server-rendered with live data injected — the ISR path. |
|
||||
|
||||
Crossing between `/wasm` and `/js` is a real page load. They are different binaries, and
|
||||
@@ -38,16 +38,19 @@ pretending otherwise would mean shipping both to every visitor.
|
||||
## Layout
|
||||
|
||||
```
|
||||
app/ the Go/WASM half — pages as plain Go functions returning a *VNode
|
||||
pages.go Deps + Shell + the public/app layouts + the landing page
|
||||
layers.go the Layers, as data. MIRRORED in frontend/src/layers.ts.
|
||||
docs.go the docs chrome; docsNav() is the sidebar AND the index
|
||||
kit.go table.go overlays.go chart.go data.go server_counter.go
|
||||
*.gen.go GENERATED by kjol/cmd/wasmgen (routes, layout dispatch, RSC stubs)
|
||||
app/ Kjol Wasm Web — pages as plain Go functions returning a *VNode
|
||||
pages.go Deps + Shell + the public/app layouts + the landing page
|
||||
layers.go the Layers, as data. MIRRORED in frontend/src/layers.ts.
|
||||
docs.go the docs chrome; docsNav() is the sidebar AND the index
|
||||
components.go THE WHOLE KIT, on one page. componentGroups() is the single source
|
||||
for both the sections and the sidebar that jumps to them.
|
||||
table.go the AutoTable's data + controller (shared with its tests)
|
||||
chart.go data.go server_counter.go
|
||||
*.gen.go GENERATED by kjol/cmd/wasmgen (routes, layout dispatch, RSC stubs)
|
||||
wasm/ the js/wasm client entry (main_native.go is a host stub)
|
||||
css/app.css its Tailwind entry — kjol/tw scans the .go files for class names
|
||||
|
||||
frontend/ the Solid half — .tsx pages written against @ui/*
|
||||
frontend/ Kjol JS Web — .tsx pages written against @ui/*
|
||||
css/style.css brand ONLY. kjol's theme.css is prepended by the bundler, and it
|
||||
is the one that does `@import "tailwindcss"`.
|
||||
vendor/ pdf-lib + pdfjs-dist. @ui/AutoTable imports them at the TOP LEVEL,
|
||||
@@ -57,18 +60,21 @@ frontend/ the Solid half — .tsx pages written against @ui/*
|
||||
src/layers.ts the Layers again. Keep in step with app/layers.go.
|
||||
|
||||
server/ ONE Go server: serves wwwroot, SSRs the wasm routes, hosts /rsc,
|
||||
mounts the Solid SPA at /js/*, serves the SSR'd public pages.
|
||||
mounts the Solid SPA at /js/*, serves the SSR'd public pages, and
|
||||
carries the -build flag.
|
||||
build/ the build pipeline, in Go rather than a shell script, so the cold build
|
||||
and the watch loop call the SAME functions and cannot drift. It is a
|
||||
library, not a command: the server imports it, and Go will not let you
|
||||
import a main — hence `go run ./server -build` rather than `./build`.
|
||||
internal/handlers/ the app side of the public-page inversion: kjol generates the
|
||||
registry; this owns the type and the document shell.
|
||||
buildsteps/ the build, in Go rather than a shell script, so the one-shot build and
|
||||
the dev server's watch loop call the SAME functions and cannot drift.
|
||||
wwwroot/ both halves write here. They never collide: app.css / app.wasm for one,
|
||||
wwwroot/ both layers write here. They never collide: app.css / app.wasm for one,
|
||||
bundle.min.* for the other. One static dir, one server.
|
||||
```
|
||||
|
||||
## Theming
|
||||
|
||||
One theme, both halves. The kits are themed by **semantic tokens** — components say
|
||||
One theme, both layers. The kits are themed by **semantic tokens** — components say
|
||||
`bg-surface`, `text-ink`, `border-line` and never name a colour — so dark mode
|
||||
re-points about a dozen CSS variables and not one component knows it happened.
|
||||
|
||||
@@ -84,11 +90,12 @@ to invert (the neutral button, whose label must go dark when the fill goes pale)
|
||||
|
||||
## Adding things
|
||||
|
||||
**A Go/WASM page:** write the function, mark it `//gowasm:page /wasm/thing layout=app`,
|
||||
**A Kjol Wasm Web page:** write the function, mark it `//gowasm:page /wasm/thing layout=app`,
|
||||
build. `wasmgen` regenerates the routing. Add `static` to have it server-rendered.
|
||||
|
||||
**A Solid page:** write the `.tsx`, add it to `routes` in `frontend/src/app.ts` and to
|
||||
`NAV` in `frontend/src/layout/Shell.tsx`.
|
||||
**A component:** add a section to `app/components.go` (Go) or `frontend/src/pages/Components.tsx`
|
||||
(Solid), and one entry to `componentGroups()` / `COMPONENT_GROUPS`. That single list drives the
|
||||
sections, the sidebar that jumps to them, and the index — so none of the three can drift.
|
||||
|
||||
**A layer:** one entry in `app/layers.go` *and* one in `frontend/src/layers.ts`. They are
|
||||
two files because nothing is upstream of both a WebAssembly binary and an esbuild bundle;
|
||||
@@ -103,7 +110,7 @@ keeping each to a flat list of plain data is what makes that duplication surviva
|
||||
| `kjol/rsc` | stateless server components over HTTP | `//gowasm:server` + its generated client stub |
|
||||
| `kjol/wasmdevserver` | reusable dev server: SSR, `/rsc`, hot reload, error overlay | `server/main.go` fills a `wasmdevserver.Config` |
|
||||
| `kjol/webui` | the Go component kit | every `/wasm/*` page |
|
||||
| `kjol/jsbundler` | TSX → Solid → esbuild, the Tailwind driver, the SSR bake | `buildsteps.JS`, and the ISR render at request time |
|
||||
| `kjol/jsbundler` | TSX → Solid → esbuild, the Tailwind driver, the SSR bake | `build.JS`, and the ISR render at request time |
|
||||
| `kjol/jsruntime` | the Solid kit, the vendored runtime, the icons, `theme.css` | everything under `/js/*` |
|
||||
| `kjol/tw` | the Tailwind v4 engine, in Go | both stylesheets — it scans `.go` for one and `.tsx` for the other |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user