Module

Sigil.Svg.Layout

Package
purescript-sigil
Repository
afcondon/purescript-sigil

Core layout functions: pure RenderType → LayoutNode conversion.

All functions are pure — they produce positioned LayoutNode trees without touching the DOM.

#unwrapType Source

unwrapType :: RenderType -> { body :: RenderType, constraints :: Array Constraint, forallVars :: Array String }

Peel off outer forall and constraint layers.

#parseClassName Source

parseClassName :: String -> Maybe { name :: String, params :: Array String }

Parse "Foldable f" → { name: "Foldable", params: ["f"] }.

#renderNode Source

renderNode :: RenderContext -> Number -> Number -> RenderType -> RenderResult

Lay out a RenderType node at position (x, y). Returns positioned LayoutNodes and the horizontal width consumed.

#renderSmallPill Source

renderSmallPill :: RenderContext -> Number -> Number -> String -> Number -> RenderResult

Small variable pill for annotations (forall row, class row).

#renderSigletVarDot Source

renderSigletVarDot :: RenderContext -> Number -> Number -> String -> RenderResult

Siglet var dot: filled colored circle for multi-letter type variables.

#renderConstraintPile Source

renderConstraintPile :: RenderContext -> Number -> Number -> Array Constraint -> RenderResult

Constraint pile (stacked rounded rects with dashed connector). In siglet mode, class names become dots and args use renderNode (so multi-letter vars → dots, single-letter → pills, TCon → dots).