figdown 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/dist/figdown.js +339 -88
- package/dist/figdown.mjs +339 -88
- package/examples/evpn-fabric.svg +1 -1
- package/examples/showcase/arp-resolution.svg +1 -1
- package/examples/showcase/ethernet-frame.svg +1 -1
- package/examples/showcase/l2-forwarding-logic.svg +9 -9
- package/examples/showcase/tcp-handshake.svg +1 -1
- package/examples/showcase/tcp-header.svg +1 -1
- package/examples/showcase/tcp-state-machine.svg +77 -55
- package/guide/expressing.md +3 -3
- package/guide/layout.md +16 -16
- package/guide/showcase.md +62 -56
- package/package.json +2 -2
- package/skill/figdown/SKILL.md +26 -0
- package/skill/figdown/figdown.html +391 -109
- package/skill/figdown/reference/experimental/flowchart.md +59 -18
- package/skill/figdown/reference/experimental/statechart.md +92 -0
- package/skill/figdown/reference/reading.md +13 -1
- package/skill/figdown/reference/scene.md +18 -3
|
@@ -3,14 +3,25 @@
|
|
|
3
3
|
The genre itself is outside the v0.1 conformance surface: it may change or be
|
|
4
4
|
withdrawn in a later `0.x`. A portable figure uses `block` instead.
|
|
5
5
|
|
|
6
|
-
Load `../scene.md` first — `flowchart` reuses the
|
|
7
|
-
(`node`, `group`, `external`, `
|
|
8
|
-
|
|
6
|
+
Load `../scene.md` first — `flowchart` reuses the scene vocabulary
|
|
7
|
+
(`node`, `group`, `external`, `flow`, `rank`) with the same meanings, and adds
|
|
8
|
+
the three role keywords below. `flow down` is the default here.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
**Under `figdown 0.2` the connector is `flowline`, not `edge`** — ISO 5807's
|
|
11
|
+
own word for a flowchart's connecting line. Same operators, same labels, same
|
|
12
|
+
option keys, same model; only the word changed.
|
|
13
|
+
|
|
14
|
+
**The spelling is gated by the version you declare.** Under
|
|
15
|
+
`figdown 0.1 flowchart`, `edge` is still the word and `flowline` is a line
|
|
16
|
+
error naming the version; under `figdown 0.2 flowchart` it is the other way
|
|
17
|
+
round. Each version accepts exactly one spelling — two in one version would be
|
|
18
|
+
an alias. A document that writes `flowline` must declare `figdown 0.2`, and
|
|
19
|
+
`edge` under 0.1 stays legal until v1.0.
|
|
20
|
+
|
|
21
|
+
## Three role keywords, and when to write `node` instead
|
|
11
22
|
|
|
12
23
|
```figdown
|
|
13
|
-
figdown 0.
|
|
24
|
+
figdown 0.2 flowchart
|
|
14
25
|
flow down
|
|
15
26
|
terminator start "Request received"
|
|
16
27
|
process parse "Parse body"
|
|
@@ -19,13 +30,13 @@ process apply "Apply change"
|
|
|
19
30
|
process reject "Reject"
|
|
20
31
|
terminator done "Response sent"
|
|
21
32
|
node log "Audit store" shape=cylinder
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
flowline start -> parse
|
|
34
|
+
flowline parse -> valid
|
|
35
|
+
flowline valid -[yes]-> apply
|
|
36
|
+
flowline valid -[no]-> reject
|
|
37
|
+
flowline apply -> done
|
|
38
|
+
flowline reject -> log
|
|
39
|
+
flowline log -> parse
|
|
29
40
|
decision kind "Change kind?" shape=ellipse
|
|
30
41
|
```
|
|
31
42
|
|
|
@@ -44,13 +55,43 @@ wrong roughly one time in five.
|
|
|
44
55
|
model still records the role. That is the escape hatch for matching a source
|
|
45
56
|
drawing without lying about what the step is.
|
|
46
57
|
|
|
47
|
-
**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
**Prefer a role. `node` is the fallback, not the default.** Reach for
|
|
59
|
+
`process`, `decision` or `terminator` first, and write `node` only when **the
|
|
60
|
+
source does not state which** the stage is.
|
|
61
|
+
|
|
62
|
+
That is what a bare `node` says here, and it is all it says: *the source does
|
|
63
|
+
not state the role.* ISO 5807 is a standard for **drawing** flowcharts, so it
|
|
64
|
+
has no "unclassified" — the person with the pen must draw some symbol, and
|
|
65
|
+
every drawn stage therefore has a classification. FigDown separates role from
|
|
66
|
+
geometry, so it can record the absence instead of inventing a role. A
|
|
67
|
+
transcriber who genuinely cannot tell a Process from a Predefined process
|
|
68
|
+
writes `node`, and that is the honest line.
|
|
69
|
+
|
|
70
|
+
**`node` is NOT the spelling for "an ISO symbol FigDown has not implemented."**
|
|
71
|
+
Nine ISO stage symbols have no word in this genre — Data (input/output),
|
|
72
|
+
Stored data, Predefined process, Preparation, Manual operation, Manual input,
|
|
73
|
+
Document, Parallel mode, Loop limit. That is a **gap in FigDown**, not a fact
|
|
74
|
+
about your figure, and writing a bare `node` for one of them files the gap as
|
|
75
|
+
if it were your judgement. When your source states a role this genre cannot
|
|
76
|
+
spell:
|
|
77
|
+
|
|
78
|
+
- write `node` — `process` would be a false claim, and nothing in the figure
|
|
79
|
+
could catch it;
|
|
80
|
+
- **name the ISO symbol in a comment** on the same line, so the classification
|
|
81
|
+
survives as text a reader can quote (a comment is never parsed, and never a
|
|
82
|
+
second semantic channel);
|
|
83
|
+
- report the gap, so it can be counted and closed.
|
|
84
|
+
|
|
85
|
+
```figdown
|
|
86
|
+
node cfg "Read config file" # ISO 5807 Data (input/output) — no FigDown role
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
So do not "upgrade" a `node` to `process` to make it look decided — and do not
|
|
90
|
+
write `node` because deciding was work. Those are different acts with the same
|
|
91
|
+
spelling, and only you know which one you did.
|
|
51
92
|
|
|
52
93
|
**Label every exit from a `decision`.** Use the on-line label form
|
|
53
|
-
(`
|
|
54
|
-
the reader has to guess at.
|
|
94
|
+
(`flowline d -[yes]-> x`) or an endpoint label; an unlabelled branch is a
|
|
95
|
+
figure the reader has to guess at.
|
|
55
96
|
|
|
56
97
|
**There is no loop keyword.** A plain back-edge *is* the loop.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Genre `statechart` — EXPERIMENTAL / EXPERIMENTAL
|
|
2
|
+
|
|
3
|
+
The genre itself is outside the conformance surface: it may change or be
|
|
4
|
+
**withdrawn** in a later `0.x` without a migration. A portable figure uses
|
|
5
|
+
`block` instead — that is what these figures were spelled as before `figdown
|
|
6
|
+
0.2`, and the rewrite back is one line.
|
|
7
|
+
|
|
8
|
+
**It needs `figdown 0.2` on line 1.** `figdown 0.1 statechart` is a line
|
|
9
|
+
error, and a deliberately named one: `genre "statechart" requires figdown 0.2`.
|
|
10
|
+
An engine may not read a `0.1` document as though it were `0.2`.
|
|
11
|
+
|
|
12
|
+
Load `../scene.md` first — `statechart` reuses the scene vocabulary
|
|
13
|
+
(`group`, `external`, `class`, `flow`, `rank`) with the same meanings, and
|
|
14
|
+
**renames the other two**: a node is a **`state`** and a connector is a
|
|
15
|
+
**`transition`**, both taken from OMG UML 2.5.1 §14. Nothing else changes —
|
|
16
|
+
same option keys, same id space, same operators, same model — and `node` or
|
|
17
|
+
`edge` here is a **line error** naming the word to write instead.
|
|
18
|
+
|
|
19
|
+
`flow right` is the default, as in `block`; `flowchart`'s `down` default does
|
|
20
|
+
**not** apply here.
|
|
21
|
+
|
|
22
|
+
**Why this genre loses `node` and `flowchart` keeps it:** a statechart has
|
|
23
|
+
exactly one kind of node, so there is nothing to leave unstated and `state`
|
|
24
|
+
gives up nothing. A flowchart stage can have a role **the source does not
|
|
25
|
+
state**, and there `node` is the only way to say so without asserting a role
|
|
26
|
+
the source never gave.
|
|
27
|
+
|
|
28
|
+
```figdown
|
|
29
|
+
figdown 0.2 statechart
|
|
30
|
+
title "Turnstile"
|
|
31
|
+
class mode "A mode of the mechanism" fill=#e0e7ff
|
|
32
|
+
state locked "LOCKED" class=mode
|
|
33
|
+
state unlocked "UNLOCKED" class=mode
|
|
34
|
+
transition locked -[coin]-> unlocked
|
|
35
|
+
transition unlocked -[push]-> locked
|
|
36
|
+
transition locked -[push]-> locked # self-transition: the event happens
|
|
37
|
+
# and the machine stays
|
|
38
|
+
flow right
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## What the genre adds, which is a reading and not a syntax
|
|
42
|
+
|
|
43
|
+
Everything above parses identically under `block`. The genre earns its
|
|
44
|
+
existence in what you are entitled to conclude from it.
|
|
45
|
+
|
|
46
|
+
**Under `statechart`, and not under `flowchart` or `block`:**
|
|
47
|
+
|
|
48
|
+
- **Every top-level `state` is a state** — a *mode the machine is in*, not a
|
|
49
|
+
step it performs. It has duration; the machine sits in it until something
|
|
50
|
+
happens.
|
|
51
|
+
- **Every `transition` is a transition**, and its direction is the direction of the
|
|
52
|
+
change. An undirected `--` between two states asserts a relationship the
|
|
53
|
+
genre has no reading for; do not read it as a transition in both directions.
|
|
54
|
+
- **A mid label is a transition inscription** — the trigger, and optionally a
|
|
55
|
+
guard and an effect — as free text. There is no structure in it. Quote it,
|
|
56
|
+
attribute it to its edge, and stop; you may not parse `event / action` into
|
|
57
|
+
fields, because nothing in the language promises that shape.
|
|
58
|
+
- **A self-loop is "the event occurs and the machine stays"**, which is a
|
|
59
|
+
fact about the machine. Under `flowchart` the same drawing is a *poll* —
|
|
60
|
+
"check again" — and that is a different claim entirely.
|
|
61
|
+
- **The set of states is closed.** The nodes are all the modes the figure
|
|
62
|
+
asserts; a state not drawn is not asserted to exist.
|
|
63
|
+
|
|
64
|
+
**Still not conclusible, and the list is the same as everywhere else:**
|
|
65
|
+
|
|
66
|
+
- **No current state.** Nothing in a figure says which state the machine is
|
|
67
|
+
in now. A fill colour does not, a `class` does not, position does not.
|
|
68
|
+
- **No initial and no final state.** The language has no vocabulary for
|
|
69
|
+
either at `figdown 0.2` — deliberately, pending evidence, and **no `start`
|
|
70
|
+
keyword was added**: ISO's terminator symbol is *both* ends distinguished by
|
|
71
|
+
its label, so there is no word to borrow, and a reader who lacks one answers
|
|
72
|
+
"unstated" rather than answering wrongly. A state with no incoming
|
|
73
|
+
transition is *drawn* that way; it is not *declared* initial, and reading it
|
|
74
|
+
as initial is inventing a fact.
|
|
75
|
+
- **No ordering among transitions.** Peer edges have no sequence, and an
|
|
76
|
+
ordinal in a label is naming, not order.
|
|
77
|
+
- **No hierarchy, no regions, no history.** A `group` groups; it does not
|
|
78
|
+
make a superstate.
|
|
79
|
+
- **Nothing from the layout zone.** `pin` is arrangement for humans; skip it.
|
|
80
|
+
|
|
81
|
+
**Reclassifying costs more than one line now.** Changing `flowchart` to
|
|
82
|
+
`statechart` on line 1 no longer suffices: every `flowline` becomes a
|
|
83
|
+
`transition` and every `node` a `state`. Run `tools/migrate-figdown.js` — it
|
|
84
|
+
rewrites both, scoped by the header genre.
|
|
85
|
+
|
|
86
|
+
**Do not upgrade a `flowchart` to a `statechart` on structure.** It was
|
|
87
|
+
measured: cycles do not separate the two (of the state machines and the
|
|
88
|
+
flowcharts in this project's own corpus, both are usually cyclic), and
|
|
89
|
+
self-loops appear in almost none. A retry loop drawn as a flowchart is exactly
|
|
90
|
+
the figure that reads wrong as a statechart. **Only the declared genre says
|
|
91
|
+
which it is** — and a title that contains the words "state machine" does not,
|
|
92
|
+
because a polling flowchart is routinely titled that way.
|
|
@@ -71,6 +71,15 @@ Widths, colours and alignment never change it.
|
|
|
71
71
|
**`timing`.** Cycle *t* is the *t*-th character of the lane. `.` continues
|
|
72
72
|
the previous value, and cycles stay contiguous across a gap.
|
|
73
73
|
|
|
74
|
+
**`statechart`** (EXPERIMENTAL, `figdown 0.2` only). Nodes are **states** — modes
|
|
75
|
+
the machine is *in* — and edges are **transitions** on an event. This is the
|
|
76
|
+
one reading you may not derive from the drawing: a cyclic figure with a
|
|
77
|
+
self-loop is just as likely to be a polling `flowchart`, and the word "state
|
|
78
|
+
machine" in a `title` decides nothing. Only line 1 decides. What you may and
|
|
79
|
+
may not conclude is in `experimental/statechart.md`; the short version is that
|
|
80
|
+
there is no current state, no initial state and no final state in the
|
|
81
|
+
language, so reading any of the three out of a figure is invention.
|
|
82
|
+
|
|
74
83
|
## What you MUST NOT infer
|
|
75
84
|
|
|
76
85
|
- **Ignore the layout zone.** Everything from the `layout` keyword down is
|
|
@@ -96,7 +105,10 @@ the previous value, and cycles stay contiguous across a gap.
|
|
|
96
105
|
- **A keyword's meaning is relative to its genre.** Line 1 names the
|
|
97
106
|
namespace. Never carry a reading from one genre into another, and read a
|
|
98
107
|
nested region under **its** genre, not its host's. Multi-section files give
|
|
99
|
-
each section its own genre
|
|
108
|
+
each section its own genre — **and its own language version**; the two
|
|
109
|
+
numbers on a section's header line are that section's whole contract, and
|
|
110
|
+
one file may legitimately carry sections at different versions. The
|
|
111
|
+
permanent exceptions: `figdown`, `title`,
|
|
100
112
|
`layout` and `pin` mean the same thing everywhere — which is exactly what
|
|
101
113
|
lets you skip the layout zone without first knowing the genre.
|
|
102
114
|
- **A shared `class` is a shared category, not an identity.** The language
|
|
@@ -1,11 +1,26 @@
|
|
|
1
|
-
# Scene genres — `block`, and the vocabulary `topology` / `flowchart` share
|
|
1
|
+
# Scene genres — `block`, and the vocabulary `topology` / `flowchart` / `statechart` share
|
|
2
2
|
|
|
3
3
|
Status: `block` is NORMATIVE and portable. The same seven keywords are
|
|
4
|
-
the whole scene surface; `topology` and `
|
|
5
|
-
own, in their own files.
|
|
4
|
+
the whole scene surface; `topology`, `flowchart` and `statechart` reuse them
|
|
5
|
+
and add — or **rename** — their own, in their own files.
|
|
6
6
|
|
|
7
7
|
Load this for any figure made of **things and the connections between them**.
|
|
8
8
|
|
|
9
|
+
**Two of the seven are spelled differently by genre.** Read
|
|
10
|
+
this file for what they *mean*; write the word your genre uses:
|
|
11
|
+
|
|
12
|
+
| genre | the thing | the line |
|
|
13
|
+
|---|---|---|
|
|
14
|
+
| `block`, `topology` | `node` | `edge` |
|
|
15
|
+
| `flowchart` | `node` | **`flowline`** |
|
|
16
|
+
| `statechart` | **`state`** | **`transition`** |
|
|
17
|
+
|
|
18
|
+
Each genre takes the term its own domain actually uses — ISO 5807 calls a
|
|
19
|
+
flowchart's connector a *flowline*; UML calls a state machine's arc a
|
|
20
|
+
*transition*. The wrong one is a **line error naming the right one**, never a
|
|
21
|
+
silent acceptance, so you cannot get this wrong without being told. Everything
|
|
22
|
+
else about them — operators, labels, option keys, the model — is identical.
|
|
23
|
+
|
|
9
24
|
## The seven keywords
|
|
10
25
|
|
|
11
26
|
```figdown
|