| 12345678910 |
- import{g6 as f,g4 as x,g3 as C,dr as B,df as T,dg as y,aa as s,bY as u,eV as k,g1 as V,cb as N,dm as S,bZ as _,cK as D}from"./builder-DygomDiV.js";import{p as $}from"./chunk-4BX2VUAB-rSZvuPbd.js";import{I as A}from"./chunk-QZHKN3VN-CG6uYqSS.js";import{p as I}from"./wardley-L42UT6IY-DF83sseq.js";var l=new A(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",children:[]}]})),X=s(()=>{l.reset(),_()},"clear"),z=s(()=>l.records.stack[0],"getRoot"),H=s(()=>l.records.cnt,"getCount"),L=D.treeView,R=s(()=>u(L,S().treeView),"getConfig"),W=s((e,t)=>{for(;e<=l.records.stack[l.records.stack.length-1].level;)l.records.stack.pop();const a={id:l.records.cnt++,level:e,name:t,children:[]};l.records.stack[l.records.stack.length-1].children.push(a),l.records.stack.push(a)},"addNode"),E={clear:X,addNode:W,getRoot:z,getCount:H,getConfig:R,getAccTitle:y,getAccDescription:T,getDiagramTitle:B,setAccDescription:C,setAccTitle:x,setDiagramTitle:f},b=E,M=s(e=>{$(e,b),e.nodes.map(t=>b.addNode(t.indent?parseInt(t.indent):0,t.name))},"populate"),Y={parse:s(async e=>{const t=await I("treeView",e);k.debug(t),M(t)},"parse")},F=s((e,t,a,n,o)=>{const c=n.append("text").text(a.name).attr("dominant-baseline","middle").attr("class","treeView-node-label"),{height:g,width:r}=c.node().getBBox(),d=g+o.paddingY*2,i=r+o.paddingX*2;c.attr("x",e+o.paddingX),c.attr("y",t+d/2),a.BBox={x:e,y:t,width:i,height:d}},"positionLabel"),m=s((e,t,a,n,o,c)=>e.append("line").attr("x1",t).attr("y1",a).attr("x2",n).attr("y2",o).attr("stroke-width",c).attr("class","treeView-node-line"),"positionLine"),K=s((e,t,a)=>{let n=0,o=0;const c=s((r,d,i,h)=>{const v=h*(i.rowIndent+i.paddingX);F(v,n,d,r,i);const{height:p,width:w}=d.BBox;m(r,v-i.rowIndent,n+p/2,v,n+p/2,i.lineThickness),o=Math.max(o,v+w),n+=p},"drawNode"),g=s((r,d=0)=>{c(e,r,a,d),r.children.forEach(p=>{g(p,d+1)});const{x:i,y:h,height:v}=r.BBox;if(r.children.length){const{y:p,height:w}=r.children[r.children.length-1].BBox;m(e,i+a.paddingX,h+v,i+a.paddingX,p+w/2+a.lineThickness/2,a.lineThickness)}},"processNode");return g(t),{totalHeight:n,totalWidth:o}},"drawTree"),Z=s((e,t,a,n)=>{k.debug(`Rendering treeView diagram
- `+e);const o=n.db,c=o.getRoot(),g=o.getConfig(),r=V(t),d=r.append("g");d.attr("class","tree-view");const{totalHeight:i,totalWidth:h}=K(d,c,g);r.attr("viewBox",`-${g.lineThickness/2} 0 ${h} ${i}`),N(r,i,h,g.useMaxWidth)},"draw"),j={draw:Z},q=j,G={labelFontSize:"16px",labelColor:"black",lineColor:"black"},J=s(({treeView:e})=>{const{labelFontSize:t,labelColor:a,lineColor:n}=u(G,e);return`
- .treeView-node-label {
- font-size: ${t};
- fill: ${a};
- }
- .treeView-node-line {
- stroke: ${n};
- }
- `},"styles"),O=J,te={db:b,renderer:q,parser:Y,styles:O};export{te as diagram};
|