@cardenelabs/dragon 0.36.4 → 0.37.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/README.md +33 -2
- package/dist/cli.cjs +1126 -220
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1118 -212
- package/dist/cli.js.map +1 -1
- package/dist/export.cjs +1043 -165
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +1 -1
- package/dist/export.d.ts +1 -1
- package/dist/export.js +1038 -160
- package/dist/export.js.map +1 -1
- package/dist/index.cjs +1133 -218
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +77 -3
- package/dist/index.d.ts +77 -3
- package/dist/index.js +1132 -219
- package/dist/index.js.map +1 -1
- package/dist/player.global.js +2 -2
- package/dist/{schema-9VLameDG.d.cts → schema-B2MTRv66.d.cts} +11 -2
- package/dist/{schema-9VLameDG.d.ts → schema-B2MTRv66.d.ts} +11 -2
- package/package.json +1 -1
- package/src/field-messages.ts +4 -0
- package/src/figure-text.ts +21 -0
- package/src/index.ts +8 -1
- package/src/layout/architecture.ts +1 -1
- package/src/layout/scene.ts +78 -8
- package/src/layout/sequence.ts +1 -1
- package/src/layout/state.ts +387 -0
- package/src/look/values.ts +40 -5
- package/src/messages.ts +14 -0
- package/src/parser.ts +45 -14
- package/src/printer.ts +6 -1
- package/src/render/icons.ts +4 -0
- package/src/render/parts.ts +170 -23
- package/src/render/svg.ts +78 -8
- package/src/schema.ts +22 -6
- package/src/schemas/diagram.schema.json +30 -4
- package/src/schemas/validate-diagram.js +1 -1
- package/src/timeline.ts +47 -0
- package/src/words.ts +8 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ const parsed = parseNotation(source);
|
|
|
38
38
|
if (!parsed.ok) throw new Error(parsed.errors.map((e) => `${e.line}: ${e.message}`).join("\n"));
|
|
39
39
|
|
|
40
40
|
const host = document.getElementById("figure");
|
|
41
|
-
if (host === null) throw new Error("
|
|
41
|
+
if (host === null) throw new Error("#figure not found");
|
|
42
42
|
const player = mountDiagram(host, parsed.diagram);
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -58,7 +58,7 @@ CSS と字の file は、束ねる道具 (Vite など) が頁へ運ぶ。
|
|
|
58
58
|
3. 空白を含む名前と文は、行末か `[` の前に置く。`,` か `]` を含む値と、`[` を含む名前だけを `"` で囲む
|
|
59
59
|
4. 入れ子は `group … end` だけ。段は次の `step` までで、字下げは読みやすさのために付ける。`say` の続きの行だけは `say` より深く字下げする
|
|
60
60
|
|
|
61
|
-
行の頭の語は `sequence` `architecture` `group` `end` `box` `strip` `step` `say` `code` `act` `note` `set` で、線の行は `名札 -> 名札` と書く。
|
|
61
|
+
行の頭の語は `sequence` `architecture` `state` `group` `end` `box` `strip` `step` `say` `code` `act` `note` `set` で、線の行は `名札 -> 名札` と書く。
|
|
62
62
|
|
|
63
63
|
```dragon
|
|
64
64
|
architecture 注文を倉庫へ回す
|
|
@@ -83,6 +83,37 @@ step 出荷に回す
|
|
|
83
83
|
前の形の記法 (`時系列図` か `構成図` で始まる形) は読まず、その行の新しい形を示す誤りで止まる。
|
|
84
84
|
前の形と新しい形の対応表は [`CHANGELOG.md`](https://github.com/cardene777/dragon/blob/main/CHANGELOG.md) にある。
|
|
85
85
|
|
|
86
|
+
### 状態遷移図
|
|
87
|
+
|
|
88
|
+
`state` で始めると、1 つの物が状態を移る様子を段ごとに追う状態遷移図になる。箱が状態で、線は状態から状態への移り変わり。
|
|
89
|
+
線の送る側に `start` を書くと始まりの印から出る線に、受ける側に `finish` を書くと終わりの印へ入る線になる。
|
|
90
|
+
最初の `step` より前に書いた線は、移れるが今回は通らない道として点線で引く。
|
|
91
|
+
|
|
92
|
+
```dragon
|
|
93
|
+
state 注文が届くまでの状態
|
|
94
|
+
|
|
95
|
+
box 支払い待ち [note: 入金を待つ, color: amber, icon: clock]
|
|
96
|
+
box 発送済み [note: 業者が運ぶ, color: violet, icon: truck]
|
|
97
|
+
box 配達完了 [note: 受け取られた, color: green, icon: check]
|
|
98
|
+
box キャンセル [note: 払った分は返す, color: rose, icon: x]
|
|
99
|
+
|
|
100
|
+
支払い待ち -> キャンセル: 取り消す
|
|
101
|
+
キャンセル -> finish
|
|
102
|
+
|
|
103
|
+
step 注文する
|
|
104
|
+
say 注文を確定すると、支払い待ちから始まる。
|
|
105
|
+
start -> 支払い待ち: 注文を確定 [tag: #1042]
|
|
106
|
+
|
|
107
|
+
step 発送する
|
|
108
|
+
say 入金を確かめて品物を送り、発送済みに移る。
|
|
109
|
+
支払い待ち -> 発送済み: 発送 [tag: #1042]
|
|
110
|
+
|
|
111
|
+
step 届く
|
|
112
|
+
say 品物が届いて配達完了に移り、注文を閉じる。
|
|
113
|
+
発送済み -> 配達完了: 受け取り [tag: #1042]
|
|
114
|
+
配達完了 -> finish: 注文を閉じる [tag: #1042]
|
|
115
|
+
```
|
|
116
|
+
|
|
86
117
|
## 書き出し
|
|
87
118
|
|
|
88
119
|
書き出しは画面なしの Chromium で、頁と同じ描画を時刻を止めて 1 コマずつ撮る。
|