Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

styles-1b0c237a-DEBp4bhg.js 9.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import{G as V}from"./layout-DtdJliGi.js";import{S as D,v as M,x as R,U,C as F,y as j,z as H,p as A,l as y,q as W,c as C,j as z,r as $,o as E,h as _,A as X,t as J,B as K}from"./index-BPCszWWQ.js";import{r as Q}from"./index-f58d48f9-CLIR902B.js";function Y(e){return typeof e=="string"?new D([document.querySelectorAll(e)],[document.documentElement]):new D([R(e)],M)}const Z=(e,l)=>U.lang.round(F.parse(e)[l]);function pe(e,l){return!!e.children(l).length}function be(e){return L(e.v)+":"+L(e.w)+":"+L(e.name)}var O=/:/g;function L(e){return e?String(e).replace(O,"\\:"):""}function ee(e,l){l&&e.attr("style",l)}function fe(e,l,c){l&&e.attr("class",l).attr("class",c+" "+e.attr("class"))}function ue(e,l){var c=l.graph();if(j(c)){var a=c.transition;if(H(a))return a(e)}return e}function te(e,l){var c=e.append("foreignObject").attr("width","100000"),a=c.append("xhtml:div");a.attr("xmlns","http://www.w3.org/1999/xhtml");var i=l.label;switch(typeof i){case"function":a.insert(i);break;case"object":a.insert(function(){return i});break;default:a.html(i)}ee(a,l.labelStyle),a.style("display","inline-block"),a.style("white-space","nowrap");var d=a.node().getBoundingClientRect();return c.attr("width",d.width).attr("height",d.height),c}const G={},re=function(e){const l=Object.keys(e);for(const c of l)G[c]=e[c]},q=function(e,l,c,a,i,d){const u=a.select(`[id="${c}"]`);Object.keys(e).forEach(function(p){const r=e[p];let g="default";r.classes.length>0&&(g=r.classes.join(" ")),g=g+" flowchart-label";const w=A(r.styles);let t=r.text!==void 0?r.text:r.id,s;if(y.info("vertex",r,r.labelType),r.labelType==="markdown")y.info("vertex",r,r.labelType);else if(W(C().flowchart.htmlLabels)){const m={label:t.replace(/fa[blrs]?:fa-[\w-]+/g,k=>`<i class='${k.replace(":"," ")}'></i>`)};s=te(u,m).node(),s.parentNode.removeChild(s)}else{const m=i.createElementNS("http://www.w3.org/2000/svg","text");m.setAttribute("style",w.labelStyle.replace("color:","fill:"));const k=t.split(z.lineBreakRegex);for(const T of k){const v=i.createElementNS("http://www.w3.org/2000/svg","tspan");v.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),v.setAttribute("dy","1em"),v.setAttribute("x","1"),v.textContent=T,m.appendChild(v)}s=m}let b=0,o="";switch(r.type){case"round":b=5,o="rect";break;case"square":o="rect";break;case"diamond":o="question";break;case"hexagon":o="hexagon";break;case"odd":o="rect_left_inv_arrow";break;case"lean_right":o="lean_right";break;case"lean_left":o="lean_left";break;case"trapezoid":o="trapezoid";break;case"inv_trapezoid":o="inv_trapezoid";break;case"odd_right":o="rect_left_inv_arrow";break;case"circle":o="circle";break;case"ellipse":o="ellipse";break;case"stadium":o="stadium";break;case"subroutine":o="subroutine";break;case"cylinder":o="cylinder";break;case"group":o="rect";break;case"doublecircle":o="doublecircle";break;default:o="rect"}l.setNode(r.id,{labelStyle:w.labelStyle,shape:o,labelText:t,labelType:r.labelType,rx:b,ry:b,class:g,style:w.style,id:r.id,link:r.link,linkTarget:r.linkTarget,tooltip:d.db.getTooltip(r.id)||"",domId:d.db.lookUpDomId(r.id),haveCallback:r.haveCallback,width:r.type==="group"?500:void 0,dir:r.dir,type:r.type,props:r.props,padding:C().flowchart.padding}),y.info("setNode",{labelStyle:w.labelStyle,labelType:r.labelType,shape:o,labelText:t,rx:b,ry:b,class:g,style:w.style,id:r.id,domId:d.db.lookUpDomId(r.id),width:r.type==="group"?500:void 0,type:r.type,dir:r.dir,props:r.props,padding:C().flowchart.padding})})},P=function(e,l,c){y.info("abc78 edges = ",e);let a=0,i={},d,u;if(e.defaultStyle!==void 0){const n=A(e.defaultStyle);d=n.style,u=n.labelStyle}e.forEach(function(n){a++;const p="L-"+n.start+"-"+n.end;i[p]===void 0?(i[p]=0,y.info("abc78 new entry",p,i[p])):(i[p]++,y.info("abc78 new entry",p,i[p]));let r=p+"-"+i[p];y.info("abc78 new link id to be used is",p,r,i[p]);const g="LS-"+n.start,w="LE-"+n.end,t={style:"",labelStyle:""};switch(t.minlen=n.length||1,n.type==="arrow_open"?t.arrowhead="none":t.arrowhead="normal",t.arrowTypeStart="arrow_open",t.arrowTypeEnd="arrow_open",n.type){case"double_arrow_cross":t.arrowTypeStart="arrow_cross";case"arrow_cross":t.arrowTypeEnd="arrow_cross";break;case"double_arrow_point":t.arrowTypeStart="arrow_point";case"arrow_point":t.arrowTypeEnd="arrow_point";break;case"double_arrow_circle":t.arrowTypeStart="arrow_circle";case"arrow_circle":t.arrowTypeEnd="arrow_circle";break}let s="",b="";switch(n.stroke){case"normal":s="fill:none;",d!==void 0&&(s=d),u!==void 0&&(b=u),t.thickness="normal",t.pattern="solid";break;case"dotted":t.thickness="normal",t.pattern="dotted",t.style="fill:none;stroke-width:2px;stroke-dasharray:3;";break;case"thick":t.thickness="thick",t.pattern="solid",t.style="stroke-width: 3.5px;fill:none;";break;case"invisible":t.thickness="invisible",t.pattern="solid",t.style="stroke-width: 0;fill:none;";break}if(n.style!==void 0){const o=A(n.style);s=o.style,b=o.labelStyle}t.style=t.style+=s,t.labelStyle=t.labelStyle+=b,n.interpolate!==void 0?t.curve=$(n.interpolate,E):e.defaultInterpolate!==void 0?t.curve=$(e.defaultInterpolate,E):t.curve=$(G.curve,E),n.text===void 0?n.style!==void 0&&(t.arrowheadStyle="fill: #333"):(t.arrowheadStyle="fill: #333",t.labelpos="c"),t.labelType=n.labelType,t.label=n.text.replace(z.lineBreakRegex,`
  2. `),n.style===void 0&&(t.style=t.style||"stroke: #333; stroke-width: 1.5px;fill:none;"),t.labelStyle=t.labelStyle.replace("color:","fill:"),t.id=r,t.classes="flowchart-link "+g+" "+w,l.setEdge(n.start,n.end,t,a)})},le=function(e,l){return l.db.getClasses()},ae=async function(e,l,c,a){y.info("Drawing flowchart");let i=a.db.getDirection();i===void 0&&(i="TD");const{securityLevel:d,flowchart:u}=C(),n=u.nodeSpacing||50,p=u.rankSpacing||50;let r;d==="sandbox"&&(r=_("#i"+l));const g=d==="sandbox"?_(r.nodes()[0].contentDocument.body):_("body"),w=d==="sandbox"?r.nodes()[0].contentDocument:document,t=new V({multigraph:!0,compound:!0}).setGraph({rankdir:i,nodesep:n,ranksep:p,marginx:0,marginy:0}).setDefaultEdgeLabel(function(){return{}});let s;const b=a.db.getSubGraphs();y.info("Subgraphs - ",b);for(let f=b.length-1;f>=0;f--)s=b[f],y.info("Subgraph - ",s),a.db.addVertex(s.id,{text:s.title,type:s.labelType},"group",void 0,s.classes,s.dir);const o=a.db.getVertices(),m=a.db.getEdges();y.info("Edges",m);let k=0;for(k=b.length-1;k>=0;k--){s=b[k],Y("cluster").append("text");for(let f=0;f<s.nodes.length;f++)y.info("Setting up subgraphs",s.nodes[f],s.id),t.setParent(s.nodes[f],s.id)}q(o,t,l,g,w,a),P(m,t);const T=g.select(`[id="${l}"]`),v=g.select("#"+l+" g");if(await Q(v,t,["point","circle","cross"],"flowchart",l),X.insertTitle(T,"flowchartTitleText",u.titleTopMargin,a.db.getDiagramTitle()),J(t,T,u.diagramPadding,u.useMaxWidth),a.db.indexNodes("subGraph"+k),!u.htmlLabels){const f=w.querySelectorAll('[id="'+l+'"] .edgeLabel .label');for(const x of f){const S=x.getBBox(),h=w.createElementNS("http://www.w3.org/2000/svg","rect");h.setAttribute("rx",0),h.setAttribute("ry",0),h.setAttribute("width",S.width),h.setAttribute("height",S.height),x.insertBefore(h,x.firstChild)}}Object.keys(o).forEach(function(f){const x=o[f];if(x.link){const S=_("#"+l+' [id="'+f+'"]');if(S){const h=w.createElementNS("http://www.w3.org/2000/svg","a");h.setAttributeNS("http://www.w3.org/2000/svg","class",x.classes.join(" ")),h.setAttributeNS("http://www.w3.org/2000/svg","href",x.link),h.setAttributeNS("http://www.w3.org/2000/svg","rel","noopener"),d==="sandbox"?h.setAttributeNS("http://www.w3.org/2000/svg","target","_top"):x.linkTarget&&h.setAttributeNS("http://www.w3.org/2000/svg","target",x.linkTarget);const N=S.insert(function(){return h},":first-child"),B=S.select(".label-container");B&&N.append(function(){return B.node()});const I=S.select(".label");I&&N.append(function(){return I.node()})}}})},we={setConf:re,addVertices:q,addEdges:P,getClasses:le,draw:ae},oe=(e,l)=>{const c=Z,a=c(e,"r"),i=c(e,"g"),d=c(e,"b");return K(a,i,d,l)},ne=e=>`.label {
  3. font-family: ${e.fontFamily};
  4. color: ${e.nodeTextColor||e.textColor};
  5. }
  6. .cluster-label text {
  7. fill: ${e.titleColor};
  8. }
  9. .cluster-label span,p {
  10. color: ${e.titleColor};
  11. }
  12. .label text,span,p {
  13. fill: ${e.nodeTextColor||e.textColor};
  14. color: ${e.nodeTextColor||e.textColor};
  15. }
  16. .node rect,
  17. .node circle,
  18. .node ellipse,
  19. .node polygon,
  20. .node path {
  21. fill: ${e.mainBkg};
  22. stroke: ${e.nodeBorder};
  23. stroke-width: 1px;
  24. }
  25. .flowchart-label text {
  26. text-anchor: middle;
  27. }
  28. // .flowchart-label .text-outer-tspan {
  29. // text-anchor: middle;
  30. // }
  31. // .flowchart-label .text-inner-tspan {
  32. // text-anchor: start;
  33. // }
  34. .node .label {
  35. text-align: center;
  36. }
  37. .node.clickable {
  38. cursor: pointer;
  39. }
  40. .arrowheadPath {
  41. fill: ${e.arrowheadColor};
  42. }
  43. .edgePath .path {
  44. stroke: ${e.lineColor};
  45. stroke-width: 2.0px;
  46. }
  47. .flowchart-link {
  48. stroke: ${e.lineColor};
  49. fill: none;
  50. }
  51. .edgeLabel {
  52. background-color: ${e.edgeLabelBackground};
  53. rect {
  54. opacity: 0.5;
  55. background-color: ${e.edgeLabelBackground};
  56. fill: ${e.edgeLabelBackground};
  57. }
  58. text-align: center;
  59. }
  60. /* For html labels only */
  61. .labelBkg {
  62. background-color: ${oe(e.edgeLabelBackground,.5)};
  63. // background-color:
  64. }
  65. .cluster rect {
  66. fill: ${e.clusterBkg};
  67. stroke: ${e.clusterBorder};
  68. stroke-width: 1px;
  69. }
  70. .cluster text {
  71. fill: ${e.titleColor};
  72. }
  73. .cluster span,p {
  74. color: ${e.titleColor};
  75. }
  76. /* .cluster div {
  77. color: ${e.titleColor};
  78. } */
  79. div.mermaidTooltip {
  80. position: absolute;
  81. text-align: center;
  82. max-width: 200px;
  83. padding: 2px;
  84. font-family: ${e.fontFamily};
  85. font-size: 12px;
  86. background: ${e.tertiaryColor};
  87. border: 1px solid ${e.border2};
  88. border-radius: 2px;
  89. pointer-events: none;
  90. z-index: 100;
  91. }
  92. .flowchartTitleText {
  93. text-anchor: middle;
  94. font-size: 18px;
  95. fill: ${e.textColor};
  96. }
  97. `,he=ne;export{ee as a,te as b,ue as c,fe as d,be as e,we as f,he as g,pe as i,Y as s};