Expresso.Element.Toc (expresso v0.1.0)

Copy Markdown View Source

A table of contents: one entry for each section of the deck

A slide with the section option starts a section, and the section runs to the next slide with a section option. Expresso.SectionTransformer puts one Expresso.Element.TocEntry into the toc for each section, with a link to the first slide of the section. The entries are the children of the toc, so the reveal option gives each entry its own step, and the dim option dims each entry when a later entry shows, as for the series of a chart.

The section of the slide of the toc is the current section. Its entry takes the accent color. The progress option tells how the other entries look:

ValueThe other entries
:dim_restEach other entry dims. This is the default.
:dim_earlierEach earlier entry dims.
:check_earlierEach earlier entry gets a check mark.
:strike_earlierA line goes through each earlier entry.

A toc on a slide before the first section has no current section, and each entry looks the same.

Summary

Types

t()

The struct of a table of contents

Functions

Make the assigns of the render function from the struct

Return the values of the progress option

Make the HTML of a table of contents

Types

t()

@type t() :: %Expresso.Element.Toc{
  __spark_metadata__: term(),
  at: term(),
  class: term(),
  dim: term(),
  easing: term(),
  effect: term(),
  el: term(),
  elements: term(),
  morph: term(),
  on: term(),
  progress: term(),
  reveal: term(),
  signature: term(),
  speed: term(),
  steps: term()
}

The struct of a table of contents

Functions

get_assigns(toc)

@spec get_assigns(t()) :: map()

Make the assigns of the render function from the struct

The key overlay holds the attributes of the overlay contract, from Expresso.Overlay.Render.attributes/1. The key entries holds the entries, each with its own attributes.

progress_values()

@spec progress_values() :: [atom()]

Return the values of the progress option

iex> Expresso.Element.Toc.progress_values()
[:dim_rest, :dim_earlier, :check_earlier, :strike_earlier]

render(assigns)

@spec render(map()) :: Phoenix.HTML.safe()

Make the HTML of a table of contents

The toc is a nav with an ordered list. The entry of the current section has aria-current="location", so a screen reader names it. Each entry is a link of the goto option to the first slide of its section.