Press.Layout.Box (press v0.1.0)

Copy Markdown View Source

A positioned geometric box in the layout tree.

Summary

Types

The structural category of a layout box.

t()

A positioned geometric box struct.

Functions

Computes border-box height (content height + padding + border).

Computes border-box width (content width + padding + border).

Computes total outer height including content height, padding, border, and margin.

Computes total outer width including content width, padding, border, and margin.

Types

box_type()

@type box_type() ::
  :block | :line | :text | :table | :table_row | :table_cell | :image

The structural category of a layout box.

t()

@type t() :: %Press.Layout.Box{
  background_color: term(),
  border_color: %{top: term(), right: term(), bottom: term(), left: term()},
  border_style: %{top: term(), right: term(), bottom: term(), left: term()},
  border_width: %{top: float(), right: float(), bottom: float(), left: float()},
  children: [t()],
  color: term(),
  computed: map() | nil,
  font: atom() | nil,
  font_size: float() | nil,
  height: float() | nil,
  image: Press.Image.t() | nil,
  margin: %{top: float(), right: float(), bottom: float(), left: float()},
  padding: %{top: float(), right: float(), bottom: float(), left: float()},
  tag: String.t() | nil,
  text: String.t() | nil,
  type: box_type(),
  width: float() | nil,
  x: float() | nil,
  y: float() | nil
}

A positioned geometric box struct.

Functions

border_box_height(box)

@spec border_box_height(t()) :: float()

Computes border-box height (content height + padding + border).

border_box_width(box)

@spec border_box_width(t()) :: float()

Computes border-box width (content width + padding + border).

outer_height(box)

@spec outer_height(t()) :: float()

Computes total outer height including content height, padding, border, and margin.

outer_width(box)

@spec outer_width(t()) :: float()

Computes total outer width including content width, padding, border, and margin.