@cardenelabs/cdl 0.115.0 → 0.116.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 +40 -1
- package/dist/index.cjs +41 -3
- 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 +41 -4
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +4 -2
- 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 +4 -2
- 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/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,44 @@ CDL (Chainome Diagram Language) の主要変更履歴。
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.116.0] - 2026-10-01
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **葉が少ない木の図が札の中で浮いていた** (#970)
|
|
13
|
+
|
|
14
|
+
木の札は種別ごとに 1 つの値 (720x480) で固定されていた。
|
|
15
|
+
必要な幅は葉の数で変わるので、葉が少ない図は札の中で小さく見える。
|
|
16
|
+
#968 で兄弟を近づけた結果これが目立ち、見本帳の `配布物の構成` は
|
|
17
|
+
中身 375 に対して札が 720 で、左右に 172 ずつ余っていた。
|
|
18
|
+
|
|
19
|
+
**札の幅を葉の数から出す**。
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
要る幅 = 葉の数 × (箱の幅 + 隙間) + 左右の余白
|
|
23
|
+
隙間 = 段の高さ - 箱の高さ
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
規則は縦が既に持っているものを横に当てただけになる。
|
|
27
|
+
段は区画の中央に置かれるので、縦の余白は隙間の半分ずつになる。
|
|
28
|
+
同じ形を横に当てると上の式になり、3 段の木では今の高さ (480) をそのまま返す
|
|
29
|
+
= 縦は既にこの値で描かれている。
|
|
30
|
+
|
|
31
|
+
| 図の形 | 札の幅 (直す前 → 後) | 中身 | 割合 |
|
|
32
|
+
|---|---|---|---|
|
|
33
|
+
| 葉 2 枚 / 段 3 つ | 720 → 519 | 375 | 52% → 72% |
|
|
34
|
+
| 葉 3 枚 / 段 3 つ | 720 → 720 (変わらない) | 588 | 82% |
|
|
35
|
+
|
|
36
|
+
**広げる向きには使わない**。 葉が多い図では式の値が既定を超えるが、
|
|
37
|
+
札を広げると並べる側の配置が崩れる。 超える図は今までどおり区画が狭まり、
|
|
38
|
+
箱が小さくなる側で吸収する (葉 10 枚の図は式の値が 2353 で、720 に留まる)。
|
|
39
|
+
|
|
40
|
+
**葉が 1 枚の図は 2 枚として扱う**。 1 枚の木は縦 1 本の鎖で、
|
|
41
|
+
式のまま出すと箱 1 つぶんの幅になり、木ではなく縦書きの字列に見える。
|
|
42
|
+
|
|
43
|
+
`木の札の幅` を公開した。 組み立てる側 (`tree()` preset と記法の側) が
|
|
44
|
+
札を作る前に引く。 規則を呼ぶ側に写さないための口になる。
|
|
45
|
+
|
|
8
46
|
## [0.115.0] - 2026-09-30
|
|
9
47
|
|
|
10
48
|
### Fixed
|
|
@@ -4580,7 +4618,8 @@ Initial OSS release.
|
|
|
4580
4618
|
使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
|
|
4581
4619
|
行き止まりになる。
|
|
4582
4620
|
|
|
4583
|
-
[Unreleased]: https://github.com/cardene777/cdl/compare/v0.
|
|
4621
|
+
[Unreleased]: https://github.com/cardene777/cdl/compare/v0.116.0...HEAD
|
|
4622
|
+
[0.116.0]: https://github.com/cardene777/cdl/compare/v0.115.0...v0.116.0
|
|
4584
4623
|
[0.115.0]: https://github.com/cardene777/cdl/compare/v0.114.0...v0.115.0
|
|
4585
4624
|
[0.114.0]: https://github.com/cardene777/cdl/compare/v0.113.0...v0.114.0
|
|
4586
4625
|
[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];
|
|
@@ -34509,7 +34546,6 @@ function classDiagram(preset) {
|
|
|
34509
34546
|
return api;
|
|
34510
34547
|
}
|
|
34511
34548
|
function tree(preset) {
|
|
34512
|
-
const canvasW = preset.nodeWidth ? preset.nodeWidth * 2 : 720;
|
|
34513
34549
|
const canvasH = 480;
|
|
34514
34550
|
const b = diagram(preset.id, { topic: preset.topic, type: "tree" });
|
|
34515
34551
|
const treeNodes = [];
|
|
@@ -34519,6 +34555,7 @@ function tree(preset) {
|
|
|
34519
34555
|
return api;
|
|
34520
34556
|
},
|
|
34521
34557
|
build() {
|
|
34558
|
+
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
34559
|
b.lane("tree", { width: canvasW });
|
|
34523
34560
|
const nodeId = `${preset.id}-tree`;
|
|
34524
34561
|
b.node(nodeId, {
|
|
@@ -35193,5 +35230,6 @@ exports.visualValidateAll = visualValidateAll;
|
|
|
35193
35230
|
exports.visualValidateLaid = visualValidateLaid;
|
|
35194
35231
|
exports.withDerivedValues = withDerivedValues;
|
|
35195
35232
|
exports.worldToPx = worldToPx;
|
|
35233
|
+
exports.木の札の幅 = 木の札の幅;
|
|
35196
35234
|
//# sourceMappingURL=index.cjs.map
|
|
35197
35235
|
//# sourceMappingURL=index.cjs.map
|