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