Visualize.Chart.Builder.Fonts (Visualize v0.2.25)

Copy Markdown View Source

The font picker (spec/14 §19.10): family, size, face and anchor of the node being edited, together, the way a drawing tool keeps them beside the canvas.

It acts on the node the form is editing when that node's kind carries the font keys — a style, a theme — and writes through the same edit the form does, under the same names, so it is a bigger view of the font fields and never a second form. On a node with no font keys it says which node to open.

This module compiles only when Phoenix.Component is loaded (spec/10 §1.1, D-45, D-85).

Summary

Functions

The font keys a node kind carries, of font_family, font_size, font_weight, font_style and text_anchor; [] for a kind with none.

Renders the font picker: <form class="vis-builder-fonts"> over the node's font keys, or a note when the node has none.

Functions

keys(kind)

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

The font keys a node kind carries, of font_family, font_size, font_weight, font_style and text_anchor; [] for a kind with none.

iex> Visualize.Chart.Builder.Fonts.keys(:style)
[:font_family, :font_size, :font_weight, :font_style, :text_anchor]

iex> Visualize.Chart.Builder.Fonts.keys(:frame)
[]

panel(assigns)

Renders the font picker: <form class="vis-builder-fonts"> over the node's font keys, or a note when the node has none.

Attributes

  • id (:string) (required) - the panel's id.
  • kind (:atom) (required) - the kind of the node being edited.
  • node (:any) - the node being edited, or nil. Defaults to nil.
  • target (:any) - the phx-target of the panel's events. Defaults to nil.