@cardenelabs/cdl 0.72.0 → 0.73.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,34 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.73.0] - 2026-09-26
9
+
10
+ ### Fixed
11
+
12
+ - **縮めた絵の中の字を指定どおりの大きさで描くようにした** (#871 / #884)
13
+
14
+ 入れ子の絵は決まった大きさで組んでから、箱に収まる倍率で丸ごと縮めている。
15
+ 字も一緒に縮むので、指定した大きさより小さく描かれていた。
16
+
17
+ ```
18
+ <g transform="translate(288.07 59.79) scale(0.7190297684674752)">
19
+ ハッシュ / 直前 / 木の根 / ノンス 指定 10.5 × 0.719 = 実効 7.55
20
+ ```
21
+
22
+ 包む側 (`fitArt`) が倍率を絵へ渡せるようにした。
23
+ 関数を渡さない絵は今までどおり縮むだけで、1 つも描き方が変わらない。
24
+
25
+ **包む側で一律に打ち消さない** = 絵が自分で計算している「その字が収まる幅」 が指定の
26
+ 大きさのまま残り、字だけ大きくなって切った字が枠から出る。
27
+ 打ち消すかどうかは絵に決めさせる。
28
+
29
+ 連鎖の箱 (`shape-blockchain-block`) を打ち消す側にした。
30
+ 幅の予算も打ち消した後の大きさで計算する。
31
+
32
+ 上限は絵の中の帯から出す。
33
+ 5 行は 22 ずつ空けて並び、見出しは高さ 32 の帯に乗るので、字がその 8 割を超えると
34
+ 上下の行や帯の縁に触れる。 小さいほうを採って 1.6 倍で止める。
35
+
8
36
  ## [0.72.0] - 2026-09-26
9
37
 
10
38
  ### Fixed
@@ -3024,7 +3052,8 @@ Initial OSS release.
3024
3052
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
3025
3053
  行き止まりになる。
3026
3054
 
3027
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.72.0...HEAD
3055
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.73.0...HEAD
3056
+ [0.73.0]: https://github.com/cardene777/cdl/compare/v0.72.0...v0.73.0
3028
3057
  [0.72.0]: https://github.com/cardene777/cdl/compare/v0.71.0...v0.72.0
3029
3058
  [0.71.0]: https://github.com/cardene777/cdl/compare/v0.70.0...v0.71.0
3030
3059
  [0.70.0]: https://github.com/cardene777/cdl/compare/v0.69.0...v0.70.0
package/dist/index.cjs CHANGED
@@ -14596,20 +14596,21 @@ function fitLabel(band, block, pos) {
14596
14596
  };
14597
14597
  }
14598
14598
  function fitArt(region, extent, art) {
14599
+ const \u7D44\u3080 = (k) => typeof art === "function" ? art(k) : art;
14599
14600
  const \u7E26 = extent.\u4E0A + extent.\u4E0B;
14600
14601
  const \u6A2A = extent.\u5DE6 + extent.\u53F3;
14601
- if (!Number.isFinite(\u7E26) || !Number.isFinite(\u6A2A) || \u7E26 <= 0 || \u6A2A <= 0) return art;
14602
+ if (!Number.isFinite(\u7E26) || !Number.isFinite(\u6A2A) || \u7E26 <= 0 || \u6A2A <= 0) return \u7D44\u3080(1);
14602
14603
  if (!Number.isFinite(region.availH) || !Number.isFinite(region.availW) || region.availH <= 0 || region.availW <= 0) {
14603
- return art;
14604
+ return \u7D44\u3080(1);
14604
14605
  }
14605
14606
  const s = Math.min(1, region.availH / \u7E26, region.availW / \u6A2A);
14606
- if (!Number.isFinite(s) || s <= 0) return art;
14607
+ if (!Number.isFinite(s) || s <= 0) return \u7D44\u3080(1);
14607
14608
  const \u7D75cx = region.cx + (extent.\u53F3 - extent.\u5DE6) / 2;
14608
14609
  const \u7D75cy = region.cy + (extent.\u4E0B - extent.\u4E0A) / 2;
14609
14610
  const dx = region.cx - s * \u7D75cx;
14610
14611
  const dy = region.cy - s * \u7D75cy;
14611
- if (s >= 1 && dx === 0 && dy === 0) return art;
14612
- return /* @__PURE__ */ jsxRuntime.jsx("g", { transform: `translate(${dx} ${dy}) scale(${s})`, children: art });
14612
+ if (s >= 1 && dx === 0 && dy === 0) return \u7D44\u3080(1);
14613
+ return /* @__PURE__ */ jsxRuntime.jsx("g", { transform: `translate(${dx} ${dy}) scale(${s})`, children: \u7D44\u3080(s) });
14613
14614
  }
14614
14615
 
14615
14616
  // src/render/tone.ts
@@ -29843,6 +29844,20 @@ var SMART_CONTRACT_W = 220;
29843
29844
  var SMART_CONTRACT_H = 220;
29844
29845
  var BLOCK_W = 240;
29845
29846
  var BLOCK_H = 220;
29847
+ var \u898B\u51FA\u3057\u306E\u5B57 = 13;
29848
+ var \u540D\u306E\u5B57 = 10.5;
29849
+ var \u5024\u306E\u5B57 = 11;
29850
+ var \u884C\u306E\u9593\u9694 = 22;
29851
+ var \u898B\u51FA\u3057\u306E\u5E2F = 32;
29852
+ var \u5E2F\u306B\u5BFE\u3059\u308B\u4E0A\u9650 = 0.8;
29853
+ function \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(k) {
29854
+ const \u623B\u3057 = Number.isFinite(k) && k > 0 ? 1 / k : 1;
29855
+ const \u4E0A\u9650 = Math.min(
29856
+ \u884C\u306E\u9593\u9694 * \u5E2F\u306B\u5BFE\u3059\u308B\u4E0A\u9650 / \u5024\u306E\u5B57,
29857
+ \u898B\u51FA\u3057\u306E\u5E2F * \u5E2F\u306B\u5BFE\u3059\u308B\u4E0A\u9650 / \u898B\u51FA\u3057\u306E\u5B57
29858
+ );
29859
+ return Math.max(1, Math.min(\u623B\u3057, \u4E0A\u9650));
29860
+ }
29846
29861
  var BLOCK_SHADOW = 6;
29847
29862
  var NFT_W = 220;
29848
29863
  var NFT_H = 240;
@@ -30018,23 +30033,29 @@ function ShapeBlockchainBlockNode({ node, active, lang }) {
30018
30033
  };
30019
30034
  });
30020
30035
  const \u898B\u51FA\u3057\u306E\u5E45 = bw - 14 - 30;
30021
- const art = /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
30022
- /* @__PURE__ */ jsxRuntime.jsx("rect", { x: x + 6, y: y + 6, width: bw, height: bh, rx: 8, fill: frame.stroke, opacity: 0.2, stroke: "none" }),
30023
- /* @__PURE__ */ jsxRuntime.jsx("rect", { "data-cdl-role": "node-body", x, y, width: bw, height: bh, rx: 8, ...frame }),
30024
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: `M ${x} ${y + 32} L ${x} ${y + 8} Q ${x} ${y}, ${x + 8} ${y} L ${x + bw - 8} ${y} Q ${x + bw} ${y}, ${x + bw} ${y + 8} L ${x + bw} ${y + 32} Z`, fill: "var(--cdl-tone-accent, #2d6a8f)", fillOpacity: 0.9, stroke: "none" }),
30025
- /* @__PURE__ */ jsxRuntime.jsx("text", { "data-cdl-role": "blockchain-block-title", x: x + 14, y: y + 22, fontSize: 13, fontWeight: 700, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", fill: "#ffffff", children: \u5E45\u3067\u5207\u308B(\u898B\u51FA\u3057, 13, \u898B\u51FA\u3057\u306E\u5E45, \u5B57\u306E\u5E45) }),
30026
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x + bw - 16, cy: y + 16, r: 5.5, fill: "#7cd88f", stroke: "#ffffff", strokeWidth: 1.5 }),
30027
- fields.map((f, i) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
30028
- /* @__PURE__ */ jsxRuntime.jsx("text", { x: x + 14, y: y + 54 + i * 22, fontSize: 10.5, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", fill: "var(--cdl-text-dim, #5a6270)", children: f.label }),
30029
- /* @__PURE__ */ jsxRuntime.jsx("text", { "data-cdl-role": `blockchain-block-${f.key}`, x: x + bw - 14, y: y + 54 + i * 22, fontSize: 11, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", fontWeight: 600, textAnchor: "end", fill: "var(--cdl-text, #1a1f2a)", children: \u5E45\u3067\u5207\u308B(f.value, 11, bw - 28 - \u5B57\u306E\u5E45(f.label, 10.5) - 8, \u5B57\u306E\u5E45) }),
30030
- /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x + 14, y1: y + 60 + i * 22, x2: x + bw - 14, y2: y + 60 + i * 22, stroke: "var(--cdl-divider, #d4d4d8)", strokeWidth: 0.5, opacity: 0.5 })
30031
- ] }, i)),
30032
- /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${cx - 32}, ${y + bh - 26})`, children: [
30033
- /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: 0, width: 22, height: 18, rx: 3, fill: "none", stroke: frame.stroke, strokeWidth: 1.5 }),
30034
- /* @__PURE__ */ jsxRuntime.jsx("line", { x1: 22, y1: 9, x2: 42, y2: 9, stroke: frame.stroke, strokeWidth: 1.5 }),
30035
- /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 42, y: 0, width: 22, height: 18, rx: 3, fill: "var(--cdl-tone-accent, #2d6a8f)", fillOpacity: 0.5, stroke: frame.stroke, strokeWidth: 1.5 })
30036
- ] })
30037
- ] });
30036
+ const art = (\u500D\u7387) => {
30037
+ const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387);
30038
+ const \u984C\u306E\u5927\u304D\u3055 = \u898B\u51FA\u3057\u306E\u5B57 * \u500D;
30039
+ const \u540D\u306E\u5927\u304D\u3055 = \u540D\u306E\u5B57 * \u500D;
30040
+ const \u5024\u306E\u5927\u304D\u3055 = \u5024\u306E\u5B57 * \u500D;
30041
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
30042
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: x + 6, y: y + 6, width: bw, height: bh, rx: 8, fill: frame.stroke, opacity: 0.2, stroke: "none" }),
30043
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { "data-cdl-role": "node-body", x, y, width: bw, height: bh, rx: 8, ...frame }),
30044
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: `M ${x} ${y + 32} L ${x} ${y + 8} Q ${x} ${y}, ${x + 8} ${y} L ${x + bw - 8} ${y} Q ${x + bw} ${y}, ${x + bw} ${y + 8} L ${x + bw} ${y + 32} Z`, fill: "var(--cdl-tone-accent, #2d6a8f)", fillOpacity: 0.9, stroke: "none" }),
30045
+ /* @__PURE__ */ jsxRuntime.jsx("text", { "data-cdl-role": "blockchain-block-title", x: x + 14, y: y + 22, fontSize: \u984C\u306E\u5927\u304D\u3055, fontWeight: 700, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", fill: "#ffffff", children: \u5E45\u3067\u5207\u308B(\u898B\u51FA\u3057, \u984C\u306E\u5927\u304D\u3055, \u898B\u51FA\u3057\u306E\u5E45, \u5B57\u306E\u5E45) }),
30046
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x + bw - 16, cy: y + 16, r: 5.5, fill: "#7cd88f", stroke: "#ffffff", strokeWidth: 1.5 }),
30047
+ fields.map((f, i) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
30048
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: x + 14, y: y + 54 + i * \u884C\u306E\u9593\u9694, fontSize: \u540D\u306E\u5927\u304D\u3055, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", fill: "var(--cdl-text-dim, #5a6270)", children: f.label }),
30049
+ /* @__PURE__ */ jsxRuntime.jsx("text", { "data-cdl-role": `blockchain-block-${f.key}`, x: x + bw - 14, y: y + 54 + i * \u884C\u306E\u9593\u9694, fontSize: \u5024\u306E\u5927\u304D\u3055, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", fontWeight: 600, textAnchor: "end", fill: "var(--cdl-text, #1a1f2a)", children: \u5E45\u3067\u5207\u308B(f.value, \u5024\u306E\u5927\u304D\u3055, bw - 28 - \u5B57\u306E\u5E45(f.label, \u540D\u306E\u5927\u304D\u3055) - 8, \u5B57\u306E\u5E45) }),
30050
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: x + 14, y1: y + 60 + i * \u884C\u306E\u9593\u9694, x2: x + bw - 14, y2: y + 60 + i * \u884C\u306E\u9593\u9694, stroke: "var(--cdl-divider, #d4d4d8)", strokeWidth: 0.5, opacity: 0.5 })
30051
+ ] }, i)),
30052
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${cx - 32}, ${y + bh - 26})`, children: [
30053
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: 0, width: 22, height: 18, rx: 3, fill: "none", stroke: frame.stroke, strokeWidth: 1.5 }),
30054
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: 22, y1: 9, x2: 42, y2: 9, stroke: frame.stroke, strokeWidth: 1.5 }),
30055
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 42, y: 0, width: 22, height: 18, rx: 3, fill: "var(--cdl-tone-accent, #2d6a8f)", fillOpacity: 0.5, stroke: frame.stroke, strokeWidth: 1.5 })
30056
+ ] })
30057
+ ] });
30058
+ };
30038
30059
  return /* @__PURE__ */ jsxRuntime.jsx("g", { children: fitArt(r, blockchainBlockExtent(frame.strokeWidth), art) });
30039
30060
  }
30040
30061
  function ShapeBlockchainNode({ node, active }) {