@cardenelabs/cdl 0.42.0 → 0.43.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,39 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.43.0] - 2026-09-10
9
+
10
+ ### Fixed
11
+
12
+ - **帯の間隔を箱の縁から数えるようにした** (#789)
13
+
14
+ 帯 (lane) の間隔は、辺の名札を入れるのに要る隙間から決まる。 その隙間の式は
15
+ `名札の幅 + 箱と名札の余白 32 × 2 + 経路の突き出し 40 × 2` で、内訳はどれも
16
+ **箱の縁** が起点になる。 それを 帯の縁 から数えていたため、
17
+ `(帯の幅 − 箱の幅) / 2` を 2 枚分 余計に空けていた。
18
+
19
+ ただし 2 対以上を跨ぐ辺は別で、名札が途中の帯の内側にも入りうる。 その帯は
20
+ 軸 64 `lane-border-clearance` の対象なので、跨ぐ辺だけは 帯の縁 のまま残す。
21
+ 隣り合う 2 帯を結ぶ辺の名札は発着の 2 帯に閉じるので、軸 64 は元から見ていない。
22
+
23
+ 下流の見本帳 444 枚での実測。
24
+
25
+ | 何を | 前 | 後 |
26
+ |---|---|---|
27
+ | 幅が変わった図 | — | 78 枚 (広がった図は 0 枚) |
28
+ | その 78 枚の幅の合計 | 126,204 | 118,721 |
29
+ | 軸 23 `responsive-viewport` | 16 件 | 12 件 |
30
+ | 軸 64 `lane-border-clearance` | 0 件 | 0 件 |
31
+ | 軸 65 `row-gap-uniform` | 0 件 | 0 件 |
32
+
33
+ 最も縮んだのは `swim-demo` の 2148 → 1848 で、親の幅 1100px での箱の題が
34
+ 11.3px から 13.1px になる。
35
+
36
+ **余りに頼っていた図が 2 枚出る**。 名札を 2 枚以上 同じ隙間に置く図は、
37
+ 1 枚分しか確保しない式では元から足りておらず、余りがそれを隠していた
38
+ (実測 = `interactive-traffic-sankey` で 3 件、`animation-rich-order-status-flow` で 1 件)。
39
+ 帯の位置を書き手が広げれば消える。
40
+
8
41
  ## [0.42.0] - 2026-09-10
9
42
 
10
43
  ### Fixed
@@ -2196,7 +2229,8 @@ Initial OSS release.
2196
2229
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
2197
2230
  行き止まりになる。
2198
2231
 
2199
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.42.0...HEAD
2232
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.43.0...HEAD
2233
+ [0.43.0]: https://github.com/cardene777/cdl/compare/v0.42.0...v0.43.0
2200
2234
  [0.42.0]: https://github.com/cardene777/cdl/compare/v0.41.1...v0.42.0
2201
2235
  [0.41.1]: https://github.com/cardene777/cdl/compare/v0.41.0...v0.41.1
2202
2236
  [0.41.0]: https://github.com/cardene777/cdl/compare/v0.40.12...v0.41.0
package/dist/index.cjs CHANGED
@@ -20217,7 +20217,8 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
20217
20217
  const nodeById = new Map(nodes.map((n) => [n.id, n]));
20218
20218
  const sortedByX = [...layoutedLanes].sort((a, b) => a.x - b.x);
20219
20219
  const laneIndexById = new Map(sortedByX.map((lane, i) => [lane.id, i]));
20220
- const requiredBoxWByPair = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
20220
+ const requiredBoxWAdjacent = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
20221
+ const requiredBoxWSpanning = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
20221
20222
  for (const edge of edges) {
20222
20223
  const fromLane = nodeById.get(edge.from)?.lane;
20223
20224
  const toLane = nodeById.get(edge.to)?.lane;
@@ -20229,23 +20230,33 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
20229
20230
  if (labelBoxW === 0) continue;
20230
20231
  const lo = Math.min(fi, ti);
20231
20232
  const hi = Math.max(fi, ti);
20233
+ const \u8981\u6C42 = hi - lo === 1 ? requiredBoxWAdjacent : requiredBoxWSpanning;
20232
20234
  for (let pair = lo; pair < hi; pair++) {
20233
- if (labelBoxW > requiredBoxWByPair[pair]) requiredBoxWByPair[pair] = labelBoxW;
20235
+ if (labelBoxW > \u8981\u6C42[pair]) \u8981\u6C42[pair] = labelBoxW;
20234
20236
  }
20235
20237
  }
20238
+ const \u7BB1\u306E\u534A\u5E45 = /* @__PURE__ */ new Map();
20239
+ for (const n of nodes) {
20240
+ const \u4ECA = \u7BB1\u306E\u534A\u5E45.get(n.lane) ?? 0;
20241
+ if (n.w / 2 > \u4ECA) \u7BB1\u306E\u534A\u5E45.set(n.lane, n.w / 2);
20242
+ }
20236
20243
  const requiredPitchByPair = [];
20237
20244
  for (let i = 0; i < sortedByX.length - 1; i++) {
20238
20245
  const lane = sortedByX[i];
20239
20246
  const rightLane = sortedByX[i + 1];
20240
- const halfSum = lane.width / 2 + rightLane.width / 2;
20247
+ const laneHalfSum = lane.width / 2 + rightLane.width / 2;
20248
+ const nodeHalfSum = (\u7BB1\u306E\u534A\u5E45.get(lane.id) ?? 0) + (\u7BB1\u306E\u534A\u5E45.get(rightLane.id) ?? 0);
20241
20249
  const currentPitch = rightLane.x + rightLane.width / 2 - (lane.x + lane.width / 2);
20242
- const maxLabelBoxW = requiredBoxWByPair[i];
20243
- if (maxLabelBoxW === 0) {
20250
+ const \u96A3 = requiredBoxWAdjacent[i];
20251
+ const \u8DE8 = requiredBoxWSpanning[i];
20252
+ if (\u96A3 === 0 && \u8DE8 === 0) {
20244
20253
  requiredPitchByPair.push(currentPitch);
20245
20254
  continue;
20246
20255
  }
20247
- const requiredGap = maxLabelBoxW + CLEARANCE_NODE_LABEL * 2 + EDGE_STUB_OUT * 2;
20248
- requiredPitchByPair.push(Math.max(currentPitch, requiredGap + halfSum));
20256
+ const \u4E0A\u4E57\u305B = CLEARANCE_NODE_LABEL * 2 + EDGE_STUB_OUT * 2;
20257
+ const \u96A3\u306E\u8981\u6C42 = \u96A3 === 0 ? 0 : \u96A3 + \u4E0A\u4E57\u305B + nodeHalfSum;
20258
+ const \u8DE8\u306E\u8981\u6C42 = \u8DE8 === 0 ? 0 : \u8DE8 + \u4E0A\u4E57\u305B + laneHalfSum;
20259
+ requiredPitchByPair.push(Math.max(currentPitch, \u96A3\u306E\u8981\u6C42, \u8DE8\u306E\u8981\u6C42));
20249
20260
  }
20250
20261
  const targetPitch = Math.ceil(Math.max(...requiredPitchByPair));
20251
20262
  const shiftedXById = /* @__PURE__ */ new Map();