@cardenelabs/dragon 0.37.0 → 0.40.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.
Files changed (48) hide show
  1. package/README.md +38 -1
  2. package/dist/cli.cjs +2403 -550
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +2408 -555
  5. package/dist/cli.js.map +1 -1
  6. package/dist/export.cjs +2252 -537
  7. package/dist/export.cjs.map +1 -1
  8. package/dist/export.d.cts +3 -1
  9. package/dist/export.d.ts +3 -1
  10. package/dist/export.js +2257 -542
  11. package/dist/export.js.map +1 -1
  12. package/dist/index.cjs +2387 -495
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +11 -154
  15. package/dist/index.d.ts +11 -154
  16. package/dist/index.js +2387 -496
  17. package/dist/index.js.map +1 -1
  18. package/dist/ink-B_7OXxtb.d.cts +360 -0
  19. package/dist/ink-B_7OXxtb.d.ts +360 -0
  20. package/dist/player.global.js +2 -2
  21. package/package.json +1 -1
  22. package/src/cli.ts +9 -0
  23. package/src/export/index.ts +4 -1
  24. package/src/field-messages.ts +8 -0
  25. package/src/figure-text.ts +28 -0
  26. package/src/index.ts +3 -0
  27. package/src/layout/architecture.ts +123 -44
  28. package/src/layout/git.ts +728 -0
  29. package/src/layout/measure.ts +10 -0
  30. package/src/layout/scene.ts +300 -19
  31. package/src/layout/sequence.ts +29 -11
  32. package/src/layout/state.ts +82 -62
  33. package/src/look/values.ts +57 -4
  34. package/src/messages.ts +47 -4
  35. package/src/parser.ts +142 -7
  36. package/src/player.ts +44 -0
  37. package/src/printer.ts +16 -4
  38. package/src/render/git.ts +161 -0
  39. package/src/render/ink.ts +104 -0
  40. package/src/render/parts.ts +103 -36
  41. package/src/render/svg.ts +63 -15
  42. package/src/schema.ts +47 -13
  43. package/src/schemas/diagram.schema.json +75 -8
  44. package/src/schemas/validate-diagram.js +1 -1
  45. package/src/timeline.ts +18 -3
  46. package/src/words.ts +19 -3
  47. package/dist/schema-B2MTRv66.d.cts +0 -133
  48. package/dist/schema-B2MTRv66.d.ts +0 -133
package/README.md CHANGED
@@ -58,7 +58,7 @@ CSS と字の file は、束ねる道具 (Vite など) が頁へ運ぶ。
58
58
  3. 空白を含む名前と文は、行末か `[` の前に置く。`,` か `]` を含む値と、`[` を含む名前だけを `"` で囲む
59
59
  4. 入れ子は `group … end` だけ。段は次の `step` までで、字下げは読みやすさのために付ける。`say` の続きの行だけは `say` より深く字下げする
60
60
 
61
- 行の頭の語は `sequence` `architecture` `state` `group` `end` `box` `strip` `step` `say` `code` `act` `note` `set` で、線の行は `名札 -> 名札` と書く。
61
+ 行の頭の語は `sequence` `architecture` `state` `git` `group` `end` `box` `branch` `strip` `step` `say` `code` `commit` `act` `note` `set` で、線の行は `名札 -> 名札` と書く。
62
62
 
63
63
  ```dragon
64
64
  architecture 注文を倉庫へ回す
@@ -114,6 +114,42 @@ step 届く
114
114
  配達完了 -> finish: 注文を閉じる [tag: #1042]
115
115
  ```
116
116
 
117
+ ### 枝分かれの図
118
+
119
+ `git` で始めると、git の枝に commit を積み、取り込むまでを段ごとに追う枝分かれの図になる。枝は `branch` の行で上から順に宣言し、枝ごとに帯が並ぶ。
120
+ 段の中では `commit <名札> on <枝>` で枝の先に commit を積み、`copy <元>` で当て直しの commit を、`merge <枝>` で merge commit を作る。`hash` と `note` で丸の外に hash と一言を添える。
121
+ `<枝> from <commit>` で枝を切り、`<札> -> <commit>` で commit を作らずに枝の札か `HEAD` を動かす。どの札からも辿れなくなった commit は点線の丸に変わる。
122
+
123
+ ```dragon
124
+ git fix は merge commit で、feature は当て直して取り込む
125
+
126
+ branch main [note: 取り込む先]
127
+ branch feature [note: 作業の枝]
128
+ branch fix [note: 直しの枝]
129
+
130
+ step 枝を切る
131
+ say main の A から fix と feature を切り、それぞれに commit を積む。
132
+ commit A on main [hash: 3fa0c19, note: 最初の形]
133
+ fix from A
134
+ commit F on fix [hash: 9b2e4d1, note: 誤字を直す]
135
+ feature from A
136
+ commit C on feature [hash: c41d0e5, note: 検索を足す]
137
+
138
+ step merge commit で取り込む
139
+ say fix を merge commit M で main へ取り込む。M は A と F の 2 つを親に持つ。
140
+ commit M on main merge fix [hash: 7d3a5e2, note: fix を取り込む]
141
+
142
+ step 当て直す
143
+ say HEAD を M へ動かして枝から離し、C を M の先へ写して C' を作る。
144
+ HEAD -> M
145
+ commit C' on main copy C [hash: a90c6b4, note: 検索を足す]
146
+
147
+ step 早送りする
148
+ say feature を C' へ動かし、main も C' まで進める。元の C はどの枝からも辿れなくなる。
149
+ feature -> C'
150
+ main -> C'
151
+ ```
152
+
117
153
  ## 書き出し
118
154
 
119
155
  書き出しは画面なしの Chromium で、頁と同じ描画を時刻を止めて 1 コマずつ撮る。
@@ -143,6 +179,7 @@ dragon export ccip.json --out out
143
179
  | `--format <形>` | 書き出す形を `,` で区切る (既定 `mp4,gif,html,png`) |
144
180
 
145
181
  PNG は最後の段の止め絵を、全体を止めた見せ方で撮る。
182
+ 図の中で字が重なる段がある時は、書き出したうえで重なりを段と文で 1 件 1 行ずつ標準エラーに出す (例 `段 5: 段の番号 1 と段の番号 5 が重なる`)。終わり方は 0 のまま変えない。
146
183
  HTML は図で描く字だけに削った字の file を埋めた 1 file で、外へ何も取りに行かない。
147
184
  node から呼ぶ時は `@cardenelabs/dragon/export` の `exportDiagram` を使う。
148
185