@cardenelabs/cdl 0.114.0 → 0.115.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 +32 -1
- package/dist/index.cjs +24 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -2
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +24 -2
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +24 -2
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/kinds/tree.tsx +49 -2
package/dist/index.js
CHANGED
|
@@ -15929,6 +15929,28 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
|
|
|
15929
15929
|
const \u8981\u308B = measureTextWidth(\u540D\u524D.text, { fontSize: \u540D\u524D.fontSize}) + (nodeW - \u4F7F\u3048\u308B\u5E45(nodeW));
|
|
15930
15930
|
return Math.min(Math.max(\u8981\u308B, nodeW), slotW * 0.92);
|
|
15931
15931
|
};
|
|
15932
|
+
const \u8449\u306E\u4E26\u3073 = [];
|
|
15933
|
+
const \u6BB5\u306E\u8868 = /* @__PURE__ */ new Map();
|
|
15934
|
+
const \u5E45\u306E\u8868 = /* @__PURE__ */ new Map();
|
|
15935
|
+
{
|
|
15936
|
+
const \u898B\u305F = /* @__PURE__ */ new Set();
|
|
15937
|
+
const \u4E0B\u898B = (n, depth) => {
|
|
15938
|
+
\u898B\u305F.add(n.id);
|
|
15939
|
+
\u6BB5\u306E\u8868.set(n.id, depth);
|
|
15940
|
+
\u5E45\u306E\u8868.set(n.id, \u7BB1\u306E\u5E45(n, depth));
|
|
15941
|
+
const kids = (childrenOf.get(n.id) ?? []).filter((k) => !\u898B\u305F.has(k.id));
|
|
15942
|
+
if (kids.length === 0) {
|
|
15943
|
+
\u8449\u306E\u4E26\u3073.push(n.id);
|
|
15944
|
+
return;
|
|
15945
|
+
}
|
|
15946
|
+
for (const k of kids) \u4E0B\u898B(k, depth + 1);
|
|
15947
|
+
};
|
|
15948
|
+
for (const r of roots) if (!\u898B\u305F.has(r.id)) \u4E0B\u898B(r, 0);
|
|
15949
|
+
}
|
|
15950
|
+
const \u8449\u306E\u6570 = Math.max(\u8449\u306E\u4E26\u3073.length, 1);
|
|
15951
|
+
const \u6BB5\u306E\u9699\u9593 = depthGap - nodeH;
|
|
15952
|
+
const \u8449\u306E\u9593\u9694 = Math.min(slotW, nodeW + \u6BB5\u306E\u9699\u9593);
|
|
15953
|
+
const \u8449\u306Ex = (i) => canvasW / 2 - (\u8449\u306E\u6570 - 1) * \u8449\u306E\u9593\u9694 / 2 + i * \u8449\u306E\u9593\u9694;
|
|
15932
15954
|
const posOf = /* @__PURE__ */ new Map();
|
|
15933
15955
|
const nodes = [];
|
|
15934
15956
|
const placed = /* @__PURE__ */ new Set();
|
|
@@ -15938,7 +15960,7 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
|
|
|
15938
15960
|
const kids = (childrenOf.get(n.id) ?? []).filter((k) => !placed.has(k.id));
|
|
15939
15961
|
let x;
|
|
15940
15962
|
if (kids.length === 0) {
|
|
15941
|
-
x = leafCursor
|
|
15963
|
+
x = \u8449\u306Ex(leafCursor);
|
|
15942
15964
|
leafCursor += 1;
|
|
15943
15965
|
} else {
|
|
15944
15966
|
const xs = kids.map((k) => place(k, depth + 1));
|
|
@@ -15952,7 +15974,7 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
|
|
|
15952
15974
|
...n.subtitle !== void 0 ? { subtitle: n.subtitle } : {},
|
|
15953
15975
|
x,
|
|
15954
15976
|
y,
|
|
15955
|
-
w: \u7BB1\u306E\u5E45(n, depth),
|
|
15977
|
+
w: \u5E45\u306E\u8868.get(n.id) ?? \u7BB1\u306E\u5E45(n, depth),
|
|
15956
15978
|
h: nodeH,
|
|
15957
15979
|
depth,
|
|
15958
15980
|
...n.unresolved ? { unresolved: true } : {}
|