Skip to content

Commit a8077bf

Browse files
author
Roy Lin
committed
docs: redesign GUI around A3S Graphics
1 parent c8eaa24 commit a8077bf

4 files changed

Lines changed: 498 additions & 530 deletions

File tree

README.md

Lines changed: 51 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</p>
66

77
<p align="center">
8-
<em>Reducer-driven Rust components, structured RSX, and direct AppKit, GTK4, and WinUI rendering without a browser runtime.</em>
8+
<em>Reducer-driven Rust components, structured RSX, and an A3S-owned GPU rendering engine without a browser runtime.</em>
99
</p>
1010

1111
---
@@ -14,21 +14,23 @@
1414

1515
**A3S GUI** is a native GUI runtime for structured A3S UI frames. Applications
1616
describe semantic UI in Rust function components or `.rsx` modules, update
17-
state through reducers, and render the same portable native IR through one of
18-
four hosts:
17+
state through reducers, and lower the same portable native IR into layout,
18+
paint, interaction, and accessibility records. Application pixels are moving
19+
to the shared [`a3s-graphics`](https://github.com/A3S-Lab/Graphics) engine,
20+
whose production path uses `wgpu` directly for Metal, Direct3D 12, and Vulkan.
1921

20-
- AppKit on macOS
21-
- GTK4 on Linux
22-
- WinUI on Windows
23-
- a deterministic headless host for tests and protocol integration
22+
The current AppKit, GTK4, WinUI, and deterministic headless hosts remain as the
23+
migration baseline. New rendering work targets the self-drawn Graphics path;
24+
the three control renderers will be removed after the generic calculator,
25+
input, IME, and accessibility cutover gates pass.
2426

2527
The crate provides:
2628

2729
- `ComponentCx` function components with state, props, context, derived values,
2830
effects, resources, reducers, and interaction hooks
2931
- static RSX lowering for semantic components, intrinsic elements, bindings,
3032
actions, fragments, slots, and spreads
31-
- keyed reconciliation and ordered native command batches
33+
- stable semantic identity, retained rendering, and ordered frame transactions
3234
- a strict versioned protocol with prepare, commit, ACK, recovery, replay, and
3335
sensitive-value redaction
3436
- portable interaction behavior for press, hover, focus, selection, overlays,
@@ -40,9 +42,10 @@ The crate provides:
4042
- a built-in `rsx_ui` component registry plus calculator, dogfood, and
4143
component-playground applications
4244

43-
A3S GUI does not embed a DOM, CSSOM, WebView, or JavaScript object graph. RSX
44-
uses familiar component syntax, but it compiles into typed native data and
45-
platform widget operations.
45+
A3S GUI does not embed a DOM, CSSOM, WebView, framework-owned content renderer,
46+
or JavaScript object graph.
47+
RSX uses familiar component syntax, but it compiles into typed semantic,
48+
layout, graphics-scene, interaction, and accessibility data.
4649

4750
The long-term behavioral direction is a native, cross-platform counterpart to
4851
[React Aria](https://react-aria.adobe.com/getting-started). This is not a DOM
@@ -60,8 +63,8 @@ a3s-gui = { git = "https://github.com/A3S-Lab/GUI" }
6063
```
6164

6265
The default feature set includes the headless runtime, RSX authoring, and the
63-
built-in design system. Add the matching native feature to open real platform
64-
widgets:
66+
built-in design system. During the renderer migration, the matching legacy
67+
native feature still opens the platform-control baseline:
6568

6669
```toml
6770
# macOS
@@ -125,10 +128,10 @@ just playground
125128
| `headless` | Deterministic runtime and host behavior without an OS GUI |
126129
| `authoring` | SWC-backed RSX parsing, `ComponentCx`, and explicit component registries |
127130
| `design-system` | Built-in `rsx_ui` registry; implies `authoring` |
128-
| `appkit`, `gtk4`, `winui` | Pure planning adapters that do not link an OS widget toolkit |
129-
| `appkit-native` | Real AppKit surface on macOS |
130-
| `gtk4-native` | Real GTK4 surface on Linux |
131-
| `winui-native` | Real WinUI 3 surface on Windows |
131+
| `appkit`, `gtk4`, `winui` | Legacy planning adapters retained for migration evidence |
132+
| `appkit-native` | Legacy AppKit control surface on macOS |
133+
| `gtk4-native` | Legacy GTK4 control surface on Linux |
134+
| `winui-native` | Legacy WinUI 3 control surface on Windows |
132135

133136
Runtime and protocol consumers can exclude the authoring stack:
134137

@@ -150,15 +153,23 @@ Rust ComponentCx function or .rsx module
150153
|
151154
v
152155
semantic native UI IR
156+
/ | \
157+
v v v
158+
layout semantics interaction/hit tree
159+
| | |
160+
v | |
161+
Graphics Scene | |
162+
| | |
163+
v | |
164+
software / wgpu | |
165+
| | |
166+
+----------+-----------+
153167
|
154168
v
155-
keyed reconciliation and command batches
169+
thin platform host and normalized events
156170
|
157171
v
158-
AppKit / GTK4 / WinUI / headless host
159-
|
160-
v
161-
normalized native events and action reducers
172+
action reducers
162173
```
163174

164175
The main ownership boundaries are explicit:
@@ -168,13 +179,13 @@ The main ownership boundaries are explicit:
168179
| Authoring | Rust components, hooks, RSX parsing, component contracts, and bindings |
169180
| Protocol | Serializable frames, actions, revisions, events, ACKs, and recovery |
170181
| Runtime | Reducer flow, interaction state, effects, focus, selection, and overlays |
171-
| Renderer | Stable-key reconciliation and ordered host operations |
172-
| Platform planning | Portable widget blueprints, setters, capabilities, and command batches |
173-
| Native surface | OS widget lifetime, thread affinity, raw input, focus, accessibility, and event delivery |
182+
| Layout and scene adapter | Stable layout records, paint extraction, hit regions, and explicit projection diagnostics |
183+
| A3S Graphics | Scene validation, retained damage, render preparation, software reference, shaders, and GPU rendering |
184+
| Platform host | Window/surface lifetime, raw input, IME, focus, accessibility bridge, system surfaces, and event delivery |
174185

175-
Application state and product I/O remain outside the renderer. Native backends
176-
never execute component functions, and thread-affine native handles never cross
177-
the serializable host boundary.
186+
Application state and product I/O remain outside the renderer. Graphics and
187+
platform hosts never execute component functions, and thread-affine native or
188+
GPU handles never cross the serializable boundary.
178189

179190
## Component And Hook Model
180191

@@ -272,7 +283,8 @@ framework.
272283
| Headless runtime | Usable for deterministic tests, protocol sessions, rendering, accessibility, and capability inspection |
273284
| Protocol and native execution | Versioned protocol v1 with ordered revisions, retained resend, exact ACK validation, degraded state, and fresh-executor replay |
274285
| Built-in design system | Broad dogfood component set with calculator and component-atlas coverage |
275-
| AppKit, GTK4, and WinUI | Real native surfaces with host-native CI; continuing platform-edge hardening |
286+
| Self-drawn Graphics path | Deterministic scene/reference core exists independently; GPU and GUI lowering are the active P0 work |
287+
| AppKit, GTK4, and WinUI controls | Migration baseline only; frozen until removal after self-drawn cutover |
276288
| Native input evidence | Canonical manifests and a strict verifier are implemented; the WinUI harness covers its current 98-case matrix, while AppKit and GTK4 OS-automation evidence is incomplete |
277289
| Packaging | Reproducible unsigned smoke bundles; signing, notarization, installers, and product update metadata remain application responsibilities |
278290
| React Aria direction | Substantial shared behavior foundation; full component, platform, and assistive-technology parity is still in progress |
@@ -301,7 +313,7 @@ just playground
301313
just dogfood-native
302314
```
303315

304-
The AppKit, GTK4, and WinUI calculator entrypoints use the same
316+
The legacy AppKit, GTK4, and WinUI calculator entrypoints use the same
305317
`shared_calculator_component`, state model, reducer, RSX component tree, window
306318
constraints, and explicit keypad sizing. Their semantics and layout intent are
307319
therefore shared. Exact pixels still follow each native toolkit's control
@@ -323,8 +335,9 @@ cargo run --locked --features <backend>-native --example <backend>_dogfood
323335
| --- | --- |
324336
| Authoring | Rust-first function components and static RSX, not JavaScript execution |
325337
| State | Explicit reducers and one-way state-to-frame-to-action flow |
326-
| Rendering | Semantic native IR and stable-key reconciliation |
327-
| Widgets | Real AppKit, GTK4, and WinUI controls by default |
338+
| Rendering | Native IR to deterministic GUI layout and A3S Graphics scene |
339+
| Pixels | A3S-owned software reference and `wgpu` renderer; no framework-owned content renderer |
340+
| Platform | Thin window, input, IME, accessibility, system-surface, and presentation hosts |
328341
| Behavior | Shared headless contracts with field- and role-level native capability reporting |
329342
| Accessibility | Portable semantic truth plus exact native projection where supported |
330343
| Styling | Portable native style tokens and selected utility syntax, not a browser CSS engine |
@@ -338,17 +351,17 @@ cargo run --locked --features <backend>-native --example <backend>_dogfood
338351
src/
339352
├── accessibility/ # Semantic tree, conformance, relationships, and native-ready values
340353
├── app/ # Reducer-driven native application loop
341-
├── backend/ # Command execution, recording, and recovery
342-
├── platform/ # Portable widget planning and setter batches
354+
├── backend/ # Legacy command execution and recovery during migration
355+
├── platform/ # Legacy widget planning during migration
343356
├── protocol.rs # Versioned frame, action, event, and ACK boundary
344357
├── native.rs # Portable native UI IR
345-
├── renderer.rs # Stable-key reconciliation
358+
├── renderer.rs # Legacy stable-key control reconciliation
346359
├── runtime/ # Interaction, focus, overlays, effects, and rerender flow
347360
├── rsx_app/ # ComponentCx, hooks, components, and binding scope
348361
├── rsx_ui/ # Built-in semantic design-system registry
349-
├── appkit_native/ # Real macOS surface
350-
├── gtk4_native/ # Real Linux surface
351-
└── winui_native/ # Real Windows surface
362+
├── appkit_native/ # Legacy macOS control surface; future thin host
363+
├── gtk4_native/ # Legacy Linux control surface; future thin host
364+
└── winui_native/ # Legacy Windows control surface; future thin host
352365
353366
examples/ # Headless, calculator, dogfood, controls, and playground apps
354367
docs/ # Architecture, language, platform, packaging, and roadmap contracts

docs/architecture.md

Lines changed: 59 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
# a3s-gui Architecture
22

3-
`a3s-gui` accepts structured UI input and emits native platform commands for
4-
AppKit, WinUI, and GTK4 backends.
3+
`a3s-gui` accepts structured UI input and produces a deterministic layout,
4+
paint scene, interaction tree, and accessibility tree. Application content is
5+
rendered by the A3S-owned [`a3s-graphics`](https://github.com/A3S-Lab/Graphics)
6+
engine. Graphics uses a deterministic software reference path and an owned
7+
`wgpu` path for Metal, Direct3D 12, and Vulkan; it has no RSX, widget,
8+
accessibility, or window-system dependency.
59

610
The input contract is structured RSX element data: protocol element records,
711
semantic element names, `className`, inline style objects, `aria-*`, `data-*`,
812
and DOM-style event props. Supported `semantic_ui` component names are treated
9-
as semantic identifiers. The renderer consumes A3S Native UI IR; host adapters
10-
create platform widgets directly.
13+
as semantic identifiers. The renderer consumes A3S Native UI IR. Thin platform
14+
hosts own windows, raw input, IME, accessibility bridges, menus, dialogs,
15+
clipboard, and frame presentation, but they do not lay out or draw application
16+
content.
17+
18+
The current AppKit, GTK4, and WinUI control renderers remain a migration
19+
baseline until the self-drawn calculator passes the cross-platform cutover
20+
gates. They are compatibility code, not the target architecture. New rendering
21+
features must enter through the layout and Graphics scene path.
1122

1223
```text
1324
Rust ComponentCx function + optional RSX view template
@@ -29,21 +40,30 @@ Semantic UI tree
2940
|
3041
v
3142
A3S Native UI IR
43+
/ | \
44+
v v v
45+
layout semantics interaction/hit tree
46+
| | |
47+
v | |
48+
A3S Graphics Scene |
49+
| | |
50+
v | |
51+
FramePlanner | |
52+
| | |
53+
+----+ | |
54+
| | |
55+
v | |
56+
software / wgpu renderer |
57+
| | |
58+
v v |
59+
thin platform host <-----+
60+
- window + surface presentation
61+
- raw input + IME
62+
- accessibility bridge
63+
- menus, dialogs, clipboard
3264
|
3365
v
34-
Keyed renderer diff engine
35-
|
36-
v
37-
Native command stream
38-
|
39-
v
40-
NativeHost adapter
41-
- AppKit on macOS
42-
- WinUI on Windows
43-
- GTK4 on Linux
44-
|
45-
v
46-
Native events
66+
Normalized native events
4767
|
4868
v
4969
HostEvent protocol
@@ -61,8 +81,8 @@ Action ids
6181
## Contract
6282

6383
The bridge accepts semantic component names, HTML and SVG intrinsic names,
64-
common Web props, and event names. The native renderer receives a typed,
65-
portable protocol. Input records come from Rust `ComponentCx` functions,
84+
common Web props, and event names. The GUI renderer receives a typed, portable
85+
protocol. Input records come from Rust `ComponentCx` functions,
6686
registered `.rsx` view templates, `RsxComponent` hook registrations, or Rust
6787
code that builds the same protocol shape.
6888

@@ -132,17 +152,23 @@ semantic mapper, renderer, and planning core compile without SWC or `rsx_ui`.
132152
The remaining dependencies stay one-way:
133153

134154
- `ComponentCx`, RSX parsing, and `rsx_ui` authoring compile outward-facing
135-
syntax into `CompiledRsxNode`; native backends never execute component
136-
functions.
155+
syntax into `CompiledRsxNode`; layout, Graphics, and platform hosts never
156+
execute component functions.
137157
- `rsx_ui` depends on semantic component contracts. The semantic mapper,
138-
native IR, renderer, and platform planning layers do not depend on the
158+
native IR, layout, scene adapter, and Graphics layers do not depend on the
139159
built-in design-system registry.
140-
- `src/native.rs`, reconciliation, and `src/platform/` remain independent of OS
141-
widget handles. AppKit, GTK4, and WinUI surfaces depend on those portable
142-
types and are selected behind their target/feature boundaries.
143-
- `src/backend/` executes planned commands but does not own product state or
144-
product I/O. The serializable host boundary carries data and command records,
145-
never component runtime instances or thread-affine native handles.
160+
- GUI layout and scene extraction depend on `a3s-graphics` public scene types.
161+
`a3s-graphics` never depends on `a3s-gui`, an operating-system window API, or
162+
product code.
163+
- `wgpu` types remain inside Graphics. They do not leak into protocol,
164+
`NativeElement`, portable style, components, or product application APIs.
165+
- Platform hosts consume GUI interaction/accessibility records and Graphics
166+
presentation records. Thread-affine window, accessibility, IME, and surface
167+
handles stay at that outer edge.
168+
- During migration, `src/renderer.rs`, `src/host.rs`, `src/platform/`, and
169+
`src/backend/` implement the legacy control path. They may not gain new
170+
visual behavior and are deleted when the equivalent scene/presentation and
171+
recovery gates pass.
146172
- `src/effect.rs` defines an executor seam without depending on Tokio or another
147173
application runtime. An application may inject such an executor at the outer
148174
edge.
@@ -195,7 +221,11 @@ artifact. The harness requires an interactive Windows desktop and the Windows
195221
App Runtime 1.7 framework package used by the WinUI backend's dynamic
196222
dependency.
197223

198-
## NativeHost Boundary
224+
## Legacy NativeHost Compatibility Boundary
225+
226+
This section documents the current control renderer so its behavior can be
227+
preserved and then removed deliberately. It is not the destination for new
228+
rendering work. The removal gates are tracked in `docs/roadmap.md`.
199229

200230
Every platform adapter implements the same host operations:
201231

docs/react-aria-native.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ design system without depending on a browser.
77

88
This is a behavioral compatibility target, not a DOM compatibility target.
99
React Aria's public concepts should have recognizable native equivalents, but
10-
the implementation must use AppKit, GTK4, and WinUI controls, focus systems,
11-
accessibility APIs, and input events directly.
10+
the implementation uses A3S-owned layout and Graphics rendering together with
11+
the operating system's window, focus, accessibility, IME, and input APIs.
1212

1313
The project does not claim React Aria parity yet.
1414

@@ -25,13 +25,20 @@ Headless behavior contracts
2525
Portable semantic tree and typed Native UI IR
2626
|
2727
v
28-
Behavior state machines and keyed reconciliation
28+
GUI layout, behavior state machines, and stable identity
2929
|
30-
v
31-
Versioned platform capabilities
30+
+--------+--------+
31+
| |
32+
v v
33+
A3S Graphics scene semantic/accessibility tree
34+
| |
35+
v v
36+
software / wgpu platform accessibility bridge
37+
| |
38+
+--------+--------+
3239
|
3340
v
34-
AppKit / GTK4 / WinUI native adapters
41+
thin macOS / Linux / Windows host
3542
3643
Native input and accessibility events travel upward through the same layers.
3744
```

0 commit comments

Comments
 (0)