Data, forms, and persistence
This page demos the Tier 1.5 surface: declarative fetch, forms that write state, persistent state, and the JavaScript escape hatch.
Fetched data drives reactive loops
:fetch team from "/__wd/data/team.json" declares state and fills it from the network. Until it lands, the page shows the fallback branch:
—
Team lead ★
Crew
Loading the team…
Loading the team…
That loop also proves :if over loop items: the lead badge is decided per row.
Forms write state, no backend required
:form into profile captures the submit straight into state. With action="/url" instead, Darkmown emits a plain native form and stays out of the way entirely:
Hello — good luck with .
Submit the form and this sentence reacts. Nothing leaves the page.
Submit the form and this sentence reacts. Nothing leaves the page.
Server round-trips, adapter style
Darkmown does not own your backend — point a form at any endpoint. With JS, the submit becomes a fetch and the JSON reply lands in state; without JS, the same markup is a plain native POST:
The server answered with at .
The reply will appear here.
The reply will appear here.
The request failed:
In darkmown dev the echo endpoint is built into the dev server; on darkmown.com it is a real serverless function behind the same URL. Either way, Darkmown itself stays static — sessions ride on :fetch plus ordinary cookies against your real API.
Persistent state survives reload
:state items = [] persist keeps this section in localStorage. Add a few, reload the page, and the count holds:
The cart holds 0 item(s) worth $0.
:computed total = items.length * 4 derives state from state — the price updates with every cart change, persistence included.
The escape hatch
Colocated data.js uses the window.wd API (wd.get, wd.set) for anything directives can't say. Section state is addressed as cart:items:
Lazy loading
The list below uses when=visible — the request only fires once this section scrolls into view. Watch the network tab:
Scroll me into view and I will load.
Scroll me into view and I will load.