@cardenelabs/dragon 0.28.0 → 0.30.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 (57) hide show
  1. package/README.md +78 -5
  2. package/dist/index.cjs +9246 -8698
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +186 -66
  5. package/dist/index.d.ts +186 -66
  6. package/dist/index.js +9247 -8700
  7. package/dist/index.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/compile/actor-ids.ts +306 -0
  10. package/src/compile/actors.ts +74 -0
  11. package/src/compile/c4.ts +77 -0
  12. package/src/compile/chain.ts +54 -0
  13. package/src/compile/chart-fields.ts +178 -0
  14. package/src/compile/class.ts +100 -0
  15. package/src/compile/deep-rewrite.ts +30 -0
  16. package/src/compile/derived-source.ts +18 -0
  17. package/src/compile/direction.ts +63 -0
  18. package/src/compile/er-relation.ts +200 -0
  19. package/src/compile/er.ts +44 -0
  20. package/src/compile/flow.ts +54 -0
  21. package/src/compile/funnel.ts +75 -0
  22. package/src/compile/gantt.ts +232 -0
  23. package/src/compile/generic.ts +284 -0
  24. package/src/compile/hierarchy.ts +92 -0
  25. package/src/compile/journey.ts +84 -0
  26. package/src/compile/kinds.ts +156 -0
  27. package/src/compile/lanes.ts +56 -0
  28. package/src/compile/mind.ts +343 -0
  29. package/src/compile/node-title.ts +24 -0
  30. package/src/compile/notice.ts +94 -0
  31. package/src/compile/parts-lookup.ts +17 -0
  32. package/src/compile/parts.ts +2635 -0
  33. package/src/compile/placement-apply.ts +673 -0
  34. package/src/compile/placement.ts +15 -0
  35. package/src/compile/quadrant.ts +110 -0
  36. package/src/compile/rows.ts +40 -0
  37. package/src/compile/sequence.ts +226 -0
  38. package/src/compile/slug.ts +29 -0
  39. package/src/compile/solidity.ts +39 -0
  40. package/src/compile/state.ts +71 -0
  41. package/src/compile/subtitle.ts +22 -0
  42. package/src/compile/swimlane.ts +83 -0
  43. package/src/compile/topology.ts +50 -0
  44. package/src/compile/tree.ts +60 -0
  45. package/src/compile/value-chart.ts +183 -0
  46. package/src/compile/values.ts +432 -0
  47. package/src/compile/word-state.ts +82 -0
  48. package/src/compile.ts +513 -6858
  49. package/src/index.ts +8 -7
  50. package/src/json-line-map.ts +30 -0
  51. package/src/json-parser.ts +356 -123
  52. package/src/near-name.ts +42 -0
  53. package/src/relative-pos.ts +71 -2
  54. package/src/schema.ts +1 -1
  55. package/src/schemas/diagram.json +38 -4
  56. package/src/types.ts +1 -1
  57. package/src/v05/parser.ts +91 -72
package/dist/index.d.cts CHANGED
@@ -75,14 +75,12 @@ declare const DSL_ONLY_KINDS: readonly ["entity", "state", "contract", "eoa", "m
75
75
  /** 記法だけが持つ種類。 描画側の `NodeKind` には含まれない */
76
76
  type DslOnlyKind = (typeof DSL_ONLY_KINDS)[number];
77
77
  /**
78
- * 受け付ける箱の種類。 描画できる種類 (cdl の `NODE_KINDS`) に、 記法だけが持つ種類を足す。
78
+ * 記法が受理する種類の全体。 これに載っていない種類は見本 (パーツ) の候補になる。
79
79
  *
80
- * 以前は手書きの 31 種だった。 描画できる 90 種のうち 78 種が記法から書けず、 部品名として
81
- * 扱われて「そんな部品は無い」 と警告が出るだけだった。 描画側を出所に加えることで
80
+ * 描画できる種類 (cdl の `NODE_KINDS`) に、 記法だけが持つ種類と基盤の別名を足す。
81
+ * 手書きの一覧だった頃は、 描画側に種類が増えても記法から書けず、 部品名として扱われて
82
+ * 「そんな部品は無い」 と警告が出るだけだった。 描画側を出所に加えることで
82
83
  * 「描画できるものは書ける」 が成立する。
83
- */
84
- /**
85
- * 記法が受理する種類の全体。 これに載っていない種類は見本 (パーツ) の候補になる。
86
84
  *
87
85
  * 画面側が「本文が見本を使っているか」 を判定するのに使う (#1022)。 手書きの一覧を
88
86
  * 別に持つと、種類が増えた時にそちらだけ取り残されて余分な読み込みが起きる。
@@ -191,8 +189,19 @@ declare const TONE_ALIAS: Record<string, Tone>;
191
189
  * 2 つあるため、 解決の規則は本 file に 1 つだけ置いて両方から呼ぶ。 片方だけ直すと画面が
192
190
  * 直らない事故を、 規則を共有することで構造的に防ぐ。
193
191
  */
194
- /** 基準からどちら側に置くか。 */
195
- type RelativeDirection = "right" | "left" | "above" | "below";
192
+ /**
193
+ * 基準からどちら側に置くか。
194
+ *
195
+ * 語の一覧は下の `RELATIVE_DIRECTIONS` が持つ。 型を並べ直さず、一覧から導く。
196
+ */
197
+ type RelativeDirection = (typeof RELATIVE_DIRECTIONS)[number];
198
+ /**
199
+ * 向きとして受ける語の一覧。
200
+ *
201
+ * 読み取りの入口が 2 つある (本文の `位置: Web の右 200` と JSON の `posRel.dir`) ため、
202
+ * 一覧を 1 箇所に置いて両方から引く。 2 度書くと、向きを足した時に片方だけが取り残される。
203
+ */
204
+ declare const RELATIVE_DIRECTIONS: readonly ["right", "left", "above", "below"];
196
205
  /** 相対で書かれた位置の指定。 */
197
206
  type RelativePos = {
198
207
  /** 基準にする相手の名前。 `actors:` に書かれた名前をそのまま持つ。 */
@@ -860,13 +869,13 @@ type DslValue = {
860
869
  /** 動く長さ (ms) */
861
870
  durationMs: number;
862
871
  });
863
- /** ステップ (phase) */
864
872
  /** 動いている間の帯 (#1466)。 順序図で、面がいつ動いているかを段の番号で持つ */
865
873
  type DslBand = {
866
874
  actor: string;
867
875
  from: number;
868
876
  to: number;
869
877
  };
878
+ /** ステップ (phase) */
870
879
  type DslPhase = {
871
880
  name: string;
872
881
  durationMs: number;
@@ -949,44 +958,16 @@ type ParseResult = {
949
958
  declare function parseTextDsl(src: string): ParseResult;
950
959
 
951
960
  /**
952
- * AST (DslDocument) → 既存 preset API 経由 → LaidDiagram
961
+ * 組み立てが出す知らせの形 (#2030 で `compile.ts` から移した)。
953
962
  *
954
- * v0.3 ... アニメーション ブロック full compile 対応 (sequence preset のみ、 他 preset は v0.4 で順次)
955
- * - state / tween / set / highlight / badge / body を実 phase に注入
956
- * - アニメーション ありなら builder 直接経路 ... preset の標準 phase を置換
957
- * - アニメーション なしは v0.2 と同じく preset 経由
963
+ * 図種ごとの file が受け取り口の型として使い、`compile.ts` が再輸出して外へ出す。
958
964
  *
959
- * v0.2 ... 6 preset 全対応 (sequence / flow / swimlane / er / state / topology)
965
+ * **葉に置く** = 型そのものは消えるが、TypeScript の取り込みの輪は残る。 輪があると
966
+ * 読む順で解決が変わるため、型でも輪を作らない。
960
967
  */
961
-
962
- interface CompileToCdlOpts {
963
- /**
964
- * CAR-1657 = parts identifier lookup catalog、 caller (CdlEditor / test) が inject。
965
- * DslActor.partId が set された actor を検出したら partsCatalog[partId] から CdlDiagram を
966
- * lookup + mergePartIntoDiagram で target に統合。 未渡し時は parts kind actor を skip + warn。
967
- */
968
- partsCatalog?: Record<string, CdlDiagram>;
969
- /**
970
- * 組み立ての途中で分かった「書いたのに効かなかったこと」 の受け取り口。
971
- *
972
- * 図は出せるので誤りにはしないが、 黙って捨てると書いた人が理由を追えない。 editor は
973
- * これを受けて画面に出す。 判定は組み立て側だけが持ち、 画面側は表示に徹する。
974
- */
975
- onNotice?: (notice: CompileNotice) => void;
976
- /**
977
- * edge が DSL のどの行から来たかの受け取り口 (#998)。
978
- *
979
- * preset によっては書いた step と生成される edge が一致しない (`type: flow` は actor を鎖状に
980
- * 繋ぐため `a -> c` と書いても `a -> b` になる)。 edge を起点に本文の行を直す機能は、 この
981
- * 対応が無いと別の行を書き換える。
982
- *
983
- * **対応が取れない edge については呼ばれない**。 「対応が無い」 と「行 0」 を区別するため。
984
- */
985
- onEdgeSource?: (edgeId: string, line: number) => void;
986
- }
987
968
  /** 図は出せるが書いた通りにならなかった、 という知らせ。 */
988
969
  type CompileNotice = {
989
- kind: "relative-position-ignored" | "focus-target-missing" | "state-override-rejected" | "external-paint-dropped" | "part-not-drawn" | "direction-not-honored" | "scale-reserved" | "part-color-ignored" | "part-state-missing" | "part-edge-dropped" | "part-node-ignored" | "part-lane-ignored" | "chart-value-unreadable" | "chart-edge-dropped" | "value-shadows-state" | "value-unresolved" | "value-duplicate" | "flow-actor-missing" | "value-trigger-unresolved" | "lane-not-honored" | "lane-declared-empty" | "eyebrow-not-honored" | "flow-endpoint-not-honored" | "draw-not-honored" | "draw-target-mismatch" | "formula-unresolved" | "event-target-missing" | "actor-kind-not-honored" | "message-option-not-honored" | "position-offset-ignored" | "group-lane-missing" | "group-lanes-apart";
970
+ kind: "relative-position-ignored" | "focus-target-missing" | "state-override-rejected" | "external-paint-dropped" | "part-not-drawn" | "direction-not-honored" | "scale-reserved" | "part-color-ignored" | "part-state-missing" | "part-edge-dropped" | "part-not-found" | "part-node-ignored" | "part-lane-ignored" | "chart-value-unreadable" | "chart-edge-dropped" | "value-shadows-state" | "value-unresolved" | "value-duplicate" | "flow-actor-missing" | "value-trigger-unresolved" | "lane-not-honored" | "lane-declared-empty" | "eyebrow-not-honored" | "flow-endpoint-not-honored" | "draw-not-honored" | "draw-target-mismatch" | "formula-unresolved" | "event-target-missing" | "actor-kind-not-honored" | "message-option-not-honored" | "position-offset-ignored" | "group-lane-missing" | "group-lanes-apart" | "cardinality-not-honored" | "edge-option-not-honored" | "gantt-end-before-start";
990
971
  /** 対象の名前。 光らせる相手なら書かれた指定そのまま */
991
972
  actor: string;
992
973
  /** 書かれていた行 */
@@ -994,25 +975,7 @@ type CompileNotice = {
994
975
  message: string;
995
976
  hint?: string;
996
977
  };
997
- declare function compileToCdl(doc: DslDocument, opts?: CompileToCdlOpts): CdlDiagram;
998
- /**
999
- * 登場人物ごとの、 図の上での中心と大きさを測る。
1000
- *
1001
- * 対応付けは箱に表示される名前で行う。 id を使わない理由は `applyNodeTones` と同じで、
1002
- * slug の作り方が dragon と cdl で違うため記号を含む名前で一致しない。
1003
- *
1004
- * 1 人が複数の箱に分かれる図種 (順序図の上端 / 下端) では、 全部を囲む矩形を返す。
1005
- * 箱として現れない登場人物は縦列の矩形で代用する。
1006
- */
1007
- declare function measureActorBoxes(diagram: CdlDiagram,
1008
- /**
1009
- * 配置まで済ませた図。 渡すとここでは測り直さない (#1006)。
1010
- *
1011
- * 呼出側が既に組み立てているなら、 ここで `layout` を呼ぶと同じ図の配置を 2 度計算する。
1012
- * 図の規模に比例して重く、 辺 500 本で約 300ms (実測)。
1013
- * 渡す時は `diagram` と対にする = 別の図の配置を渡すと、 測る位置がずれる。
1014
- */
1015
- laidHint?: LaidDiagram): Map<string, AnchorBox>;
978
+
1016
979
  /**
1017
980
  * この図を取り込んでよいか (#1015)。
1018
981
  *
@@ -1209,6 +1172,63 @@ declare function partsGridCenters(baseBottom: number | undefined, items: Readonl
1209
1172
  */
1210
1173
  declare function 部品に上書きを当てる(part: CdlDiagram, actor: Pick<DslActor, "stateOverride" | "colorHex">): CdlDiagram;
1211
1174
 
1175
+ /**
1176
+ * 登場人物ごとの、 図の上での中心と大きさを測る。
1177
+ *
1178
+ * 対応付けは箱に表示される名前で行う。 id を使わない理由は `applyNodeTones` と同じで、
1179
+ * slug の作り方が dragon と cdl で違うため記号を含む名前で一致しない。
1180
+ *
1181
+ * 1 人が複数の箱に分かれる図種 (順序図の上端 / 下端) では、 全部を囲む矩形を返す。
1182
+ * 箱として現れない登場人物は縦列の矩形で代用する。
1183
+ */
1184
+ declare function measureActorBoxes(diagram: CdlDiagram,
1185
+ /**
1186
+ * 配置まで済ませた図。 渡すとここでは測り直さない (#1006)。
1187
+ *
1188
+ * 呼出側が既に組み立てているなら、 ここで `layout` を呼ぶと同じ図の配置を 2 度計算する。
1189
+ * 図の規模に比例して重く、 辺 500 本で約 300ms (実測)。
1190
+ * 渡す時は `diagram` と対にする = 別の図の配置を渡すと、 測る位置がずれる。
1191
+ */
1192
+ laidHint?: LaidDiagram): Map<string, AnchorBox>;
1193
+
1194
+ /**
1195
+ * AST (DslDocument) → 既存 preset API 経由 → LaidDiagram
1196
+ *
1197
+ * v0.3 ... アニメーション ブロック full compile 対応 (sequence preset のみ、 他 preset は v0.4 で順次)
1198
+ * - state / tween / set / highlight / badge / body を実 phase に注入
1199
+ * - アニメーション ありなら builder 直接経路 ... preset の標準 phase を置換
1200
+ * - アニメーション なしは v0.2 と同じく preset 経由
1201
+ *
1202
+ * v0.2 ... 6 preset 全対応 (sequence / flow / swimlane / er / state / topology)
1203
+ */
1204
+
1205
+ interface CompileToCdlOpts {
1206
+ /**
1207
+ * CAR-1657 = parts identifier lookup catalog、 caller (CdlEditor / test) が inject。
1208
+ * DslActor.partId が set された actor を検出したら partsCatalog[partId] から CdlDiagram を
1209
+ * lookup + mergePartIntoDiagram で target に統合。 未渡し時は parts kind actor を skip + warn。
1210
+ */
1211
+ partsCatalog?: Record<string, CdlDiagram>;
1212
+ /**
1213
+ * 組み立ての途中で分かった「書いたのに効かなかったこと」 の受け取り口。
1214
+ *
1215
+ * 図は出せるので誤りにはしないが、 黙って捨てると書いた人が理由を追えない。 editor は
1216
+ * これを受けて画面に出す。 判定は組み立て側だけが持ち、 画面側は表示に徹する。
1217
+ */
1218
+ onNotice?: (notice: CompileNotice) => void;
1219
+ /**
1220
+ * edge が DSL のどの行から来たかの受け取り口 (#998)。
1221
+ *
1222
+ * preset によっては書いた step と生成される edge が一致しない (`type: flow` は actor を鎖状に
1223
+ * 繋ぐため `a -> c` と書いても `a -> b` になる)。 edge を起点に本文の行を直す機能は、 この
1224
+ * 対応が無いと別の行を書き換える。
1225
+ *
1226
+ * **対応が取れない edge については呼ばれない**。 「対応が無い」 と「行 0」 を区別するため。
1227
+ */
1228
+ onEdgeSource?: (edgeId: string, line: number) => void;
1229
+ }
1230
+ declare function compileToCdl(doc: DslDocument, opts?: CompileToCdlOpts): CdlDiagram;
1231
+
1212
1232
  /**
1213
1233
  * 記法の検査 (図を書く人向けの修正システム)。
1214
1234
  *
@@ -1536,6 +1556,33 @@ declare function describeOversize(size: InputSize): string | null;
1536
1556
  */
1537
1557
  declare function describeOversizeSource(src: string): string | null;
1538
1558
 
1559
+ /**
1560
+ * JSON / YAML の本文で「どこに書いたか」 を指す鍵と、そこから行番号を引く表 (#2117)。
1561
+ *
1562
+ * JSON を読む経路は行番号を持たないため、組み立ての知らせは全て 0 行になり、画面は
1563
+ * 「どの行の話か」 を出せなかった。 本文の行が分かる入口 (編集画面の YAML 欄) は、本文を
1564
+ * 読む時に場所ごとの行を集めてこの表で渡す。 表を渡さない呼出 (LLM が作った JSON を直に
1565
+ * 渡す経路) は今までどおり 0 行になる。
1566
+ *
1567
+ * 鍵の形は RFC 6901 (JSON Pointer) と同じにする (`/actors/1` / `/values/sales`)。
1568
+ * 名前をそのまま `.` で繋ぐ形にすると、`values` に `a.b` という名前を書いた場所と、
1569
+ * `values.a` の中の `b` という欄が同じ鍵になる。 `/` と `~` を書き換える規則があるため、
1570
+ * この形では重ならない。
1571
+ *
1572
+ * 表を作る側 (`apps/playground-spa/src/lib/yaml-lines.ts`) と引く側 (`json-parser.ts`) は
1573
+ * 同じ関数を呼ぶ。 別々に持つと、片方だけ直した時に **全ての行が引けなくなる** =
1574
+ * 引けない状態は知らせが 0 行に戻るだけで、図も誤りも変わらないため気付けない。
1575
+ */
1576
+ /** 本文の場所 (JSON Pointer) から、元の本文の行番号 (1 始まり) を引く表。 */
1577
+ type 書いた行の表 = ReadonlyMap<string, number>;
1578
+ /**
1579
+ * 場所を指す鍵を作る。 引数は上から順に、欄の名前と並びの番号。
1580
+ *
1581
+ * 文書そのものは引数なしで空文字になる。 1 つずつ足す時は、親の鍵に
1582
+ * `書いた場所の鍵(次の区切り)` を繋げる (同じ結果になる)。
1583
+ */
1584
+ declare function 書いた場所の鍵(...道: readonly (string | number)[]): string;
1585
+
1539
1586
  /**
1540
1587
  * LLM 向け JSON DSL parser。
1541
1588
  *
@@ -1544,7 +1591,7 @@ declare function describeOversizeSource(src: string): string | null;
1544
1591
  * で確実に生成できるよう、 flat な object array を優先した shape になっている。
1545
1592
  *
1546
1593
  * 使い方 (LLM):
1547
- * 1. `packages/dragon/schemas/diagram.json` の JSON Schema を LLM の tool schema に注入
1594
+ * 1. `packages/dragon/src/schemas/diagram.json` の JSON Schema を LLM の tool schema に注入
1548
1595
  * 2. LLM が JSON を返す
1549
1596
  * 3. `jsonToDiagram(json)` で CdlDiagram に変換
1550
1597
  * 4. validation error は throw、 retry loop で LLM に修正させる
@@ -1699,6 +1746,23 @@ interface DragonJson {
1699
1746
  */
1700
1747
  palette?: DslPalette;
1701
1748
  }
1749
+ /**
1750
+ * 位置を他の要素からの相対で書く指定の、JSON 側の形 (#2039)。
1751
+ *
1752
+ * 記法の `位置: Web の右 200` を 3 つの欄に開いたもの。 内側の値は `RelativePos` と同じで、
1753
+ * 向きの語も同じ 4 つ (`right` / `left` / `above` / `below`) を使う。
1754
+ *
1755
+ * **向きの語を並べ直さない**。 `RelativeDirection` をそのまま使うことで、本文側に向きを
1756
+ * 足した時に JSON 側が黙って取り残される形を作らない。
1757
+ */
1758
+ interface JsonRelativePos {
1759
+ /** 基準にする相手の名前。 `actors:` に書かれた名前をそのまま書く */
1760
+ anchor: string;
1761
+ /** 基準からどちら側に置くか */
1762
+ dir: RelativeDirection;
1763
+ /** 相手との間隔。 書かなければ `RELATIVE_GAP_DEFAULT` */
1764
+ gap?: number;
1765
+ }
1702
1766
  interface JsonActor {
1703
1767
  name: string;
1704
1768
  /**
@@ -1727,8 +1791,9 @@ interface JsonActor {
1727
1791
  renderOffsetX?: number | string;
1728
1792
  renderOffsetY?: number | string;
1729
1793
  /**
1730
- * CAR-1657 unified syntax = 既存 NodeKind (28 個) に加えて parts identifier (arc-gauge 等) を
1731
- * accept する。 未知 kind 値は parts 候補として partId に格納、 compile 側 partsCatalog で解決。
1794
+ * CAR-1657 unified syntax = 既存 NodeKind (一覧は `v05/parser.ts` の `NODE_KIND_VALID`) に
1795
+ * 加えて parts identifier (arc-gauge 等) を accept する。
1796
+ * 未知 kind 値は parts 候補として partId に格納、 compile 側 partsCatalog で解決。
1732
1797
  * LLM structured output の typing 制約を緩めるため union に string 追加。
1733
1798
  * `string & {}` = NodeKind の候補を IDE 補完で提示しつつ任意 string も許容する idiom。
1734
1799
  * 素の `NodeKind | string` は no-redundant-type-constituents に抵触し補完も潰れる (#865)。
@@ -1754,6 +1819,17 @@ interface JsonActor {
1754
1819
  * と同じで、読み方は `DslActor.layoutPos` が持つ。
1755
1820
  */
1756
1821
  pos?: LayoutPos;
1822
+ /**
1823
+ * 位置を他の要素からの相対で書く指定 (#2039)。 記法の `位置: Web の右 200` と同じ。
1824
+ *
1825
+ * 記法は 1 本の文字列に「誰の」「どちら側に」「どれだけ離して」 を詰めるが、JSON では
1826
+ * 3 つの欄に分ける。 文字列を組み立てて渡す形にすると、書く側が記法の並び順と区切りを
1827
+ * 覚える必要が出る = JSON を書くのは主に LLM で、読み取りの規則は欄の名前で示す方が短い。
1828
+ *
1829
+ * 組み立ての段階で基準の実座標から `posX` / `posY` に直すため、解決した後は座標を直接
1830
+ * 書いた時と同じ経路を通る。 `pos` (配置後のずらし幅) とは別の欄。
1831
+ */
1832
+ posRel?: JsonRelativePos;
1757
1833
  /**
1758
1834
  * CAR-1657 parts state override (kind = parts identifier 時のみ有効)。
1759
1835
  * LLM JSON DSL では nested 明示 = `{ "state": { "v": 50 } }` が natural、 human 側の
@@ -1813,6 +1889,17 @@ interface JsonActor {
1813
1889
  * 読めない項目名として知らせる)。
1814
1890
  */
1815
1891
  scale?: number;
1892
+ /**
1893
+ * 見本が持つ段を使うか (#2125)。 記法の `{ kind: wave-gauge, phase: false }` と同じ。
1894
+ *
1895
+ * 既定 (書かない) は見本の段を書いた段と番号ごとに並べて再生する。 `false` を書くと
1896
+ * 見本の段の中身 (点灯と値の変化) を空にし、値は書いた段だけが動かす。
1897
+ *
1898
+ * 見本 (parts) にしか効かない。 中身は状態の上書き (`state`) に `phase` として入る =
1899
+ * `"state": { "phase": false }` と同じ所へ届く。 記法が中括弧の中に 1 つの名前として
1900
+ * 書ける以上、JSON でも同じ名前で書けるようにする (入口で書き方が分かれない)。
1901
+ */
1902
+ phase?: boolean;
1816
1903
  /** 行頭の印 (#1466)。 行と対で読む。 語の意味は図の種類が決める */
1817
1904
  marks?: string[];
1818
1905
  }
@@ -1960,6 +2047,13 @@ interface JsonDslError {
1960
2047
  declare function jsonToDiagram(json: unknown, opts?: {
1961
2048
  partsCatalog?: Record<string, CdlDiagram>;
1962
2049
  onNotice?: CompileToCdlOpts["onNotice"];
2050
+ /**
2051
+ * 本文の場所から書いた行を引く表 (#2117)。 渡すと知らせが書いた行を指す。
2052
+ *
2053
+ * JSON そのものは書いた場所を持たないため、本文の行が分かる入口 (編集画面の YAML 欄) が
2054
+ * 集めて渡す。 渡さない呼出は今までどおり全ての知らせが 0 行になる。
2055
+ */
2056
+ 行の表?: 書いた行の表;
1963
2057
  }): CdlDiagram;
1964
2058
  /**
1965
2059
  * JSON DSL を validate だけ実施 (compile しない)。 error 詳細を配列で取得したい場合に使う。
@@ -1988,7 +2082,7 @@ declare function validateDragonJson(json: unknown): {
1988
2082
  * });
1989
2083
  * const diagram = jsonToDiagram(res.content[0].input);
1990
2084
  *
1991
- * schema JSON は `packages/dragon/schemas/diagram.json` が SSOT、 本 file は import して再 export するだけ。
2085
+ * schema JSON は `packages/dragon/src/schemas/diagram.json` が SSOT、 本 file は import して再 export するだけ。
1992
2086
  */
1993
2087
  /**
1994
2088
  * Dragon DSL JSON Schema (Draft 7)。 Anthropic / OpenAI の tool schema にそのまま注入可能。
@@ -2178,6 +2272,10 @@ declare const diagramJsonSchema: {
2178
2272
  type: string;
2179
2273
  description: string;
2180
2274
  };
2275
+ phase: {
2276
+ type: string;
2277
+ description: string;
2278
+ };
2181
2279
  pos: {
2182
2280
  type: string;
2183
2281
  additionalProperties: boolean;
@@ -2192,6 +2290,28 @@ declare const diagramJsonSchema: {
2192
2290
  };
2193
2291
  };
2194
2292
  };
2293
+ posRel: {
2294
+ type: string;
2295
+ additionalProperties: boolean;
2296
+ description: string;
2297
+ required: string[];
2298
+ properties: {
2299
+ anchor: {
2300
+ type: string;
2301
+ minLength: number;
2302
+ description: string;
2303
+ };
2304
+ dir: {
2305
+ type: string;
2306
+ enum: string[];
2307
+ description: string;
2308
+ };
2309
+ gap: {
2310
+ type: string;
2311
+ description: string;
2312
+ };
2313
+ };
2314
+ };
2195
2315
  visibleIf: {
2196
2316
  type: string;
2197
2317
  description: string;
@@ -3407,4 +3527,4 @@ interface CompileOpts {
3407
3527
  */
3408
3528
  declare function textDslToDiagram(src: string, opts?: CompileOpts): CdlDiagram;
3409
3529
 
3410
- export { type AnchorBox, type CompileNotice, type CompileOpts, DIAGRAM_BOUNDARY_PADDING, DIRECTION_ALIAS, DRAW_TARGETS, DRAW_WORDS, type DiagramBoundingBox, type DragonJson, type DslActor, type DslAnimate, type DslDocument, type DslError, type DslGroup, type DslLane, type DslPhase, type DslSet, type DslState, type DslStep, type DslTween, type DslValue, type DslViewport, type FocusEntry, type InputSize, JSONを分解する, type JsonActor, type JsonAxes, type JsonDslError, type JsonPhase, type JsonStep, type LayoutMode, type LayoutPos, type LintIssue, type LintReport, type LintSeverity, MAX_INPUT_BYTES, MAX_INPUT_ELEMENTS, MAX_PART_SCALE, NODE_KIND_ALIAS, NODE_KIND_VALID, PHASE_ITEM_WORDS, PRESET_TYPES, type PresetType, RELATIVE_GAP_DEFAULT, type RelativeDirection, type RelativePos, TONE_ALIAS, TOP_LEVEL_KEYS, autoFix, compileToCdl, computeDiagramBoundingBox, countBytes, countDiagramElements, countDocElements, describeOversize, describeOversizeSource, diagramJsonSchema, isColorValue, jsonToDiagram, lintDiagram, measureActorBoxes, normalizePartScale, orderByDependency, parseFocusEntry, parseRelativePos, parseTextDsl, parseTextDslV05, partBoxInFrame, partDrawsInDiagram, partIsMeasurable, partRenderSize, partScaleFactor, partTargetScale, partTargetSize, partVisualSize, partsBaseBottom, partsGridCenters, pointsOutside, rectsOverlap, resolveRelativePos, stripExternalPaint, stripQuotes, textDslToDiagram, validateDragonJson, writeActorPosition, type トークン, type トークンの種類, 区間に広げる, 記法を分解する, 部品に上書きを当てる };
3530
+ export { type AnchorBox, type CompileNotice, type CompileOpts, DIAGRAM_BOUNDARY_PADDING, DIRECTION_ALIAS, DRAW_TARGETS, DRAW_WORDS, type DiagramBoundingBox, type DragonJson, type DslActor, type DslAnimate, type DslDocument, type DslError, type DslGroup, type DslLane, type DslPhase, type DslSet, type DslState, type DslStep, type DslTween, type DslValue, type DslViewport, type FocusEntry, type InputSize, JSONを分解する, type JsonActor, type JsonAxes, type JsonDslError, type JsonPhase, type JsonStep, type LayoutMode, type LayoutPos, type LintIssue, type LintReport, type LintSeverity, MAX_INPUT_BYTES, MAX_INPUT_ELEMENTS, MAX_PART_SCALE, NODE_KIND_ALIAS, NODE_KIND_VALID, PHASE_ITEM_WORDS, PRESET_TYPES, type PresetType, RELATIVE_GAP_DEFAULT, type RelativeDirection, type RelativePos, TONE_ALIAS, TOP_LEVEL_KEYS, autoFix, compileToCdl, computeDiagramBoundingBox, countBytes, countDiagramElements, countDocElements, describeOversize, describeOversizeSource, diagramJsonSchema, isColorValue, jsonToDiagram, lintDiagram, measureActorBoxes, normalizePartScale, orderByDependency, parseFocusEntry, parseRelativePos, parseTextDsl, parseTextDslV05, partBoxInFrame, partDrawsInDiagram, partIsMeasurable, partRenderSize, partScaleFactor, partTargetScale, partTargetSize, partVisualSize, partsBaseBottom, partsGridCenters, pointsOutside, rectsOverlap, resolveRelativePos, stripExternalPaint, stripQuotes, textDslToDiagram, validateDragonJson, writeActorPosition, type トークン, type トークンの種類, 区間に広げる, 書いた場所の鍵, type 書いた行の表, 記法を分解する, 部品に上書きを当てる };