@cardenelabs/cdl 0.115.0 → 0.117.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 +69 -1
- package/dist/index.cjs +47 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -3
- package/dist/index.d.ts +23 -3
- package/dist/index.js +47 -5
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +10 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +10 -3
- package/dist/react.js.map +1 -1
- package/dist/{render-oEmwYN-q.d.cts → render-A5AKjNuy.d.cts} +1 -1
- package/dist/{render-oEmwYN-q.d.ts → render-A5AKjNuy.d.ts} +1 -1
- package/package.json +1 -1
- package/src/index.ts +3 -0
- package/src/kinds/tree.tsx +78 -2
- package/src/presets.ts +5 -1
- package/src/visual-validate.ts +22 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,72 @@ CDL (Chainome Diagram Language) の主要変更履歴。
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.117.0] - 2026-10-01
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **位置を手で書いた箱に、自動で並べた時の揃えの規則を当てていた** (#972)
|
|
13
|
+
|
|
14
|
+
揃えを見る 2 軸が「レーンの中の箱は縦 1 列に並ぶ」 前提を持っていた。
|
|
15
|
+
|
|
16
|
+
| 軸 | 何を見るか | 重さ |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| `alignment` (軸 5) | 同じレーンの箱の中心の横位置が揃っているか | error |
|
|
19
|
+
| `column-alignment` (軸 58) | 同じ縦列の箱の中心の横位置が許容 1 以内で揃っているか | error |
|
|
20
|
+
|
|
21
|
+
`posX` と `posY` を両方書いた箱は **その並びから外して置く** ためにある。
|
|
22
|
+
外して置いたこと自体を違反として数えるので、意図どおりの図が毎回落ちていた。
|
|
23
|
+
|
|
24
|
+
同じ条件は軸 15 (`lane-cx-consistency`) が元から持っており、そちらだけ直っていた。
|
|
25
|
+
その 1 行を `位置を手で書いた` として括り出し、3 軸で同じ条件を使う。
|
|
26
|
+
|
|
27
|
+
**基準の箱も先に外す**。 判定だけを外すと、レーンの先頭の箱が手で置かれていた時に
|
|
28
|
+
自動で置いた箱が全部その位置と比べられて落ちる。
|
|
29
|
+
|
|
30
|
+
片方だけ書いた箱は外さない。 採用の条件が
|
|
31
|
+
`posX !== undefined && posY !== undefined` なので、片方だけでは自動の配置が生きており、
|
|
32
|
+
並びから外す指定にならない。
|
|
33
|
+
|
|
34
|
+
描く位置は変えていない。 変えたのは判定だけで、焼き付けた見た目は動かない。
|
|
35
|
+
|
|
36
|
+
## [0.116.0] - 2026-10-01
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
|
|
40
|
+
- **葉が少ない木の図が札の中で浮いていた** (#970)
|
|
41
|
+
|
|
42
|
+
木の札は種別ごとに 1 つの値 (720x480) で固定されていた。
|
|
43
|
+
必要な幅は葉の数で変わるので、葉が少ない図は札の中で小さく見える。
|
|
44
|
+
#968 で兄弟を近づけた結果これが目立ち、見本帳の `配布物の構成` は
|
|
45
|
+
中身 375 に対して札が 720 で、左右に 172 ずつ余っていた。
|
|
46
|
+
|
|
47
|
+
**札の幅を葉の数から出す**。
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
要る幅 = 葉の数 × (箱の幅 + 隙間) + 左右の余白
|
|
51
|
+
隙間 = 段の高さ - 箱の高さ
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
規則は縦が既に持っているものを横に当てただけになる。
|
|
55
|
+
段は区画の中央に置かれるので、縦の余白は隙間の半分ずつになる。
|
|
56
|
+
同じ形を横に当てると上の式になり、3 段の木では今の高さ (480) をそのまま返す
|
|
57
|
+
= 縦は既にこの値で描かれている。
|
|
58
|
+
|
|
59
|
+
| 図の形 | 札の幅 (直す前 → 後) | 中身 | 割合 |
|
|
60
|
+
|---|---|---|---|
|
|
61
|
+
| 葉 2 枚 / 段 3 つ | 720 → 519 | 375 | 52% → 72% |
|
|
62
|
+
| 葉 3 枚 / 段 3 つ | 720 → 720 (変わらない) | 588 | 82% |
|
|
63
|
+
|
|
64
|
+
**広げる向きには使わない**。 葉が多い図では式の値が既定を超えるが、
|
|
65
|
+
札を広げると並べる側の配置が崩れる。 超える図は今までどおり区画が狭まり、
|
|
66
|
+
箱が小さくなる側で吸収する (葉 10 枚の図は式の値が 2353 で、720 に留まる)。
|
|
67
|
+
|
|
68
|
+
**葉が 1 枚の図は 2 枚として扱う**。 1 枚の木は縦 1 本の鎖で、
|
|
69
|
+
式のまま出すと箱 1 つぶんの幅になり、木ではなく縦書きの字列に見える。
|
|
70
|
+
|
|
71
|
+
`木の札の幅` を公開した。 組み立てる側 (`tree()` preset と記法の側) が
|
|
72
|
+
札を作る前に引く。 規則を呼ぶ側に写さないための口になる。
|
|
73
|
+
|
|
8
74
|
## [0.115.0] - 2026-09-30
|
|
9
75
|
|
|
10
76
|
### Fixed
|
|
@@ -4580,7 +4646,9 @@ Initial OSS release.
|
|
|
4580
4646
|
使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
|
|
4581
4647
|
行き止まりになる。
|
|
4582
4648
|
|
|
4583
|
-
[Unreleased]: https://github.com/cardene777/cdl/compare/v0.
|
|
4649
|
+
[Unreleased]: https://github.com/cardene777/cdl/compare/v0.117.0...HEAD
|
|
4650
|
+
[0.117.0]: https://github.com/cardene777/cdl/compare/v0.116.0...v0.117.0
|
|
4651
|
+
[0.116.0]: https://github.com/cardene777/cdl/compare/v0.115.0...v0.116.0
|
|
4584
4652
|
[0.115.0]: https://github.com/cardene777/cdl/compare/v0.114.0...v0.115.0
|
|
4585
4653
|
[0.114.0]: https://github.com/cardene777/cdl/compare/v0.113.0...v0.114.0
|
|
4586
4654
|
[0.113.0]: https://github.com/cardene777/cdl/compare/v0.112.0...v0.113.0
|
package/dist/index.cjs
CHANGED
|
@@ -15720,6 +15720,43 @@ var PAD_TOP = 40;
|
|
|
15720
15720
|
var PAD_RIGHT = 24;
|
|
15721
15721
|
var PAD_BOTTOM = 40;
|
|
15722
15722
|
var PAD_LEFT = 24;
|
|
15723
|
+
var \u7BB1\u306E\u6700\u5927\u5E45 = 140;
|
|
15724
|
+
var \u7BB1\u306E\u6700\u5927\u9AD8\u3055 = 38;
|
|
15725
|
+
var \u672D\u306E\u65E2\u5B9A\u5E45 = 720;
|
|
15726
|
+
var \u672D\u306E\u65E2\u5B9A\u9AD8\u3055 = 480;
|
|
15727
|
+
function \u6728\u306E\u672D\u306E\u5E45(treeNodes) {
|
|
15728
|
+
const { \u8449\u306E\u6570, \u6BB5\u6570 } = \u6728\u306E\u5F62(treeNodes);
|
|
15729
|
+
const \u6BB5\u306E\u9AD8\u3055 = (\u672D\u306E\u65E2\u5B9A\u9AD8\u3055 - PAD_TOP - PAD_BOTTOM) / Math.max(\u6BB5\u6570, 1);
|
|
15730
|
+
const \u7BB1\u306E\u9AD8\u30553 = Math.min(\u7BB1\u306E\u6700\u5927\u9AD8\u3055, \u6BB5\u306E\u9AD8\u3055 * 0.7);
|
|
15731
|
+
const \u9699\u9593 = \u6BB5\u306E\u9AD8\u3055 - \u7BB1\u306E\u9AD8\u30553;
|
|
15732
|
+
const \u8981\u308B\u5E45 = Math.max(\u8449\u306E\u6570, 2) * (\u7BB1\u306E\u6700\u5927\u5E45 + \u9699\u9593);
|
|
15733
|
+
return Math.ceil(Math.min(\u672D\u306E\u65E2\u5B9A\u5E45, \u8981\u308B\u5E45 + PAD_LEFT + PAD_RIGHT));
|
|
15734
|
+
}
|
|
15735
|
+
function \u6728\u306E\u5F62(treeNodes) {
|
|
15736
|
+
const ids = new Set(treeNodes.map((n) => n.id));
|
|
15737
|
+
const childrenOf = /* @__PURE__ */ new Map();
|
|
15738
|
+
for (const n of treeNodes) {
|
|
15739
|
+
const p = n.parent && ids.has(n.parent) ? n.parent : "__root__";
|
|
15740
|
+
if (!childrenOf.has(p)) childrenOf.set(p, []);
|
|
15741
|
+
childrenOf.get(p).push(n);
|
|
15742
|
+
}
|
|
15743
|
+
const \u898B\u305F = /* @__PURE__ */ new Set();
|
|
15744
|
+
let \u8449\u306E\u6570 = 0;
|
|
15745
|
+
let \u6BB5\u6570 = 0;
|
|
15746
|
+
const \u4E0B\u898B = (n, depth) => {
|
|
15747
|
+
\u898B\u305F.add(n.id);
|
|
15748
|
+
\u6BB5\u6570 = Math.max(\u6BB5\u6570, depth + 1);
|
|
15749
|
+
const kids = (childrenOf.get(n.id) ?? []).filter((k) => !\u898B\u305F.has(k.id));
|
|
15750
|
+
if (kids.length === 0) {
|
|
15751
|
+
\u8449\u306E\u6570 += 1;
|
|
15752
|
+
return;
|
|
15753
|
+
}
|
|
15754
|
+
for (const k of kids) \u4E0B\u898B(k, depth + 1);
|
|
15755
|
+
};
|
|
15756
|
+
for (const r of childrenOf.get("__root__") ?? []) if (!\u898B\u305F.has(r.id)) \u4E0B\u898B(r, 0);
|
|
15757
|
+
for (const n of treeNodes) if (!\u898B\u305F.has(n.id)) \u4E0B\u898B(n, 0);
|
|
15758
|
+
return { \u8449\u306E\u6570, \u6BB5\u6570 };
|
|
15759
|
+
}
|
|
15723
15760
|
var \u6728\u306E\u679D\u306E\u592A\u3055 = (\u6BB5) => Math.max(1.1, 2.6 - \u6BB5 * 0.45);
|
|
15724
15761
|
function \u6728\u306E\u4E2D\u8EAB(node, stateValues = {}) {
|
|
15725
15762
|
const treeNodes = resolveTreeData(node.treeData ?? [], stateValues);
|
|
@@ -15923,8 +15960,8 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
|
|
|
15923
15960
|
);
|
|
15924
15961
|
const depthGap = canvasH / Math.max(maxDepth + 1, 1);
|
|
15925
15962
|
const slotW = canvasW / totalLeaves;
|
|
15926
|
-
const nodeH = Math.min(
|
|
15927
|
-
const nodeW = Math.min(
|
|
15963
|
+
const nodeH = Math.min(\u7BB1\u306E\u6700\u5927\u9AD8\u3055, depthGap * 0.7);
|
|
15964
|
+
const nodeW = Math.min(\u7BB1\u306E\u6700\u5927\u5E45, slotW * 0.85);
|
|
15928
15965
|
const \u7BB1\u306E\u5E45 = (n, depth) => {
|
|
15929
15966
|
const \u6750\u6599 = \u6728\u306E\u884C({ ...n, depth });
|
|
15930
15967
|
const \u540D\u524D = \u6750\u6599[0];
|
|
@@ -17310,6 +17347,9 @@ function visualValidateInner(laid, diag, violations, counts, push, profile, skip
|
|
|
17310
17347
|
return { diagramId: safeDiagramId(diag), ok: false, violations, counts, profile, skippedAxes };
|
|
17311
17348
|
}
|
|
17312
17349
|
}
|
|
17350
|
+
function \u4F4D\u7F6E\u3092\u624B\u3067\u66F8\u3044\u305F(n) {
|
|
17351
|
+
return n.posX !== void 0 && n.posY !== void 0;
|
|
17352
|
+
}
|
|
17313
17353
|
function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5668) {
|
|
17314
17354
|
const LIFELINE_W_THRESHOLD = 8;
|
|
17315
17355
|
for (const n of laid.nodes) {
|
|
@@ -17383,6 +17423,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
|
|
|
17383
17423
|
}
|
|
17384
17424
|
const byLane = /* @__PURE__ */ new Map();
|
|
17385
17425
|
for (const n of laid.nodes) {
|
|
17426
|
+
if (\u4F4D\u7F6E\u3092\u624B\u3067\u66F8\u3044\u305F(n)) continue;
|
|
17386
17427
|
const list = byLane.get(n.lane) ?? [];
|
|
17387
17428
|
list.push(n);
|
|
17388
17429
|
byLane.set(n.lane, list);
|
|
@@ -17727,6 +17768,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
|
|
|
17727
17768
|
const byLaneCol = /* @__PURE__ */ new Map();
|
|
17728
17769
|
for (const n of laid.nodes) {
|
|
17729
17770
|
if (n.id.endsWith("-spacer") || /^s\d+-/.test(n.id)) continue;
|
|
17771
|
+
if (\u4F4D\u7F6E\u3092\u624B\u3067\u66F8\u3044\u305F(n)) continue;
|
|
17730
17772
|
const list = byLaneCol.get(n.lane) ?? [];
|
|
17731
17773
|
list.push(n);
|
|
17732
17774
|
byLaneCol.set(n.lane, list);
|
|
@@ -17803,7 +17845,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
|
|
|
17803
17845
|
for (const l of laid.lanes) laneById.set(l.id, l);
|
|
17804
17846
|
for (const n of laid.nodes) {
|
|
17805
17847
|
if (n.id.endsWith("-spacer") || /^s\d+-/.test(n.id)) continue;
|
|
17806
|
-
if (n
|
|
17848
|
+
if (\u4F4D\u7F6E\u3092\u624B\u3067\u66F8\u3044\u305F(n)) continue;
|
|
17807
17849
|
const lane = laneById.get(n.lane);
|
|
17808
17850
|
if (!lane) continue;
|
|
17809
17851
|
const laneCx = lane.x + lane.width / 2;
|
|
@@ -34509,7 +34551,6 @@ function classDiagram(preset) {
|
|
|
34509
34551
|
return api;
|
|
34510
34552
|
}
|
|
34511
34553
|
function tree(preset) {
|
|
34512
|
-
const canvasW = preset.nodeWidth ? preset.nodeWidth * 2 : 720;
|
|
34513
34554
|
const canvasH = 480;
|
|
34514
34555
|
const b = diagram(preset.id, { topic: preset.topic, type: "tree" });
|
|
34515
34556
|
const treeNodes = [];
|
|
@@ -34519,6 +34560,7 @@ function tree(preset) {
|
|
|
34519
34560
|
return api;
|
|
34520
34561
|
},
|
|
34521
34562
|
build() {
|
|
34563
|
+
const canvasW = preset.nodeWidth ? preset.nodeWidth * 2 : \u6728\u306E\u672D\u306E\u5E45(treeNodes.map((n) => ({ id: n.id, title: n.title, parent: n.parent })));
|
|
34522
34564
|
b.lane("tree", { width: canvasW });
|
|
34523
34565
|
const nodeId = `${preset.id}-tree`;
|
|
34524
34566
|
b.node(nodeId, {
|
|
@@ -35193,5 +35235,6 @@ exports.visualValidateAll = visualValidateAll;
|
|
|
35193
35235
|
exports.visualValidateLaid = visualValidateLaid;
|
|
35194
35236
|
exports.withDerivedValues = withDerivedValues;
|
|
35195
35237
|
exports.worldToPx = worldToPx;
|
|
35238
|
+
exports.木の札の幅 = 木の札の幅;
|
|
35196
35239
|
//# sourceMappingURL=index.cjs.map
|
|
35197
35240
|
//# sourceMappingURL=index.cjs.map
|