@cardenelabs/dragon 0.7.0 → 0.9.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/dist/index.d.cts CHANGED
@@ -82,7 +82,7 @@ declare function orderByDependency(items: ReadonlyArray<{
82
82
  * docs/cdl/text-dsl-spec.md の文法を AST に変換した中間表現
83
83
  */
84
84
 
85
- type PresetType = "sequence" | "flow" | "swimlane" | "er" | "state" | "topology" | "solidity" | "gantt" | "class" | "pie" | "c4" | "mind";
85
+ type PresetType = "sequence" | "flow" | "swimlane" | "er" | "state" | "topology" | "solidity" | "gantt" | "class" | "pie" | "bar" | "line" | "funnel" | "tree" | "journey" | "quadrant" | "c4" | "mind";
86
86
  type Position = {
87
87
  line: number;
88
88
  column?: number;
@@ -110,9 +110,42 @@ type LayoutMode = "auto" | "manual";
110
110
  type DslDocument = {
111
111
  title: string;
112
112
  type: PresetType;
113
+ /**
114
+ * 図全体を 1 箱にする図種 (`pie` / `bar` / `line` / `funnel` / `tree` / `journey` /
115
+ * `quadrant` / `mind` / `gantt`) で、 その箱の上に出す小見出し (#1247)。
116
+ *
117
+ * これらの図種は箱を 1 つしか作らないため「どの箱の小見出しか」 が決まる。 箱ごとに
118
+ * 分かれる図種では決まらないので、 書かれていたら組み立て側が知らせる。
119
+ */
120
+ eyebrow?: string;
121
+ /**
122
+ * `eyebrow` を書いた行 (#1247)。 知らせの行番号に使う。
123
+ *
124
+ * 図の `pos` は常に 1 行目を指すため、 そこを使うと「10 行目に書いた `eyebrow` が効かない」
125
+ * を 1 行目として知らせることになり、 書いた場所に辿り着けない。
126
+ */
127
+ eyebrowPos?: Position;
128
+ /**
129
+ * 2 軸で仕分ける図 (`type: quadrant`) の軸の名前 (#1251)。
130
+ *
131
+ * 書かないと「小さい / 大きい」 のままになり、何を判断する図か読めない。
132
+ * 区画の名前 (`右上` 等) は軸の名前から `{上} × {右}` の形で決まる。
133
+ *
134
+ * 他の図種には軸が無いため、書かれていたら組み立て側が知らせる。
135
+ */
136
+ axes?: DslAxes;
137
+ /** `axes` を書いた行 (#1251)。 知らせの行番号に使う */
138
+ axesPos?: Position;
113
139
  actors: DslActor[];
114
140
  flow: DslStep[];
115
141
  animate?: DslAnimate;
142
+ /**
143
+ * 他の値から自動で決まる値 (`values:`)。 時間を持たず、 参照した値が動けば常に追随する。
144
+ *
145
+ * `states` (初期値だけを持つ) と `animation` (いつ何を動かすか) の間に置く層で、
146
+ * 値どうしの関係を書く場所。 書かなければ今までと同じ挙動。
147
+ */
148
+ values?: DslValue[];
116
149
  /** v0.5+ 拡張 ... viewport / lanes / groups */
117
150
  viewport?: DslViewport;
118
151
  lanes?: Record<string, DslLane>;
@@ -124,6 +157,17 @@ type DslDocument = {
124
157
  layout?: LayoutMode;
125
158
  pos: Position;
126
159
  };
160
+ /** 2 軸で仕分ける図の軸の名前 (#1251) */
161
+ type DslAxes = {
162
+ x?: {
163
+ left?: string;
164
+ right?: string;
165
+ };
166
+ y?: {
167
+ bottom?: string;
168
+ top?: string;
169
+ };
170
+ };
127
171
  /** 登場人物 (v0.5+ ... inline option 拡張) */
128
172
  type DslActor = {
129
173
  name: string;
@@ -142,6 +186,35 @@ type DslActor = {
142
186
  eyebrow?: string;
143
187
  value?: string;
144
188
  rows?: string[];
189
+ /**
190
+ * 工程の並び (`type: gantt`) で、その工程の担当 (#1251)。
191
+ *
192
+ * 他の図種では相手が無いため、書かれていたら組み立て側が知らせる。
193
+ */
194
+ owner?: string;
195
+ /**
196
+ * 工程の並び (`type: gantt`) で、その工程が終わる時期 (#1251)。
197
+ *
198
+ * 書かなければ始まりと同じ時期に終わる (帯が 1 コマ)。 `{名前}` を書くと状態から取り、
199
+ * 段で帯が伸び縮みする様子を見せられる。
200
+ *
201
+ * 他の図種では相手が無いため、書かれていたら組み立て側が知らせる。
202
+ */
203
+ end?: string;
204
+ /**
205
+ * 体験の道筋 (`type: journey`) で、その段階が起きる場所 (#1251)。
206
+ *
207
+ * 「どこで起きたか」 を段の下に出す。 他の図種では相手が無いため、書かれていたら
208
+ * 組み立て側が知らせる。
209
+ */
210
+ touchpoint?: string;
211
+ /**
212
+ * 体験の道筋 (`type: journey`) で、その段階の改善の余地 (#1251)。
213
+ *
214
+ * 気持ちが落ちる段に「何を直せるか」 を添える。 他の図種では相手が無いため、
215
+ * 書かれていたら組み立て側が知らせる。
216
+ */
217
+ opportunity?: string;
145
218
  lane?: string;
146
219
  stack?: number;
147
220
  initial?: boolean;
@@ -246,6 +319,8 @@ type DslStep = {
246
319
  cardinality?: string;
247
320
  labelOffsetX?: number;
248
321
  labelOffsetY?: number;
322
+ /** true で説明文を矢印の線の上に重ねる。 分岐図の条件ラベル用。 */
323
+ overlay?: boolean;
249
324
  /**
250
325
  * canvas pivot (CAR-1693 Phase 1) DSL 表面 `pos: {x, y}` 由来の layout offset。 step の edge
251
326
  * label 位置を auto layout compute から (dx, dy) shift する。 未指定は auto、 set 済は Phase 2 で適用。
@@ -310,6 +385,51 @@ type DslState = {
310
385
  initial: number | string;
311
386
  pos: Position;
312
387
  };
388
+ /**
389
+ * 値が動き出すきっかけ (#1161 段 2)。
390
+ *
391
+ * `step` は段が始まった時、 `reaches` は別の値が境目を越えた時。 どちらも「成り立った瞬間の
392
+ * 出来事」 で、 常に成り立つ関係を表す式とは別物 (spec § 2.3)。
393
+ */
394
+ type DslValueTrigger = {
395
+ kind: "step";
396
+ step: string;
397
+ } | {
398
+ kind: "reaches";
399
+ /** 見張る相手の値の名前 */
400
+ source: string;
401
+ op: ">=" | ">" | "<=" | "<" | "==" | "!=";
402
+ threshold: number;
403
+ };
404
+ /**
405
+ * 記法の `values:` の 1 件。 形は 2 つある。
406
+ *
407
+ * | 形 | 持つもの | 意味 |
408
+ * |---|---|---|
409
+ * | 式 | `expression` | 常に成り立つ関係。 時間を持たない |
410
+ * | きっかけ | `trigger` / `to` / `durationMs` | きっかけから `to` まで動く。 時間を持つ |
411
+ *
412
+ * 両方を持つ形は無い (parser が弾く)。 きっかけ形は組み立ての時点で段の時計を読む式へ畳まれる
413
+ * ため、 図に載る時にはどちらも `derived` になる。
414
+ */
415
+ type DslValue = {
416
+ name: string;
417
+ pos: Position;
418
+ } & ({
419
+ /** 式そのもの。 評価は描画側が毎 frame 行う */
420
+ expression: string;
421
+ trigger?: never;
422
+ to?: never;
423
+ durationMs?: never;
424
+ } | {
425
+ expression?: never;
426
+ /** 動き出すきっかけ */
427
+ trigger: DslValueTrigger;
428
+ /** 動いた先の値 */
429
+ to: number;
430
+ /** 動く長さ (ms) */
431
+ durationMs: number;
432
+ });
313
433
  /** ステップ (phase) */
314
434
  type DslPhase = {
315
435
  name: string;
@@ -319,6 +439,25 @@ type DslPhase = {
319
439
  sets?: DslSet[];
320
440
  body?: string;
321
441
  badge?: string;
442
+ /**
443
+ * その段で左の起点から描くもの (`draw: line`、 #1312)。
444
+ *
445
+ * 受ける語は今のところ `line` だけ。 折れ線 (`type: line`) の図で、その段の間に線が
446
+ * 左端から右へ伸び、点と値の数字は線の先が届いた時に現れる。
447
+ *
448
+ * **最上位ではなく段に置く**。 記法は動き (`tween` / `set` / `focus` / `badge`) を段に、
449
+ * 静的な性質 (`eyebrow` / `axes`) を最上位に書く分け方を既に持つ。 線が伸びるのは動き。
450
+ *
451
+ * 相手の名前は書かせない = 折れ線は図全体を 1 箱で描くため相手が 1 つに決まる。
452
+ */
453
+ draw?: string;
454
+ /**
455
+ * `draw` を書いた行 (#1312)。 知らせの行番号に使う。
456
+ *
457
+ * 段の `pos` は `- step:` の行を指すため、そこを使うと「段の 3 行目に書いた `draw` が
458
+ * 効かない」 を段の先頭行として知らせることになる。
459
+ */
460
+ drawPos?: Position;
322
461
  pos: Position;
323
462
  };
324
463
  /** state lerp (遷移) */
@@ -397,7 +536,7 @@ interface CompileToCdlOpts {
397
536
  }
398
537
  /** 図は出せるが書いた通りにならなかった、 という知らせ。 */
399
538
  type CompileNotice = {
400
- kind: "relative-position-ignored" | "focus-target-missing" | "state-override-rejected" | "external-paint-dropped" | "part-not-drawn" | "scale-reserved";
539
+ kind: "relative-position-ignored" | "focus-target-missing" | "state-override-rejected" | "external-paint-dropped" | "part-not-drawn" | "scale-reserved" | "chart-value-unreadable" | "chart-edge-dropped" | "value-shadows-state" | "value-unresolved" | "value-duplicate" | "flow-actor-missing" | "value-trigger-unresolved" | "flow-self-loop" | "lane-not-honored" | "lane-declared-empty" | "eyebrow-not-honored" | "flow-endpoint-not-honored" | "draw-not-honored" | "draw-target-mismatch";
401
540
  /** 対象の名前。 光らせる相手なら書かれた指定そのまま */
402
541
  actor: string;
403
542
  /** 書かれていた行 */
@@ -639,6 +778,14 @@ type V05ParseResult = {
639
778
  ok: false;
640
779
  errors: DslError[];
641
780
  };
781
+ /**
782
+ * 記法が受ける top-level の項目 (#1190)。
783
+ *
784
+ * 読めない行の案内と、記法一覧が全て載せているかの検査が、どちらもここを見る。 一覧に手で
785
+ * 書くと、項目を足した時に案内か一覧のどちらかが取り残される (実際に `states` / `values` が
786
+ * 一覧に 1 件も無い状態で放置されていた)。
787
+ */
788
+ declare const TOP_LEVEL_KEYS: readonly ["title", "type", "actors", "flow", "states", "values", "animation", "viewport", "lanes", "groups", "eyebrow", "axes"];
642
789
  /** 受け付ける図種。 記法一覧はここを見る。 */
643
790
  declare const PRESET_TYPES: ReadonlySet<PresetType>;
644
791
  /**
@@ -663,6 +810,25 @@ declare function parseTextDslV05(src: string): V05ParseResult;
663
810
  * 画面側も同じ関数を使う (#1028) = 別々に持つと、片方だけが読める本文ができる。
664
811
  */
665
812
  declare function stripQuotes(s: string): string;
813
+ /**
814
+ * `draw:` に書ける語と、その語が効く図種 (#1312 / #1314)。
815
+ *
816
+ * **語と図種の対応をここ 1 箇所で持つ**。 受ける語の一覧 (`DRAW_WORDS`) も、組み立て側が見る
817
+ * 図種の一覧 (`DRAWABLE_DOC_TYPES`) も、この表から導く。 3 つを別々に並べると、語を足した時に
818
+ * どれかが古いまま残る (#1310 / #1304 で 3 度直した形)。
819
+ *
820
+ * | 語 | 図種 | 起点 |
821
+ * |---|---|---|
822
+ * | `line` | `line` | 左端から右へ線が伸びる |
823
+ * | `bar` | `bar` | 横軸から上へ棒が伸びる |
824
+ * | `pie` | `pie` | 12 時から時計回りに扇が開く |
825
+ *
826
+ * いまは語と図種が同じ綴りだが、**同じものとして扱わない**。 語は書き手が書く名前で、
827
+ * 図種は `type:` が取る値。 片方だけ別名を足したくなった時に、対応が表に残っている形にする。
828
+ */
829
+ declare const DRAW_TARGETS: ReadonlyMap<string, PresetType>;
830
+ /** `draw:` に書ける語。 表から導く (#1314) */
831
+ declare const DRAW_WORDS: ReadonlySet<string>;
666
832
 
667
833
  /**
668
834
  * Text DSL i18n キーワード一覧
@@ -866,6 +1032,45 @@ type StrippedPaint = {
866
1032
  */
867
1033
  declare function stripExternalPaint(diagram: unknown): StrippedPaint[];
868
1034
 
1035
+ /** 分解した部分の種類 (#1310) */
1036
+ type トークンの種類 = "項目名" | "説明文" | "矢印" | "色名" | "値の参照" | "注記";
1037
+ /** 分解した部分 1 つ。 位置は本文の先頭からの文字数 (`slice` にそのまま渡せる) */
1038
+ type トークン = {
1039
+ 種類: トークンの種類;
1040
+ 開始: number;
1041
+ 終わり: number;
1042
+ /** `色名` の時だけ入る、解決後の色の名前。 画面はこれで「その色」 を引く */
1043
+ 色?: Tone;
1044
+ };
1045
+ /**
1046
+ * 記法を分解する (#1310)。
1047
+ *
1048
+ * 行ごとに見る。 記法は行単位で意味が決まるため、行をまたぐ状態を持たない。
1049
+ */
1050
+ declare function 記法を分解する(src: string): トークン[];
1051
+ /**
1052
+ * JSON を分解する (#1310)。
1053
+ *
1054
+ * 記法と違い鍵は英語で、記法の語彙は出ない。 したがって **鍵 / 文字列 / 数を汎用の色で塗る**。
1055
+ *
1056
+ * 例外は `tone` と `color` の値で、こちらは記法と同じ語彙を持つため色名として扱う。
1057
+ * 同じ `"success"` が入口によって別の色になる状態を作らないため。
1058
+ */
1059
+ declare function JSONを分解する(src: string): トークン[];
1060
+ /**
1061
+ * 分解した並びを、本文を覆う区間の列に広げる (#1310)。
1062
+ *
1063
+ * 分解器は色が付く部分だけを返すため、間の文字が抜ける。 画面はそのまま並べると本文が
1064
+ * 欠けるので、**色の付かない部分も種類なしの区間として挟む**。
1065
+ *
1066
+ * 返す区間は本文を過不足なく覆う (連結すると元の本文に戻る)。
1067
+ */
1068
+ declare function 区間に広げる(src: string, tokens: トークン[]): Array<{
1069
+ 文字: string;
1070
+ 種類?: トークンの種類;
1071
+ 色?: Tone;
1072
+ }>;
1073
+
869
1074
  /**
870
1075
  * 図を組み立てる前に、 大きすぎる入力を止める (#1005)。
871
1076
  *
@@ -911,6 +1116,9 @@ interface InputSize {
911
1116
  * **段の中身 (光らせる相手 / 遷移 / 即時変更) も数える**。 段の数だけを見ると、
912
1117
  * 1 段に 1,000 件の相手を書いた形が 1 件として通る。 実測ではこの形が組み立ての中で
913
1118
  * 約 100 万件に展開され、 呼び出しの深さが上限を超えて落ちた。
1119
+ *
1120
+ * **他の値から決まる値 (`values:`) も数える** (#1162)。 これらは毎 frame 解かれるので、
1121
+ * 数に入れないと上限をすり抜けた本文が描画のたびに重さを持つ。
914
1122
  */
915
1123
  declare function countDocElements(doc: DslDocument): number;
916
1124
  /**
@@ -933,6 +1141,7 @@ declare function countDiagramElements(diagram: {
933
1141
  formulas?: unknown[];
934
1142
  scrollTriggers?: unknown[];
935
1143
  eventBindings?: unknown[];
1144
+ derived?: unknown[];
936
1145
  }): number;
937
1146
  /** 本文の大きさを byte で数える (文字数ではなく実際の大きさ) */
938
1147
  declare function countBytes(src: string): number;
@@ -981,10 +1190,44 @@ interface DragonJson {
981
1190
  title: string;
982
1191
  /** preset type (必須): sequence / flow / swimlane / er / state / topology / solidity / gantt / class / pie / c4 / mind */
983
1192
  type: PresetType;
1193
+ /**
1194
+ * 図表の箱の上に出す小見出し (optional)。 記法の最上位 `eyebrow:` と同じ (#1247)。
1195
+ *
1196
+ * 効くのは図全体を 1 箱にする図種 (`pie` / `bar` / `line` / `funnel` / `tree` / `journey` /
1197
+ * `quadrant` / `mind` / `gantt`) だけ。 箱ごとに分かれる図種では相手が決まらないため、
1198
+ * 組み立て側が知らせを出す。 そちらは `actors[].eyebrow` に書く。
1199
+ */
1200
+ eyebrow?: string;
1201
+ /**
1202
+ * 2 軸で仕分ける図 (`type: quadrant`) の軸の名前 (#1294)。 記法の `axes:` と同じ。
1203
+ *
1204
+ * 書かないと「小さい / 大きい」 のままになり、何を判断する図か読めない。 区画の名前
1205
+ * (`右上` 等) は軸の名前から決まる。
1206
+ *
1207
+ * 他の図種には軸が無いため、書かれていたら組み立て側が知らせる。
1208
+ */
1209
+ axes?: JsonAxes;
984
1210
  /** 登場人物 (必須): 文字列 or { name, kind, ... } object */
985
1211
  actors: (string | JsonActor)[];
986
1212
  /** flow step 配列 (必須): { from, to, label, ... } */
987
1213
  flow: JsonStep[];
1214
+ /**
1215
+ * 状態の初期値 (optional)。 記法の `states:` と同じ (#1181)。
1216
+ *
1217
+ * `{名前}` を箱の文字に置くと、ここに書いた値が描画側で置き換わる。 名前は英数字と `_`
1218
+ * だけ (描画側が置き換える時に見る範囲と揃える)。
1219
+ *
1220
+ * ここに書けるのは初期値まで。 段で動かすのは `animation[].tween` / `animation[].set`
1221
+ * (`#1186` で追加、記法の `tween:` / `set:` と同じ)。
1222
+ */
1223
+ states?: Record<string, number | string>;
1224
+ /**
1225
+ * 他の値から自動で決まる値 (optional)。 記法の `values:` と同じ (#1181)。
1226
+ *
1227
+ * 式には四則 (`+ - * /`) と括弧、比較 (`> >= < <= == !=`)、`min` / `max` が書ける。
1228
+ * 他の値は `{名前}` で読む。 解くのは描画側で、毎 frame 参照から順に決まる。
1229
+ */
1230
+ values?: Record<string, string>;
988
1231
  /** animation phase 配列 (optional) */
989
1232
  animation?: JsonPhase[];
990
1233
  /** viewport (optional): 全体 canvas size / gap */
@@ -1015,11 +1258,6 @@ interface DragonJson {
1015
1258
  label?: string;
1016
1259
  lanes: string[];
1017
1260
  }>;
1018
- /**
1019
- * canvas pivot (CAR-1693 Phase 1) diagram-level layout mode。 "auto" (default) は catalog 100+
1020
- * backward compat、 "manual" は Phase 4 で drag → pos: 保存の完全 manual mode として使う予定。
1021
- */
1022
- layout?: LayoutMode;
1023
1261
  }
1024
1262
  interface JsonActor {
1025
1263
  name: string;
@@ -1049,20 +1287,103 @@ interface JsonActor {
1049
1287
  * LLM JSON DSL では nested 明示 = `{ "state": { "v": 50 } }` が natural、 human 側の
1050
1288
  * inline 拡散 pattern (`- arc1: { kind: arc-gauge, v: 50 }`) とは記述形式が分岐する
1051
1289
  * (spec § 2.3 分岐設計、 human = YAML 手書き最適 / LLM = JSON structured 最適)。
1290
+ *
1291
+ * 見本でない箱に書くと誤りとして返す (#1294)。 記法側は読めない項目名として行番号付きで
1292
+ * 知らせるため、黙って捨てると入口によって扱いが変わる。
1052
1293
  */
1053
1294
  state?: Record<string, number | string | boolean>;
1295
+ /**
1296
+ * 箱の色 (#1294)。 記法の `tone:` と同じ。
1297
+ *
1298
+ * 色の名前と別名 (`成功` / `success` 等) を受ける。 見本 (parts) では色ではなく状態の
1299
+ * 上書きとして意味を持つため、記法と同じく見本の箱には効かない。
1300
+ */
1301
+ tone?: Tone | (string & {});
1302
+ /**
1303
+ * 色番号または色の名前 (#1294)。 記法の `色:` / `color:` と同じ。
1304
+ *
1305
+ * `#` で始まる値は色番号として `colorHex` に入り、見本の絵の色を変える。 それ以外は
1306
+ * 色の名前として読む (記法の `splitColorValue` と同じ振り分け)。
1307
+ */
1308
+ color?: string;
1309
+ /**
1310
+ * 工程の並び (`type: gantt`) で、その工程の担当 (#1294)。 記法の `owner:` と同じ。
1311
+ */
1312
+ owner?: string;
1313
+ /**
1314
+ * 工程の並び (`type: gantt`) で、その工程が終わる時期 (#1294)。 記法の `end:` と同じ。
1315
+ *
1316
+ * 値は他の工程が書いた時期のどれかに一致させる。 一致しない値は始まりと同じ位置に落ちる
1317
+ * (記法側と同じ扱い)。
1318
+ */
1319
+ end?: string;
1320
+ /**
1321
+ * 体験の道筋 (`type: journey`) で、その段階が起きる場所 (#1294)。 記法の `touchpoint:` と同じ。
1322
+ */
1323
+ touchpoint?: string;
1324
+ /**
1325
+ * 体験の道筋 (`type: journey`) で、その段階の改善の余地 (#1294)。 記法の `opportunity:` と同じ。
1326
+ */
1327
+ opportunity?: string;
1328
+ /**
1329
+ * 箱を置く絶対座標と大きさ (#1294)。 記法の `posX:` / `posY:` / `posW:` / `posH:` と同じ。
1330
+ *
1331
+ * `pos` (ずらし幅) とは別物。 こちらは auto layout を使わずに位置そのものを決める。
1332
+ */
1333
+ posX?: number;
1334
+ posY?: number;
1335
+ posW?: number;
1336
+ posH?: number;
1337
+ /**
1338
+ * 箱の中の要素ごとに位置と大きさを固定する (#1294)。 記法の `nodes:` と同じ。
1339
+ *
1340
+ * key は箱が作る要素の名前 (`header` / `footer` / `spacer` / `s0` 等)。
1341
+ */
1342
+ nodes?: Record<string, JsonActorNodeOverride>;
1343
+ /**
1344
+ * 見本を何倍で描くか (#1294)。 記法の `scale:` / `倍率:` と同じ。
1345
+ *
1346
+ * 見本 (parts) にしか効かない。 見本でない箱に書くと誤りとして返す (記法側も同じく
1347
+ * 読めない項目名として知らせる)。
1348
+ */
1349
+ scale?: number;
1350
+ }
1351
+ /** 2 軸で仕分ける図の軸の名前 (#1294)。 記法の `axes:` と同じ形 */
1352
+ interface JsonAxes {
1353
+ x?: {
1354
+ left?: string;
1355
+ right?: string;
1356
+ };
1357
+ y?: {
1358
+ bottom?: string;
1359
+ top?: string;
1360
+ };
1361
+ }
1362
+ /** 箱の中の要素 1 つ分の位置と大きさ (#1294)。 記法の `nodes: { header: { ... } }` と同じ */
1363
+ interface JsonActorNodeOverride {
1364
+ posX?: number;
1365
+ posY?: number;
1366
+ posW?: number;
1367
+ posH?: number;
1054
1368
  }
1055
1369
  interface JsonStep {
1056
1370
  from: string;
1057
1371
  to: string;
1058
1372
  label: string;
1059
1373
  sub?: string;
1060
- tone?: Tone;
1374
+ /**
1375
+ * 矢印の色 (#1304)。 記法の `(成功)` と同じく別名 (`成功` / `neutral` 等) も受ける。
1376
+ *
1377
+ * `string & {}` は箱の `tone` と同じ idiom = 正規の色名を補完に出しつつ別名も通す。
1378
+ */
1379
+ tone?: Tone | (string & {});
1061
1380
  style?: EdgeStyle;
1062
1381
  guard?: string;
1063
1382
  cardinality?: string;
1064
1383
  labelOffsetX?: number;
1065
1384
  labelOffsetY?: number;
1385
+ /** true で説明文を矢印の線の上に重ねる。 分岐図の条件ラベル用。 */
1386
+ overlay?: boolean;
1066
1387
  /**
1067
1388
  * canvas pivot (CAR-1693 Phase 1) DSL 表面 `pos: {x, y}` = edge label offset。 未指定は
1068
1389
  * backward compat、 set 済は Phase 2 の applyPosOffset で edge label 位置を shift する。
@@ -1080,6 +1401,26 @@ interface JsonPhase {
1080
1401
  body?: string;
1081
1402
  /** badge label */
1082
1403
  badge?: string;
1404
+ /**
1405
+ * その段で左の起点から描くもの (#1312)。 記法の `draw: line` と同じ。
1406
+ *
1407
+ * 受ける語は `line` だけ (`DRAW_WORDS`)。 折れ線の図で、その段の間に線が左端から
1408
+ * 右へ伸びる。
1409
+ */
1410
+ draw?: string;
1411
+ /**
1412
+ * 段の中で値を動かす (#1186)。 記法の `tween: name 100 -> 90` と同じ。
1413
+ *
1414
+ * 足すまで JSON の入口は `states:` で初期値を書けても **動かす手段が無かった** ため、
1415
+ * 同じ図を記法で書くと動き JSON で書くと静止する状態だった (#1181 で状態を足した時の残り)。
1416
+ */
1417
+ tween?: Record<string, readonly [number, number]>;
1418
+ /**
1419
+ * 段の切替で値を差し替える (#1186)。 記法の `set: name value` と同じ。
1420
+ *
1421
+ * `tween` が段の中を補間するのに対し、こちらは段の切替時に 1 度だけ変える。
1422
+ */
1423
+ set?: Record<string, number | string>;
1083
1424
  }
1084
1425
  /**
1085
1426
  * JSON DSL error。 line 概念がないため、 field path (JSON pointer style) で位置を示す。
@@ -1112,6 +1453,7 @@ interface JsonDslError {
1112
1453
  */
1113
1454
  declare function jsonToDiagram(json: unknown, opts?: {
1114
1455
  partsCatalog?: Record<string, CdlDiagram>;
1456
+ onNotice?: CompileToCdlOpts["onNotice"];
1115
1457
  }): CdlDiagram;
1116
1458
  /**
1117
1459
  * JSON DSL を validate だけ実施 (compile しない)。 error 詳細を配列で取得したい場合に使う。
@@ -1164,6 +1506,41 @@ declare const diagramJsonSchema: {
1164
1506
  enum: string[];
1165
1507
  description: string;
1166
1508
  };
1509
+ eyebrow: {
1510
+ type: string;
1511
+ description: string;
1512
+ };
1513
+ axes: {
1514
+ type: string;
1515
+ additionalProperties: boolean;
1516
+ description: string;
1517
+ properties: {
1518
+ x: {
1519
+ type: string;
1520
+ additionalProperties: boolean;
1521
+ properties: {
1522
+ left: {
1523
+ type: string;
1524
+ };
1525
+ right: {
1526
+ type: string;
1527
+ };
1528
+ };
1529
+ };
1530
+ y: {
1531
+ type: string;
1532
+ additionalProperties: boolean;
1533
+ properties: {
1534
+ bottom: {
1535
+ type: string;
1536
+ };
1537
+ top: {
1538
+ type: string;
1539
+ };
1540
+ };
1541
+ };
1542
+ };
1543
+ };
1167
1544
  actors: {
1168
1545
  type: string;
1169
1546
  minItems: number;
@@ -1225,6 +1602,101 @@ declare const diagramJsonSchema: {
1225
1602
  type: string;
1226
1603
  description: string;
1227
1604
  };
1605
+ state: {
1606
+ type: string;
1607
+ description: string;
1608
+ additionalProperties: {
1609
+ type: string[];
1610
+ };
1611
+ };
1612
+ tone: {
1613
+ type: string;
1614
+ description: string;
1615
+ enum: string[];
1616
+ };
1617
+ color: {
1618
+ type: string;
1619
+ description: string;
1620
+ anyOf: ({
1621
+ enum: string[];
1622
+ pattern?: undefined;
1623
+ } | {
1624
+ pattern: string;
1625
+ enum?: undefined;
1626
+ })[];
1627
+ };
1628
+ owner: {
1629
+ type: string;
1630
+ description: string;
1631
+ };
1632
+ end: {
1633
+ type: string;
1634
+ description: string;
1635
+ };
1636
+ touchpoint: {
1637
+ type: string;
1638
+ description: string;
1639
+ };
1640
+ opportunity: {
1641
+ type: string;
1642
+ description: string;
1643
+ };
1644
+ posX: {
1645
+ type: string;
1646
+ description: string;
1647
+ };
1648
+ posY: {
1649
+ type: string;
1650
+ description: string;
1651
+ };
1652
+ posW: {
1653
+ type: string;
1654
+ description: string;
1655
+ };
1656
+ posH: {
1657
+ type: string;
1658
+ description: string;
1659
+ };
1660
+ nodes: {
1661
+ type: string;
1662
+ description: string;
1663
+ additionalProperties: {
1664
+ type: string;
1665
+ additionalProperties: boolean;
1666
+ properties: {
1667
+ posX: {
1668
+ type: string;
1669
+ };
1670
+ posY: {
1671
+ type: string;
1672
+ };
1673
+ posW: {
1674
+ type: string;
1675
+ };
1676
+ posH: {
1677
+ type: string;
1678
+ };
1679
+ };
1680
+ };
1681
+ };
1682
+ scale: {
1683
+ type: string;
1684
+ description: string;
1685
+ };
1686
+ pos: {
1687
+ type: string;
1688
+ additionalProperties: boolean;
1689
+ description: string;
1690
+ required: string[];
1691
+ properties: {
1692
+ x: {
1693
+ type: string;
1694
+ };
1695
+ y: {
1696
+ type: string;
1697
+ };
1698
+ };
1699
+ };
1228
1700
  };
1229
1701
  description?: undefined;
1230
1702
  })[];
@@ -1280,9 +1752,58 @@ declare const diagramJsonSchema: {
1280
1752
  type: string;
1281
1753
  description: string;
1282
1754
  };
1755
+ overlay: {
1756
+ type: string;
1757
+ description: string;
1758
+ };
1759
+ pos: {
1760
+ type: string;
1761
+ additionalProperties: boolean;
1762
+ description: string;
1763
+ required: string[];
1764
+ properties: {
1765
+ x: {
1766
+ type: string;
1767
+ };
1768
+ y: {
1769
+ type: string;
1770
+ };
1771
+ };
1772
+ };
1283
1773
  };
1284
1774
  };
1285
1775
  };
1776
+ states: {
1777
+ type: string;
1778
+ description: string;
1779
+ additionalProperties: boolean;
1780
+ patternProperties: {
1781
+ "^[a-zA-Z_][a-zA-Z0-9_]*$": {
1782
+ type: string[];
1783
+ description: string;
1784
+ };
1785
+ };
1786
+ examples: {
1787
+ inflow: number;
1788
+ done: number;
1789
+ }[];
1790
+ };
1791
+ values: {
1792
+ type: string;
1793
+ description: string;
1794
+ additionalProperties: boolean;
1795
+ patternProperties: {
1796
+ "^[a-zA-Z_][a-zA-Z0-9_]*$": {
1797
+ type: string;
1798
+ minLength: number;
1799
+ description: string;
1800
+ };
1801
+ };
1802
+ examples: {
1803
+ waiting: string;
1804
+ busy: string;
1805
+ }[];
1806
+ };
1286
1807
  animation: {
1287
1808
  type: string;
1288
1809
  description: string;
@@ -1316,6 +1837,36 @@ declare const diagramJsonSchema: {
1316
1837
  type: string;
1317
1838
  description: string;
1318
1839
  };
1840
+ draw: {
1841
+ type: string;
1842
+ enum: string[];
1843
+ description: string;
1844
+ };
1845
+ tween: {
1846
+ type: string;
1847
+ description: string;
1848
+ additionalProperties: boolean;
1849
+ patternProperties: {
1850
+ "^[a-zA-Z_][a-zA-Z0-9_]*$": {
1851
+ type: string;
1852
+ items: {
1853
+ type: string;
1854
+ };
1855
+ minItems: number;
1856
+ maxItems: number;
1857
+ };
1858
+ };
1859
+ };
1860
+ set: {
1861
+ type: string;
1862
+ description: string;
1863
+ additionalProperties: boolean;
1864
+ patternProperties: {
1865
+ "^[a-zA-Z_][a-zA-Z0-9_]*$": {
1866
+ type: string[];
1867
+ };
1868
+ };
1869
+ };
1319
1870
  };
1320
1871
  };
1321
1872
  };
@@ -1352,6 +1903,10 @@ declare const diagramJsonSchema: {
1352
1903
  type: string;
1353
1904
  minimum: number;
1354
1905
  };
1906
+ scale: {
1907
+ type: string;
1908
+ description: string;
1909
+ };
1355
1910
  };
1356
1911
  };
1357
1912
  lanes: {
@@ -1377,6 +1932,20 @@ declare const diagramJsonSchema: {
1377
1932
  lifeline: {
1378
1933
  type: string;
1379
1934
  };
1935
+ pos: {
1936
+ type: string;
1937
+ additionalProperties: boolean;
1938
+ description: string;
1939
+ required: string[];
1940
+ properties: {
1941
+ x: {
1942
+ type: string;
1943
+ };
1944
+ y: {
1945
+ type: string;
1946
+ };
1947
+ };
1948
+ };
1380
1949
  };
1381
1950
  };
1382
1951
  };
@@ -1448,4 +2017,4 @@ interface CompileOpts {
1448
2017
  */
1449
2018
  declare function textDslToDiagram(src: string, opts?: CompileOpts): CdlDiagram;
1450
2019
 
1451
- export { type AnchorBox, type CompileNotice, type CompileOpts, DIAGRAM_BOUNDARY_PADDING, 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 DslViewport, type FocusEntry, type InputSize, type JsonActor, 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, PRESET_TYPES, type PresetType, RELATIVE_GAP_DEFAULT, type RelativeDirection, type RelativePos, TONE_ALIAS, 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, partsGridCenters, pointsOutside, rectsOverlap, resolveRelativePos, stripExternalPaint, stripQuotes, textDslToDiagram, validateDragonJson, writeActorPosition };
2020
+ export { type AnchorBox, type CompileNotice, type CompileOpts, DIAGRAM_BOUNDARY_PADDING, 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 JsonActorNodeOverride, 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, 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, partsGridCenters, pointsOutside, rectsOverlap, resolveRelativePos, stripExternalPaint, stripQuotes, textDslToDiagram, validateDragonJson, writeActorPosition, type トークン, type トークンの種類, 区間に広げる, 記法を分解する };