Status: backlog Priority: P1 Created: 2026-02-25 Blocks: viz-visualizer-enhancements, viz-simulator
The current visualizer shows [cond] as a literal string on transitions, ignoring the :diagram/condition key that convenience macros already attach. UML statechart notation has standard conventions: transitions show event [guard] / actions, states show entry / actionName and exit / actionName. We need label formatting functions to support this notation.
chart.cljc (alongside existing chart analysis functions)diagram-label [{:keys [id diagram/label]}] — prefers :diagram/label, falls back to (name id)transition-label [elements-by-id transition] — UML format: event [condition] / action1, action2
:diagram/label on the transition if set (overrides all):diagram/condition for guard display text[cond] only if :cond present but no :diagram/condition:diagram/label from executable content children for the action part after /state-entry-labels [elements-by-id state-element] — walks on-entry children, returns vec of :diagram/label strings from their executable contentstate-exit-labels [elements-by-id state-element] — same for on-exitsrc/main/com/fulcrologic/statecharts/chart.cljc — add functions (additive, no signature changes)These functions navigate elements-by-id using existing chart navigation functions (get-children, entry-handlers, exit-handlers). The transition-label function assembles parts conditionally and joins with spaces. Standard UML format: event [guard] / action1, action2.
transition-label: event only → ":go"transition-label: event + cond (no diagram/condition) → ":go [cond]"transition-label: event + diagram/condition → ":go [valid?]"transition-label: event + condition + action labels → ":go [valid?] / load-data, notify"transition-label: diagram/label overrides everything → "custom label"state-entry-labels: on-entry with labeled script → ["load-data"]state-exit-labels: on-exit with labeled script → ["cleanup"]state-entry-labels: on-entry with no diagram/label → []Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |