Skip to content

Commit f9f20eb

Browse files
committed
Formatting
1 parent 2b68687 commit f9f20eb

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

rfcs/2024-05-21-ui-component-model.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,35 @@ Context: converge on a default UI component model for LLM-generated UI.
1919

2020
### Technical goals
2121

22-
- Components are encapsulated
22+
- Components are **encapsulated**
2323
- A component may control its child tree, but not its siblings or parent
24-
- Components are black boxes, with inputs and outputs
25-
- Components have inputs, and output UI and events
24+
- Components are **black boxes**, with inputs and outputs
25+
- Components have **inputs**, and **output UI** and **events**
2626
- Are pure-ish functions of state (we may allow cheats for local component state ala hooks)
27-
- Component inputs and outputs are statically-typed
28-
- E.g. via TypeScript
29-
- Allows the runtime to enforce data policies on component
30-
- Components have local state
27+
- Component **inputs** and **outputs** are **statically-typed**
28+
- E.g. via TypeScript
29+
- Allows the runtime to enforce data policies on component
30+
- Components have **local state**
3131
- State is encapsulated within component
3232
- Components may pass state down to child components as input
33-
- E.g. the React “[lifting state up](https://legacy.reactjs.org/docs/lifting-state-up.html)” pattern.
34-
- Local state may be persisted. If it isn’t, it is ephemeral, and lasts for the lifetime of the component.
35-
- Components are islands
33+
- E.g. the React **[“lifting state up” pattern](https://legacy.reactjs.org/docs/lifting-state-up.html)**.
34+
- Local state may be **persisted**.
35+
- If it isn’t, it is **ephemeral**, and lasts for the lifetime of the component.
36+
- Components are **islands**
3637
- Components can be used free-standing, or within a larger component tree.
3738
- Note: in something like the Elm App Architecture Pattern, Models, Views, and Update functions are “zippered” together, meaning components are “some assembly required”. This would fall short of this goal without some additional means of making an individual component free-standing.
38-
- Components are composable
39+
- Components are **composable**
3940
- Components can be combined together like lego to create larger components
40-
- Composition should involve plugging together component inputs, outputs, and events, and arranging UI tree. It shouldn’t be more complicated than that.
41-
- Components can have holes, allowing you to slot in an arbitrary component of the right shape.
41+
- Composition should involve plugging together component inputs, outputs, and events, and arranging a UI tree. It shouldn’t be more complicated than that.
42+
- Components can have **holes**, allowing you to slot in an arbitrary component of the right shape.
4243
- Inversion of control for templates.
43-
- The shape of the hole is determined by the data input and output types
44-
- Example mechanisms: [slots](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots), [passing down closures that evaluate to components](https://swiftwithmajid.com/2019/11/06/the-power-of-closures-in-swiftui/), [overridable blocks](https://mustache.github.io/mustache.5.html#Blocks), etc.
45-
- Components have [high locality of behavior](https://github.com/gordonbrander/generative-ui-playbook?tab=readme-ov-file#llms-work-best-with-high-locality)
46-
- UI templates are pure functions of state
44+
- The shape of the hole is determined by the data’s input and output types
45+
- Example mechanisms
46+
- [slots](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots)
47+
- [passing down closures that evaluate to components](https://swiftwithmajid.com/2019/11/06/the-power-of-closures-in-swiftui/)
48+
- [overridable blocks](https://mustache.github.io/mustache.5.html#Blocks)
49+
- Components have **[high locality of behavior](https://github.com/gordonbrander/generative-ui-playbook?tab=readme-ov-file#llms-work-best-with-high-locality)**
50+
- UI **templates** are **pure functions of state**
4751
- Templates take inputs, and output a UI tree and events
4852
- Templates produce a UI tree that is easy for the runtime to analyze and sanitize (probably a VDOM, probably not raw DOM).
4953
- Components can be rendered on the web platform

0 commit comments

Comments
 (0)