11 lines
3.2 KiB
JavaScript
11 lines
3.2 KiB
JavaScript
import{a as N}from"./chunk-AEOMTBSW.mjs";import{a as E}from"./chunk-DKKBVRCY.mjs";import{a as v}from"./chunk-TU3PZOEN.mjs";import"./chunk-DU5LTGQ6.mjs";import"./chunk-6NTNNK5N.mjs";import"./chunk-RNJOYNJ4.mjs";import"./chunk-XGPFEOL4.mjs";import"./chunk-A34GCYZU.mjs";import"./chunk-W7ZLLLMY.mjs";import"./chunk-WSB5WSVC.mjs";import"./chunk-DJ7UZH7F.mjs";import{a as R}from"./chunk-267PNR3T.mjs";import{l as D}from"./chunk-2HR5LOFI.mjs";import"./chunk-XBXGYYE5.mjs";import{N as b,Q as T,R as S,S as C,T as x,U as k,V as B,W as G,j as u,s as y}from"./chunk-5YUVU3PZ.mjs";import{b as h}from"./chunk-MGPAVIPZ.mjs";import"./chunk-TYMNRAUI.mjs";import"./chunk-FXACKDTF.mjs";import"./chunk-H3VCZNTA.mjs";import"./chunk-QU3B7NT4.mjs";import"./chunk-JIN56HTB.mjs";import{a as r}from"./chunk-VELTKBKT.mjs";var d=new v(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",children:[]}]})),I=r(()=>{d.reset(),T()},"clear"),P=r(()=>d.records.stack[0],"getRoot"),X=r(()=>d.records.cnt,"getCount"),z=u.treeView,F=r(()=>D(z,y().treeView),"getConfig"),H=r((e,t)=>{for(;e<=d.records.stack[d.records.stack.length-1].level;)d.records.stack.pop();let i={id:d.records.cnt++,level:e,name:t,children:[]};d.records.stack[d.records.stack.length-1].children.push(i),d.records.stack.push(i)},"addNode"),M={clear:I,addNode:H,getRoot:P,getCount:X,getConfig:F,getAccTitle:C,getAccDescription:k,getDiagramTitle:G,setAccDescription:x,setAccTitle:S,setDiagramTitle:B},w=M;var W=r(e=>{N(e,w),e.nodes.map(t=>w.addNode(t.indent?parseInt(t.indent):0,t.name))},"populate"),j={parse:r(async e=>{let t=await E("treeView",e);h.debug(t),W(t)},"parse")};var L=r((e,t,i,n,s)=>{let l=n.append("text").text(i.name).attr("dominant-baseline","middle").attr("class","treeView-node-label"),{height:c,width:o}=l.node().getBBox(),m=c+s.paddingY*2,a=o+s.paddingX*2;l.attr("x",e+s.paddingX),l.attr("y",t+m/2),i.BBox={x:e,y:t,width:a,height:m}},"positionLabel"),A=r((e,t,i,n,s,l)=>e.append("line").attr("x1",t).attr("y1",i).attr("x2",n).attr("y2",s).attr("stroke-width",l).attr("class","treeView-node-line"),"positionLine"),Y=r((e,t,i)=>{let n=0,s=0,l=r((o,m,a,g)=>{let f=g*(a.rowIndent+a.paddingX);L(f,n,m,o,a);let{height:p,width:V}=m.BBox;A(o,f-a.rowIndent,n+p/2,f,n+p/2,a.lineThickness),s=Math.max(s,f+V),n+=p},"drawNode"),c=r((o,m=0)=>{l(e,o,i,m),o.children.forEach(p=>{c(p,m+1)});let{x:a,y:g,height:f}=o.BBox;if(o.children.length){let{y:p,height:V}=o.children[o.children.length-1].BBox;A(e,a+i.paddingX,g+f,a+i.paddingX,p+V/2+i.lineThickness/2,i.lineThickness)}},"processNode");return c(t),{totalHeight:n,totalWidth:s}},"drawTree"),_=r((e,t,i,n)=>{h.debug(`Rendering treeView diagram
|
|
`+e);let s=n.db,l=s.getRoot(),c=s.getConfig(),o=R(t),m=o.append("g");m.attr("class","tree-view");let{totalHeight:a,totalWidth:g}=Y(m,l,c);o.attr("viewBox",`-${c.lineThickness/2} 0 ${g} ${a}`),b(o,a,g,c.useMaxWidth)},"draw"),O={draw:_},q=O;var U={labelFontSize:"16px",labelColor:"black",lineColor:"black"},J=r(({treeView:e})=>{let{labelFontSize:t,labelColor:i,lineColor:n}=D(U,e);return`
|
|
.treeView-node-label {
|
|
font-size: ${t};
|
|
fill: ${i};
|
|
}
|
|
.treeView-node-line {
|
|
stroke: ${n};
|
|
}
|
|
`},"styles"),$=J;var Te={db:w,renderer:q,parser:j,styles:$};export{Te as diagram};
|