The grid a surface places its cells on (spec/06 §3.3), the built-in layout :grid
(Macaw.Layout): 12 columns, or 6 or 24 by {:grid, columns: n}.
Places are %{x, y, w, h} in integer units: x from 0 to one less than the columns,
w from 1 with x + w at most the columns, y from 0, h from 1, and y + h at most
rows/0. Reading order is by y, then x, then name, and is the DOM order. Placement
is by classes from one static stylesheet, never inline style:
iex> Macaw.Grid.classes(%{x: 0, y: 2, w: 6, h: 3})
"mw-cell mw-col-1 mw-span-6 mw-row-3 mw-rows-3"
Summary
Functions
A place's classes: the cell, its column and span, its row and rows, the same on every
width; the container's class sets the width (container/1).
The grid's columns when a surface chooses none, 12.
The faults of the cells' places on 12 columns, each at [:cells, name, :place]: a bound
broken is {:out_of_bounds, what, value} (what one of :x, :w, :x_plus_w, :y,
:h, :y_plus_h); two cells overlapping is {:overlap, other} at the later one in
reading order. cells maps names to anything with a place. faults/2 takes the
grid's options, its columns among them.
faults/1 on the options' columns.
The cells' names in reading order: by y, then x, then name.
The most rows a grid places a cell in, 64, so every placement has a class.
A place's declared size in CSS pixels on 12 columns: its share of the surface's width
and its rows' height, {w * width / 12, h * row_height}. size/4 takes the grid's
options, its columns among them.
A place's declared size on the options' columns: {w * width / columns, h * row_height}.
The grid's one static stylesheet, for every width: the grid (12 columns, and .mw-grid-6
and .mw-grid-24 for the others), a rule per column start and column span up to the
widest, per row start and row span, and the container query that stacks every cell into
reading order when the surface is narrower than 40rem.
The stylesheet's path, its content address (Macaw.Component.Stylesheet.path/1).
The widths a grid may have, in columns: 6, 12 and 24, so its stylesheet is static.
Types
@type place() :: %{ x: non_neg_integer(), y: non_neg_integer(), w: pos_integer(), h: pos_integer() }
Functions
A place's classes: the cell, its column and span, its row and rows, the same on every
width; the container's class sets the width (container/1).
@spec columns() :: pos_integer()
The grid's columns when a surface chooses none, 12.
@spec faults(%{required(String.t()) => %{place: place()}}) :: [Macaw.Base.Fault.t()]
The faults of the cells' places on 12 columns, each at [:cells, name, :place]: a bound
broken is {:out_of_bounds, what, value} (what one of :x, :w, :x_plus_w, :y,
:h, :y_plus_h); two cells overlapping is {:overlap, other} at the later one in
reading order. cells maps names to anything with a place. faults/2 takes the
grid's options, its columns among them.
@spec faults(%{required(String.t()) => %{place: place()}}, map()) :: [ Macaw.Base.Fault.t() ]
faults/1 on the options' columns.
The cells' names in reading order: by y, then x, then name.
@spec rows() :: pos_integer()
The most rows a grid places a cell in, 64, so every placement has a class.
A place's declared size in CSS pixels on 12 columns: its share of the surface's width
and its rows' height, {w * width / 12, h * row_height}. size/4 takes the grid's
options, its columns among them.
A place's declared size on the options' columns: {w * width / columns, h * row_height}.
@spec stylesheet() :: String.t()
The grid's one static stylesheet, for every width: the grid (12 columns, and .mw-grid-6
and .mw-grid-24 for the others), a rule per column start and column span up to the
widest, per row start and row span, and the container query that stacks every cell into
reading order when the surface is narrower than 40rem.
@spec stylesheet_path() :: String.t()
The stylesheet's path, its content address (Macaw.Component.Stylesheet.path/1).
@spec widths() :: [pos_integer(), ...]
The widths a grid may have, in columns: 6, 12 and 24, so its stylesheet is static.