@cardenelabs/cdl 0.27.0 → 0.29.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/CHANGELOG.md CHANGED
@@ -5,6 +5,96 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.29.0] - 2026-09-04
9
+
10
+ ### Added
11
+
12
+ - **図の種類を絵の根に出すようにした** (#645)
13
+
14
+ これまで絵の根に出ていたのは `data-cdl-stage` と `data-cdl-scale` と `data-cdl-palette` の
15
+ 3 つだけで、図の種類が出ていなかった。 そのため消費側が図の種類で描き分けられない。
16
+
17
+ 実際に困った例は、消費側の dragon でクラス図の関係の線だけを太くしようとした時。
18
+ 線の規則は `[data-cdl-role="edge-line"]` 1 つしかなく、直すと ER 図 ・ 状態遷移図 ・
19
+ 流れ図 ・ 並び図 の線まで同時に太くなる。
20
+
21
+ `data-cdl-palette` では選び分けられない = クラス図と ER 図がどちらも `kinari` を出すため。
22
+
23
+ `palette` (#1553) と同じ形にした = **cdl は名前だけを出し、見た目は消費側が決める**。
24
+ 値を engine に持たせると、消費側が表現を変えるたびに engine の release が要る。
25
+
26
+ 種類名は組み立て器の名前をそのまま小文字で使う。 例外は 4 件。
27
+
28
+ | 組み立て器 | 種類名 | なぜ |
29
+ |---|---|---|
30
+ | `classDiagram` | `class` | 消費側の記法が `class` を使う |
31
+ | `userJourney` | `journey` | 同上 |
32
+ | `mindMap` | `mindmap` | 大文字小文字を混ぜない |
33
+ | `stateMachine` と `stateMachine2` | どちらも `state` | 後者は入れ子と動作を足した拡張で、図の種類としては同じ |
34
+
35
+ 組み立て器を通さず `diagram()` を直に呼んだ図と、空文字を渡した図には属性を出さない。
36
+
37
+ ## [0.28.0] - 2026-09-04
38
+
39
+ ### Changed
40
+
41
+ - **クラス図の関係の色みを種類から決めるようにした** (#641)
42
+
43
+ 6 種の関係が全て同じ色 (`info`) で引かれていた。 見分けを担うのは 線 (実線 / 破線) と
44
+ 印の形 (三角 / 菱 / 開いた矢) と 印が付く側 の 3 軸だけで、6 種を 1 枚に並べると
45
+ 印の形まで見ないとどれがどれか判らない。
46
+
47
+ 種類から色みを決める対応表 (`CLASS_RELATION_TONE`) を足し、6 種を 3 群に寄せた。
48
+
49
+ | 群 | 種類 | 色み | 群の中の見分け |
50
+ |---|---|---|---|
51
+ | 縦の関係 | `extends` / `implements` | `accent` | 線 (実線 / 破線) |
52
+ | 所有 | `aggregates` / `composes` | `teal` | 印の塗り (白抜き / 塗る) |
53
+ | 向きだけ | `associates` / `uses` | `success` | 線 (実線 / 破線) |
54
+
55
+ **群の中は色を分けない**。 群の中の 2 種は既に線か印の塗りで分かれているので、
56
+ 色まで足すと同じことを 2 回言うことになる。 色が担うのは群の見分けだけ。
57
+
58
+ 優先順位は 関係に書いた色み > 図に書いた `defaultTone` > 種類から決まる既定 の 3 段。
59
+ `defaultTone` を書いた図は「全部同じ色みにする」 と宣言しているので、そちらが勝つ =
60
+ 既存の図の見た目は変わらない。
61
+
62
+ **色の値は持たない**。 名前だけを図に載せ、実際の色は消費側が `data-cdl-tone` を見て当てる。
63
+
64
+ ### Fixed
65
+
66
+ - **比較 link が 404 になっていた 6 版に tag を打った** (#639)
67
+
68
+ 変更履歴は 31 版ぶんの比較 link を持つが、tag があるのは 25 版だった。
69
+ `0.17.0` / `0.17.1` / `0.18.0` / `0.18.1` / `0.24.0` / `0.25.0` の 6 本が飛び先を持たず、
70
+ 押すと 404 になる。 この file は npm の配布物に入るので、`node_modules` から読んだ
71
+ 利用者にも 404 が届いていた。
72
+
73
+ 6 本とも、その版の値を持つ commit に打った。
74
+ 最上位の tag は `v0.27.0` のままなので、版の範囲を導く検査の判定は変わらない。
75
+
76
+ **`0.27.0` の記述に書いた tag の数も直した**。 「`v0.9.0` までしか tag が無い」 と
77
+ 書いていたが、実測では `v0.23.0` まであった。 `git tag --list` の並びを版順と読み違えた
78
+ もので、`--sort=-v:refname` で確かめると最上位は `v0.23.0` になる。
79
+ tag を打つ判断そのものは変わらない = `v0.23.0` を起点にしても 4 版ぶんが範囲に入る。
80
+
81
+ ### Added
82
+
83
+ - **版に入る commit が変更履歴から辿れることを検査する** (#637)
84
+
85
+ `0.27.0` を切る時に doc だけの PR (#633) の entry を書き忘れたが、既存の検査は 1 つも
86
+ 落ちなかった。 `release-packaging.test.ts` は公開物に変更履歴が入るかと比較 link の形しか
87
+ 見ないため、commit の記載漏れは素通りする。
88
+
89
+ 前の版から HEAD までの各 commit について、その commit が持つ番号のどれかが変更履歴に
90
+ 載っているか「利用者から見えない」 と宣言されていることを見る検査を足した。
91
+ 消費側 (dragon) の同名の検査を移したもので、あちらでは tag の打ち忘れと宣言の残骸を
92
+ 実際に捕まえている。
93
+
94
+ **併せて `v0.26.0` と `v0.27.0` の tag を打った**。 検査は版の範囲を tag から導くので、
95
+ 無いと起点が `v0.23.0` まで下がり、`0.24.0` から `0.27.0` の 4 版ぶんが範囲に入って使えない。
96
+ 間の版の tag は打っていない = 範囲の判定に効くのはいちばん新しい tag だけ。
97
+
8
98
  ## [0.27.0] - 2026-09-04
9
99
 
10
100
  ### Changed
@@ -1350,7 +1440,9 @@ Initial OSS release.
1350
1440
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
1351
1441
  行き止まりになる。
1352
1442
 
1353
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.27.0...HEAD
1443
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.29.0...HEAD
1444
+ [0.29.0]: https://github.com/cardene777/cdl/compare/v0.28.0...v0.29.0
1445
+ [0.28.0]: https://github.com/cardene777/cdl/compare/v0.27.0...v0.28.0
1354
1446
  [0.27.0]: https://github.com/cardene777/cdl/compare/v0.26.0...v0.27.0
1355
1447
  [0.26.0]: https://github.com/cardene777/cdl/compare/v0.25.0...v0.26.0
1356
1448
  [0.25.0]: https://github.com/cardene777/cdl/compare/v0.24.0...v0.25.0
package/dist/index.cjs CHANGED
@@ -11486,6 +11486,8 @@ function diagram(id, options) {
11486
11486
  ...options.structuredData === "exclude" ? { structuredData: "exclude" } : {},
11487
11487
  // 配色の名前は素通しする。 空文字の遮断は `layout` が持つ (後段が必ず通るため)
11488
11488
  ...options.palette !== void 0 ? { palette: options.palette } : {},
11489
+ // 種類の名前も同じ経路で渡し、空文字の扱いを `layout` の 1 箇所に揃える
11490
+ ...options.type !== void 0 ? { type: options.type } : {},
11489
11491
  // inputs / formulas / scrollTriggers / eventBindings は空なら省略 (static diagram の JSON 形状維持)
11490
11492
  ...inputs.length > 0 ? { inputs: [...inputs] } : {},
11491
11493
  ...formulas.length > 0 ? { formulas: [...formulas] } : {},
@@ -20282,6 +20284,8 @@ function layout(diag) {
20282
20284
  // **遮断はここだけに置く**。 描画は必ず組み立てを通り、組み立て API も `er` も
20283
20285
  // 素通しにしてある。 上流にも置くと、どの入力でも通らない分岐が残る
20284
20286
  ...diag.palette ? { palette: diag.palette } : {},
20287
+ // 種類も配色と同じく空の目印を出さない。 遮断をここに揃えると手書きの図にも効く
20288
+ ...diag.type ? { type: diag.type } : {},
20285
20289
  bboxes,
20286
20290
  collisions,
20287
20291
  nearCollisions,
@@ -29701,6 +29705,7 @@ function CdlStage({
29701
29705
  "data-cdl-stage": "",
29702
29706
  "data-cdl-scale": diagramScale === 1 ? void 0 : diagramScale,
29703
29707
  "data-cdl-palette": laid.palette,
29708
+ "data-cdl-type": laid.type,
29704
29709
  children: [
29705
29710
  /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
29706
29711
  Object.entries(TONE).flatMap(
@@ -30370,7 +30375,7 @@ function fitRowsWidth(boxW, rows) {
30370
30375
  }
30371
30376
  function swimlane(preset) {
30372
30377
  const w = preset.laneWidth ?? 400;
30373
- const b = diagram(preset.id, { topic: preset.topic });
30378
+ const b = diagram(preset.id, { topic: preset.topic, type: "swimlane" });
30374
30379
  const labelToId = /* @__PURE__ */ new Map();
30375
30380
  const idsInOrder = [];
30376
30381
  for (const label of preset.lanes) {
@@ -30390,7 +30395,7 @@ function swimlane(preset) {
30390
30395
  }
30391
30396
  function flow(preset) {
30392
30397
  const w = preset.laneWidth ?? 400;
30393
- const b = diagram(preset.id, { topic: preset.topic });
30398
+ const b = diagram(preset.id, { topic: preset.topic, type: "flow" });
30394
30399
  b.lane("flow", { width: w, ...preset.laneLabel ? { label: preset.laneLabel } : {} });
30395
30400
  const tone = preset.defaultTone ?? "accent";
30396
30401
  const style = preset.defaultStyle ?? "dotted-flow";
@@ -30451,7 +30456,7 @@ var SEQUENCE_MESSAGE_LOOK = {
30451
30456
  };
30452
30457
  function sequence(preset) {
30453
30458
  const tone = preset.defaultTone ?? "accent";
30454
- const b = diagram(preset.id, { topic: preset.topic });
30459
+ const b = diagram(preset.id, { topic: preset.topic, type: "sequence" });
30455
30460
  const \u9762\u3005 = preset.actors.map(
30456
30461
  (a) => typeof a === "string" ? { name: a } : { name: a.name, ...a.subtitle ? { subtitle: a.subtitle } : {} }
30457
30462
  );
@@ -30506,7 +30511,7 @@ function topology(preset) {
30506
30511
  const groupW = preset.groupWidth ?? 460;
30507
30512
  const tone = preset.defaultTone ?? "accent";
30508
30513
  const style = preset.defaultStyle ?? "solid";
30509
- const b = diagram(preset.id, { topic: preset.topic });
30514
+ const b = diagram(preset.id, { topic: preset.topic, type: "topology" });
30510
30515
  const groupOrder = [];
30511
30516
  const groupStackCount = /* @__PURE__ */ new Map();
30512
30517
  const phaseActivate = [];
@@ -30575,7 +30580,7 @@ function er(preset) {
30575
30580
  const entityW = resolveStorageBoxW(preset.entityWidth, "er", "entityWidth");
30576
30581
  const tone = preset.defaultTone ?? "info";
30577
30582
  const \u7E1E\u3092\u6577\u304F = preset.rowStripe ?? true;
30578
- const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette });
30583
+ const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette, type: "er" });
30579
30584
  const entities = [];
30580
30585
  const phaseActivate = [];
30581
30586
  let relIdx = 0;
@@ -30661,7 +30666,7 @@ var FSM_ACTION_MARK = {
30661
30666
  function stateMachine(preset) {
30662
30667
  const stateW = resolveStateW(preset.stateWidth, "stateMachine");
30663
30668
  const tone = preset.defaultTone ?? "accent";
30664
- const b = diagram(preset.id, { topic: preset.topic });
30669
+ const b = diagram(preset.id, { topic: preset.topic, type: "state" });
30665
30670
  const phaseActivate = [];
30666
30671
  const stateOrder = /* @__PURE__ */ new Map();
30667
30672
  const \u72B6\u614B = [];
@@ -30773,7 +30778,7 @@ function infrastructure(preset) {
30773
30778
  const laneW = preset.laneWidth ?? 380;
30774
30779
  const tone = preset.defaultTone ?? "accent";
30775
30780
  const style = preset.defaultStyle ?? "solid";
30776
- const b = diagram(preset.id, { topic: preset.topic });
30781
+ const b = diagram(preset.id, { topic: preset.topic, type: "infrastructure" });
30777
30782
  const colLaneIds = /* @__PURE__ */ new Map();
30778
30783
  const phaseActivate = [];
30779
30784
  let connIdx = 0;
@@ -30832,6 +30837,14 @@ var CLASS_RELATION_LOOK = {
30832
30837
  associates: { head: "open", fill: "solid", tailHead: "none", tailFill: "solid", style: "solid" },
30833
30838
  uses: { head: "open", fill: "solid", tailHead: "none", tailFill: "solid", style: "dashed" }
30834
30839
  };
30840
+ var CLASS_RELATION_TONE = {
30841
+ extends: "accent",
30842
+ implements: "accent",
30843
+ aggregates: "teal",
30844
+ composes: "teal",
30845
+ associates: "success",
30846
+ uses: "success"
30847
+ };
30835
30848
  Object.fromEntries(
30836
30849
  Object.entries(CLASS_RELATION_LOOK).map(([k, v]) => [k, v.head])
30837
30850
  );
@@ -30844,9 +30857,9 @@ function stripAccess(row) {
30844
30857
  }
30845
30858
  function classDiagram(preset) {
30846
30859
  const classW = resolveStorageBoxW(preset.classWidth, "classDiagram", "classWidth");
30847
- const tone = preset.defaultTone ?? "info";
30860
+ const \u56F3\u306E\u65E2\u5B9A = preset.defaultTone;
30848
30861
  const \u7E1E\u3092\u6577\u304F = preset.rowStripe ?? true;
30849
- const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette });
30862
+ const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette, type: "class" });
30850
30863
  const classes = [];
30851
30864
  const phaseActivate = [];
30852
30865
  const \u7BB1 = [];
@@ -30908,7 +30921,7 @@ function classDiagram(preset) {
30908
30921
  id: edgeId,
30909
30922
  label: r.label ?? r.type,
30910
30923
  ...r.cardinality ? { sub: r.cardinality } : {},
30911
- tone: r.tone ?? tone,
30924
+ tone: r.tone ?? \u56F3\u306E\u65E2\u5B9A ?? CLASS_RELATION_TONE[r.type],
30912
30925
  // 関係の種類から線と端の形を決める (cdl#574 / #578)。 書いた値が勝つ
30913
30926
  style: r.style ?? \u898B\u305F\u76EE.style,
30914
30927
  head: r.head ?? \u898B\u305F\u76EE.head,
@@ -30933,7 +30946,7 @@ function classDiagram(preset) {
30933
30946
  function tree(preset) {
30934
30947
  const canvasW = preset.nodeWidth ? preset.nodeWidth * 2 : 720;
30935
30948
  const canvasH = 480;
30936
- const b = diagram(preset.id, { topic: preset.topic });
30949
+ const b = diagram(preset.id, { topic: preset.topic, type: "tree" });
30937
30950
  const treeNodes = [];
30938
30951
  const api = {
30939
30952
  node(n) {
@@ -30971,7 +30984,7 @@ function tree(preset) {
30971
30984
  function userJourney(preset) {
30972
30985
  const canvasW = preset.stepWidth ? preset.stepWidth * 2 : 720;
30973
30986
  const canvasH = 480;
30974
- const b = diagram(preset.id, { topic: preset.topic });
30987
+ const b = diagram(preset.id, { topic: preset.topic, type: "journey" });
30975
30988
  const steps = [];
30976
30989
  const api = {
30977
30990
  step(s) {
@@ -31010,7 +31023,7 @@ function userJourney(preset) {
31010
31023
  function mindMap(preset) {
31011
31024
  const canvasW = preset.branchWidth ? preset.branchWidth * 2 : 720;
31012
31025
  const canvasH = 480;
31013
- const b = diagram(preset.id, { topic: preset.topic });
31026
+ const b = diagram(preset.id, { topic: preset.topic, type: "mindmap" });
31014
31027
  const branches = [];
31015
31028
  const api = {
31016
31029
  branch(br) {
@@ -31054,7 +31067,7 @@ function mindMap(preset) {
31054
31067
  function funnel(preset) {
31055
31068
  const canvasW = toGridSize(preset.stageWidth ?? 560);
31056
31069
  const canvasH = 480;
31057
- const b = diagram(preset.id, { topic: preset.topic });
31070
+ const b = diagram(preset.id, { topic: preset.topic, type: "funnel" });
31058
31071
  const stages = [];
31059
31072
  const api = {
31060
31073
  stage(s) {
@@ -31092,7 +31105,7 @@ function funnel(preset) {
31092
31105
  function quadrant(preset) {
31093
31106
  const canvasW = 640;
31094
31107
  const canvasH = 480;
31095
- const b = diagram(preset.id, { topic: preset.topic });
31108
+ const b = diagram(preset.id, { topic: preset.topic, type: "quadrant" });
31096
31109
  const items = [];
31097
31110
  const api = {
31098
31111
  item(it) {
@@ -31143,7 +31156,7 @@ function chart(preset) {
31143
31156
  const canvasH = toGridSize(
31144
31157
  preset.type === "pie" || preset.type === "gauge" || preset.type === "radial" || preset.type === "stat" || preset.type === "waffle" || preset.type === "stacked-bar" ? 320 : 360
31145
31158
  );
31146
- const b = diagram(preset.id, { topic: preset.topic });
31159
+ const b = diagram(preset.id, { topic: preset.topic, type: "chart" });
31147
31160
  const data = [];
31148
31161
  const kindMap = {
31149
31162
  line: "chart-line",
@@ -31192,7 +31205,7 @@ function gantt(preset) {
31192
31205
  const canvasW = preset.laneWidth ? preset.laneWidth * 2 : 720;
31193
31206
  const canvasH = 360;
31194
31207
  const tone = preset.defaultTone ?? "teal";
31195
- const b = diagram(preset.id, { topic: preset.topic });
31208
+ const b = diagram(preset.id, { topic: preset.topic, type: "gantt" });
31196
31209
  const tasks = [];
31197
31210
  const api = {
31198
31211
  task(t) {
@@ -31258,7 +31271,7 @@ var SHAPE_EYEBROW = {
31258
31271
  function flowchart(preset) {
31259
31272
  const laneW = preset.laneWidth ?? 380;
31260
31273
  const tone = preset.defaultTone ?? "accent";
31261
- const b = diagram(preset.id, { topic: preset.topic });
31274
+ const b = diagram(preset.id, { topic: preset.topic, type: "flowchart" });
31262
31275
  const laneToId = /* @__PURE__ */ new Map();
31263
31276
  const laneStackCount = /* @__PURE__ */ new Map();
31264
31277
  for (const label of preset.lanes) {
@@ -31319,7 +31332,7 @@ var NET_KIND_MAP = {
31319
31332
  function network(preset) {
31320
31333
  const laneW = preset.laneWidth ?? 320;
31321
31334
  const tone = preset.defaultTone ?? "info";
31322
- const b = diagram(preset.id, { topic: preset.topic });
31335
+ const b = diagram(preset.id, { topic: preset.topic, type: "network" });
31323
31336
  const colLaneIds = /* @__PURE__ */ new Map();
31324
31337
  const phaseActivate = [];
31325
31338
  let edgeIdx = 0;
@@ -31369,7 +31382,7 @@ function stateMachine2(preset) {
31369
31382
  const stateW = resolveStateW(preset.stateWidth, "stateMachine2");
31370
31383
  const laneW = boxLaneW(stateW);
31371
31384
  const tone = preset.defaultTone ?? "accent";
31372
- const b = diagram(preset.id, { topic: preset.topic });
31385
+ const b = diagram(preset.id, { topic: preset.topic, type: "state" });
31373
31386
  const stateOrder = /* @__PURE__ */ new Map();
31374
31387
  const phaseActivate = [];
31375
31388
  let transIdx = 0;