@cardenelabs/cdl 0.25.0 → 0.27.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,68 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.27.0] - 2026-09-04
9
+
10
+ ### Changed
11
+
12
+ - **高さの式の説明を印の有無で分けた** (#633)
13
+
14
+ 公開している `requiredRowsHeight` の説明が「`rows` を持つ node に必要な高さ」 と述べていたが、
15
+ 印を持つ箱は #631 から別の式で決まる。 読んだ人が印を持つ箱を 24 高く組まないよう、
16
+ 適用先を印を持たない箱に限定し、印を持つ箱がどこを起点にするかを 1 文で書いた。
17
+
18
+ 併せて、実在しない消費側の名指し (`dragon の sequence header 等`) を落とした。
19
+ 消費側を全件走査すると呼出は 0 件で、この記述は #631 より前から食い違っていた。
20
+
21
+ doc comment のみで、関数の中身と公開面は変えていない。
22
+
23
+ ### Fixed
24
+
25
+ - **行の縞が終わる位置から箱の下余白を取るようにした** (#631)
26
+
27
+ 行頭の印 (`rowMarks`) を持つ箱は、最後の行の中線から 76 下を下端にしていた。
28
+ 縞の帯は中線から 28 下で終わるため、差の 48 が行送り 56 に近い空の行 1 つに見えていた。
29
+ 縞が最後の行に乗る時は余白が面の色の帯に読め、乗らない時は最後の行が倍の高さに
30
+ 見えるため、どちらも行がそこで終わることを読めなかった。
31
+
32
+ 箱の下端を、最後の行に対応する縞の帯の下端から 24 下に置く。
33
+ 24 は箱の角の丸み 16 より大きく、これを下回ると縞の四角い角が丸みからはみ出して
34
+ 四隅に色が出る。
35
+ 余白は別の定数から足さず **帯から導く** ため、行送りを変えた時も字と帯だけが動いて
36
+ 余白が取り残されない。
37
+
38
+ 印を持たない箱の高さは変わらない。
39
+ `rowMarks` を持つ箱すべてに効き、組み立て器では `er()` / `stateMachine()` /
40
+ `classDiagram()` の 3 つが印を付ける。
41
+ 対象の箱は高さが 24 縮む。
42
+
43
+ ## [0.26.0] - 2026-09-03
44
+
45
+ ### Added
46
+
47
+ - **クラス図の箱にも行の縞と配色を通した** (#627)
48
+
49
+ クラス図の箱は ER 図と同じ作り (行頭の印 + 左に名前 + 右に型) をしている。
50
+ 名前と型が離れて並ぶので、行を横に追う目印が要るのは ER 図と同じだった。
51
+
52
+ `classDiagram` に `rowStripe` と `palette` を足し、既定を `er` と揃えた。
53
+ どちらも書けば上書きでき、`rowStripe: false` で縞を外せる。
54
+
55
+ ### Changed
56
+
57
+ - **行が 1 つの箱には縞を敷かなくなった** (#627)
58
+
59
+ 縞の役目は「隣り合う行を見分ける」 こと。
60
+ 1 行しか無い箱には見分ける相手が居ないので、敷くとその 1 行が「主役」 に見える。
61
+
62
+ 実際にクラス図へ当てて確かめると、1 行の箱 (`Auditable` / `Sku`) で縞が強調に読めた。
63
+ 2 行以上の箱では意図どおり行の区切りとして読めた。
64
+
65
+ 閾値ではなく **役目から導いた規則** なので、図種を増やしても同じ判断ができる。
66
+ 判定は描き手 (`storage.tsx`) が持つ = 組み立て器ごとに書くと、次の図種で取り残される。
67
+
68
+ ER 図にも同じ規則が効く (1 行の表で縞が消える)。
69
+
8
70
  ## [0.25.0] - 2026-09-03
9
71
 
10
72
  ### Added
@@ -1288,7 +1350,10 @@ Initial OSS release.
1288
1350
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
1289
1351
  行き止まりになる。
1290
1352
 
1291
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.24.0...HEAD
1353
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.27.0...HEAD
1354
+ [0.27.0]: https://github.com/cardene777/cdl/compare/v0.26.0...v0.27.0
1355
+ [0.26.0]: https://github.com/cardene777/cdl/compare/v0.25.0...v0.26.0
1356
+ [0.25.0]: https://github.com/cardene777/cdl/compare/v0.24.0...v0.25.0
1292
1357
  [0.24.0]: https://github.com/cardene777/cdl/compare/v0.23.0...v0.24.0
1293
1358
  [0.23.0]: https://github.com/cardene777/cdl/compare/v0.22.0...v0.23.0
1294
1359
  [0.22.0]: https://github.com/cardene777/cdl/compare/v0.21.2...v0.22.0
package/dist/index.cjs CHANGED
@@ -11838,6 +11838,7 @@ function rowGlyphDepth(kind) {
11838
11838
  return Math.ceil(font * ROW_GLYPH_DEPTH_RATIO);
11839
11839
  }
11840
11840
  var ROW_LAYOUT_BOTTOM_PAD = 20;
11841
+ var ROW_STRIPE_BOTTOM_PAD = 24;
11841
11842
  function requiredRowsHeight(kind, rowCount) {
11842
11843
  if (rowCount <= 0) return null;
11843
11844
  const lastBaseline = rowBaselineY(kind, rowCount - 1);
@@ -11845,6 +11846,12 @@ function requiredRowsHeight(kind, rowCount) {
11845
11846
  const pitch = kind === "storage" ? ROW_PITCH_STORAGE : ROW_PITCH_GENERIC;
11846
11847
  return lastBaseline + pitch + ROW_LAYOUT_BOTTOM_PAD;
11847
11848
  }
11849
+ function requiredMarkedRowsHeight(kind, rowCount) {
11850
+ if (rowCount <= 0) return null;
11851
+ const lastBand = rowStripeBand(kind, rowCount - 1, 0);
11852
+ if (lastBand === null) return null;
11853
+ return lastBand.y + lastBand.h + ROW_STRIPE_BOTTOM_PAD;
11854
+ }
11848
11855
  function isRenderedNode(n) {
11849
11856
  if (n.visibleIf === void 0 || n.visibleIf === "") return true;
11850
11857
  if (n.visibleIf.includes("{")) return true;
@@ -19967,7 +19974,10 @@ function autoStorageHeight(n, defaultH) {
19967
19974
  const \u7E70\u308A\u4E0A\u3052 = n.eyebrow ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052("storage");
19968
19975
  if (!n.rows || n.rows.length === 0) return 115 + \u547C\u3073\u540D\u306E\u5206 - \u7E70\u308A\u4E0A\u3052;
19969
19976
  const \u5FC5\u8981 = requiredRowsHeight("storage", n.rows.length) ?? defaultH;
19970
- if (\u5370\u3042\u308A) return \u5FC5\u8981 + \u547C\u3073\u540D\u306E\u5206;
19977
+ if (\u5370\u3042\u308A) {
19978
+ const \u5E2F\u304B\u3089\u5FC5\u8981 = requiredMarkedRowsHeight("storage", n.rows.length) ?? defaultH;
19979
+ return \u5E2F\u304B\u3089\u5FC5\u8981 + \u547C\u3073\u540D\u306E\u5206;
19980
+ }
19971
19981
  return Math.max(defaultH, \u5FC5\u8981);
19972
19982
  }
19973
19983
  function autoRowsWidth(n, defaultW) {
@@ -22766,6 +22776,7 @@ var ROW_GLYPH_CX = ROW_PAD_X_PX + ROW_GLYPH_HALF + 1;
22766
22776
  var ROW_GLYPH_LEAD = 40;
22767
22777
  var ROW_TYPE_FONT = 22;
22768
22778
  var SUBTITLE_BASELINE = 118;
22779
+ var STRIPE_MIN_ROWS = 2;
22769
22780
  var SUBTITLE_FONT = 20;
22770
22781
  var UNDERLINE_DROP = 7;
22771
22782
  function RowGlyph({ mark, x, y, color }) {
@@ -22823,7 +22834,7 @@ function StorageNode({
22823
22834
  strokeWidth: active ? 3 : 1.25
22824
22835
  }
22825
22836
  ),
22826
- node.rowStripe && rows.map((_, idx) => {
22837
+ node.rowStripe && rows.length >= STRIPE_MIN_ROWS && rows.map((_, idx) => {
22827
22838
  if (idx % 2 !== 0) return null;
22828
22839
  const \u5E2F = rowStripeBand("storage", idx, \u884C\u306E\u4E0B\u3052);
22829
22840
  if (!\u5E2F) return null;
@@ -30834,7 +30845,8 @@ function stripAccess(row) {
30834
30845
  function classDiagram(preset) {
30835
30846
  const classW = resolveStorageBoxW(preset.classWidth, "classDiagram", "classWidth");
30836
30847
  const tone = preset.defaultTone ?? "info";
30837
- const b = diagram(preset.id, { topic: preset.topic });
30848
+ const \u7E1E\u3092\u6577\u304F = preset.rowStripe ?? true;
30849
+ const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette });
30838
30850
  const classes = [];
30839
30851
  const phaseActivate = [];
30840
30852
  const \u7BB1 = [];
@@ -30882,7 +30894,9 @@ function classDiagram(preset) {
30882
30894
  // 種類の札は **書いた時だけ** 出す (#578)。 「クラス」 と書いた札は箱がクラスで
30883
30895
  // あることしか言わず、図の中の全ての箱に同じ字が並ぶ
30884
30896
  ...m.c.stereotype ? { eyebrow: m.c.stereotype } : {},
30885
- ...m.rows.length > 0 ? { rows: m.rows, rowMarks: m.rowMarks } : {}
30897
+ ...m.rows.length > 0 ? { rows: m.rows, rowMarks: m.rowMarks } : {},
30898
+ // 縞は行を持つ箱にだけ敷く (#627)。 行が無い箱に書いても描き手が読まない
30899
+ ...m.rows.length > 0 && \u7E1E\u3092\u6577\u304F ? { rowStripe: true } : {}
30886
30900
  });
30887
30901
  classes.push(m.c.id);
30888
30902
  phaseActivate.push(m.c.id);