The canvas with a run around it: statifier-ui's status and scrubber above it, its event log below, and the document's own blocks where an ops view would draw a diagram.
An ops view built out of StatifierUI.Live draws four things - a status
header, a scrubber, a Mermaid diagram of the chart, and the event log.
Three of those are about the run and are the same wherever the run is
watched from. The fourth is about the chart, and inside this editor
there is something better to put in its seat: the blocks the author wrote,
already laid out, already marked. So the diagram is not mounted, the
canvas takes that seat, and the three run surfaces are composed around it
exactly as statifier-ui ships them.
The seam is a read, and it stays one
statifier-ui owns the trace wire format and the components that draw it;
this package owns blocks, the compiler and its provenance map. Nothing in
that split needed a callback: the components take a
StatifierUI.Live.State and draw it, StatifierBlocks.Runtime.Marks
turns the same read model into the marks the canvas already accepts, and
StatifierBlocks.Runtime.Handled turns a clicked log entry into the block
whose state handled it. No statifier-ui module changed, no new wire type
exists, and the two events the components emit are statifier-ui's own -
renamed by the caller, which is what scrub_event and select_event are
for.
Optional, and quiet when absent
statifier_ui is an optional dependency here, exactly as
phoenix_live_view is. The three components are resolved at runtime from
a module read out of :statifier_blocks, :run_pane_module and checked
with function_exported?/3 - the indirection
StatifierBlocks.Editor.Field uses for the expression input and
StatifierBlocks.Runtime.Marks uses for the inspector reads, and for the
same two reasons: the compiler stays quiet in a tree without the package,
and a test can point the key at a module of its own to exercise the
absent branch on a machine where the package is present.
With nothing resolvable the pane still draws, still seats the canvas, and says in one line that the run surfaces need the package. It does not refuse to render: an author whose host forgot a dependency should still see their document.
A pane with no run is not a pane
run_pane/1 with state: nil renders its inner block and nothing else -
no wrapper element, no class, no attribute. A document with no run over it
therefore produces exactly the markup it produced before this component
existed, which is a property the editor's tests assert rather than assume.
Summary
Functions
The canvas, seated in a run.
Functions
@spec run_pane(map()) :: Phoenix.LiveView.Rendered.t()
The canvas, seated in a run.
state is a StatifierUI.Live.State, or nil for no run - see the
moduledoc for what nil renders. scrub_event, select_event and
send_event are the names the pane's own controls push, and they default
to this package's own namespace rather than statifier-ui's, so a host
embedding both an ops view and this editor on one page does not get one
component's clicks in the other's handler. events is the send palette -
already derived by the editor from the selected block's fixtures - and
sendable? says whether this run has a live session to send into; with
no entries the send region is not drawn at all.
Attributes
id(:string) (required) - DOM id root; the three surfaces derive theirs from it.state(:any) (required) - aStatifierUI.Live.State, ornilfor no run.target(:any) -phx-targetfor the two events. Defaults tonil.scrub_event(:string) - Defaults to"run-scrub".select_event(:string) - Defaults to"run-select".events(:list) - the send palette:%{name:, payload_text:}maps, already derived by the editor. Defaults to[].sendable?(:boolean) - whether this run can be sent to: a live stream with a session supplied. Defaults tofalse.send_event(:string) - Defaults to"run-send".
Slots
inner_block(required) - the canvas, in the diagram's seat.