# `Macaw.Frame.Style.Defaults`
[🔗](https://github.com/dcoai/macaw_frame/blob/v0.1.0/lib/macaw/frame/style/defaults.ex#L1)

Defaults inherited by container and layer kind (spec/02 §3.8): what a style does not say
comes from the containers the element sits in.

An element's defaults are its containers' in order, farthest first (the theme's root,
the design, the frame, the element's own `defaults`); for each, its part defaults, then
its entry for the element's layer kind; the site's stack is laid over the result. A
label, an axis and a legend take the part defaults alone. **The base is never written
onto an element** (`base/0`): it is what the backends already draw when a key is
absent.

    iex> design = %{"line" => %{stroke: %{cap: :round}}, stroke: %{width: 2}}
    iex> frame = %{stroke: %{width: 3}}
    iex> Macaw.Frame.Style.Defaults.layer([design, frame], "line")
    %{stroke: %{width: 3, cap: :round}}
    iex> Macaw.Frame.Style.Defaults.layer([design, frame], "area")
    %{stroke: %{width: 3}}

# `base`

```elixir
@spec base() :: map()
```

The theme's root defaults: every part, defined (§3.8).

# `entry`

```elixir
@spec entry(term(), term()) :: map()
```

A container's entry for a layer kind, `%{}` when it has none.

# `layer`

```elixir
@spec layer(term(), term()) :: map()
```

The defaults an element of layer kind `kind` inherits from `containers`, farthest first:
each container's parts, then its entry for the kind; with `kind` `nil` (a label, an
axis, a legend) the parts alone. A container that is no map gives nothing.

# `parts`

```elixir
@spec parts(term()) :: map()
```

A container's part defaults: its node without its kind entries.

---

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