@cardenelabs/dragon 0.11.0 → 0.13.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,4 @@
1
- import { NodeKind, Tone, EdgeStyle, CdlDiagram, LaidDiagram } from '@cardenelabs/cdl';
1
+ import { CdlDiagram, NodeKind, Tone, EdgeStyle, LaidDiagram } from '@cardenelabs/cdl';
2
2
 
3
3
  /**
4
4
  * 位置を他の要素からの相対で書くための解決。
@@ -82,6 +82,14 @@ declare function orderByDependency(items: ReadonlyArray<{
82
82
  * docs/cdl/text-dsl-spec.md の文法を AST に変換した中間表現
83
83
  */
84
84
 
85
+ /**
86
+ * 箱の中に描く図形 (#1374)。 **描画側の型をそのまま使う**。
87
+ *
88
+ * 写して持つと欄が増えた時にずれる。 指した先が変われば型検査が教える。
89
+ */
90
+ type DslDynShape = NonNullable<CdlDiagram["nodes"][number]["shape"]>;
91
+ /** 値を見せる部品 (#1374)。 図形と同じ理由で描画側の型をそのまま使う */
92
+ type DslReadout = NonNullable<CdlDiagram["readouts"]>[number];
85
93
  type PresetType = "sequence" | "flow" | "swimlane" | "er" | "state" | "topology" | "solidity" | "gantt" | "class" | "pie" | "bar" | "line" | "funnel" | "tree" | "journey" | "quadrant" | "c4" | "mind";
86
94
  type Position = {
87
95
  line: number;
@@ -150,6 +158,12 @@ type DslDocument = {
150
158
  viewport?: DslViewport;
151
159
  lanes?: Record<string, DslLane>;
152
160
  groups?: Record<string, DslGroup>;
161
+ /**
162
+ * 値を見せる部品 (`readouts:`、 #1374)。 割合の輪や数え上げを図の脇に出す。
163
+ *
164
+ * 箱ではないので縦列に載らない。 図全体に 1 つの並びとして持つ。
165
+ */
166
+ readouts?: DslReadout[];
153
167
  /**
154
168
  * canvas pivot (CAR-1693 Phase 1) diagram-level layout mode。 未指定は "auto" default で
155
169
  * catalog 100+ backward compat。 "manual" は Phase 4 で drag → pos: 保存の完全 manual mode。
@@ -186,6 +200,26 @@ type DslActor = {
186
200
  eyebrow?: string;
187
201
  value?: string;
188
202
  rows?: string[];
203
+ /**
204
+ * 箱の中に描く図形 (`shape:`、 #1374)。 水位や角度を状態で動かせる。
205
+ *
206
+ * 種類ごとに書ける欄が違う (`図形の表`)。 知らない種類と欄は読み取りが知らせる。
207
+ */
208
+ shape?: DslDynShape;
209
+ /**
210
+ * 箱に出す題 (`title:`、 #1381)。 書かなければ名前がそのまま題になる。
211
+ *
212
+ * 名前は図の中で 1 つに決まる必要がある (`focus:` と `flow:` が名前で指すため) 一方、
213
+ * 題は重なってよい。 同じ題の箱を並べる図と、題を持たない箱を、名前と切り離して書ける。
214
+ */
215
+ title?: string;
216
+ /**
217
+ * その箱を出すかどうかの条件 (`visibleIf:`、 #1381)。
218
+ *
219
+ * 状態を差し込める文字列で、描画側が真偽を判定する。 `"0"` / `"false"` / 空文字が偽で、
220
+ * それ以外は真。 値だけを見せる図が、場所を空けるためだけの見えない箱を置くのに使う。
221
+ */
222
+ visibleIf?: string;
189
223
  /**
190
224
  * 工程の並び (`type: gantt`) で、その工程の担当 (#1251)。
191
225
  *
@@ -317,6 +351,8 @@ type DslStep = {
317
351
  /** v0.5+ inline option */
318
352
  guard?: string;
319
353
  cardinality?: string;
354
+ /** 矢印がどの辺から出るか (#1385)。 書かなければ描画側が自動で選ぶ */
355
+ side?: "top" | "right" | "bottom" | "left";
320
356
  labelOffsetX?: number;
321
357
  labelOffsetY?: number;
322
358
  /** true で説明文を矢印の線の上に重ねる。 分岐図の条件ラベル用。 */
@@ -785,7 +821,7 @@ type V05ParseResult = {
785
821
  * 書くと、項目を足した時に案内か一覧のどちらかが取り残される (実際に `states` / `values` が
786
822
  * 一覧に 1 件も無い状態で放置されていた)。
787
823
  */
788
- declare const TOP_LEVEL_KEYS: readonly ["title", "type", "actors", "flow", "states", "values", "animation", "viewport", "lanes", "groups", "eyebrow", "axes"];
824
+ declare const TOP_LEVEL_KEYS: readonly ["title", "type", "actors", "flow", "states", "values", "animation", "viewport", "lanes", "groups", "eyebrow", "axes", "readouts"];
789
825
  /** 受け付ける図種。 記法一覧はここを見る。 */
790
826
  declare const PRESET_TYPES: ReadonlySet<PresetType>;
791
827
  /**
@@ -1227,6 +1263,12 @@ interface DragonJson {
1227
1263
  actors: (string | JsonActor)[];
1228
1264
  /** flow step 配列 (必須): { from, to, label, ... } */
1229
1265
  flow: JsonStep[];
1266
+ /**
1267
+ * 値を見せる部品 (optional、 #1374)。 記法の最上位 `readouts:` と同じ。
1268
+ *
1269
+ * 箱ではないので縦列に載らない。 図全体に 1 つの並びとして持つ。
1270
+ */
1271
+ readouts?: DslReadout[];
1230
1272
  /**
1231
1273
  * 状態の初期値 (optional)。 記法の `states:` と同じ (#1181)。
1232
1274
  *
@@ -1277,6 +1319,20 @@ interface DragonJson {
1277
1319
  }
1278
1320
  interface JsonActor {
1279
1321
  name: string;
1322
+ /**
1323
+ * 箱の中に描く図形 (optional、 #1374)。 記法の `shape:` と同じ。
1324
+ *
1325
+ * 水位や角度を状態で動かす。 形は描画側の型が縛る。
1326
+ */
1327
+ shape?: DslDynShape;
1328
+ /**
1329
+ * その箱を出すかどうかの条件 (optional、 #1381)。 記法の `visibleIf:` と同じ。
1330
+ */
1331
+ visibleIf?: string;
1332
+ /**
1333
+ * 箱に出す題 (optional、 #1381)。 記法の `title:` と同じ。
1334
+ */
1335
+ title?: string;
1280
1336
  /**
1281
1337
  * CAR-1657 unified syntax = 既存 NodeKind (28 個) に加えて parts identifier (arc-gauge 等) を
1282
1338
  * accept する。 未知 kind 値は parts 候補として partId に格納、 compile 側 partsCatalog で解決。
@@ -1387,6 +1443,8 @@ interface JsonStep {
1387
1443
  to: string;
1388
1444
  label: string;
1389
1445
  sub?: string;
1446
+ /** 矢印がどの辺から出るか (#1385)。 記法の `side:` と同じ */
1447
+ side?: "top" | "right" | "bottom" | "left";
1390
1448
  /**
1391
1449
  * 矢印の色 (#1304)。 記法の `(成功)` と同じく別名 (`成功` / `neutral` 等) も受ける。
1392
1450
  *
@@ -1712,6 +1770,96 @@ declare const diagramJsonSchema: {
1712
1770
  };
1713
1771
  };
1714
1772
  };
1773
+ visibleIf: {
1774
+ type: string;
1775
+ description: string;
1776
+ };
1777
+ title: {
1778
+ type: string;
1779
+ description: string;
1780
+ };
1781
+ shape: {
1782
+ type: string;
1783
+ description: string;
1784
+ required: string[];
1785
+ properties: {
1786
+ kind: {
1787
+ type: string;
1788
+ enum: string[];
1789
+ };
1790
+ source: {
1791
+ type: string[];
1792
+ };
1793
+ fillMax: {
1794
+ type: string;
1795
+ };
1796
+ orient: {
1797
+ type: string;
1798
+ enum: string[];
1799
+ };
1800
+ radius: {
1801
+ type: string[];
1802
+ };
1803
+ fillProgress: {
1804
+ type: string[];
1805
+ };
1806
+ innerRadius: {
1807
+ type: string;
1808
+ };
1809
+ outerRadius: {
1810
+ type: string;
1811
+ };
1812
+ startAngle: {
1813
+ type: string;
1814
+ };
1815
+ angle: {
1816
+ type: string[];
1817
+ };
1818
+ sweepMax: {
1819
+ type: string;
1820
+ };
1821
+ level: {
1822
+ type: string[];
1823
+ };
1824
+ amplitude: {
1825
+ type: string;
1826
+ };
1827
+ frequency: {
1828
+ type: string;
1829
+ };
1830
+ waveHeight: {
1831
+ type: string;
1832
+ };
1833
+ sides: {
1834
+ type: string;
1835
+ };
1836
+ rotation: {
1837
+ type: string[];
1838
+ };
1839
+ fill: {
1840
+ type: string;
1841
+ };
1842
+ stroke: {
1843
+ type: string;
1844
+ };
1845
+ };
1846
+ additionalProperties: boolean;
1847
+ oneOf: ({
1848
+ properties: {
1849
+ kind: {
1850
+ enum: string[];
1851
+ };
1852
+ };
1853
+ required: string[];
1854
+ } | {
1855
+ properties: {
1856
+ kind: {
1857
+ enum: string[];
1858
+ };
1859
+ };
1860
+ required?: undefined;
1861
+ })[];
1862
+ };
1715
1863
  };
1716
1864
  description?: undefined;
1717
1865
  })[];
@@ -1759,6 +1907,11 @@ declare const diagramJsonSchema: {
1759
1907
  type: string;
1760
1908
  description: string;
1761
1909
  };
1910
+ side: {
1911
+ type: string;
1912
+ enum: string[];
1913
+ description: string;
1914
+ };
1762
1915
  labelOffsetX: {
1763
1916
  type: string;
1764
1917
  description: string;
@@ -1985,6 +2138,395 @@ declare const diagramJsonSchema: {
1985
2138
  };
1986
2139
  };
1987
2140
  };
2141
+ readouts: {
2142
+ type: string;
2143
+ description: string;
2144
+ items: {
2145
+ type: string;
2146
+ required: string[];
2147
+ additionalProperties: boolean;
2148
+ properties: {
2149
+ id: {
2150
+ type: string;
2151
+ minLength: number;
2152
+ };
2153
+ kind: {
2154
+ type: string;
2155
+ enum: string[];
2156
+ };
2157
+ additionsSource: {
2158
+ type: string;
2159
+ };
2160
+ bodySource: {
2161
+ type: string;
2162
+ };
2163
+ canvasH: {
2164
+ type: string;
2165
+ };
2166
+ canvasW: {
2167
+ type: string;
2168
+ };
2169
+ caption: {
2170
+ type: string;
2171
+ };
2172
+ cellGap: {
2173
+ type: string;
2174
+ };
2175
+ cellSize: {
2176
+ type: string;
2177
+ };
2178
+ charMs: {
2179
+ type: string;
2180
+ };
2181
+ color: {
2182
+ type: string;
2183
+ };
2184
+ colorA: {
2185
+ type: string;
2186
+ };
2187
+ colorAccent: {
2188
+ type: string;
2189
+ };
2190
+ colorActive: {
2191
+ type: string;
2192
+ };
2193
+ colorActual: {
2194
+ type: string;
2195
+ };
2196
+ colorAdd: {
2197
+ type: string;
2198
+ };
2199
+ colorApplied: {
2200
+ type: string;
2201
+ };
2202
+ colorB: {
2203
+ type: string;
2204
+ };
2205
+ colorBar: {
2206
+ type: string;
2207
+ };
2208
+ colorBottom: {
2209
+ type: string;
2210
+ };
2211
+ colorDel: {
2212
+ type: string;
2213
+ };
2214
+ colorDiscount: {
2215
+ type: string;
2216
+ };
2217
+ colorDown: {
2218
+ type: string;
2219
+ };
2220
+ colorFocus: {
2221
+ type: string;
2222
+ };
2223
+ colorMap: {
2224
+ type: string;
2225
+ minItems: number;
2226
+ items: {
2227
+ type: string;
2228
+ required: string[];
2229
+ additionalProperties: boolean;
2230
+ properties: {
2231
+ status: {
2232
+ type: string;
2233
+ };
2234
+ color: {
2235
+ type: string;
2236
+ };
2237
+ };
2238
+ };
2239
+ };
2240
+ colorNeg: {
2241
+ type: string;
2242
+ };
2243
+ colorNew: {
2244
+ type: string;
2245
+ };
2246
+ colorOld: {
2247
+ type: string;
2248
+ };
2249
+ colorOther: {
2250
+ type: string;
2251
+ };
2252
+ colorPending: {
2253
+ type: string;
2254
+ };
2255
+ colorPlay: {
2256
+ type: string;
2257
+ };
2258
+ colorPos: {
2259
+ type: string;
2260
+ };
2261
+ colorRead: {
2262
+ type: string;
2263
+ };
2264
+ colorSelf: {
2265
+ type: string;
2266
+ };
2267
+ colorSource: {
2268
+ type: string;
2269
+ };
2270
+ colorStrong: {
2271
+ type: string;
2272
+ };
2273
+ colorTop: {
2274
+ type: string;
2275
+ };
2276
+ colorTotal: {
2277
+ type: string;
2278
+ };
2279
+ colorUnread: {
2280
+ type: string;
2281
+ };
2282
+ colorUp: {
2283
+ type: string;
2284
+ };
2285
+ colorWeak: {
2286
+ type: string;
2287
+ };
2288
+ colorWinner: {
2289
+ type: string;
2290
+ };
2291
+ colors: {
2292
+ type: string;
2293
+ items: {
2294
+ type: string;
2295
+ };
2296
+ };
2297
+ columnWidth: {
2298
+ type: string;
2299
+ };
2300
+ comparisonSource: {
2301
+ type: string;
2302
+ };
2303
+ count: {
2304
+ type: string;
2305
+ };
2306
+ currency: {
2307
+ type: string;
2308
+ };
2309
+ currentSource: {
2310
+ type: string;
2311
+ };
2312
+ decimals: {
2313
+ type: string;
2314
+ };
2315
+ deletionsSource: {
2316
+ type: string;
2317
+ };
2318
+ duration: {
2319
+ type: string;
2320
+ };
2321
+ durationMs: {
2322
+ type: string;
2323
+ };
2324
+ durationSource: {
2325
+ type: string;
2326
+ };
2327
+ fill: {
2328
+ type: string;
2329
+ };
2330
+ highThreshold: {
2331
+ type: string;
2332
+ };
2333
+ history: {
2334
+ type: string;
2335
+ };
2336
+ historySource: {
2337
+ type: string;
2338
+ };
2339
+ innerRatio: {
2340
+ type: string;
2341
+ };
2342
+ itemTemplate: {
2343
+ type: string;
2344
+ };
2345
+ kindSource: {
2346
+ type: string;
2347
+ };
2348
+ label: {
2349
+ type: string;
2350
+ };
2351
+ labelA: {
2352
+ type: string;
2353
+ };
2354
+ labelB: {
2355
+ type: string;
2356
+ };
2357
+ labelSource: {
2358
+ type: string;
2359
+ };
2360
+ lowThreshold: {
2361
+ type: string;
2362
+ };
2363
+ map: {
2364
+ type: string;
2365
+ minItems: number;
2366
+ items: {
2367
+ type: string;
2368
+ required: string[];
2369
+ additionalProperties: boolean;
2370
+ properties: {
2371
+ value: {
2372
+ type: string;
2373
+ };
2374
+ color: {
2375
+ type: string;
2376
+ };
2377
+ label: {
2378
+ type: string;
2379
+ };
2380
+ };
2381
+ };
2382
+ };
2383
+ max: {
2384
+ type: string;
2385
+ };
2386
+ maxSize: {
2387
+ type: string;
2388
+ };
2389
+ membersSource: {
2390
+ type: string;
2391
+ };
2392
+ min: {
2393
+ type: string;
2394
+ };
2395
+ minSize: {
2396
+ type: string;
2397
+ };
2398
+ monthName: {
2399
+ type: string;
2400
+ };
2401
+ newSource: {
2402
+ type: string;
2403
+ };
2404
+ oldSource: {
2405
+ type: string;
2406
+ };
2407
+ pathD: {
2408
+ type: string;
2409
+ };
2410
+ playingSource: {
2411
+ type: string;
2412
+ };
2413
+ prefix: {
2414
+ type: string;
2415
+ };
2416
+ prevSource: {
2417
+ type: string;
2418
+ };
2419
+ progressSource: {
2420
+ type: string;
2421
+ };
2422
+ rMax: {
2423
+ type: string;
2424
+ };
2425
+ rMin: {
2426
+ type: string;
2427
+ };
2428
+ rangeAvg: {
2429
+ type: string;
2430
+ };
2431
+ rangeBad: {
2432
+ type: string;
2433
+ };
2434
+ runningSource: {
2435
+ type: string;
2436
+ };
2437
+ segments: {
2438
+ type: string;
2439
+ };
2440
+ showValue: {
2441
+ type: string;
2442
+ };
2443
+ size: {
2444
+ type: string;
2445
+ };
2446
+ source: {
2447
+ type: string;
2448
+ };
2449
+ sourceA: {
2450
+ type: string;
2451
+ };
2452
+ sourceB: {
2453
+ type: string;
2454
+ };
2455
+ stepsSource: {
2456
+ type: string;
2457
+ };
2458
+ strokeWidth: {
2459
+ type: string;
2460
+ };
2461
+ suffix: {
2462
+ type: string;
2463
+ };
2464
+ targetSource: {
2465
+ type: string;
2466
+ };
2467
+ textSource: {
2468
+ type: string;
2469
+ };
2470
+ titleSource: {
2471
+ type: string;
2472
+ };
2473
+ unit: {
2474
+ type: string;
2475
+ };
2476
+ viewH: {
2477
+ type: string;
2478
+ };
2479
+ viewW: {
2480
+ type: string;
2481
+ };
2482
+ xMax: {
2483
+ type: string;
2484
+ };
2485
+ xMin: {
2486
+ type: string;
2487
+ };
2488
+ yMax: {
2489
+ type: string;
2490
+ };
2491
+ yMin: {
2492
+ type: string;
2493
+ };
2494
+ };
2495
+ oneOf: ({
2496
+ properties: {
2497
+ kind: {
2498
+ enum: string[];
2499
+ };
2500
+ map?: undefined;
2501
+ };
2502
+ required: string[];
2503
+ } | {
2504
+ properties: {
2505
+ kind: {
2506
+ enum: string[];
2507
+ };
2508
+ map: {
2509
+ type: string;
2510
+ minItems: number;
2511
+ items: {
2512
+ type: string;
2513
+ required: string[];
2514
+ additionalProperties: boolean;
2515
+ properties: {
2516
+ value: {
2517
+ type: string;
2518
+ };
2519
+ color: {
2520
+ type: string;
2521
+ };
2522
+ };
2523
+ };
2524
+ };
2525
+ };
2526
+ required: string[];
2527
+ })[];
2528
+ };
2529
+ };
1988
2530
  };
1989
2531
  };
1990
2532