@cardenelabs/cdl 0.116.0 → 0.118.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,77 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.118.0] - 2026-10-01
9
+
10
+ ### Fixed
11
+
12
+ - **呼び名を書いた箱の下の余白が、上の 2 倍空いていた** (#974)
13
+
14
+ `storage` の箱に呼び名 (`subtitle`) を書くと、字が上に貼り付いて箱が下に間延びしていた。
15
+
16
+ | 書き方 | 箱の高さ | 上の余白 | 下の余白 |
17
+ |---|---|---|---|
18
+ | 名前だけ | 79 | 揃う | 揃う |
19
+ | 小見出し + 名前 | 115 | 揃う | 揃う |
20
+ | 名前 + 説明 | 125 | 17 | 39 |
21
+ | 小見出し + 名前 + 説明 | 161 | 21 | 39 |
22
+
23
+ 許容は 7 なので、呼び名を書いた 2 通りだけが外れていた。
24
+
25
+ 高さを決める側が、呼び名の分として **行の群を下げる幅** (`SUBTITLE_ROW_SHIFT` = 46) を
26
+ そのまま足していた。 46 は行を持つ箱で行の塊を何 world 下げるかの値で、
27
+ **行を持たない箱には下げる相手が居ない**。
28
+
29
+ 足すべきなのは字の塊の下端が下がる分になる。
30
+ 下端は題の字形の底から呼び名の字形の底へ移るので、baseline の差に字形の深さの差を足す。
31
+
32
+ ```
33
+ 呼び名で伸びる量 = (呼び名の baseline 118 - 題の baseline 86)
34
+ + (呼び名の級 20 - 題の級 34) × 字形の深さの割合 0.4
35
+ = 26
36
+ ```
37
+
38
+ 呼び名の方が字が小さいぶん深さは浅いので、差は引き算になる。
39
+
40
+ | 書き方 | 直す前 | 直した後 |
41
+ |---|---|---|
42
+ | 名前 + 説明 | 125 | 105 |
43
+ | 小見出し + 名前 + 説明 | 161 | 141 |
44
+
45
+ **行を持つ箱は触っていない**。 そちらの 46 は行の塊を下げる分として正しく、
46
+ 描く側の下げ幅と対になっている。
47
+
48
+ 呼び名の baseline と級は `layout/spec.ts` に移した。
49
+ 描く側と高さを出す側が同じ値を読む形にしないと、片方だけ動いて箱の下が空く。
50
+
51
+ ## [0.117.0] - 2026-10-01
52
+
53
+ ### Fixed
54
+
55
+ - **位置を手で書いた箱に、自動で並べた時の揃えの規則を当てていた** (#972)
56
+
57
+ 揃えを見る 2 軸が「レーンの中の箱は縦 1 列に並ぶ」 前提を持っていた。
58
+
59
+ | 軸 | 何を見るか | 重さ |
60
+ |---|---|---|
61
+ | `alignment` (軸 5) | 同じレーンの箱の中心の横位置が揃っているか | error |
62
+ | `column-alignment` (軸 58) | 同じ縦列の箱の中心の横位置が許容 1 以内で揃っているか | error |
63
+
64
+ `posX` と `posY` を両方書いた箱は **その並びから外して置く** ためにある。
65
+ 外して置いたこと自体を違反として数えるので、意図どおりの図が毎回落ちていた。
66
+
67
+ 同じ条件は軸 15 (`lane-cx-consistency`) が元から持っており、そちらだけ直っていた。
68
+ その 1 行を `位置を手で書いた` として括り出し、3 軸で同じ条件を使う。
69
+
70
+ **基準の箱も先に外す**。 判定だけを外すと、レーンの先頭の箱が手で置かれていた時に
71
+ 自動で置いた箱が全部その位置と比べられて落ちる。
72
+
73
+ 片方だけ書いた箱は外さない。 採用の条件が
74
+ `posX !== undefined && posY !== undefined` なので、片方だけでは自動の配置が生きており、
75
+ 並びから外す指定にならない。
76
+
77
+ 描く位置は変えていない。 変えたのは判定だけで、焼き付けた見た目は動かない。
78
+
8
79
  ## [0.116.0] - 2026-10-01
9
80
 
10
81
  ### Fixed
@@ -4618,7 +4689,9 @@ Initial OSS release.
4618
4689
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
4619
4690
  行き止まりになる。
4620
4691
 
4621
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.116.0...HEAD
4692
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.118.0...HEAD
4693
+ [0.118.0]: https://github.com/cardene777/cdl/compare/v0.117.0...v0.118.0
4694
+ [0.117.0]: https://github.com/cardene777/cdl/compare/v0.116.0...v0.117.0
4622
4695
  [0.116.0]: https://github.com/cardene777/cdl/compare/v0.115.0...v0.116.0
4623
4696
  [0.115.0]: https://github.com/cardene777/cdl/compare/v0.114.0...v0.115.0
4624
4697
  [0.114.0]: https://github.com/cardene777/cdl/compare/v0.113.0...v0.114.0
package/dist/index.cjs CHANGED
@@ -12589,11 +12589,16 @@ var ROW_FONT_GENERIC = 21;
12589
12589
  var STORAGE_TITLE_BASELINE = 86;
12590
12590
  var STORAGE_TITLE_FONT = 34;
12591
12591
  var SUBTITLE_ROW_SHIFT = 46;
12592
+ var STORAGE_SUBTITLE_BASELINE = 118;
12593
+ var STORAGE_SUBTITLE_FONT = 20;
12592
12594
  var STORAGE_ROW_DIVIDER_Y = Math.round(
12593
12595
  (STORAGE_TITLE_BASELINE + (ROW_TOP_STORAGE - ROW_FONT_STORAGE * GLYPH_CAP_RATIO)) / 2
12594
12596
  );
12595
12597
  var ROW_GLYPH_DEPTH_RATIO = 0.4;
12596
12598
  var TITLE_ROW_MIN_GAP = GENERIC_TITLE_FONT * ROW_GLYPH_DEPTH_RATIO + ROW_FONT_GENERIC * GLYPH_CAP_RATIO;
12599
+ var \u547C\u3073\u540D\u3067\u4F38\u3073\u308B\u91CF = Math.round(
12600
+ STORAGE_SUBTITLE_BASELINE - STORAGE_TITLE_BASELINE + (STORAGE_SUBTITLE_FONT - STORAGE_TITLE_FONT) * ROW_GLYPH_DEPTH_RATIO
12601
+ );
12597
12602
  function rowGlyphDepth(kind) {
12598
12603
  if (!rendersRows(kind)) return null;
12599
12604
  const font = kind === "storage" ? ROW_FONT_STORAGE : ROW_FONT_GENERIC;
@@ -17347,6 +17352,9 @@ function visualValidateInner(laid, diag, violations, counts, push, profile, skip
17347
17352
  return { diagramId: safeDiagramId(diag), ok: false, violations, counts, profile, skippedAxes };
17348
17353
  }
17349
17354
  }
17355
+ function \u4F4D\u7F6E\u3092\u624B\u3067\u66F8\u3044\u305F(n) {
17356
+ return n.posX !== void 0 && n.posY !== void 0;
17357
+ }
17350
17358
  function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5668) {
17351
17359
  const LIFELINE_W_THRESHOLD = 8;
17352
17360
  for (const n of laid.nodes) {
@@ -17420,6 +17428,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
17420
17428
  }
17421
17429
  const byLane = /* @__PURE__ */ new Map();
17422
17430
  for (const n of laid.nodes) {
17431
+ if (\u4F4D\u7F6E\u3092\u624B\u3067\u66F8\u3044\u305F(n)) continue;
17423
17432
  const list = byLane.get(n.lane) ?? [];
17424
17433
  list.push(n);
17425
17434
  byLane.set(n.lane, list);
@@ -17764,6 +17773,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
17764
17773
  const byLaneCol = /* @__PURE__ */ new Map();
17765
17774
  for (const n of laid.nodes) {
17766
17775
  if (n.id.endsWith("-spacer") || /^s\d+-/.test(n.id)) continue;
17776
+ if (\u4F4D\u7F6E\u3092\u624B\u3067\u66F8\u3044\u305F(n)) continue;
17767
17777
  const list = byLaneCol.get(n.lane) ?? [];
17768
17778
  list.push(n);
17769
17779
  byLaneCol.set(n.lane, list);
@@ -17840,7 +17850,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
17840
17850
  for (const l of laid.lanes) laneById.set(l.id, l);
17841
17851
  for (const n of laid.nodes) {
17842
17852
  if (n.id.endsWith("-spacer") || /^s\d+-/.test(n.id)) continue;
17843
- if (n.posX !== void 0 && n.posY !== void 0) continue;
17853
+ if (\u4F4D\u7F6E\u3092\u624B\u3067\u66F8\u3044\u305F(n)) continue;
17844
17854
  const lane = laneById.get(n.lane);
17845
17855
  if (!lane) continue;
17846
17856
  const laneCx = lane.x + lane.width / 2;
@@ -21644,7 +21654,9 @@ function autoStorageHeight(n, defaultH) {
21644
21654
  const \u5370\u3042\u308A = n.rowMarks !== void 0;
21645
21655
  const \u547C\u3073\u540D\u306E\u5206 = n.subtitle ? SUBTITLE_ROW_SHIFT : 0;
21646
21656
  const \u7E70\u308A\u4E0A\u3052 = n.eyebrow ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052("storage");
21647
- if (!n.rows || n.rows.length === 0) return 115 + \u547C\u3073\u540D\u306E\u5206 - \u7E70\u308A\u4E0A\u3052;
21657
+ if (!n.rows || n.rows.length === 0) {
21658
+ return 115 + (n.subtitle ? \u547C\u3073\u540D\u3067\u4F38\u3073\u308B\u91CF : 0) - \u7E70\u308A\u4E0A\u3052;
21659
+ }
21648
21660
  const \u5FC5\u8981 = requiredRowsHeight("storage", n.rows.length) ?? defaultH;
21649
21661
  if (\u5370\u3042\u308A) {
21650
21662
  const \u5E2F\u304B\u3089\u5FC5\u8981 = requiredMarkedRowsHeight("storage", n.rows.length) ?? defaultH;
@@ -24921,9 +24933,9 @@ var ROW_GLYPH_HALF = 7;
24921
24933
  var ROW_GLYPH_CX = ROW_PAD_X_PX + ROW_GLYPH_HALF + 1;
24922
24934
  var ROW_GLYPH_LEAD = 40;
24923
24935
  var ROW_TYPE_FONT = 22;
24924
- var SUBTITLE_BASELINE = 118;
24936
+ var SUBTITLE_BASELINE = STORAGE_SUBTITLE_BASELINE;
24925
24937
  var STRIPE_MIN_ROWS = 2;
24926
- var SUBTITLE_FONT = 20;
24938
+ var SUBTITLE_FONT = STORAGE_SUBTITLE_FONT;
24927
24939
  var UNDERLINE_DROP = 7;
24928
24940
  function RowGlyph({ mark, x, y, color }) {
24929
24941
  const \u534A = ROW_GLYPH_HALF;