diff options
| author | Gabriel Schneider <[email protected]> | 2026-08-01 22:44:19 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-10 09:17:07 -0300 |
| commit | d59397d4146ffa23adbbe6dc99c64ebb22a93b2d (patch) | |
| tree | a06984bf172a6c894c1586d58aad02ec302b6c2d /docs/design.typ | |
| parent | cbcdf01764e2e144a821643c3a8e9a5ad39eda2e (diff) | |
| download | pardes-d59397d4146ffa23adbbe6dc99c64ebb22a93b2d.tar.gz pardes-d59397d4146ffa23adbbe6dc99c64ebb22a93b2d.zip | |
add vanilla DOM web backend
Diffstat (limited to 'docs/design.typ')
| -rw-r--r-- | docs/design.typ | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/docs/design.typ b/docs/design.typ index 763dcde4..9cc05cab 100644 --- a/docs/design.typ +++ b/docs/design.typ @@ -18,7 +18,8 @@ is text and all text is equally alive, whether the shell printed it or the user typed it. It runs in three places: the terminal (libvaxis), a native SDL3 window (the -steamdeck), and the browser (wasm + SDL3 + emscripten). The rewrite exists because +steamdeck), and the browser (a freestanding wasm core driven by vanilla +JavaScript and rendered as HTML/CSS). The rewrite exists because the prototype grew three parallel implementations of one program. The rewrite has exactly one program and three thin shells. @@ -59,8 +60,9 @@ input: one event vocabulary, three dialects translated at the door. *Surface* (out): a grid of cells — grapheme, fg, bg, attrs — plus a cursor and per-pane rectangles. This is the *canonical interface*: it is literally what the -tty shell hands to vaxis, cell by cell. The SDL shells rasterize the same grid -through a glyph atlas. If it cannot be expressed in the surface, it does not +tty shell hands to vaxis, cell by cell. SDL rasterizes the same grid through a +glyph atlas; the browser reads a packed copy and patches native DOM cells. If it +cannot be expressed in the surface, it does not exist in pardes. (Pixel images ride along as an attachment per pane: the SDL shells blit RGBA, the tty shell falls back to the petscii matcher, kitty graphics when available.) @@ -136,7 +138,7 @@ only goes down. As built, against the prototype's 12,072 lines of Zig: [*module*], [*lines*], [], [core (pardes.zig + look.zig + syntax + image + dump)], [4,289], [all semantics, all platforms], [modal.zig + petscii.zig (pure, unit-testable)], [1,410], [carried over, unchanged], - [shells (tty.zig; gui.zig = sdl native + web)], [2,768], [translate + rasterize only], + [shells (tty.zig; gui.zig = SDL native; web.zig + web/ = browser)], [2,768], [translate + render only], [main.zig + build.zig], [484], [three targets, codegen for queries], [*application total*], [*7,626*], [vs 12,072 — three full backends instead of one and a half], [snapshot harness (snapshot.zig + e2e_harness.zig)], [831], [the parity oracle, kept], @@ -170,8 +172,8 @@ test. = Build `zig build` produces three statically linked artifacts: `pardes` (vaxis), -`pardes-gui` (SDL3), `pardes.wasm` + shell page (emscripten). Same dependency -set as the prototype — ghostty, vaxis, uucode (shared config), zstbi, SDL +`pardes-gui` (SDL3), `pardes.wasm` + a vanilla DOM shell (wasm32-freestanding). +Same native dependency set as the prototype — ghostty, vaxis, uucode (shared config), zstbi, SDL (castholm, lazy), zig-tree-sitter + grammars — all via `zig fetch`, wired in `build.zig`. Codegen during build, consumed by comptime: tree-sitter `highlights.scm` → options module; tutor text → embedded pane content. Debug @@ -260,23 +262,23 @@ instead of looking it and stepping the list wears the themes. Colors toggles all recolor passes; Debug stats overlay; Dump writes state ZON. *Web (replay viewer parity).* Embedded dump; focus, border/move drags, wheel, -scrollbar, Colors/NextColor, pinch, render scale, and link-LOOK opening a new +scrollbar, Colors/NextColor, and link-LOOK opening a new tab (new — the prototype has no web link handling). One-finger touch is deliberately complete by itself: tap = LOOK; drag past a small slop = natural scroll, with no LOOK on release. A build-generated read-only archive lets LOOK open the current contents of Git-tracked Pardes `.zig` files despite the web shell having no host filesystem. The published launcher dump is captured from a running Pardes TTY after `git ls-files '*.zig'`, so its complete terminal -listing is the set the user can open; the published web build carries only the -Zig tree-sitter grammar and colors opened source panes without shipping unused -C/C++ parsers. A body gesture retains tap-LOOK/drag-scroll, but finger-down on +listing is the set the user can open. The freestanding module carries no host +libc, SDL, or WebGL; Tree-sitter's C runtime and the selected parsers link into +the module through a tiny local ABI shim (Zig is the compact web default). A body gesture retains +tap-LOOK/drag-scroll, but finger-down on a tagline or a one-cell-tolerant pane separator latches to a left-mouse gesture for its lifetime, keeping layout drags out of the scroll heuristic. Touch -circles, trails, and click flashes render only while Debug is enabled. SDL -shells use an -stb_truetype atlas over the SDL GPU API (SPIR-V on native, GLES3 on web), -letterboxed web scaling, pinch, and a touch debug overlay. `PARDES_TEST` -provides PPM and text-grid capture; the browser `.snap` harness drives real -Chromium touch input and reads both text and per-cell styles from the rendered +input translation and scroll/tap state live entirely in the JavaScript shell. +The native SDL shell uses an stb_truetype atlas over the SDL GPU API (SPIR-V). +The browser exposes each cell as selectable, inspectable text and applies the +surface styles with CSS. The browser `.snap` harness drives real Chromium touch +input and reads both text and per-cell styles from the DOM renderer's packed surface. Joystick cursor for the steamdeck is *new* scope — the prototype ships no gamepad input. |
