StatifierBlocks.Editor.ConnectorLayer (StatifierBlocks v0.15.0)

Copy Markdown View Source

The drawn connectors, and the element the measurement hook rides on (ADR-0005 decision 10, and the 2026-08-29 amendment to decision 7).

Two elements, and neither holds a decision. StatifierBlocks.Connectors decided every path in the list this renders, from rectangles the browser measured; all this component does is put them on the page and hand the stylesheet a class to colour each one by.

Why the hook rides its own element

An element carries one phx-hook, and the canvas root already carries StatifierBlocksDrag - it is deliberately the drag hook's single element, so that adding a block adds no listeners. The measurement hook therefore rides a dedicated empty child of the canvas: the drag hook's element and its lifetime are untouched, and the measure hook finds its stage with one closest('[data-sb-anchor="stage"]') rather than by an id, so the hook holds no knowledge of what the canvas root is called.

The element renders whether or not a host imported the hook. It is a zero-size div either way; with no hook attached it is inert, nothing is measured, Connectors.edges/2 returns [], and the <svg> below is not rendered at all. That is clause 7b.3's "fully usable with the hook absent", and it costs one empty element rather than a flag.

Why the layer is absent rather than empty

No measurement means no <svg> element, not an <svg> with no paths. An empty overlay is still a box in the layout with a scroll extent and a stacking context, and the amendment's standing test is that a host without the hook gets the editor it had before - which is an editor with no overlay in it.

Summary

Functions

The connector overlay: absent entirely until something is measured.

Functions

connector_layer(assigns)

The connector overlay: absent entirely until something is measured.

Attributes

  • edges (:list) - Defaults to [].
  • stage (:any) - Defaults to nil.
  • target (:any) (required)