Macaw.Live.Surface (macaw_live v0.1.0)

Copy Markdown View Source

The function component a template renders a mounted surface with (spec/01 §3.1), as Macaw.Live.surface/1:

<Macaw.Live.surface macaw={@macaw} name="status" />

It renders one wrapper, <div id="mw-live-<surface>" phx-hook="MacawSurface" data-mw-live>, the runtime's only addition to the surface's markup (spec/00 §2), around the surface's chrome (Macaw.Surface.chrome/2) and one Macaw.Live.CellComponent per cell in reading order, so the markup inside the wrapper is Macaw.Surface.render/3's by construction. The wrapper carries the MacawSurface hook, which measures the cells and keeps focus (spec/05 §1). Connected, it also names the page's binary stream, data-mw-channel (its topic) and data-mw-channel-token, which the hook joins once per page (spec/05 §9.3).

A name the %Macaw.Live.Mounted{} doesn't hold renders nothing: a template naming a surface it never mounted is the host's bug.

Summary

Functions

The surface name of macaw, rendered.

Functions

render(assigns)

@spec render(map()) :: Phoenix.LiveView.Rendered.t()

The surface name of macaw, rendered.

Attributes

  • macaw (Macaw.Live.Mounted) (required) - the @macaw assign mount/3 set.
  • name (:string) (required) - a mounted surface's name.