Native targets, an early proof
Markless is built to compile one web-like
to any device. Today the web ships; iOS and macOS are early proofs.
import { state } from '@markless/core';
export function Counter() @{
let count = state(0);
<button onClick={() => count++}>Count {count}</button>
}This is the proof's real source. <button> becomes a native UIButton on iOS and an NSButton on macOS, and onClick runs in JavaScriptCore when you tap it.
The views are native, not a web page
Press Debug View Hierarchy, then search the layers for WebView:
An iPhone running the early Markless proof: a native label and a native button. Press Debug View Hierarchy to look inside.
- The layers are the proof's own views:
UIWindow,UIView,UIStackView,UILabel,UIButton. - There is no
WKWebViewanywhere, and a check script in the proof makes sure of it. - Tapping the button runs the handler, and the native button sets its own title.
How the proof works today
The plan the proof runs, its artifact.json, is written by hand. It lists the state, the views, the event and the text binding:
{
"node": "host:button",
"authoredEvent": "onClick",
"semanticEvent": "activate",
"nativeEvent": "touchUpInside",
"symbolId": "symbol:counter.increment"
}Not yet:
- The compiler doesn't write
artifact.json. Both proofs live inpoc/fixtures/proofs/. - They don't use
@markless/runtime, and don't cover styling, lists, navigation or packaging. - Android, Windows and Linux are not started.
Want a device sooner? Contributing shows where to start.