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

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 controls a node kind has, by the name each writes under: a style's family, size, face and anchor in its parts, a theme's family and size; [] 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()) :: [String.t()]

The font controls a node kind has, by the name each writes under: a style's family, size, face and anchor in its parts, a theme's family and size; [] for a kind with none.

iex> Visualize.Chart.Builder.Fonts.keys(:style)
["font.family", "font.size", "font.face", "text.anchor"]

iex> Visualize.Chart.Builder.Fonts.keys(:theme)
["font_family", "font_size"]

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.