One file, every device

2 min·Assumes: state, events

You write a
once, and Markless works it out when you
it, for every place it runs.
import { state } from '@markless/core';

export default function SeatMap() @{
	let seat = state('A2');

	<p>Your seat: {seat}</p>
}

seat is a value the page watches, and {seat} is the spot that shows it. That is the whole plan, and it doesn't say which device it runs on.

The plan is the same on every host

Drag the file onto each host, then pick a seat:

A pen-and-ink drawing of one file, seatmap.tsrx, beside three hosts: a browser window, a phone marked early proof, and a server terminal. Drag the file onto a host, press a host, or press 1, 2 or 3: the browser draws the seat map as a web page, the phone draws the same seats as native buttons, and the server prints the HTML it sends. Then press a seat in the browser or on the phone to pick it; seats A3 and B1 are taken. Press the file itself and it wobbles: there is one file, planned at compile time for every host. Escape starts again.

One file, seatmap.tsrx, and three hosts: a browser, a phone and a server. Drag the file onto a host, or press.

  • The browser draws the plan as a web page.
  • A server prints the plan as the HTML it sends.
  • The phone draws it with native buttons. Native is an early proof: the web is what ships.

Pick where it renders

The compiled component is the same in each place; only the call changes:

  • Browser

    Call render(App, { target }) from @markless/core: a plain Vite app with no server at all.

  • Server

    Call renderToString(), or renderToStream() to send it in pieces, for HTML that is ready when it arrives.

  • Multi-page app

    @markless/router gives you file routes on Nitro, which deploys to many hosts.

  • Tests

    render() and renderSSR() from @markless/vitest-browser run browser tests, with or without a server render first.

  • Build time

    The repo’s demos can prerender pages as a preview; there is no public option yet.

  • iOS and macOSearly proof

    Hand-written proofs, not wired to the compiler yet.

PlaygroundRestored your edit

Your seat: A2

Ram: we land in a few thousand days.
Try this
  1. To do: Press B4. You move next to Melon Tusk, who renames your seat.
  2. To do: Start at B1 instead of A2.
  3. To do: Add a seat: in cabin.ts, put 'C1' at the end of SEATS. It lands on a new row, with nobody beside it yet.

What stays the same everywhere

  • Setup runs once. On a server the body runs there, and the browser never runs it again.
  • No handler runs before its event. Fetching code early is not running it.
  • A write reaches only its readers. Nothing compares an old page with a new one.

The compiler shows the plan it writes.