Skip to content

Commit 7deee09

Browse files
cgreenoclaude
andcommitted
feat(sequence): activation periods
Adds both of mermaid's notations: the activate/deactivate keywords and the arrow suffix shorthand, where + activates the receiver and - deactivates the sender. Activation counts are tracked per participant, so stacked activations balance and deactivating an inactive participant is an error, matching mermaid. mermaid draws an activation box beside the lifeline. Columns are scarce in ASCII and stealing them would push every arrow around, so an active period is drawn as a heavy lifeline instead, with heavy-vertical junctions where messages attach or cross. An activation left open at the end of the diagram runs to the bottom, as mermaid's box does. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 0f404a4 commit 7deee09

12 files changed

Lines changed: 684 additions & 44 deletions
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
sequenceDiagram
2+
A->>B: start
3+
activate B
4+
B->>B: work
5+
deactivate B
6+
B-->>A: done
7+
---
8+
+---+ +---+
9+
| A | | B |
10+
+-+-+ +-+-+
11+
| |
12+
| start |
13+
+-------->|
14+
| #
15+
| # work
16+
| #--+
17+
| # |
18+
| #<-+
19+
| |
20+
| done |
21+
|<........+
22+
| |
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sequenceDiagram
2+
Alice-->>+Bob: Hello Bob, how are you?
3+
Bob-->>- Alice: I am fine and you?
4+
---
5+
+-------+ +-----+
6+
| Alice | | Bob |
7+
+---+---+ +--+--+
8+
| |
9+
| Hello Bob, how are you?
10+
+...........>|
11+
| #
12+
| I am fine and you?
13+
|<...........#
14+
| |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
sequenceDiagram
2+
Alice->>+Bob: request
3+
Bob->>+Carol: sub-request
4+
Carol-->>-Bob: sub-reply
5+
Bob-->>-Alice: reply
6+
---
7+
+-------+ +-----+ +-------+
8+
| Alice | | Bob | | Carol |
9+
+---+---+ +--+--+ +---+---+
10+
| | |
11+
| request | |
12+
+----------->| |
13+
| # |
14+
| # sub-request|
15+
| #----------->|
16+
| # #
17+
| # sub-reply #
18+
| #<...........#
19+
| # |
20+
| reply # |
21+
|<...........# |
22+
| | |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
sequenceDiagram
2+
A->>B: start
3+
activate B
4+
B->>B: work
5+
deactivate B
6+
B-->>A: done
7+
---
8+
┌───┐ ┌───┐
9+
│ A │ │ B │
10+
└─┬─┘ └─┬─┘
11+
│ │
12+
│ start │
13+
├────────►│
14+
│ ┃
15+
│ ┃ work
16+
│ ┠──┐
17+
│ ┃ │
18+
│ ┃◄─┘
19+
│ │
20+
│ done │
21+
│◄┈┈┈┈┈┈┈┈┤
22+
│ │
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sequenceDiagram
2+
Alice-->>+Bob: Hello Bob, how are you?
3+
Bob-->>- Alice: I am fine and you?
4+
---
5+
┌───────┐ ┌─────┐
6+
│ Alice │ │ Bob │
7+
└───┬───┘ └──┬──┘
8+
│ │
9+
│ Hello Bob, how are you?
10+
├┈┈┈┈┈┈┈┈┈┈┈►│
11+
│ ┃
12+
│ I am fine and you?
13+
│◄┈┈┈┈┈┈┈┈┈┈┈┨
14+
│ │
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
sequenceDiagram
2+
Alice->>+Bob: request
3+
Bob->>+Carol: sub-request
4+
Carol-->>-Bob: sub-reply
5+
Bob-->>-Alice: reply
6+
---
7+
┌───────┐ ┌─────┐ ┌───────┐
8+
│ Alice │ │ Bob │ │ Carol │
9+
└───┬───┘ └──┬──┘ └───┬───┘
10+
│ │ │
11+
│ request │ │
12+
├───────────►│ │
13+
│ ┃ │
14+
│ ┃ sub-request│
15+
│ ┠───────────►│
16+
│ ┃ ┃
17+
│ ┃ sub-reply ┃
18+
│ ┃◄┈┈┈┈┈┈┈┈┈┈┈┨
19+
│ ┃ │
20+
│ reply ┃ │
21+
│◄┈┈┈┈┈┈┈┈┈┈┈┨ │
22+
│ │ │

0 commit comments

Comments
 (0)