@cardenelabs/dragon 0.13.0 → 0.15.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
@@ -1,4 +1,136 @@
1
1
  import { CdlDiagram, NodeKind, Tone, EdgeStyle, LaidDiagram } from '@cardenelabs/cdl';
2
+ export { CdlDiagram } from '@cardenelabs/cdl';
3
+
4
+ /**
5
+ * Text DSL v0.5 parser
6
+ *
7
+ * 設計方針:
8
+ * - keyword は英語のみ (title / type / actors / flow / states / animation / step / focus / tween / set / badge)
9
+ * - 値の日本語は quote 必須 (`title: "API call"` / `step: "request" 1.5s`)
10
+ * - YAML 風 + 短縮 keyword + 箇条書き構造
11
+ * - Mermaid 知ってる人にもゼロ学習、 非エンジニアにも直感的
12
+ *
13
+ * syntax 例:
14
+ *
15
+ * title: "API call"
16
+ * type: sequence
17
+ *
18
+ * actors:
19
+ * - Client
20
+ * - API: function
21
+ * - DB
22
+ *
23
+ * flow:
24
+ * - Client -> API: "GET /items"
25
+ * - API -> DB: "SELECT" (success)
26
+ *
27
+ * states:
28
+ * request_count: 0
29
+ * row_count: 0
30
+ *
31
+ * animation:
32
+ * - step: "request" 1.5s
33
+ * focus: [Client, API]
34
+ * tween:
35
+ * request_count: 0 -> 1
36
+ * badge: "request"
37
+ *
38
+ * - step: "query" 1.5s
39
+ * focus: [API, DB]
40
+ * tween:
41
+ * row_count: 0 -> 20
42
+ * badge: "query"
43
+ *
44
+ * 出力は v0.4 と同じ DslDocument。 既存 compile.ts で CdlDiagram に変換できる。
45
+ */
46
+
47
+ type V05ParseResult = {
48
+ ok: true;
49
+ doc: DslDocument;
50
+ } | {
51
+ ok: false;
52
+ errors: DslError[];
53
+ };
54
+ /**
55
+ * 記法が受ける top-level の項目 (#1190)。
56
+ *
57
+ * 読めない行の案内と、記法一覧が全て載せているかの検査が、どちらもここを見る。 一覧に手で
58
+ * 書くと、項目を足した時に案内か一覧のどちらかが取り残される (実際に `states` / `values` が
59
+ * 一覧に 1 件も無い状態で放置されていた)。
60
+ */
61
+ declare const TOP_LEVEL_KEYS: readonly ["title", "type", "actors", "flow", "states", "values", "animation", "viewport", "lanes", "groups", "eyebrow", "axes", "readouts", "inputs", "formulas", "events", "scrolls"];
62
+ /** 受け付ける図種。 記法一覧はここを見る。 */
63
+ declare const PRESET_TYPES: ReadonlySet<PresetType>;
64
+ /**
65
+ * 記法だけが持つ種類。 描画側には無いが、 図種ごとの組み立てで意味を持つ。
66
+ *
67
+ * `contract` / `eoa` / `multisig` / `proxy` / `library` / `interface` は Solidity 図の
68
+ * 役割分けに、 `entity` / `state` は ER 図と状態遷移図に使う。
69
+ *
70
+ * **描画側へ渡す前に必ず読み替える** (`compile.ts` の `描ける種別`)。 読み替えを通さずに渡すと
71
+ * 図の組み立てが落ちる = 描画側は知らない種類の大きさを引けない (#1420 で実測、
72
+ * `Cannot read properties of undefined (reading 'h')`)。
73
+ */
74
+ declare const DSL_ONLY_KINDS: readonly ["entity", "state", "contract", "eoa", "multisig", "proxy", "library", "interface"];
75
+ /** 記法だけが持つ種類。 描画側の `NodeKind` には含まれない */
76
+ type DslOnlyKind = (typeof DSL_ONLY_KINDS)[number];
77
+ /**
78
+ * 受け付ける箱の種類。 描画できる種類 (cdl の `NODE_KINDS`) に、 記法だけが持つ種類を足す。
79
+ *
80
+ * 以前は手書きの 31 種だった。 描画できる 90 種のうち 78 種が記法から書けず、 部品名として
81
+ * 扱われて「そんな部品は無い」 と警告が出るだけだった。 描画側を出所に加えることで
82
+ * 「描画できるものは書ける」 が成立する。
83
+ */
84
+ /**
85
+ * 記法が受理する種類の全体。 これに載っていない種類は見本 (パーツ) の候補になる。
86
+ *
87
+ * 画面側が「本文が見本を使っているか」 を判定するのに使う (#1022)。 手書きの一覧を
88
+ * 別に持つと、種類が増えた時にそちらだけ取り残されて余分な読み込みが起きる。
89
+ */
90
+ declare const NODE_KIND_VALID: ReadonlySet<string>;
91
+ declare function parseTextDslV05(src: string): V05ParseResult;
92
+ /**
93
+ * 対応する引用符だけを外す。
94
+ *
95
+ * 先頭と末尾を別々に外すと、対応しない形 (`'300,200"`) が中身だけ取り出せてしまう。
96
+ * 画面側も同じ関数を使う (#1028) = 別々に持つと、片方だけが読める本文ができる。
97
+ */
98
+ declare function stripQuotes(s: string): string;
99
+ /**
100
+ * 段に書ける項目の英語名。 `parsePhase` が受け付ける名前の入口でも使う。
101
+ *
102
+ * 誤りの案内で使うほか、**見本が値の名前にこの語を使っていないか** を見るのにも使う
103
+ * (#1330)。 段の項目と値は階層が違うので衝突しないが、同じ語が 2 つの意味で並ぶと
104
+ * 見本を読む人が階層から意味を判断することになる。
105
+ */
106
+ declare const PHASE_ITEM_WORDS: readonly ["focus", "badge", "body", "description", "tween", "set", "draw"];
107
+ /**
108
+ * `draw:` に書ける語と、その語が効く図種 (#1312 / #1314)。
109
+ *
110
+ * **語と図種の対応をここ 1 箇所で持つ**。 受ける語の一覧 (`DRAW_WORDS`) も、組み立て側が見る
111
+ * 図種の一覧 (`DRAWABLE_DOC_TYPES`) も、この表から導く。 3 つを別々に並べると、語を足した時に
112
+ * どれかが古いまま残る (#1310 / #1304 で 3 度直した形)。
113
+ *
114
+ * | 語 | 図種 | 起点 |
115
+ * |---|---|---|
116
+ * | `line` | `line` | 左端から右へ線が伸びる |
117
+ * | `bar` | `bar` | 横軸から上へ棒が伸びる |
118
+ * | `pie` | `pie` | 12 時から時計回りに扇が開く |
119
+ * | `journey` | `journey` | 左端から右へ気持ちの線が伸びる |
120
+ * | `mind` | `mind` | 中心から外へ枝が伸びる |
121
+ * | `tree` | `tree` | 根から下へ枝が伸びる |
122
+ * | `gantt` | `gantt` | 各帯の始端から右へ帯が伸びる |
123
+ * | `funnel` | `funnel` | 上端から順に段が積まれる |
124
+ *
125
+ * `quadrant` は入れない。 4 つの区画に項目を置く図で **項目に順序が無く**、起点を決められない
126
+ * (順番を書いた順で決めると、動きが図の意味を持たない)。
127
+ *
128
+ * いまは語と図種が同じ綴りだが、**同じものとして扱わない**。 語は書き手が書く名前で、
129
+ * 図種は `type:` が取る値。 片方だけ別名を足したくなった時に、対応が表に残っている形にする。
130
+ */
131
+ declare const DRAW_TARGETS: ReadonlyMap<string, PresetType>;
132
+ /** `draw:` に書ける語。 表から導く (#1314) */
133
+ declare const DRAW_WORDS: ReadonlySet<string>;
2
134
 
3
135
  /**
4
136
  * 位置を他の要素からの相対で書くための解決。
@@ -82,6 +214,17 @@ declare function orderByDependency(items: ReadonlyArray<{
82
214
  * docs/cdl/text-dsl-spec.md の文法を AST に変換した中間表現
83
215
  */
84
216
 
217
+ /**
218
+ * 記法が書ける箱の種類 (#1420)。
219
+ *
220
+ * 描画できる種類 (`NodeKind`) に、**記法だけが持つ種類** (`contract` / `eoa` など) を足す。
221
+ * 後者は図種ごとの役割分け (`solidity` の縦列の並べ替えなど) に使い、描画側へ渡す手前で
222
+ * `compile.ts` の `描ける種別` が読み替える。
223
+ *
224
+ * `NodeKind` だけに縛っていた間、記法が受ける値を型が表せていなかった。
225
+ */
226
+ type DslNodeKind = NodeKind | DslOnlyKind;
227
+
85
228
  /**
86
229
  * 箱の中に描く図形 (#1374)。 **描画側の型をそのまま使う**。
87
230
  *
@@ -90,6 +233,42 @@ declare function orderByDependency(items: ReadonlyArray<{
90
233
  type DslDynShape = NonNullable<CdlDiagram["nodes"][number]["shape"]>;
91
234
  /** 値を見せる部品 (#1374)。 図形と同じ理由で描画側の型をそのまま使う */
92
235
  type DslReadout = NonNullable<CdlDiagram["readouts"]>[number];
236
+ /** 読む人が動かすつまみ (#1389)。 部品と同じ理由で描画側の型をそのまま使う */
237
+ type DslInput = NonNullable<CdlDiagram["inputs"]>[number];
238
+ /** つまみの値から決まる値 (#1391)。 描画側の型に、知らせ用の記述位置だけを足す。 */
239
+ type DslFormula = NonNullable<CdlDiagram["formulas"]>[number] & {
240
+ pos?: Position;
241
+ };
242
+ /** 巻き上げに応じて進む値 (#1393)。 描画側の型をそのまま使う */
243
+ type DslScrollTrigger = NonNullable<CdlDiagram["scrollTriggers"]>[number];
244
+ /**
245
+ * 押下などの出来事で動く仕掛け (`events:`、 #1393)。
246
+ *
247
+ * **描画側の型をそのまま使わない**。 描画側は相手を識別子で持つ (`{ kind: "node", id }`) が、
248
+ * 記法は識別子を書けず名前で指す。 名前から識別子への読み替えは組み立てが行うため、
249
+ * 記法の段階では「何をどう指したか」 だけを持つ。
250
+ */
251
+ type DslEventBinding = {
252
+ /** 出来事の種類 (`click` / `hover` など、描画側の `CdlEventKind` と同じ語) */
253
+ event: NonNullable<CdlDiagram["eventBindings"]>[number]["event"];
254
+ /** 何を指したか。 名前は記法に書かれたまま持ち、組み立てが識別子へ直す */
255
+ target: {
256
+ kind: "node";
257
+ name: string;
258
+ } | {
259
+ kind: "lane";
260
+ name: string;
261
+ } | {
262
+ kind: "edge";
263
+ from: string;
264
+ to: string;
265
+ } | {
266
+ kind: "diagram";
267
+ };
268
+ /** 呼び出す仕掛けの名前。 実体は画面側が持つ */
269
+ handlerId: string;
270
+ pos: Position;
271
+ };
93
272
  type PresetType = "sequence" | "flow" | "swimlane" | "er" | "state" | "topology" | "solidity" | "gantt" | "class" | "pie" | "bar" | "line" | "funnel" | "tree" | "journey" | "quadrant" | "c4" | "mind";
94
273
  type Position = {
95
274
  line: number;
@@ -164,6 +343,35 @@ type DslDocument = {
164
343
  * 箱ではないので縦列に載らない。 図全体に 1 つの並びとして持つ。
165
344
  */
166
345
  readouts?: DslReadout[];
346
+ /**
347
+ * 読む人が動かすつまみ (`inputs:`、 #1389)。 つまみが握る値は状態と同じ名前で参照できる。
348
+ *
349
+ * 部品と同じく箱ではないので縦列に載らない。 図全体に 1 つの並びとして持つ。
350
+ */
351
+ inputs?: DslInput[];
352
+ /**
353
+ * つまみの値から決まる値 (`formulas:`、 #1391)。
354
+ *
355
+ * **`values:` とは経路が別**。 あちらは段が動かす状態を読んで毎 frame 決まり直す
356
+ * (`derived`) のに対し、こちらはつまみが握る値を読む反応の網に載る (`formulas`)。
357
+ * 描画側がこの 2 つを別の欄として持つため、記法でも別の項目にする。
358
+ *
359
+ * 式は描画側の書き方。 名前は中括弧で囲っても囲わなくてもよい (描画側の parser が
360
+ * どちらも同じ名前として読む)。
361
+ */
362
+ formulas?: DslFormula[];
363
+ /**
364
+ * 押下などの出来事で動く仕掛け (`events:`、 #1393)。
365
+ *
366
+ * 相手は名前で指す。 組み立てが識別子へ直し、指す先が無ければ知らせる。
367
+ */
368
+ events?: DslEventBinding[];
369
+ /**
370
+ * 巻き上げに応じて進む値 (`scrolls:`、 #1393)。
371
+ *
372
+ * 画面を巻き上げた量から 0 から 1 の進み具合を作る。 描画側はこれを値として読む。
373
+ */
374
+ scrolls?: DslScrollTrigger[];
167
375
  /**
168
376
  * canvas pivot (CAR-1693 Phase 1) diagram-level layout mode。 未指定は "auto" default で
169
377
  * catalog 100+ backward compat。 "manual" は Phase 4 で drag → pos: 保存の完全 manual mode。
@@ -185,7 +393,7 @@ type DslAxes = {
185
393
  /** 登場人物 (v0.5+ ... inline option 拡張) */
186
394
  type DslActor = {
187
395
  name: string;
188
- kind: NodeKind;
396
+ kind: DslNodeKind;
189
397
  /**
190
398
  * 著者が種類を書いたか。 書かなかった時 `kind` には既定の `actor` が入るため、
191
399
  * `kind` の値だけでは「書いた `actor`」 と「書かなかった」 を区別できない。
@@ -220,6 +428,29 @@ type DslActor = {
220
428
  * それ以外は真。 値だけを見せる図が、場所を空けるためだけの見えない箱を置くのに使う。
221
429
  */
222
430
  visibleIf?: string;
431
+ /**
432
+ * 箱の幅と高さを値に追随させる (`wBind:` / `hBind:`、 #1392)。
433
+ *
434
+ * 状態の名前を `{名前}` の形で書く。 配置計算は追随前の `posW` / `posH` を使い、
435
+ * 描く時だけ値に合わせて伸び縮みする (矢印の通り道が動かないようにするための分離)。
436
+ */
437
+ wBind?: string;
438
+ hBind?: string;
439
+ /**
440
+ * 箱の濃さ (`opacity:`、 #1392)。 0 から 1 の数か、状態の名前を書く。
441
+ *
442
+ * 書かなければ完全に見える状態になる。 `visibleIf` が出す / 出さないの 2 値なのに対し、
443
+ * こちらは途中の濃さを持てる。
444
+ */
445
+ opacity?: number | string;
446
+ /**
447
+ * 描く時だけ箱をずらす量 (`renderOffsetX:` / `renderOffsetY:`、 #1392)。
448
+ *
449
+ * 配置計算と矢印はずらす前の位置を使うため、円周上に並べて見せる等の見た目専用。
450
+ * 数か、状態の名前を書く。
451
+ */
452
+ renderOffsetX?: number | string;
453
+ renderOffsetY?: number | string;
223
454
  /**
224
455
  * 工程の並び (`type: gantt`) で、その工程の担当 (#1251)。
225
456
  *
@@ -351,6 +582,15 @@ type DslStep = {
351
582
  /** v0.5+ inline option */
352
583
  guard?: string;
353
584
  cardinality?: string;
585
+ /**
586
+ * 矢印を値に追随させる欄 (`widthBind:` / `strokeBind:` / `dashOffsetBind:`、 #1396)。
587
+ *
588
+ * 箱の `wBind` (#1392) と同じ形で、状態やつまみの名前を `{名前}` で書く。
589
+ * 太さ / 色 / 破線の位置がその値に合わせて動く。 通り道そのものは動かない。
590
+ */
591
+ widthBind?: string;
592
+ strokeBind?: string;
593
+ dashOffsetBind?: string;
354
594
  /** 矢印がどの辺から出るか (#1385)。 書かなければ描画側が自動で選ぶ */
355
595
  side?: "top" | "right" | "bottom" | "left";
356
596
  labelOffsetX?: number;
@@ -572,7 +812,7 @@ interface CompileToCdlOpts {
572
812
  }
573
813
  /** 図は出せるが書いた通りにならなかった、 という知らせ。 */
574
814
  type CompileNotice = {
575
- 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";
815
+ 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" | "formula-unresolved" | "event-target-missing";
576
816
  /** 対象の名前。 光らせる相手なら書かれた指定そのまま */
577
817
  actor: string;
578
818
  /** 書かれていた行 */
@@ -764,124 +1004,6 @@ declare function partsGridCenters(baseNodeCount: number, items: ReadonlyArray<{
764
1004
  cy: number;
765
1005
  }>;
766
1006
 
767
- /**
768
- * Text DSL v0.5 parser
769
- *
770
- * 設計方針:
771
- * - keyword は英語のみ (title / type / actors / flow / states / animation / step / focus / tween / set / badge)
772
- * - 値の日本語は quote 必須 (`title: "API call"` / `step: "request" 1.5s`)
773
- * - YAML 風 + 短縮 keyword + 箇条書き構造
774
- * - Mermaid 知ってる人にもゼロ学習、 非エンジニアにも直感的
775
- *
776
- * syntax 例:
777
- *
778
- * title: "API call"
779
- * type: sequence
780
- *
781
- * actors:
782
- * - Client
783
- * - API: function
784
- * - DB
785
- *
786
- * flow:
787
- * - Client -> API: "GET /items"
788
- * - API -> DB: "SELECT" (success)
789
- *
790
- * states:
791
- * request_count: 0
792
- * row_count: 0
793
- *
794
- * animation:
795
- * - step: "request" 1.5s
796
- * focus: [Client, API]
797
- * tween:
798
- * request_count: 0 -> 1
799
- * badge: "request"
800
- *
801
- * - step: "query" 1.5s
802
- * focus: [API, DB]
803
- * tween:
804
- * row_count: 0 -> 20
805
- * badge: "query"
806
- *
807
- * 出力は v0.4 と同じ DslDocument。 既存 compile.ts で CdlDiagram に変換できる。
808
- */
809
-
810
- type V05ParseResult = {
811
- ok: true;
812
- doc: DslDocument;
813
- } | {
814
- ok: false;
815
- errors: DslError[];
816
- };
817
- /**
818
- * 記法が受ける top-level の項目 (#1190)。
819
- *
820
- * 読めない行の案内と、記法一覧が全て載せているかの検査が、どちらもここを見る。 一覧に手で
821
- * 書くと、項目を足した時に案内か一覧のどちらかが取り残される (実際に `states` / `values` が
822
- * 一覧に 1 件も無い状態で放置されていた)。
823
- */
824
- declare const TOP_LEVEL_KEYS: readonly ["title", "type", "actors", "flow", "states", "values", "animation", "viewport", "lanes", "groups", "eyebrow", "axes", "readouts"];
825
- /** 受け付ける図種。 記法一覧はここを見る。 */
826
- declare const PRESET_TYPES: ReadonlySet<PresetType>;
827
- /**
828
- * 受け付ける箱の種類。 描画できる種類 (cdl の `NODE_KINDS`) に、 記法だけが持つ種類を足す。
829
- *
830
- * 以前は手書きの 31 種だった。 描画できる 90 種のうち 78 種が記法から書けず、 部品名として
831
- * 扱われて「そんな部品は無い」 と警告が出るだけだった。 描画側を出所に加えることで
832
- * 「描画できるものは書ける」 が成立する。
833
- */
834
- /**
835
- * 記法が受理する種類の全体。 これに載っていない種類は見本 (パーツ) の候補になる。
836
- *
837
- * 画面側が「本文が見本を使っているか」 を判定するのに使う (#1022)。 手書きの一覧を
838
- * 別に持つと、種類が増えた時にそちらだけ取り残されて余分な読み込みが起きる。
839
- */
840
- declare const NODE_KIND_VALID: ReadonlySet<string>;
841
- declare function parseTextDslV05(src: string): V05ParseResult;
842
- /**
843
- * 対応する引用符だけを外す。
844
- *
845
- * 先頭と末尾を別々に外すと、対応しない形 (`'300,200"`) が中身だけ取り出せてしまう。
846
- * 画面側も同じ関数を使う (#1028) = 別々に持つと、片方だけが読める本文ができる。
847
- */
848
- declare function stripQuotes(s: string): string;
849
- /**
850
- * 段に書ける項目の英語名。 `parsePhase` が受け付ける名前の入口でも使う。
851
- *
852
- * 誤りの案内で使うほか、**見本が値の名前にこの語を使っていないか** を見るのにも使う
853
- * (#1330)。 段の項目と値は階層が違うので衝突しないが、同じ語が 2 つの意味で並ぶと
854
- * 見本を読む人が階層から意味を判断することになる。
855
- */
856
- declare const PHASE_ITEM_WORDS: readonly ["focus", "badge", "body", "description", "tween", "set", "draw"];
857
- /**
858
- * `draw:` に書ける語と、その語が効く図種 (#1312 / #1314)。
859
- *
860
- * **語と図種の対応をここ 1 箇所で持つ**。 受ける語の一覧 (`DRAW_WORDS`) も、組み立て側が見る
861
- * 図種の一覧 (`DRAWABLE_DOC_TYPES`) も、この表から導く。 3 つを別々に並べると、語を足した時に
862
- * どれかが古いまま残る (#1310 / #1304 で 3 度直した形)。
863
- *
864
- * | 語 | 図種 | 起点 |
865
- * |---|---|---|
866
- * | `line` | `line` | 左端から右へ線が伸びる |
867
- * | `bar` | `bar` | 横軸から上へ棒が伸びる |
868
- * | `pie` | `pie` | 12 時から時計回りに扇が開く |
869
- * | `journey` | `journey` | 左端から右へ気持ちの線が伸びる |
870
- * | `mind` | `mind` | 中心から外へ枝が伸びる |
871
- * | `tree` | `tree` | 根から下へ枝が伸びる |
872
- * | `gantt` | `gantt` | 各帯の始端から右へ帯が伸びる |
873
- * | `funnel` | `funnel` | 上端から順に段が積まれる |
874
- *
875
- * `quadrant` は入れない。 4 つの区画に項目を置く図で **項目に順序が無く**、起点を決められない
876
- * (順番を書いた順で決めると、動きが図の意味を持たない)。
877
- *
878
- * いまは語と図種が同じ綴りだが、**同じものとして扱わない**。 語は書き手が書く名前で、
879
- * 図種は `type:` が取る値。 片方だけ別名を足したくなった時に、対応が表に残っている形にする。
880
- */
881
- declare const DRAW_TARGETS: ReadonlyMap<string, PresetType>;
882
- /** `draw:` に書ける語。 表から導く (#1314) */
883
- declare const DRAW_WORDS: ReadonlySet<string>;
884
-
885
1007
  /**
886
1008
  * Text DSL i18n キーワード一覧
887
1009
  * 日本語 / 英語両対応 (大文字小文字無視)
@@ -1071,11 +1193,13 @@ type StrippedPaint = {
1071
1193
  /**
1072
1194
  * 図の中から、 色を塗る位置に入った外部参照を落とす。
1073
1195
  *
1074
- * 対象は 2 種類ある。
1196
+ * 対象は 3 種類ある。
1075
1197
  *
1076
1198
  * - 色を塗る key (`fill` / `stroke` / `bg` 等) の値
1077
1199
  * - 状態の値 (`states[].initial` と、 phase が状態へ入れる値)。 状態は `{名前}` の形で
1078
1200
  * `fill` に差し込まれるため、 色を塗る位置に届く
1201
+ * - つまみの値 (`inputs[].defaultValue` / `defaultValues` / `options`)。 これらも状態を上書きし、
1202
+ * 同じ形で paint に届く
1079
1203
  *
1080
1204
  * 説明文 (`title` / `subtitle` / `value` / `rows`) は対象外。 文字として出るだけで
1081
1205
  * 属性にはならないため、 URL を書く正当な用途を壊さない。
@@ -1269,6 +1393,38 @@ interface DragonJson {
1269
1393
  * 箱ではないので縦列に載らない。 図全体に 1 つの並びとして持つ。
1270
1394
  */
1271
1395
  readouts?: DslReadout[];
1396
+ /**
1397
+ * 読む人が動かすつまみ (optional、 #1389)。 記法の最上位 `inputs:` と同じ。
1398
+ *
1399
+ * 部品と同じく箱ではないので縦列に載らない。 図全体に 1 つの並びとして持つ。
1400
+ */
1401
+ inputs?: DslInput[];
1402
+ /**
1403
+ * つまみの値から決まる値 (optional、 #1391)。 記法の最上位 `formulas:` と同じ。
1404
+ *
1405
+ * 形は `{ 名前: "式" }`。 `values:` と経路が別で、式は名前を中括弧で囲わない。
1406
+ */
1407
+ formulas?: Record<string, string>;
1408
+ /**
1409
+ * 押下などの出来事で動く仕掛け (optional、 #1393)。 記法の最上位 `events:` と同じ。
1410
+ *
1411
+ * 相手は名前で指す (`box` / `lane` / `arrow` / `diagram` のどれか 1 つ)。
1412
+ */
1413
+ events?: {
1414
+ on: string;
1415
+ handler: string;
1416
+ box?: string;
1417
+ lane?: string;
1418
+ arrow?: string;
1419
+ diagram?: boolean;
1420
+ }[];
1421
+ /** 巻き上げに応じて進む値 (optional、 #1393)。 記法の最上位 `scrolls:` と同じ */
1422
+ scrolls?: Record<string, {
1423
+ start?: number;
1424
+ end?: number;
1425
+ scrub?: number;
1426
+ label?: string;
1427
+ }>;
1272
1428
  /**
1273
1429
  * 状態の初期値 (optional)。 記法の `states:` と同じ (#1181)。
1274
1430
  *
@@ -1333,6 +1489,17 @@ interface JsonActor {
1333
1489
  * 箱に出す題 (optional、 #1381)。 記法の `title:` と同じ。
1334
1490
  */
1335
1491
  title?: string;
1492
+ /**
1493
+ * 値に追随する 5 欄 (optional、 #1392)。 記法の `wBind:` / `hBind:` / `opacity:` /
1494
+ * `renderOffsetX:` / `renderOffsetY:` と同じ。
1495
+ *
1496
+ * 大きさは文字列だけ (数を書いても追随のしようが無い)、濃さとずらしは数も受ける。
1497
+ */
1498
+ wBind?: string;
1499
+ hBind?: string;
1500
+ opacity?: number | string;
1501
+ renderOffsetX?: number | string;
1502
+ renderOffsetY?: number | string;
1336
1503
  /**
1337
1504
  * CAR-1657 unified syntax = 既存 NodeKind (28 個) に加えて parts identifier (arc-gauge 等) を
1338
1505
  * accept する。 未知 kind 値は parts 候補として partId に格納、 compile 側 partsCatalog で解決。
@@ -1454,6 +1621,13 @@ interface JsonStep {
1454
1621
  style?: EdgeStyle;
1455
1622
  guard?: string;
1456
1623
  cardinality?: string;
1624
+ /**
1625
+ * 矢印を値に追随させる 3 欄 (optional、 #1396)。 記法の `widthBind:` / `strokeBind:` /
1626
+ * `dashOffsetBind:` と同じ。 描画側は文字列だけを取る。
1627
+ */
1628
+ widthBind?: string;
1629
+ strokeBind?: string;
1630
+ dashOffsetBind?: string;
1457
1631
  labelOffsetX?: number;
1458
1632
  labelOffsetY?: number;
1459
1633
  /** true で説明文を矢印の線の上に重ねる。 分岐図の条件ラベル用。 */
@@ -1860,6 +2034,36 @@ declare const diagramJsonSchema: {
1860
2034
  required?: undefined;
1861
2035
  })[];
1862
2036
  };
2037
+ wBind: {
2038
+ type: string;
2039
+ minLength: number;
2040
+ pattern: string;
2041
+ description: string;
2042
+ };
2043
+ hBind: {
2044
+ type: string;
2045
+ minLength: number;
2046
+ pattern: string;
2047
+ description: string;
2048
+ };
2049
+ opacity: {
2050
+ type: string[];
2051
+ minLength: number;
2052
+ pattern: string;
2053
+ description: string;
2054
+ };
2055
+ renderOffsetX: {
2056
+ type: string[];
2057
+ minLength: number;
2058
+ pattern: string;
2059
+ description: string;
2060
+ };
2061
+ renderOffsetY: {
2062
+ type: string[];
2063
+ minLength: number;
2064
+ pattern: string;
2065
+ description: string;
2066
+ };
1863
2067
  };
1864
2068
  description?: undefined;
1865
2069
  })[];
@@ -1938,6 +2142,24 @@ declare const diagramJsonSchema: {
1938
2142
  };
1939
2143
  };
1940
2144
  };
2145
+ widthBind: {
2146
+ type: string;
2147
+ minLength: number;
2148
+ pattern: string;
2149
+ description: string;
2150
+ };
2151
+ strokeBind: {
2152
+ type: string;
2153
+ minLength: number;
2154
+ pattern: string;
2155
+ description: string;
2156
+ };
2157
+ dashOffsetBind: {
2158
+ type: string;
2159
+ minLength: number;
2160
+ pattern: string;
2161
+ description: string;
2162
+ };
1941
2163
  };
1942
2164
  };
1943
2165
  };
@@ -2527,6 +2749,208 @@ declare const diagramJsonSchema: {
2527
2749
  })[];
2528
2750
  };
2529
2751
  };
2752
+ inputs: {
2753
+ type: string;
2754
+ description: string;
2755
+ items: {
2756
+ type: string;
2757
+ required: string[];
2758
+ additionalProperties: boolean;
2759
+ properties: {
2760
+ id: {
2761
+ type: string;
2762
+ minLength: number;
2763
+ };
2764
+ kind: {
2765
+ type: string;
2766
+ enum: string[];
2767
+ };
2768
+ autoplay: {
2769
+ type: string;
2770
+ };
2771
+ defaultHi: {
2772
+ type: string;
2773
+ };
2774
+ defaultLo: {
2775
+ type: string;
2776
+ };
2777
+ defaultSpeedIdx: {
2778
+ type: string;
2779
+ };
2780
+ defaultValue: {
2781
+ type: string[];
2782
+ };
2783
+ defaultValues: {
2784
+ type: string;
2785
+ items: {
2786
+ type: string;
2787
+ };
2788
+ };
2789
+ defaultX: {
2790
+ type: string;
2791
+ };
2792
+ defaultY: {
2793
+ type: string;
2794
+ };
2795
+ duration: {
2796
+ type: string;
2797
+ };
2798
+ label: {
2799
+ type: string;
2800
+ };
2801
+ loop: {
2802
+ type: string;
2803
+ };
2804
+ max: {
2805
+ type: string;
2806
+ };
2807
+ maxLength: {
2808
+ type: string;
2809
+ };
2810
+ min: {
2811
+ type: string;
2812
+ };
2813
+ options: {
2814
+ type: string;
2815
+ items: {
2816
+ type: string;
2817
+ };
2818
+ };
2819
+ placeholder: {
2820
+ type: string;
2821
+ };
2822
+ speeds: {
2823
+ type: string;
2824
+ items: {
2825
+ type: string;
2826
+ };
2827
+ };
2828
+ step: {
2829
+ type: string;
2830
+ };
2831
+ xMax: {
2832
+ type: string;
2833
+ };
2834
+ xMin: {
2835
+ type: string;
2836
+ };
2837
+ yMax: {
2838
+ type: string;
2839
+ };
2840
+ yMin: {
2841
+ type: string;
2842
+ };
2843
+ };
2844
+ oneOf: ({
2845
+ properties: {
2846
+ kind: {
2847
+ enum: string[];
2848
+ };
2849
+ defaultValue: {
2850
+ type: string;
2851
+ };
2852
+ };
2853
+ required: string[];
2854
+ } | {
2855
+ properties: {
2856
+ kind: {
2857
+ enum: string[];
2858
+ };
2859
+ defaultValue?: undefined;
2860
+ };
2861
+ required: string[];
2862
+ })[];
2863
+ };
2864
+ };
2865
+ formulas: {
2866
+ type: string;
2867
+ description: string;
2868
+ additionalProperties: {
2869
+ type: string;
2870
+ minLength: number;
2871
+ pattern: string;
2872
+ };
2873
+ propertyNames: {
2874
+ pattern: string;
2875
+ };
2876
+ };
2877
+ events: {
2878
+ type: string;
2879
+ description: string;
2880
+ items: {
2881
+ type: string;
2882
+ required: string[];
2883
+ additionalProperties: boolean;
2884
+ properties: {
2885
+ on: {
2886
+ type: string;
2887
+ enum: string[];
2888
+ };
2889
+ handler: {
2890
+ type: string;
2891
+ minLength: number;
2892
+ pattern: string;
2893
+ };
2894
+ box: {
2895
+ type: string;
2896
+ minLength: number;
2897
+ description: string;
2898
+ };
2899
+ lane: {
2900
+ type: string;
2901
+ minLength: number;
2902
+ description: string;
2903
+ };
2904
+ arrow: {
2905
+ type: string;
2906
+ minLength: number;
2907
+ pattern: string;
2908
+ description: string;
2909
+ };
2910
+ diagram: {
2911
+ const: boolean;
2912
+ description: string;
2913
+ };
2914
+ };
2915
+ oneOf: {
2916
+ required: string[];
2917
+ }[];
2918
+ };
2919
+ };
2920
+ scrolls: {
2921
+ type: string;
2922
+ description: string;
2923
+ propertyNames: {
2924
+ pattern: string;
2925
+ };
2926
+ additionalProperties: {
2927
+ type: string;
2928
+ additionalProperties: boolean;
2929
+ properties: {
2930
+ start: {
2931
+ type: string;
2932
+ minimum: number;
2933
+ maximum: number;
2934
+ description: string;
2935
+ };
2936
+ end: {
2937
+ type: string;
2938
+ minimum: number;
2939
+ maximum: number;
2940
+ description: string;
2941
+ };
2942
+ scrub: {
2943
+ type: string;
2944
+ minimum: number;
2945
+ maximum: number;
2946
+ description: string;
2947
+ };
2948
+ label: {
2949
+ type: string;
2950
+ };
2951
+ };
2952
+ };
2953
+ };
2530
2954
  };
2531
2955
  };
2532
2956