Expand description
Rux layout, milestones M1–M4.
A styled node tree fed through taffy (flexbox) to produce absolute paint
items. Boxes come straight from taffy; text leaves are sized through a
caller-supplied measure callback (so this crate stays free of any font
dependency, the shell owns the text engine). See docs/04-architecture.md,
Stage 4.
Structs§
- Access
- The accessibility facts about one node: what it is, what it’s called, and what state it’s in. Attached during the build and carried through layout so the shell can publish a tree with real geometry.
- Access
Node - One element exposed to assistive technology, with the geometry it ended up occupying. Emitted in document order, and only for nodes whose role is meaningful, a plain layout box contributes nothing.
- BoxShadow
- A single (outer)
box-shadow. Offsets, blur and spread are logical px. - Focus
Item - One keyboard-focusable element, in document (Tab) order. Carries the geometry (for the focus ring) plus how the shell should act on it.
- Focus
Region - An absolutely-positioned focusable region for an
<input>, carrying itsr-modelsignal name. - Gradient
- A CSS gradient reduced to what the painter needs: a shape and colour stops.
- HitRegion
- An absolutely-positioned tappable region, carrying its
@taphandler source. - Image
Content - An image carried by a leaf node.
srcis resolved to a path the painter can open; the intrinsic size is filled in by the runtime (it reads the file’s header) and sizes the box when CSS gives no width/height. - Layout
- The result of laying out a tree: paint items, hit regions, and focus regions, all in painter’s/topmost-last order.
- Node
- A node in the view tree: a style, optional text, children, and an optional
@taphandler (raw handler source, run by the shell on tap). - Offset
- How far a scroller’s content has travelled, in logical pixels. Positive
moves the content up / left, i.e.
yis “how far down the content we are”. - Paint
Image - An image scaled to fill its laid-out box.
- Paint
Rect - A resolved, absolutely-positioned box: an optional fill and an optional border, sharing one rounded-rect geometry.
- Paint
Text - A resolved, absolutely-positioned text block.
- Paint
Tick - A checkmark stroked inside its laid-out box.
- Rgba
- Straight RGBA in the 0..=1 range. Renderer-agnostic.
- Scroll
Region - A scrollable box.
idis its index in tree order, stable across rebuilds as long as the tree’s shape is, which is what the shell keys offsets by. - Select
Region - An absolutely-positioned
type="select", carrying its bound options so the shell can open a dropdown and write the chosen value back tomodel. - Sides
- Per-side box-model lengths (padding / margin / border widths).
- State
Region - An absolutely-positioned box whose styling depends on pointer state
(
:hover/:active), carrying the tree path that identifies it to the builder. Emitted only for nodes some pointer-state rule could match, so a document with no such rules produces none. - Style
- The style subset M-series understands (a stand-in for the CSS
ComputedStyle). - Text
Content - Text carried by a leaf node.
Enums§
- Access
Role - What an element is, for assistive technology. Deliberately a small enum
owned by the layout rather than an
accesskittype: the layout stays free of the platform a11y crate, and only the shell translates these. - Align
- Cross-axis alignment (
align-items). - Axis
- How a node lays out its children. Defaults to
Rowto match CSS’sflex-directioninitial value. - Background
- A box background: a flat colour, a gradient, or an image.
- Cursor
- The mouse cursor shown while the pointer is over a box (
cursor). Only the values the shell maps to a winitCursorIconare modelled; the default is the arrow. - Display
- CSS
display. Defaults toBlock(strict-CSS fidelity): flex layout,gap, andflex-directiononly apply underFlex. - Focus
Kind - Gradient
Kind - Grid
Flow grid-auto-flow: how auto-placed items fill the implicit grid.- Grid
Place - One endpoint of a
grid-column/grid-rowplacement. - Justify
- Main-axis distribution (
justify-content). - Len
- A CSS length. Percentages are stored as a fraction (
0.0..=1.0);vh/vwhold the raw viewport-percentage number (e.g.100vh→Vh(100.0)).remis resolved to pixels at parse time. - Overflow
- Overflow behaviour for content exceeding a box.
- Paint
- A drawable item in painter’s order (parents before children).
- Position
position.Relativeis the normal in-flow box (the default);Absolutetakes the box out of flow and positions it by itsinsetagainst the nearest positioned ancestor.- Text
Align - Horizontal text alignment within a text box (
text-align). - Text
Wrap - How a line may break when a word is wider than its box (
overflow-wrap/word-break). CSS’s default lets a long word overflow rather than break. - Track
- A grid track size (
grid-template-columns/-rows). - Track
Side - One side of a
minmax(), never itself aminmax. AFris only valid on the max side (a flex minimum is meaningless), and degrades toautoif used as a minimum.
Functions§
- layout
- Lay out
rootinto anavail_wxavail_hviewport, returning paint items and hit regions. Text leaves are sized viameasure. - layout_
scrolled - Lay out with the shell’s current scroll offsets (one per scrollable box, in tree order). A missing entry is 0.
Type Aliases§
- Corners
- Corner radii in CSS order, top-left, top-right, bottom-right, bottom-left.
A single
border-radiusfills all four; the per-corner longhands override. - Measure
- Callback that measures a text block:
(text, font_size, weight, wrap, max_width) -> (w, h). Measures a text node to(width, height)given an optional max width. Takes the wholeTextContentso new text properties (family, spacing, style…) don’t each widen this signature. - Transform
- A 2-D affine
transform, as the six coefficients[a, b, c, d, e, f](kurboAffineorder:x' = a·x + c·y + e,y' = b·x + d·y + f). Translations are in logical px; the origin is applied at paint time (CSS default: box centre).