State diagram (Mermaid)
Anything with a status field deserves one of these. The value is in making the illegal transitions obvious, and in forcing you to answer what happens after cancellation.
#What this example shows
Transitions labelled with the event that causes them, not the resulting state.
A note anchored to a state, for the rules that do not fit on an arrow.
Terminal states, drawn explicitly, so no state is a dead end by accident.
#A worked example
Open it, edit it, or copy the source below.
The source, which you can paste into a new diagram and edit:
#Making it your own
Add composite states with state Name { ... } when a state has its own internal machine.
Use direction LR at the top if the diagram reads better sideways.
Every state needs a way out. A state with no outgoing transition is usually a bug.
#Related
Copy it. Change one line. See what happens.
