Module

Play.Types

Package
purescript-play
Repository
shamansir/purescript-play

#Def Source

type Def = { childGap :: Number, direction :: Direction, padding :: Padding, sizing :: { height :: Sizing, width :: Sizing } }

The compiled definition from user-specified with API layout properties. Not intented to be constructed manually.

#Direction Source

data Direction

Defines the layout direction for arranging child elements.

  • TopToBottom: Children are arranged vertically from top to bottom
  • LeftToRight: Children are arranged horizontally from left to right

Constructors

Instances

#Offset Source

type Offset = Pos

An alias for Pos, used to represent relative offsets or displacements.

#Padding Source

type Padding = { bottom :: Number, left :: Number, right :: Number, top :: Number }

Defines padding (inner spacing) for all four sides of an item. Means the space between the border of the item and its children on the corresponding sides. All values are in pixels.

#Pos Source

type Pos = { x :: Number, y :: Number }

A 2D position of the element's top-left corner.

#Rect Source

type Rect = { pos :: Pos, size :: Size }

A rectangular area defined by position and size. Represents the final computed layout bounds of an element.

#Size Source

type Size = { height :: Number, width :: Number }

Dimensions of a rectangular area the item occupies. All values are in pixels.

#Sizing Source

data Sizing

Defines how an element should size itself along a particular axis.

  • None: No specific sizing constraint
  • Fixed Number: Fixed size in pixels
  • Fit: Size to fit the content (minimum required space)
  • Grow: Expand to fill available space
  • FitGrow: If fitting the content requires more space than growing, then fit anyway, else grow to fill the available space

Constructors

Instances

  • Eq Sizing

    FixedPct Percentage FitMin { min :: Number } FitMax { max :: Number } FitMinMax { min :: Number, max :: Number }

#WithDef Source

type WithDef a = { def :: Def, v :: a }

An element with its layout definition. Used during the initial layout specification phase.

#WithDefSize Source

type WithDefSize a = { def :: Def, size :: Size, v :: a }

An element with layout definition and computed size. Intermediate state during layout computation.

#WithRect Source

type WithRect a = { rect :: Rect, v :: a }

An element with its final computed rectangular bounds. The final result of layout computation, so holds Def data no more.

#WithDefRect Source

type WithDefRect a = { def :: Def, rect :: Rect, v :: a }

An element with both layout definition and computed rectangular bounds. Contains complete layout information for potential rollback operations.