blocks is an opinionated UI framework whose screens are data: typed blocks, checked, then drawn by a renderer. It has
two modes. Mode A, server-driven (drover, cooee): a Rust server builds screens and sends row ops over the device
stream. Mode B, client-built (a client-built app): TS builders in a route loader build the screen and the React adapter draws it,
with no server and no stream; it uses the kinds, the generated types, the builders, check, blocks.css and the guard
kit, and not shelf, mirror, the stream, wire versioning or site.
Shipped: the crate (typed blocks, their row diff and ops, the device stream protocol) with the codegen that turns its
Rust types into JSON Schema, TS and Swift; the theme rules (scheme tokens, the gate, styles, the pack check) and one
neutral default pair; the SwiftUI package; the HTML renderer and shell, the static site renderer, and the headless
harnesses (docs/architecture/blocks/migration.md).
- One definition of a screen: Rust types, with the schema, TS and Swift generated from them (
docs/schema.md). - Screens change by row ops in Mode A:
difftwo screens,applythe ops, and resume a stream after a reconnect. - Held to drover's standard from the first commit: every gate below runs in CI and in
just check.
- No drover or cooee imports. They depend on blocks, never the other way.
- No transport: no tokio, HTTP or sockets. Streams are carried by drover and cooee.
- No named colour scheme or theme pack: those live in jirathip-dev/swag, which an app pins beside blocks.
just check runs them all locally but just sim, whose fixed seeds run inside just test (it needs just, cargo-deny, actionlint, node 24, and drover on PATH or in $DROVER).
just fmt,just clippy: rustfmt, clippy pedantic, and the banned APIs (.drover/rules.md)just fixtures: each lint fixture inci/lint-fixtures/rust/andweb/lint-fixtures/must failjust test,just perf,just soak: the tests, the release perf budgets and the flat-memory soakjust sim 2000: random op sequences on random screens, then one seeded corpus of screens, ops and expressions through Rust, TS and Swift; also run nightly (.github/workflows/sim.yml)just deps,just deny: the allow-list indocs/deps.md, then licences, advisories, duplicates and sourcesjust web: strict tsc andweb/lint.mjsonweb/src(the generatedgen/and the hand-written renderer, stream and patcher), then the node tests inweb/test/just arch,just cap: drover's arch-check (.drover/arch.toml), and the line cap: the highestline_capinci/cap.tomlandci/cap.d/*.toml, now 15,000 (scripts/line-cap.sh)just desktop: the desktop renderer's tests (crates/blocks-desktop, egui), and no egui in theblockscrate's treejust actionlint,just swift: the workflows, and the Swift package on macOS (op apply, the generated types, a render test per core kind), warnings as errors
Start a screen with the usage skill skill/blocks/ (an app's lanes get it from blocks skill --to <dir>), from an
example screen in skill/blocks/examples/, and check it headlessly with blocks check --shot (docs/guard.md).
The root Package.swift ships Blocks (the generated types, JSONValue, op apply, Replica: the ADR's Swift Mirror, renamed so it does not shadow Swift's own) and BlocksUI
(BlocksView, .appBlocks for an app's own kinds, .blockStyle). An app pins a release tag, the
v<SCHEMA_VERSION>.<n> the release workflow cuts on a green main:
.package(url: "https://github.com/jirathip-dev/blocks", exact: "<tag>").
An app block is built from public pieces: BlockNode and BlockStack (blocks inside it), ActButton with a Source
(a tap or action), MenuItems (acts as menu buttons), RelativeValue (a text redrawn each minute), the card
environment entry's CardContext, Refreshing (pull to refresh) and LayoutTransition.entering. An app with its own
Look, Palette or look entry keeps them: its own names shadow BlocksUI's, and .blocksLook(Look(palette: Palette(...), tiles: nil)) hands BlocksUI the app's colours with no dot grid and no build-up. A menu screen stays the
app's own: its rows (an account, settings groups) are no core kind.
MIT, see LICENSE.