Choreo.Lab.DSL.MindMap (Choreo v0.12.0)

Copy Markdown View Source

Experimental Livebook-friendly DSL for sketching mind maps.

This Lab DSL compiles to the stable, pipe-first Choreo.MindMap builders and returns an ordinary %Choreo.MindMap{}. It follows the shared Lab identity rule: in assignment form, the variable name becomes the node id and the string becomes the display label; in inline form, the string is slugged into an id and also used as the label.

Examples

iex> import Choreo.Lab.DSL.MindMap
...> map = mind_map do
...>   system = root("System Design")
...>   requirements = topic("Requirements")
...>   risks = note("Open Risks")
...>
...>   system ~> requirements
...>   edge requirements ~> risks, "needs review"
...> end
iex> Choreo.MindMap.root(map)
:system
iex> map.graph.nodes[:requirements].label
"Requirements"
iex> map.edge_meta[{:requirements, :risks}].label
"needs review"

Branch edges can use ~>, pipe modifiers, explicit edge, or the typed branch form:

root ~> topic
root ~> topic |> on("expands into")
edge root ~> topic, "expands into"
branch root ~> topic, "expands into"

Associative cross-links use the typed associate/association form, a typed keyword on edge, or a pipe modifier:

associate topic ~> note, "related"
association topic ~> note, "related"
edge topic ~> note, associate: "related"
topic ~> note |> associate("related")

Summary

Types

edge_decl()

@type edge_decl() :: %{
  from: Yog.node_id(),
  to: Yog.node_id(),
  edge_type: :branch | :associate,
  opts: keyword()
}

node_decl()

@type node_decl() :: %{id: Yog.node_id(), builder: atom(), opts: keyword()}

Functions

associate(arg1 \\ nil, arg2 \\ nil, opts \\ [])

association(arg1 \\ nil, arg2 \\ nil, opts \\ [])

branch(arg1 \\ nil, arg2 \\ nil, opts \\ [])

mind_map(list)

(macro)

Builds a %Choreo.MindMap{} from a compact Lab DSL block.

mind_map(opts, list)

(macro)

note(arg1 \\ nil, arg2 \\ nil, opts \\ [])

root(arg1 \\ nil, arg2 \\ nil, opts \\ [])

subtopic(arg1 \\ nil, arg2 \\ nil, opts \\ [])

taxonomy()

@spec taxonomy() :: %{
  nodes: [atom()],
  edges: [atom()],
  modifiers: [atom()],
  options: [atom()]
}

Returns the vocabulary supported by the mind-map DSL.

This is meant as a lightweight Livebook discovery helper when autocomplete is not enough.

iex> taxonomy = Choreo.Lab.DSL.MindMap.taxonomy()
iex> :root in taxonomy.nodes
true
iex> :associate in taxonomy.edges
true
iex> :on in taxonomy.modifiers
true

topic(arg1 \\ nil, arg2 \\ nil, opts \\ [])

verbs()

@spec verbs() :: %{
  nodes: [atom()],
  edges: [atom()],
  modifiers: [atom()],
  options: [atom()]
}

Compatibility alias for taxonomy/0.