@cardenelabs/dragon 0.42.1 → 0.43.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/src/timeline.ts CHANGED
@@ -153,8 +153,8 @@ function plan(step: Diagram["steps"][number], needle?: Needle): Planned {
153
153
  return;
154
154
  }
155
155
  if (event.type === "now" || (needle && pulled(event))) return;
156
- // 枝分かれの図の commit を積む出来事と枝を切る出来事は、親から引く線と同じ間で引く
157
- if (event.type === "commit" || event.type === "branch") {
156
+ // 枝分かれの図の commit を積む出来事と枝を切る出来事と、木の図の葉と親を出す出来事は、親から引く線と同じ間で引く
157
+ if (event.type === "commit" || event.type === "branch" || event.type === "leaf" || event.type === "node") {
158
158
  const a = cursor;
159
159
  const b = a + MOTION.draw;
160
160
  out.edges.push({ event: e, a, b, carries: false, coin: false, named: false });
package/src/words.ts CHANGED
@@ -16,7 +16,7 @@ export type NotationLang = "ja" | "en";
16
16
  const keys = <K extends string>(table: Record<K, true>): K[] => Object.keys(table) as K[];
17
17
 
18
18
  /** 図の種類。最初の行の頭の語 */
19
- export const KINDS = keys<Diagram["kind"]>({ sequence: true, architecture: true, state: true, git: true, time: true });
19
+ export const KINDS = keys<Diagram["kind"]>({ sequence: true, architecture: true, state: true, git: true, time: true, tree: true });
20
20
 
21
21
  /**
22
22
  * 状態遷移図の始まりと終わりの印の名前 (#3163)。線の送る側に `start`、受ける側に `finish` を書き、
@@ -36,11 +36,16 @@ export const TIME_HEADS = ["scale", "period", "row", "point", "zoom", "mark", "s
36
36
  */
37
37
  export const NOW = "now";
38
38
 
39
+ /**
40
+ * 木の図 (`tree`、#3233) だけが書ける行の頭の語。段の中で葉を出し (`leaf`)、1 つ以上の子から親を組む (`node`)
41
+ */
42
+ export const TREE_HEADS = ["leaf", "node"] as const;
43
+
39
44
  /**
40
45
  * 最初の行より後の行の頭の語。線の行だけは箱の名札から始まる。
41
46
  * `branch` と `commit` は枝分かれの図 (`git`) だけが書ける (#3164)。`source` は段の出典 (#3199)
42
47
  */
43
- export const HEADS = ["group", "end", "box", "strip", "step", "say", "code", "source", "act", "note", "set", "branch", "commit", ...TIME_HEADS] as const;
48
+ export const HEADS = ["group", "end", "box", "strip", "step", "say", "code", "source", "act", "note", "set", "branch", "commit", ...TIME_HEADS, ...TREE_HEADS] as const;
44
49
  type Head = (typeof HEADS)[number];
45
50
 
46
51
  /** 箱と区画の名札の後ろに、見せる名前を続ける語 (`box <名札> as <名前>`) */
@@ -60,6 +65,9 @@ export const GIT_WORDS = [FROM, COPY, MERGE] as const;
60
65
  /** 時間軸の図の節目の行で、節目を置く目盛りを続ける語 (`point <名札> at <目盛り>`)。必ず書くので部品の語に数えない */
61
66
  export const AT = "at";
62
67
 
68
+ /** 木の図の `node` の行で、親の名札の後ろに子を続ける語 (`node <名札> of <子>, <子>`)。必ず書くので部品の語に数えない */
69
+ export const OF = "of";
70
+
63
71
  /**
64
72
  * 行ごとに書ける属性の鍵。線の `at` と `into`、`note` の `color`、中身の帯の欄の `meter` は時間軸の図だけが書ける (#3165)。
65
73
  * `meter` は `strip` の行の欄ごとに、欄の名前の後ろに書く (`strip <題>: <欄> [meter: <割合>]`)
@@ -76,6 +84,8 @@ export const ATTRS = {
76
84
  strip: ["meter"],
77
85
  branch: ["note"],
78
86
  commit: ["hash", "note"],
87
+ leaf: ["hash"],
88
+ node: ["hash"],
79
89
  scale: ["from"],
80
90
  period: ["from"],
81
91
  row: ["color", "empty"],