@cardenelabs/cdl 0.119.0 → 0.121.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,95 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.121.0] - 2026-10-02
9
+
10
+ ### Fixed
11
+
12
+ - **線の端に添える数が、縮めて出すと箱の中の字より一段小さく見えた** (#994)
13
+
14
+ 大きさを札の下の行 (`EDGE_LABEL_TEXT.sub.fontSize`) から引いていた。
15
+ 札は箱と箱の間に置くので縮めても読めるが、端の字は線の脇で単独に立つので同じ大きさでは負ける。
16
+ 見本帳はクラス図を 0.42 倍で出しており、19 は画面で 8 画素、箱の中の字は 11 画素だった。
17
+
18
+ 端の字の大きさを札から切り離して 26 にした。
19
+ 画面では 11 画素になり、箱の中の字と並ぶ。
20
+
21
+ あわせて **余白を字の大きさに連れて広げない形に戻した**。
22
+ [#989](https://github.com/cardene777/cdl/issues/989) は字の箱の高さの半分から導いていたので、
23
+ 字を 26 に上げると余白まで 16 に広がり、印の大きさは変わらないのに字だけが線から遠ざかった。
24
+ 実機で見た言葉は「間伸びしてる」 で、図も縦に伸びていた。
25
+ この余白が避ける相手は印で、印は字に連れて変わらないため、避ける幅も動かさない。
26
+
27
+ | 何を | 前 | 後 |
28
+ |---|---|---|
29
+ | 端の字の大きさ | 19 (札の下の行と同じ) | 26 (独立) |
30
+ | 印と字の余白 | 12 (箱の半分から導く) | 12 (据え置き) |
31
+ | 線の脇へ離す | 19 | 19 |
32
+ | 端から線に沿って戻る | 26 | 26 |
33
+
34
+ 線に沿って戻る距離は変えていないので、箱の間隔は字の箱が高くなった分 (23 から 31) だけ伸びる。
35
+
36
+ - **走る丸を太らせると端の印に食い込んだ** (#994)
37
+
38
+ 通り道を縮める幅を **芯の半径** で測っていた。
39
+ 使う側は紙の色の縁を回して玉を線から浮かせるので、実際の外側は芯より太い
40
+ (見本帳は 3.5 の縁を足しており、外側は芯 + 1.75 になる)。
41
+ 縁は CSS で足されるため描く側からは見えない。
42
+
43
+ 芯を 11 から 12 に上げ、縮める幅の基準を **玉の一番外の縁** (芯 + 縁の見込み 2) に変えた。
44
+ これより太い縁を足すと印に入るので、見込みの値は描く側が持つ。
45
+
46
+ ## [0.120.0] - 2026-10-02
47
+
48
+ ### Fixed
49
+
50
+ - **線の端に添える数が、線に近すぎて 1 つの帯に見えた** (#989)
51
+
52
+ [#984](https://github.com/cardene777/cdl/issues/984) で線の脇へ離す距離を 8 から 15 に広げたが、
53
+ 使う側は図を縮めて出すので足りなかった。
54
+ 見本帳はクラス図を 0.42 倍で出しており、15 は画面では 6 画素になる。
55
+ 字の高さが 8 画素なので、字 1 つ分も空いていなかった。
56
+
57
+ 余白を **字の箱の高さの半分** から導くようにした。
58
+ 縮めた後も字の半行分の空きが残り、字を大きくした図では余白も一緒に広がる。
59
+
60
+ | 何を | 前 | 後 |
61
+ |---|---|---|
62
+ | 印と字の余白 | 8 | 12 |
63
+ | 線の脇へ離す | 15 | 19 |
64
+ | 端から線に沿って戻る | 22 | 26 |
65
+
66
+ 線に沿って戻る距離が広がるので、縦に並ぶ箱の間隔も 4 ずつ広がる
67
+ (`端の字に要る線の長さ` を間隔の計算が引いているため)。
68
+
69
+ - **走る丸が端の印の中に入り、印に穴が開いたように見えた** (#988)
70
+
71
+ 丸の通り道が線そのもの (`edge.d`) だったので、丸が端まで行き着いて印の上に重なっていた。
72
+ 継承の線では輪郭だけの三角の中に濃い芯が入り、印に穴が開いたように読めた。
73
+
74
+ 同じ型は点線で 1 度直している。
75
+ 点線は端に粒が 1 つ出るので、線の方を端から 12 縮めて粒を隠した (`shrinkPathEnd`)。
76
+ 走る丸の通り道は縮めていなかった。
77
+
78
+ 通り道を両端で縮めるようにした。
79
+ 縮める長さは **印の長さに芯の半径を足した値** で、どちらも実装の定数から導く。
80
+
81
+ | 何を | 値の出どころ |
82
+ |---|---|
83
+ | 印の長さ | `EDGE_HEAD_MARKER_SIZE.既定` |
84
+ | 芯の半径 | `走る丸の半径.芯` |
85
+
86
+ 芯の半径を足すのは、丸の中心が印の外に出ても **芯の縁が印に掛かる** ため。
87
+ 印の長さだけ縮めた形は実際に三角の底に芯が触れていた。
88
+
89
+ 先頭を縮める処理 (`shrinkPathStart`) を、末尾を縮める処理と対にして足した。
90
+ 曲線は最初の制御点の向きへ送る = 弦を使うと、大きく膨らむ曲線で線が端から出ていく向きと
91
+ 別の向きになる。
92
+
93
+ **縮めると点に潰れる短い線は縮めない**。 潰れた通り道では丸が 1 点に止まって見え、
94
+ 走っていないのと区別が付かない。
95
+
96
+
8
97
  ## [0.119.0] - 2026-10-01
9
98
 
10
99
  ### Fixed
@@ -4727,7 +4816,9 @@ Initial OSS release.
4727
4816
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
4728
4817
  行き止まりになる。
4729
4818
 
4730
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.119.0...HEAD
4819
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.121.0...HEAD
4820
+ [0.121.0]: https://github.com/cardene777/cdl/compare/v0.120.0...v0.121.0
4821
+ [0.120.0]: https://github.com/cardene777/cdl/compare/v0.119.0...v0.120.0
4731
4822
  [0.119.0]: https://github.com/cardene777/cdl/compare/v0.118.0...v0.119.0
4732
4823
  [0.118.0]: https://github.com/cardene777/cdl/compare/v0.117.0...v0.118.0
4733
4824
  [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 = 26;
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 = 12;
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\u5916\u5074;
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,13 @@ function SolidEdgePath({
24207
24234
  }
24208
24235
  );
24209
24236
  }
24237
+ var \u8D70\u308B\u4E38\u306E\u534A\u5F84 = { \u5916: 28, \u4E2D: 18, \u82AF: 12 };
24238
+ var \u8D70\u308B\u4E38\u306E\u7E01\u306E\u898B\u8FBC\u307F = 2;
24239
+ var \u8D70\u308B\u4E38\u306E\u5916\u5074 = \u8D70\u308B\u4E38\u306E\u534A\u5F84.\u82AF + \u8D70\u308B\u4E38\u306E\u7E01\u306E\u898B\u8FBC\u307F;
24210
24240
  function EdgeGlowCircles({ color, edgeId }) {
24211
24241
  const ref = `#cdl-edge-${edgeId}`;
24212
24242
  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: [
24243
+ /* @__PURE__ */ jsxRuntime.jsxs("circle", { r: \u8D70\u308B\u4E38\u306E\u534A\u5F84.\u5916, fill: color, children: [
24214
24244
  /* @__PURE__ */ jsxRuntime.jsx("animateMotion", { dur: "2s", begin: "-1s", repeatCount: "indefinite", rotate: "auto", children: /* @__PURE__ */ jsxRuntime.jsx("mpath", { href: ref }) }),
24215
24245
  /* @__PURE__ */ jsxRuntime.jsx(
24216
24246
  "animate",
@@ -24224,7 +24254,7 @@ function EdgeGlowCircles({ color, edgeId }) {
24224
24254
  }
24225
24255
  )
24226
24256
  ] }),
24227
- /* @__PURE__ */ jsxRuntime.jsxs("circle", { r: 18, fill: color, children: [
24257
+ /* @__PURE__ */ jsxRuntime.jsxs("circle", { r: \u8D70\u308B\u4E38\u306E\u534A\u5F84.\u4E2D, fill: color, children: [
24228
24258
  /* @__PURE__ */ jsxRuntime.jsx("animateMotion", { dur: "2s", begin: "-1s", repeatCount: "indefinite", rotate: "auto", children: /* @__PURE__ */ jsxRuntime.jsx("mpath", { href: ref }) }),
24229
24259
  /* @__PURE__ */ jsxRuntime.jsx(
24230
24260
  "animate",
@@ -24238,7 +24268,7 @@ function EdgeGlowCircles({ color, edgeId }) {
24238
24268
  }
24239
24269
  )
24240
24270
  ] }),
24241
- /* @__PURE__ */ jsxRuntime.jsxs("circle", { r: 11, fill: color, children: [
24271
+ /* @__PURE__ */ jsxRuntime.jsxs("circle", { r: \u8D70\u308B\u4E38\u306E\u534A\u5F84.\u82AF, fill: color, children: [
24242
24272
  /* @__PURE__ */ jsxRuntime.jsx("animateMotion", { dur: "2s", begin: "-1s", repeatCount: "indefinite", rotate: "auto", children: /* @__PURE__ */ jsxRuntime.jsx("mpath", { href: ref }) }),
24243
24273
  /* @__PURE__ */ jsxRuntime.jsx(
24244
24274
  "animate",