Press.Style.Cascade (press v0.1.0)

Copy Markdown View Source

Builds the styled tree: matches CSS rules against the DOM, resolves the cascade (per property, ordered by origin + specificity + source index), applies inheritance, and resolves units to points — except %, which stays symbolic ({:percent, n}) for Layout to resolve against the actual containing block width it computes. See docs/superpowers/specs/2026-07-24-css-parser-cascade-design.md for the full algorithm.

Summary

Functions

Builds a styled node tree by applying the CSS cascade to the DOM.

Resolves the final page configuration (size and margin) from @page rules.

Functions

build(dom, external_rules, embedded_rules)

Builds a styled node tree by applying the CSS cascade to the DOM.

page_config(external_page_rules, embedded_page_rules)

@spec page_config([Press.CSS.PageRule.t()], [Press.CSS.PageRule.t()]) :: %{
  size: {float(), float()},
  margin: %{top: float(), right: float(), bottom: float(), left: float()}
}

Resolves the final page configuration (size and margin) from @page rules.