Macaw.Builtin.Split (macaw v0.6.0)

Copy Markdown View Source

The built-in split (spec/05 §5.9), "macaw.split": two panes side by side or stacked, with a separator between them and a disclosure collapsing the second, of kind :container, :pure.

  • parameters: label (text, "Split view"), its name; orientation ("horizontal" or "vertical"); position (number, 50, bindable), the first pane's share in percent, drawn at the nearest step of 10 from 10 to 90; open ("both" or "first", bindable), whether the second pane shows;
  • declarations: no slots; the event "open" with its default action setting open from the event's value (spec/05 §5.3); it observes :activate;
  • panes: exactly two; it shows both for "both" and the first for "first";
  • markup: a named group placed by classes, never inline style; the first pane's region; a focusable separator valued at the drawn position, controlling the first pane; a toggle, aria-expanded whether the second pane shows and aria-controls it, emitting open with "first" or "both", or, given a link for it, an <a href> to that view; then the second pane's region, empty and hidden when collapsed. Moving the separator is the client's;
  • stylesheet: stylesheet/0, served at stylesheet_path/0, its content address.

Summary

Functions

The drawn position of a position setting: the nearest step of 10 from 10 to 90.

The split's one static stylesheet: its two orientations, a rule per step of the first pane's share, the separator and the toggle, every color a theme custom property with the default theme's value as its fallback. It loads and imports nothing.

The stylesheet's path, its content address (Macaw.Component.Stylesheet.path/1).

Functions

step(position)

@spec step(number()) :: pos_integer()

The drawn position of a position setting: the nearest step of 10 from 10 to 90.

iex> Macaw.Builtin.Split.step(34)
30
iex> Macaw.Builtin.Split.step(99)
90

stylesheet()

@spec stylesheet() :: String.t()

The split's one static stylesheet: its two orientations, a rule per step of the first pane's share, the separator and the toggle, every color a theme custom property with the default theme's value as its fallback. It loads and imports nothing.

stylesheet_path()

@spec stylesheet_path() :: String.t()

The stylesheet's path, its content address (Macaw.Component.Stylesheet.path/1).