Skip to main content

Module style

Module style 

Source
Expand description

Style RESOLUTION for layout: a node’s style object (token references already resolved by the theme, conditions still nested) → the flat map for this pass (conditions::resolve_conditions: media against the SURFACE box, the state keys against the node’s states) → logical properties made physical from the surface direction → a taffy Style plus the painted Visual.

Rules from the VAPP-4 spike that every painter relies on: border-box, flex row default, min-width: auto, overflow: hidden = clip, the border widths (borderWidth and the four sides) are the visual keys with layout effect, absolute nodes paint last among their siblings (no z-index). Round 1 adds the per-side and per-corner keys, gradients, paint-only transforms, transitions (resolved durations + easings), text styling, overflowX/Y, visibility, pointerEvents, userSelect, cursor.

Re-exports§

pub use crate::conditions::is_condition_key;
pub use crate::conditions::resolve_conditions;
pub use crate::conditions::ConditionContext;

Structs§

Gradient
A linear gradient painted OVER background_color (CSS angle: 0 = up, 90 = right).
GradientStop
One gradient stop: a resolved colour at 0..1.
ShadowLayer
One shadow layer, resolved.
Transition
The motion a node’s colour/opacity/transform/size changes animate with: the resolved $motion.* duration (0 under reduced motion) and the $ease.* cubic bezier (CSS ease when unset).
Visual
Painted properties, RESOLVED (hex colours, px numbers, shadow layers, family names). Painters never read the theme; they paint this.
VisualAnimation
A node’s animation (animation + animationDuration, resolved).

Enums§

BoxKind
How a node’s padding and border reach taffy.
TransformOp
One paint-only transform function, in source order (applied around the box’s centre, like CSS transform-origin: center).

Constants§

DEFAULT_EASING
CSS ease, the easing of a transition without transitionEasing.

Functions§

axis_overflow
The overflow of one axis: the axis key over overflow.
border_sides
The border widths [top, right, bottom, left] (borderWidth then the sides); None when no width key is set.
direction_of
A resolved style’s own direction (inherited down the tree by the surface; the root’s, else the locale’s, is the surface direction).
is_scroll_container
Is the flat style a scroll container on either axis?
parse_transform
translate(Xpx, Ypx) scale(N) rotate(Ndeg) → the ops in order.
percent_value
A "N%" length as a fraction (0.5 for 50%).
px
A length in px when it is a plain number or Npx (not %/auto).
resolve_logical
Logical properties → physical sides for the surface direction. taffy has only physical rects. A logical key wins over the physical one it maps to (it states the direction-aware intent). insetBlockStart/End are top/bottom; textAlign: start|end becomes left|right.
sides_px
The px sides [top, right, bottom, left] of a padding-like key family (padding, paddingHorizontal, paddingVertical, the four sides; the logical keys are already physical here). None when no key is set.
to_taffy
Resolved flat map → taffy style. direction is NOT inherited by taffy, so the caller passes the surface’s and every node gets it.
visual
The painted subset of a resolved flat map. For a BoxKind::Leaf the recipe’s padding/gap ride along for the painter and the measurer. % radii are left out here (the surface resolves them against the box).