Constraints for agents working on user UI modules. Read this before any change.
This library is part of WebTyp's construction harness: the typed, explicit API is what keeps an
agent that doesn't know the library from building wrong code. The compiler must reject mistakes; what
it can't catch becomes a devMode warning — never a silent failure.
- Typed over
any— no generic slots; typed builder methods (likewebtyp/json), reusingfmttypes. Anything reactive goes only through a signal binding (BindText/Bind*), which requires a signal. - Explicit names —
Text(static) vsBindText(reactive); reading the call states intent. - Illegal states unrepresentable — dynamic content has ONE path, typed to require a signal.
- Minimal public surface — export only what the author types; engine plumbing stays unexported.
- Docs are minimal "how" instructions, not long skills — if a rule must be remembered, close it with types, not prose.
(Ecosystem rationale: skill api-design — the construction harness, in
webtyp/devskills/skills/api-design/SKILL.md.)
Modules and views implement only Render() *dom.Element (+ optional Init(ctx dom.Ctx)).
There is NO OnMount/OnUpdate/OnUnmount and NO manual Update() (unexported in dom).
- Do not delegate
form.OnMount()—webtyp/formself-manages via signal bindings. A module that embeds a form just includes it in its render tree (expose sub-components viaChildren() []dom.Componentso theirInitruns). - Dynamic lists (e.g.
lan.goIP rows) are adom.SignalNodesbound withcontainer.BindChildren(s); add/remove rebuilds[]*dom.Element(each.Key(id)) and only the changed row patches.
State the UI shows lives in typed signals; changing one patches only the bound node — never re-render a whole element, never a Virtual DOM.
Zero generic functions (follow webtyp/fmt codec rule "cero any, cero map"). Use concrete typed
signals: SignalString/SignalBool/SignalNodes, DeriveString/DeriveBool, Bind*, Show.
Never Signal[T].
Export only what other packages consume (module entry types). Unexport view helpers, field models, and anything only this package uses. Struct fields stay unexported.
- UI lifecycle/reactive code in
//go:build wasmfiles;!wasmstubs where called from tag-less code. - No Go stdlib: use
webtyp.com/fmt. DOM only viawebtyp.com/dom, neversyscall/js.switchnotmap. Nodefer/recover. Embeddom.Elementby value.
go install webtyp.com/devflow/cmd/gotest@latest
gotestgotest, nevergo test. Stdlib assertions only. Dual WASM/stdlib; real DOM in WASM tests.- Cover frequent use cases: login/register/profile forms work after construction with no lifecycle
hook;
lanadd/remove patches single IP rows (others keep identity). Publish withgopush 'message'.
This library provides the mechanism (hashing, sessions, routes, permission checking). The policy—what roles exist, who receives what, if there's a wildcard—is declared by the consumer via Bootstrap(Seed). No role or resource constants live here.
Update docs before code and before gopush: docs/ARCHITECTURE.md (remove OnMount delegation
from the module-lifecycle description), update docs/diagrams/ (flowchart TD, no subgraph,
<br/> for breaks), and re-index README.md so every docs/ file is linked.