5 lines
9.6 KiB
JavaScript
5 lines
9.6 KiB
JavaScript
/*! third party licenses: js/vendor.LICENSE.txt */
|
|
import{s as C,d as T,p as D}from"./styles-9a916d00-Cjd44_hq.chunk.mjs";import{s as N,l as W}from"./isEmpty-nTVdZyYD.chunk.mjs";import{G as X}from"./graph-BOKMr-rC.chunk.mjs";import{l as Y}from"./layout-_kSBx-Bz.chunk.mjs";import{g as H,l as f,d as $,u as v,H as G}from"./index-CyCAgei9.chunk.mjs";import"./percentages-BXMCSKIN-Cw9SI0WV.chunk.mjs";import{l as J}from"./line-2ECJkxIB.chunk.mjs";import"./vendor-BeFBwUwf.chunk.mjs";import"./index-vg7q3Iku.chunk.mjs";import"./has-DJswI7NS.chunk.mjs";import"./_baseUniq-CE6homwJ.chunk.mjs";import"./union-S9f8F22c.chunk.mjs";import"./_basePickBy-0DU--7tw.chunk.mjs";import"./zipObject-D21phg5E.chunk.mjs";import"./whiteboard-main.mjs";import"./index-Anv74-sp.chunk.mjs";import"./index-Bn0s6V7w.chunk.mjs";import"./array-Cg_lHFoG.chunk.mjs";import"./path-i7Zvihw6.chunk.mjs";let O=0;const Z=function(i,a,t,s,p){const c=function(n){switch(n){case p.db.relationType.AGGREGATION:return"aggregation";case p.db.relationType.EXTENSION:return"extension";case p.db.relationType.COMPOSITION:return"composition";case p.db.relationType.DEPENDENCY:return"dependency";case p.db.relationType.LOLLIPOP:return"lollipop"}};a.points=a.points.filter(n=>!Number.isNaN(n.y));const o=a.points,g=J().x(function(n){return n.x}).y(function(n){return n.y}).curve(W),d=i.append("path").attr("d",g(o)).attr("id","edge"+O).attr("class","relation");let r="";s.arrowMarkerAbsolute&&(r=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,r=r.replace(/\(/g,"\\("),r=r.replace(/\)/g,"\\)")),t.relation.lineType==1&&d.attr("class","relation dashed-line"),t.relation.lineType==10&&d.attr("class","relation dotted-line"),t.relation.type1!=="none"&&d.attr("marker-start","url("+r+"#"+c(t.relation.type1)+"Start)"),t.relation.type2!=="none"&&d.attr("marker-end","url("+r+"#"+c(t.relation.type2)+"End)");let m,l;const x=a.points.length;let u=v.calcLabelPosition(a.points);m=u.x,l=u.y;let b,w,e,h;if(x%2!==0&&x>1){let n=v.calcCardinalityPosition(t.relation.type1!=="none",a.points,a.points[0]),y=v.calcCardinalityPosition(t.relation.type2!=="none",a.points,a.points[x-1]);f.debug("cardinality_1_point "+JSON.stringify(n)),f.debug("cardinality_2_point "+JSON.stringify(y)),b=n.x,w=n.y,e=y.x,h=y.y}if(t.title!==void 0){const n=i.append("g").attr("class","classLabel"),y=n.append("text").attr("class","label").attr("x",m).attr("y",l).attr("fill","red").attr("text-anchor","middle").text(t.title);window.label=y;const E=y.node().getBBox();n.insert("rect",":first-child").attr("class","box").attr("x",E.x-s.padding/2).attr("y",E.y-s.padding/2).attr("width",E.width+s.padding).attr("height",E.height+s.padding)}f.info("Rendering relation "+JSON.stringify(t)),t.relationTitle1!==void 0&&t.relationTitle1!=="none"&&i.append("g").attr("class","cardinality").append("text").attr("class","type1").attr("x",b).attr("y",w).attr("fill","black").attr("font-size","6").text(t.relationTitle1),t.relationTitle2!==void 0&&t.relationTitle2!=="none"&&i.append("g").attr("class","cardinality").append("text").attr("class","type2").attr("x",e).attr("y",h).attr("fill","black").attr("font-size","6").text(t.relationTitle2),O++},I=function(i,a,t,s){f.debug("Rendering class ",a,t);const p=a.id,c={id:p,label:a.id,width:0,height:0},o=i.append("g").attr("id",s.db.lookUpDomId(p)).attr("class","classGroup");let g;a.link?g=o.append("svg:a").attr("xlink:href",a.link).attr("target",a.linkTarget).append("text").attr("y",t.textHeight+t.padding).attr("x",0):g=o.append("text").attr("y",t.textHeight+t.padding).attr("x",0);let d=!0;a.annotations.forEach(function(n){const y=g.append("tspan").text("«"+n+"»");d||y.attr("dy",t.textHeight),d=!1});let r=A(a);const m=g.append("tspan").text(r).attr("class","title");d||m.attr("dy",t.textHeight);const l=g.node().getBBox().height;let x,u,b;if(a.members.length>0){x=o.append("line").attr("x1",0).attr("y1",t.padding+l+t.dividerMargin/2).attr("y2",t.padding+l+t.dividerMargin/2);const n=o.append("text").attr("x",t.padding).attr("y",l+t.dividerMargin+t.textHeight).attr("fill","white").attr("class","classText");d=!0,a.members.forEach(function(y){S(n,y,d,t),d=!1}),u=n.node().getBBox()}if(a.methods.length>0){b=o.append("line").attr("x1",0).attr("y1",t.padding+l+t.dividerMargin+u.height).attr("y2",t.padding+l+t.dividerMargin+u.height);const n=o.append("text").attr("x",t.padding).attr("y",l+2*t.dividerMargin+u.height+t.textHeight).attr("fill","white").attr("class","classText");d=!0,a.methods.forEach(function(y){S(n,y,d,t),d=!1})}const w=o.node().getBBox();var e=" ";a.cssClasses.length>0&&(e=e+a.cssClasses.join(" "));const h=o.insert("rect",":first-child").attr("x",0).attr("y",0).attr("width",w.width+2*t.padding).attr("height",w.height+t.padding+.5*t.dividerMargin).attr("class",e).node().getBBox().width;return g.node().childNodes.forEach(function(n){n.setAttribute("x",(h-n.getBBox().width)/2)}),a.tooltip&&g.insert("title").text(a.tooltip),x&&x.attr("x2",h),b&&b.attr("x2",h),c.width=h,c.height=w.height+t.padding+.5*t.dividerMargin,c},A=function(i){let a=i.id;return i.type&&(a+="<"+G(i.type)+">"),a},P=function(i,a,t,s){f.debug("Rendering note ",a,t);const p=a.id,c={id:p,text:a.text,width:0,height:0},o=i.append("g").attr("id",p).attr("class","classGroup");let g=o.append("text").attr("y",t.textHeight+t.padding).attr("x",0);const d=JSON.parse(`"${a.text}"`).split(`
|
|
`);d.forEach(function(l){f.debug(`Adding line: ${l}`),g.append("tspan").text(l).attr("class","title").attr("dy",t.textHeight)});const r=o.node().getBBox(),m=o.insert("rect",":first-child").attr("x",0).attr("y",0).attr("width",r.width+2*t.padding).attr("height",r.height+d.length*t.textHeight+t.padding+.5*t.dividerMargin).node().getBBox().width;return g.node().childNodes.forEach(function(l){l.setAttribute("x",(m-l.getBBox().width)/2)}),c.width=m,c.height=r.height+d.length*t.textHeight+t.padding+.5*t.dividerMargin,c},S=function(i,a,t,s){const{displayText:p,cssStyle:c}=a.getDisplayDetails(),o=i.append("tspan").attr("x",s.padding).text(p);c!==""&&o.attr("style",a.cssStyle),t||o.attr("dy",s.textHeight)},M={getClassTitleString:A,drawClass:I,drawEdge:Z,drawNote:P};let B={};const L=20,k=function(i){const a=Object.entries(B).find(t=>t[1].label===i);if(a)return a[0]},R=function(i){i.append("defs").append("marker").attr("id","extensionStart").attr("class","extension").attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),i.append("defs").append("marker").attr("id","extensionEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z"),i.append("defs").append("marker").attr("id","compositionStart").attr("class","extension").attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),i.append("defs").append("marker").attr("id","compositionEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),i.append("defs").append("marker").attr("id","aggregationStart").attr("class","extension").attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),i.append("defs").append("marker").attr("id","aggregationEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),i.append("defs").append("marker").attr("id","dependencyStart").attr("class","extension").attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),i.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},U=function(i,a,t,s){const p=H().class;B={},f.info("Rendering diagram "+i);const c=H().securityLevel;let o;c==="sandbox"&&(o=N("#i"+a));const g=c==="sandbox"?N(o.nodes()[0].contentDocument.body):N("body"),d=g.select(`[id='${a}']`);R(d);const r=new X({multigraph:!0});r.setGraph({isMultiGraph:!0}),r.setDefaultEdgeLabel(function(){return{}});const m=s.db.getClasses(),l=Object.keys(m);for(const e of l){const h=m[e],n=M.drawClass(d,h,p,s);B[n.id]=n,r.setNode(n.id,n),f.info("Org height: "+n.height)}s.db.getRelations().forEach(function(e){f.info("tjoho"+k(e.id1)+k(e.id2)+JSON.stringify(e)),r.setEdge(k(e.id1),k(e.id2),{relation:e},e.title||"DEFAULT")}),s.db.getNotes().forEach(function(e){f.debug(`Adding note: ${JSON.stringify(e)}`);const h=M.drawNote(d,e,p,s);B[h.id]=h,r.setNode(h.id,h),e.class&&e.class in m&&r.setEdge(e.id,k(e.class),{relation:{id1:e.id,id2:e.class,relation:{type1:"none",type2:"none",lineType:10}}},"DEFAULT")}),Y(r),r.nodes().forEach(function(e){e!==void 0&&r.node(e)!==void 0&&(f.debug("Node "+e+": "+JSON.stringify(r.node(e))),g.select("#"+(s.db.lookUpDomId(e)||e)).attr("transform","translate("+(r.node(e).x-r.node(e).width/2)+","+(r.node(e).y-r.node(e).height/2)+" )"))}),r.edges().forEach(function(e){e!==void 0&&r.edge(e)!==void 0&&(f.debug("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(r.edge(e))),M.drawEdge(d,r.edge(e),r.edge(e).relation,p,s))});const x=d.node().getBBox(),u=x.width+L*2,b=x.height+L*2;$(d,b,u,p.useMaxWidth);const w=`${x.x-L} ${x.y-L} ${u} ${b}`;f.debug(`viewBox ${w}`),d.attr("viewBox",w)},_={draw:U},gt={parser:D,db:T,renderer:_,styles:C,init:i=>{i.class||(i.class={}),i.class.arrowMarkerAbsolute=i.arrowMarkerAbsolute,T.clear()}};export{gt as diagram};
|
|
//# sourceMappingURL=classDiagram-70f12bd4-BGUuiUHB.chunk.mjs.map
|