@cardenelabs/cdl 0.105.0 → 0.106.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 +24 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +3 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +3 -3
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/visual-validate.ts +9 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cardenelabs/cdl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.106.0",
|
|
4
4
|
"description": "CDL (Chainome Diagram Language). Mermaid-like declarative DSL that compiles to animated SVG diagrams. Built for blockchain / Solidity flows, generic enough for sequence / flow / state / ER / topology diagrams.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "cardene777",
|
package/src/visual-validate.ts
CHANGED
|
@@ -2003,18 +2003,23 @@ function runAxes(
|
|
|
2003
2003
|
if (!isRenderedNode(n)) continue;
|
|
2004
2004
|
const titleTrimmed = n.title?.trim() ?? "";
|
|
2005
2005
|
if (!titleTrimmed) continue;
|
|
2006
|
-
//
|
|
2006
|
+
// 幅は **字ごとの実幅** で出す (#949)。 字数に 1 字の幅を掛ける近似は、英数字の題で
|
|
2007
|
+
// 過大に見積もる (英数字は全角の半分ほどしか取らない)。 34 で描く `storage` に
|
|
2008
|
+
// `order_items` を書くと、近似は 426 と数えるが実際は 250 ほどしか使わない。
|
|
2009
|
+
//
|
|
2010
|
+
// 1 字の大きさは **その種別が題を描く大きさ** から渡す (#946)。 22 の定数で持っていたが、
|
|
2007
2011
|
// 22 で描く種別は 1 つも無く、見積りが実物の 1.2 倍から 1.7 倍になっていた。
|
|
2008
2012
|
//
|
|
2009
2013
|
// 箱の内側の余白 (52) は、題を箱の中に描く種別にだけ足す。 箱の外に描く種別 (`dyn-*` の
|
|
2010
2014
|
// 名前と図表の題) は内側の余白に縛られないので、足すと収まっている題まで挙がる。
|
|
2011
|
-
const titleLen = titleTrimmed.length;
|
|
2012
2015
|
const expectedW =
|
|
2013
|
-
|
|
2016
|
+
measureTextWidth(titleTrimmed, { fontSize: titleFontSize(n.kind) }) +
|
|
2017
|
+
(drawsTitleOutsideBox(n.kind) ? 0 : TITLE_BOX_PADDING);
|
|
2014
2018
|
if (expectedW > n.w + 8) {
|
|
2015
2019
|
push(
|
|
2016
2020
|
"text-readability",
|
|
2017
|
-
|
|
2021
|
+
// 字ごとの実幅は小数になるので、読む人に出す時だけ丸める (判定は丸めない)
|
|
2022
|
+
`node "${n.id}" title "${n.title}" が node 幅 ${n.w}px を超過する可能性 (期待 ${Math.round(expectedW)}px)`,
|
|
2018
2023
|
"warn",
|
|
2019
2024
|
);
|
|
2020
2025
|
}
|