Raxol.UI.Layout.StyleInheritance (Raxol v2.9.2)

View Source

Shared style inheritance logic for layout containers.

Text styling properties cascade from parent to child elements. Layout properties (padding, border, width, height, gap) do NOT inherit.

Summary

Functions

Converts style values to a map. Handles maps, keyword-like lists, and atoms.

Propagates inheritable style properties from a parent element into each child's style map. Child values take precedence.

Functions

ensure_style_map(style)

@spec ensure_style_map(term()) :: map()

Converts style values to a map. Handles maps, keyword-like lists, and atoms.

List entries that are neither {key, value} pairs nor atoms are skipped, so one malformed entry cannot fail the layout of the whole frame.

inherit_styles(parent, children)

@spec inherit_styles(map(), [map()]) :: [map()]

Propagates inheritable style properties from a parent element into each child's style map. Child values take precedence.