mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-01 10:22:30 +02:00
1 line
No EOL
9.6 KiB
JavaScript
1 line
No EOL
9.6 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[99595],{99595:(t,e,a)=>{a.d(e,{diagram:()=>h});var r=a(73445),i=a(93126),n=a(51822),d=a(62499),l=a(17367),o=a(91922);a(95285),a(31546),a(31234);let s={},p=function(t){let e=Object.entries(s).find(e=>e[1].label===t);if(e)return e[0]},g=function(t){t.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"),t.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"),t.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"),t.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"),t.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"),t.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"),t.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"),t.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")},h={parser:r.p,db:r.d,renderer:{draw:function(t,e,a,r){let h;let c=(0,l.c)().class;s={},l.l.info("Rendering diagram "+t);let f=(0,l.c)().securityLevel;"sandbox"===f&&(h=(0,i.Ltv)("#i"+e));let u="sandbox"===f?(0,i.Ltv)(h.nodes()[0].contentDocument.body):(0,i.Ltv)("body"),x=u.select(`[id='${e}']`);g(x);let y=new d.T({multigraph:!0});y.setGraph({isMultiGraph:!0}),y.setDefaultEdgeLabel(function(){return{}});let b=r.db.getClasses();for(let t of Object.keys(b)){let e=b[t],a=o.s.drawClass(x,e,c,r);s[a.id]=a,y.setNode(a.id,a),l.l.info("Org height: "+a.height)}r.db.getRelations().forEach(function(t){l.l.info("tjoho"+p(t.id1)+p(t.id2)+JSON.stringify(t)),y.setEdge(p(t.id1),p(t.id2),{relation:t},t.title||"DEFAULT")}),r.db.getNotes().forEach(function(t){l.l.debug(`Adding note: ${JSON.stringify(t)}`);let e=o.s.drawNote(x,t,c,r);s[e.id]=e,y.setNode(e.id,e),t.class&&t.class in b&&y.setEdge(t.id,p(t.class),{relation:{id1:t.id,id2:t.class,relation:{type1:"none",type2:"none",lineType:10}}},"DEFAULT")}),(0,n.Zp)(y),y.nodes().forEach(function(t){void 0!==t&&void 0!==y.node(t)&&(l.l.debug("Node "+t+": "+JSON.stringify(y.node(t))),u.select("#"+(r.db.lookUpDomId(t)||t)).attr("transform","translate("+(y.node(t).x-y.node(t).width/2)+","+(y.node(t).y-y.node(t).height/2)+" )"))}),y.edges().forEach(function(t){void 0!==t&&void 0!==y.edge(t)&&(l.l.debug("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(y.edge(t))),o.s.drawEdge(x,y.edge(t),y.edge(t).relation,c,r))});let m=x.node().getBBox(),w=m.width+40,k=m.height+40;(0,l.i)(x,k,w,c.useMaxWidth);let L=`${m.x-20} ${m.y-20} ${w} ${k}`;l.l.debug(`viewBox ${L}`),x.attr("viewBox",L)}},styles:r.s,init:t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,r.d.clear()}}},91922:(t,e,a)=>{a.d(e,{p:()=>l,s:()=>p});var r=a(93126),i=a(17367);let n=0,d=function(t){let e=t.id;return t.type&&(e+="<"+t.type+">"),e},l=function(t){let e="",a="",r="",n="",d=t.substring(0,1),l=t.substring(t.length-1,t.length);d.match(/[#+~-]/)&&(n=d);let o=/[\s\w)~]/;l.match(o)||(a=s(l));let p=""===n?0:1,g=""===a?t.length:t.length-1,h=(t=t.substring(p,g)).indexOf("("),c=t.indexOf(")");if(h>1&&c>h&&c<=t.length){let d=t.substring(0,h).trim(),l=t.substring(h+1,c);if(e=n+d+"("+(0,i.x)(l.trim())+")",c<t.length){let n=t.substring(c+1,c+2);""!==a||n.match(o)?r=t.substring(c+1).trim():(a=s(n),r=t.substring(c+2).trim()),""!==r&&(":"===r.charAt(0)&&(r=r.substring(1).trim()),e+=r=" : "+(0,i.x)(r))}}else e=n+(0,i.x)(t);return{displayText:e,cssStyle:a}},o=function(t,e,a,r){let i=l(e),n=t.append("tspan").attr("x",r.padding).text(i.displayText);""!==i.cssStyle&&n.attr("style",i.cssStyle),a||n.attr("dy",r.textHeight)},s=function(t){switch(t){case"*":return"font-style:italic;";case"$":return"text-decoration:underline;";default:return""}},p={getClassTitleString:d,drawClass:function(t,e,a,r){let n;i.l.debug("Rendering class ",e,a);let l=e.id,s={id:l,label:e.id,width:0,height:0},p=t.append("g").attr("id",r.db.lookUpDomId(l)).attr("class","classGroup");n=e.link?p.append("svg:a").attr("xlink:href",e.link).attr("target",e.linkTarget).append("text").attr("y",a.textHeight+a.padding).attr("x",0):p.append("text").attr("y",a.textHeight+a.padding).attr("x",0);let g=!0;e.annotations.forEach(function(t){let e=n.append("tspan").text("\xab"+t+"\xbb");g||e.attr("dy",a.textHeight),g=!1});let h=d(e),c=n.append("tspan").text(h).attr("class","title");g||c.attr("dy",a.textHeight);let f=n.node().getBBox().height,u=p.append("line").attr("x1",0).attr("y1",a.padding+f+a.dividerMargin/2).attr("y2",a.padding+f+a.dividerMargin/2),x=p.append("text").attr("x",a.padding).attr("y",f+a.dividerMargin+a.textHeight).attr("fill","white").attr("class","classText");g=!0,e.members.forEach(function(t){o(x,t,g,a),g=!1});let y=x.node().getBBox(),b=p.append("line").attr("x1",0).attr("y1",a.padding+f+a.dividerMargin+y.height).attr("y2",a.padding+f+a.dividerMargin+y.height),m=p.append("text").attr("x",a.padding).attr("y",f+2*a.dividerMargin+y.height+a.textHeight).attr("fill","white").attr("class","classText");g=!0,e.methods.forEach(function(t){o(m,t,g,a),g=!1});let w=p.node().getBBox();var k=" ";e.cssClasses.length>0&&(k+=e.cssClasses.join(" "));let L=p.insert("rect",":first-child").attr("x",0).attr("y",0).attr("width",w.width+2*a.padding).attr("height",w.height+a.padding+.5*a.dividerMargin).attr("class",k).node().getBBox().width;return n.node().childNodes.forEach(function(t){t.setAttribute("x",(L-t.getBBox().width)/2)}),e.tooltip&&n.insert("title").text(e.tooltip),u.attr("x2",L),b.attr("x2",L),s.width=L,s.height=w.height+a.padding+.5*a.dividerMargin,s},drawEdge:function(t,e,a,d,l){let o,s,p,g,h,c;let f=function(t){switch(t){case l.db.relationType.AGGREGATION:return"aggregation";case l.db.relationType.EXTENSION:return"extension";case l.db.relationType.COMPOSITION:return"composition";case l.db.relationType.DEPENDENCY:return"dependency";case l.db.relationType.LOLLIPOP:return"lollipop"}};e.points=e.points.filter(t=>!Number.isNaN(t.y));let u=e.points,x=(0,r.n8j)().x(function(t){return t.x}).y(function(t){return t.y}).curve(r.qrM),y=t.append("path").attr("d",x(u)).attr("id","edge"+n).attr("class","relation"),b="";d.arrowMarkerAbsolute&&(b=(b=(b=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search).replace(/\(/g,"\\(")).replace(/\)/g,"\\)")),1==a.relation.lineType&&y.attr("class","relation dashed-line"),10==a.relation.lineType&&y.attr("class","relation dotted-line"),"none"!==a.relation.type1&&y.attr("marker-start","url("+b+"#"+f(a.relation.type1)+"Start)"),"none"!==a.relation.type2&&y.attr("marker-end","url("+b+"#"+f(a.relation.type2)+"End)");let m=e.points.length,w=i.u.calcLabelPosition(e.points);if(o=w.x,s=w.y,m%2!=0&&m>1){let t=i.u.calcCardinalityPosition("none"!==a.relation.type1,e.points,e.points[0]),r=i.u.calcCardinalityPosition("none"!==a.relation.type2,e.points,e.points[m-1]);i.l.debug("cardinality_1_point "+JSON.stringify(t)),i.l.debug("cardinality_2_point "+JSON.stringify(r)),p=t.x,g=t.y,h=r.x,c=r.y}if(void 0!==a.title){let e=t.append("g").attr("class","classLabel"),r=e.append("text").attr("class","label").attr("x",o).attr("y",s).attr("fill","red").attr("text-anchor","middle").text(a.title);window.label=r;let i=r.node().getBBox();e.insert("rect",":first-child").attr("class","box").attr("x",i.x-d.padding/2).attr("y",i.y-d.padding/2).attr("width",i.width+d.padding).attr("height",i.height+d.padding)}i.l.info("Rendering relation "+JSON.stringify(a)),void 0!==a.relationTitle1&&"none"!==a.relationTitle1&&t.append("g").attr("class","cardinality").append("text").attr("class","type1").attr("x",p).attr("y",g).attr("fill","black").attr("font-size","6").text(a.relationTitle1),void 0!==a.relationTitle2&&"none"!==a.relationTitle2&&t.append("g").attr("class","cardinality").append("text").attr("class","type2").attr("x",h).attr("y",c).attr("fill","black").attr("font-size","6").text(a.relationTitle2),n++},drawNote:function(t,e,a,r){i.l.debug("Rendering note ",e,a);let n=e.id,d={id:n,text:e.text,width:0,height:0},l=t.append("g").attr("id",n).attr("class","classGroup"),o=l.append("text").attr("y",a.textHeight+a.padding).attr("x",0),s=JSON.parse(`"${e.text}"`).split("\n");s.forEach(function(t){i.l.debug(`Adding line: ${t}`),o.append("tspan").text(t).attr("class","title").attr("dy",a.textHeight)});let p=l.node().getBBox(),g=l.insert("rect",":first-child").attr("x",0).attr("y",0).attr("width",p.width+2*a.padding).attr("height",p.height+s.length*a.textHeight+a.padding+.5*a.dividerMargin).node().getBBox().width;return o.node().childNodes.forEach(function(t){t.setAttribute("x",(g-t.getBBox().width)/2)}),d.width=g,d.height=p.height+s.length*a.textHeight+a.padding+.5*a.dividerMargin,d},parseMember:l}}}]); |