Views, Modifiers, and Layout
Repose UI is built around three core ideas:
View: an immutable description of a UI node (cheap to rebuild every frame).Modifier: layout, styling, and interaction hints attached to aView.- Incremental layout + paint via a persistent engine:
composition produces a new
Viewtree each frame;LayoutEnginereconciles it into a persistentViewTree(repose-tree) and runs incremental Taffy layout + paint (with scopes, dirty sets, and paint caches).
Views
A View is a lightweight value that describes what to show, not how it is
rendered. It is cheap to create; you rebuild the description each frame
(Compose-style). Identity and layout state live in the persistent tree, not
in the View values themselves.
use *;
use *;
Internally, a View has:
id: ViewId- assigned during composition / layout.kind: ViewKind- which widget it is (Text, Button, etc.).modifier: Modifier- layout/styling/interaction metadata.children: Vec<View>- owned child views.
Views are pure data: they do not hold state or platform handles.
State lives in signals / remember_*; platform integration is in
repose-platform / repose-app.
Modifiers
Modifier describes how a view participates in layout and hit-testing:
- Size:
size,width,height,min_*,max_*,fill_max_* - Box model:
padding,padding_values, margins - Visuals:
background,border,clip_rounded,alpha,transform, layers - Flex / grid:
flex_*,align_*,justify_*,grid,grid_span - Positioning:
absolute(),offset(..) - Scroll:
vertical_scroll/horizontal_scroll/scrollable,nested_scroll_connection - Interaction:
clickable(), pointer callbacks,semantics - Custom paint:
painter(used byrepose-canvas) - Incremental helpers:
key,repaint_boundary,scope!(core)
Modifiers are mapped to Taffy Style inside LayoutEngine. Values are in
density-independent pixels (dp) and converted to physical px via Density.
Layout + paint
Public entry:
;
This is a thin thread-local wrapper around LayoutEngine::layout_frame, which:
- Reconciles
rootinto the persistentViewTree(stableNodeIds, content + subtree hashes, dirty set, generation GC). - Syncs dual Taffy trees (root + per-
scope!ScopeLayoutTrees). - Computes layout (measure callbacks, constraint equality skip for scopes).
- Walks the tree to emit
SceneNodes,HitRegions, andSemNodes, with paint-cache hits onrepaint_boundary/ scopes, culling, nested scroll, etc.
Prefer scope!, stable keys, and repaint_boundary on expensive subtrees so
the incremental engine can skip work.