ruru
Version:
Grafast-flavoured GraphiQL distribution
2 lines • 12.1 kB
JavaScript
export const __webpack_esm_id__=1498;export const __webpack_esm_ids__=[1498];export const __webpack_esm_modules__={15348(e,t,a){function l(e,t){e.accDescr&&t.setAccDescription?.(e.accDescr),e.accTitle&&t.setAccTitle?.(e.accTitle),e.title&&t.setDiagramTitle?.(e.title)}a.r(t),a.d(t,{populateCommonDb:()=>l}),(0,a(60162).__name)(l,"populateCommonDb")},26819(e,t,a){a.r(t),a.d(t,{setupViewPortForSVG:()=>r});var l=a(54141),s=a(60162),r=(0,s.__name)((e,t,a,r)=>{e.attr("class",a);const{width:o,height:c,x:d,y:p}=n(e,t);(0,l.configureSvgSize)(e,c,o,r);const h=i(d,p,o,c,t);e.attr("viewBox",h),s.log.debug(`viewBox configured: ${h} with padding: ${t}`)},"setupViewPortForSVG"),n=(0,s.__name)((e,t)=>{const a=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:a.width+2*t,height:a.height+2*t,x:a.x,y:a.y}},"calculateDimensionsWithPadding"),i=(0,s.__name)((e,t,a,l,s)=>`${e-s} ${t-s} ${a} ${l}`,"createViewBox")},41498(e,t,a){a.r(t),a.d(t,{diagram:()=>b});var l=a(92329),s=a(26819),r=a(96540),n=a(15348),i=a(82029),o=a(54141),c=a(60162),d=a(73744),p=a(79806),h=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=o.setAccTitle,this.getAccTitle=o.getAccTitle,this.setDiagramTitle=o.setDiagramTitle,this.getDiagramTitle=o.getDiagramTitle,this.getAccDescription=o.getAccDescription,this.setAccDescription=o.setAccDescription}static{(0,c.__name)(this,"TreeMapDB")}getNodes(){return this.nodes}getConfig(){const e=o.defaultConfig_default,t=(0,o.getConfig)();return(0,i.cleanAndMerge)({...e.treemap,...t.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),0===t&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:"",children:this.outerNodes}}addClass(e,t){const a=this.classes.get(e)??{id:e,styles:[],textStyles:[]},l=t.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");l&&l.forEach(e=>{(0,r.isLabelStyle)(e)&&(a?.textStyles?a.textStyles.push(e):a.textStyles=[e]),a?.styles?a.styles.push(e):a.styles=[e]}),this.classes.set(e,a)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){(0,o.clear)(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function m(e){if(!e.length)return[];const t=[],a=[];return e.forEach(e=>{const l={name:e.name,children:"Leaf"===e.type?void 0:[]};for(l.classSelector=e?.classSelector,e?.cssCompiledStyles&&(l.cssCompiledStyles=[e.cssCompiledStyles]),"Leaf"===e.type&&void 0!==e.value&&(l.value=e.value);a.length>0&&a[a.length-1].level>=e.level;)a.pop();if(0===a.length)t.push(l);else{const e=a[a.length-1].node;e.children?e.children.push(l):e.children=[l]}"Leaf"!==e.type&&a.push({node:l,level:e.level})}),t}(0,c.__name)(m,"buildHierarchy");var y=(0,c.__name)((e,t)=>{(0,n.populateCommonDb)(e,t);const a=[];for(const a of e.TreemapRows??[])"ClassDefStatement"===a.$type&&t.addClass(a.className??"",a.styleText??"");for(const l of e.TreemapRows??[]){const e=l.item;if(!e)continue;const s=l.indent?parseInt(l.indent):0,r=g(e),n=e.classSelector?t.getStylesForClass(e.classSelector):[],i=n.length>0?n.join(";"):void 0,o={level:s,name:r,type:e.$type,value:e.value,classSelector:e.classSelector,cssCompiledStyles:i};a.push(o)}const l=m(a),s=(0,c.__name)((e,a)=>{for(const l of e)t.addNode(l,a),l.children&&l.children.length>0&&s(l.children,a+1)},"addNodesRecursively");s(l,0)},"populate"),g=(0,c.__name)(e=>e.name?String(e.name):"","getItemName"),f={parser:{yy:void 0},parse:(0,c.__name)(async e=>{try{const t=d.parse,a=await t("treemap",e);c.log.debug("Treemap AST:",a);const l=f.parser?.yy;if(!(l instanceof h))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");y(a,l)}catch(e){throw c.log.error("Error parsing treemap:",e),e}},"parse")},u={draw:(0,c.__name)((e,t,a,n)=>{const i=n.db,d=i.getConfig(),h=d.padding??10,m=i.getDiagramTitle(),y=i.getRoot(),{themeVariables:g}=(0,o.getConfig)();if(!y)return;const f=m?30:0,u=(0,l.selectSvgElement)(t),S=d.nodeWidth?10*d.nodeWidth:960,x=d.nodeHeight?10*d.nodeHeight:500,b=S,C=x+f;let w;u.attr("viewBox",`0 0 ${b} ${C}`),(0,o.configureSvgSize)(u,C,b,d.useMaxWidth);try{const e=d.valueFormat||",";if("$0,0"===e)w=(0,c.__name)(e=>"$"+(0,p.format)(",")(e),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const t=/\.\d+/.exec(e),a=t?t[0]:"";w=(0,c.__name)(e=>"$"+(0,p.format)(","+a)(e),"valueFormat")}else if(e.startsWith("$")){const t=e.substring(1);w=(0,c.__name)(e=>"$"+(0,p.format)(t||"")(e),"valueFormat")}else w=(0,p.format)(e)}catch(e){c.log.error("Error creating format function:",e),w=(0,p.format)(",")}const v=(0,p.scaleOrdinal)().range(["transparent",g.cScale0,g.cScale1,g.cScale2,g.cScale3,g.cScale4,g.cScale5,g.cScale6,g.cScale7,g.cScale8,g.cScale9,g.cScale10,g.cScale11]),_=(0,p.scaleOrdinal)().range(["transparent",g.cScalePeer0,g.cScalePeer1,g.cScalePeer2,g.cScalePeer3,g.cScalePeer4,g.cScalePeer5,g.cScalePeer6,g.cScalePeer7,g.cScalePeer8,g.cScalePeer9,g.cScalePeer10,g.cScalePeer11]),$=(0,p.scaleOrdinal)().range([g.cScaleLabel0,g.cScaleLabel1,g.cScaleLabel2,g.cScaleLabel3,g.cScaleLabel4,g.cScaleLabel5,g.cScaleLabel6,g.cScaleLabel7,g.cScaleLabel8,g.cScaleLabel9,g.cScaleLabel10,g.cScaleLabel11]);m&&u.append("text").attr("x",b/2).attr("y",f/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(m);const L=u.append("g").attr("transform",`translate(0, ${f})`).attr("class","treemapContainer"),T=(0,p.hierarchy)(y).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),k=(0,p.treemap)().size([S,x]).paddingTop(e=>e.children&&e.children.length>0?35:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?10:0).paddingRight(e=>e.children&&e.children.length>0?10:0).paddingBottom(e=>e.children&&e.children.length>0?10:0).round(!0)(T),M=k.descendants().filter(e=>e.children&&e.children.length>0),z=L.selectAll(".treemapSection").data(M).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);z.append("rect").attr("width",e=>e.x1-e.x0).attr("height",25).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>0===e.depth?"display: none;":""),z.append("clipPath").attr("id",(e,a)=>`clip-section-${t}-${a}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",25),z.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,t)=>`treemapSection section${t}`).attr("fill",e=>v(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>_(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(0===e.depth)return"display: none;";const t=(0,r.styles2String)({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+";"+t.borderStyles.join(";")}),z.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",12.5).attr("dominant-baseline","middle").text(e=>0===e.depth?"":e.data.name).attr("font-weight","bold").attr("style",e=>0===e.depth?"display: none;":"dominant-baseline: middle; font-size: 12px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"+(0,r.styles2String)({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")).each(function(e){if(0===e.depth)return;const t=(0,p.select)(this),a=e.data.name;t.text(a);const l=e.x1-e.x0;let s;s=!1!==d.showValues&&e.value?l-10-30-10-6:l-6-6;const r=Math.max(15,s),n=t.node();if(n.getComputedTextLength()>r){const e="...";let l=a;for(;l.length>0;){if(l=a.substring(0,l.length-1),0===l.length){t.text(e),n.getComputedTextLength()>r&&t.text("");break}if(t.text(l+e),n.getComputedTextLength()<=r)break}}}),!1!==d.showValues&&z.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",12.5).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?w(e.value):"").attr("font-style","italic").attr("style",e=>0===e.depth?"display: none;":"text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"+(0,r.styles2String)({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace("color:","fill:"));const D=k.leaves(),F=L.selectAll(".treemapLeafGroup").data(D).enter().append("g").attr("class",(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);F.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?v(e.parent.data.name):v(e.data.name)).attr("style",e=>(0,r.styles2String)({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?v(e.parent.data.name):v(e.data.name)).attr("stroke-width",3),F.append("clipPath").attr("id",(e,a)=>`clip-${t}-${a}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),F.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>"text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+$(e.data.name)+";"+(0,r.styles2String)({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")).attr("clip-path",(e,a)=>`url(#clip-${t}-${a})`).text(e=>e.data.name).each(function(e){const t=(0,p.select)(this),a=e.x1-e.x0,l=e.y1-e.y0,s=t.node(),r=a-8,n=l-8;if(r<10||n<10)return void t.style("display","none");let i=parseInt(t.style("font-size"),10);for(;s.getComputedTextLength()>r&&i>8;)i--,t.style("font-size",`${i}px`);let o=Math.max(6,Math.min(28,Math.round(.6*i))),c=i+2+o;for(;c>n&&i>8&&(i--,o=Math.max(6,Math.min(28,Math.round(.6*i))),!(o<6&&8===i));)t.style("font-size",`${i}px`),c=i+2+o;t.style("font-size",`${i}px`),(s.getComputedTextLength()>r||i<8||n<i)&&t.style("display","none")}),!1!==d.showValues&&F.append("text").attr("class","treemapValue").attr("x",e=>(e.x1-e.x0)/2).attr("y",function(e){return(e.y1-e.y0)/2}).attr("style",e=>"text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+$(e.data.name)+";"+(0,r.styles2String)({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")).attr("clip-path",(e,a)=>`url(#clip-${t}-${a})`).text(e=>e.value?w(e.value):"").each(function(e){const t=(0,p.select)(this),a=this.parentNode;if(!a)return void t.style("display","none");const l=(0,p.select)(a).select(".treemapLabel");if(l.empty()||"none"===l.style("display"))return void t.style("display","none");const s=parseFloat(l.style("font-size")),r=Math.max(6,Math.min(28,Math.round(.6*s)));t.style("font-size",`${r}px`);const n=(e.y1-e.y0)/2+s/2+2;t.attr("y",n);const i=e.x1-e.x0,o=e.y1-e.y0-4,c=i-8;t.node().getComputedTextLength()>c||n+r>o||r<6?t.style("display","none"):t.style("display",null)});const P=d.diagramPadding??8;(0,s.setupViewPortForSVG)(u,P,"flowchart",d?.useMaxWidth||!1)},"draw"),getClasses:(0,c.__name)(function(e,t){return t.db.getClasses()},"getClasses")},S={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelColor:"black",labelFontSize:"12px",valueFontSize:"10px",valueColor:"black",titleColor:"black",titleFontSize:"14px"},x=(0,c.__name)(({treemap:e}={})=>{const t=(0,i.cleanAndMerge)(S,e);return`\n .treemapNode.section {\n stroke: ${t.sectionStrokeColor};\n stroke-width: ${t.sectionStrokeWidth};\n fill: ${t.sectionFillColor};\n }\n .treemapNode.leaf {\n stroke: ${t.leafStrokeColor};\n stroke-width: ${t.leafStrokeWidth};\n fill: ${t.leafFillColor};\n }\n .treemapLabel {\n fill: ${t.labelColor};\n font-size: ${t.labelFontSize};\n }\n .treemapValue {\n fill: ${t.valueColor};\n font-size: ${t.valueFontSize};\n }\n .treemapTitle {\n fill: ${t.titleColor};\n font-size: ${t.titleFontSize};\n }\n `},"getStyles"),b={parser:f,get db(){return new h},renderer:u,styles:x}}};
//# sourceMappingURL=1498.js.map