@@ -19,21 +19,120 @@ A2UI uses an **adjacency list model** for component hierarchies. Instead of nest
1919
2020## The Adjacency List Model
2121
22- ``` json
23- {
24- "surfaceUpdate" : {
25- "components" : [
26- {"id" : " root" , "component" : {"Column" : {"children" : {"explicitList" : [" greeting" , " buttons" ]}}}},
27- {"id" : " greeting" , "component" : {"Text" : {"text" : {"literalString" : " Hello" }}}},
28- {"id" : " buttons" , "component" : {"Row" : {"children" : {"explicitList" : [" cancel-btn" , " ok-btn" ]}}}},
29- {"id" : " cancel-btn" , "component" : {"Button" : {"child" : " cancel-text" , "action" : {"name" : " cancel" }}}},
30- {"id" : " cancel-text" , "component" : {"Text" : {"text" : {"literalString" : " Cancel" }}}},
31- {"id" : " ok-btn" , "component" : {"Button" : {"child" : " ok-text" , "action" : {"name" : " ok" }}}},
32- {"id" : " ok-text" , "component" : {"Text" : {"text" : {"literalString" : " OK" }}}}
33- ]
34- }
35- }
36- ```
22+ === "v0.8"
23+
24+ ```json
25+ {
26+ "surfaceUpdate": {
27+ "components": [
28+ {
29+ "id": "root",
30+ "component": {
31+ "Column": {
32+ "children": { "explicitList": ["greeting", "buttons"] }
33+ }
34+ }
35+ },
36+ {
37+ "id": "greeting",
38+ "component": {
39+ "Text": { "text": { "literalString": "Hello" } }
40+ }
41+ },
42+ {
43+ "id": "buttons",
44+ "component": {
45+ "Row": {
46+ "children": { "explicitList": ["cancel-btn", "ok-btn"] }
47+ }
48+ }
49+ },
50+ {
51+ "id": "cancel-btn",
52+ "component": {
53+ "Button": {
54+ "child": "cancel-text",
55+ "action": { "name": "cancel" }
56+ }
57+ }
58+ },
59+ {
60+ "id": "cancel-text",
61+ "component": {
62+ "Text": { "text": { "literalString": "Cancel" } }
63+ }
64+ },
65+ {
66+ "id": "ok-btn",
67+ "component": {
68+ "Button": {
69+ "child": "ok-text",
70+ "action": { "name": "ok" }
71+ }
72+ }
73+ },
74+ {
75+ "id": "ok-text",
76+ "component": {
77+ "Text": { "text": { "literalString": "OK" } }
78+ }
79+ }
80+ ]
81+ }
82+ }
83+ ```
84+
85+ === "v0.9"
86+
87+ ```json
88+ {
89+ "version": "v0.9",
90+ "updateComponents": {
91+ "surfaceId": "main",
92+ "components": [
93+ {
94+ "id": "root",
95+ "component": "Column",
96+ "children": ["greeting", "buttons"]
97+ },
98+ {
99+ "id": "greeting",
100+ "component": "Text",
101+ "text": "Hello"
102+ },
103+ {
104+ "id": "buttons",
105+ "component": "Row",
106+ "children": ["cancel-btn", "ok-btn"]
107+ },
108+ {
109+ "id": "cancel-btn",
110+ "component": "Button",
111+ "child": "cancel-text",
112+ "action": { "event": { "name": "cancel" } }
113+ },
114+ {
115+ "id": "cancel-text",
116+ "component": "Text",
117+ "text": "Cancel"
118+ },
119+ {
120+ "id": "ok-btn",
121+ "component": "Button",
122+ "child": "ok-text",
123+ "action": { "event": { "name": "ok" } }
124+ },
125+ {
126+ "id": "ok-text",
127+ "component": "Text",
128+ "text": "OK"
129+ }
130+ ]
131+ }
132+ }
133+ ```
134+
135+ v0.9 uses a flatter component format: `"component": "Text"` instead of nested `{"Text": {...}}`, and children are simple arrays instead of `{"explicitList": [...]}`.
37136
38137Components reference children by ID, not by nesting.
39138
@@ -45,9 +144,30 @@ Every component has:
451442 . ** Type** : Component type (` Text ` , ` Button ` , ` Card ` )
461453 . ** Properties** : Configuration specific to that type
47146
48- ``` json
49- {"id" : " welcome" , "component" : {"Text" : {"text" : {"literalString" : " Hello" }, "usageHint" : " h1" }}}
50- ```
147+ === "v0.8"
148+
149+ ```json
150+ {
151+ "id": "welcome",
152+ "component": {
153+ "Text": {
154+ "text": { "literalString": "Hello" },
155+ "usageHint": "h1"
156+ }
157+ }
158+ }
159+ ```
160+
161+ === "v0.9"
162+
163+ ```json
164+ {
165+ "id": "welcome",
166+ "component": "Text",
167+ "text": "Hello",
168+ "variant": "h1"
169+ }
170+ ```
51171
52172## The Standard Catalog
53173
@@ -64,12 +184,23 @@ For the complete component gallery with examples, see [Component Reference](../r
64184
65185** Static (` explicitList ` )** - Fixed list of child IDs:
66186``` json
67- {"children" : {"explicitList" : [" back-btn" , " title" , " menu-btn" ]}}
187+ {
188+ "children" : {
189+ "explicitList" : [" back-btn" , " title" , " menu-btn" ]
190+ }
191+ }
68192```
69193
70194** Dynamic (` template ` )** - Generate children from data array:
71195``` json
72- {"children" : {"template" : {"dataBinding" : " /items" , "componentId" : " item-template" }}}
196+ {
197+ "children" : {
198+ "template" : {
199+ "dataBinding" : " /items" ,
200+ "componentId" : " item-template"
201+ }
202+ }
203+ }
73204```
74205
75206For each item in ` /items ` , render the ` item-template ` . See [ Data Binding] ( data-binding.md ) for details.
@@ -87,17 +218,26 @@ LLMs can generate components with literal values or bind them to data paths for
87218
88219Components compose into ** surfaces** (widgets):
89220
90- 1 . LLM generates component definitions via ` surfaceUpdate `
91- 2 . LLM populates data via ` dataModelUpdate `
92- 3 . LLM signals render via ` beginRendering `
93- 4 . Client renders all components as native widgets
221+ === "v0.8"
222+
223+ 1. LLM generates component definitions via `surfaceUpdate`
224+ 2. LLM populates data via `dataModelUpdate`
225+ 3. LLM signals render via `beginRendering`
226+ 4. Client renders all components as native widgets
227+
228+ === "v0.9"
229+
230+ 1. LLM creates a surface via `createSurface` (specifying catalog)
231+ 2. LLM generates component definitions via `updateComponents`
232+ 3. LLM populates data via `updateDataModel`
233+ 4. Client renders all components as native widgets
94234
95235A surface is a complete, cohesive UI (form, dashboard, chat, etc.).
96236
97237## Incremental Updates
98238
99- - ** Add** - Send new ` surfaceUpdate ` with new component IDs
100- - ** Update** - Send ` surfaceUpdate ` with existing ID and new properties
239+ - ** Add** - Send new component definitions with new IDs
240+ - ** Update** - Send component definitions with existing ID and new properties
101241- ** Remove** - Update parent's ` children ` list to exclude removed IDs
102242
103243The flat structure makes all updates simple ID-based operations.
0 commit comments