@cardenelabs/cdl 0.119.0 → 0.120.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,57 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.120.0] - 2026-10-02
9
+
10
+ ### Fixed
11
+
12
+ - **線の端に添える数が、線に近すぎて 1 つの帯に見えた** (#989)
13
+
14
+ [#984](https://github.com/cardene777/cdl/issues/984) で線の脇へ離す距離を 8 から 15 に広げたが、
15
+ 使う側は図を縮めて出すので足りなかった。
16
+ 見本帳はクラス図を 0.42 倍で出しており、15 は画面では 6 画素になる。
17
+ 字の高さが 8 画素なので、字 1 つ分も空いていなかった。
18
+
19
+ 余白を **字の箱の高さの半分** から導くようにした。
20
+ 縮めた後も字の半行分の空きが残り、字を大きくした図では余白も一緒に広がる。
21
+
22
+ | 何を | 前 | 後 |
23
+ |---|---|---|
24
+ | 印と字の余白 | 8 | 12 |
25
+ | 線の脇へ離す | 15 | 19 |
26
+ | 端から線に沿って戻る | 22 | 26 |
27
+
28
+ 線に沿って戻る距離が広がるので、縦に並ぶ箱の間隔も 4 ずつ広がる
29
+ (`端の字に要る線の長さ` を間隔の計算が引いているため)。
30
+
31
+ - **走る丸が端の印の中に入り、印に穴が開いたように見えた** (#988)
32
+
33
+ 丸の通り道が線そのもの (`edge.d`) だったので、丸が端まで行き着いて印の上に重なっていた。
34
+ 継承の線では輪郭だけの三角の中に濃い芯が入り、印に穴が開いたように読めた。
35
+
36
+ 同じ型は点線で 1 度直している。
37
+ 点線は端に粒が 1 つ出るので、線の方を端から 12 縮めて粒を隠した (`shrinkPathEnd`)。
38
+ 走る丸の通り道は縮めていなかった。
39
+
40
+ 通り道を両端で縮めるようにした。
41
+ 縮める長さは **印の長さに芯の半径を足した値** で、どちらも実装の定数から導く。
42
+
43
+ | 何を | 値の出どころ |
44
+ |---|---|
45
+ | 印の長さ | `EDGE_HEAD_MARKER_SIZE.既定` |
46
+ | 芯の半径 | `走る丸の半径.芯` |
47
+
48
+ 芯の半径を足すのは、丸の中心が印の外に出ても **芯の縁が印に掛かる** ため。
49
+ 印の長さだけ縮めた形は実際に三角の底に芯が触れていた。
50
+
51
+ 先頭を縮める処理 (`shrinkPathStart`) を、末尾を縮める処理と対にして足した。
52
+ 曲線は最初の制御点の向きへ送る = 弦を使うと、大きく膨らむ曲線で線が端から出ていく向きと
53
+ 別の向きになる。
54
+
55
+ **縮めると点に潰れる短い線は縮めない**。 潰れた通り道では丸が 1 点に止まって見え、
56
+ 走っていないのと区別が付かない。
57
+
58
+
8
59
  ## [0.119.0] - 2026-10-01
9
60
 
10
61
  ### Fixed
@@ -4727,7 +4778,8 @@ Initial OSS release.
4727
4778
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
4728
4779
  行き止まりになる。
4729
4780
 
4730
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.119.0...HEAD
4781
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.120.0...HEAD
4782
+ [0.120.0]: https://github.com/cardene777/cdl/compare/v0.119.0...v0.120.0
4731
4783
  [0.119.0]: https://github.com/cardene777/cdl/compare/v0.118.0...v0.119.0
4732
4784
  [0.118.0]: https://github.com/cardene777/cdl/compare/v0.117.0...v0.118.0
4733
4785
  [0.117.0]: https://github.com/cardene777/cdl/compare/v0.116.0...v0.117.0
package/dist/index.cjs CHANGED
@@ -15439,6 +15439,32 @@ function shrinkPathEnd(d, shrinkPx) {
15439
15439
  tokens[tokens.length - 1] = newEndY.toFixed(1);
15440
15440
  return tokens.join(" ");
15441
15441
  }
15442
+ function shrinkPathStart(d, shrinkPx) {
15443
+ const \u533A\u9593 = [...d.matchAll(/([MLCQZmlcqz])([^MLCQZmlcqz]*)/g)].map((m) => ({
15444
+ cmd: m[1],
15445
+ args: (m[2] ?? "").trim().split(/[\s,]+/).filter(Boolean).map(parseFloat)
15446
+ }));
15447
+ if (\u533A\u9593.length < 2) return d;
15448
+ const \u5148\u982D = \u533A\u9593[0];
15449
+ if (\u5148\u982D.cmd !== "M" || \u5148\u982D.args.length < 2) return d;
15450
+ const \u6B21 = \u533A\u9593[1];
15451
+ const \u5411\u304D\u5148 = \u6B21.cmd === "Q" || \u6B21.cmd === "C" ? { x: \u6B21.args[0], y: \u6B21.args[1] } : \u6B21.cmd === "L" || \u6B21.cmd === "M" ? { x: \u6B21.args[0], y: \u6B21.args[1] } : null;
15452
+ if (!\u5411\u304D\u5148 || !Number.isFinite(\u5411\u304D\u5148.x) || !Number.isFinite(\u5411\u304D\u5148.y)) return d;
15453
+ const x0 = \u5148\u982D.args[0];
15454
+ const y0 = \u5148\u982D.args[1];
15455
+ const dx = \u5411\u304D\u5148.x - x0;
15456
+ const dy = \u5411\u304D\u5148.y - y0;
15457
+ const len = Math.hypot(dx, dy);
15458
+ if (len < shrinkPx + 1) return d;
15459
+ const \u6BD4 = shrinkPx / len;
15460
+ const \u65B0x = x0 + dx * \u6BD4;
15461
+ const \u65B0y = y0 + dy * \u6BD4;
15462
+ const tokens = d.trim().split(/\s+/);
15463
+ if (tokens.length < 3) return d;
15464
+ tokens[1] = \u65B0x.toFixed(1);
15465
+ tokens[2] = \u65B0y.toFixed(1);
15466
+ return tokens.join(" ");
15467
+ }
15442
15468
  function pathSubpath(d, progress) {
15443
15469
  if (progress >= 1) return d;
15444
15470
  if (progress <= 0) {
@@ -21568,12 +21594,12 @@ function recomputeContainedLanes(lanes, nodes) {
21568
21594
  }
21569
21595
 
21570
21596
  // src/layout/head-label.ts
21571
- var \u7AEF\u306E\u5B57\u3068\u5370\u306E\u4F59\u767D = 8;
21597
+ var \u7AEF\u306E\u5B57\u306E\u5927\u304D\u3055 = EDGE_LABEL_TEXT.sub.fontSize;
21598
+ var \u7BB1\u306E\u9AD8\u3055 = Math.round(\u7AEF\u306E\u5B57\u306E\u5927\u304D\u3055 * 1.2);
21599
+ var \u7AEF\u306E\u5B57\u3068\u5370\u306E\u4F59\u767D = Math.round(\u7BB1\u306E\u9AD8\u3055 / 2);
21572
21600
  var \u7AEF\u306E\u5370\u306E\u5F35\u308A\u51FA\u3057 = EDGE_HEAD_MARKER_SIZE.\u65E2\u5B9A / 2;
21573
21601
  var \u7AEF\u306E\u5B57\u3092\u623B\u3059\u8DDD\u96E2 = EDGE_HEAD_MARKER_SIZE.\u65E2\u5B9A + \u7AEF\u306E\u5B57\u3068\u5370\u306E\u4F59\u767D;
21574
21602
  var \u7AEF\u306E\u5B57\u3068\u7DDA\u306E\u9699\u9593 = \u7AEF\u306E\u5370\u306E\u5F35\u308A\u51FA\u3057 + \u7AEF\u306E\u5B57\u3068\u5370\u306E\u4F59\u767D;
21575
- var \u7AEF\u306E\u5B57\u306E\u5927\u304D\u3055 = EDGE_LABEL_TEXT.sub.fontSize;
21576
- var \u7BB1\u306E\u9AD8\u3055 = Math.round(\u7AEF\u306E\u5B57\u306E\u5927\u304D\u3055 * 1.2);
21577
21603
  var BASELINE_RATIO = 0.8;
21578
21604
  var \u4E21\u7AEF\u306E\u5B57\u306E\u9593 = \u7AEF\u306E\u5B57\u3092\u623B\u3059\u8DDD\u96E2 * 2;
21579
21605
  function \u7AEF\u306E\u5B57\u306B\u8981\u308B\u7DDA\u306E\u9577\u3055(edge) {
@@ -24100,7 +24126,8 @@ function CdlEdgeView({
24100
24126
  const isPassThrough = isDotted && Boolean(edge.dThrough);
24101
24127
  const lineDotsD = isDotted ? shrinkPathEnd(edge.d, 12) : edge.d;
24102
24128
  const glowPathId = `cdl-edge-${edge.id}`;
24103
- const glowPathD = edge.d;
24129
+ const \u901A\u308A\u9053\u3092\u7E2E\u3081\u308B = EDGE_HEAD_MARKER_SIZE.\u65E2\u5B9A + \u8D70\u308B\u4E38\u306E\u534A\u5F84.\u82AF;
24130
+ const glowPathD = shrinkPathStart(shrinkPathEnd(edge.d, \u901A\u308A\u9053\u3092\u7E2E\u3081\u308B), \u901A\u308A\u9053\u3092\u7E2E\u3081\u308B);
24104
24131
  return /* @__PURE__ */ jsxRuntime.jsxs(
24105
24132
  "g",
24106
24133
  {
@@ -24163,7 +24190,7 @@ function CdlEdgeView({
24163
24190
  }
24164
24191
  ),
24165
24192
  flowing && !isDotted && /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "edge-flow", children: [
24166
- /* @__PURE__ */ jsxRuntime.jsx("path", { id: glowPathId, d: edge.d, fill: "none", stroke: "none" }),
24193
+ /* @__PURE__ */ jsxRuntime.jsx("path", { id: glowPathId, d: glowPathD, fill: "none", stroke: "none" }),
24167
24194
  /* @__PURE__ */ jsxRuntime.jsx(EdgeGlowCircles, { color, edgeId: edge.id })
24168
24195
  ] })
24169
24196
  ]
@@ -24207,10 +24234,11 @@ function SolidEdgePath({
24207
24234
  }
24208
24235
  );
24209
24236
  }
24237
+ var \u8D70\u308B\u4E38\u306E\u534A\u5F84 = { \u5916: 28, \u4E2D: 18, \u82AF: 11 };
24210
24238
  function EdgeGlowCircles({ color, edgeId }) {
24211
24239
  const ref = `#cdl-edge-${edgeId}`;
24212
24240
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-particle": edgeId, "data-cdl-particle-path-ref": ref, children: [
24213
- /* @__PURE__ */ jsxRuntime.jsxs("circle", { r: 28, fill: color, children: [
24241
+ /* @__PURE__ */ jsxRuntime.jsxs("circle", { r: \u8D70\u308B\u4E38\u306E\u534A\u5F84.\u5916, fill: color, children: [
24214
24242
  /* @__PURE__ */ jsxRuntime.jsx("animateMotion", { dur: "2s", begin: "-1s", repeatCount: "indefinite", rotate: "auto", children: /* @__PURE__ */ jsxRuntime.jsx("mpath", { href: ref }) }),
24215
24243
  /* @__PURE__ */ jsxRuntime.jsx(
24216
24244
  "animate",
@@ -24224,7 +24252,7 @@ function EdgeGlowCircles({ color, edgeId }) {
24224
24252
  }
24225
24253
  )
24226
24254
  ] }),
24227
- /* @__PURE__ */ jsxRuntime.jsxs("circle", { r: 18, fill: color, children: [
24255
+ /* @__PURE__ */ jsxRuntime.jsxs("circle", { r: \u8D70\u308B\u4E38\u306E\u534A\u5F84.\u4E2D, fill: color, children: [
24228
24256
  /* @__PURE__ */ jsxRuntime.jsx("animateMotion", { dur: "2s", begin: "-1s", repeatCount: "indefinite", rotate: "auto", children: /* @__PURE__ */ jsxRuntime.jsx("mpath", { href: ref }) }),
24229
24257
  /* @__PURE__ */ jsxRuntime.jsx(
24230
24258
  "animate",
@@ -24238,7 +24266,7 @@ function EdgeGlowCircles({ color, edgeId }) {
24238
24266
  }
24239
24267
  )
24240
24268
  ] }),
24241
- /* @__PURE__ */ jsxRuntime.jsxs("circle", { r: 11, fill: color, children: [
24269
+ /* @__PURE__ */ jsxRuntime.jsxs("circle", { r: \u8D70\u308B\u4E38\u306E\u534A\u5F84.\u82AF, fill: color, children: [
24242
24270
  /* @__PURE__ */ jsxRuntime.jsx("animateMotion", { dur: "2s", begin: "-1s", repeatCount: "indefinite", rotate: "auto", children: /* @__PURE__ */ jsxRuntime.jsx("mpath", { href: ref }) }),
24243
24271
  /* @__PURE__ */ jsxRuntime.jsx(
24244
24272
  "animate",