@cardenelabs/cdl 0.114.0 → 0.115.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,36 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.115.0] - 2026-09-30
9
+
10
+ ### Fixed
11
+
12
+ - **木の兄弟どうしが遠くへ離れ、離れた 2 本の列に見えた** (#968)
13
+
14
+ 葉は `canvasW / 葉の数` で等分した区画の中央に置かれていた。
15
+ 区画は箱より広いので、葉が少ない図では兄弟が区画の幅だけ離れる。
16
+ 見本帳の `配布物の構成` は葉が 2 枚で、箱の縁の間が 196 空いていた。
17
+ 同じ図の段と段の隙間は 95 なので、横だけが縦の 2 倍になる。
18
+
19
+ 横の隙間を **段と段の隙間に揃えた**。
20
+ 木は根から下へ辿る図なので、間隔が 1 つの調子で揃っていないと系統が読めない。
21
+
22
+ | 図の形 | 横の隙間 (直す前 → 後) | 縦の隙間 |
23
+ |---|---|---|
24
+ | 葉 2 枚 | 196 → 95 | 95 |
25
+ | 葉 3 枚 | 84 → 84 (変わらない) | 95 |
26
+
27
+ **今より広げない**。 葉が多い図では区画の方が狭いので、そちらが効いて位置は動かない。
28
+ 頭打ちを外すと間隔が区画の 3 倍になり、最後の一様縮小が効いて箱まで小さくなる
29
+ (実測 = 葉 10 枚の図で箱の幅が 57.1 から 19.5 に縮んだ)。
30
+
31
+ 箱の幅を出す処理を置き場所より先に回した。
32
+ 端の葉がどれだけ幅を取るかは、名前と段から決まるので位置より先に出せる。
33
+
34
+ 見本帳 (`cardene777/dragon`) の `配布物の構成` は、札に対する中身の割合が
35
+ 横 66% から 52% に **下がる**。 兄弟が近づいたぶん中身が小さくなるためで、
36
+ 図が札の中で浮くのは札の大きさの話として別に扱う。
37
+
8
38
  ## [0.114.0] - 2026-09-30
9
39
 
10
40
  ### Fixed
@@ -4550,7 +4580,8 @@ Initial OSS release.
4550
4580
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
4551
4581
  行き止まりになる。
4552
4582
 
4553
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.114.0...HEAD
4583
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.115.0...HEAD
4584
+ [0.115.0]: https://github.com/cardene777/cdl/compare/v0.114.0...v0.115.0
4554
4585
  [0.114.0]: https://github.com/cardene777/cdl/compare/v0.113.0...v0.114.0
4555
4586
  [0.113.0]: https://github.com/cardene777/cdl/compare/v0.112.0...v0.113.0
4556
4587
  [0.112.0]: https://github.com/cardene777/cdl/compare/v0.111.0...v0.112.0
package/dist/index.cjs CHANGED
@@ -15931,6 +15931,28 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
15931
15931
  const \u8981\u308B = measureTextWidth(\u540D\u524D.text, { fontSize: \u540D\u524D.fontSize}) + (nodeW - \u4F7F\u3048\u308B\u5E45(nodeW));
15932
15932
  return Math.min(Math.max(\u8981\u308B, nodeW), slotW * 0.92);
15933
15933
  };
15934
+ const \u8449\u306E\u4E26\u3073 = [];
15935
+ const \u6BB5\u306E\u8868 = /* @__PURE__ */ new Map();
15936
+ const \u5E45\u306E\u8868 = /* @__PURE__ */ new Map();
15937
+ {
15938
+ const \u898B\u305F = /* @__PURE__ */ new Set();
15939
+ const \u4E0B\u898B = (n, depth) => {
15940
+ \u898B\u305F.add(n.id);
15941
+ \u6BB5\u306E\u8868.set(n.id, depth);
15942
+ \u5E45\u306E\u8868.set(n.id, \u7BB1\u306E\u5E45(n, depth));
15943
+ const kids = (childrenOf.get(n.id) ?? []).filter((k) => !\u898B\u305F.has(k.id));
15944
+ if (kids.length === 0) {
15945
+ \u8449\u306E\u4E26\u3073.push(n.id);
15946
+ return;
15947
+ }
15948
+ for (const k of kids) \u4E0B\u898B(k, depth + 1);
15949
+ };
15950
+ for (const r of roots) if (!\u898B\u305F.has(r.id)) \u4E0B\u898B(r, 0);
15951
+ }
15952
+ const \u8449\u306E\u6570 = Math.max(\u8449\u306E\u4E26\u3073.length, 1);
15953
+ const \u6BB5\u306E\u9699\u9593 = depthGap - nodeH;
15954
+ const \u8449\u306E\u9593\u9694 = Math.min(slotW, nodeW + \u6BB5\u306E\u9699\u9593);
15955
+ const \u8449\u306Ex = (i) => canvasW / 2 - (\u8449\u306E\u6570 - 1) * \u8449\u306E\u9593\u9694 / 2 + i * \u8449\u306E\u9593\u9694;
15934
15956
  const posOf = /* @__PURE__ */ new Map();
15935
15957
  const nodes = [];
15936
15958
  const placed = /* @__PURE__ */ new Set();
@@ -15940,7 +15962,7 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
15940
15962
  const kids = (childrenOf.get(n.id) ?? []).filter((k) => !placed.has(k.id));
15941
15963
  let x;
15942
15964
  if (kids.length === 0) {
15943
- x = leafCursor * slotW + slotW / 2;
15965
+ x = \u8449\u306Ex(leafCursor);
15944
15966
  leafCursor += 1;
15945
15967
  } else {
15946
15968
  const xs = kids.map((k) => place(k, depth + 1));
@@ -15954,7 +15976,7 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
15954
15976
  ...n.subtitle !== void 0 ? { subtitle: n.subtitle } : {},
15955
15977
  x,
15956
15978
  y,
15957
- w: \u7BB1\u306E\u5E45(n, depth),
15979
+ w: \u5E45\u306E\u8868.get(n.id) ?? \u7BB1\u306E\u5E45(n, depth),
15958
15980
  h: nodeH,
15959
15981
  depth,
15960
15982
  ...n.unresolved ? { unresolved: true } : {}