@antv/hierarchy 0.6.13 → 0.7.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/README.md +51 -3
- package/dist/hierarchy.es.js +2 -0
- package/dist/hierarchy.es.js.map +1 -0
- package/dist/hierarchy.umd.js +2 -0
- package/dist/hierarchy.umd.js.map +1 -0
- package/lib/compact-box.d.ts +3 -0
- package/lib/compact-box.d.ts.map +1 -0
- package/lib/dendrogram.d.ts +3 -0
- package/lib/dendrogram.d.ts.map +1 -0
- package/lib/indented.d.ts +3 -0
- package/lib/indented.d.ts.map +1 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/layout/base.d.ts +8 -0
- package/lib/layout/base.d.ts.map +1 -0
- package/lib/layout/dendrogram.d.ts +3 -0
- package/lib/layout/dendrogram.d.ts.map +1 -0
- package/lib/layout/do-layout.d.ts +5 -0
- package/lib/layout/do-layout.d.ts.map +1 -0
- package/lib/layout/hierarchy.d.ts +3 -0
- package/lib/layout/hierarchy.d.ts.map +1 -0
- package/lib/layout/indented.d.ts +3 -0
- package/lib/layout/indented.d.ts.map +1 -0
- package/lib/layout/mindmap.d.ts +3 -0
- package/lib/layout/mindmap.d.ts.map +1 -0
- package/lib/layout/non-layered-tidy.d.ts +3 -0
- package/lib/layout/non-layered-tidy.d.ts.map +1 -0
- package/lib/layout/separate-root.d.ts +6 -0
- package/lib/layout/separate-root.d.ts.map +1 -0
- package/lib/mindmap.d.ts +3 -0
- package/lib/mindmap.d.ts.map +1 -0
- package/lib/types.d.ts +90 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/util.d.ts +17 -0
- package/lib/util.d.ts.map +1 -0
- package/package.json +48 -53
- package/.babelrc +0 -14
- package/.editorconfig +0 -20
- package/.eslintignore +0 -7
- package/.eslintrc +0 -28
- package/.github/workflows/build.yml +0 -32
- package/CHANGELOG.md +0 -0
- package/CONTRIBUTING.md +0 -142
- package/CONTRIBUTING.zh-CN.md +0 -148
- package/assets/compact-box-bt.png +0 -0
- package/assets/compact-box-h.png +0 -0
- package/assets/compact-box-lr.png +0 -0
- package/assets/compact-box-rl.png +0 -0
- package/assets/compact-box-tb.png +0 -0
- package/assets/compact-box-v.png +0 -0
- package/assets/dendrogram-bt.png +0 -0
- package/assets/dendrogram-h.png +0 -0
- package/assets/dendrogram-lr.png +0 -0
- package/assets/dendrogram-rl.png +0 -0
- package/assets/dendrogram-tb.png +0 -0
- package/assets/dendrogram-v.png +0 -0
- package/assets/indented-h.png +0 -0
- package/assets/indented-lr.png +0 -0
- package/assets/indented-rl.png +0 -0
- package/assets/layered-tidy-bt.png +0 -0
- package/assets/layered-tidy-h.png +0 -0
- package/assets/layered-tidy-lr.png +0 -0
- package/assets/layered-tidy-rl.png +0 -0
- package/assets/layered-tidy-tb.png +0 -0
- package/assets/layered-tidy-v.png +0 -0
- package/assets/mindmap.png +0 -0
- package/bin/mkdir-dist.js +0 -8
- package/bin/screenshot.js +0 -81
- package/bin/win-dev.js +0 -14
- package/build/hierarchy.js +0 -1131
- package/build/hierarchy.js.map +0 -1
- package/dist/hierarchy.min.js +0 -1
- package/lib/compact-box.js +0 -24
- package/lib/dendrogram.js +0 -25
- package/lib/indented.js +0 -65
- package/lib/index.js +0 -7
- package/lib/layout/base.js +0 -17
- package/lib/layout/dendrogram.js +0 -108
- package/lib/layout/do-layout.js +0 -107
- package/lib/layout/hierarchy.js +0 -184
- package/lib/layout/indented.js +0 -36
- package/lib/layout/mindmap.js +0 -92
- package/lib/layout/non-layered-tidy.js +0 -236
- package/lib/layout/separate-root.js +0 -39
- package/lib/mindmap.js +0 -24
- package/lib/util.js +0 -18
- package/src/compact-box.js +0 -21
- package/src/dendrogram.js +0 -22
- package/src/indented.js +0 -52
- package/src/index.js +0 -9
- package/src/layout/base.js +0 -16
- package/src/layout/dendrogram.js +0 -105
- package/src/layout/do-layout.js +0 -106
- package/src/layout/hierarchy.js +0 -187
- package/src/layout/indented.js +0 -40
- package/src/layout/mindmap.js +0 -93
- package/src/layout/non-layered-tidy.js +0 -250
- package/src/layout/separate-root.js +0 -40
- package/src/mindmap.js +0 -21
- package/src/util.js +0 -16
package/README.md
CHANGED
|
@@ -9,13 +9,61 @@
|
|
|
9
9
|
[](https://www.npmjs.com/package/@antv/hierarchy)
|
|
10
10
|
[](https://www.npmjs.com/package/@antv/hierarchy)
|
|
11
11
|
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
✨ **TypeScript Support**: Fully typed with TypeScript for better IDE support and type safety
|
|
15
|
+
|
|
16
|
+
🚀 **Modern Build System**: Built with Vite for faster builds and smaller bundle sizes
|
|
17
|
+
|
|
18
|
+
📦 **Multiple Formats**: Supports both ES modules and UMD formats
|
|
19
|
+
|
|
20
|
+
🎯 **Tree-shakeable**: ES module format allows for efficient tree-shaking
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @antv/hierarchy
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
### ES Module (Recommended)
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { compactBox } from '@antv/hierarchy';
|
|
34
|
+
// or
|
|
35
|
+
import * as Hierarchy from '@antv/hierarchy';
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### CommonJS
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
const Hierarchy = require('@antv/hierarchy');
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### TypeScript
|
|
45
|
+
|
|
46
|
+
This library includes TypeScript definitions. You'll get full IntelliSense support:
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { compactBox, type HierarchyNode, type CompactBoxOptions } from '@antv/hierarchy';
|
|
50
|
+
|
|
51
|
+
const options: CompactBoxOptions = {
|
|
52
|
+
direction: 'LR',
|
|
53
|
+
getId: (d) => d.id,
|
|
54
|
+
getWidth: (d) => 100,
|
|
55
|
+
getHeight: (d) => 50
|
|
56
|
+
};
|
|
57
|
+
```
|
|
12
58
|
|
|
13
59
|
## API
|
|
14
60
|
|
|
15
61
|
### example
|
|
16
62
|
|
|
17
|
-
```
|
|
18
|
-
|
|
63
|
+
```typescript
|
|
64
|
+
import { compactBox } from '@antv/hierarchy';
|
|
65
|
+
// or for CommonJS
|
|
66
|
+
// const { compactBox } = require('@antv/hierarchy');
|
|
19
67
|
|
|
20
68
|
// your tree data
|
|
21
69
|
const root = {
|
|
@@ -43,7 +91,7 @@ const root = {
|
|
|
43
91
|
const NODE_SIZE = 16;
|
|
44
92
|
const PEM = 5;
|
|
45
93
|
const ctx = document.getElementById('id-of-canvas-element').getContext('2d');
|
|
46
|
-
const rootNode =
|
|
94
|
+
const rootNode = compactBox(root, {
|
|
47
95
|
direction: 'H', // H / V / LR / RL / TB / BT
|
|
48
96
|
getId(d) {
|
|
49
97
|
return d.id;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function t(t,e,i,n="height"){const h=t[n],r=e[n];return"center"===i?(h+r)/2:t.height}const e=Object.assign,i={getId:t=>t.id||t.name,getPreH:t=>t.preH||0,getPreV:t=>t.preV||0,getHGap:t=>t.hgap||18,getVGap:t=>t.vgap||18,getChildren:t=>t.children,getHeight:t=>t.height||36,getWidth(t){const e=t.label||" ";return t.width||18*e.split("").length}};class n{constructor(t,e){if(this.x=0,this.y=0,this.depth=0,this.children=[],this.hgap=0,this.vgap=0,t instanceof n||"x"in t&&"y"in t&&"children"in t){const e=t;return this.data=e.data,this.id=e.id,this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.depth=e.depth,this.children=e.children,this.parent=e.parent,this.hgap=e.hgap,this.vgap=e.vgap,this.preH=e.preH,void(this.preV=e.preV)}this.data=t;const i=e.getHGap(t),h=e.getVGap(t);this.preH=e.getPreH(t),this.preV=e.getPreV(t),this.width=e.getWidth(t),this.height=e.getHeight(t),this.width+=this.preH,this.height+=this.preV,this.id=e.getId(t),this.addGap(i,h)}isRoot(){return 0===this.depth}isLeaf(){return 0===this.children.length}addGap(t,e){this.hgap+=t,this.vgap+=e,this.width+=2*t,this.height+=2*e}eachNode(t){let e,i=[this];for(;e=i.shift();)t(e),i=e.children.concat(i)}DFTraverse(t){this.eachNode(t)}BFTraverse(t){let e,i=[this];for(;e=i.shift();)t(e),i=i.concat(e.children)}getBoundingBox(){const t={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(e=>{t.left=Math.min(t.left,e.x),t.top=Math.min(t.top,e.y),t.width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height)}),t}translate(t=0,e=0){this.eachNode(i=>{i.x+=t,i.y+=e,i.x+=i.preH,i.y+=i.preV})}right2left(){const t=this.getBoundingBox();this.eachNode(e=>{e.x=e.x-2*(e.x-t.left)-e.width}),this.translate(t.width,0)}bottom2top(){const t=this.getBoundingBox();this.eachNode(e=>{e.y=e.y-2*(e.y-t.top)-e.height}),this.translate(0,t.height)}}function h(t,h={},r){h=e({},i,h);const o=new n(t,h),s=[o];let c;if(!r&&!t.collapsed)for(;c=s.shift();)if(!c.data.collapsed){const t=h.getChildren(c.data),e=t?t.length:0;if(c.children=new Array(e),t&&e)for(let i=0;i<e;i++){const e=new n(t[i],h);c.children[i]=e,s.push(e),e.parent=c,e.depth=c.depth+1}}return o}class r{constructor(t,e={}){this.options=e,this.rootNode=h(t,e)}execute(){throw new Error("please override this method")}}let o=class t{constructor(t=0,e=0,i=0,n=[]){this.x=0,this.prelim=0,this.mod=0,this.shift=0,this.change=0,this.tl=null,this.tr=null,this.el=null,this.er=null,this.msel=0,this.mser=0,this.w=t||0,this.h=e||0,this.y=i||0,this.c=n||[],this.cs=n.length}static fromNode(e,i){if(!e)return null;const n=[];return e.children.forEach(e=>{const h=t.fromNode(e,i);h&&n.push(h)}),i?new t(e.height,e.width,e.x,n):new t(e.width,e.height,e.y,n)}};function s(t,e,i){i?t.y+=e:t.x+=e,t.children.forEach(t=>{s(t,e,i)})}function c(t,e){let i=e?t.y:t.x;return t.children.forEach(t=>{i=Math.min(c(t,e),i)}),i}function l(t,e){s(t,-c(t,e),e)}function a(t,e,i){i?e.y=t.x:e.x=t.x,t.c.forEach((t,n)=>{a(t,e.children[n],i)})}function d(t,e,i=0){e?(t.x=i,i+=t.width):(t.y=i,i+=t.height),t.children.forEach(t=>{d(t,e,i)})}function f(t,e={}){const i=e.isHorizontal;function n(t){0===t.cs?(t.el=t,t.er=t,t.msel=t.mser=0):(t.el=t.c[0].el,t.msel=t.c[0].msel,t.er=t.c[t.cs-1].er,t.mser=t.c[t.cs-1].mser)}function h(t,e,i){let n=t.c[e-1],h=n.mod,o=t.c[e],l=o.mod;for(;null!==n&&null!==o;){i&&f(n)>i.low&&(i=i.nxt);const a=h+n.prelim+n.w-(l+o.prelim);a>0&&(l+=a,i&&r(t,e,i.index,a));const d=f(n),g=f(o);d<=g&&(n=c(n),null!==n&&(h+=n.mod)),d>=g&&(o=s(o),null!==o&&(l+=o.mod))}!n&&o?function(t,e,i,n){const h=t.c[0].el;h.tl=i;const r=n-i.mod-t.c[0].msel;h.mod+=r,h.prelim-=r,t.c[0].el=t.c[e].el,t.c[0].msel=t.c[e].msel}(t,e,o,l):n&&!o&&function(t,e,i,n){const h=t.c[e].er;h.tr=i;const r=n-i.mod-t.c[e].mser;h.mod+=r,h.prelim-=r,t.c[e].er=t.c[e-1].er,t.c[e].mser=t.c[e-1].mser}(t,e,n,h)}function r(t,e,i,n){t.c[e].mod+=n,t.c[e].msel+=n,t.c[e].mser+=n,function(t,e,i,n){if(i!==e-1){const h=e-i;t.c[i+1].shift+=n/h,t.c[e].shift-=n/h,t.c[e].change-=n-n/h}}(t,e,i,n)}function s(t){return 0===t.cs?t.tl:t.c[0]}function c(t){return 0===t.cs?t.tr:t.c[t.cs-1]}function f(t){return t.y+t.h}function g(t,e,i){for(;null!==i&&t>=i.low;)i=i.nxt;return{low:t,index:e,nxt:i}}d(t,i);const u=o.fromNode(t,i);return u&&(!function t(e){if(0===e.cs)return void n(e);t(e.c[0]);let i=g(f(e.c[0].el),0,null);for(let n=1;n<e.cs;++n){t(e.c[n]);const r=f(e.c[n].er);h(e,n,i),i=g(r,n,i)}!function(t){t.prelim=(t.c[0].prelim+t.c[0].mod+t.c[t.cs-1].mod+t.c[t.cs-1].prelim+t.c[t.cs-1].w)/2-t.w/2}(e),n(e)}(u),function t(e,i){i+=e.mod,e.x=e.prelim+i,function(t){let e=0,i=0;for(let n=0;n<t.cs;n++)e+=t.c[n].shift,i+=e+t.c[n].change,t.c[n].mod+=i}(e);for(let n=0;n<e.cs;n++)t(e.c[n],i)}(u,0),a(u,t,i),l(t,i)),t}function g(t,e){const i=h(t.data,e,!0),n=h(t.data,e,!0),r=t.children.length,o=Math.round(r/2),s=e.getSide||function(t,e){return e<o?"right":"left"};for(let h=0;h<r;h++){const e=t.children[h];"right"===s(e,h)?n.children.push(e):i.children.push(e)}return i.eachNode(t=>{t.isRoot()||(t.side="left")}),n.eachNode(t=>{t.isRoot()||(t.side="right")}),{left:i,right:n}}const u=["LR","RL","TB","BT","H","V"],p=["LR","RL","H"],x=u[0];function y(t,e,i){const n=e.direction||x;if(e.isHorizontal=(t=>p.indexOf(t)>-1)(n),n&&-1===u.indexOf(n))throw new TypeError(`Invalid direction: ${n}`);if(n===u[0])i(t,e);else if(n===u[1])i(t,e),t.right2left();else if(n===u[2])i(t,e);else if(n===u[3])i(t,e),t.bottom2top();else if(n===u[4]||n===u[5]){const{left:n,right:h}=g(t,e);i(n,e),i(h,e),e.isHorizontal?n.right2left():n.bottom2top(),h.translate(n.x-h.x,n.y-h.y),t.x=n.x,t.y=h.y;const r=t.getBoundingBox();e.isHorizontal?r.top<0&&t.translate(0,-r.top):r.left<0&&t.translate(-r.left,0)}let h=e.fixedRoot;return void 0===h&&(h=!0),h&&t.translate(-(t.x+t.width/2+t.hgap),-(t.y+t.height/2+t.vgap)),function(t,e){if(e.radial){const[i,n]=e.isHorizontal?["x","y"]:["y","x"],h={x:1/0,y:1/0},r={x:-1/0,y:-1/0};let o=0;t.DFTraverse(t=>{o++;const{x:e,y:i}=t;h.x=Math.min(h.x,e),h.y=Math.min(h.y,i),r.x=Math.max(r.x,e),r.y=Math.max(r.y,i)});const s=r[n]-h[n];if(0===s)return;const c=2*Math.PI/o;t.DFTraverse(e=>{const r=e[n],o=h[n],l=e[i],a=t[i],d=(r-o)/s*(2*Math.PI-c)+c,f=l-a;e.x=Math.cos(d)*f,e.y=Math.sin(d)*f})}}(t,e),t}class m extends r{execute(){return y(this.rootNode,this.options,f)}}const w={};function H(t,i){const n=e({},w,i);return new m(t,n).execute()}class N{constructor(t=0,e=[]){this.x=0,this.y=0,this.leftChild=null,this.rightChild=null,this.isLeaf=!1,this.height=t,this.children=e}}const v={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function M(t,e,i){i?(e.x=t.x,e.y=t.y):(e.x=t.y,e.y=t.x),t.children.forEach((t,n)=>{M(t,e.children[n],i)})}function E(t,i={}){const n=e({},v,i);let h=0;let r=null;const o=function t(e){e.width=0,e.depth&&e.depth>h&&(h=e.depth);const i=e.children,n=i.length,r=new N(e.height,[]);return i.forEach((e,i)=>{const h=t(e);r.children.push(h),0===i&&(r.leftChild=h),i===n-1&&(r.rightChild=h)}),r.originNode=e,r.isLeaf=e.isLeaf(),r}(t);return function t(e){if(e.isLeaf||0===e.children.length)e.drawingDepth=h;else{const i=e.children.map(e=>t(e)),n=Math.min(...i);e.drawingDepth=n-1}return e.drawingDepth}(o),function t(e){e.x=e.drawingDepth*n.rankSep,e.isLeaf?(e.y=0,r&&(e.y=r.y+r.height+n.nodeSep,e.originNode.parent!==r.originNode.parent&&(e.y+=n.subTreeSep)),r=e):(e.children.forEach(e=>{t(e)}),e.y=(e.leftChild.y+e.rightChild.y)/2)}(o),M(o,t,n.isHorizontal),t}class B extends r{execute(){return this.rootNode.width=0,y(this.rootNode,this.options,E)}}const T={};function S(t,i){const n=e({},T,i);return new B(t,n).execute()}function b(e,i,n,h){let r=null;e.eachNode(e=>{!function(e,i,n,h,r){const o=("function"==typeof n?n(e):n)*e.depth;if(!h)try{if(e.parent&&e.id===e.parent.children[0].id)return e.x+=o,void(e.y=i?i.y:0)}catch{}if(e.x+=o,i){if(e.y=i.y+t(i,e,r),i.parent&&e.parent&&e.parent.id!==i.parent.id){const n=i.parent,h=n.y+t(n,e,r);e.y=h>e.y?h:e.y}}else e.y=0}(e,r,i,n,h),r=e})}const L=["LR","RL","H"],V=L[0];class R extends r{execute(){const t=this.options,e=this.rootNode;t.isHorizontal=!0;const{indent:i=20,dropCap:n=!0,direction:h=V,align:r}=t;if(h&&-1===L.indexOf(h))throw new TypeError(`Invalid direction: ${h}`);if(h===L[0])b(e,i,n,r);else if(h===L[1])b(e,i,n,r),e.right2left();else if(h===L[2]){const{left:h,right:o}=g(e,t);b(h,i,n,r),h.right2left(),b(o,i,n,r);const s=h.getBoundingBox();o.translate(s.width,0),e.x=o.x-e.width/2}return e}}const z={};function C(t,i){const n=e({},z,i);return new R(t,n).execute()}function D(t,e){let i=0;return t.children.length?t.children.forEach(t=>{i+=D(t,e)}):i=t.height,t._subTreeSep=e.getSubTreeSep(t.data),t.totalHeight=Math.max(t.height,i)+2*t._subTreeSep,t.totalHeight}function Y(t){const e=t.children,i=e.length;if(i){e.forEach(t=>{Y(t)});const n=e[0],h=e[i-1],r=h.y-n.y+h.height;let o=0;if(e.forEach(t=>{o+=t.totalHeight}),r>t.height)t.y=n.y+r/2-t.height/2;else if(1!==e.length||t.height>o){const i=t.y+(t.height-r)/2-n.y;e.forEach(t=>{t.translate(0,i)})}else t.y=(n.y+n.height/2+h.y+h.height/2)/2-t.height/2}}const G={getSubTreeSep:()=>0};function I(t,i={}){return i=e({},G,i),t.parent={x:0,width:0,height:0,y:0},t.BFTraverse(t=>{t.x=t.parent.x+t.parent.width}),t.parent=void 0,D(t,i),t.startY=0,t.y=t.totalHeight/2-t.height/2,t.eachNode(t=>{const e=t.children,i=e.length;if(i){const n=e[0];if(n.startY=t.startY+t._subTreeSep,1===i)n.y=t.y+t.height/2-n.height/2;else{n.y=n.startY+n.totalHeight/2-n.height/2;for(let t=1;t<i;t++){const i=e[t];i.startY=e[t-1].startY+e[t-1].totalHeight,i.y=i.startY+i.totalHeight/2-i.height/2}}}}),Y(t),t}class P extends r{execute(){return y(this.rootNode,this.options,I)}}const A={};function F(t,i){const n=e({},A,i);return new P(t,n).execute()}const _={compactBox:H,dendrogram:S,indented:C,mindmap:F},O="0.7.0";export{H as compactBox,_ as default,S as dendrogram,C as indented,F as mindmap,O as version};
|
|
2
|
+
//# sourceMappingURL=hierarchy.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hierarchy.es.js","sources":["../src/util.ts","../src/layout/hierarchy.ts","../src/layout/base.ts","../src/layout/non-layered-tidy.ts","../src/layout/separate-root.ts","../src/layout/do-layout.ts","../src/compact-box.ts","../src/layout/dendrogram.ts","../src/dendrogram.ts","../src/layout/indented.ts","../src/indented.ts","../src/layout/mindmap.ts","../src/mindmap.ts","../src/index.ts"],"sourcesContent":["import type { HierarchyNode } from './types';\n\n/**\n * Get average height or height for node's position calculation, according to align.\n * @param preNode previous node\n * @param node current node, whose position is going to be calculated\n * @param align 'center' means nodes align at the center, other value means align at the left-top\n * @param heightField field name for height value on preNode and node\n * @return the height for calculation\n */\nexport function getHeight(\n preNode: HierarchyNode,\n node: HierarchyNode,\n align?: 'center' | undefined,\n heightField: keyof HierarchyNode = 'height',\n): number {\n const preNodeHeight = preNode[heightField] as number;\n const nodeHeight = node[heightField] as number;\n return align === 'center' ? (preNodeHeight + nodeHeight) / 2 : preNode.height;\n}\n\nexport const assign = Object.assign;\n","import { assign } from '../util';\nimport type { HierarchyData, HierarchyNode, HierarchyOptions, BoundingBox } from '../types';\n\nconst PEM = 18;\nconst DEFAULT_HEIGHT = PEM * 2;\nconst DEFAULT_GAP = PEM;\n\nconst DEFAULT_OPTIONS: Required<\n Pick<\n HierarchyOptions,\n | 'getId'\n | 'getPreH'\n | 'getPreV'\n | 'getHGap'\n | 'getVGap'\n | 'getChildren'\n | 'getHeight'\n | 'getWidth'\n >\n> = {\n getId(d: HierarchyData): string {\n return (d.id || d.name) as string;\n },\n getPreH(d: HierarchyData): number {\n return d.preH || 0;\n },\n getPreV(d: HierarchyData): number {\n return d.preV || 0;\n },\n getHGap(d: HierarchyData): number {\n return d.hgap || DEFAULT_GAP;\n },\n getVGap(d: HierarchyData): number {\n return d.vgap || DEFAULT_GAP;\n },\n getChildren(d: HierarchyData): HierarchyData[] | undefined {\n return d.children;\n },\n getHeight(d: HierarchyData): number {\n return d.height || DEFAULT_HEIGHT;\n },\n getWidth(d: HierarchyData): number {\n const label = d.label || ' ';\n return d.width || label.split('').length * PEM; // FIXME DO NOT get width like this\n },\n};\n\nclass Node implements HierarchyNode {\n data: HierarchyData;\n id: string;\n x: number = 0;\n y: number = 0;\n width: number;\n height: number;\n depth: number = 0;\n children: HierarchyNode[] = [];\n parent?: HierarchyNode;\n hgap: number = 0;\n vgap: number = 0;\n preH: number;\n preV: number;\n\n constructor(data: HierarchyData | HierarchyNode, options: HierarchyOptions) {\n if (data instanceof Node || ('x' in data && 'y' in data && 'children' in data)) {\n // If it's already a Node, cast and return\n const node = data as Node;\n this.data = node.data;\n this.id = node.id;\n this.x = node.x;\n this.y = node.y;\n this.width = node.width;\n this.height = node.height;\n this.depth = node.depth;\n this.children = node.children;\n this.parent = node.parent;\n this.hgap = node.hgap;\n this.vgap = node.vgap;\n this.preH = node.preH;\n this.preV = node.preV;\n return;\n }\n\n this.data = data as HierarchyData;\n\n /*\n * Gaps: filling space between nodes\n * (x, y) ----------------------\n * | vgap |\n * | -------------------- h\n * | h | | e\n * | g | | i\n * | a | | g\n * | p | | h\n * | --------------------- t\n * | |\n * -----------width------------\n */\n const hgap = options.getHGap!(data);\n const vgap = options.getVGap!(data);\n this.preH = options.getPreH!(data);\n this.preV = options.getPreV!(data);\n this.width = options.getWidth!(data);\n this.height = options.getHeight!(data);\n this.width += this.preH;\n this.height += this.preV;\n this.id = options.getId!(data);\n\n this.addGap(hgap, vgap);\n }\n\n isRoot(): boolean {\n return this.depth === 0;\n }\n\n isLeaf(): boolean {\n return this.children.length === 0;\n }\n\n addGap(hgap: number, vgap: number): void {\n this.hgap += hgap;\n this.vgap += vgap;\n this.width += 2 * hgap;\n this.height += 2 * vgap;\n }\n\n eachNode(callback: (node: HierarchyNode) => void): void {\n let nodes: HierarchyNode[] = [this];\n let current: HierarchyNode | undefined;\n while ((current = nodes.shift())) {\n callback(current);\n nodes = current.children.concat(nodes);\n }\n }\n\n DFTraverse(callback: (node: HierarchyNode) => void): void {\n this.eachNode(callback);\n }\n\n BFTraverse(callback: (node: HierarchyNode) => void): void {\n let nodes: HierarchyNode[] = [this];\n let current: HierarchyNode | undefined;\n while ((current = nodes.shift())) {\n callback(current);\n nodes = nodes.concat(current.children);\n }\n }\n\n getBoundingBox(): BoundingBox {\n const bb: BoundingBox = {\n left: Number.MAX_VALUE,\n top: Number.MAX_VALUE,\n width: 0,\n height: 0,\n };\n this.eachNode((node) => {\n bb.left = Math.min(bb.left, node.x);\n bb.top = Math.min(bb.top, node.y);\n bb.width = Math.max(bb.width, node.x + node.width);\n bb.height = Math.max(bb.height, node.y + node.height);\n });\n return bb;\n }\n\n translate(tx: number = 0, ty: number = 0): void {\n this.eachNode((node) => {\n node.x += tx;\n node.y += ty;\n node.x += node.preH;\n node.y += node.preV;\n });\n }\n\n right2left(): void {\n const bb = this.getBoundingBox();\n this.eachNode((node) => {\n node.x = node.x - (node.x - bb.left) * 2 - node.width;\n });\n this.translate(bb.width, 0);\n }\n\n bottom2top(): void {\n const bb = this.getBoundingBox();\n this.eachNode((node) => {\n node.y = node.y - (node.y - bb.top) * 2 - node.height;\n });\n this.translate(0, bb.height);\n }\n}\n\nexport default function hierarchy(\n data: HierarchyData,\n options: HierarchyOptions = {},\n isolated?: boolean,\n): HierarchyNode {\n options = assign({}, DEFAULT_OPTIONS, options);\n const root = new Node(data, options);\n const nodes: HierarchyNode[] = [root];\n let node: HierarchyNode | undefined;\n\n if (!isolated && !data.collapsed) {\n while ((node = nodes.shift())) {\n if (!node.data.collapsed) {\n const children = options.getChildren!(node.data);\n const length = children ? children.length : 0;\n node.children = new Array(length);\n if (children && length) {\n for (let i = 0; i < length; i++) {\n const child = new Node(children[i], options);\n node.children[i] = child;\n nodes.push(child);\n child.parent = node;\n child.depth = node.depth + 1;\n }\n }\n }\n }\n }\n\n return root;\n}\n","import hierarchy from './hierarchy';\nimport type { HierarchyData, HierarchyNode, HierarchyOptions } from '../types';\n\nexport default class Layout {\n options: HierarchyOptions;\n rootNode: HierarchyNode;\n\n constructor(root: HierarchyData, options: HierarchyOptions = {}) {\n this.options = options;\n this.rootNode = hierarchy(root, options);\n }\n\n execute(): HierarchyNode {\n throw new Error('please override this method');\n }\n}\n","import type { HierarchyNode, HierarchyOptions } from '../types';\n\ninterface WrappedTreeNode {\n w: number;\n h: number;\n y: number;\n x: number;\n c: WrappedTreeNode[];\n cs: number;\n prelim: number;\n mod: number;\n shift: number;\n change: number;\n tl: WrappedTreeNode | null;\n tr: WrappedTreeNode | null;\n el: WrappedTreeNode | null;\n er: WrappedTreeNode | null;\n msel: number;\n mser: number;\n}\n\nclass WrappedTree implements WrappedTreeNode {\n w: number;\n h: number;\n y: number;\n x: number = 0;\n c: WrappedTreeNode[];\n cs: number;\n prelim: number = 0;\n mod: number = 0;\n shift: number = 0;\n change: number = 0;\n tl: WrappedTreeNode | null = null;\n tr: WrappedTreeNode | null = null;\n el: WrappedTreeNode | null = null;\n er: WrappedTreeNode | null = null;\n msel: number = 0;\n mser: number = 0;\n\n constructor(w: number = 0, h: number = 0, y: number = 0, c: WrappedTreeNode[] = []) {\n this.w = w || 0;\n this.h = h || 0;\n this.y = y || 0;\n this.c = c || [];\n this.cs = c.length;\n }\n\n static fromNode(root: HierarchyNode | null, isHorizontal?: boolean): WrappedTreeNode | null {\n if (!root) return null;\n const children: WrappedTreeNode[] = [];\n root.children.forEach((child) => {\n const wrappedChild = WrappedTree.fromNode(child, isHorizontal);\n if (wrappedChild) children.push(wrappedChild);\n });\n if (isHorizontal) {\n return new WrappedTree(root.height, root.width, root.x, children);\n }\n return new WrappedTree(root.width, root.height, root.y, children);\n }\n}\n\nfunction moveRight(node: HierarchyNode, move: number, isHorizontal?: boolean): void {\n if (isHorizontal) {\n node.y += move;\n } else {\n node.x += move;\n }\n node.children.forEach((child) => {\n moveRight(child, move, isHorizontal);\n });\n}\n\nfunction getMin(node: HierarchyNode, isHorizontal?: boolean): number {\n let res = isHorizontal ? node.y : node.x;\n node.children.forEach((child) => {\n res = Math.min(getMin(child, isHorizontal), res);\n });\n return res;\n}\n\nfunction normalize(node: HierarchyNode, isHorizontal?: boolean): void {\n const min = getMin(node, isHorizontal);\n moveRight(node, -min, isHorizontal);\n}\n\nfunction convertBack(\n converted: WrappedTreeNode,\n root: HierarchyNode,\n isHorizontal?: boolean,\n): void {\n if (isHorizontal) {\n root.y = converted.x;\n } else {\n root.x = converted.x;\n }\n converted.c.forEach((child, i) => {\n convertBack(child, root.children[i], isHorizontal);\n });\n}\n\nfunction layer(node: HierarchyNode, isHorizontal?: boolean, d: number = 0): void {\n if (isHorizontal) {\n node.x = d;\n d += node.width;\n } else {\n node.y = d;\n d += node.height;\n }\n node.children.forEach((child) => {\n layer(child, isHorizontal, d);\n });\n}\n\ninterface IYL {\n low: number;\n index: number;\n nxt: IYL | null;\n}\n\nexport default function nonLayeredTidy(\n root: HierarchyNode,\n options: HierarchyOptions = {},\n): HierarchyNode {\n const isHorizontal = options.isHorizontal;\n\n function firstWalk(t: WrappedTreeNode): void {\n if (t.cs === 0) {\n setExtremes(t);\n return;\n }\n firstWalk(t.c[0]);\n let ih: IYL | null = updateIYL(bottom(t.c[0].el!), 0, null);\n for (let i = 1; i < t.cs; ++i) {\n firstWalk(t.c[i]);\n const min = bottom(t.c[i].er!);\n separate(t, i, ih);\n ih = updateIYL(min, i, ih);\n }\n positionRoot(t);\n setExtremes(t);\n }\n\n function setExtremes(t: WrappedTreeNode): void {\n if (t.cs === 0) {\n t.el = t;\n t.er = t;\n t.msel = t.mser = 0;\n } else {\n t.el = t.c[0].el;\n t.msel = t.c[0].msel;\n t.er = t.c[t.cs - 1].er;\n t.mser = t.c[t.cs - 1].mser;\n }\n }\n\n function separate(t: WrappedTreeNode, i: number, ih: IYL | null): void {\n let sr: WrappedTreeNode | null = t.c[i - 1];\n let mssr = sr.mod;\n let cl: WrappedTreeNode | null = t.c[i];\n let mscl = cl.mod;\n while (sr !== null && cl !== null) {\n if (ih && bottom(sr) > ih.low) ih = ih.nxt;\n const dist = mssr + sr.prelim + sr.w - (mscl + cl.prelim);\n if (dist > 0) {\n mscl += dist;\n if (ih) moveSubtree(t, i, ih.index, dist);\n }\n const sy = bottom(sr);\n const cy = bottom(cl);\n if (sy <= cy) {\n sr = nextRightContour(sr);\n if (sr !== null) mssr += sr.mod;\n }\n if (sy >= cy) {\n cl = nextLeftContour(cl);\n if (cl !== null) mscl += cl.mod;\n }\n }\n if (!sr && !!cl) {\n setLeftThread(t, i, cl, mscl);\n } else if (!!sr && !cl) {\n setRightThread(t, i, sr, mssr);\n }\n }\n\n function moveSubtree(t: WrappedTreeNode, i: number, si: number, dist: number): void {\n t.c[i].mod += dist;\n t.c[i].msel += dist;\n t.c[i].mser += dist;\n distributeExtra(t, i, si, dist);\n }\n\n function nextLeftContour(t: WrappedTreeNode): WrappedTreeNode | null {\n return t.cs === 0 ? t.tl : t.c[0];\n }\n\n function nextRightContour(t: WrappedTreeNode): WrappedTreeNode | null {\n return t.cs === 0 ? t.tr : t.c[t.cs - 1];\n }\n\n function bottom(t: WrappedTreeNode): number {\n return t.y + t.h;\n }\n\n function setLeftThread(\n t: WrappedTreeNode,\n i: number,\n cl: WrappedTreeNode,\n modsumcl: number,\n ): void {\n const li = t.c[0].el!;\n li.tl = cl;\n const diff = modsumcl - cl.mod - t.c[0].msel;\n li.mod += diff;\n li.prelim -= diff;\n t.c[0].el = t.c[i].el;\n t.c[0].msel = t.c[i].msel;\n }\n\n function setRightThread(\n t: WrappedTreeNode,\n i: number,\n sr: WrappedTreeNode,\n modsumsr: number,\n ): void {\n const ri = t.c[i].er!;\n ri.tr = sr;\n const diff = modsumsr - sr.mod - t.c[i].mser;\n ri.mod += diff;\n ri.prelim -= diff;\n t.c[i].er = t.c[i - 1].er;\n t.c[i].mser = t.c[i - 1].mser;\n }\n\n function positionRoot(t: WrappedTreeNode): void {\n t.prelim =\n (t.c[0].prelim + t.c[0].mod + t.c[t.cs - 1].mod + t.c[t.cs - 1].prelim + t.c[t.cs - 1].w) /\n 2 -\n t.w / 2;\n }\n\n function secondWalk(t: WrappedTreeNode, modsum: number): void {\n modsum += t.mod;\n t.x = t.prelim + modsum;\n addChildSpacing(t);\n for (let i = 0; i < t.cs; i++) {\n secondWalk(t.c[i], modsum);\n }\n }\n\n function distributeExtra(t: WrappedTreeNode, i: number, si: number, dist: number): void {\n if (si !== i - 1) {\n const nr = i - si;\n t.c[si + 1].shift += dist / nr;\n t.c[i].shift -= dist / nr;\n t.c[i].change -= dist - dist / nr;\n }\n }\n\n function addChildSpacing(t: WrappedTreeNode): void {\n let d = 0;\n let modsumdelta = 0;\n for (let i = 0; i < t.cs; i++) {\n d += t.c[i].shift;\n modsumdelta += d + t.c[i].change;\n t.c[i].mod += modsumdelta;\n }\n }\n\n function updateIYL(low: number, index: number, ih: IYL | null): IYL {\n while (ih !== null && low >= ih.low) {\n ih = ih.nxt;\n }\n return {\n low,\n index,\n nxt: ih,\n };\n }\n\n // do layout\n layer(root, isHorizontal);\n const wt = WrappedTree.fromNode(root, isHorizontal);\n if (wt) {\n firstWalk(wt);\n secondWalk(wt, 0);\n convertBack(wt, root, isHorizontal);\n normalize(root, isHorizontal);\n }\n\n return root;\n}\n","import hierarchy from './hierarchy';\nimport type { HierarchyNode, HierarchyOptions } from '../types';\n\nexport default function separateRoot(\n root: HierarchyNode,\n options: HierarchyOptions,\n): { left: HierarchyNode; right: HierarchyNode } {\n // separate into left and right trees\n const left = hierarchy(root.data, options, true); // root only\n const right = hierarchy(root.data, options, true); // root only\n\n // automatically\n const treeSize = root.children.length;\n const rightTreeSize = Math.round(treeSize / 2);\n\n // separate left and right tree by meta data\n const getSide =\n options.getSide ||\n function (_child: HierarchyNode, index: number): 'left' | 'right' {\n if (index < rightTreeSize) {\n return 'right';\n }\n return 'left';\n };\n\n for (let i = 0; i < treeSize; i++) {\n const child = root.children[i];\n const side = getSide(child, i);\n if (side === 'right') {\n right.children.push(child);\n } else {\n left.children.push(child);\n }\n }\n\n left.eachNode((node) => {\n if (!node.isRoot()) {\n node.side = 'left';\n }\n });\n\n right.eachNode((node) => {\n if (!node.isRoot()) {\n node.side = 'right';\n }\n });\n\n return {\n left,\n right,\n };\n}\n","import separateTree from './separate-root';\nimport type { HierarchyNode, HierarchyOptions, Direction } from '../types';\n\nconst VALID_DIRECTIONS: Direction[] = [\n 'LR', // left to right\n 'RL', // right to left\n 'TB', // top to bottom\n 'BT', // bottom to top\n 'H', // horizontal\n 'V', // vertical\n];\n\nconst HORIZONTAL_DIRECTIONS: Direction[] = ['LR', 'RL', 'H'];\n\nconst isHorizontal = (direction: Direction): boolean =>\n HORIZONTAL_DIRECTIONS.indexOf(direction) > -1;\n\nconst DEFAULT_DIRECTION: Direction = VALID_DIRECTIONS[0];\n\ntype LayoutAlgorithm = (root: HierarchyNode, options: HierarchyOptions) => HierarchyNode;\n\nexport default function doLayout(\n root: HierarchyNode,\n options: HierarchyOptions,\n layoutAlgorithm: LayoutAlgorithm,\n): HierarchyNode {\n const direction = options.direction || DEFAULT_DIRECTION;\n options.isHorizontal = isHorizontal(direction);\n\n if (direction && VALID_DIRECTIONS.indexOf(direction) === -1) {\n throw new TypeError(`Invalid direction: ${direction}`);\n }\n\n if (direction === VALID_DIRECTIONS[0]) {\n // LR\n layoutAlgorithm(root, options);\n } else if (direction === VALID_DIRECTIONS[1]) {\n // RL\n layoutAlgorithm(root, options);\n root.right2left();\n } else if (direction === VALID_DIRECTIONS[2]) {\n // TB\n layoutAlgorithm(root, options);\n } else if (direction === VALID_DIRECTIONS[3]) {\n // BT\n layoutAlgorithm(root, options);\n root.bottom2top();\n } else if (direction === VALID_DIRECTIONS[4] || direction === VALID_DIRECTIONS[5]) {\n // H or V\n // separate into left and right trees\n const { left, right } = separateTree(root, options);\n // do layout for left and right trees\n layoutAlgorithm(left, options);\n layoutAlgorithm(right, options);\n if (options.isHorizontal) {\n left.right2left();\n } else {\n left.bottom2top();\n }\n // combine left and right trees\n right.translate(left.x - right.x, left.y - right.y);\n // translate root\n root.x = left.x;\n root.y = right.y;\n const bb = root.getBoundingBox();\n if (options.isHorizontal) {\n if (bb.top < 0) {\n root.translate(0, -bb.top);\n }\n } else {\n if (bb.left < 0) {\n root.translate(-bb.left, 0);\n }\n }\n }\n\n // fixed root position, default value is true\n let fixedRoot = options.fixedRoot;\n if (fixedRoot === undefined) fixedRoot = true;\n if (fixedRoot) {\n root.translate(-(root.x + root.width / 2 + root.hgap), -(root.y + root.height / 2 + root.vgap));\n }\n\n reassignXYIfRadial(root, options);\n\n return root;\n}\n\nfunction reassignXYIfRadial(root: HierarchyNode, options: HierarchyOptions): void {\n if (options.radial) {\n const [rScale, radScale] = options.isHorizontal ? ['x', 'y'] : ['y', 'x'];\n\n const min = { x: Infinity, y: Infinity };\n const max = { x: -Infinity, y: -Infinity };\n\n let count = 0;\n root.DFTraverse((node) => {\n count++;\n const { x, y } = node;\n min.x = Math.min(min.x, x);\n min.y = Math.min(min.y, y);\n max.x = Math.max(max.x, x);\n max.y = Math.max(max.y, y);\n });\n\n const radDiff = max[radScale as 'x' | 'y'] - min[radScale as 'x' | 'y'];\n if (radDiff === 0) return;\n\n const avgRad = (Math.PI * 2) / count;\n root.DFTraverse((node) => {\n const nodeRadScale = node[radScale as 'x' | 'y'];\n const minRadScale = min[radScale as 'x' | 'y'];\n const nodeRScale = node[rScale as 'x' | 'y'];\n const rootRScale = root[rScale as 'x' | 'y'];\n\n const rad = ((nodeRadScale - minRadScale) / radDiff) * (Math.PI * 2 - avgRad) + avgRad;\n const r = nodeRScale - rootRScale;\n node.x = Math.cos(rad) * r;\n node.y = Math.sin(rad) * r;\n });\n }\n}\n","import TreeLayout from './layout/base';\nimport nonLayeredTidyTree from './layout/non-layered-tidy';\nimport doTreeLayout from './layout/do-layout';\nimport { assign } from './util';\nimport type { HierarchyData, HierarchyNode, CompactBoxOptions } from './types';\n\nclass CompactBoxTreeLayout extends TreeLayout {\n execute(): HierarchyNode {\n return doTreeLayout(this.rootNode, this.options, nonLayeredTidyTree);\n }\n}\n\nconst DEFAULT_OPTIONS: CompactBoxOptions = {};\n\nexport default function compactBoxLayout(\n root: HierarchyData,\n options?: CompactBoxOptions,\n): HierarchyNode {\n const mergedOptions = assign({}, DEFAULT_OPTIONS, options);\n return new CompactBoxTreeLayout(root, mergedOptions).execute();\n}\n","import { assign } from '../util';\nimport type { HierarchyNode, HierarchyOptions } from '../types';\n\ninterface WrappedTreeNode {\n x: number;\n y: number;\n height: number;\n leftChild: WrappedTreeNode | null;\n rightChild: WrappedTreeNode | null;\n children: WrappedTreeNode[];\n originNode: HierarchyNode;\n isLeaf: boolean;\n drawingDepth?: number;\n}\n\nclass WrappedTree implements WrappedTreeNode {\n x: number = 0;\n y: number = 0;\n height: number;\n leftChild: WrappedTreeNode | null = null;\n rightChild: WrappedTreeNode | null = null;\n children: WrappedTreeNode[];\n originNode!: HierarchyNode;\n isLeaf: boolean = false;\n\n constructor(height: number = 0, children: WrappedTreeNode[] = []) {\n this.height = height;\n this.children = children;\n }\n}\n\nconst DEFAULT_OPTIONS = {\n isHorizontal: true,\n nodeSep: 20,\n nodeSize: 20,\n rankSep: 200,\n subTreeSep: 10,\n};\n\nfunction convertBack(converted: WrappedTreeNode, root: HierarchyNode, isHorizontal: boolean): void {\n if (isHorizontal) {\n root.x = converted.x;\n root.y = converted.y;\n } else {\n root.x = converted.y;\n root.y = converted.x;\n }\n converted.children.forEach((child, i) => {\n convertBack(child, root.children[i], isHorizontal);\n });\n}\n\nexport default function dendrogram(\n root: HierarchyNode,\n options: HierarchyOptions = {},\n): HierarchyNode {\n const mergedOptions = assign({}, DEFAULT_OPTIONS, options);\n\n let maxDepth = 0;\n\n function wrappedTreeFromNode(n: HierarchyNode): WrappedTreeNode {\n n.width = 0;\n if (n.depth && n.depth > maxDepth) {\n maxDepth = n.depth;\n }\n const children = n.children;\n const childrenCount = children.length;\n const t = new WrappedTree(n.height, []);\n children.forEach((child, i) => {\n const childWT = wrappedTreeFromNode(child);\n t.children.push(childWT);\n if (i === 0) {\n t.leftChild = childWT;\n }\n if (i === childrenCount - 1) {\n t.rightChild = childWT;\n }\n });\n t.originNode = n;\n t.isLeaf = n.isLeaf();\n return t;\n }\n\n function getDrawingDepth(t: WrappedTreeNode): number {\n if (t.isLeaf || t.children.length === 0) {\n t.drawingDepth = maxDepth;\n } else {\n const depths = t.children.map((child) => getDrawingDepth(child));\n const minChildDepth = Math.min(...depths);\n t.drawingDepth = minChildDepth - 1;\n }\n return t.drawingDepth;\n }\n\n let prevLeaf: WrappedTreeNode | null = null;\n\n function position(t: WrappedTreeNode): void {\n t.x = t.drawingDepth! * mergedOptions.rankSep;\n if (t.isLeaf) {\n t.y = 0;\n if (prevLeaf) {\n t.y = prevLeaf.y + prevLeaf.height + mergedOptions.nodeSep;\n if (t.originNode.parent !== prevLeaf.originNode.parent) {\n t.y += mergedOptions.subTreeSep;\n }\n }\n prevLeaf = t;\n } else {\n t.children.forEach((child) => {\n position(child);\n });\n t.y = (t.leftChild!.y + t.rightChild!.y) / 2;\n }\n }\n\n const wt = wrappedTreeFromNode(root);\n getDrawingDepth(wt);\n position(wt);\n convertBack(wt, root, mergedOptions.isHorizontal);\n\n return root;\n}\n","import TreeLayout from './layout/base';\nimport dendrogram from './layout/dendrogram';\nimport doTreeLayout from './layout/do-layout';\nimport { assign } from './util';\nimport type { HierarchyData, HierarchyNode, DendrogramOptions } from './types';\n\nclass DendrogramLayout extends TreeLayout {\n execute(): HierarchyNode {\n this.rootNode.width = 0;\n return doTreeLayout(this.rootNode, this.options, dendrogram);\n }\n}\n\nconst DEFAULT_OPTIONS: DendrogramOptions = {};\n\nexport default function dendrogramLayout(\n root: HierarchyData,\n options?: DendrogramOptions,\n): HierarchyNode {\n const mergedOptions = assign({}, DEFAULT_OPTIONS, options);\n return new DendrogramLayout(root, mergedOptions).execute();\n}\n","import { getHeight } from '../util';\nimport type { HierarchyNode } from '../types';\n\nfunction positionNode(\n node: HierarchyNode,\n previousNode: HierarchyNode | null,\n indent: number | ((node: HierarchyNode) => number),\n dropCap: boolean,\n align?: 'center' | undefined,\n): void {\n // calculate the node's horizontal offset DX, dx's type might be number or function\n const displacementX = (typeof indent === 'function' ? indent(node) : indent) * node.depth;\n\n if (!dropCap) {\n try {\n if (node.parent && node.id === node.parent.children[0].id) {\n node.x += displacementX;\n node.y = previousNode ? previousNode.y : 0;\n return;\n }\n } catch {\n // skip to normal when a node has no parent\n }\n }\n\n node.x += displacementX;\n if (previousNode) {\n node.y = previousNode.y + getHeight(previousNode, node, align);\n if (previousNode.parent && node.parent && node.parent.id !== previousNode.parent.id) {\n // previous node has different parent\n const prevParent = previousNode.parent;\n const preY = prevParent.y + getHeight(prevParent, node, align);\n node.y = preY > node.y ? preY : node.y;\n }\n } else {\n node.y = 0;\n }\n}\n\nexport default function indented(\n root: HierarchyNode,\n indent: number | ((node: HierarchyNode) => number),\n dropCap: boolean,\n align?: 'center' | undefined,\n): void {\n let previousNode: HierarchyNode | null = null;\n root.eachNode((node) => {\n positionNode(node, previousNode, indent, dropCap, align);\n previousNode = node;\n });\n}\n","import TreeLayout from './layout/base';\nimport indentedTree from './layout/indented';\nimport separateTree from './layout/separate-root';\nimport { assign } from './util';\nimport type { HierarchyData, HierarchyNode, IndentedOptions, Direction } from './types';\n\nconst VALID_DIRECTIONS: Direction[] = [\n 'LR', // left to right\n 'RL', // right to left\n 'H', // horizontal\n];\nconst DEFAULT_DIRECTION: Direction = VALID_DIRECTIONS[0];\n\nclass IndentedLayout extends TreeLayout {\n execute(): HierarchyNode {\n const options = this.options as IndentedOptions;\n const root = this.rootNode;\n options.isHorizontal = true;\n\n // default indent 20 and sink first children;\n const { indent = 20, dropCap = true, direction = DEFAULT_DIRECTION, align } = options;\n\n if (direction && VALID_DIRECTIONS.indexOf(direction) === -1) {\n throw new TypeError(`Invalid direction: ${direction}`);\n }\n\n if (direction === VALID_DIRECTIONS[0]) {\n // LR\n indentedTree(root, indent, dropCap, align);\n } else if (direction === VALID_DIRECTIONS[1]) {\n // RL\n indentedTree(root, indent, dropCap, align);\n root.right2left();\n } else if (direction === VALID_DIRECTIONS[2]) {\n // H\n // separate into left and right trees\n const { left, right } = separateTree(root, options);\n indentedTree(left, indent, dropCap, align);\n left.right2left();\n indentedTree(right, indent, dropCap, align);\n const bbox = left.getBoundingBox();\n right.translate(bbox.width, 0);\n root.x = right.x - root.width / 2;\n }\n\n return root;\n }\n}\n\nconst DEFAULT_OPTIONS: IndentedOptions = {};\n\nexport default function indentedLayout(\n root: HierarchyData,\n options?: IndentedOptions,\n): HierarchyNode {\n const mergedOptions = assign({}, DEFAULT_OPTIONS, options);\n return new IndentedLayout(root, mergedOptions).execute();\n}\n","import { assign } from '../util';\nimport type { HierarchyNode, HierarchyOptions } from '../types';\n\nfunction secondWalk(node: HierarchyNode, options: HierarchyOptions): number {\n let totalHeight = 0;\n if (!node.children.length) {\n totalHeight = node.height;\n } else {\n node.children.forEach((c) => {\n totalHeight += secondWalk(c, options);\n });\n }\n node._subTreeSep = options.getSubTreeSep!(node.data);\n node.totalHeight = Math.max(node.height, totalHeight) + 2 * node._subTreeSep;\n return node.totalHeight;\n}\n\nfunction thirdWalk(node: HierarchyNode): void {\n const children = node.children;\n const len = children.length;\n if (len) {\n children.forEach((c) => {\n thirdWalk(c);\n });\n const first = children[0];\n const last = children[len - 1];\n const childrenHeight = last.y - first.y + last.height;\n let childrenTotalHeight = 0;\n children.forEach((child) => {\n childrenTotalHeight += child.totalHeight!;\n });\n if (childrenHeight > node.height) {\n // 当子节点总高度大于父节点高度\n node.y = first.y + childrenHeight / 2 - node.height / 2;\n } else if (children.length !== 1 || node.height > childrenTotalHeight) {\n // 多于一个子节点或者父节点大于所有子节点的总高度\n const offset = node.y + (node.height - childrenHeight) / 2 - first.y;\n children.forEach((c) => {\n c.translate(0, offset);\n });\n } else {\n // 只有一个子节点\n node.y = (first.y + first.height / 2 + last.y + last.height / 2) / 2 - node.height / 2;\n }\n }\n}\n\nconst DEFAULT_OPTIONS: HierarchyOptions = {\n getSubTreeSep() {\n return 0;\n },\n};\n\nexport default function mindmap(\n root: HierarchyNode,\n options: HierarchyOptions = {},\n): HierarchyNode {\n options = assign({}, DEFAULT_OPTIONS, options);\n\n root.parent = {\n x: 0,\n width: 0,\n height: 0,\n y: 0,\n } as HierarchyNode;\n\n // first walk\n root.BFTraverse((node) => {\n node.x = node.parent!.x + node.parent!.width;\n });\n\n root.parent = undefined;\n\n // second walk\n secondWalk(root, options);\n\n // adjusting\n // separating nodes\n root.startY = 0;\n root.y = root.totalHeight! / 2 - root.height / 2;\n root.eachNode((node) => {\n const children = node.children;\n const len = children.length;\n if (len) {\n const first = children[0];\n first.startY = node.startY! + node._subTreeSep!;\n if (len === 1) {\n first.y = node.y + node.height / 2 - first.height / 2;\n } else {\n first.y = first.startY + first.totalHeight! / 2 - first.height / 2;\n for (let i = 1; i < len; i++) {\n const c = children[i];\n c.startY = children[i - 1].startY! + children[i - 1].totalHeight!;\n c.y = c.startY + c.totalHeight! / 2 - c.height / 2;\n }\n }\n }\n });\n\n // third walk\n thirdWalk(root);\n\n return root;\n}\n","import TreeLayout from './layout/base';\nimport mindmap from './layout/mindmap';\nimport doTreeLayout from './layout/do-layout';\nimport { assign } from './util';\nimport type { HierarchyData, HierarchyNode, MindmapOptions } from './types';\n\nclass MindmapLayout extends TreeLayout {\n execute(): HierarchyNode {\n return doTreeLayout(this.rootNode, this.options, mindmap);\n }\n}\n\nconst DEFAULT_OPTIONS: MindmapOptions = {};\n\nexport default function mindmapLayout(\n root: HierarchyData,\n options?: MindmapOptions,\n): HierarchyNode {\n const mergedOptions = assign({}, DEFAULT_OPTIONS, options);\n return new MindmapLayout(root, mergedOptions).execute();\n}\n","import compactBox from './compact-box';\nimport dendrogram from './dendrogram';\nimport indented from './indented';\nimport mindmap from './mindmap';\n\nexport { compactBox, dendrogram, indented, mindmap };\n\nexport * from './types';\n\nexport default {\n compactBox,\n dendrogram,\n indented,\n mindmap,\n};\n\nexport const version = '0.7.0';\n"],"names":["getHeight","preNode","node","align","heightField","preNodeHeight","nodeHeight","height","assign","Object","DEFAULT_OPTIONS","getId","d","id","name","getPreH","preH","getPreV","preV","getHGap","hgap","getVGap","vgap","getChildren","children","PEM","getWidth","label","width","split","length","Node","constructor","data","options","this","x","y","depth","parent","addGap","isRoot","isLeaf","eachNode","callback","current","nodes","shift","concat","DFTraverse","BFTraverse","getBoundingBox","bb","left","Number","MAX_VALUE","top","Math","min","max","translate","tx","ty","right2left","bottom2top","hierarchy","isolated","root","collapsed","Array","i","child","push","Layout","rootNode","execute","Error","WrappedTree$1","WrappedTree","w","h","c","prelim","mod","change","tl","tr","el","er","msel","mser","cs","fromNode","isHorizontal","forEach","wrappedChild","moveRight","move","getMin","res","normalize","convertBack","converted","layer","nonLayeredTidy","setExtremes","t","separate","ih","sr","mssr","cl","mscl","bottom","low","nxt","dist","moveSubtree","index","sy","cy","nextRightContour","nextLeftContour","modsumcl","li","diff","setLeftThread","modsumsr","ri","setRightThread","si","nr","distributeExtra","updateIYL","wt","firstWalk","positionRoot","secondWalk","modsum","modsumdelta","addChildSpacing","separateRoot","right","treeSize","rightTreeSize","round","getSide","_child","side","VALID_DIRECTIONS","HORIZONTAL_DIRECTIONS","DEFAULT_DIRECTION","doLayout","layoutAlgorithm","direction","indexOf","TypeError","separateTree","fixedRoot","radial","rScale","radScale","Infinity","count","radDiff","avgRad","PI","nodeRadScale","minRadScale","nodeRScale","rootRScale","rad","r","cos","sin","reassignXYIfRadial","CompactBoxTreeLayout","TreeLayout","doTreeLayout","nonLayeredTidyTree","compactBoxLayout","mergedOptions","leftChild","rightChild","nodeSep","nodeSize","rankSep","subTreeSep","dendrogram","maxDepth","prevLeaf","wrappedTreeFromNode","n","childrenCount","childWT","originNode","getDrawingDepth","drawingDepth","depths","map","minChildDepth","position","DendrogramLayout","dendrogramLayout","indented","indent","dropCap","previousNode","displacementX","prevParent","preY","positionNode","IndentedLayout","indentedTree","bbox","indentedLayout","totalHeight","_subTreeSep","getSubTreeSep","thirdWalk","len","first","last","childrenHeight","childrenTotalHeight","offset","mindmap","startY","MindmapLayout","mindmapLayout","compactBox","version"],"mappings":"AAUO,SAASA,EACdC,EACAC,EACAC,EACAC,EAAmC,UAEnC,MAAMC,EAAgBJ,EAAQG,GACxBE,EAAaJ,EAAKE,GACxB,MAAiB,WAAVD,GAAsBE,EAAgBC,GAAc,EAAIL,EAAQM,MACzE,CAEO,MAAMC,EAASC,OAAOD,OCdvBE,EAYF,CACFC,MAAMC,GACIA,EAAEC,IAAMD,EAAEE,KAEpBC,QAAQH,GACCA,EAAEI,MAAQ,EAEnBC,QAAQL,GACCA,EAAEM,MAAQ,EAEnBC,QAAQP,GACCA,EAAEQ,MA3BD,GA6BVC,QAAQT,GACCA,EAAEU,MA9BD,GAgCVC,YAAYX,GACHA,EAAEY,SAEXxB,UAAUY,GACDA,EAAEL,QAnCUkB,GAqCrB,QAAAC,CAASd,GACP,MAAMe,EAAQf,EAAEe,OAAS,IACzB,OAAOf,EAAEgB,OAxCD,GAwCUD,EAAME,MAAM,IAAIC,MACpC,GAGF,MAAMC,EAeJ,WAAAC,CAAYC,EAAqCC,GAC/C,GAbFC,KAAAC,EAAY,EACZD,KAAAE,EAAY,EAGZF,KAAAG,MAAgB,EAChBH,KAAAX,SAA4B,GAE5BW,KAAAf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IsJ,EAAKtJ,IAAK,CAC5B,MAAMW,EAAIzD,EAAS8C,GACnBW,EAAEkJ,OAAS3M,EAAS8C,EAAI,GAAG6J,OAAU3M,EAAS8C,EAAI,GAAGkJ,YACrDvI,EAAE5C,EAAI4C,EAAEkJ,OAASlJ,EAAEuI,YAAe,EAAIvI,EAAE1E,OAAS,CACnD,CACF,CACF,IAIFoN,EAAUxJ,GAEHA,CACT,CCjGA,MAAMiK,UAAsBnD,EAC1B,OAAAtG,GACE,OAAOuG,EAAa/I,KAAKuC,SAAUvC,KAAKD,QAASgM,EACnD,EAGF,MAAMxN,EAAkC,CAAA,EAExC,SAAwB2N,EACtBlK,EACAjC,GAEA,MAAMmJ,EAAgB7K,EAAO,GAAIE,EAAiBwB,GAClD,OAAO,IAAIkM,EAAcjK,EAAMkH,GAAe1G,SAChD,CCXA,MAAA2C,EAAe,CAAAgH,WACbA,EAAA1C,WACAA,EAAAgB,SACAA,EAAAsB,QACAA,GAGWK,EAAU"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Hierarchy={})}(this,function(t){"use strict";function e(t,e,i,n="height"){const h=t[n],o=e[n];return"center"===i?(h+o)/2:t.height}const i=Object.assign,n={getId:t=>t.id||t.name,getPreH:t=>t.preH||0,getPreV:t=>t.preV||0,getHGap:t=>t.hgap||18,getVGap:t=>t.vgap||18,getChildren:t=>t.children,getHeight:t=>t.height||36,getWidth(t){const e=t.label||" ";return t.width||18*e.split("").length}};class h{constructor(t,e){if(this.x=0,this.y=0,this.depth=0,this.children=[],this.hgap=0,this.vgap=0,t instanceof h||"x"in t&&"y"in t&&"children"in t){const e=t;return this.data=e.data,this.id=e.id,this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.depth=e.depth,this.children=e.children,this.parent=e.parent,this.hgap=e.hgap,this.vgap=e.vgap,this.preH=e.preH,void(this.preV=e.preV)}this.data=t;const i=e.getHGap(t),n=e.getVGap(t);this.preH=e.getPreH(t),this.preV=e.getPreV(t),this.width=e.getWidth(t),this.height=e.getHeight(t),this.width+=this.preH,this.height+=this.preV,this.id=e.getId(t),this.addGap(i,n)}isRoot(){return 0===this.depth}isLeaf(){return 0===this.children.length}addGap(t,e){this.hgap+=t,this.vgap+=e,this.width+=2*t,this.height+=2*e}eachNode(t){let e,i=[this];for(;e=i.shift();)t(e),i=e.children.concat(i)}DFTraverse(t){this.eachNode(t)}BFTraverse(t){let e,i=[this];for(;e=i.shift();)t(e),i=i.concat(e.children)}getBoundingBox(){const t={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(e=>{t.left=Math.min(t.left,e.x),t.top=Math.min(t.top,e.y),t.width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height)}),t}translate(t=0,e=0){this.eachNode(i=>{i.x+=t,i.y+=e,i.x+=i.preH,i.y+=i.preV})}right2left(){const t=this.getBoundingBox();this.eachNode(e=>{e.x=e.x-2*(e.x-t.left)-e.width}),this.translate(t.width,0)}bottom2top(){const t=this.getBoundingBox();this.eachNode(e=>{e.y=e.y-2*(e.y-t.top)-e.height}),this.translate(0,t.height)}}function o(t,e={},o){e=i({},n,e);const r=new h(t,e),s=[r];let c;if(!o&&!t.collapsed)for(;c=s.shift();)if(!c.data.collapsed){const t=e.getChildren(c.data),i=t?t.length:0;if(c.children=new Array(i),t&&i)for(let n=0;n<i;n++){const i=new h(t[n],e);c.children[n]=i,s.push(i),i.parent=c,i.depth=c.depth+1}}return r}class r{constructor(t,e={}){this.options=e,this.rootNode=o(t,e)}execute(){throw new Error("please override this method")}}let s=class t{constructor(t=0,e=0,i=0,n=[]){this.x=0,this.prelim=0,this.mod=0,this.shift=0,this.change=0,this.tl=null,this.tr=null,this.el=null,this.er=null,this.msel=0,this.mser=0,this.w=t||0,this.h=e||0,this.y=i||0,this.c=n||[],this.cs=n.length}static fromNode(e,i){if(!e)return null;const n=[];return e.children.forEach(e=>{const h=t.fromNode(e,i);h&&n.push(h)}),i?new t(e.height,e.width,e.x,n):new t(e.width,e.height,e.y,n)}};function c(t,e,i){i?t.y+=e:t.x+=e,t.children.forEach(t=>{c(t,e,i)})}function l(t,e){let i=e?t.y:t.x;return t.children.forEach(t=>{i=Math.min(l(t,e),i)}),i}function d(t,e){c(t,-l(t,e),e)}function a(t,e,i){i?e.y=t.x:e.x=t.x,t.c.forEach((t,n)=>{a(t,e.children[n],i)})}function f(t,e,i=0){e?(t.x=i,i+=t.width):(t.y=i,i+=t.height),t.children.forEach(t=>{f(t,e,i)})}function u(t,e={}){const i=e.isHorizontal;function n(t){0===t.cs?(t.el=t,t.er=t,t.msel=t.mser=0):(t.el=t.c[0].el,t.msel=t.c[0].msel,t.er=t.c[t.cs-1].er,t.mser=t.c[t.cs-1].mser)}function h(t,e,i){let n=t.c[e-1],h=n.mod,s=t.c[e],d=s.mod;for(;null!==n&&null!==s;){i&&l(n)>i.low&&(i=i.nxt);const a=h+n.prelim+n.w-(d+s.prelim);a>0&&(d+=a,i&&o(t,e,i.index,a));const f=l(n),u=l(s);f<=u&&(n=c(n),null!==n&&(h+=n.mod)),f>=u&&(s=r(s),null!==s&&(d+=s.mod))}!n&&s?function(t,e,i,n){const h=t.c[0].el;h.tl=i;const o=n-i.mod-t.c[0].msel;h.mod+=o,h.prelim-=o,t.c[0].el=t.c[e].el,t.c[0].msel=t.c[e].msel}(t,e,s,d):n&&!s&&function(t,e,i,n){const h=t.c[e].er;h.tr=i;const o=n-i.mod-t.c[e].mser;h.mod+=o,h.prelim-=o,t.c[e].er=t.c[e-1].er,t.c[e].mser=t.c[e-1].mser}(t,e,n,h)}function o(t,e,i,n){t.c[e].mod+=n,t.c[e].msel+=n,t.c[e].mser+=n,function(t,e,i,n){if(i!==e-1){const h=e-i;t.c[i+1].shift+=n/h,t.c[e].shift-=n/h,t.c[e].change-=n-n/h}}(t,e,i,n)}function r(t){return 0===t.cs?t.tl:t.c[0]}function c(t){return 0===t.cs?t.tr:t.c[t.cs-1]}function l(t){return t.y+t.h}function u(t,e,i){for(;null!==i&&t>=i.low;)i=i.nxt;return{low:t,index:e,nxt:i}}f(t,i);const g=s.fromNode(t,i);return g&&(!function t(e){if(0===e.cs)return void n(e);t(e.c[0]);let i=u(l(e.c[0].el),0,null);for(let n=1;n<e.cs;++n){t(e.c[n]);const o=l(e.c[n].er);h(e,n,i),i=u(o,n,i)}!function(t){t.prelim=(t.c[0].prelim+t.c[0].mod+t.c[t.cs-1].mod+t.c[t.cs-1].prelim+t.c[t.cs-1].w)/2-t.w/2}(e),n(e)}(g),function t(e,i){i+=e.mod,e.x=e.prelim+i,function(t){let e=0,i=0;for(let n=0;n<t.cs;n++)e+=t.c[n].shift,i+=e+t.c[n].change,t.c[n].mod+=i}(e);for(let n=0;n<e.cs;n++)t(e.c[n],i)}(g,0),a(g,t,i),d(t,i)),t}function g(t,e){const i=o(t.data,e,!0),n=o(t.data,e,!0),h=t.children.length,r=Math.round(h/2),s=e.getSide||function(t,e){return e<r?"right":"left"};for(let o=0;o<h;o++){const e=t.children[o];"right"===s(e,o)?n.children.push(e):i.children.push(e)}return i.eachNode(t=>{t.isRoot()||(t.side="left")}),n.eachNode(t=>{t.isRoot()||(t.side="right")}),{left:i,right:n}}const p=["LR","RL","TB","BT","H","V"],x=["LR","RL","H"],y=p[0];function m(t,e,i){const n=e.direction||y;if(e.isHorizontal=(t=>x.indexOf(t)>-1)(n),n&&-1===p.indexOf(n))throw new TypeError(`Invalid direction: ${n}`);if(n===p[0])i(t,e);else if(n===p[1])i(t,e),t.right2left();else if(n===p[2])i(t,e);else if(n===p[3])i(t,e),t.bottom2top();else if(n===p[4]||n===p[5]){const{left:n,right:h}=g(t,e);i(n,e),i(h,e),e.isHorizontal?n.right2left():n.bottom2top(),h.translate(n.x-h.x,n.y-h.y),t.x=n.x,t.y=h.y;const o=t.getBoundingBox();e.isHorizontal?o.top<0&&t.translate(0,-o.top):o.left<0&&t.translate(-o.left,0)}let h=e.fixedRoot;return void 0===h&&(h=!0),h&&t.translate(-(t.x+t.width/2+t.hgap),-(t.y+t.height/2+t.vgap)),function(t,e){if(e.radial){const[i,n]=e.isHorizontal?["x","y"]:["y","x"],h={x:1/0,y:1/0},o={x:-1/0,y:-1/0};let r=0;t.DFTraverse(t=>{r++;const{x:e,y:i}=t;h.x=Math.min(h.x,e),h.y=Math.min(h.y,i),o.x=Math.max(o.x,e),o.y=Math.max(o.y,i)});const s=o[n]-h[n];if(0===s)return;const c=2*Math.PI/r;t.DFTraverse(e=>{const o=e[n],r=h[n],l=e[i],d=t[i],a=(o-r)/s*(2*Math.PI-c)+c,f=l-d;e.x=Math.cos(a)*f,e.y=Math.sin(a)*f})}}(t,e),t}class w extends r{execute(){return m(this.rootNode,this.options,u)}}const H={};function N(t,e){const n=i({},H,e);return new w(t,n).execute()}class v{constructor(t=0,e=[]){this.x=0,this.y=0,this.leftChild=null,this.rightChild=null,this.isLeaf=!1,this.height=t,this.children=e}}const M={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function b(t,e,i){i?(e.x=t.x,e.y=t.y):(e.x=t.y,e.y=t.x),t.children.forEach((t,n)=>{b(t,e.children[n],i)})}function T(t,e={}){const n=i({},M,e);let h=0;let o=null;const r=function t(e){e.width=0,e.depth&&e.depth>h&&(h=e.depth);const i=e.children,n=i.length,o=new v(e.height,[]);return i.forEach((e,i)=>{const h=t(e);o.children.push(h),0===i&&(o.leftChild=h),i===n-1&&(o.rightChild=h)}),o.originNode=e,o.isLeaf=e.isLeaf(),o}(t);return function t(e){if(e.isLeaf||0===e.children.length)e.drawingDepth=h;else{const i=e.children.map(e=>t(e)),n=Math.min(...i);e.drawingDepth=n-1}return e.drawingDepth}(r),function t(e){e.x=e.drawingDepth*n.rankSep,e.isLeaf?(e.y=0,o&&(e.y=o.y+o.height+n.nodeSep,e.originNode.parent!==o.originNode.parent&&(e.y+=n.subTreeSep)),o=e):(e.children.forEach(e=>{t(e)}),e.y=(e.leftChild.y+e.rightChild.y)/2)}(r),b(r,t,n.isHorizontal),t}class E extends r{execute(){return this.rootNode.width=0,m(this.rootNode,this.options,T)}}const S={};function B(t,e){const n=i({},S,e);return new E(t,n).execute()}function L(t,i,n,h){let o=null;t.eachNode(t=>{!function(t,i,n,h,o){const r=("function"==typeof n?n(t):n)*t.depth;if(!h)try{if(t.parent&&t.id===t.parent.children[0].id)return t.x+=r,void(t.y=i?i.y:0)}catch{}if(t.x+=r,i){if(t.y=i.y+e(i,t,o),i.parent&&t.parent&&t.parent.id!==i.parent.id){const n=i.parent,h=n.y+e(n,t,o);t.y=h>t.y?h:t.y}}else t.y=0}(t,o,i,n,h),o=t})}const V=["LR","RL","H"],R=V[0];class z extends r{execute(){const t=this.options,e=this.rootNode;t.isHorizontal=!0;const{indent:i=20,dropCap:n=!0,direction:h=R,align:o}=t;if(h&&-1===V.indexOf(h))throw new TypeError(`Invalid direction: ${h}`);if(h===V[0])L(e,i,n,o);else if(h===V[1])L(e,i,n,o),e.right2left();else if(h===V[2]){const{left:h,right:r}=g(e,t);L(h,i,n,o),h.right2left(),L(r,i,n,o);const s=h.getBoundingBox();r.translate(s.width,0),e.x=r.x-e.width/2}return e}}const C={};function D(t,e){const n=i({},C,e);return new z(t,n).execute()}function P(t,e){let i=0;return t.children.length?t.children.forEach(t=>{i+=P(t,e)}):i=t.height,t._subTreeSep=e.getSubTreeSep(t.data),t.totalHeight=Math.max(t.height,i)+2*t._subTreeSep,t.totalHeight}function Y(t){const e=t.children,i=e.length;if(i){e.forEach(t=>{Y(t)});const n=e[0],h=e[i-1],o=h.y-n.y+h.height;let r=0;if(e.forEach(t=>{r+=t.totalHeight}),o>t.height)t.y=n.y+o/2-t.height/2;else if(1!==e.length||t.height>r){const i=t.y+(t.height-o)/2-n.y;e.forEach(t=>{t.translate(0,i)})}else t.y=(n.y+n.height/2+h.y+h.height/2)/2-t.height/2}}const _={getSubTreeSep:()=>0};function G(t,e={}){return e=i({},_,e),t.parent={x:0,width:0,height:0,y:0},t.BFTraverse(t=>{t.x=t.parent.x+t.parent.width}),t.parent=void 0,P(t,e),t.startY=0,t.y=t.totalHeight/2-t.height/2,t.eachNode(t=>{const e=t.children,i=e.length;if(i){const n=e[0];if(n.startY=t.startY+t._subTreeSep,1===i)n.y=t.y+t.height/2-n.height/2;else{n.y=n.startY+n.totalHeight/2-n.height/2;for(let t=1;t<i;t++){const i=e[t];i.startY=e[t-1].startY+e[t-1].totalHeight,i.y=i.startY+i.totalHeight/2-i.height/2}}}}),Y(t),t}class I extends r{execute(){return m(this.rootNode,this.options,G)}}const A={};function F(t,e){const n=i({},A,e);return new I(t,n).execute()}const O={compactBox:N,dendrogram:B,indented:D,mindmap:F};t.compactBox=N,t.default=O,t.dendrogram=B,t.indented=D,t.mindmap=F,t.version="0.7.0",Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
2
|
+
//# sourceMappingURL=hierarchy.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hierarchy.umd.js","sources":["../src/util.ts","../src/layout/hierarchy.ts","../src/layout/base.ts","../src/layout/non-layered-tidy.ts","../src/layout/separate-root.ts","../src/layout/do-layout.ts","../src/compact-box.ts","../src/layout/dendrogram.ts","../src/dendrogram.ts","../src/layout/indented.ts","../src/indented.ts","../src/layout/mindmap.ts","../src/mindmap.ts","../src/index.ts"],"sourcesContent":["import type { HierarchyNode } from './types';\n\n/**\n * Get average height or height for node's position calculation, according to align.\n * @param preNode previous node\n * @param node current node, whose position is going to be calculated\n * @param align 'center' means nodes align at the center, other value means align at the left-top\n * @param heightField field name for height value on preNode and node\n * @return the height for calculation\n */\nexport function getHeight(\n preNode: HierarchyNode,\n node: HierarchyNode,\n align?: 'center' | undefined,\n heightField: keyof HierarchyNode = 'height',\n): number {\n const preNodeHeight = preNode[heightField] as number;\n const nodeHeight = node[heightField] as number;\n return align === 'center' ? (preNodeHeight + nodeHeight) / 2 : preNode.height;\n}\n\nexport const assign = Object.assign;\n","import { assign } from '../util';\nimport type { HierarchyData, HierarchyNode, HierarchyOptions, BoundingBox } from '../types';\n\nconst PEM = 18;\nconst DEFAULT_HEIGHT = PEM * 2;\nconst DEFAULT_GAP = PEM;\n\nconst DEFAULT_OPTIONS: Required<\n Pick<\n HierarchyOptions,\n | 'getId'\n | 'getPreH'\n | 'getPreV'\n | 'getHGap'\n | 'getVGap'\n | 'getChildren'\n | 'getHeight'\n | 'getWidth'\n >\n> = {\n getId(d: HierarchyData): string {\n return (d.id || d.name) as string;\n },\n getPreH(d: HierarchyData): number {\n return d.preH || 0;\n },\n getPreV(d: HierarchyData): number {\n return d.preV || 0;\n },\n getHGap(d: HierarchyData): number {\n return d.hgap || DEFAULT_GAP;\n },\n getVGap(d: HierarchyData): number {\n return d.vgap || DEFAULT_GAP;\n },\n getChildren(d: HierarchyData): HierarchyData[] | undefined {\n return d.children;\n },\n getHeight(d: HierarchyData): number {\n return d.height || DEFAULT_HEIGHT;\n },\n getWidth(d: HierarchyData): number {\n const label = d.label || ' ';\n return d.width || label.split('').length * PEM; // FIXME DO NOT get width like this\n },\n};\n\nclass Node implements HierarchyNode {\n data: HierarchyData;\n id: string;\n x: number = 0;\n y: number = 0;\n width: number;\n height: number;\n depth: number = 0;\n children: HierarchyNode[] = [];\n parent?: HierarchyNode;\n hgap: number = 0;\n vgap: number = 0;\n preH: number;\n preV: number;\n\n constructor(data: HierarchyData | HierarchyNode, options: HierarchyOptions) {\n if (data instanceof Node || ('x' in data && 'y' in data && 'children' in data)) {\n // If it's already a Node, cast and return\n const node = data as Node;\n this.data = node.data;\n this.id = node.id;\n this.x = node.x;\n this.y = node.y;\n this.width = node.width;\n this.height = node.height;\n this.depth = node.depth;\n this.children = node.children;\n this.parent = node.parent;\n this.hgap = node.hgap;\n this.vgap = node.vgap;\n this.preH = node.preH;\n this.preV = node.preV;\n return;\n }\n\n this.data = data as HierarchyData;\n\n /*\n * Gaps: filling space between nodes\n * (x, y) ----------------------\n * | vgap |\n * | -------------------- h\n * | h | | e\n * | g | | i\n * | a | | g\n * | p | | h\n * | --------------------- t\n * | |\n * -----------width------------\n */\n const hgap = options.getHGap!(data);\n const vgap = options.getVGap!(data);\n this.preH = options.getPreH!(data);\n this.preV = options.getPreV!(data);\n this.width = options.getWidth!(data);\n this.height = options.getHeight!(data);\n this.width += this.preH;\n this.height += this.preV;\n this.id = options.getId!(data);\n\n this.addGap(hgap, vgap);\n }\n\n isRoot(): boolean {\n return this.depth === 0;\n }\n\n isLeaf(): boolean {\n return this.children.length === 0;\n }\n\n addGap(hgap: number, vgap: number): void {\n this.hgap += hgap;\n this.vgap += vgap;\n this.width += 2 * hgap;\n this.height += 2 * vgap;\n }\n\n eachNode(callback: (node: HierarchyNode) => void): void {\n let nodes: HierarchyNode[] = [this];\n let current: HierarchyNode | undefined;\n while ((current = nodes.shift())) {\n callback(current);\n nodes = current.children.concat(nodes);\n }\n }\n\n DFTraverse(callback: (node: HierarchyNode) => void): void {\n this.eachNode(callback);\n }\n\n BFTraverse(callback: (node: HierarchyNode) => void): void {\n let nodes: HierarchyNode[] = [this];\n let current: HierarchyNode | undefined;\n while ((current = nodes.shift())) {\n callback(current);\n nodes = nodes.concat(current.children);\n }\n }\n\n getBoundingBox(): BoundingBox {\n const bb: BoundingBox = {\n left: Number.MAX_VALUE,\n top: Number.MAX_VALUE,\n width: 0,\n height: 0,\n };\n this.eachNode((node) => {\n bb.left = Math.min(bb.left, node.x);\n bb.top = Math.min(bb.top, node.y);\n bb.width = Math.max(bb.width, node.x + node.width);\n bb.height = Math.max(bb.height, node.y + node.height);\n });\n return bb;\n }\n\n translate(tx: number = 0, ty: number = 0): void {\n this.eachNode((node) => {\n node.x += tx;\n node.y += ty;\n node.x += node.preH;\n node.y += node.preV;\n });\n }\n\n right2left(): void {\n const bb = this.getBoundingBox();\n this.eachNode((node) => {\n node.x = node.x - (node.x - bb.left) * 2 - node.width;\n });\n this.translate(bb.width, 0);\n }\n\n bottom2top(): void {\n const bb = this.getBoundingBox();\n this.eachNode((node) => {\n node.y = node.y - (node.y - bb.top) * 2 - node.height;\n });\n this.translate(0, bb.height);\n }\n}\n\nexport default function hierarchy(\n data: HierarchyData,\n options: HierarchyOptions = {},\n isolated?: boolean,\n): HierarchyNode {\n options = assign({}, DEFAULT_OPTIONS, options);\n const root = new Node(data, options);\n const nodes: HierarchyNode[] = [root];\n let node: HierarchyNode | undefined;\n\n if (!isolated && !data.collapsed) {\n while ((node = nodes.shift())) {\n if (!node.data.collapsed) {\n const children = options.getChildren!(node.data);\n const length = children ? children.length : 0;\n node.children = new Array(length);\n if (children && length) {\n for (let i = 0; i < length; i++) {\n const child = new Node(children[i], options);\n node.children[i] = child;\n nodes.push(child);\n child.parent = node;\n child.depth = node.depth + 1;\n }\n }\n }\n }\n }\n\n return root;\n}\n","import hierarchy from './hierarchy';\nimport type { HierarchyData, HierarchyNode, HierarchyOptions } from '../types';\n\nexport default class Layout {\n options: HierarchyOptions;\n rootNode: HierarchyNode;\n\n constructor(root: HierarchyData, options: HierarchyOptions = {}) {\n this.options = options;\n this.rootNode = hierarchy(root, options);\n }\n\n execute(): HierarchyNode {\n throw new Error('please override this method');\n }\n}\n","import type { HierarchyNode, HierarchyOptions } from '../types';\n\ninterface WrappedTreeNode {\n w: number;\n h: number;\n y: number;\n x: number;\n c: WrappedTreeNode[];\n cs: number;\n prelim: number;\n mod: number;\n shift: number;\n change: number;\n tl: WrappedTreeNode | null;\n tr: WrappedTreeNode | null;\n el: WrappedTreeNode | null;\n er: WrappedTreeNode | null;\n msel: number;\n mser: number;\n}\n\nclass WrappedTree implements WrappedTreeNode {\n w: number;\n h: number;\n y: number;\n x: number = 0;\n c: WrappedTreeNode[];\n cs: number;\n prelim: number = 0;\n mod: number = 0;\n shift: number = 0;\n change: number = 0;\n tl: WrappedTreeNode | null = null;\n tr: WrappedTreeNode | null = null;\n el: WrappedTreeNode | null = null;\n er: WrappedTreeNode | null = null;\n msel: number = 0;\n mser: number = 0;\n\n constructor(w: number = 0, h: number = 0, y: number = 0, c: WrappedTreeNode[] = []) {\n this.w = w || 0;\n this.h = h || 0;\n this.y = y || 0;\n this.c = c || [];\n this.cs = c.length;\n }\n\n static fromNode(root: HierarchyNode | null, isHorizontal?: boolean): WrappedTreeNode | null {\n if (!root) return null;\n const children: WrappedTreeNode[] = [];\n root.children.forEach((child) => {\n const wrappedChild = WrappedTree.fromNode(child, isHorizontal);\n if (wrappedChild) children.push(wrappedChild);\n });\n if (isHorizontal) {\n return new WrappedTree(root.height, root.width, root.x, children);\n }\n return new WrappedTree(root.width, root.height, root.y, children);\n }\n}\n\nfunction moveRight(node: HierarchyNode, move: number, isHorizontal?: boolean): void {\n if (isHorizontal) {\n node.y += move;\n } else {\n node.x += move;\n }\n node.children.forEach((child) => {\n moveRight(child, move, isHorizontal);\n });\n}\n\nfunction getMin(node: HierarchyNode, isHorizontal?: boolean): number {\n let res = isHorizontal ? node.y : node.x;\n node.children.forEach((child) => {\n res = Math.min(getMin(child, isHorizontal), res);\n });\n return res;\n}\n\nfunction normalize(node: HierarchyNode, isHorizontal?: boolean): void {\n const min = getMin(node, isHorizontal);\n moveRight(node, -min, isHorizontal);\n}\n\nfunction convertBack(\n converted: WrappedTreeNode,\n root: HierarchyNode,\n isHorizontal?: boolean,\n): void {\n if (isHorizontal) {\n root.y = converted.x;\n } else {\n root.x = converted.x;\n }\n converted.c.forEach((child, i) => {\n convertBack(child, root.children[i], isHorizontal);\n });\n}\n\nfunction layer(node: HierarchyNode, isHorizontal?: boolean, d: number = 0): void {\n if (isHorizontal) {\n node.x = d;\n d += node.width;\n } else {\n node.y = d;\n d += node.height;\n }\n node.children.forEach((child) => {\n layer(child, isHorizontal, d);\n });\n}\n\ninterface IYL {\n low: number;\n index: number;\n nxt: IYL | null;\n}\n\nexport default function nonLayeredTidy(\n root: HierarchyNode,\n options: HierarchyOptions = {},\n): HierarchyNode {\n const isHorizontal = options.isHorizontal;\n\n function firstWalk(t: WrappedTreeNode): void {\n if (t.cs === 0) {\n setExtremes(t);\n return;\n }\n firstWalk(t.c[0]);\n let ih: IYL | null = updateIYL(bottom(t.c[0].el!), 0, null);\n for (let i = 1; i < t.cs; ++i) {\n firstWalk(t.c[i]);\n const min = bottom(t.c[i].er!);\n separate(t, i, ih);\n ih = updateIYL(min, i, ih);\n }\n positionRoot(t);\n setExtremes(t);\n }\n\n function setExtremes(t: WrappedTreeNode): void {\n if (t.cs === 0) {\n t.el = t;\n t.er = t;\n t.msel = t.mser = 0;\n } else {\n t.el = t.c[0].el;\n t.msel = t.c[0].msel;\n t.er = t.c[t.cs - 1].er;\n t.mser = t.c[t.cs - 1].mser;\n }\n }\n\n function separate(t: WrappedTreeNode, i: number, ih: IYL | null): void {\n let sr: WrappedTreeNode | null = t.c[i - 1];\n let mssr = sr.mod;\n let cl: WrappedTreeNode | null = t.c[i];\n let mscl = cl.mod;\n while (sr !== null && cl !== null) {\n if (ih && bottom(sr) > ih.low) ih = ih.nxt;\n const dist = mssr + sr.prelim + sr.w - (mscl + cl.prelim);\n if (dist > 0) {\n mscl += dist;\n if (ih) moveSubtree(t, i, ih.index, dist);\n }\n const sy = bottom(sr);\n const cy = bottom(cl);\n if (sy <= cy) {\n sr = nextRightContour(sr);\n if (sr !== null) mssr += sr.mod;\n }\n if (sy >= cy) {\n cl = nextLeftContour(cl);\n if (cl !== null) mscl += cl.mod;\n }\n }\n if (!sr && !!cl) {\n setLeftThread(t, i, cl, mscl);\n } else if (!!sr && !cl) {\n setRightThread(t, i, sr, mssr);\n }\n }\n\n function moveSubtree(t: WrappedTreeNode, i: number, si: number, dist: number): void {\n t.c[i].mod += dist;\n t.c[i].msel += dist;\n t.c[i].mser += dist;\n distributeExtra(t, i, si, dist);\n }\n\n function nextLeftContour(t: WrappedTreeNode): WrappedTreeNode | null {\n return t.cs === 0 ? t.tl : t.c[0];\n }\n\n function nextRightContour(t: WrappedTreeNode): WrappedTreeNode | null {\n return t.cs === 0 ? t.tr : t.c[t.cs - 1];\n }\n\n function bottom(t: WrappedTreeNode): number {\n return t.y + t.h;\n }\n\n function setLeftThread(\n t: WrappedTreeNode,\n i: number,\n cl: WrappedTreeNode,\n modsumcl: number,\n ): void {\n const li = t.c[0].el!;\n li.tl = cl;\n const diff = modsumcl - cl.mod - t.c[0].msel;\n li.mod += diff;\n li.prelim -= diff;\n t.c[0].el = t.c[i].el;\n t.c[0].msel = t.c[i].msel;\n }\n\n function setRightThread(\n t: WrappedTreeNode,\n i: number,\n sr: WrappedTreeNode,\n modsumsr: number,\n ): void {\n const ri = t.c[i].er!;\n ri.tr = sr;\n const diff = modsumsr - sr.mod - t.c[i].mser;\n ri.mod += diff;\n ri.prelim -= diff;\n t.c[i].er = t.c[i - 1].er;\n t.c[i].mser = t.c[i - 1].mser;\n }\n\n function positionRoot(t: WrappedTreeNode): void {\n t.prelim =\n (t.c[0].prelim + t.c[0].mod + t.c[t.cs - 1].mod + t.c[t.cs - 1].prelim + t.c[t.cs - 1].w) /\n 2 -\n t.w / 2;\n }\n\n function secondWalk(t: WrappedTreeNode, modsum: number): void {\n modsum += t.mod;\n t.x = t.prelim + modsum;\n addChildSpacing(t);\n for (let i = 0; i < t.cs; i++) {\n secondWalk(t.c[i], modsum);\n }\n }\n\n function distributeExtra(t: WrappedTreeNode, i: number, si: number, dist: number): void {\n if (si !== i - 1) {\n const nr = i - si;\n t.c[si + 1].shift += dist / nr;\n t.c[i].shift -= dist / nr;\n t.c[i].change -= dist - dist / nr;\n }\n }\n\n function addChildSpacing(t: WrappedTreeNode): void {\n let d = 0;\n let modsumdelta = 0;\n for (let i = 0; i < t.cs; i++) {\n d += t.c[i].shift;\n modsumdelta += d + t.c[i].change;\n t.c[i].mod += modsumdelta;\n }\n }\n\n function updateIYL(low: number, index: number, ih: IYL | null): IYL {\n while (ih !== null && low >= ih.low) {\n ih = ih.nxt;\n }\n return {\n low,\n index,\n nxt: ih,\n };\n }\n\n // do layout\n layer(root, isHorizontal);\n const wt = WrappedTree.fromNode(root, isHorizontal);\n if (wt) {\n firstWalk(wt);\n secondWalk(wt, 0);\n convertBack(wt, root, isHorizontal);\n normalize(root, isHorizontal);\n }\n\n return root;\n}\n","import hierarchy from './hierarchy';\nimport type { HierarchyNode, HierarchyOptions } from '../types';\n\nexport default function separateRoot(\n root: HierarchyNode,\n options: HierarchyOptions,\n): { left: HierarchyNode; right: HierarchyNode } {\n // separate into left and right trees\n const left = hierarchy(root.data, options, true); // root only\n const right = hierarchy(root.data, options, true); // root only\n\n // automatically\n const treeSize = root.children.length;\n const rightTreeSize = Math.round(treeSize / 2);\n\n // separate left and right tree by meta data\n const getSide =\n options.getSide ||\n function (_child: HierarchyNode, index: number): 'left' | 'right' {\n if (index < rightTreeSize) {\n return 'right';\n }\n return 'left';\n };\n\n for (let i = 0; i < treeSize; i++) {\n const child = root.children[i];\n const side = getSide(child, i);\n if (side === 'right') {\n right.children.push(child);\n } else {\n left.children.push(child);\n }\n }\n\n left.eachNode((node) => {\n if (!node.isRoot()) {\n node.side = 'left';\n }\n });\n\n right.eachNode((node) => {\n if (!node.isRoot()) {\n node.side = 'right';\n }\n });\n\n return {\n left,\n right,\n };\n}\n","import separateTree from './separate-root';\nimport type { HierarchyNode, HierarchyOptions, Direction } from '../types';\n\nconst VALID_DIRECTIONS: Direction[] = [\n 'LR', // left to right\n 'RL', // right to left\n 'TB', // top to bottom\n 'BT', // bottom to top\n 'H', // horizontal\n 'V', // vertical\n];\n\nconst HORIZONTAL_DIRECTIONS: Direction[] = ['LR', 'RL', 'H'];\n\nconst isHorizontal = (direction: Direction): boolean =>\n HORIZONTAL_DIRECTIONS.indexOf(direction) > -1;\n\nconst DEFAULT_DIRECTION: Direction = VALID_DIRECTIONS[0];\n\ntype LayoutAlgorithm = (root: HierarchyNode, options: HierarchyOptions) => HierarchyNode;\n\nexport default function doLayout(\n root: HierarchyNode,\n options: HierarchyOptions,\n layoutAlgorithm: LayoutAlgorithm,\n): HierarchyNode {\n const direction = options.direction || DEFAULT_DIRECTION;\n options.isHorizontal = isHorizontal(direction);\n\n if (direction && VALID_DIRECTIONS.indexOf(direction) === -1) {\n throw new TypeError(`Invalid direction: ${direction}`);\n }\n\n if (direction === VALID_DIRECTIONS[0]) {\n // LR\n layoutAlgorithm(root, options);\n } else if (direction === VALID_DIRECTIONS[1]) {\n // RL\n layoutAlgorithm(root, options);\n root.right2left();\n } else if (direction === VALID_DIRECTIONS[2]) {\n // TB\n layoutAlgorithm(root, options);\n } else if (direction === VALID_DIRECTIONS[3]) {\n // BT\n layoutAlgorithm(root, options);\n root.bottom2top();\n } else if (direction === VALID_DIRECTIONS[4] || direction === VALID_DIRECTIONS[5]) {\n // H or V\n // separate into left and right trees\n const { left, right } = separateTree(root, options);\n // do layout for left and right trees\n layoutAlgorithm(left, options);\n layoutAlgorithm(right, options);\n if (options.isHorizontal) {\n left.right2left();\n } else {\n left.bottom2top();\n }\n // combine left and right trees\n right.translate(left.x - right.x, left.y - right.y);\n // translate root\n root.x = left.x;\n root.y = right.y;\n const bb = root.getBoundingBox();\n if (options.isHorizontal) {\n if (bb.top < 0) {\n root.translate(0, -bb.top);\n }\n } else {\n if (bb.left < 0) {\n root.translate(-bb.left, 0);\n }\n }\n }\n\n // fixed root position, default value is true\n let fixedRoot = options.fixedRoot;\n if (fixedRoot === undefined) fixedRoot = true;\n if (fixedRoot) {\n root.translate(-(root.x + root.width / 2 + root.hgap), -(root.y + root.height / 2 + root.vgap));\n }\n\n reassignXYIfRadial(root, options);\n\n return root;\n}\n\nfunction reassignXYIfRadial(root: HierarchyNode, options: HierarchyOptions): void {\n if (options.radial) {\n const [rScale, radScale] = options.isHorizontal ? ['x', 'y'] : ['y', 'x'];\n\n const min = { x: Infinity, y: Infinity };\n const max = { x: -Infinity, y: -Infinity };\n\n let count = 0;\n root.DFTraverse((node) => {\n count++;\n const { x, y } = node;\n min.x = Math.min(min.x, x);\n min.y = Math.min(min.y, y);\n max.x = Math.max(max.x, x);\n max.y = Math.max(max.y, y);\n });\n\n const radDiff = max[radScale as 'x' | 'y'] - min[radScale as 'x' | 'y'];\n if (radDiff === 0) return;\n\n const avgRad = (Math.PI * 2) / count;\n root.DFTraverse((node) => {\n const nodeRadScale = node[radScale as 'x' | 'y'];\n const minRadScale = min[radScale as 'x' | 'y'];\n const nodeRScale = node[rScale as 'x' | 'y'];\n const rootRScale = root[rScale as 'x' | 'y'];\n\n const rad = ((nodeRadScale - minRadScale) / radDiff) * (Math.PI * 2 - avgRad) + avgRad;\n const r = nodeRScale - rootRScale;\n node.x = Math.cos(rad) * r;\n node.y = Math.sin(rad) * r;\n });\n }\n}\n","import TreeLayout from './layout/base';\nimport nonLayeredTidyTree from './layout/non-layered-tidy';\nimport doTreeLayout from './layout/do-layout';\nimport { assign } from './util';\nimport type { HierarchyData, HierarchyNode, CompactBoxOptions } from './types';\n\nclass CompactBoxTreeLayout extends TreeLayout {\n execute(): HierarchyNode {\n return doTreeLayout(this.rootNode, this.options, nonLayeredTidyTree);\n }\n}\n\nconst DEFAULT_OPTIONS: CompactBoxOptions = {};\n\nexport default function compactBoxLayout(\n root: HierarchyData,\n options?: CompactBoxOptions,\n): HierarchyNode {\n const mergedOptions = assign({}, DEFAULT_OPTIONS, options);\n return new CompactBoxTreeLayout(root, mergedOptions).execute();\n}\n","import { assign } from '../util';\nimport type { HierarchyNode, HierarchyOptions } from '../types';\n\ninterface WrappedTreeNode {\n x: number;\n y: number;\n height: number;\n leftChild: WrappedTreeNode | null;\n rightChild: WrappedTreeNode | null;\n children: WrappedTreeNode[];\n originNode: HierarchyNode;\n isLeaf: boolean;\n drawingDepth?: number;\n}\n\nclass WrappedTree implements WrappedTreeNode {\n x: number = 0;\n y: number = 0;\n height: number;\n leftChild: WrappedTreeNode | null = null;\n rightChild: WrappedTreeNode | null = null;\n children: WrappedTreeNode[];\n originNode!: HierarchyNode;\n isLeaf: boolean = false;\n\n constructor(height: number = 0, children: WrappedTreeNode[] = []) {\n this.height = height;\n this.children = children;\n }\n}\n\nconst DEFAULT_OPTIONS = {\n isHorizontal: true,\n nodeSep: 20,\n nodeSize: 20,\n rankSep: 200,\n subTreeSep: 10,\n};\n\nfunction convertBack(converted: WrappedTreeNode, root: HierarchyNode, isHorizontal: boolean): void {\n if (isHorizontal) {\n root.x = converted.x;\n root.y = converted.y;\n } else {\n root.x = converted.y;\n root.y = converted.x;\n }\n converted.children.forEach((child, i) => {\n convertBack(child, root.children[i], isHorizontal);\n });\n}\n\nexport default function dendrogram(\n root: HierarchyNode,\n options: HierarchyOptions = {},\n): HierarchyNode {\n const mergedOptions = assign({}, DEFAULT_OPTIONS, options);\n\n let maxDepth = 0;\n\n function wrappedTreeFromNode(n: HierarchyNode): WrappedTreeNode {\n n.width = 0;\n if (n.depth && n.depth > maxDepth) {\n maxDepth = n.depth;\n }\n const children = n.children;\n const childrenCount = children.length;\n const t = new WrappedTree(n.height, []);\n children.forEach((child, i) => {\n const childWT = wrappedTreeFromNode(child);\n t.children.push(childWT);\n if (i === 0) {\n t.leftChild = childWT;\n }\n if (i === childrenCount - 1) {\n t.rightChild = childWT;\n }\n });\n t.originNode = n;\n t.isLeaf = n.isLeaf();\n return t;\n }\n\n function getDrawingDepth(t: WrappedTreeNode): number {\n if (t.isLeaf || t.children.length === 0) {\n t.drawingDepth = maxDepth;\n } else {\n const depths = t.children.map((child) => getDrawingDepth(child));\n const minChildDepth = Math.min(...depths);\n t.drawingDepth = minChildDepth - 1;\n }\n return t.drawingDepth;\n }\n\n let prevLeaf: WrappedTreeNode | null = null;\n\n function position(t: WrappedTreeNode): void {\n t.x = t.drawingDepth! * mergedOptions.rankSep;\n if (t.isLeaf) {\n t.y = 0;\n if (prevLeaf) {\n t.y = prevLeaf.y + prevLeaf.height + mergedOptions.nodeSep;\n if (t.originNode.parent !== prevLeaf.originNode.parent) {\n t.y += mergedOptions.subTreeSep;\n }\n }\n prevLeaf = t;\n } else {\n t.children.forEach((child) => {\n position(child);\n });\n t.y = (t.leftChild!.y + t.rightChild!.y) / 2;\n }\n }\n\n const wt = wrappedTreeFromNode(root);\n getDrawingDepth(wt);\n position(wt);\n convertBack(wt, root, mergedOptions.isHorizontal);\n\n return root;\n}\n","import TreeLayout from './layout/base';\nimport dendrogram from './layout/dendrogram';\nimport doTreeLayout from './layout/do-layout';\nimport { assign } from './util';\nimport type { HierarchyData, HierarchyNode, DendrogramOptions } from './types';\n\nclass DendrogramLayout extends TreeLayout {\n execute(): HierarchyNode {\n this.rootNode.width = 0;\n return doTreeLayout(this.rootNode, this.options, dendrogram);\n }\n}\n\nconst DEFAULT_OPTIONS: DendrogramOptions = {};\n\nexport default function dendrogramLayout(\n root: HierarchyData,\n options?: DendrogramOptions,\n): HierarchyNode {\n const mergedOptions = assign({}, DEFAULT_OPTIONS, options);\n return new DendrogramLayout(root, mergedOptions).execute();\n}\n","import { getHeight } from '../util';\nimport type { HierarchyNode } from '../types';\n\nfunction positionNode(\n node: HierarchyNode,\n previousNode: HierarchyNode | null,\n indent: number | ((node: HierarchyNode) => number),\n dropCap: boolean,\n align?: 'center' | undefined,\n): void {\n // calculate the node's horizontal offset DX, dx's type might be number or function\n const displacementX = (typeof indent === 'function' ? indent(node) : indent) * node.depth;\n\n if (!dropCap) {\n try {\n if (node.parent && node.id === node.parent.children[0].id) {\n node.x += displacementX;\n node.y = previousNode ? previousNode.y : 0;\n return;\n }\n } catch {\n // skip to normal when a node has no parent\n }\n }\n\n node.x += displacementX;\n if (previousNode) {\n node.y = previousNode.y + getHeight(previousNode, node, align);\n if (previousNode.parent && node.parent && node.parent.id !== previousNode.parent.id) {\n // previous node has different parent\n const prevParent = previousNode.parent;\n const preY = prevParent.y + getHeight(prevParent, node, align);\n node.y = preY > node.y ? preY : node.y;\n }\n } else {\n node.y = 0;\n }\n}\n\nexport default function indented(\n root: HierarchyNode,\n indent: number | ((node: HierarchyNode) => number),\n dropCap: boolean,\n align?: 'center' | undefined,\n): void {\n let previousNode: HierarchyNode | null = null;\n root.eachNode((node) => {\n positionNode(node, previousNode, indent, dropCap, align);\n previousNode = node;\n });\n}\n","import TreeLayout from './layout/base';\nimport indentedTree from './layout/indented';\nimport separateTree from './layout/separate-root';\nimport { assign } from './util';\nimport type { HierarchyData, HierarchyNode, IndentedOptions, Direction } from './types';\n\nconst VALID_DIRECTIONS: Direction[] = [\n 'LR', // left to right\n 'RL', // right to left\n 'H', // horizontal\n];\nconst DEFAULT_DIRECTION: Direction = VALID_DIRECTIONS[0];\n\nclass IndentedLayout extends TreeLayout {\n execute(): HierarchyNode {\n const options = this.options as IndentedOptions;\n const root = this.rootNode;\n options.isHorizontal = true;\n\n // default indent 20 and sink first children;\n const { indent = 20, dropCap = true, direction = DEFAULT_DIRECTION, align } = options;\n\n if (direction && VALID_DIRECTIONS.indexOf(direction) === -1) {\n throw new TypeError(`Invalid direction: ${direction}`);\n }\n\n if (direction === VALID_DIRECTIONS[0]) {\n // LR\n indentedTree(root, indent, dropCap, align);\n } else if (direction === VALID_DIRECTIONS[1]) {\n // RL\n indentedTree(root, indent, dropCap, align);\n root.right2left();\n } else if (direction === VALID_DIRECTIONS[2]) {\n // H\n // separate into left and right trees\n const { left, right } = separateTree(root, options);\n indentedTree(left, indent, dropCap, align);\n left.right2left();\n indentedTree(right, indent, dropCap, align);\n const bbox = left.getBoundingBox();\n right.translate(bbox.width, 0);\n root.x = right.x - root.width / 2;\n }\n\n return root;\n }\n}\n\nconst DEFAULT_OPTIONS: IndentedOptions = {};\n\nexport default function indentedLayout(\n root: HierarchyData,\n options?: IndentedOptions,\n): HierarchyNode {\n const mergedOptions = assign({}, DEFAULT_OPTIONS, options);\n return new IndentedLayout(root, mergedOptions).execute();\n}\n","import { assign } from '../util';\nimport type { HierarchyNode, HierarchyOptions } from '../types';\n\nfunction secondWalk(node: HierarchyNode, options: HierarchyOptions): number {\n let totalHeight = 0;\n if (!node.children.length) {\n totalHeight = node.height;\n } else {\n node.children.forEach((c) => {\n totalHeight += secondWalk(c, options);\n });\n }\n node._subTreeSep = options.getSubTreeSep!(node.data);\n node.totalHeight = Math.max(node.height, totalHeight) + 2 * node._subTreeSep;\n return node.totalHeight;\n}\n\nfunction thirdWalk(node: HierarchyNode): void {\n const children = node.children;\n const len = children.length;\n if (len) {\n children.forEach((c) => {\n thirdWalk(c);\n });\n const first = children[0];\n const last = children[len - 1];\n const childrenHeight = last.y - first.y + last.height;\n let childrenTotalHeight = 0;\n children.forEach((child) => {\n childrenTotalHeight += child.totalHeight!;\n });\n if (childrenHeight > node.height) {\n // 当子节点总高度大于父节点高度\n node.y = first.y + childrenHeight / 2 - node.height / 2;\n } else if (children.length !== 1 || node.height > childrenTotalHeight) {\n // 多于一个子节点或者父节点大于所有子节点的总高度\n const offset = node.y + (node.height - childrenHeight) / 2 - first.y;\n children.forEach((c) => {\n c.translate(0, offset);\n });\n } else {\n // 只有一个子节点\n node.y = (first.y + first.height / 2 + last.y + last.height / 2) / 2 - node.height / 2;\n }\n }\n}\n\nconst DEFAULT_OPTIONS: HierarchyOptions = {\n getSubTreeSep() {\n return 0;\n },\n};\n\nexport default function mindmap(\n root: HierarchyNode,\n options: HierarchyOptions = {},\n): HierarchyNode {\n options = assign({}, DEFAULT_OPTIONS, options);\n\n root.parent = {\n x: 0,\n width: 0,\n height: 0,\n y: 0,\n } as HierarchyNode;\n\n // first walk\n root.BFTraverse((node) => {\n node.x = node.parent!.x + node.parent!.width;\n });\n\n root.parent = undefined;\n\n // second walk\n secondWalk(root, options);\n\n // adjusting\n // separating nodes\n root.startY = 0;\n root.y = root.totalHeight! / 2 - root.height / 2;\n root.eachNode((node) => {\n const children = node.children;\n const len = children.length;\n if (len) {\n const first = children[0];\n first.startY = node.startY! + node._subTreeSep!;\n if (len === 1) {\n first.y = node.y + node.height / 2 - first.height / 2;\n } else {\n first.y = first.startY + first.totalHeight! / 2 - first.height / 2;\n for (let i = 1; i < len; i++) {\n const c = children[i];\n c.startY = children[i - 1].startY! + children[i - 1].totalHeight!;\n c.y = c.startY + c.totalHeight! / 2 - c.height / 2;\n }\n }\n }\n });\n\n // third walk\n thirdWalk(root);\n\n return root;\n}\n","import TreeLayout from './layout/base';\nimport mindmap from './layout/mindmap';\nimport doTreeLayout from './layout/do-layout';\nimport { assign } from './util';\nimport type { HierarchyData, HierarchyNode, MindmapOptions } from './types';\n\nclass MindmapLayout extends TreeLayout {\n execute(): HierarchyNode {\n return doTreeLayout(this.rootNode, this.options, mindmap);\n }\n}\n\nconst DEFAULT_OPTIONS: MindmapOptions = {};\n\nexport default function mindmapLayout(\n root: HierarchyData,\n options?: MindmapOptions,\n): HierarchyNode {\n const mergedOptions = assign({}, DEFAULT_OPTIONS, options);\n return new MindmapLayout(root, mergedOptions).execute();\n}\n","import compactBox from './compact-box';\nimport dendrogram from './dendrogram';\nimport indented from './indented';\nimport mindmap from './mindmap';\n\nexport { compactBox, dendrogram, indented, mindmap };\n\nexport * from './types';\n\nexport default {\n compactBox,\n dendrogram,\n indented,\n mindmap,\n};\n\nexport const version = '0.7.0';\n"],"names":["getHeight","preNode","node","align","heightField","preNodeHeight","nodeHeight","height","assign","Object","DEFAULT_OPTIONS","getId","d","id","name","getPreH","preH","getPreV","preV","getHGap","hgap","getVGap","vgap","getChildren","children","PEM","getWidth","label","width","split","length","Node","constructor","data","options","this","x","y","depth","parent","addGap","isRoot","isLeaf","eachNode","callback","current","nodes","shift","concat","DFTraverse","BFTraverse","getBoundingBox","bb","left","Number","MAX_VALUE","top","Math","min","max","translate","tx","ty","right2left","bottom2top","hierarchy","isolated","root","collapsed","Array","i","child","push","Layout","rootNode","execute","Error","WrappedTree$1","WrappedTree","w","h","c","prelim","mod","change","tl","tr","el","er","msel","mser","cs","fromNode","isHorizontal","forEach","wrappedChild","moveRight","move","getMin","res","normalize","convertBack","converted","layer","nonLayeredTidy","setExtremes","t","separate","ih","sr","mssr","cl","mscl","bottom","low","nxt","dist","moveSubtree","index","sy","cy","nextRightContour","nextLeftContour","modsumcl","li","diff","setLeftThread","modsumsr","ri","setRightThread","si","nr","distributeExtra","updateIYL","wt","firstWalk","positionRoot","secondWalk","modsum","modsumdelta","addChildSpacing","separateRoot","right","treeSize","rightTreeSize","round","getSide","_child","side","VALID_DIRECTIONS","HORIZONTAL_DIRECTIONS","DEFAULT_DIRECTION","doLayout","layoutAlgorithm","direction","indexOf","TypeError","separateTree","fixedRoot","radial","rScale","radScale","Infinity","count","radDiff","avgRad","PI","nodeRadScale","minRadScale","nodeRScale","rootRScale","rad","r","cos","sin","reassignXYIfRadial","CompactBoxTreeLayout","TreeLayout","doTreeLayout","nonLayeredTidyTree","compactBoxLayout","mergedOptions","leftChild","rightChild","nodeSep","nodeSize","rankSep","subTreeSep","dendrogram","maxDepth","prevLeaf","wrappedTreeFromNode","n","childrenCount","childWT","originNode","getDrawingDepth","drawingDepth","depths","map","minChildDepth","position","DendrogramLayout","dendrogramLayout","indented","indent","dropCap","previousNode","displacementX","prevParent","preY","positionNode","IndentedLayout","indentedTree","bbox","indentedLayout","totalHeight","_subTreeSep","getSubTreeSep","thirdWalk","len","first","last","childrenHeight","childrenTotalHeight","offset","mindmap","startY","MindmapLayout","mindmapLayout","compactBox"],"mappings":"gPAUO,SAASA,EACdC,EACAC,EACAC,EACAC,EAAmC,UAEnC,MAAMC,EAAgBJ,EAAQG,GACxBE,EAAaJ,EAAKE,GACxB,MAAiB,WAAVD,GAAsBE,EAAgBC,GAAc,EAAIL,EAAQM,MACzE,CAEO,MAAMC,EAASC,OAAOD,OCdvBE,EAYF,CACFC,MAAMC,GACIA,EAAEC,IAAMD,EAAEE,KAEpBC,QAAQH,GACCA,EAAEI,MAAQ,EAEnBC,QAAQL,GACCA,EAAEM,MAAQ,EAEnBC,QAAQP,GACCA,EAAEQ,MA3BD,GA6BVC,QAAQT,GACCA,EAAEU,MA9BD,GAgCVC,YAAYX,GACHA,EAAEY,SAEXxB,UAAUY,GACDA,EAAEL,QAnCUkB,GAqCrB,QAAAC,CAASd,GACP,MAAMe,EAAQf,EAAEe,O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AUjO,EAAKuN,YACvB,IAARG,EACFC,EAAMxL,EAAInC,EAAKmC,EAAInC,EAAKK,OAAS,EAAIsN,EAAMtN,OAAS,MAC/C,CACLsN,EAAMxL,EAAIwL,EAAMM,OAASN,EAAML,YAAe,EAAIK,EAAMtN,OAAS,EACjE,IAAA,IAAS+D,EAAI,EAAGA,EAAIsJ,EAAKtJ,IAAK,CAC5B,MAAMW,EAAIzD,EAAS8C,GACnBW,EAAEkJ,OAAS3M,EAAS8C,EAAI,GAAG6J,OAAU3M,EAAS8C,EAAI,GAAGkJ,YACrDvI,EAAE5C,EAAI4C,EAAEkJ,OAASlJ,EAAEuI,YAAe,EAAIvI,EAAE1E,OAAS,CACnD,CACF,CACF,IAIFoN,EAAUxJ,GAEHA,CACT,CCjGA,MAAMiK,UAAsBnD,EAC1B,OAAAtG,GACE,OAAOuG,EAAa/I,KAAKuC,SAAUvC,KAAKD,QAASgM,EACnD,EAGF,MAAMxN,EAAkC,CAAA,EAExC,SAAwB2N,EACtBlK,EACAjC,GAEA,MAAMmJ,EAAgB7K,EAAO,GAAIE,EAAiBwB,GAClD,OAAO,IAAIkM,EAAcjK,EAAMkH,GAAe1G,SAChD,CCXA,MAAA2C,EAAe,CAAAgH,WACbA,EAAA1C,WACAA,EAAAgB,SACAA,EAAAsB,QACAA,gFAGqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compact-box.d.ts","sourceRoot":"","sources":["../src/compact-box.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAU/E,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,IAAI,EAAE,aAAa,EACnB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,aAAa,CAGf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dendrogram.d.ts","sourceRoot":"","sources":["../src/dendrogram.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAW/E,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,IAAI,EAAE,aAAa,EACnB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,aAAa,CAGf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indented.d.ts","sourceRoot":"","sources":["../src/indented.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAa,MAAM,SAAS,CAAC;AA+CxF,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,IAAI,EAAE,aAAa,EACnB,OAAO,CAAC,EAAE,eAAe,GACxB,aAAa,CAGf"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as compactBox } from './compact-box';
|
|
2
|
+
import { default as dendrogram } from './dendrogram';
|
|
3
|
+
import { default as indented } from './indented';
|
|
4
|
+
import { default as mindmap } from './mindmap';
|
|
5
|
+
export { compactBox, dendrogram, indented, mindmap };
|
|
6
|
+
export * from './types';
|
|
7
|
+
declare const _default: {
|
|
8
|
+
compactBox: typeof compactBox;
|
|
9
|
+
dendrogram: typeof dendrogram;
|
|
10
|
+
indented: typeof indented;
|
|
11
|
+
mindmap: typeof mindmap;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
14
|
+
export declare const version = "0.7.0";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAErD,cAAc,SAAS,CAAC;;;;;;;AAExB,wBAKE;AAEF,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HierarchyData, HierarchyNode, HierarchyOptions } from '../types';
|
|
2
|
+
export default class Layout {
|
|
3
|
+
options: HierarchyOptions;
|
|
4
|
+
rootNode: HierarchyNode;
|
|
5
|
+
constructor(root: HierarchyData, options?: HierarchyOptions);
|
|
6
|
+
execute(): HierarchyNode;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/layout/base.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE/E,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,EAAE,aAAa,CAAC;gBAEZ,IAAI,EAAE,aAAa,EAAE,OAAO,GAAE,gBAAqB;IAK/D,OAAO,IAAI,aAAa;CAGzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dendrogram.d.ts","sourceRoot":"","sources":["../../src/layout/dendrogram.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAmDhE,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,IAAI,EAAE,aAAa,EACnB,OAAO,GAAE,gBAAqB,GAC7B,aAAa,CAkEf"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HierarchyNode, HierarchyOptions } from '../types';
|
|
2
|
+
type LayoutAlgorithm = (root: HierarchyNode, options: HierarchyOptions) => HierarchyNode;
|
|
3
|
+
export default function doLayout(root: HierarchyNode, options: HierarchyOptions, layoutAlgorithm: LayoutAlgorithm): HierarchyNode;
|
|
4
|
+
export {};
|
|
5
|
+
//# sourceMappingURL=do-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"do-layout.d.ts","sourceRoot":"","sources":["../../src/layout/do-layout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAa,MAAM,UAAU,CAAC;AAkB3E,KAAK,eAAe,GAAG,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,KAAK,aAAa,CAAC;AAEzF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,gBAAgB,EACzB,eAAe,EAAE,eAAe,GAC/B,aAAa,CA6Df"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hierarchy.d.ts","sourceRoot":"","sources":["../../src/layout/hierarchy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAe,MAAM,UAAU,CAAC;AA4L5F,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,IAAI,EAAE,aAAa,EACnB,OAAO,GAAE,gBAAqB,EAC9B,QAAQ,CAAC,EAAE,OAAO,GACjB,aAAa,CA0Bf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indented.d.ts","sourceRoot":"","sources":["../../src/layout/indented.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAsC9C,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,aAAa,KAAK,MAAM,CAAC,EAClD,OAAO,EAAE,OAAO,EAChB,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,GAC3B,IAAI,CAMN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mindmap.d.ts","sourceRoot":"","sources":["../../src/layout/mindmap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAoDhE,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,IAAI,EAAE,aAAa,EACnB,OAAO,GAAE,gBAAqB,GAC7B,aAAa,CA+Cf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"non-layered-tidy.d.ts","sourceRoot":"","sources":["../../src/layout/non-layered-tidy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAuHhE,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,IAAI,EAAE,aAAa,EACnB,OAAO,GAAE,gBAAqB,GAC7B,aAAa,CAyKf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"separate-root.d.ts","sourceRoot":"","sources":["../../src/layout/separate-root.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEhE,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,gBAAgB,GACxB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,aAAa,CAAA;CAAE,CA6C/C"}
|
package/lib/mindmap.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mindmap.d.ts","sourceRoot":"","sources":["../src/mindmap.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAU5E,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,IAAI,EAAE,aAAa,EACnB,OAAO,CAAC,EAAE,cAAc,GACvB,aAAa,CAGf"}
|