StatifierBlocks.Editor.Canvas (StatifierBlocks v0.1.0)

Copy Markdown View Source

The tree's root and the drag hook's element (ADR-0005 decisions 7, 13, 14).

This component is small on purpose. It is the one element carrying phx-hook="StatifierBlocksDrag", and every drag event in the editor arrives through it: the hook is attached to the canvas root rather than to each block, so adding a block adds no listeners and the hook has one lifetime rather than one per node.

It is also where decision 14's theming lands. The --sb-* custom properties are declared on this element by the package's stylesheet, so a host that wants a different palette sets them here through the theme assign - a map of property name to value, rendered as an inline style - and needs no stylesheet of its own to do it.

Summary

Functions

The canvas root: the hook's element, and the tree beneath it.

Functions

canvas(assigns)

The canvas root: the hook's element, and the tree beneath it.

Attributes

  • root (StatifierBlocks.ViewModel.Node) (required)
  • drag (:any) - Defaults to nil.
  • selected_id (:string) - Defaults to nil.
  • target (:any) (required)
  • icon (:any) - Defaults to nil.
  • theme (:map) - Defaults to %{}.
  • class (:string) - Defaults to nil.