Adds the Mermaid configuration renderer - #28
Merged
Conversation
StatifierUI.Diagram.render/2 is a pure function from a compiled machine and an active configuration to Mermaid stateDiagram-v2 source for Kino.Mermaid: composite blocks for compound states, "--" region dividers for parallel states, [*] markers for resolved initial states, and an active highlight class over the full configuration. Mermaid cannot draw a transition between internal states of two different composite states, so those edges are lifted to the composite siblings under the least common ancestor and marked [lifted: source -> target]; deep initial targets get the same treatment. The compromise is documented in the moduledoc, and the render/2 interface stays stable for the later elkjs swap. Refs: sui-t36.4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Livebook inspector (sui-t36) needs its first configuration rendering:
a way to show a chart's structure with the active states highlighted,
consuming only the compiled machine and a configuration. The bead settles
the research-doc open question by starting with Mermaid and accepting its
documented limit, keeping the interface stable for the later elkjs swap
(ADR-0008 fixes the destination stack; this is the epic's permitted first
cut).
What
StatifierUI.Diagram.render/2- a pure function fromStatifier.Machineplus an active configuration (any enumerable of state indexes; the full
configuration per ADR-0005) to Mermaid
stateDiagram-v2source suitablefor
Kino.Mermaid. Compound states render as composite blocks, parallelstates as composites with
--region dividers, resolved initial states as[*]markers, final and history states with label suffixes, and activestates via a
classDef/classpair. Nodes are aliaseds<index>from theengine's document-order state indexes, so consumers address nodes by the
identity vocabulary of statifier ADR-0012.
Mermaid cannot draw a transition between internal states of two different
composite states, so such edges are lifted to the composite siblings under
the least common ancestor with a
[lifted: source -> target]marker; deepinitial targets get a
[deep: ...]marker the same way. The compromise isdocumented in the moduledoc.
Notes
(sui-t36.8) is where Kino.Mermaid consumes this.
slice wants live re-rendering from
effect.datamodel_change, that rideson Serializes datamodel_change as a wire type #27 rather than anything here.
mix qualitygreen locally (255 tests, 95.3% coverage);mix gate.verifyattests the run was not narrowed;mix gate.checkreportsno unjustified gate changes. Gettext/Sobelow are the two permanently
inapplicable skips.
Closes: sui-t36.4