# `Masu.Layout`
[🔗](https://github.com/hattoriai/masu/blob/v0.1.0/lib/masu/layout.ex#L1)

How a grid lays out its columns: their order, which are hidden, which
are pinned to the start or the end, and their widths.

A grid starts with the layout of its `:col` slots (their order, and
their `hidden`, `pinned` and `width` attributes), and changes it as the
person moves, hides, pins and resizes columns. With the query
(`Masu.Query`), it is the person's view (`Masu.View`).

The columns a grid shows are `columns/2` of its layout: the pinned to
the start first, then the others, then the pinned to the end, each in
the layout's order, without the hidden ones.

# `pin`

```elixir
@type pin() :: :start | :end
```

# `t`

```elixir
@type t() :: %Masu.Layout{
  hidden: [String.t()],
  order: [String.t()],
  pinned: %{required(String.t()) =&gt; pin()},
  widths: %{required(String.t()) =&gt; pos_integer()}
}
```

# `all`

```elixir
@spec all(t(), [Masu.Column.t()]) :: [Masu.Column.t()]
```

Every column, with whether it is hidden and where it is pinned, in the
order they show (the pinned to the start first, the pinned to the end
last): for the columns menu.

# `change`

```elixir
@spec change(t(), map(), [Masu.Column.t()]) :: t()
```

Applies a change from the browser: any of `"order"` (every key, in
order), `"hidden"` (keys), `"pinned"` (key to `"start"` or `"end"`) and
`"widths"` (key to pixels, merged into the widths there are). Keys of no
column are left out; a grid always shows one column at least.

# `columns`

```elixir
@spec columns(t(), [Masu.Column.t()]) :: [Masu.Column.t()]
```

The columns that show, in their places: the pinned to the start, the
others, the pinned to the end; each with its width and pin.

# `fit`

```elixir
@spec fit(t(), [Masu.Column.t()]) :: t()
```

The layout made to fit the columns: the keys of columns that no longer
exist are left out, and a column that the layout does not name (one
added since it was saved) takes its declared place, as declared.

# `new`

```elixir
@spec new([Masu.Column.t()]) :: t()
```

The layout of the columns as declared.

# `to_wire`

```elixir
@spec to_wire(t()) :: map()
```

The layout as the browser gets it.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
