Skip to content

Commit f834c22

Browse files
author
Roy Lin
committed
feat: route raw input through self-drawn runtime
1 parent 373a34b commit f834c22

20 files changed

Lines changed: 2676 additions & 294 deletions

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,15 @@ independently.
294294
exposure, published only after host commit, and discarded on rejection
295295
- retained resize, fractional-scale, damage, occlusion, redraw, delayed
296296
acknowledgement, and surface-loss replay without changing semantic identity
297+
- raw pointer, keyboard, Tab-focus, hover, press, cancellation, wheel, stable
298+
action bubbling, and reducer dispatch over `PlatformElementId`; failed
299+
reducers restore the complete staged interaction session
297300
- an identical-frame fast path that performs no layout, scene, host, or
298301
presentation work, plus semantic-only commits that skip pixel presentation
299-
- a software Graphics presenter and shared `self_drawn_calculator` smoke that
300-
preserve the reviewed 410x620 layout and scene fingerprints
302+
- a software Graphics presenter and interactive shared
303+
`self_drawn_calculator` smoke that preserves the reviewed 410x620 layout and
304+
scene fingerprints, routes eight fake-host events through four reducers, and
305+
reaches the expected display value `10`
301306

302307
## Roadmap at a glance
303308

@@ -309,7 +314,7 @@ independently.
309314
| M3 · Layout and Scene | Current | Generic calculator rectangle slice landed; full flex, stacking, redraw scheduling, cross-platform fingerprints, and thin-host presentation remain |
310315
| M4 · Text and interaction cutover | Planned | Shaping, glyphs, GUI-owned input, IME, accessibility bridges, overlays, and complete calculator scenarios |
311316
| M5 · Default cutover | Planned | Make self-drawn content the default, then delete the three legacy widget renderers |
312-
| H0-H5 · Thin platform hosts | H0 complete; H1 in progress | Atomic shared frames, transactional presentation, lifecycle recovery, zero-toolkit firewalls, and calculator pixels landed; portable input/reducer routing and a real raw-surface presenter remain |
317+
| H0-H5 · Thin platform hosts | H0 complete; H1 in progress | Atomic frames, lifecycle recovery, stable-id raw input/reducer routing, zero-toolkit firewalls, and an interactive calculator landed; a real raw-surface presenter remains |
313318
| T0-T5 · TSX native authoring | Proposed | Automatic JSX runtime, versioned Node-to-host session, state/event runtime, self-drawn native window, packages, and stable SDK |
314319
| M6-M8 · React Aria components | Catalog pinned; conformance planned | 51/51 families mapped, eight public parts explicitly missing, Button scene smoke only; full software and three-OS self-drawn evidence required |
315320

@@ -327,7 +332,7 @@ The default set is `headless + authoring + design-system + software-reference`.
327332
| `software-reference` | Deterministic retained reference renderer; implies `graphics` |
328333
| `gpu` | Owned offscreen GPU renderer and readback path; implies `graphics` |
329334
| `platform-host` | H0 zero-widget records, transaction trait, recording host, and conformance tests; no Graphics or OS dependency |
330-
| `platform-runtime` | H1 Native IR/layout/scene/accessibility frame orchestration over `platform-host + graphics`; no OS toolkit dependency |
335+
| `platform-runtime` | H1 Native IR/layout/scene/accessibility frames plus stable-id raw input, interaction, action, and reducer routing over `platform-host + graphics`; no OS toolkit dependency |
331336
| `host-macos`, `host-windows` | H0 target markers over `platform-host`; OS shell implementations land in H2/H3 |
332337
| `host-linux-wayland`, `host-linux-x11`, `host-linux` | H0 target markers over `platform-host`; Linux implementations land in H4 |
333338
| `authoring` | SWC-backed RSX parsing, `ComponentCx`, and explicit component registries |
@@ -461,7 +466,7 @@ src/
461466
| LayoutSnapshot to Graphics Scene lowering
462467
|- render_contract.rs executable field/role/event milestone inventory
463468
|- platform_host/ H0 zero-widget records, transactions, recorder, and validation
464-
|- platform_runtime/ H1 atomic frames, presentation lifecycle, and Graphics smoke
469+
|- platform_runtime/ H1 atomic frames, presentation lifecycle, stable-id input/reducers, and Graphics smoke
465470
|- backend/ + platform/ legacy execution/planning migration baseline
466471
`- *_native/ AppKit, GTK4, and WinUI control hosts during migration
467472

docs/platform-hosts.md

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Self-Drawn Platform Host Architecture
22

3-
Status: H0 complete; H1 atomic frame orchestration and presentation lifecycle
4-
in progress. Portable input/reducer routing and real desktop OS shells are not
5-
implemented yet.
3+
Status: H0 complete; H1 atomic frames, presentation lifecycle, and portable
4+
input/reducer routing implemented. The real Graphics raw-surface presenter and
5+
desktop OS shells are not implemented yet.
66

77
Updated: 2026-08-02
88

@@ -44,15 +44,15 @@ The repository currently contains three distinct layers:
4444
system-service records; atomic revision transactions; a recording host; and
4545
executable dependency/source firewalls.
4646

47-
The first H1 layer now connects committed Native IR, layout, scene, hit-region,
48-
and accessibility state to the new host contract. It also owns transactional
49-
scene preparation/publication plus resize, scale, damage, occlusion, redraw,
50-
delayed acknowledgement, and surface-loss replay. Portable hit/focus/action
51-
routing is the next H1 slice. Production H2-H4 hosts must then attach Graphics
52-
to real top-level surfaces and return OS services without constructing content
53-
controls. The old control backends are frozen until this replacement passes
54-
its gates. They are migration inputs, not the target architecture and not a
55-
base for new TSX work.
47+
The shared H1 layer connects committed Native IR, layout, scene, hit-region,
48+
interaction, and accessibility state to the new host contract. It owns
49+
transactional scene preparation/publication; resize, scale, damage, occlusion,
50+
redraw, delayed acknowledgement, and surface-loss replay; and stable-id raw
51+
pointer, keyboard, focus, wheel, action, and reducer routing. Production H2-H4
52+
hosts must next attach Graphics to real top-level surfaces and return OS
53+
services without constructing content controls. The old control backends are
54+
frozen until this replacement passes its gates. They are migration inputs, not
55+
the target architecture and not a base for new TSX work.
5656

5757
## Target Pipeline
5858

@@ -207,18 +207,21 @@ tests/platform_host_firewall.rs
207207
src/platform_runtime/
208208
|- frame.rs committed Native IR/layout/scene/a11y snapshot
209209
|- runtime.rs atomic candidate preparation and host commit
210-
|- events.rs resize, scale, occlusion, redraw, and ack lifecycle
210+
|- events.rs lifecycle plus ordered input/reducer dispatch
211+
|- interaction_tree.rs stable path index, hit testing, and focus order
212+
|- interaction.rs portable state, actions, changes, and event context
213+
|- input.rs pointer capture, hover, press, and cancellation
214+
|- keyboard_input.rs keyboard activation, Tab focus, and wheel routing
211215
|- presenter.rs raw-surface prepare/publish contract and recorder
212216
|- reference_presenter.rs
213217
| transactional software Graphics evidence
214218
|- accessibility.rs stable layout-path semantic projection
215-
`- tests.rs atomicity, no-op, recovery, and identity gates
219+
`- tests.rs atomicity, input, reducer, recovery, and identity gates
216220
217221
tests/platform_runtime_firewall.rs
218222
examples/self_drawn_calculator.rs
219223
220224
Planned next:
221-
src/platform_runtime/interaction.rs
222225
src/platform_host/macos/
223226
src/platform_host/windows/
224227
src/platform_host/linux/
@@ -325,7 +328,8 @@ Evidence:
325328

326329
### H1 - Shared self-drawn window runtime
327330

328-
Status: in progress; atomic frame and presentation-lifecycle slice landed.
331+
Status: in progress; atomic frame, presentation lifecycle, and portable
332+
input/reducer slices landed. The raw-surface presenter remains.
329333

330334
Deliverables:
331335

@@ -347,16 +351,22 @@ Landed evidence:
347351
changes commit accessibility without presenting identical pixels
348352
- resize, fractional scale, damage, occlusion, redraw, delayed acknowledgements,
349353
dropped frames, and surface loss replay the retained scene deterministically
350-
- 14 focused runtime/software tests and three recursive feature/source
354+
- raw pointer, keyboard, Tab-focus, hover, press, cancellation, and wheel input
355+
route through committed hit regions and stable `PlatformElementId` paths;
356+
ordered action batches retain frame revision, event sequence, bubbling
357+
target, input context, and static action payload
358+
- reducer errors restore the staged interaction state and sequence before the
359+
event is exposed as successful; successful frame reconciliation preserves
360+
focused stable ids, while rejected frames do not touch them
361+
- 20 focused runtime/software tests and three recursive feature/source
351362
firewall tests pass without any legacy renderer or OS toolkit dependency
352-
- `self_drawn_calculator` commits the existing 410x620 shared Native IR and
353-
reproduces layout fingerprint `16529597026056060935`, scene fingerprint
354-
`2100550662756266801`, and deterministic RGBA pixels
363+
- `self_drawn_calculator` reproduces layout fingerprint
364+
`16529597026056060935`, scene fingerprint `2100550662756266801`, and
365+
deterministic RGBA pixels, then routes eight fake-host events through four
366+
reducers and reaches display value `10`
355367

356368
Remaining before H1 is complete:
357369

358-
- route raw host input through portable hit testing, focus, interaction state,
359-
action selection, and the application reducer without a legacy widget plan
360370
- implement the Graphics raw-surface presenter used by H2-H4; the landed
361371
presenter contract and software implementation deliberately expose no raw
362372
handle to components or common host records
@@ -505,8 +515,8 @@ or dependency-boundary evidence.
505515

506516
## First Reviewable Commit Sequence
507517

508-
1. Finish H1 portable hit/focus/reducer routing and bind its presenter contract
509-
to the Graphics raw-surface edge.
518+
1. Finish the H1 Graphics raw-surface presenter edge using the landed portable
519+
hit/focus/reducer routing.
510520
2. Present the rectangle-only shared calculator through the Windows host.
511521
3. Present the same rectangle-only calculator through the macOS host.
512522
4. Present it through Wayland, then add the separately gated X11 fallback.

docs/roadmap.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,9 @@ Evidence:
458458

459459
### H1 - Shared self-drawn window runtime
460460

461-
Status: in progress; atomic frame orchestration and presentation lifecycle
462-
landed, while portable input/reducer routing and a real raw-surface presenter
463-
remain.
461+
Status: in progress; atomic frame orchestration, presentation lifecycle, and
462+
portable input/reducer routing landed, while a real raw-surface presenter
463+
remains.
464464

465465
- transact scene, hit-region, accessibility, and window state as one committed
466466
host frame
@@ -479,16 +479,24 @@ Landed evidence:
479479
semantic-only changes avoid redundant presentation
480480
- resize, fractional scale, damage, occlusion, redraw, delayed acknowledgement,
481481
dropped-frame, and surface-loss tests preserve stable semantic ids
482-
- the shared 410x620 calculator passes through the runtime and deterministic
483-
software presenter with its reviewed layout and scene fingerprints unchanged
484-
- 14 focused runtime/software tests plus three recursive H1 firewall tests are
482+
- raw pointer, keyboard, Tab-focus, hover, press, cancellation, and wheel events
483+
resolve through committed layout hit regions and `PlatformElementId` paths;
484+
action selection shares the semantic callback rules used during migration
485+
without importing a widget blueprint or legacy runtime
486+
- ordered action batches carry the hit-tested frame revision and monotonic
487+
event sequence, preserve bubbling current targets and static payloads, and
488+
restore staged interaction state if an application reducer fails
489+
- the shared 410x620 calculator preserves its reviewed layout and scene
490+
fingerprints, routes eight fake-host events through four reducer actions,
491+
commits the resulting frames, and reaches display value `10`
492+
- 20 focused runtime/software tests plus three recursive H1 firewall tests are
485493
included in `just verify`
486494

487495
Remaining H1 work:
488496

489-
- portable hit testing, focus, interaction, action, and reducer routing from
490-
raw host events without depending on the legacy widget blueprint/runtime
491-
- a Graphics raw-surface presenter implementation for the H2-H4 OS shells
497+
- a Graphics raw-surface presenter implementation for the H2-H4 OS shells;
498+
richer text editing, IME, overlay gestures, and component-specific
499+
interaction conformance remain explicit M4 and M6-M8 work
492500

493501
Gates:
494502

@@ -790,8 +798,8 @@ A component or subsystem is complete only when:
790798

791799
## Immediate Commit Sequence
792800

793-
1. Finish H1 portable event/reducer routing and the Graphics raw-surface
794-
presenter edge.
801+
1. Finish the H1 Graphics raw-surface presenter edge now that portable
802+
event/reducer routing is executable.
795803
2. Present the generic rectangle slice through the H2 Windows Win32 host.
796804
3. Present the same slice through the H3 macOS system-shell host.
797805
4. Present it through H4 Wayland, then the separately gated X11 fallback.

docs/tsx-native-runtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ window control use typed session commands with capability checks.
321321
| style object | scalar style map | `CompiledStyleValue` conversion |
322322
| portable props | resolved compiled props | semantic component and intrinsic mapping |
323323
| `aria-*`, HTML, `data-*` | typed fields or attribute map | accessibility and metadata projection |
324-
| event callback | action id in `events` | action registration and `EventRouter` |
324+
| event callback | action id in `events` | shared semantic action selection and the stable-id self-drawn interaction session |
325325
| `Window` | frame `window` metadata | platform window session |
326326
| custom function component | evaluated before transport | no native node |
327327

0 commit comments

Comments
 (0)