hypnagaga/docs/assets/classDiagram-5e843ae7-16dc00b2.js
2024-03-22 13:45:39 +00:00

2 lines
4.5 KiB
JavaScript

import{p as N,d as M,s as W}from"./styles-88ad4441-2e4e7873.js";import{c as S,l as i,h as u,i as H}from"./intro.stories-6f61d245.js";import{G as X,l as Y}from"./layout-86571dc7.js";import{s as l}from"./svgDraw-5d8a058e-5d65121b.js";import"./dayjs.min-1b995edc.js";import"./chunk-S4VUQJ4A-c1008b8b.js";import"./iframe-8bd743bb.js";import"../sb-preview/runtime.js";import"./index-c7d73952.js";import"./_commonjsHelpers-de833af9.js";import"./index-d37d4223.js";import"./index-e04ae519.js";import"./index-356e4a49.js";import"./jsx-runtime-75e6d74c.js";import"./_getTag-edecb89a.js";import"./isSymbol-50749e90.js";import"./isObject-32699ff3.js";import"./toString-25ea340b.js";import"./Table-4634737e.js";import"./parseCss-1f57a685.js";import"./index-72e81835.js";import"./_color-087aa1f8.js";import"./index-ab200182.js";import"./_baseSet-db0c20a6.js";import"./now-bd49f550.js";import"./line-52be5d2f.js";import"./array-9f3ba611.js";import"./path-53f90ab3.js";let g={};const m=20,p=function(e){const d=Object.entries(g).find(k=>k[1].label===e);if(d)return d[0]},Z=function(e){e.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"),e.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"),e.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"),e.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"),e.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"),e.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"),e.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"),e.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")},D=function(e,d,k,a){const c=S().class;g={},i.info("Rendering diagram "+e);const L=S().securityLevel;let y;L==="sandbox"&&(y=u("#i"+d));const x=L==="sandbox"?u(y.nodes()[0].contentDocument.body):u("body"),o=x.select(`[id='${d}']`);Z(o);const r=new X({multigraph:!0});r.setGraph({isMultiGraph:!0}),r.setDefaultEdgeLabel(function(){return{}});const h=a.db.getClasses(),$=Object.keys(h);for(const t of $){const n=h[t],s=l.drawClass(o,n,c,a);g[s.id]=s,r.setNode(s.id,s),i.info("Org height: "+s.height)}a.db.getRelations().forEach(function(t){i.info("tjoho"+p(t.id1)+p(t.id2)+JSON.stringify(t)),r.setEdge(p(t.id1),p(t.id2),{relation:t},t.title||"DEFAULT")}),a.db.getNotes().forEach(function(t){i.debug(`Adding note: ${JSON.stringify(t)}`);const n=l.drawNote(o,t,c,a);g[n.id]=n,r.setNode(n.id,n),t.class&&t.class in h&&r.setEdge(t.id,p(t.class),{relation:{id1:t.id,id2:t.class,relation:{type1:"none",type2:"none",lineType:10}}},"DEFAULT")}),Y(r),r.nodes().forEach(function(t){t!==void 0&&r.node(t)!==void 0&&(i.debug("Node "+t+": "+JSON.stringify(r.node(t))),x.select("#"+(a.db.lookUpDomId(t)||t)).attr("transform","translate("+(r.node(t).x-r.node(t).width/2)+","+(r.node(t).y-r.node(t).height/2)+" )"))}),r.edges().forEach(function(t){t!==void 0&&r.edge(t)!==void 0&&(i.debug("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(r.edge(t))),l.drawEdge(o,r.edge(t),r.edge(t).relation,c,a))});const f=o.node().getBBox(),E=f.width+m*2,b=f.height+m*2;H(o,b,E,c.useMaxWidth);const w=`${f.x-m} ${f.y-m} ${E} ${b}`;i.debug(`viewBox ${w}`),o.attr("viewBox",w)},B={draw:D},ft={parser:N,db:M,renderer:B,styles:W,init:e=>{e.class||(e.class={}),e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute,M.clear()}};export{ft as diagram};
//# sourceMappingURL=classDiagram-5e843ae7-16dc00b2.js.map