Skip to content

Commit f97139d

Browse files
committed
More updates
1 parent 66a8845 commit f97139d

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Context: converge on a default UI component model for LLM-generated UI.
1111
Product goals:
1212

1313
- Easy for LLMs to generate
14+
- Leverages patterns and/or frameworks that are widely present in the training data, or can be learned within a small context window.
1415
- Easy for humans to edit
1516
- Leverages familiar or established patterns for UI development
1617
- Conformable with existing web FE toolchains.
@@ -22,14 +23,17 @@ Technical goals:
2223
- Components are black boxes, with inputs and outputs
2324
- Components have inputs, and output UI and events
2425
- Are pure-ish functions of state (we may allow cheats for local component state ala hooks)
25-
- Components have statically-typed inputs and outputs
26-
- E.g. via TypeScript
27-
- Allows the runtime to enforce data policies on component
26+
- Component inputs and outputs are statically-typed
27+
- E.g. via TypeScript
28+
- Allows the runtime to enforce data policies on component
2829
- Components have local state
2930
- State is encapsulated within component
3031
- Components may pass state down to child components as input
3132
- E.g. the React “[lifting state up](https://legacy.reactjs.org/docs/lifting-state-up.html)” pattern.
3233
- Local state may be persisted. If it isn’t, it is ephemeral, and lasts for the lifetime of the component.
34+
- Components are islands
35+
- Components can be used free-standing, or within a larger component tree.
36+
- 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.
3337
- Components are composable
3438
- Components can be combined together like lego to create larger components
3539
- Composition should involve plugging together component inputs, outputs, and events, and arranging UI tree. It shouldn’t be more complicated than that.
@@ -38,24 +42,23 @@ Technical goals:
3842
- The shape of the hole is determined by the data input and output types
3943
- 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.
4044
- Components have [high locality of behavior](https://github.com/gordonbrander/generative-ui-playbook?tab=readme-ov-file#llms-work-best-with-high-locality)
41-
- Components are islands
42-
- Components can be used free-standing, or within a larger component tree.
43-
- 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.
44-
- UI templates are pure
45-
- They take inputs, and output a UI tree and events
46-
- They produce a UI tree that is easy for the runtime to analyze and sanitize (probably a VDOM, probably not raw DOM).
45+
- UI templates are pure functions of state
46+
- Templates take inputs, and output a UI tree and events
47+
- Templates produce a UI tree that is easy for the runtime to analyze and sanitize (probably a VDOM, probably not raw DOM).
4748
- Components can be rendered on the web platform
4849

4950
Soft goals:
50-
- Static templates
51+
- UI templates are static
52+
- They are compiled once at program start, and produce a static tree with specific “binding points” in the tree, where dynamic values and dynamic lists are rendered.
53+
- This may have a performance advantage over a totally dynamic VDOM tree, since it would allow us to analyze and enforce policies on the tree once, rather than after every render
5154

5255
Non-goals:
5356

5457
- Separation of concerns. At odds with high locality of behavior.
5558

56-
Non-goals:
59+
## Proposal
60+
5761

58-
-
5962

6063
## Open questions
6164

0 commit comments

Comments
 (0)