Understand the role of picasso-layout
masterThe picasso-layout package is responsible for the automatic layout phase of the Picasso pipeline. It operates on the grouping results produced by picasso-group to infer flex, block, and inline layouts, as well as alignment settings.
Key responsibilities include:
- Overlap Handling (
handleOverlap): Decides betweenabsoluteandrelativepositioning for overlapping layers. - Row Layout (
calculateRow/row): Infers horizontal arrangements, spacing, and alignment. - Block Layout (
isBlock/calculateBlock): Identifies block-level elements and calculates their dimensions. - Text Handling: Includes special logic for when a parent node is text (
handleParentIsText) and marking pure text nodes to avoid unnecessary container wrapping (markIsOnlyText). - Styling & Metadata: Corrects border widths (
getBorderWidth) and derives layout-related class names (calculateClassName). - Dispatching: Distributes layout logic based on node types (
handleTypeLayout/).