@cardenelabs/cdl 0.40.5 → 0.40.6
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 +23 -1
- package/dist/index.cjs +13 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +13 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +13 -1
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/validate.ts +27 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cardenelabs/cdl",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.6",
|
|
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/validate.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CdlDiagram } from "./types";
|
|
1
|
+
import type { CdlDiagram, CdlNode } from "./types";
|
|
2
2
|
import { TONES as TONE_NAMES, NODE_KINDS } from "./types";
|
|
3
3
|
import { templateRefIds } from "./render/utils";
|
|
4
4
|
import { nodeTemplateTexts } from "./render/template-fields";
|
|
@@ -46,6 +46,31 @@ export const DRAW_KINDS: ReadonlySet<string> = new Set([
|
|
|
46
46
|
const KINDS = new Set<string>(NODE_KINDS);
|
|
47
47
|
const ENG_BANNED = /\b(FUNCTION|STORAGE|EVENT LOG|BALANCES MAPPING|READ|WRITE|EMIT|CALL)\b/;
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* 図表の荷 (payload) を持つ節の欄 (cdl#743)。
|
|
51
|
+
*
|
|
52
|
+
* これらの欄を持つ節は **その節自体が図** で、段が指し示す相手ではない。 記法にも図表の節を
|
|
53
|
+
* activate する書き方が無いため、「どの phase でも activate されていない」 は書き手に直せない。
|
|
54
|
+
*
|
|
55
|
+
* **種別の一覧を持たない** = 図表の種別は増える (実測で 15 種)。 一覧を手で書くと、種別を
|
|
56
|
+
* 足した時にここへの追記を忘れて警告が復活する。 荷の欄で判定すれば自動で追従する
|
|
57
|
+
* (`rules/quality.md § 導出可能記述は人手で書かない` の経路 1)。
|
|
58
|
+
*/
|
|
59
|
+
const 図表の荷の欄 = [
|
|
60
|
+
"chartData",
|
|
61
|
+
"ganttData",
|
|
62
|
+
"mindData",
|
|
63
|
+
"funnelData",
|
|
64
|
+
"quadrantData",
|
|
65
|
+
"treeData",
|
|
66
|
+
"journeyData",
|
|
67
|
+
] as const satisfies readonly (keyof CdlNode)[];
|
|
68
|
+
|
|
69
|
+
/** 図表の荷を 1 つでも持つか。 持つ節は「使われていない」 の判定から外す */
|
|
70
|
+
function 図表の節(n: CdlNode): boolean {
|
|
71
|
+
return 図表の荷の欄.some((欄) => n[欄] !== undefined);
|
|
72
|
+
}
|
|
73
|
+
|
|
49
74
|
/**
|
|
50
75
|
* cdl が compile される前に通る validator。
|
|
51
76
|
* 構造的破綻 (重複 id / 不存在 id 参照 / 必須要素 0 件 等) は throw、
|
|
@@ -263,7 +288,7 @@ export function validate(diag: CdlDiagram): void {
|
|
|
263
288
|
for (const id of p.activate) allActivated.add(id);
|
|
264
289
|
}
|
|
265
290
|
for (const n of diag.nodes) {
|
|
266
|
-
if (!allActivated.has(n.id)) {
|
|
291
|
+
if (!allActivated.has(n.id) && !図表の節(n)) {
|
|
267
292
|
warnings.push(`node "${n.id}" がどの phase でも activate されていない (unused、 typo の可能性)`);
|
|
268
293
|
}
|
|
269
294
|
}
|