MBUI ARCHITECTURE
One retained tree from MoonBit to GPU.
No virtual DOM, no WebView — one tree, six GPUs.
@signals
Equal writes stop here — T : Eq short-circuits.
0 WebView · 0 JS bridge
SIGNALS & LAYOUT
Build once. Update only what changed.
Equal values stop at the signal; only the bound leaf repaints.
let unread = @signals.signal(3) let label = @signals.computed(fn(_) { "\{unread.get()} unread" }) row.words_runs(By(fn() { runs(label.get()) })) unread.set(3)
Signal[Int]
unread = 3
Computed[String]
idle
View::words_runs
idle
Toolbarskipped
Sidebarskipped
ScrollListskipped
0 virtual DOM allocations
Click unread.set(+1)
CLOSED-FORM MOTION
Motion as data, never frame loops.
Springs are functions of time: interrupt anytime, velocity carries over.
x(t)
Original
Retargeted
Retargett₀ = 140ms
x(t₀)—
v(t₀)—
Δv jump0.00/s
Settles—
let way = @motion.NodeWay::new(0.0) way.go(v, 1.0, @motion.spring()) way.go(v, 0.3, @motion.spring()) // keeps v(t₀)
6 GPU BACKENDS
One display list. Six native GPUs.
Thin native hosts, native text and IME, one shared display list.
macOS
MetalAppKit, CoreText, offscreen Metal capture.
iOS
MetalUIKit touch, safe areas, native keyboard.
Android
OpenGL ESJNI host driving OpenGL ES directly.
Windows
Direct3D 11Win32, DirectWrite, DPI-aware windows.
Linux
OpenGLGTK 4 on Wayland, X11, headless CI.
Web
WebGL 2Canvas WebGL 2 for docs and Storybook.
@hostapi boundary
Every OS call crosses one trait; tests swap in FakeHost.
App & @view
MoonBit
@hostapi · Host
one boundary
src/host/*
6 GPU hosts
FakeHost
headless CI
mbui-runtime
Rebuild only the .wasm; a prebuilt Wasmtime shell runs it.
Full native build
C · Xcode · NDK
.wasm → Wasmtime
seconds
DETERMINISTIC TESTER
Time is declared, never waited for.
Script input, declare time, get identical pixels at every frame rate.
01tapxy 180 64
02drag 240 420 240 160
03run_for 320ms
04audit --strict
05picture out.webp
120 fpssha256:9f4c…a81e—
60 fpssha256:9f4c…a81e—
24 fpssha256:9f4c…a81e—
7 fpssha256:9f4c…a81e—
audit(): —
IDLE