1 | (function webpackUniversalModuleDefinition(root, factory) {
|
2 | if(typeof exports === 'object' && typeof module === 'object')
|
3 | module.exports = factory();
|
4 | else if(typeof define === 'function' && define.amd)
|
5 | define([], factory);
|
6 | else if(typeof exports === 'object')
|
7 | exports["mermaid"] = factory();
|
8 | else
|
9 | root["mermaid"] = factory();
|
10 | })(typeof self !== "undefined" ? self : this, () => {
|
11 | return (() => {
|
12 | var __webpack_modules__ = ({
|
13 |
|
14 | "./src/diagrams/c4/parser/c4Diagram.jison":
|
15 |
|
16 |
|
17 |
|
18 | ((module, exports, __webpack_require__) => {
|
19 |
|
20 | module = __webpack_require__.nmd(module);
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | var parser = (function(){
|
95 | var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,6],$V1=[1,7],$V2=[1,8],$V3=[1,9],$V4=[1,16],$V5=[1,11],$V6=[1,12],$V7=[1,13],$V8=[1,14],$V9=[1,15],$Va=[1,27],$Vb=[1,33],$Vc=[1,34],$Vd=[1,35],$Ve=[1,36],$Vf=[1,37],$Vg=[1,72],$Vh=[1,73],$Vi=[1,74],$Vj=[1,75],$Vk=[1,76],$Vl=[1,77],$Vm=[1,78],$Vn=[1,38],$Vo=[1,39],$Vp=[1,40],$Vq=[1,41],$Vr=[1,42],$Vs=[1,43],$Vt=[1,44],$Vu=[1,45],$Vv=[1,46],$Vw=[1,47],$Vx=[1,48],$Vy=[1,49],$Vz=[1,50],$VA=[1,51],$VB=[1,52],$VC=[1,53],$VD=[1,54],$VE=[1,55],$VF=[1,56],$VG=[1,57],$VH=[1,59],$VI=[1,60],$VJ=[1,61],$VK=[1,62],$VL=[1,63],$VM=[1,64],$VN=[1,65],$VO=[1,66],$VP=[1,67],$VQ=[1,68],$VR=[1,69],$VS=[24,52],$VT=[24,44,46,47,48,49,50,51,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],$VU=[15,24,44,46,47,48,49,50,51,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],$VV=[1,94],$VW=[1,95],$VX=[1,96],$VY=[1,97],$VZ=[15,24,52],$V_=[7,8,9,10,18,22,25,26,27,28],$V$=[15,24,43,52],$V01=[15,24,43,52,86,87,89,90],$V11=[15,43],$V21=[44,46,47,48,49,50,51,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84];
|
96 | var parser = {trace: function trace () { },
|
97 | yy: {},
|
98 | symbols_: {"error":2,"start":3,"mermaidDoc":4,"direction":5,"directive":6,"direction_tb":7,"direction_bt":8,"direction_rl":9,"direction_lr":10,"graphConfig":11,"openDirective":12,"typeDirective":13,"closeDirective":14,"NEWLINE":15,":":16,"argDirective":17,"open_directive":18,"type_directive":19,"arg_directive":20,"close_directive":21,"C4_CONTEXT":22,"statements":23,"EOF":24,"C4_CONTAINER":25,"C4_COMPONENT":26,"C4_DYNAMIC":27,"C4_DEPLOYMENT":28,"otherStatements":29,"diagramStatements":30,"otherStatement":31,"title":32,"accDescription":33,"acc_title":34,"acc_title_value":35,"acc_descr":36,"acc_descr_value":37,"acc_descr_multiline_value":38,"boundaryStatement":39,"boundaryStartStatement":40,"boundaryStopStatement":41,"boundaryStart":42,"LBRACE":43,"ENTERPRISE_BOUNDARY":44,"attributes":45,"SYSTEM_BOUNDARY":46,"BOUNDARY":47,"CONTAINER_BOUNDARY":48,"NODE":49,"NODE_L":50,"NODE_R":51,"RBRACE":52,"diagramStatement":53,"PERSON":54,"PERSON_EXT":55,"SYSTEM":56,"SYSTEM_DB":57,"SYSTEM_QUEUE":58,"SYSTEM_EXT":59,"SYSTEM_EXT_DB":60,"SYSTEM_EXT_QUEUE":61,"CONTAINER":62,"CONTAINER_DB":63,"CONTAINER_QUEUE":64,"CONTAINER_EXT":65,"CONTAINER_EXT_DB":66,"CONTAINER_EXT_QUEUE":67,"COMPONENT":68,"COMPONENT_DB":69,"COMPONENT_QUEUE":70,"COMPONENT_EXT":71,"COMPONENT_EXT_DB":72,"COMPONENT_EXT_QUEUE":73,"REL":74,"BIREL":75,"REL_U":76,"REL_D":77,"REL_L":78,"REL_R":79,"REL_B":80,"REL_INDEX":81,"UPDATE_EL_STYLE":82,"UPDATE_REL_STYLE":83,"UPDATE_LAYOUT_CONFIG":84,"attribute":85,"STR":86,"STR_KEY":87,"STR_VALUE":88,"ATTRIBUTE":89,"ATTRIBUTE_EMPTY":90,"$accept":0,"$end":1},
|
99 | terminals_: {2:"error",7:"direction_tb",8:"direction_bt",9:"direction_rl",10:"direction_lr",15:"NEWLINE",16:":",18:"open_directive",19:"type_directive",20:"arg_directive",21:"close_directive",22:"C4_CONTEXT",24:"EOF",25:"C4_CONTAINER",26:"C4_COMPONENT",27:"C4_DYNAMIC",28:"C4_DEPLOYMENT",32:"title",33:"accDescription",34:"acc_title",35:"acc_title_value",36:"acc_descr",37:"acc_descr_value",38:"acc_descr_multiline_value",43:"LBRACE",44:"ENTERPRISE_BOUNDARY",46:"SYSTEM_BOUNDARY",47:"BOUNDARY",48:"CONTAINER_BOUNDARY",49:"NODE",50:"NODE_L",51:"NODE_R",52:"RBRACE",54:"PERSON",55:"PERSON_EXT",56:"SYSTEM",57:"SYSTEM_DB",58:"SYSTEM_QUEUE",59:"SYSTEM_EXT",60:"SYSTEM_EXT_DB",61:"SYSTEM_EXT_QUEUE",62:"CONTAINER",63:"CONTAINER_DB",64:"CONTAINER_QUEUE",65:"CONTAINER_EXT",66:"CONTAINER_EXT_DB",67:"CONTAINER_EXT_QUEUE",68:"COMPONENT",69:"COMPONENT_DB",70:"COMPONENT_QUEUE",71:"COMPONENT_EXT",72:"COMPONENT_EXT_DB",73:"COMPONENT_EXT_QUEUE",74:"REL",75:"BIREL",76:"REL_U",77:"REL_D",78:"REL_L",79:"REL_R",80:"REL_B",81:"REL_INDEX",82:"UPDATE_EL_STYLE",83:"UPDATE_REL_STYLE",84:"UPDATE_LAYOUT_CONFIG",86:"STR",87:"STR_KEY",88:"STR_VALUE",89:"ATTRIBUTE",90:"ATTRIBUTE_EMPTY"},
|
100 | productions_: [0,[3,1],[3,1],[3,2],[5,1],[5,1],[5,1],[5,1],[4,1],[6,4],[6,6],[12,1],[13,1],[17,1],[14,1],[11,4],[11,4],[11,4],[11,4],[11,4],[23,1],[23,1],[23,2],[29,1],[29,2],[29,3],[31,1],[31,1],[31,2],[31,2],[31,1],[39,3],[40,3],[40,3],[40,4],[42,2],[42,2],[42,2],[42,2],[42,2],[42,2],[42,2],[41,1],[30,1],[30,2],[30,3],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,1],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[45,1],[45,2],[85,1],[85,2],[85,1],[85,1]],
|
101 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
102 |
|
103 |
|
104 | var $0 = $$.length - 1;
|
105 | switch (yystate) {
|
106 | case 4:
|
107 | yy.setDirection('TB');
|
108 | break;
|
109 | case 5:
|
110 | yy.setDirection('BT');
|
111 | break;
|
112 | case 6:
|
113 | yy.setDirection('RL');
|
114 | break;
|
115 | case 7:
|
116 | yy.setDirection('LR');
|
117 | break;
|
118 | case 11:
|
119 | console.log("open_directive: ", $$[$0]); yy.parseDirective('%%{', 'open_directive');
|
120 | break;
|
121 | case 12:
|
122 |
|
123 | break;
|
124 | case 13:
|
125 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); console.log("arg_directive: ", $$[$0]); yy.parseDirective($$[$0], 'arg_directive');
|
126 | break;
|
127 | case 14:
|
128 | console.log("close_directive: ", $$[$0]); yy.parseDirective('}%%', 'close_directive', 'c4Context');
|
129 | break;
|
130 | case 15: case 16: case 17: case 18: case 19:
|
131 | yy.setC4Type($$[$0-3])
|
132 | break;
|
133 | case 26:
|
134 | yy.setTitle($$[$0].substring(6));this.$=$$[$0].substring(6);
|
135 | break;
|
136 | case 27:
|
137 | yy.setAccDescription($$[$0].substring(15));this.$=$$[$0].substring(15);
|
138 | break;
|
139 | case 28:
|
140 | this.$=$$[$0].trim();yy.setTitle(this.$);
|
141 | break;
|
142 | case 29: case 30:
|
143 | this.$=$$[$0].trim();yy.setAccDescription(this.$);
|
144 | break;
|
145 | case 35: case 36:
|
146 | console.log($$[$0-1],JSON.stringify($$[$0])); $$[$0].splice(2, 0, 'ENTERPRISE'); yy.addPersonOrSystemBoundary(...$$[$0]); this.$=$$[$0];
|
147 | break;
|
148 | case 37:
|
149 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystemBoundary(...$$[$0]); this.$=$$[$0];
|
150 | break;
|
151 | case 38:
|
152 | console.log($$[$0-1],JSON.stringify($$[$0])); $$[$0].splice(2, 0, 'CONTAINER'); yy.addContainerBoundary(...$$[$0]); this.$=$$[$0];
|
153 | break;
|
154 | case 39:
|
155 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addDeploymentNode('node', ...$$[$0]); this.$=$$[$0];
|
156 | break;
|
157 | case 40:
|
158 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addDeploymentNode('nodeL', ...$$[$0]); this.$=$$[$0];
|
159 | break;
|
160 | case 41:
|
161 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addDeploymentNode('nodeR', ...$$[$0]); this.$=$$[$0];
|
162 | break;
|
163 | case 42:
|
164 | yy.popBoundaryParseStack()
|
165 | break;
|
166 | case 46:
|
167 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('person', ...$$[$0]); this.$=$$[$0];
|
168 | break;
|
169 | case 47:
|
170 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('external_person', ...$$[$0]); this.$=$$[$0];
|
171 | break;
|
172 | case 48:
|
173 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('system', ...$$[$0]); this.$=$$[$0];
|
174 | break;
|
175 | case 49:
|
176 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('system_db', ...$$[$0]); this.$=$$[$0];
|
177 | break;
|
178 | case 50:
|
179 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('system_queue', ...$$[$0]); this.$=$$[$0];
|
180 | break;
|
181 | case 51:
|
182 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('external_system', ...$$[$0]); this.$=$$[$0];
|
183 | break;
|
184 | case 52:
|
185 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('external_system_db', ...$$[$0]); this.$=$$[$0];
|
186 | break;
|
187 | case 53:
|
188 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addPersonOrSystem('external_system_queue', ...$$[$0]); this.$=$$[$0];
|
189 | break;
|
190 | case 54:
|
191 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addContainer('container', ...$$[$0]); this.$=$$[$0];
|
192 | break;
|
193 | case 55:
|
194 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addContainer('container_db', ...$$[$0]); this.$=$$[$0];
|
195 | break;
|
196 | case 56:
|
197 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addContainer('container_queue', ...$$[$0]); this.$=$$[$0];
|
198 | break;
|
199 | case 57:
|
200 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addContainer('external_container', ...$$[$0]); this.$=$$[$0];
|
201 | break;
|
202 | case 58:
|
203 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addContainer('external_container_db', ...$$[$0]); this.$=$$[$0];
|
204 | break;
|
205 | case 59:
|
206 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addContainer('external_container_queue', ...$$[$0]); this.$=$$[$0];
|
207 | break;
|
208 | case 60:
|
209 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addComponent('component', ...$$[$0]); this.$=$$[$0];
|
210 | break;
|
211 | case 61:
|
212 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addComponent('component_db', ...$$[$0]); this.$=$$[$0];
|
213 | break;
|
214 | case 62:
|
215 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addComponent('component_queue', ...$$[$0]); this.$=$$[$0];
|
216 | break;
|
217 | case 63:
|
218 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addComponent('external_component', ...$$[$0]); this.$=$$[$0];
|
219 | break;
|
220 | case 64:
|
221 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addComponent('external_component_db', ...$$[$0]); this.$=$$[$0];
|
222 | break;
|
223 | case 65:
|
224 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addComponent('external_component_queue', ...$$[$0]); this.$=$$[$0];
|
225 | break;
|
226 | case 67:
|
227 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addRel('rel', ...$$[$0]); this.$=$$[$0];
|
228 | break;
|
229 | case 68:
|
230 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addRel('birel', ...$$[$0]); this.$=$$[$0];
|
231 | break;
|
232 | case 69:
|
233 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addRel('rel_u', ...$$[$0]); this.$=$$[$0];
|
234 | break;
|
235 | case 70:
|
236 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addRel('rel_d', ...$$[$0]); this.$=$$[$0];
|
237 | break;
|
238 | case 71:
|
239 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addRel('rel_l', ...$$[$0]); this.$=$$[$0];
|
240 | break;
|
241 | case 72:
|
242 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addRel('rel_r', ...$$[$0]); this.$=$$[$0];
|
243 | break;
|
244 | case 73:
|
245 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.addRel('rel_b', ...$$[$0]); this.$=$$[$0];
|
246 | break;
|
247 | case 74:
|
248 | console.log($$[$0-1],JSON.stringify($$[$0])); $$[$0].splice(0, 1); yy.addRel('rel', ...$$[$0]); this.$=$$[$0];
|
249 | break;
|
250 | case 75:
|
251 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.updateElStyle('update_el_style', ...$$[$0]); this.$=$$[$0];
|
252 | break;
|
253 | case 76:
|
254 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.updateRelStyle('update_rel_style', ...$$[$0]); this.$=$$[$0];
|
255 | break;
|
256 | case 77:
|
257 | console.log($$[$0-1],JSON.stringify($$[$0])); yy.updateLayoutConfig('update_layout_config', ...$$[$0]); this.$=$$[$0];
|
258 | break;
|
259 | case 78:
|
260 | console.log('PUSH ATTRIBUTE: ', $$[$0]); this.$ = [$$[$0]];
|
261 | break;
|
262 | case 79:
|
263 | console.log('PUSH ATTRIBUTE: ', $$[$0-1]); $$[$0].unshift($$[$0-1]); this.$=$$[$0];
|
264 | break;
|
265 | case 80: case 82:
|
266 | this.$ = $$[$0].trim();
|
267 | break;
|
268 | case 81:
|
269 | console.log('kv: ', $$[$0-1], $$[$0]); let kv={}; kv[$$[$0-1].trim()]=$$[$0].trim(); this.$=kv;
|
270 | break;
|
271 | case 83:
|
272 | this.$ = "";
|
273 | break;
|
274 | }
|
275 | },
|
276 | table: [{3:1,4:2,5:3,6:4,7:$V0,8:$V1,9:$V2,10:$V3,11:5,12:10,18:$V4,22:$V5,25:$V6,26:$V7,27:$V8,28:$V9},{1:[3]},{1:[2,1]},{1:[2,2]},{3:17,4:2,5:3,6:4,7:$V0,8:$V1,9:$V2,10:$V3,11:5,12:10,18:$V4,22:$V5,25:$V6,26:$V7,27:$V8,28:$V9},{1:[2,8]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{1:[2,7]},{13:18,19:[1,19]},{15:[1,20]},{15:[1,21]},{15:[1,22]},{15:[1,23]},{15:[1,24]},{19:[2,11]},{1:[2,3]},{14:25,16:[1,26],21:$Va},o([16,21],[2,12]),{23:28,29:29,30:30,31:31,32:$Vb,33:$Vc,34:$Vd,36:$Ve,38:$Vf,39:58,40:70,42:71,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,53:32,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR},{23:79,29:29,30:30,31:31,32:$Vb,33:$Vc,34:$Vd,36:$Ve,38:$Vf,39:58,40:70,42:71,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,53:32,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR},{23:80,29:29,30:30,31:31,32:$Vb,33:$Vc,34:$Vd,36:$Ve,38:$Vf,39:58,40:70,42:71,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,53:32,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR},{23:81,29:29,30:30,31:31,32:$Vb,33:$Vc,34:$Vd,36:$Ve,38:$Vf,39:58,40:70,42:71,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,53:32,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR},{23:82,29:29,30:30,31:31,32:$Vb,33:$Vc,34:$Vd,36:$Ve,38:$Vf,39:58,40:70,42:71,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,53:32,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR},{15:[1,83]},{17:84,20:[1,85]},{15:[2,14]},{24:[1,86]},o($VS,[2,20],{53:32,39:58,40:70,42:71,30:87,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR}),o($VS,[2,21]),o($VT,[2,23],{15:[1,88]}),o($VS,[2,43],{15:[1,89]}),o($VU,[2,26]),o($VU,[2,27]),{35:[1,90]},{37:[1,91]},o($VU,[2,30]),{45:92,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:98,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:99,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:100,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:101,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:102,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:103,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:104,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:105,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:106,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:107,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:108,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:109,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:110,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:111,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:112,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:113,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:114,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:115,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:116,85:93,86:$VV,87:$VW,89:$VX,90:$VY},o($VZ,[2,66]),{45:117,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:118,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:119,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:120,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:121,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:122,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:123,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:124,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:125,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:126,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:127,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{30:128,39:58,40:70,42:71,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,53:32,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR},{15:[1,130],43:[1,129]},{45:131,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:132,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:133,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:134,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:135,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:136,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{45:137,85:93,86:$VV,87:$VW,89:$VX,90:$VY},{24:[1,138]},{24:[1,139]},{24:[1,140]},{24:[1,141]},o($V_,[2,9]),{14:142,21:$Va},{21:[2,13]},{1:[2,15]},o($VS,[2,22]),o($VT,[2,24],{31:31,29:143,32:$Vb,33:$Vc,34:$Vd,36:$Ve,38:$Vf}),o($VS,[2,44],{29:29,30:30,31:31,53:32,39:58,40:70,42:71,23:144,32:$Vb,33:$Vc,34:$Vd,36:$Ve,38:$Vf,44:$Vg,46:$Vh,47:$Vi,48:$Vj,49:$Vk,50:$Vl,51:$Vm,54:$Vn,55:$Vo,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu,62:$Vv,63:$Vw,64:$Vx,65:$Vy,66:$Vz,67:$VA,68:$VB,69:$VC,70:$VD,71:$VE,72:$VF,73:$VG,74:$VH,75:$VI,76:$VJ,77:$VK,78:$VL,79:$VM,80:$VN,81:$VO,82:$VP,83:$VQ,84:$VR}),o($VU,[2,28]),o($VU,[2,29]),o($VZ,[2,46]),o($V$,[2,78],{85:93,45:145,86:$VV,87:$VW,89:$VX,90:$VY}),o($V01,[2,80]),{88:[1,146]},o($V01,[2,82]),o($V01,[2,83]),o($VZ,[2,47]),o($VZ,[2,48]),o($VZ,[2,49]),o($VZ,[2,50]),o($VZ,[2,51]),o($VZ,[2,52]),o($VZ,[2,53]),o($VZ,[2,54]),o($VZ,[2,55]),o($VZ,[2,56]),o($VZ,[2,57]),o($VZ,[2,58]),o($VZ,[2,59]),o($VZ,[2,60]),o($VZ,[2,61]),o($VZ,[2,62]),o($VZ,[2,63]),o($VZ,[2,64]),o($VZ,[2,65]),o($VZ,[2,67]),o($VZ,[2,68]),o($VZ,[2,69]),o($VZ,[2,70]),o($VZ,[2,71]),o($VZ,[2,72]),o($VZ,[2,73]),o($VZ,[2,74]),o($VZ,[2,75]),o($VZ,[2,76]),o($VZ,[2,77]),{41:147,52:[1,148]},{15:[1,149]},{43:[1,150]},o($V11,[2,35]),o($V11,[2,36]),o($V11,[2,37]),o($V11,[2,38]),o($V11,[2,39]),o($V11,[2,40]),o($V11,[2,41]),{1:[2,16]},{1:[2,17]},{1:[2,18]},{1:[2,19]},{15:[1,151]},o($VT,[2,25]),o($VS,[2,45]),o($V$,[2,79]),o($V01,[2,81]),o($VZ,[2,31]),o($VZ,[2,42]),o($V21,[2,32]),o($V21,[2,33],{15:[1,152]}),o($V_,[2,10]),o($V21,[2,34])],
|
277 | defaultActions: {2:[2,1],3:[2,2],5:[2,8],6:[2,4],7:[2,5],8:[2,6],9:[2,7],16:[2,11],17:[2,3],27:[2,14],85:[2,13],86:[2,15],138:[2,16],139:[2,17],140:[2,18],141:[2,19]},
|
278 | parseError: function parseError (str, hash) {
|
279 | if (hash.recoverable) {
|
280 | this.trace(str);
|
281 | } else {
|
282 | var error = new Error(str);
|
283 | error.hash = hash;
|
284 | throw error;
|
285 | }
|
286 | },
|
287 | parse: function parse(input) {
|
288 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
289 | var args = lstack.slice.call(arguments, 1);
|
290 | var lexer = Object.create(this.lexer);
|
291 | var sharedState = { yy: {} };
|
292 | for (var k in this.yy) {
|
293 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
294 | sharedState.yy[k] = this.yy[k];
|
295 | }
|
296 | }
|
297 | lexer.setInput(input, sharedState.yy);
|
298 | sharedState.yy.lexer = lexer;
|
299 | sharedState.yy.parser = this;
|
300 | if (typeof lexer.yylloc == 'undefined') {
|
301 | lexer.yylloc = {};
|
302 | }
|
303 | var yyloc = lexer.yylloc;
|
304 | lstack.push(yyloc);
|
305 | var ranges = lexer.options && lexer.options.ranges;
|
306 | if (typeof sharedState.yy.parseError === 'function') {
|
307 | this.parseError = sharedState.yy.parseError;
|
308 | } else {
|
309 | this.parseError = Object.getPrototypeOf(this).parseError;
|
310 | }
|
311 | function popStack(n) {
|
312 | stack.length = stack.length - 2 * n;
|
313 | vstack.length = vstack.length - n;
|
314 | lstack.length = lstack.length - n;
|
315 | }
|
316 | function lex() {
|
317 | var token;
|
318 | token = tstack.pop() || lexer.lex() || EOF;
|
319 | if (typeof token !== 'number') {
|
320 | if (token instanceof Array) {
|
321 | tstack = token;
|
322 | token = tstack.pop();
|
323 | }
|
324 | token = self.symbols_[token] || token;
|
325 | }
|
326 | return token;
|
327 | }
|
328 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
329 | while (true) {
|
330 | state = stack[stack.length - 1];
|
331 | if (this.defaultActions[state]) {
|
332 | action = this.defaultActions[state];
|
333 | } else {
|
334 | if (symbol === null || typeof symbol == 'undefined') {
|
335 | symbol = lex();
|
336 | }
|
337 | action = table[state] && table[state][symbol];
|
338 | }
|
339 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
340 | var errStr = '';
|
341 | expected = [];
|
342 | for (p in table[state]) {
|
343 | if (this.terminals_[p] && p > TERROR) {
|
344 | expected.push('\'' + this.terminals_[p] + '\'');
|
345 | }
|
346 | }
|
347 | if (lexer.showPosition) {
|
348 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
349 | } else {
|
350 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
351 | }
|
352 | this.parseError(errStr, {
|
353 | text: lexer.match,
|
354 | token: this.terminals_[symbol] || symbol,
|
355 | line: lexer.yylineno,
|
356 | loc: yyloc,
|
357 | expected: expected
|
358 | });
|
359 | }
|
360 | if (action[0] instanceof Array && action.length > 1) {
|
361 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
362 | }
|
363 | switch (action[0]) {
|
364 | case 1:
|
365 | stack.push(symbol);
|
366 | vstack.push(lexer.yytext);
|
367 | lstack.push(lexer.yylloc);
|
368 | stack.push(action[1]);
|
369 | symbol = null;
|
370 | if (!preErrorSymbol) {
|
371 | yyleng = lexer.yyleng;
|
372 | yytext = lexer.yytext;
|
373 | yylineno = lexer.yylineno;
|
374 | yyloc = lexer.yylloc;
|
375 | if (recovering > 0) {
|
376 | recovering--;
|
377 | }
|
378 | } else {
|
379 | symbol = preErrorSymbol;
|
380 | preErrorSymbol = null;
|
381 | }
|
382 | break;
|
383 | case 2:
|
384 | len = this.productions_[action[1]][1];
|
385 | yyval.$ = vstack[vstack.length - len];
|
386 | yyval._$ = {
|
387 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
388 | last_line: lstack[lstack.length - 1].last_line,
|
389 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
390 | last_column: lstack[lstack.length - 1].last_column
|
391 | };
|
392 | if (ranges) {
|
393 | yyval._$.range = [
|
394 | lstack[lstack.length - (len || 1)].range[0],
|
395 | lstack[lstack.length - 1].range[1]
|
396 | ];
|
397 | }
|
398 | r = this.performAction.apply(yyval, [
|
399 | yytext,
|
400 | yyleng,
|
401 | yylineno,
|
402 | sharedState.yy,
|
403 | action[1],
|
404 | vstack,
|
405 | lstack
|
406 | ].concat(args));
|
407 | if (typeof r !== 'undefined') {
|
408 | return r;
|
409 | }
|
410 | if (len) {
|
411 | stack = stack.slice(0, -1 * len * 2);
|
412 | vstack = vstack.slice(0, -1 * len);
|
413 | lstack = lstack.slice(0, -1 * len);
|
414 | }
|
415 | stack.push(this.productions_[action[1]][0]);
|
416 | vstack.push(yyval.$);
|
417 | lstack.push(yyval._$);
|
418 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
419 | stack.push(newState);
|
420 | break;
|
421 | case 3:
|
422 | return true;
|
423 | }
|
424 | }
|
425 | return true;
|
426 | }};
|
427 |
|
428 | var lexer = (function(){
|
429 | var lexer = ({
|
430 |
|
431 | EOF:1,
|
432 |
|
433 | parseError:function parseError(str, hash) {
|
434 | if (this.yy.parser) {
|
435 | this.yy.parser.parseError(str, hash);
|
436 | } else {
|
437 | throw new Error(str);
|
438 | }
|
439 | },
|
440 |
|
441 |
|
442 | setInput:function (input, yy) {
|
443 | this.yy = yy || this.yy || {};
|
444 | this._input = input;
|
445 | this._more = this._backtrack = this.done = false;
|
446 | this.yylineno = this.yyleng = 0;
|
447 | this.yytext = this.matched = this.match = '';
|
448 | this.conditionStack = ['INITIAL'];
|
449 | this.yylloc = {
|
450 | first_line: 1,
|
451 | first_column: 0,
|
452 | last_line: 1,
|
453 | last_column: 0
|
454 | };
|
455 | if (this.options.ranges) {
|
456 | this.yylloc.range = [0,0];
|
457 | }
|
458 | this.offset = 0;
|
459 | return this;
|
460 | },
|
461 |
|
462 |
|
463 | input:function () {
|
464 | var ch = this._input[0];
|
465 | this.yytext += ch;
|
466 | this.yyleng++;
|
467 | this.offset++;
|
468 | this.match += ch;
|
469 | this.matched += ch;
|
470 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
471 | if (lines) {
|
472 | this.yylineno++;
|
473 | this.yylloc.last_line++;
|
474 | } else {
|
475 | this.yylloc.last_column++;
|
476 | }
|
477 | if (this.options.ranges) {
|
478 | this.yylloc.range[1]++;
|
479 | }
|
480 |
|
481 | this._input = this._input.slice(1);
|
482 | return ch;
|
483 | },
|
484 |
|
485 |
|
486 | unput:function (ch) {
|
487 | var len = ch.length;
|
488 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
489 |
|
490 | this._input = ch + this._input;
|
491 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
492 |
|
493 | this.offset -= len;
|
494 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
495 | this.match = this.match.substr(0, this.match.length - 1);
|
496 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
497 |
|
498 | if (lines.length - 1) {
|
499 | this.yylineno -= lines.length - 1;
|
500 | }
|
501 | var r = this.yylloc.range;
|
502 |
|
503 | this.yylloc = {
|
504 | first_line: this.yylloc.first_line,
|
505 | last_line: this.yylineno + 1,
|
506 | first_column: this.yylloc.first_column,
|
507 | last_column: lines ?
|
508 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
509 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
510 | this.yylloc.first_column - len
|
511 | };
|
512 |
|
513 | if (this.options.ranges) {
|
514 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
515 | }
|
516 | this.yyleng = this.yytext.length;
|
517 | return this;
|
518 | },
|
519 |
|
520 |
|
521 | more:function () {
|
522 | this._more = true;
|
523 | return this;
|
524 | },
|
525 |
|
526 |
|
527 | reject:function () {
|
528 | if (this.options.backtrack_lexer) {
|
529 | this._backtrack = true;
|
530 | } else {
|
531 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
|
532 | text: "",
|
533 | token: null,
|
534 | line: this.yylineno
|
535 | });
|
536 |
|
537 | }
|
538 | return this;
|
539 | },
|
540 |
|
541 |
|
542 | less:function (n) {
|
543 | this.unput(this.match.slice(n));
|
544 | },
|
545 |
|
546 |
|
547 | pastInput:function () {
|
548 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
549 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
550 | },
|
551 |
|
552 |
|
553 | upcomingInput:function () {
|
554 | var next = this.match;
|
555 | if (next.length < 20) {
|
556 | next += this._input.substr(0, 20-next.length);
|
557 | }
|
558 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
559 | },
|
560 |
|
561 |
|
562 | showPosition:function () {
|
563 | var pre = this.pastInput();
|
564 | var c = new Array(pre.length + 1).join("-");
|
565 | return pre + this.upcomingInput() + "\n" + c + "^";
|
566 | },
|
567 |
|
568 |
|
569 | test_match:function(match, indexed_rule) {
|
570 | var token,
|
571 | lines,
|
572 | backup;
|
573 |
|
574 | if (this.options.backtrack_lexer) {
|
575 |
|
576 | backup = {
|
577 | yylineno: this.yylineno,
|
578 | yylloc: {
|
579 | first_line: this.yylloc.first_line,
|
580 | last_line: this.last_line,
|
581 | first_column: this.yylloc.first_column,
|
582 | last_column: this.yylloc.last_column
|
583 | },
|
584 | yytext: this.yytext,
|
585 | match: this.match,
|
586 | matches: this.matches,
|
587 | matched: this.matched,
|
588 | yyleng: this.yyleng,
|
589 | offset: this.offset,
|
590 | _more: this._more,
|
591 | _input: this._input,
|
592 | yy: this.yy,
|
593 | conditionStack: this.conditionStack.slice(0),
|
594 | done: this.done
|
595 | };
|
596 | if (this.options.ranges) {
|
597 | backup.yylloc.range = this.yylloc.range.slice(0);
|
598 | }
|
599 | }
|
600 |
|
601 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
602 | if (lines) {
|
603 | this.yylineno += lines.length;
|
604 | }
|
605 | this.yylloc = {
|
606 | first_line: this.yylloc.last_line,
|
607 | last_line: this.yylineno + 1,
|
608 | first_column: this.yylloc.last_column,
|
609 | last_column: lines ?
|
610 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
611 | this.yylloc.last_column + match[0].length
|
612 | };
|
613 | this.yytext += match[0];
|
614 | this.match += match[0];
|
615 | this.matches = match;
|
616 | this.yyleng = this.yytext.length;
|
617 | if (this.options.ranges) {
|
618 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
619 | }
|
620 | this._more = false;
|
621 | this._backtrack = false;
|
622 | this._input = this._input.slice(match[0].length);
|
623 | this.matched += match[0];
|
624 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
625 | if (this.done && this._input) {
|
626 | this.done = false;
|
627 | }
|
628 | if (token) {
|
629 | return token;
|
630 | } else if (this._backtrack) {
|
631 |
|
632 | for (var k in backup) {
|
633 | this[k] = backup[k];
|
634 | }
|
635 | return false;
|
636 | }
|
637 | return false;
|
638 | },
|
639 |
|
640 |
|
641 | next:function () {
|
642 | if (this.done) {
|
643 | return this.EOF;
|
644 | }
|
645 | if (!this._input) {
|
646 | this.done = true;
|
647 | }
|
648 |
|
649 | var token,
|
650 | match,
|
651 | tempMatch,
|
652 | index;
|
653 | if (!this._more) {
|
654 | this.yytext = '';
|
655 | this.match = '';
|
656 | }
|
657 | var rules = this._currentRules();
|
658 | for (var i = 0; i < rules.length; i++) {
|
659 | tempMatch = this._input.match(this.rules[rules[i]]);
|
660 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
661 | match = tempMatch;
|
662 | index = i;
|
663 | if (this.options.backtrack_lexer) {
|
664 | token = this.test_match(tempMatch, rules[i]);
|
665 | if (token !== false) {
|
666 | return token;
|
667 | } else if (this._backtrack) {
|
668 | match = false;
|
669 | continue;
|
670 | } else {
|
671 |
|
672 | return false;
|
673 | }
|
674 | } else if (!this.options.flex) {
|
675 | break;
|
676 | }
|
677 | }
|
678 | }
|
679 | if (match) {
|
680 | token = this.test_match(match, rules[index]);
|
681 | if (token !== false) {
|
682 | return token;
|
683 | }
|
684 |
|
685 | return false;
|
686 | }
|
687 | if (this._input === "") {
|
688 | return this.EOF;
|
689 | } else {
|
690 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
691 | text: "",
|
692 | token: null,
|
693 | line: this.yylineno
|
694 | });
|
695 | }
|
696 | },
|
697 |
|
698 |
|
699 | lex:function lex () {
|
700 | var r = this.next();
|
701 | if (r) {
|
702 | return r;
|
703 | } else {
|
704 | return this.lex();
|
705 | }
|
706 | },
|
707 |
|
708 |
|
709 | begin:function begin (condition) {
|
710 | this.conditionStack.push(condition);
|
711 | },
|
712 |
|
713 |
|
714 | popState:function popState () {
|
715 | var n = this.conditionStack.length - 1;
|
716 | if (n > 0) {
|
717 | return this.conditionStack.pop();
|
718 | } else {
|
719 | return this.conditionStack[0];
|
720 | }
|
721 | },
|
722 |
|
723 |
|
724 | _currentRules:function _currentRules () {
|
725 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
726 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
727 | } else {
|
728 | return this.conditions["INITIAL"].rules;
|
729 | }
|
730 | },
|
731 |
|
732 |
|
733 | topState:function topState (n) {
|
734 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
735 | if (n >= 0) {
|
736 | return this.conditionStack[n];
|
737 | } else {
|
738 | return "INITIAL";
|
739 | }
|
740 | },
|
741 |
|
742 |
|
743 | pushState:function pushState (condition) {
|
744 | this.begin(condition);
|
745 | },
|
746 |
|
747 |
|
748 | stateStackSize:function stateStackSize() {
|
749 | return this.conditionStack.length;
|
750 | },
|
751 | options: {},
|
752 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
753 | var YYSTATE=YY_START;
|
754 | switch($avoiding_name_collisions) {
|
755 | case 0: this.begin('open_directive'); return 18;
|
756 | break;
|
757 | case 1:return 7;
|
758 | break;
|
759 | case 2:return 8;
|
760 | break;
|
761 | case 3:return 9;
|
762 | break;
|
763 | case 4:return 10;
|
764 | break;
|
765 | case 5: this.begin('type_directive'); return 19;
|
766 | break;
|
767 | case 6: this.popState(); this.begin('arg_directive'); return 16;
|
768 | break;
|
769 | case 7: this.popState(); this.popState(); return 21;
|
770 | break;
|
771 | case 8:return 20;
|
772 | break;
|
773 | case 9:return 32;
|
774 | break;
|
775 | case 10:return 33;
|
776 | break;
|
777 | case 11: this.begin("acc_title");return 34;
|
778 | break;
|
779 | case 12: this.popState(); return "acc_title_value";
|
780 | break;
|
781 | case 13: this.begin("acc_descr");return 36;
|
782 | break;
|
783 | case 14: this.popState(); return "acc_descr_value";
|
784 | break;
|
785 | case 15: this.begin("acc_descr_multiline");
|
786 | break;
|
787 | case 16: this.popState();
|
788 | break;
|
789 | case 17:return "acc_descr_multiline_value";
|
790 | break;
|
791 | case 18:
|
792 | break;
|
793 | case 19:c
|
794 | break;
|
795 | case 20:return 15;
|
796 | break;
|
797 | case 21:
|
798 | break;
|
799 | case 22:return 22;
|
800 | break;
|
801 | case 23:return 25;
|
802 | break;
|
803 | case 24:return 26;
|
804 | break;
|
805 | case 25:return 27;
|
806 | break;
|
807 | case 26:return 28;
|
808 | break;
|
809 | case 27: this.begin("person_ext"); console.log('begin person_ext'); return 55;
|
810 | break;
|
811 | case 28: this.begin("person"); console.log('begin person'); return 54;
|
812 | break;
|
813 | case 29: this.begin("system_ext_queue"); console.log('begin system_ext_queue'); return 61;
|
814 | break;
|
815 | case 30: this.begin("system_ext_db"); console.log('begin system_ext_db'); return 60;
|
816 | break;
|
817 | case 31: this.begin("system_ext"); console.log('begin system_ext'); return 59;
|
818 | break;
|
819 | case 32: this.begin("system_queue"); console.log('begin system_queue'); return 58;
|
820 | break;
|
821 | case 33: this.begin("system_db"); console.log('begin system_db'); return 57;
|
822 | break;
|
823 | case 34: this.begin("system"); console.log('begin system'); return 56;
|
824 | break;
|
825 | case 35: this.begin("boundary"); console.log('begin boundary'); return 47;
|
826 | break;
|
827 | case 36: this.begin("enterprise_boundary"); console.log('begin enterprise_boundary'); return 44;
|
828 | break;
|
829 | case 37: this.begin("system_boundary"); console.log('begin system_boundary'); return 46;
|
830 | break;
|
831 | case 38: this.begin("container_ext_queue"); console.log('begin container_ext_queue'); return 67;
|
832 | break;
|
833 | case 39: this.begin("container_ext_db"); console.log('begin container_ext_db'); return 66;
|
834 | break;
|
835 | case 40: this.begin("container_ext"); console.log('begin container_ext'); return 65;
|
836 | break;
|
837 | case 41: this.begin("container_queue"); console.log('begin container_queue'); return 64;
|
838 | break;
|
839 | case 42: this.begin("container_db"); console.log('begin container_db'); return 63;
|
840 | break;
|
841 | case 43: this.begin("container"); console.log('begin container'); return 62;
|
842 | break;
|
843 | case 44: this.begin("container_boundary"); console.log('begin container_boundary'); return 48;
|
844 | break;
|
845 | case 45: this.begin("component_ext_queue"); console.log('begin component_ext_queue'); return 73;
|
846 | break;
|
847 | case 46: this.begin("component_ext_db"); console.log('begin component_ext_db'); return 72;
|
848 | break;
|
849 | case 47: this.begin("component_ext"); console.log('begin component_ext'); return 71;
|
850 | break;
|
851 | case 48: this.begin("component_queue"); console.log('begin component_queue'); return 70;
|
852 | break;
|
853 | case 49: this.begin("component_db"); console.log('begin component_db'); return 69;
|
854 | break;
|
855 | case 50: this.begin("component"); console.log('begin component'); return 68;
|
856 | break;
|
857 | case 51: this.begin("node"); console.log('begin node'); return 49;
|
858 | break;
|
859 | case 52: this.begin("node"); console.log('begin node'); return 49;
|
860 | break;
|
861 | case 53: this.begin("node_l"); console.log('begin node_l'); return 50;
|
862 | break;
|
863 | case 54: this.begin("node_r"); console.log('begin node_r'); return 51;
|
864 | break;
|
865 | case 55: this.begin("rel"); console.log('begin rel'); return 74;
|
866 | break;
|
867 | case 56: this.begin("birel"); console.log('begin birel'); return 75;
|
868 | break;
|
869 | case 57: this.begin("rel_u"); console.log('begin rel_u'); return 76;
|
870 | break;
|
871 | case 58: this.begin("rel_u"); console.log('begin rel_u'); return 76;
|
872 | break;
|
873 | case 59: this.begin("rel_d"); console.log('begin rel_d'); return 77;
|
874 | break;
|
875 | case 60: this.begin("rel_d"); console.log('begin rel_d'); return 77;
|
876 | break;
|
877 | case 61: this.begin("rel_l"); console.log('begin rel_l'); return 78;
|
878 | break;
|
879 | case 62: this.begin("rel_l"); console.log('begin rel_l'); return 78;
|
880 | break;
|
881 | case 63: this.begin("rel_r"); console.log('begin rel_r'); return 79;
|
882 | break;
|
883 | case 64: this.begin("rel_r"); console.log('begin rel_r'); return 79;
|
884 | break;
|
885 | case 65: this.begin("rel_b"); console.log('begin rel_b'); return 80;
|
886 | break;
|
887 | case 66: this.begin("rel_index"); console.log('begin rel_index'); return 81;
|
888 | break;
|
889 | case 67: this.begin("update_el_style"); console.log('begin update_el_style'); return 82;
|
890 | break;
|
891 | case 68: this.begin("update_rel_style"); console.log('begin update_rel_style'); return 83;
|
892 | break;
|
893 | case 69: this.begin("update_layout_config"); console.log('begin update_layout_config'); return 84;
|
894 | break;
|
895 | case 70:return "EOF_IN_STRUCT";
|
896 | break;
|
897 | case 71: console.log('begin attribute with ATTRIBUTE_EMPTY'); this.begin("attribute"); return "ATTRIBUTE_EMPTY";
|
898 | break;
|
899 | case 72: console.log('begin attribute'); this.begin("attribute");
|
900 | break;
|
901 | case 73: console.log('STOP attribute'); this.popState();console.log('STOP diagram'); this.popState();
|
902 | break;
|
903 | case 74: console.log(',,'); return 90;
|
904 | break;
|
905 | case 75: console.log(',');
|
906 | break;
|
907 | case 76: console.log('ATTRIBUTE_EMPTY'); return 90;
|
908 | break;
|
909 | case 77: console.log('begin string'); this.begin("string");
|
910 | break;
|
911 | case 78: console.log('STOP string'); this.popState();
|
912 | break;
|
913 | case 79: console.log('STR'); return "STR";
|
914 | break;
|
915 | case 80: console.log('begin string_kv'); this.begin("string_kv");
|
916 | break;
|
917 | case 81: console.log('STR_KEY'); this.begin("string_kv_key"); return "STR_KEY";
|
918 | break;
|
919 | case 82: console.log('begin string_kv_value'); this.popState(); this.begin("string_kv_value");
|
920 | break;
|
921 | case 83: console.log('STR_VALUE'); return "STR_VALUE";
|
922 | break;
|
923 | case 84: console.log('STOP string_kv_value'); this.popState(); this.popState();
|
924 | break;
|
925 | case 85: console.log('not STR'); return "STR";
|
926 | break;
|
927 | case 86: console.log('begin boundary block'); return "LBRACE";
|
928 | break;
|
929 | case 87: console.log('STOP boundary block'); return "RBRACE";
|
930 | break;
|
931 | case 88:return 'SPACE';
|
932 | break;
|
933 | case 89:return 'EOL';
|
934 | break;
|
935 | case 90:return 24;
|
936 | break;
|
937 | }
|
938 | },
|
939 | rules: [/^(?:%%\{)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],
|
940 | conditions: {"acc_descr_multiline":{"rules":[16,17],"inclusive":false},"acc_descr":{"rules":[14],"inclusive":false},"acc_title":{"rules":[12],"inclusive":false},"close_directive":{"rules":[],"inclusive":false},"arg_directive":{"rules":[7,8],"inclusive":false},"type_directive":{"rules":[6,7],"inclusive":false},"open_directive":{"rules":[5],"inclusive":false},"string_kv_value":{"rules":[83,84],"inclusive":false},"string_kv_key":{"rules":[82],"inclusive":false},"string_kv":{"rules":[81],"inclusive":false},"string":{"rules":[78,79],"inclusive":false},"attribute":{"rules":[73,74,75,76,77,80,85],"inclusive":false},"update_layout_config":{"rules":[70,71,72,73],"inclusive":false},"update_rel_style":{"rules":[70,71,72,73],"inclusive":false},"update_el_style":{"rules":[70,71,72,73],"inclusive":false},"rel_b":{"rules":[70,71,72,73],"inclusive":false},"rel_r":{"rules":[70,71,72,73],"inclusive":false},"rel_l":{"rules":[70,71,72,73],"inclusive":false},"rel_d":{"rules":[70,71,72,73],"inclusive":false},"rel_u":{"rules":[70,71,72,73],"inclusive":false},"rel_bi":{"rules":[],"inclusive":false},"rel":{"rules":[70,71,72,73],"inclusive":false},"node_r":{"rules":[70,71,72,73],"inclusive":false},"node_l":{"rules":[70,71,72,73],"inclusive":false},"node":{"rules":[70,71,72,73],"inclusive":false},"index":{"rules":[],"inclusive":false},"rel_index":{"rules":[70,71,72,73],"inclusive":false},"component_ext_queue":{"rules":[],"inclusive":false},"component_ext_db":{"rules":[70,71,72,73],"inclusive":false},"component_ext":{"rules":[70,71,72,73],"inclusive":false},"component_queue":{"rules":[70,71,72,73],"inclusive":false},"component_db":{"rules":[70,71,72,73],"inclusive":false},"component":{"rules":[70,71,72,73],"inclusive":false},"container_boundary":{"rules":[70,71,72,73],"inclusive":false},"container_ext_queue":{"rules":[],"inclusive":false},"container_ext_db":{"rules":[70,71,72,73],"inclusive":false},"container_ext":{"rules":[70,71,72,73],"inclusive":false},"container_queue":{"rules":[70,71,72,73],"inclusive":false},"container_db":{"rules":[70,71,72,73],"inclusive":false},"container":{"rules":[70,71,72,73],"inclusive":false},"birel":{"rules":[70,71,72,73],"inclusive":false},"system_boundary":{"rules":[70,71,72,73],"inclusive":false},"enterprise_boundary":{"rules":[70,71,72,73],"inclusive":false},"boundary":{"rules":[70,71,72,73],"inclusive":false},"system_ext_queue":{"rules":[70,71,72,73],"inclusive":false},"system_ext_db":{"rules":[70,71,72,73],"inclusive":false},"system_ext":{"rules":[70,71,72,73],"inclusive":false},"system_queue":{"rules":[70,71,72,73],"inclusive":false},"system_db":{"rules":[70,71,72,73],"inclusive":false},"system":{"rules":[70,71,72,73],"inclusive":false},"person_ext":{"rules":[70,71,72,73],"inclusive":false},"person":{"rules":[70,71,72,73],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,9,10,11,13,15,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,86,87,88,89,90],"inclusive":true}}
|
941 | });
|
942 | return lexer;
|
943 | })();
|
944 | parser.lexer = lexer;
|
945 | function Parser () {
|
946 | this.yy = {};
|
947 | }
|
948 | Parser.prototype = parser;parser.Parser = Parser;
|
949 | return new Parser;
|
950 | })();
|
951 |
|
952 |
|
953 | if (true) {
|
954 | exports.parser = parser;
|
955 | exports.Parser = parser.Parser;
|
956 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
957 | exports.main = function commonjsMain (args) {
|
958 | if (!args[1]) {
|
959 | console.log('Usage: '+args[0]+' FILE');
|
960 | process.exit(1);
|
961 | }
|
962 | var source = (__webpack_require__( "?1da1").readFileSync)((__webpack_require__( "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
|
963 | return exports.parser.parse(source);
|
964 | };
|
965 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
966 | exports.main(process.argv.slice(1));
|
967 | }
|
968 | }
|
969 |
|
970 | }),
|
971 |
|
972 | "./src/diagrams/class/parser/classDiagram.jison":
|
973 |
|
974 |
|
975 |
|
976 | ((module, exports, __webpack_require__) => {
|
977 |
|
978 | module = __webpack_require__.nmd(module);
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 |
|
995 |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 |
|
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 |
|
1048 |
|
1049 |
|
1050 |
|
1051 |
|
1052 | var parser = (function(){
|
1053 | var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,3],$V1=[1,7],$V2=[1,8],$V3=[1,9],$V4=[1,10],$V5=[1,13],$V6=[1,12],$V7=[1,16,25],$V8=[1,20],$V9=[1,31],$Va=[1,32],$Vb=[1,33],$Vc=[1,35],$Vd=[1,38],$Ve=[1,36],$Vf=[1,37],$Vg=[1,39],$Vh=[1,40],$Vi=[1,41],$Vj=[1,42],$Vk=[1,45],$Vl=[1,46],$Vm=[1,47],$Vn=[1,48],$Vo=[16,25],$Vp=[1,62],$Vq=[1,63],$Vr=[1,64],$Vs=[1,65],$Vt=[1,66],$Vu=[1,67],$Vv=[16,25,32,44,45,53,56,57,58,59,60,61,66,68],$Vw=[16,25,30,32,44,45,49,53,56,57,58,59,60,61,66,68,83,84,85,86],$Vx=[5,8,9,10,11,16,19,23,25],$Vy=[53,83,84,85,86],$Vz=[53,60,61,83,84,85,86],$VA=[53,56,57,58,59,83,84,85,86],$VB=[16,25,32],$VC=[1,99];
|
1054 | var parser = {trace: function trace () { },
|
1055 | yy: {},
|
1056 | symbols_: {"error":2,"start":3,"mermaidDoc":4,"statments":5,"direction":6,"directive":7,"direction_tb":8,"direction_bt":9,"direction_rl":10,"direction_lr":11,"graphConfig":12,"openDirective":13,"typeDirective":14,"closeDirective":15,"NEWLINE":16,":":17,"argDirective":18,"open_directive":19,"type_directive":20,"arg_directive":21,"close_directive":22,"CLASS_DIAGRAM":23,"statements":24,"EOF":25,"statement":26,"className":27,"alphaNumToken":28,"classLiteralName":29,"GENERICTYPE":30,"relationStatement":31,"LABEL":32,"classStatement":33,"methodStatement":34,"annotationStatement":35,"clickStatement":36,"cssClassStatement":37,"acc_title":38,"acc_title_value":39,"acc_descr":40,"acc_descr_value":41,"acc_descr_multiline_value":42,"CLASS":43,"STYLE_SEPARATOR":44,"STRUCT_START":45,"members":46,"STRUCT_STOP":47,"ANNOTATION_START":48,"ANNOTATION_END":49,"MEMBER":50,"SEPARATOR":51,"relation":52,"STR":53,"relationType":54,"lineType":55,"AGGREGATION":56,"EXTENSION":57,"COMPOSITION":58,"DEPENDENCY":59,"LINE":60,"DOTTED_LINE":61,"CALLBACK":62,"LINK":63,"LINK_TARGET":64,"CLICK":65,"CALLBACK_NAME":66,"CALLBACK_ARGS":67,"HREF":68,"CSSCLASS":69,"commentToken":70,"textToken":71,"graphCodeTokens":72,"textNoTagsToken":73,"TAGSTART":74,"TAGEND":75,"==":76,"--":77,"PCT":78,"DEFAULT":79,"SPACE":80,"MINUS":81,"keywords":82,"UNICODE_TEXT":83,"NUM":84,"ALPHA":85,"BQUOTE_STR":86,"$accept":0,"$end":1},
|
1057 | terminals_: {2:"error",5:"statments",8:"direction_tb",9:"direction_bt",10:"direction_rl",11:"direction_lr",16:"NEWLINE",17:":",19:"open_directive",20:"type_directive",21:"arg_directive",22:"close_directive",23:"CLASS_DIAGRAM",25:"EOF",30:"GENERICTYPE",32:"LABEL",38:"acc_title",39:"acc_title_value",40:"acc_descr",41:"acc_descr_value",42:"acc_descr_multiline_value",43:"CLASS",44:"STYLE_SEPARATOR",45:"STRUCT_START",47:"STRUCT_STOP",48:"ANNOTATION_START",49:"ANNOTATION_END",50:"MEMBER",51:"SEPARATOR",53:"STR",56:"AGGREGATION",57:"EXTENSION",58:"COMPOSITION",59:"DEPENDENCY",60:"LINE",61:"DOTTED_LINE",62:"CALLBACK",63:"LINK",64:"LINK_TARGET",65:"CLICK",66:"CALLBACK_NAME",67:"CALLBACK_ARGS",68:"HREF",69:"CSSCLASS",72:"graphCodeTokens",74:"TAGSTART",75:"TAGEND",76:"==",77:"--",78:"PCT",79:"DEFAULT",80:"SPACE",81:"MINUS",82:"keywords",83:"UNICODE_TEXT",84:"NUM",85:"ALPHA",86:"BQUOTE_STR"},
|
1058 | productions_: [0,[3,1],[3,1],[3,1],[3,2],[6,1],[6,1],[6,1],[6,1],[4,1],[7,4],[7,6],[13,1],[14,1],[18,1],[15,1],[12,4],[24,1],[24,2],[24,3],[27,1],[27,1],[27,2],[27,2],[27,2],[26,1],[26,2],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,2],[26,2],[26,1],[33,2],[33,4],[33,5],[33,7],[35,4],[46,1],[46,2],[34,1],[34,2],[34,1],[34,1],[31,3],[31,4],[31,4],[31,5],[52,3],[52,2],[52,2],[52,1],[54,1],[54,1],[54,1],[54,1],[55,1],[55,1],[36,3],[36,4],[36,3],[36,4],[36,4],[36,5],[36,3],[36,4],[36,4],[36,5],[36,3],[36,4],[36,4],[36,5],[37,3],[70,1],[70,1],[71,1],[71,1],[71,1],[71,1],[71,1],[71,1],[71,1],[73,1],[73,1],[73,1],[73,1],[28,1],[28,1],[28,1],[29,1]],
|
1059 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
1060 |
|
1061 |
|
1062 | var $0 = $$.length - 1;
|
1063 | switch (yystate) {
|
1064 | case 5:
|
1065 | yy.setDirection('TB');
|
1066 | break;
|
1067 | case 6:
|
1068 | yy.setDirection('BT');
|
1069 | break;
|
1070 | case 7:
|
1071 | yy.setDirection('RL');
|
1072 | break;
|
1073 | case 8:
|
1074 | yy.setDirection('LR');
|
1075 | break;
|
1076 | case 12:
|
1077 | yy.parseDirective('%%{', 'open_directive');
|
1078 | break;
|
1079 | case 13:
|
1080 | yy.parseDirective($$[$0], 'type_directive');
|
1081 | break;
|
1082 | case 14:
|
1083 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
1084 | break;
|
1085 | case 15:
|
1086 | yy.parseDirective('}%%', 'close_directive', 'class');
|
1087 | break;
|
1088 | case 20: case 21:
|
1089 | this.$=$$[$0];
|
1090 | break;
|
1091 | case 22:
|
1092 | this.$=$$[$0-1]+$$[$0];
|
1093 | break;
|
1094 | case 23: case 24:
|
1095 | this.$=$$[$0-1]+'~'+$$[$0];
|
1096 | break;
|
1097 | case 25:
|
1098 | yy.addRelation($$[$0]);
|
1099 | break;
|
1100 | case 26:
|
1101 | $$[$0-1].title = yy.cleanupLabel($$[$0]); yy.addRelation($$[$0-1]);
|
1102 | break;
|
1103 | case 34:
|
1104 | this.$=$$[$0].trim();yy.setAccTitle(this.$);
|
1105 | break;
|
1106 | case 35: case 36:
|
1107 | this.$=$$[$0].trim();yy.setAccDescription(this.$);
|
1108 | break;
|
1109 | case 37:
|
1110 | yy.addClass($$[$0]);
|
1111 | break;
|
1112 | case 38:
|
1113 | yy.addClass($$[$0-2]);yy.setCssClass($$[$0-2], $$[$0]);
|
1114 | break;
|
1115 | case 39:
|
1116 | yy.addClass($$[$0-3]);yy.addMembers($$[$0-3],$$[$0-1]);
|
1117 | break;
|
1118 | case 40:
|
1119 | yy.addClass($$[$0-5]);yy.setCssClass($$[$0-5], $$[$0-3]);yy.addMembers($$[$0-5],$$[$0-1]);
|
1120 | break;
|
1121 | case 41:
|
1122 | yy.addAnnotation($$[$0],$$[$0-2]);
|
1123 | break;
|
1124 | case 42:
|
1125 | this.$ = [$$[$0]];
|
1126 | break;
|
1127 | case 43:
|
1128 | $$[$0].push($$[$0-1]);this.$=$$[$0];
|
1129 | break;
|
1130 | case 44:
|
1131 |
|
1132 | break;
|
1133 | case 45:
|
1134 | yy.addMember($$[$0-1],yy.cleanupLabel($$[$0]));
|
1135 | break;
|
1136 | case 46:
|
1137 |
|
1138 | break;
|
1139 | case 47:
|
1140 |
|
1141 | break;
|
1142 | case 48:
|
1143 | this.$ = {'id1':$$[$0-2],'id2':$$[$0], relation:$$[$0-1], relationTitle1:'none', relationTitle2:'none'};
|
1144 | break;
|
1145 | case 49:
|
1146 | this.$ = {id1:$$[$0-3], id2:$$[$0], relation:$$[$0-1], relationTitle1:$$[$0-2], relationTitle2:'none'}
|
1147 | break;
|
1148 | case 50:
|
1149 | this.$ = {id1:$$[$0-3], id2:$$[$0], relation:$$[$0-2], relationTitle1:'none', relationTitle2:$$[$0-1]};
|
1150 | break;
|
1151 | case 51:
|
1152 | this.$ = {id1:$$[$0-4], id2:$$[$0], relation:$$[$0-2], relationTitle1:$$[$0-3], relationTitle2:$$[$0-1]}
|
1153 | break;
|
1154 | case 52:
|
1155 | this.$={type1:$$[$0-2],type2:$$[$0],lineType:$$[$0-1]};
|
1156 | break;
|
1157 | case 53:
|
1158 | this.$={type1:'none',type2:$$[$0],lineType:$$[$0-1]};
|
1159 | break;
|
1160 | case 54:
|
1161 | this.$={type1:$$[$0-1],type2:'none',lineType:$$[$0]};
|
1162 | break;
|
1163 | case 55:
|
1164 | this.$={type1:'none',type2:'none',lineType:$$[$0]};
|
1165 | break;
|
1166 | case 56:
|
1167 | this.$=yy.relationType.AGGREGATION;
|
1168 | break;
|
1169 | case 57:
|
1170 | this.$=yy.relationType.EXTENSION;
|
1171 | break;
|
1172 | case 58:
|
1173 | this.$=yy.relationType.COMPOSITION;
|
1174 | break;
|
1175 | case 59:
|
1176 | this.$=yy.relationType.DEPENDENCY;
|
1177 | break;
|
1178 | case 60:
|
1179 | this.$=yy.lineType.LINE;
|
1180 | break;
|
1181 | case 61:
|
1182 | this.$=yy.lineType.DOTTED_LINE;
|
1183 | break;
|
1184 | case 62: case 68:
|
1185 | this.$ = $$[$0-2];yy.setClickEvent($$[$0-1], $$[$0]);
|
1186 | break;
|
1187 | case 63: case 69:
|
1188 | this.$ = $$[$0-3];yy.setClickEvent($$[$0-2], $$[$0-1]);yy.setTooltip($$[$0-2], $$[$0]);
|
1189 | break;
|
1190 | case 64: case 72:
|
1191 | this.$ = $$[$0-2];yy.setLink($$[$0-1], $$[$0]);
|
1192 | break;
|
1193 | case 65:
|
1194 | this.$ = $$[$0-3];yy.setLink($$[$0-2], $$[$0-1],$$[$0]);
|
1195 | break;
|
1196 | case 66: case 74:
|
1197 | this.$ = $$[$0-3];yy.setLink($$[$0-2], $$[$0-1]);yy.setTooltip($$[$0-2], $$[$0]);
|
1198 | break;
|
1199 | case 67: case 75:
|
1200 | this.$ = $$[$0-4];yy.setLink($$[$0-3], $$[$0-2], $$[$0]);yy.setTooltip($$[$0-3], $$[$0-1]);
|
1201 | break;
|
1202 | case 70:
|
1203 | this.$ = $$[$0-3];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]);
|
1204 | break;
|
1205 | case 71:
|
1206 | this.$ = $$[$0-4];yy.setClickEvent($$[$0-3], $$[$0-2], $$[$0-1]);yy.setTooltip($$[$0-3], $$[$0]);
|
1207 | break;
|
1208 | case 73:
|
1209 | this.$ = $$[$0-3];yy.setLink($$[$0-2], $$[$0-1], $$[$0]);
|
1210 | break;
|
1211 | case 76:
|
1212 | yy.setCssClass($$[$0-1], $$[$0]);
|
1213 | break;
|
1214 | }
|
1215 | },
|
1216 | table: [{3:1,4:2,5:$V0,6:4,7:5,8:$V1,9:$V2,10:$V3,11:$V4,12:6,13:11,19:$V5,23:$V6},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{3:14,4:2,5:$V0,6:4,7:5,8:$V1,9:$V2,10:$V3,11:$V4,12:6,13:11,19:$V5,23:$V6},{1:[2,9]},o($V7,[2,5]),o($V7,[2,6]),o($V7,[2,7]),o($V7,[2,8]),{14:15,20:[1,16]},{16:[1,17]},{20:[2,12]},{1:[2,4]},{15:18,17:[1,19],22:$V8},o([17,22],[2,13]),{6:30,7:29,8:$V1,9:$V2,10:$V3,11:$V4,13:11,19:$V5,24:21,26:22,27:34,28:43,29:44,31:23,33:24,34:25,35:26,36:27,37:28,38:$V9,40:$Va,42:$Vb,43:$Vc,48:$Vd,50:$Ve,51:$Vf,62:$Vg,63:$Vh,65:$Vi,69:$Vj,83:$Vk,84:$Vl,85:$Vm,86:$Vn},{16:[1,49]},{18:50,21:[1,51]},{16:[2,15]},{25:[1,52]},{16:[1,53],25:[2,17]},o($Vo,[2,25],{32:[1,54]}),o($Vo,[2,27]),o($Vo,[2,28]),o($Vo,[2,29]),o($Vo,[2,30]),o($Vo,[2,31]),o($Vo,[2,32]),o($Vo,[2,33]),{39:[1,55]},{41:[1,56]},o($Vo,[2,36]),o($Vo,[2,44],{52:57,54:60,55:61,32:[1,59],53:[1,58],56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu}),{27:68,28:43,29:44,83:$Vk,84:$Vl,85:$Vm,86:$Vn},o($Vo,[2,46]),o($Vo,[2,47]),{28:69,83:$Vk,84:$Vl,85:$Vm},{27:70,28:43,29:44,83:$Vk,84:$Vl,85:$Vm,86:$Vn},{27:71,28:43,29:44,83:$Vk,84:$Vl,85:$Vm,86:$Vn},{27:72,28:43,29:44,83:$Vk,84:$Vl,85:$Vm,86:$Vn},{53:[1,73]},o($Vv,[2,20],{28:43,29:44,27:74,30:[1,75],83:$Vk,84:$Vl,85:$Vm,86:$Vn}),o($Vv,[2,21],{30:[1,76]}),o($Vw,[2,90]),o($Vw,[2,91]),o($Vw,[2,92]),o([16,25,30,32,44,45,53,56,57,58,59,60,61,66,68],[2,93]),o($Vx,[2,10]),{15:77,22:$V8},{22:[2,14]},{1:[2,16]},{6:30,7:29,8:$V1,9:$V2,10:$V3,11:$V4,13:11,19:$V5,24:78,25:[2,18],26:22,27:34,28:43,29:44,31:23,33:24,34:25,35:26,36:27,37:28,38:$V9,40:$Va,42:$Vb,43:$Vc,48:$Vd,50:$Ve,51:$Vf,62:$Vg,63:$Vh,65:$Vi,69:$Vj,83:$Vk,84:$Vl,85:$Vm,86:$Vn},o($Vo,[2,26]),o($Vo,[2,34]),o($Vo,[2,35]),{27:79,28:43,29:44,53:[1,80],83:$Vk,84:$Vl,85:$Vm,86:$Vn},{52:81,54:60,55:61,56:$Vp,57:$Vq,58:$Vr,59:$Vs,60:$Vt,61:$Vu},o($Vo,[2,45]),{55:82,60:$Vt,61:$Vu},o($Vy,[2,55],{54:83,56:$Vp,57:$Vq,58:$Vr,59:$Vs}),o($Vz,[2,56]),o($Vz,[2,57]),o($Vz,[2,58]),o($Vz,[2,59]),o($VA,[2,60]),o($VA,[2,61]),o($Vo,[2,37],{44:[1,84],45:[1,85]}),{49:[1,86]},{53:[1,87]},{53:[1,88]},{66:[1,89],68:[1,90]},{28:91,83:$Vk,84:$Vl,85:$Vm},o($Vv,[2,22]),o($Vv,[2,23]),o($Vv,[2,24]),{16:[1,92]},{25:[2,19]},o($VB,[2,48]),{27:93,28:43,29:44,83:$Vk,84:$Vl,85:$Vm,86:$Vn},{27:94,28:43,29:44,53:[1,95],83:$Vk,84:$Vl,85:$Vm,86:$Vn},o($Vy,[2,54],{54:96,56:$Vp,57:$Vq,58:$Vr,59:$Vs}),o($Vy,[2,53]),{28:97,83:$Vk,84:$Vl,85:$Vm},{46:98,50:$VC},{27:100,28:43,29:44,83:$Vk,84:$Vl,85:$Vm,86:$Vn},o($Vo,[2,62],{53:[1,101]}),o($Vo,[2,64],{53:[1,103],64:[1,102]}),o($Vo,[2,68],{53:[1,104],67:[1,105]}),o($Vo,[2,72],{53:[1,107],64:[1,106]}),o($Vo,[2,76]),o($Vx,[2,11]),o($VB,[2,50]),o($VB,[2,49]),{27:108,28:43,29:44,83:$Vk,84:$Vl,85:$Vm,86:$Vn},o($Vy,[2,52]),o($Vo,[2,38],{45:[1,109]}),{47:[1,110]},{46:111,47:[2,42],50:$VC},o($Vo,[2,41]),o($Vo,[2,63]),o($Vo,[2,65]),o($Vo,[2,66],{64:[1,112]}),o($Vo,[2,69]),o($Vo,[2,70],{53:[1,113]}),o($Vo,[2,73]),o($Vo,[2,74],{64:[1,114]}),o($VB,[2,51]),{46:115,50:$VC},o($Vo,[2,39]),{47:[2,43]},o($Vo,[2,67]),o($Vo,[2,71]),o($Vo,[2,75]),{47:[1,116]},o($Vo,[2,40])],
|
1217 | defaultActions: {2:[2,1],3:[2,2],4:[2,3],6:[2,9],13:[2,12],14:[2,4],20:[2,15],51:[2,14],52:[2,16],78:[2,19],111:[2,43]},
|
1218 | parseError: function parseError (str, hash) {
|
1219 | if (hash.recoverable) {
|
1220 | this.trace(str);
|
1221 | } else {
|
1222 | var error = new Error(str);
|
1223 | error.hash = hash;
|
1224 | throw error;
|
1225 | }
|
1226 | },
|
1227 | parse: function parse(input) {
|
1228 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
1229 | var args = lstack.slice.call(arguments, 1);
|
1230 | var lexer = Object.create(this.lexer);
|
1231 | var sharedState = { yy: {} };
|
1232 | for (var k in this.yy) {
|
1233 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
1234 | sharedState.yy[k] = this.yy[k];
|
1235 | }
|
1236 | }
|
1237 | lexer.setInput(input, sharedState.yy);
|
1238 | sharedState.yy.lexer = lexer;
|
1239 | sharedState.yy.parser = this;
|
1240 | if (typeof lexer.yylloc == 'undefined') {
|
1241 | lexer.yylloc = {};
|
1242 | }
|
1243 | var yyloc = lexer.yylloc;
|
1244 | lstack.push(yyloc);
|
1245 | var ranges = lexer.options && lexer.options.ranges;
|
1246 | if (typeof sharedState.yy.parseError === 'function') {
|
1247 | this.parseError = sharedState.yy.parseError;
|
1248 | } else {
|
1249 | this.parseError = Object.getPrototypeOf(this).parseError;
|
1250 | }
|
1251 | function popStack(n) {
|
1252 | stack.length = stack.length - 2 * n;
|
1253 | vstack.length = vstack.length - n;
|
1254 | lstack.length = lstack.length - n;
|
1255 | }
|
1256 | function lex() {
|
1257 | var token;
|
1258 | token = tstack.pop() || lexer.lex() || EOF;
|
1259 | if (typeof token !== 'number') {
|
1260 | if (token instanceof Array) {
|
1261 | tstack = token;
|
1262 | token = tstack.pop();
|
1263 | }
|
1264 | token = self.symbols_[token] || token;
|
1265 | }
|
1266 | return token;
|
1267 | }
|
1268 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
1269 | while (true) {
|
1270 | state = stack[stack.length - 1];
|
1271 | if (this.defaultActions[state]) {
|
1272 | action = this.defaultActions[state];
|
1273 | } else {
|
1274 | if (symbol === null || typeof symbol == 'undefined') {
|
1275 | symbol = lex();
|
1276 | }
|
1277 | action = table[state] && table[state][symbol];
|
1278 | }
|
1279 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
1280 | var errStr = '';
|
1281 | expected = [];
|
1282 | for (p in table[state]) {
|
1283 | if (this.terminals_[p] && p > TERROR) {
|
1284 | expected.push('\'' + this.terminals_[p] + '\'');
|
1285 | }
|
1286 | }
|
1287 | if (lexer.showPosition) {
|
1288 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
1289 | } else {
|
1290 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
1291 | }
|
1292 | this.parseError(errStr, {
|
1293 | text: lexer.match,
|
1294 | token: this.terminals_[symbol] || symbol,
|
1295 | line: lexer.yylineno,
|
1296 | loc: yyloc,
|
1297 | expected: expected
|
1298 | });
|
1299 | }
|
1300 | if (action[0] instanceof Array && action.length > 1) {
|
1301 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
1302 | }
|
1303 | switch (action[0]) {
|
1304 | case 1:
|
1305 | stack.push(symbol);
|
1306 | vstack.push(lexer.yytext);
|
1307 | lstack.push(lexer.yylloc);
|
1308 | stack.push(action[1]);
|
1309 | symbol = null;
|
1310 | if (!preErrorSymbol) {
|
1311 | yyleng = lexer.yyleng;
|
1312 | yytext = lexer.yytext;
|
1313 | yylineno = lexer.yylineno;
|
1314 | yyloc = lexer.yylloc;
|
1315 | if (recovering > 0) {
|
1316 | recovering--;
|
1317 | }
|
1318 | } else {
|
1319 | symbol = preErrorSymbol;
|
1320 | preErrorSymbol = null;
|
1321 | }
|
1322 | break;
|
1323 | case 2:
|
1324 | len = this.productions_[action[1]][1];
|
1325 | yyval.$ = vstack[vstack.length - len];
|
1326 | yyval._$ = {
|
1327 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
1328 | last_line: lstack[lstack.length - 1].last_line,
|
1329 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
1330 | last_column: lstack[lstack.length - 1].last_column
|
1331 | };
|
1332 | if (ranges) {
|
1333 | yyval._$.range = [
|
1334 | lstack[lstack.length - (len || 1)].range[0],
|
1335 | lstack[lstack.length - 1].range[1]
|
1336 | ];
|
1337 | }
|
1338 | r = this.performAction.apply(yyval, [
|
1339 | yytext,
|
1340 | yyleng,
|
1341 | yylineno,
|
1342 | sharedState.yy,
|
1343 | action[1],
|
1344 | vstack,
|
1345 | lstack
|
1346 | ].concat(args));
|
1347 | if (typeof r !== 'undefined') {
|
1348 | return r;
|
1349 | }
|
1350 | if (len) {
|
1351 | stack = stack.slice(0, -1 * len * 2);
|
1352 | vstack = vstack.slice(0, -1 * len);
|
1353 | lstack = lstack.slice(0, -1 * len);
|
1354 | }
|
1355 | stack.push(this.productions_[action[1]][0]);
|
1356 | vstack.push(yyval.$);
|
1357 | lstack.push(yyval._$);
|
1358 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
1359 | stack.push(newState);
|
1360 | break;
|
1361 | case 3:
|
1362 | return true;
|
1363 | }
|
1364 | }
|
1365 | return true;
|
1366 | }};
|
1367 |
|
1368 |
|
1369 | var lexer = (function(){
|
1370 | var lexer = ({
|
1371 |
|
1372 | EOF:1,
|
1373 |
|
1374 | parseError:function parseError(str, hash) {
|
1375 | if (this.yy.parser) {
|
1376 | this.yy.parser.parseError(str, hash);
|
1377 | } else {
|
1378 | throw new Error(str);
|
1379 | }
|
1380 | },
|
1381 |
|
1382 |
|
1383 | setInput:function (input, yy) {
|
1384 | this.yy = yy || this.yy || {};
|
1385 | this._input = input;
|
1386 | this._more = this._backtrack = this.done = false;
|
1387 | this.yylineno = this.yyleng = 0;
|
1388 | this.yytext = this.matched = this.match = '';
|
1389 | this.conditionStack = ['INITIAL'];
|
1390 | this.yylloc = {
|
1391 | first_line: 1,
|
1392 | first_column: 0,
|
1393 | last_line: 1,
|
1394 | last_column: 0
|
1395 | };
|
1396 | if (this.options.ranges) {
|
1397 | this.yylloc.range = [0,0];
|
1398 | }
|
1399 | this.offset = 0;
|
1400 | return this;
|
1401 | },
|
1402 |
|
1403 |
|
1404 | input:function () {
|
1405 | var ch = this._input[0];
|
1406 | this.yytext += ch;
|
1407 | this.yyleng++;
|
1408 | this.offset++;
|
1409 | this.match += ch;
|
1410 | this.matched += ch;
|
1411 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
1412 | if (lines) {
|
1413 | this.yylineno++;
|
1414 | this.yylloc.last_line++;
|
1415 | } else {
|
1416 | this.yylloc.last_column++;
|
1417 | }
|
1418 | if (this.options.ranges) {
|
1419 | this.yylloc.range[1]++;
|
1420 | }
|
1421 |
|
1422 | this._input = this._input.slice(1);
|
1423 | return ch;
|
1424 | },
|
1425 |
|
1426 |
|
1427 | unput:function (ch) {
|
1428 | var len = ch.length;
|
1429 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
1430 |
|
1431 | this._input = ch + this._input;
|
1432 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
1433 |
|
1434 | this.offset -= len;
|
1435 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
1436 | this.match = this.match.substr(0, this.match.length - 1);
|
1437 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
1438 |
|
1439 | if (lines.length - 1) {
|
1440 | this.yylineno -= lines.length - 1;
|
1441 | }
|
1442 | var r = this.yylloc.range;
|
1443 |
|
1444 | this.yylloc = {
|
1445 | first_line: this.yylloc.first_line,
|
1446 | last_line: this.yylineno + 1,
|
1447 | first_column: this.yylloc.first_column,
|
1448 | last_column: lines ?
|
1449 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
1450 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
1451 | this.yylloc.first_column - len
|
1452 | };
|
1453 |
|
1454 | if (this.options.ranges) {
|
1455 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
1456 | }
|
1457 | this.yyleng = this.yytext.length;
|
1458 | return this;
|
1459 | },
|
1460 |
|
1461 |
|
1462 | more:function () {
|
1463 | this._more = true;
|
1464 | return this;
|
1465 | },
|
1466 |
|
1467 |
|
1468 | reject:function () {
|
1469 | if (this.options.backtrack_lexer) {
|
1470 | this._backtrack = true;
|
1471 | } else {
|
1472 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
|
1473 | text: "",
|
1474 | token: null,
|
1475 | line: this.yylineno
|
1476 | });
|
1477 |
|
1478 | }
|
1479 | return this;
|
1480 | },
|
1481 |
|
1482 |
|
1483 | less:function (n) {
|
1484 | this.unput(this.match.slice(n));
|
1485 | },
|
1486 |
|
1487 |
|
1488 | pastInput:function () {
|
1489 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
1490 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
1491 | },
|
1492 |
|
1493 |
|
1494 | upcomingInput:function () {
|
1495 | var next = this.match;
|
1496 | if (next.length < 20) {
|
1497 | next += this._input.substr(0, 20-next.length);
|
1498 | }
|
1499 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
1500 | },
|
1501 |
|
1502 |
|
1503 | showPosition:function () {
|
1504 | var pre = this.pastInput();
|
1505 | var c = new Array(pre.length + 1).join("-");
|
1506 | return pre + this.upcomingInput() + "\n" + c + "^";
|
1507 | },
|
1508 |
|
1509 |
|
1510 | test_match:function(match, indexed_rule) {
|
1511 | var token,
|
1512 | lines,
|
1513 | backup;
|
1514 |
|
1515 | if (this.options.backtrack_lexer) {
|
1516 |
|
1517 | backup = {
|
1518 | yylineno: this.yylineno,
|
1519 | yylloc: {
|
1520 | first_line: this.yylloc.first_line,
|
1521 | last_line: this.last_line,
|
1522 | first_column: this.yylloc.first_column,
|
1523 | last_column: this.yylloc.last_column
|
1524 | },
|
1525 | yytext: this.yytext,
|
1526 | match: this.match,
|
1527 | matches: this.matches,
|
1528 | matched: this.matched,
|
1529 | yyleng: this.yyleng,
|
1530 | offset: this.offset,
|
1531 | _more: this._more,
|
1532 | _input: this._input,
|
1533 | yy: this.yy,
|
1534 | conditionStack: this.conditionStack.slice(0),
|
1535 | done: this.done
|
1536 | };
|
1537 | if (this.options.ranges) {
|
1538 | backup.yylloc.range = this.yylloc.range.slice(0);
|
1539 | }
|
1540 | }
|
1541 |
|
1542 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
1543 | if (lines) {
|
1544 | this.yylineno += lines.length;
|
1545 | }
|
1546 | this.yylloc = {
|
1547 | first_line: this.yylloc.last_line,
|
1548 | last_line: this.yylineno + 1,
|
1549 | first_column: this.yylloc.last_column,
|
1550 | last_column: lines ?
|
1551 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
1552 | this.yylloc.last_column + match[0].length
|
1553 | };
|
1554 | this.yytext += match[0];
|
1555 | this.match += match[0];
|
1556 | this.matches = match;
|
1557 | this.yyleng = this.yytext.length;
|
1558 | if (this.options.ranges) {
|
1559 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
1560 | }
|
1561 | this._more = false;
|
1562 | this._backtrack = false;
|
1563 | this._input = this._input.slice(match[0].length);
|
1564 | this.matched += match[0];
|
1565 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
1566 | if (this.done && this._input) {
|
1567 | this.done = false;
|
1568 | }
|
1569 | if (token) {
|
1570 | return token;
|
1571 | } else if (this._backtrack) {
|
1572 |
|
1573 | for (var k in backup) {
|
1574 | this[k] = backup[k];
|
1575 | }
|
1576 | return false;
|
1577 | }
|
1578 | return false;
|
1579 | },
|
1580 |
|
1581 |
|
1582 | next:function () {
|
1583 | if (this.done) {
|
1584 | return this.EOF;
|
1585 | }
|
1586 | if (!this._input) {
|
1587 | this.done = true;
|
1588 | }
|
1589 |
|
1590 | var token,
|
1591 | match,
|
1592 | tempMatch,
|
1593 | index;
|
1594 | if (!this._more) {
|
1595 | this.yytext = '';
|
1596 | this.match = '';
|
1597 | }
|
1598 | var rules = this._currentRules();
|
1599 | for (var i = 0; i < rules.length; i++) {
|
1600 | tempMatch = this._input.match(this.rules[rules[i]]);
|
1601 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
1602 | match = tempMatch;
|
1603 | index = i;
|
1604 | if (this.options.backtrack_lexer) {
|
1605 | token = this.test_match(tempMatch, rules[i]);
|
1606 | if (token !== false) {
|
1607 | return token;
|
1608 | } else if (this._backtrack) {
|
1609 | match = false;
|
1610 | continue;
|
1611 | } else {
|
1612 |
|
1613 | return false;
|
1614 | }
|
1615 | } else if (!this.options.flex) {
|
1616 | break;
|
1617 | }
|
1618 | }
|
1619 | }
|
1620 | if (match) {
|
1621 | token = this.test_match(match, rules[index]);
|
1622 | if (token !== false) {
|
1623 | return token;
|
1624 | }
|
1625 |
|
1626 | return false;
|
1627 | }
|
1628 | if (this._input === "") {
|
1629 | return this.EOF;
|
1630 | } else {
|
1631 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
1632 | text: "",
|
1633 | token: null,
|
1634 | line: this.yylineno
|
1635 | });
|
1636 | }
|
1637 | },
|
1638 |
|
1639 |
|
1640 | lex:function lex () {
|
1641 | var r = this.next();
|
1642 | if (r) {
|
1643 | return r;
|
1644 | } else {
|
1645 | return this.lex();
|
1646 | }
|
1647 | },
|
1648 |
|
1649 |
|
1650 | begin:function begin (condition) {
|
1651 | this.conditionStack.push(condition);
|
1652 | },
|
1653 |
|
1654 |
|
1655 | popState:function popState () {
|
1656 | var n = this.conditionStack.length - 1;
|
1657 | if (n > 0) {
|
1658 | return this.conditionStack.pop();
|
1659 | } else {
|
1660 | return this.conditionStack[0];
|
1661 | }
|
1662 | },
|
1663 |
|
1664 |
|
1665 | _currentRules:function _currentRules () {
|
1666 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
1667 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
1668 | } else {
|
1669 | return this.conditions["INITIAL"].rules;
|
1670 | }
|
1671 | },
|
1672 |
|
1673 |
|
1674 | topState:function topState (n) {
|
1675 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
1676 | if (n >= 0) {
|
1677 | return this.conditionStack[n];
|
1678 | } else {
|
1679 | return "INITIAL";
|
1680 | }
|
1681 | },
|
1682 |
|
1683 |
|
1684 | pushState:function pushState (condition) {
|
1685 | this.begin(condition);
|
1686 | },
|
1687 |
|
1688 |
|
1689 | stateStackSize:function stateStackSize() {
|
1690 | return this.conditionStack.length;
|
1691 | },
|
1692 | options: {},
|
1693 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
1694 | var YYSTATE=YY_START;
|
1695 | switch($avoiding_name_collisions) {
|
1696 | case 0: this.begin('open_directive'); return 19;
|
1697 | break;
|
1698 | case 1:return 8;
|
1699 | break;
|
1700 | case 2:return 9;
|
1701 | break;
|
1702 | case 3:return 10;
|
1703 | break;
|
1704 | case 4:return 11;
|
1705 | break;
|
1706 | case 5: this.begin('type_directive'); return 20;
|
1707 | break;
|
1708 | case 6: this.popState(); this.begin('arg_directive'); return 17;
|
1709 | break;
|
1710 | case 7: this.popState(); this.popState(); return 22;
|
1711 | break;
|
1712 | case 8:return 21;
|
1713 | break;
|
1714 | case 9:
|
1715 | break;
|
1716 | case 10:
|
1717 | break;
|
1718 | case 11: this.begin("acc_title");return 38;
|
1719 | break;
|
1720 | case 12: this.popState(); return "acc_title_value";
|
1721 | break;
|
1722 | case 13: this.begin("acc_descr");return 40;
|
1723 | break;
|
1724 | case 14: this.popState(); return "acc_descr_value";
|
1725 | break;
|
1726 | case 15: this.begin("acc_descr_multiline");
|
1727 | break;
|
1728 | case 16: this.popState();
|
1729 | break;
|
1730 | case 17:return "acc_descr_multiline_value";
|
1731 | break;
|
1732 | case 18:return 16;
|
1733 | break;
|
1734 | case 19:
|
1735 | break;
|
1736 | case 20:return 23;
|
1737 | break;
|
1738 | case 21:return 23;
|
1739 | break;
|
1740 | case 22: this.begin("struct"); return 45;
|
1741 | break;
|
1742 | case 23:return "EOF_IN_STRUCT";
|
1743 | break;
|
1744 | case 24:return "OPEN_IN_STRUCT";
|
1745 | break;
|
1746 | case 25: this.popState(); return 47;
|
1747 | break;
|
1748 | case 26:
|
1749 | break;
|
1750 | case 27: return "MEMBER";
|
1751 | break;
|
1752 | case 28:return 43;
|
1753 | break;
|
1754 | case 29:return 69;
|
1755 | break;
|
1756 | case 30:return 62;
|
1757 | break;
|
1758 | case 31:return 63;
|
1759 | break;
|
1760 | case 32:return 65;
|
1761 | break;
|
1762 | case 33:return 48;
|
1763 | break;
|
1764 | case 34:return 49;
|
1765 | break;
|
1766 | case 35:this.begin("generic");
|
1767 | break;
|
1768 | case 36:this.popState();
|
1769 | break;
|
1770 | case 37:return "GENERICTYPE";
|
1771 | break;
|
1772 | case 38:this.begin("string");
|
1773 | break;
|
1774 | case 39:this.popState();
|
1775 | break;
|
1776 | case 40:return "STR";
|
1777 | break;
|
1778 | case 41:this.begin("bqstring");
|
1779 | break;
|
1780 | case 42:this.popState();
|
1781 | break;
|
1782 | case 43:return "BQUOTE_STR";
|
1783 | break;
|
1784 | case 44:this.begin("href");
|
1785 | break;
|
1786 | case 45:this.popState();
|
1787 | break;
|
1788 | case 46:return 68;
|
1789 | break;
|
1790 | case 47:this.begin("callback_name");
|
1791 | break;
|
1792 | case 48:this.popState();
|
1793 | break;
|
1794 | case 49:this.popState(); this.begin("callback_args");
|
1795 | break;
|
1796 | case 50:return 66;
|
1797 | break;
|
1798 | case 51:this.popState();
|
1799 | break;
|
1800 | case 52:return 67;
|
1801 | break;
|
1802 | case 53:return 64;
|
1803 | break;
|
1804 | case 54:return 64;
|
1805 | break;
|
1806 | case 55:return 64;
|
1807 | break;
|
1808 | case 56:return 64;
|
1809 | break;
|
1810 | case 57:return 57;
|
1811 | break;
|
1812 | case 58:return 57;
|
1813 | break;
|
1814 | case 59:return 59;
|
1815 | break;
|
1816 | case 60:return 59;
|
1817 | break;
|
1818 | case 61:return 58;
|
1819 | break;
|
1820 | case 62:return 56;
|
1821 | break;
|
1822 | case 63:return 60;
|
1823 | break;
|
1824 | case 64:return 61;
|
1825 | break;
|
1826 | case 65:return 32;
|
1827 | break;
|
1828 | case 66:return 44;
|
1829 | break;
|
1830 | case 67:return 81;
|
1831 | break;
|
1832 | case 68:return 'DOT';
|
1833 | break;
|
1834 | case 69:return 'PLUS';
|
1835 | break;
|
1836 | case 70:return 78;
|
1837 | break;
|
1838 | case 71:return 'EQUALS';
|
1839 | break;
|
1840 | case 72:return 'EQUALS';
|
1841 | break;
|
1842 | case 73:return 85;
|
1843 | break;
|
1844 | case 74:return 'PUNCTUATION';
|
1845 | break;
|
1846 | case 75:return 84;
|
1847 | break;
|
1848 | case 76:return 83;
|
1849 | break;
|
1850 | case 77:return 80;
|
1851 | break;
|
1852 | case 78:return 25;
|
1853 | break;
|
1854 | }
|
1855 | },
|
1856 | rules: [/^(?:%%\{)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:[{])/,/^(?:$)/,/^(?:[{])/,/^(?:[}])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:class\b)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:[~])/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[`])/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:href[\s]+["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:$)/],
|
1857 | conditions: {"acc_descr_multiline":{"rules":[16,17],"inclusive":false},"acc_descr":{"rules":[14],"inclusive":false},"acc_title":{"rules":[12],"inclusive":false},"arg_directive":{"rules":[7,8],"inclusive":false},"type_directive":{"rules":[6,7],"inclusive":false},"open_directive":{"rules":[5],"inclusive":false},"callback_args":{"rules":[51,52],"inclusive":false},"callback_name":{"rules":[48,49,50],"inclusive":false},"href":{"rules":[45,46],"inclusive":false},"struct":{"rules":[23,24,25,26,27],"inclusive":false},"generic":{"rules":[36,37],"inclusive":false},"bqstring":{"rules":[42,43],"inclusive":false},"string":{"rules":[39,40],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,9,10,11,13,15,18,19,20,21,22,28,29,30,31,32,33,34,35,38,41,44,47,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78],"inclusive":true}}
|
1858 | });
|
1859 | return lexer;
|
1860 | })();
|
1861 | parser.lexer = lexer;
|
1862 | function Parser () {
|
1863 | this.yy = {};
|
1864 | }
|
1865 | Parser.prototype = parser;parser.Parser = Parser;
|
1866 | return new Parser;
|
1867 | })();
|
1868 |
|
1869 |
|
1870 | if (true) {
|
1871 | exports.parser = parser;
|
1872 | exports.Parser = parser.Parser;
|
1873 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
1874 | exports.main = function commonjsMain (args) {
|
1875 | if (!args[1]) {
|
1876 | console.log('Usage: '+args[0]+' FILE');
|
1877 | process.exit(1);
|
1878 | }
|
1879 | var source = (__webpack_require__( "?35ed").readFileSync)((__webpack_require__( "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
|
1880 | return exports.parser.parse(source);
|
1881 | };
|
1882 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
1883 | exports.main(process.argv.slice(1));
|
1884 | }
|
1885 | }
|
1886 |
|
1887 | }),
|
1888 |
|
1889 | "./src/diagrams/er/parser/erDiagram.jison":
|
1890 |
|
1891 |
|
1892 |
|
1893 | ((module, exports, __webpack_require__) => {
|
1894 |
|
1895 | module = __webpack_require__.nmd(module);
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 |
|
1946 |
|
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 |
|
1952 |
|
1953 |
|
1954 |
|
1955 |
|
1956 |
|
1957 |
|
1958 |
|
1959 |
|
1960 |
|
1961 |
|
1962 |
|
1963 |
|
1964 |
|
1965 |
|
1966 |
|
1967 |
|
1968 |
|
1969 | var parser = (function(){
|
1970 | var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,2],$V1=[1,5],$V2=[6,9,11,23,25,27,29,30,49],$V3=[1,17],$V4=[1,18],$V5=[1,19],$V6=[1,20],$V7=[1,21],$V8=[1,24],$V9=[1,29],$Va=[1,30],$Vb=[1,31],$Vc=[1,32],$Vd=[6,9,11,15,20,23,25,27,29,30,42,43,44,45,49],$Ve=[1,45],$Vf=[30,46,47],$Vg=[4,6,9,11,23,25,27,29,30,49],$Vh=[42,43,44,45],$Vi=[22,37],$Vj=[1,64];
|
1971 | var parser = {trace: function trace () { },
|
1972 | yy: {},
|
1973 | symbols_: {"error":2,"start":3,"ER_DIAGRAM":4,"document":5,"EOF":6,"directive":7,"line":8,"SPACE":9,"statement":10,"NEWLINE":11,"openDirective":12,"typeDirective":13,"closeDirective":14,":":15,"argDirective":16,"entityName":17,"relSpec":18,"role":19,"BLOCK_START":20,"attributes":21,"BLOCK_STOP":22,"title":23,"title_value":24,"acc_title":25,"acc_title_value":26,"acc_descr":27,"acc_descr_value":28,"acc_descr_multiline_value":29,"ALPHANUM":30,".":31,"attribute":32,"attributeType":33,"attributeName":34,"attributeKeyType":35,"attributeComment":36,"ATTRIBUTE_WORD":37,"ATTRIBUTE_KEY":38,"COMMENT":39,"cardinality":40,"relType":41,"ZERO_OR_ONE":42,"ZERO_OR_MORE":43,"ONE_OR_MORE":44,"ONLY_ONE":45,"NON_IDENTIFYING":46,"IDENTIFYING":47,"WORD":48,"open_directive":49,"type_directive":50,"arg_directive":51,"close_directive":52,"$accept":0,"$end":1},
|
1974 | terminals_: {2:"error",4:"ER_DIAGRAM",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",20:"BLOCK_START",22:"BLOCK_STOP",23:"title",24:"title_value",25:"acc_title",26:"acc_title_value",27:"acc_descr",28:"acc_descr_value",29:"acc_descr_multiline_value",30:"ALPHANUM",31:".",37:"ATTRIBUTE_WORD",38:"ATTRIBUTE_KEY",39:"COMMENT",42:"ZERO_OR_ONE",43:"ZERO_OR_MORE",44:"ONE_OR_MORE",45:"ONLY_ONE",46:"NON_IDENTIFYING",47:"IDENTIFYING",48:"WORD",49:"open_directive",50:"type_directive",51:"arg_directive",52:"close_directive"},
|
1975 | productions_: [0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,5],[10,4],[10,3],[10,1],[10,2],[10,2],[10,2],[10,1],[17,1],[17,3],[21,1],[21,2],[32,2],[32,3],[32,3],[32,4],[33,1],[34,1],[35,1],[36,1],[18,3],[40,1],[40,1],[40,1],[40,1],[41,1],[41,1],[19,1],[19,1],[12,1],[13,1],[16,1],[14,1]],
|
1976 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
1977 |
|
1978 |
|
1979 | var $0 = $$.length - 1;
|
1980 | switch (yystate) {
|
1981 | case 1:
|
1982 |
|
1983 | break;
|
1984 | case 3:
|
1985 | this.$ = []
|
1986 | break;
|
1987 | case 4:
|
1988 | $$[$0-1].push($$[$0]);this.$ = $$[$0-1]
|
1989 | break;
|
1990 | case 5: case 6:
|
1991 | this.$ = $$[$0]
|
1992 | break;
|
1993 | case 7: case 8:
|
1994 | this.$=[];
|
1995 | break;
|
1996 | case 12:
|
1997 |
|
1998 | yy.addEntity($$[$0-4]);
|
1999 | yy.addEntity($$[$0-2]);
|
2000 | yy.addRelationship($$[$0-4], $$[$0], $$[$0-2], $$[$0-3]);
|
2001 |
|
2002 |
|
2003 | break;
|
2004 | case 13:
|
2005 |
|
2006 |
|
2007 | yy.addEntity($$[$0-3]);
|
2008 | yy.addAttributes($$[$0-3], $$[$0-1]);
|
2009 |
|
2010 |
|
2011 | break;
|
2012 | case 14:
|
2013 | yy.addEntity($$[$0-2]);
|
2014 | break;
|
2015 | case 15:
|
2016 | yy.addEntity($$[$0]);
|
2017 | break;
|
2018 | case 16: case 17:
|
2019 | this.$=$$[$0].trim();yy.setAccTitle(this.$);
|
2020 | break;
|
2021 | case 18: case 19:
|
2022 | this.$=$$[$0].trim();yy.setAccDescription(this.$);
|
2023 | break;
|
2024 | case 20:
|
2025 | this.$ = $$[$0];
|
2026 | break;
|
2027 | case 21:
|
2028 | this.$ = $$[$0-2] + $$[$0-1] + $$[$0];
|
2029 | break;
|
2030 | case 22:
|
2031 | this.$ = [$$[$0]];
|
2032 | break;
|
2033 | case 23:
|
2034 | $$[$0].push($$[$0-1]); this.$=$$[$0];
|
2035 | break;
|
2036 | case 24:
|
2037 | this.$ = { attributeType: $$[$0-1], attributeName: $$[$0] };
|
2038 | break;
|
2039 | case 25:
|
2040 | this.$ = { attributeType: $$[$0-2], attributeName: $$[$0-1], attributeKeyType: $$[$0] };
|
2041 | break;
|
2042 | case 26:
|
2043 | this.$ = { attributeType: $$[$0-2], attributeName: $$[$0-1], attributeComment: $$[$0] };
|
2044 | break;
|
2045 | case 27:
|
2046 | this.$ = { attributeType: $$[$0-3], attributeName: $$[$0-2], attributeKeyType: $$[$0-1], attributeComment: $$[$0] };
|
2047 | break;
|
2048 | case 28: case 29: case 30:
|
2049 | this.$=$$[$0];
|
2050 | break;
|
2051 | case 31:
|
2052 | this.$=$$[$0].replace(/"/g, '');
|
2053 | break;
|
2054 | case 32:
|
2055 |
|
2056 | this.$ = { cardA: $$[$0], relType: $$[$0-1], cardB: $$[$0-2] };
|
2057 |
|
2058 |
|
2059 | break;
|
2060 | case 33:
|
2061 | this.$ = yy.Cardinality.ZERO_OR_ONE;
|
2062 | break;
|
2063 | case 34:
|
2064 | this.$ = yy.Cardinality.ZERO_OR_MORE;
|
2065 | break;
|
2066 | case 35:
|
2067 | this.$ = yy.Cardinality.ONE_OR_MORE;
|
2068 | break;
|
2069 | case 36:
|
2070 | this.$ = yy.Cardinality.ONLY_ONE;
|
2071 | break;
|
2072 | case 37:
|
2073 | this.$ = yy.Identification.NON_IDENTIFYING;
|
2074 | break;
|
2075 | case 38:
|
2076 | this.$ = yy.Identification.IDENTIFYING;
|
2077 | break;
|
2078 | case 39:
|
2079 | this.$ = $$[$0].replace(/"/g, '');
|
2080 | break;
|
2081 | case 40:
|
2082 | this.$ = $$[$0];
|
2083 | break;
|
2084 | case 41:
|
2085 | yy.parseDirective('%%{', 'open_directive');
|
2086 | break;
|
2087 | case 42:
|
2088 | yy.parseDirective($$[$0], 'type_directive');
|
2089 | break;
|
2090 | case 43:
|
2091 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
2092 | break;
|
2093 | case 44:
|
2094 | yy.parseDirective('}%%', 'close_directive', 'er');
|
2095 | break;
|
2096 | }
|
2097 | },
|
2098 | table: [{3:1,4:$V0,7:3,12:4,49:$V1},{1:[3]},o($V2,[2,3],{5:6}),{3:7,4:$V0,7:3,12:4,49:$V1},{13:8,50:[1,9]},{50:[2,41]},{6:[1,10],7:15,8:11,9:[1,12],10:13,11:[1,14],12:4,17:16,23:$V3,25:$V4,27:$V5,29:$V6,30:$V7,49:$V1},{1:[2,2]},{14:22,15:[1,23],52:$V8},o([15,52],[2,42]),o($V2,[2,8],{1:[2,1]}),o($V2,[2,4]),{7:15,10:25,12:4,17:16,23:$V3,25:$V4,27:$V5,29:$V6,30:$V7,49:$V1},o($V2,[2,6]),o($V2,[2,7]),o($V2,[2,11]),o($V2,[2,15],{18:26,40:28,20:[1,27],42:$V9,43:$Va,44:$Vb,45:$Vc}),{24:[1,33]},{26:[1,34]},{28:[1,35]},o($V2,[2,19]),o($Vd,[2,20],{31:[1,36]}),{11:[1,37]},{16:38,51:[1,39]},{11:[2,44]},o($V2,[2,5]),{17:40,30:$V7},{21:41,22:[1,42],32:43,33:44,37:$Ve},{41:46,46:[1,47],47:[1,48]},o($Vf,[2,33]),o($Vf,[2,34]),o($Vf,[2,35]),o($Vf,[2,36]),o($V2,[2,16]),o($V2,[2,17]),o($V2,[2,18]),{17:49,30:$V7},o($Vg,[2,9]),{14:50,52:$V8},{52:[2,43]},{15:[1,51]},{22:[1,52]},o($V2,[2,14]),{21:53,22:[2,22],32:43,33:44,37:$Ve},{34:54,37:[1,55]},{37:[2,28]},{40:56,42:$V9,43:$Va,44:$Vb,45:$Vc},o($Vh,[2,37]),o($Vh,[2,38]),o($Vd,[2,21]),{11:[1,57]},{19:58,30:[1,60],48:[1,59]},o($V2,[2,13]),{22:[2,23]},o($Vi,[2,24],{35:61,36:62,38:[1,63],39:$Vj}),o([22,37,38,39],[2,29]),{30:[2,32]},o($Vg,[2,10]),o($V2,[2,12]),o($V2,[2,39]),o($V2,[2,40]),o($Vi,[2,25],{36:65,39:$Vj}),o($Vi,[2,26]),o([22,37,39],[2,30]),o($Vi,[2,31]),o($Vi,[2,27])],
|
2099 | defaultActions: {5:[2,41],7:[2,2],24:[2,44],39:[2,43],45:[2,28],53:[2,23],56:[2,32]},
|
2100 | parseError: function parseError (str, hash) {
|
2101 | if (hash.recoverable) {
|
2102 | this.trace(str);
|
2103 | } else {
|
2104 | var error = new Error(str);
|
2105 | error.hash = hash;
|
2106 | throw error;
|
2107 | }
|
2108 | },
|
2109 | parse: function parse(input) {
|
2110 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
2111 | var args = lstack.slice.call(arguments, 1);
|
2112 | var lexer = Object.create(this.lexer);
|
2113 | var sharedState = { yy: {} };
|
2114 | for (var k in this.yy) {
|
2115 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
2116 | sharedState.yy[k] = this.yy[k];
|
2117 | }
|
2118 | }
|
2119 | lexer.setInput(input, sharedState.yy);
|
2120 | sharedState.yy.lexer = lexer;
|
2121 | sharedState.yy.parser = this;
|
2122 | if (typeof lexer.yylloc == 'undefined') {
|
2123 | lexer.yylloc = {};
|
2124 | }
|
2125 | var yyloc = lexer.yylloc;
|
2126 | lstack.push(yyloc);
|
2127 | var ranges = lexer.options && lexer.options.ranges;
|
2128 | if (typeof sharedState.yy.parseError === 'function') {
|
2129 | this.parseError = sharedState.yy.parseError;
|
2130 | } else {
|
2131 | this.parseError = Object.getPrototypeOf(this).parseError;
|
2132 | }
|
2133 | function popStack(n) {
|
2134 | stack.length = stack.length - 2 * n;
|
2135 | vstack.length = vstack.length - n;
|
2136 | lstack.length = lstack.length - n;
|
2137 | }
|
2138 | function lex() {
|
2139 | var token;
|
2140 | token = tstack.pop() || lexer.lex() || EOF;
|
2141 | if (typeof token !== 'number') {
|
2142 | if (token instanceof Array) {
|
2143 | tstack = token;
|
2144 | token = tstack.pop();
|
2145 | }
|
2146 | token = self.symbols_[token] || token;
|
2147 | }
|
2148 | return token;
|
2149 | }
|
2150 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
2151 | while (true) {
|
2152 | state = stack[stack.length - 1];
|
2153 | if (this.defaultActions[state]) {
|
2154 | action = this.defaultActions[state];
|
2155 | } else {
|
2156 | if (symbol === null || typeof symbol == 'undefined') {
|
2157 | symbol = lex();
|
2158 | }
|
2159 | action = table[state] && table[state][symbol];
|
2160 | }
|
2161 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
2162 | var errStr = '';
|
2163 | expected = [];
|
2164 | for (p in table[state]) {
|
2165 | if (this.terminals_[p] && p > TERROR) {
|
2166 | expected.push('\'' + this.terminals_[p] + '\'');
|
2167 | }
|
2168 | }
|
2169 | if (lexer.showPosition) {
|
2170 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
2171 | } else {
|
2172 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
2173 | }
|
2174 | this.parseError(errStr, {
|
2175 | text: lexer.match,
|
2176 | token: this.terminals_[symbol] || symbol,
|
2177 | line: lexer.yylineno,
|
2178 | loc: yyloc,
|
2179 | expected: expected
|
2180 | });
|
2181 | }
|
2182 | if (action[0] instanceof Array && action.length > 1) {
|
2183 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
2184 | }
|
2185 | switch (action[0]) {
|
2186 | case 1:
|
2187 | stack.push(symbol);
|
2188 | vstack.push(lexer.yytext);
|
2189 | lstack.push(lexer.yylloc);
|
2190 | stack.push(action[1]);
|
2191 | symbol = null;
|
2192 | if (!preErrorSymbol) {
|
2193 | yyleng = lexer.yyleng;
|
2194 | yytext = lexer.yytext;
|
2195 | yylineno = lexer.yylineno;
|
2196 | yyloc = lexer.yylloc;
|
2197 | if (recovering > 0) {
|
2198 | recovering--;
|
2199 | }
|
2200 | } else {
|
2201 | symbol = preErrorSymbol;
|
2202 | preErrorSymbol = null;
|
2203 | }
|
2204 | break;
|
2205 | case 2:
|
2206 | len = this.productions_[action[1]][1];
|
2207 | yyval.$ = vstack[vstack.length - len];
|
2208 | yyval._$ = {
|
2209 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
2210 | last_line: lstack[lstack.length - 1].last_line,
|
2211 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
2212 | last_column: lstack[lstack.length - 1].last_column
|
2213 | };
|
2214 | if (ranges) {
|
2215 | yyval._$.range = [
|
2216 | lstack[lstack.length - (len || 1)].range[0],
|
2217 | lstack[lstack.length - 1].range[1]
|
2218 | ];
|
2219 | }
|
2220 | r = this.performAction.apply(yyval, [
|
2221 | yytext,
|
2222 | yyleng,
|
2223 | yylineno,
|
2224 | sharedState.yy,
|
2225 | action[1],
|
2226 | vstack,
|
2227 | lstack
|
2228 | ].concat(args));
|
2229 | if (typeof r !== 'undefined') {
|
2230 | return r;
|
2231 | }
|
2232 | if (len) {
|
2233 | stack = stack.slice(0, -1 * len * 2);
|
2234 | vstack = vstack.slice(0, -1 * len);
|
2235 | lstack = lstack.slice(0, -1 * len);
|
2236 | }
|
2237 | stack.push(this.productions_[action[1]][0]);
|
2238 | vstack.push(yyval.$);
|
2239 | lstack.push(yyval._$);
|
2240 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
2241 | stack.push(newState);
|
2242 | break;
|
2243 | case 3:
|
2244 | return true;
|
2245 | }
|
2246 | }
|
2247 | return true;
|
2248 | }};
|
2249 |
|
2250 |
|
2251 | var lexer = (function(){
|
2252 | var lexer = ({
|
2253 |
|
2254 | EOF:1,
|
2255 |
|
2256 | parseError:function parseError(str, hash) {
|
2257 | if (this.yy.parser) {
|
2258 | this.yy.parser.parseError(str, hash);
|
2259 | } else {
|
2260 | throw new Error(str);
|
2261 | }
|
2262 | },
|
2263 |
|
2264 |
|
2265 | setInput:function (input, yy) {
|
2266 | this.yy = yy || this.yy || {};
|
2267 | this._input = input;
|
2268 | this._more = this._backtrack = this.done = false;
|
2269 | this.yylineno = this.yyleng = 0;
|
2270 | this.yytext = this.matched = this.match = '';
|
2271 | this.conditionStack = ['INITIAL'];
|
2272 | this.yylloc = {
|
2273 | first_line: 1,
|
2274 | first_column: 0,
|
2275 | last_line: 1,
|
2276 | last_column: 0
|
2277 | };
|
2278 | if (this.options.ranges) {
|
2279 | this.yylloc.range = [0,0];
|
2280 | }
|
2281 | this.offset = 0;
|
2282 | return this;
|
2283 | },
|
2284 |
|
2285 |
|
2286 | input:function () {
|
2287 | var ch = this._input[0];
|
2288 | this.yytext += ch;
|
2289 | this.yyleng++;
|
2290 | this.offset++;
|
2291 | this.match += ch;
|
2292 | this.matched += ch;
|
2293 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
2294 | if (lines) {
|
2295 | this.yylineno++;
|
2296 | this.yylloc.last_line++;
|
2297 | } else {
|
2298 | this.yylloc.last_column++;
|
2299 | }
|
2300 | if (this.options.ranges) {
|
2301 | this.yylloc.range[1]++;
|
2302 | }
|
2303 |
|
2304 | this._input = this._input.slice(1);
|
2305 | return ch;
|
2306 | },
|
2307 |
|
2308 |
|
2309 | unput:function (ch) {
|
2310 | var len = ch.length;
|
2311 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
2312 |
|
2313 | this._input = ch + this._input;
|
2314 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
2315 |
|
2316 | this.offset -= len;
|
2317 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
2318 | this.match = this.match.substr(0, this.match.length - 1);
|
2319 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
2320 |
|
2321 | if (lines.length - 1) {
|
2322 | this.yylineno -= lines.length - 1;
|
2323 | }
|
2324 | var r = this.yylloc.range;
|
2325 |
|
2326 | this.yylloc = {
|
2327 | first_line: this.yylloc.first_line,
|
2328 | last_line: this.yylineno + 1,
|
2329 | first_column: this.yylloc.first_column,
|
2330 | last_column: lines ?
|
2331 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
2332 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
2333 | this.yylloc.first_column - len
|
2334 | };
|
2335 |
|
2336 | if (this.options.ranges) {
|
2337 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
2338 | }
|
2339 | this.yyleng = this.yytext.length;
|
2340 | return this;
|
2341 | },
|
2342 |
|
2343 |
|
2344 | more:function () {
|
2345 | this._more = true;
|
2346 | return this;
|
2347 | },
|
2348 |
|
2349 |
|
2350 | reject:function () {
|
2351 | if (this.options.backtrack_lexer) {
|
2352 | this._backtrack = true;
|
2353 | } else {
|
2354 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
|
2355 | text: "",
|
2356 | token: null,
|
2357 | line: this.yylineno
|
2358 | });
|
2359 |
|
2360 | }
|
2361 | return this;
|
2362 | },
|
2363 |
|
2364 |
|
2365 | less:function (n) {
|
2366 | this.unput(this.match.slice(n));
|
2367 | },
|
2368 |
|
2369 |
|
2370 | pastInput:function () {
|
2371 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
2372 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
2373 | },
|
2374 |
|
2375 |
|
2376 | upcomingInput:function () {
|
2377 | var next = this.match;
|
2378 | if (next.length < 20) {
|
2379 | next += this._input.substr(0, 20-next.length);
|
2380 | }
|
2381 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
2382 | },
|
2383 |
|
2384 |
|
2385 | showPosition:function () {
|
2386 | var pre = this.pastInput();
|
2387 | var c = new Array(pre.length + 1).join("-");
|
2388 | return pre + this.upcomingInput() + "\n" + c + "^";
|
2389 | },
|
2390 |
|
2391 |
|
2392 | test_match:function(match, indexed_rule) {
|
2393 | var token,
|
2394 | lines,
|
2395 | backup;
|
2396 |
|
2397 | if (this.options.backtrack_lexer) {
|
2398 |
|
2399 | backup = {
|
2400 | yylineno: this.yylineno,
|
2401 | yylloc: {
|
2402 | first_line: this.yylloc.first_line,
|
2403 | last_line: this.last_line,
|
2404 | first_column: this.yylloc.first_column,
|
2405 | last_column: this.yylloc.last_column
|
2406 | },
|
2407 | yytext: this.yytext,
|
2408 | match: this.match,
|
2409 | matches: this.matches,
|
2410 | matched: this.matched,
|
2411 | yyleng: this.yyleng,
|
2412 | offset: this.offset,
|
2413 | _more: this._more,
|
2414 | _input: this._input,
|
2415 | yy: this.yy,
|
2416 | conditionStack: this.conditionStack.slice(0),
|
2417 | done: this.done
|
2418 | };
|
2419 | if (this.options.ranges) {
|
2420 | backup.yylloc.range = this.yylloc.range.slice(0);
|
2421 | }
|
2422 | }
|
2423 |
|
2424 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
2425 | if (lines) {
|
2426 | this.yylineno += lines.length;
|
2427 | }
|
2428 | this.yylloc = {
|
2429 | first_line: this.yylloc.last_line,
|
2430 | last_line: this.yylineno + 1,
|
2431 | first_column: this.yylloc.last_column,
|
2432 | last_column: lines ?
|
2433 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
2434 | this.yylloc.last_column + match[0].length
|
2435 | };
|
2436 | this.yytext += match[0];
|
2437 | this.match += match[0];
|
2438 | this.matches = match;
|
2439 | this.yyleng = this.yytext.length;
|
2440 | if (this.options.ranges) {
|
2441 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
2442 | }
|
2443 | this._more = false;
|
2444 | this._backtrack = false;
|
2445 | this._input = this._input.slice(match[0].length);
|
2446 | this.matched += match[0];
|
2447 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
2448 | if (this.done && this._input) {
|
2449 | this.done = false;
|
2450 | }
|
2451 | if (token) {
|
2452 | return token;
|
2453 | } else if (this._backtrack) {
|
2454 |
|
2455 | for (var k in backup) {
|
2456 | this[k] = backup[k];
|
2457 | }
|
2458 | return false;
|
2459 | }
|
2460 | return false;
|
2461 | },
|
2462 |
|
2463 |
|
2464 | next:function () {
|
2465 | if (this.done) {
|
2466 | return this.EOF;
|
2467 | }
|
2468 | if (!this._input) {
|
2469 | this.done = true;
|
2470 | }
|
2471 |
|
2472 | var token,
|
2473 | match,
|
2474 | tempMatch,
|
2475 | index;
|
2476 | if (!this._more) {
|
2477 | this.yytext = '';
|
2478 | this.match = '';
|
2479 | }
|
2480 | var rules = this._currentRules();
|
2481 | for (var i = 0; i < rules.length; i++) {
|
2482 | tempMatch = this._input.match(this.rules[rules[i]]);
|
2483 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
2484 | match = tempMatch;
|
2485 | index = i;
|
2486 | if (this.options.backtrack_lexer) {
|
2487 | token = this.test_match(tempMatch, rules[i]);
|
2488 | if (token !== false) {
|
2489 | return token;
|
2490 | } else if (this._backtrack) {
|
2491 | match = false;
|
2492 | continue;
|
2493 | } else {
|
2494 |
|
2495 | return false;
|
2496 | }
|
2497 | } else if (!this.options.flex) {
|
2498 | break;
|
2499 | }
|
2500 | }
|
2501 | }
|
2502 | if (match) {
|
2503 | token = this.test_match(match, rules[index]);
|
2504 | if (token !== false) {
|
2505 | return token;
|
2506 | }
|
2507 |
|
2508 | return false;
|
2509 | }
|
2510 | if (this._input === "") {
|
2511 | return this.EOF;
|
2512 | } else {
|
2513 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
2514 | text: "",
|
2515 | token: null,
|
2516 | line: this.yylineno
|
2517 | });
|
2518 | }
|
2519 | },
|
2520 |
|
2521 |
|
2522 | lex:function lex () {
|
2523 | var r = this.next();
|
2524 | if (r) {
|
2525 | return r;
|
2526 | } else {
|
2527 | return this.lex();
|
2528 | }
|
2529 | },
|
2530 |
|
2531 |
|
2532 | begin:function begin (condition) {
|
2533 | this.conditionStack.push(condition);
|
2534 | },
|
2535 |
|
2536 |
|
2537 | popState:function popState () {
|
2538 | var n = this.conditionStack.length - 1;
|
2539 | if (n > 0) {
|
2540 | return this.conditionStack.pop();
|
2541 | } else {
|
2542 | return this.conditionStack[0];
|
2543 | }
|
2544 | },
|
2545 |
|
2546 |
|
2547 | _currentRules:function _currentRules () {
|
2548 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
2549 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
2550 | } else {
|
2551 | return this.conditions["INITIAL"].rules;
|
2552 | }
|
2553 | },
|
2554 |
|
2555 |
|
2556 | topState:function topState (n) {
|
2557 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
2558 | if (n >= 0) {
|
2559 | return this.conditionStack[n];
|
2560 | } else {
|
2561 | return "INITIAL";
|
2562 | }
|
2563 | },
|
2564 |
|
2565 |
|
2566 | pushState:function pushState (condition) {
|
2567 | this.begin(condition);
|
2568 | },
|
2569 |
|
2570 |
|
2571 | stateStackSize:function stateStackSize() {
|
2572 | return this.conditionStack.length;
|
2573 | },
|
2574 | options: {"case-insensitive":true},
|
2575 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
2576 | var YYSTATE=YY_START;
|
2577 | switch($avoiding_name_collisions) {
|
2578 | case 0: this.begin("acc_title");return 25;
|
2579 | break;
|
2580 | case 1: this.popState(); return "acc_title_value";
|
2581 | break;
|
2582 | case 2: this.begin("acc_descr");return 27;
|
2583 | break;
|
2584 | case 3: this.popState(); return "acc_descr_value";
|
2585 | break;
|
2586 | case 4: this.begin("acc_descr_multiline");
|
2587 | break;
|
2588 | case 5: this.popState();
|
2589 | break;
|
2590 | case 6:return "acc_descr_multiline_value";
|
2591 | break;
|
2592 | case 7: this.begin('open_directive'); return 49;
|
2593 | break;
|
2594 | case 8: this.begin('type_directive'); return 50;
|
2595 | break;
|
2596 | case 9: this.popState(); this.begin('arg_directive'); return 15;
|
2597 | break;
|
2598 | case 10: this.popState(); this.popState(); return 52;
|
2599 | break;
|
2600 | case 11:return 51;
|
2601 | break;
|
2602 | case 12:
|
2603 | break;
|
2604 | case 13:
|
2605 | break;
|
2606 | case 14:return 11;
|
2607 | break;
|
2608 | case 15:
|
2609 | break;
|
2610 | case 16:return 9;
|
2611 | break;
|
2612 | case 17:return 48;
|
2613 | break;
|
2614 | case 18:return 4;
|
2615 | break;
|
2616 | case 19: this.begin("block"); return 20;
|
2617 | break;
|
2618 | case 20:
|
2619 | break;
|
2620 | case 21:return 38
|
2621 | break;
|
2622 | case 22:return 37
|
2623 | break;
|
2624 | case 23:return 39;
|
2625 | break;
|
2626 | case 24:
|
2627 | break;
|
2628 | case 25: this.popState(); return 22;
|
2629 | break;
|
2630 | case 26:return yy_.yytext[0];
|
2631 | break;
|
2632 | case 27:return 42;
|
2633 | break;
|
2634 | case 28:return 43;
|
2635 | break;
|
2636 | case 29:return 44;
|
2637 | break;
|
2638 | case 30:return 45;
|
2639 | break;
|
2640 | case 31:return 42;
|
2641 | break;
|
2642 | case 32:return 43;
|
2643 | break;
|
2644 | case 33:return 44;
|
2645 | break;
|
2646 | case 34:return 46;
|
2647 | break;
|
2648 | case 35:return 47;
|
2649 | break;
|
2650 | case 36:return 46;
|
2651 | break;
|
2652 | case 37:return 46;
|
2653 | break;
|
2654 | case 38:return 30;
|
2655 | break;
|
2656 | case 39:return yy_.yytext[0];
|
2657 | break;
|
2658 | case 40:return 6;
|
2659 | break;
|
2660 | }
|
2661 | },
|
2662 | rules: [/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK))\b)/i,/^(?:[A-Za-z][A-Za-z0-9\-_]*)/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:\|o\b)/i,/^(?:\}o\b)/i,/^(?:\}\|)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:[A-Za-z][A-Za-z0-9\-_]*)/i,/^(?:.)/i,/^(?:$)/i],
|
2663 | conditions: {"acc_descr_multiline":{"rules":[5,6],"inclusive":false},"acc_descr":{"rules":[3],"inclusive":false},"acc_title":{"rules":[1],"inclusive":false},"open_directive":{"rules":[8],"inclusive":false},"type_directive":{"rules":[9,10],"inclusive":false},"arg_directive":{"rules":[10,11],"inclusive":false},"block":{"rules":[20,21,22,23,24,25,26],"inclusive":false},"INITIAL":{"rules":[0,2,4,7,12,13,14,15,16,17,18,19,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"inclusive":true}}
|
2664 | });
|
2665 | return lexer;
|
2666 | })();
|
2667 | parser.lexer = lexer;
|
2668 | function Parser () {
|
2669 | this.yy = {};
|
2670 | }
|
2671 | Parser.prototype = parser;parser.Parser = Parser;
|
2672 | return new Parser;
|
2673 | })();
|
2674 |
|
2675 |
|
2676 | if (true) {
|
2677 | exports.parser = parser;
|
2678 | exports.Parser = parser.Parser;
|
2679 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
2680 | exports.main = function commonjsMain (args) {
|
2681 | if (!args[1]) {
|
2682 | console.log('Usage: '+args[0]+' FILE');
|
2683 | process.exit(1);
|
2684 | }
|
2685 | var source = (__webpack_require__( "?3c87").readFileSync)((__webpack_require__( "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
|
2686 | return exports.parser.parse(source);
|
2687 | };
|
2688 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
2689 | exports.main(process.argv.slice(1));
|
2690 | }
|
2691 | }
|
2692 |
|
2693 | }),
|
2694 |
|
2695 | "./src/diagrams/flowchart/parser/flow.jison":
|
2696 |
|
2697 |
|
2698 |
|
2699 | ((module, exports, __webpack_require__) => {
|
2700 |
|
2701 | module = __webpack_require__.nmd(module);
|
2702 |
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 |
|
2708 |
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 |
|
2714 |
|
2715 |
|
2716 |
|
2717 |
|
2718 |
|
2719 |
|
2720 |
|
2721 |
|
2722 |
|
2723 |
|
2724 |
|
2725 |
|
2726 |
|
2727 |
|
2728 |
|
2729 |
|
2730 |
|
2731 |
|
2732 |
|
2733 |
|
2734 |
|
2735 |
|
2736 |
|
2737 |
|
2738 |
|
2739 |
|
2740 |
|
2741 |
|
2742 |
|
2743 |
|
2744 |
|
2745 |
|
2746 |
|
2747 |
|
2748 |
|
2749 |
|
2750 |
|
2751 |
|
2752 |
|
2753 |
|
2754 |
|
2755 |
|
2756 |
|
2757 |
|
2758 |
|
2759 |
|
2760 |
|
2761 |
|
2762 |
|
2763 |
|
2764 |
|
2765 |
|
2766 |
|
2767 |
|
2768 |
|
2769 |
|
2770 |
|
2771 |
|
2772 |
|
2773 |
|
2774 |
|
2775 | var parser = (function(){
|
2776 | var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,9],$V1=[1,7],$V2=[1,6],$V3=[1,8],$V4=[1,20,21,22,23,38,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],$V5=[2,10],$V6=[1,20],$V7=[1,21],$V8=[1,22],$V9=[1,23],$Va=[1,30],$Vb=[1,32],$Vc=[1,33],$Vd=[1,34],$Ve=[1,62],$Vf=[1,48],$Vg=[1,52],$Vh=[1,36],$Vi=[1,37],$Vj=[1,38],$Vk=[1,39],$Vl=[1,40],$Vm=[1,56],$Vn=[1,63],$Vo=[1,51],$Vp=[1,53],$Vq=[1,55],$Vr=[1,59],$Vs=[1,60],$Vt=[1,41],$Vu=[1,42],$Vv=[1,43],$Vw=[1,44],$Vx=[1,61],$Vy=[1,50],$Vz=[1,54],$VA=[1,57],$VB=[1,58],$VC=[1,49],$VD=[1,66],$VE=[1,71],$VF=[1,20,21,22,23,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],$VG=[1,75],$VH=[1,74],$VI=[1,76],$VJ=[20,21,23,81,82],$VK=[1,99],$VL=[1,104],$VM=[1,107],$VN=[1,108],$VO=[1,101],$VP=[1,106],$VQ=[1,109],$VR=[1,102],$VS=[1,114],$VT=[1,113],$VU=[1,103],$VV=[1,105],$VW=[1,110],$VX=[1,111],$VY=[1,112],$VZ=[1,115],$V_=[20,21,22,23,81,82],$V$=[20,21,22,23,53,81,82],$V01=[20,21,22,23,40,52,53,55,57,59,61,63,65,66,67,69,71,73,74,76,81,82,91,95,105,106,109,111,112,122,123,124,125,126,127],$V11=[20,21,23],$V21=[20,21,23,52,66,67,81,82,91,95,105,106,109,111,112,122,123,124,125,126,127],$V31=[1,12,20,21,22,23,24,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],$V41=[52,66,67,91,95,105,106,109,111,112,122,123,124,125,126,127],$V51=[1,149],$V61=[1,157],$V71=[1,158],$V81=[1,159],$V91=[1,160],$Va1=[1,144],$Vb1=[1,145],$Vc1=[1,141],$Vd1=[1,152],$Ve1=[1,153],$Vf1=[1,154],$Vg1=[1,155],$Vh1=[1,156],$Vi1=[1,161],$Vj1=[1,162],$Vk1=[1,147],$Vl1=[1,150],$Vm1=[1,146],$Vn1=[1,143],$Vo1=[20,21,22,23,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],$Vp1=[1,165],$Vq1=[20,21,22,23,26,52,66,67,91,105,106,109,111,112,122,123,124,125,126,127],$Vr1=[20,21,22,23,24,26,38,40,41,42,52,56,58,60,62,64,66,67,68,70,72,73,75,77,81,82,86,87,88,89,90,91,92,95,105,106,109,111,112,113,114,122,123,124,125,126,127],$Vs1=[12,21,22,24],$Vt1=[22,106],$Vu1=[1,250],$Vv1=[1,245],$Vw1=[1,246],$Vx1=[1,254],$Vy1=[1,251],$Vz1=[1,248],$VA1=[1,247],$VB1=[1,249],$VC1=[1,252],$VD1=[1,253],$VE1=[1,255],$VF1=[1,273],$VG1=[20,21,23,106],$VH1=[20,21,22,23,66,67,86,102,105,106,109,110,111,112,113];
|
2777 | var parser = {trace: function trace () { },
|
2778 | yy: {},
|
2779 | symbols_: {"error":2,"start":3,"mermaidDoc":4,"directive":5,"openDirective":6,"typeDirective":7,"closeDirective":8,"separator":9,":":10,"argDirective":11,"open_directive":12,"type_directive":13,"arg_directive":14,"close_directive":15,"graphConfig":16,"document":17,"line":18,"statement":19,"SEMI":20,"NEWLINE":21,"SPACE":22,"EOF":23,"GRAPH":24,"NODIR":25,"DIR":26,"FirstStmtSeperator":27,"ending":28,"endToken":29,"spaceList":30,"spaceListNewline":31,"verticeStatement":32,"styleStatement":33,"linkStyleStatement":34,"classDefStatement":35,"classStatement":36,"clickStatement":37,"subgraph":38,"text":39,"SQS":40,"SQE":41,"end":42,"direction":43,"acc_title":44,"acc_title_value":45,"acc_descr":46,"acc_descr_value":47,"acc_descr_multiline_value":48,"link":49,"node":50,"vertex":51,"AMP":52,"STYLE_SEPARATOR":53,"idString":54,"DOUBLECIRCLESTART":55,"DOUBLECIRCLEEND":56,"PS":57,"PE":58,"(-":59,"-)":60,"STADIUMSTART":61,"STADIUMEND":62,"SUBROUTINESTART":63,"SUBROUTINEEND":64,"VERTEX_WITH_PROPS_START":65,"ALPHA":66,"COLON":67,"PIPE":68,"CYLINDERSTART":69,"CYLINDEREND":70,"DIAMOND_START":71,"DIAMOND_STOP":72,"TAGEND":73,"TRAPSTART":74,"TRAPEND":75,"INVTRAPSTART":76,"INVTRAPEND":77,"linkStatement":78,"arrowText":79,"TESTSTR":80,"START_LINK":81,"LINK":82,"textToken":83,"STR":84,"keywords":85,"STYLE":86,"LINKSTYLE":87,"CLASSDEF":88,"CLASS":89,"CLICK":90,"DOWN":91,"UP":92,"textNoTags":93,"textNoTagsToken":94,"DEFAULT":95,"stylesOpt":96,"alphaNum":97,"CALLBACKNAME":98,"CALLBACKARGS":99,"HREF":100,"LINK_TARGET":101,"HEX":102,"numList":103,"INTERPOLATE":104,"NUM":105,"COMMA":106,"style":107,"styleComponent":108,"MINUS":109,"UNIT":110,"BRKT":111,"DOT":112,"PCT":113,"TAGSTART":114,"alphaNumToken":115,"idStringToken":116,"alphaNumStatement":117,"direction_tb":118,"direction_bt":119,"direction_rl":120,"direction_lr":121,"PUNCTUATION":122,"UNICODE_TEXT":123,"PLUS":124,"EQUALS":125,"MULT":126,"UNDERSCORE":127,"graphCodeTokens":128,"ARROW_CROSS":129,"ARROW_POINT":130,"ARROW_CIRCLE":131,"ARROW_OPEN":132,"QUOTE":133,"$accept":0,"$end":1},
|
2780 | terminals_: {2:"error",10:":",12:"open_directive",13:"type_directive",14:"arg_directive",15:"close_directive",20:"SEMI",21:"NEWLINE",22:"SPACE",23:"EOF",24:"GRAPH",25:"NODIR",26:"DIR",38:"subgraph",40:"SQS",41:"SQE",42:"end",44:"acc_title",45:"acc_title_value",46:"acc_descr",47:"acc_descr_value",48:"acc_descr_multiline_value",52:"AMP",53:"STYLE_SEPARATOR",55:"DOUBLECIRCLESTART",56:"DOUBLECIRCLEEND",57:"PS",58:"PE",59:"(-",60:"-)",61:"STADIUMSTART",62:"STADIUMEND",63:"SUBROUTINESTART",64:"SUBROUTINEEND",65:"VERTEX_WITH_PROPS_START",66:"ALPHA",67:"COLON",68:"PIPE",69:"CYLINDERSTART",70:"CYLINDEREND",71:"DIAMOND_START",72:"DIAMOND_STOP",73:"TAGEND",74:"TRAPSTART",75:"TRAPEND",76:"INVTRAPSTART",77:"INVTRAPEND",80:"TESTSTR",81:"START_LINK",82:"LINK",84:"STR",86:"STYLE",87:"LINKSTYLE",88:"CLASSDEF",89:"CLASS",90:"CLICK",91:"DOWN",92:"UP",95:"DEFAULT",98:"CALLBACKNAME",99:"CALLBACKARGS",100:"HREF",101:"LINK_TARGET",102:"HEX",104:"INTERPOLATE",105:"NUM",106:"COMMA",109:"MINUS",110:"UNIT",111:"BRKT",112:"DOT",113:"PCT",114:"TAGSTART",118:"direction_tb",119:"direction_bt",120:"direction_rl",121:"direction_lr",122:"PUNCTUATION",123:"UNICODE_TEXT",124:"PLUS",125:"EQUALS",126:"MULT",127:"UNDERSCORE",129:"ARROW_CROSS",130:"ARROW_POINT",131:"ARROW_CIRCLE",132:"ARROW_OPEN",133:"QUOTE"},
|
2781 | productions_: [0,[3,1],[3,2],[5,4],[5,6],[6,1],[7,1],[11,1],[8,1],[4,2],[17,0],[17,2],[18,1],[18,1],[18,1],[18,1],[18,1],[16,2],[16,2],[16,2],[16,3],[28,2],[28,1],[29,1],[29,1],[29,1],[27,1],[27,1],[27,2],[31,2],[31,2],[31,1],[31,1],[30,2],[30,1],[19,2],[19,2],[19,2],[19,2],[19,2],[19,2],[19,9],[19,6],[19,4],[19,1],[19,2],[19,2],[19,1],[9,1],[9,1],[9,1],[32,3],[32,4],[32,2],[32,1],[50,1],[50,5],[50,3],[51,4],[51,4],[51,6],[51,4],[51,4],[51,4],[51,8],[51,4],[51,4],[51,4],[51,6],[51,4],[51,4],[51,4],[51,4],[51,4],[51,1],[49,2],[49,3],[49,3],[49,1],[49,3],[78,1],[79,3],[39,1],[39,2],[39,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[93,1],[93,2],[35,5],[35,5],[36,5],[37,2],[37,4],[37,3],[37,5],[37,2],[37,4],[37,4],[37,6],[37,2],[37,4],[37,2],[37,4],[37,4],[37,6],[33,5],[33,5],[34,5],[34,5],[34,9],[34,9],[34,7],[34,7],[103,1],[103,3],[96,1],[96,3],[107,1],[107,2],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[94,1],[94,1],[94,1],[94,1],[54,1],[54,2],[97,1],[97,2],[117,1],[117,1],[117,1],[117,1],[43,1],[43,1],[43,1],[43,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1]],
|
2782 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
2783 |
|
2784 |
|
2785 | var $0 = $$.length - 1;
|
2786 | switch (yystate) {
|
2787 | case 5:
|
2788 | yy.parseDirective('%%{', 'open_directive');
|
2789 | break;
|
2790 | case 6:
|
2791 | yy.parseDirective($$[$0], 'type_directive');
|
2792 | break;
|
2793 | case 7:
|
2794 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
2795 | break;
|
2796 | case 8:
|
2797 | yy.parseDirective('}%%', 'close_directive', 'flowchart');
|
2798 | break;
|
2799 | case 10:
|
2800 | this.$ = [];
|
2801 | break;
|
2802 | case 11:
|
2803 |
|
2804 | if($$[$0] !== []){
|
2805 | $$[$0-1].push($$[$0]);
|
2806 | }
|
2807 | this.$=$$[$0-1];
|
2808 | break;
|
2809 | case 12: case 82: case 84: case 96: case 152: case 154: case 155:
|
2810 | this.$=$$[$0];
|
2811 | break;
|
2812 | case 19:
|
2813 | yy.setDirection('TB');this.$ = 'TB';
|
2814 | break;
|
2815 | case 20:
|
2816 | yy.setDirection($$[$0-1]);this.$ = $$[$0-1];
|
2817 | break;
|
2818 | case 35:
|
2819 | this.$=$$[$0-1].nodes
|
2820 | break;
|
2821 | case 36: case 37: case 38: case 39: case 40:
|
2822 | this.$=[];
|
2823 | break;
|
2824 | case 41:
|
2825 | this.$=yy.addSubGraph($$[$0-6],$$[$0-1],$$[$0-4]);
|
2826 | break;
|
2827 | case 42:
|
2828 | this.$=yy.addSubGraph($$[$0-3],$$[$0-1],$$[$0-3]);
|
2829 | break;
|
2830 | case 43:
|
2831 | this.$=yy.addSubGraph(undefined,$$[$0-1],undefined);
|
2832 | break;
|
2833 | case 45:
|
2834 | this.$=$$[$0].trim();yy.setAccTitle(this.$);
|
2835 | break;
|
2836 | case 46: case 47:
|
2837 | this.$=$$[$0].trim();yy.setAccDescription(this.$);
|
2838 | break;
|
2839 | case 51:
|
2840 | yy.addLink($$[$0-2].stmt,$$[$0],$$[$0-1]); this.$ = { stmt: $$[$0], nodes: $$[$0].concat($$[$0-2].nodes) }
|
2841 | break;
|
2842 | case 52:
|
2843 | yy.addLink($$[$0-3].stmt,$$[$0-1],$$[$0-2]); this.$ = { stmt: $$[$0-1], nodes: $$[$0-1].concat($$[$0-3].nodes) }
|
2844 | break;
|
2845 | case 53:
|
2846 | this.$ = {stmt: $$[$0-1], nodes:$$[$0-1] }
|
2847 | break;
|
2848 | case 54:
|
2849 | this.$ = {stmt: $$[$0], nodes:$$[$0] }
|
2850 | break;
|
2851 | case 55:
|
2852 | this.$ = [$$[$0]];
|
2853 | break;
|
2854 | case 56:
|
2855 | this.$ = $$[$0-4].concat($$[$0]);
|
2856 | break;
|
2857 | case 57:
|
2858 | this.$ = [$$[$0-2]];yy.setClass($$[$0-2],$$[$0])
|
2859 | break;
|
2860 | case 58:
|
2861 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'square');
|
2862 | break;
|
2863 | case 59:
|
2864 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'doublecircle');
|
2865 | break;
|
2866 | case 60:
|
2867 | this.$ = $$[$0-5];yy.addVertex($$[$0-5],$$[$0-2],'circle');
|
2868 | break;
|
2869 | case 61:
|
2870 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'ellipse');
|
2871 | break;
|
2872 | case 62:
|
2873 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'stadium');
|
2874 | break;
|
2875 | case 63:
|
2876 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'subroutine');
|
2877 | break;
|
2878 | case 64:
|
2879 | this.$ = $$[$0-7];yy.addVertex($$[$0-7],$$[$0-1],'rect',undefined,undefined,undefined, Object.fromEntries([[$$[$0-5], $$[$0-3]]]));
|
2880 | break;
|
2881 | case 65:
|
2882 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'cylinder');
|
2883 | break;
|
2884 | case 66:
|
2885 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'round');
|
2886 | break;
|
2887 | case 67:
|
2888 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'diamond');
|
2889 | break;
|
2890 | case 68:
|
2891 | this.$ = $$[$0-5];yy.addVertex($$[$0-5],$$[$0-2],'hexagon');
|
2892 | break;
|
2893 | case 69:
|
2894 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'odd');
|
2895 | break;
|
2896 | case 70:
|
2897 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'trapezoid');
|
2898 | break;
|
2899 | case 71:
|
2900 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'inv_trapezoid');
|
2901 | break;
|
2902 | case 72:
|
2903 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'lean_right');
|
2904 | break;
|
2905 | case 73:
|
2906 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'lean_left');
|
2907 | break;
|
2908 | case 74:
|
2909 | this.$ = $$[$0];yy.addVertex($$[$0]);
|
2910 | break;
|
2911 | case 75:
|
2912 | $$[$0-1].text = $$[$0];this.$ = $$[$0-1];
|
2913 | break;
|
2914 | case 76: case 77:
|
2915 | $$[$0-2].text = $$[$0-1];this.$ = $$[$0-2];
|
2916 | break;
|
2917 | case 78:
|
2918 | this.$ = $$[$0];
|
2919 | break;
|
2920 | case 79:
|
2921 | var inf = yy.destructLink($$[$0], $$[$0-2]); this.$ = {"type":inf.type,"stroke":inf.stroke,"length":inf.length,"text":$$[$0-1]};
|
2922 | break;
|
2923 | case 80:
|
2924 | var inf = yy.destructLink($$[$0]);this.$ = {"type":inf.type,"stroke":inf.stroke,"length":inf.length};
|
2925 | break;
|
2926 | case 81:
|
2927 | this.$ = $$[$0-1];
|
2928 | break;
|
2929 | case 83: case 97: case 153:
|
2930 | this.$=$$[$0-1]+''+$$[$0];
|
2931 | break;
|
2932 | case 98: case 99:
|
2933 | this.$ = $$[$0-4];yy.addClass($$[$0-2],$$[$0]);
|
2934 | break;
|
2935 | case 100:
|
2936 | this.$ = $$[$0-4];yy.setClass($$[$0-2], $$[$0]);
|
2937 | break;
|
2938 | case 101: case 109:
|
2939 | this.$ = $$[$0-1];yy.setClickEvent($$[$0-1], $$[$0]);
|
2940 | break;
|
2941 | case 102: case 110:
|
2942 | this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-3], $$[$0]);
|
2943 | break;
|
2944 | case 103:
|
2945 | this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]);
|
2946 | break;
|
2947 | case 104:
|
2948 | this.$ = $$[$0-4];yy.setClickEvent($$[$0-4], $$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-4], $$[$0]);
|
2949 | break;
|
2950 | case 105: case 111:
|
2951 | this.$ = $$[$0-1];yy.setLink($$[$0-1], $$[$0]);
|
2952 | break;
|
2953 | case 106: case 112:
|
2954 | this.$ = $$[$0-3];yy.setLink($$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-3], $$[$0]);
|
2955 | break;
|
2956 | case 107: case 113:
|
2957 | this.$ = $$[$0-3];yy.setLink($$[$0-3], $$[$0-2], $$[$0]);
|
2958 | break;
|
2959 | case 108: case 114:
|
2960 | this.$ = $$[$0-5];yy.setLink($$[$0-5], $$[$0-4], $$[$0]);yy.setTooltip($$[$0-5], $$[$0-2]);
|
2961 | break;
|
2962 | case 115:
|
2963 | this.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]);
|
2964 | break;
|
2965 | case 116: case 118:
|
2966 | this.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]);
|
2967 | break;
|
2968 | case 117:
|
2969 | this.$ = $$[$0-4];yy.updateLink([$$[$0-2]],$$[$0]);
|
2970 | break;
|
2971 | case 119:
|
2972 | this.$ = $$[$0-8];yy.updateLinkInterpolate([$$[$0-6]],$$[$0-2]);yy.updateLink([$$[$0-6]],$$[$0]);
|
2973 | break;
|
2974 | case 120:
|
2975 | this.$ = $$[$0-8];yy.updateLinkInterpolate($$[$0-6],$$[$0-2]);yy.updateLink($$[$0-6],$$[$0]);
|
2976 | break;
|
2977 | case 121:
|
2978 | this.$ = $$[$0-6];yy.updateLinkInterpolate([$$[$0-4]],$$[$0]);
|
2979 | break;
|
2980 | case 122:
|
2981 | this.$ = $$[$0-6];yy.updateLinkInterpolate($$[$0-4],$$[$0]);
|
2982 | break;
|
2983 | case 123: case 125:
|
2984 | this.$ = [$$[$0]]
|
2985 | break;
|
2986 | case 124: case 126:
|
2987 | $$[$0-2].push($$[$0]);this.$ = $$[$0-2];
|
2988 | break;
|
2989 | case 128:
|
2990 | this.$ = $$[$0-1] + $$[$0];
|
2991 | break;
|
2992 | case 150:
|
2993 | this.$=$$[$0]
|
2994 | break;
|
2995 | case 151:
|
2996 | this.$=$$[$0-1]+''+$$[$0]
|
2997 | break;
|
2998 | case 156:
|
2999 | this.$='v';
|
3000 | break;
|
3001 | case 157:
|
3002 | this.$='-';
|
3003 | break;
|
3004 | case 158:
|
3005 | this.$={stmt:'dir', value:'TB'};
|
3006 | break;
|
3007 | case 159:
|
3008 | this.$={stmt:'dir', value:'BT'};
|
3009 | break;
|
3010 | case 160:
|
3011 | this.$={stmt:'dir', value:'RL'};
|
3012 | break;
|
3013 | case 161:
|
3014 | this.$={stmt:'dir', value:'LR'};
|
3015 | break;
|
3016 | }
|
3017 | },
|
3018 | table: [{3:1,4:2,5:3,6:5,12:$V0,16:4,21:$V1,22:$V2,24:$V3},{1:[3]},{1:[2,1]},{3:10,4:2,5:3,6:5,12:$V0,16:4,21:$V1,22:$V2,24:$V3},o($V4,$V5,{17:11}),{7:12,13:[1,13]},{16:14,21:$V1,22:$V2,24:$V3},{16:15,21:$V1,22:$V2,24:$V3},{25:[1,16],26:[1,17]},{13:[2,5]},{1:[2,2]},{1:[2,9],18:18,19:19,20:$V6,21:$V7,22:$V8,23:$V9,32:24,33:25,34:26,35:27,36:28,37:29,38:$Va,43:31,44:$Vb,46:$Vc,48:$Vd,50:35,51:45,52:$Ve,54:46,66:$Vf,67:$Vg,86:$Vh,87:$Vi,88:$Vj,89:$Vk,90:$Vl,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,116:47,118:$Vt,119:$Vu,120:$Vv,121:$Vw,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC},{8:64,10:[1,65],15:$VD},o([10,15],[2,6]),o($V4,[2,17]),o($V4,[2,18]),o($V4,[2,19]),{20:[1,68],21:[1,69],22:$VE,27:67,30:70},o($VF,[2,11]),o($VF,[2,12]),o($VF,[2,13]),o($VF,[2,14]),o($VF,[2,15]),o($VF,[2,16]),{9:72,20:$VG,21:$VH,23:$VI,49:73,78:77,81:[1,78],82:[1,79]},{9:80,20:$VG,21:$VH,23:$VI},{9:81,20:$VG,21:$VH,23:$VI},{9:82,20:$VG,21:$VH,23:$VI},{9:83,20:$VG,21:$VH,23:$VI},{9:84,20:$VG,21:$VH,23:$VI},{9:86,20:$VG,21:$VH,22:[1,85],23:$VI},o($VF,[2,44]),{45:[1,87]},{47:[1,88]},o($VF,[2,47]),o($VJ,[2,54],{30:89,22:$VE}),{22:[1,90]},{22:[1,91]},{22:[1,92]},{22:[1,93]},{26:$VK,52:$VL,66:$VM,67:$VN,84:[1,97],91:$VO,97:96,98:[1,94],100:[1,95],105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:98,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($VF,[2,158]),o($VF,[2,159]),o($VF,[2,160]),o($VF,[2,161]),o($V_,[2,55],{53:[1,116]}),o($V$,[2,74],{116:129,40:[1,117],52:$Ve,55:[1,118],57:[1,119],59:[1,120],61:[1,121],63:[1,122],65:[1,123],66:$Vf,67:$Vg,69:[1,124],71:[1,125],73:[1,126],74:[1,127],76:[1,128],91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC}),o($V01,[2,150]),o($V01,[2,175]),o($V01,[2,176]),o($V01,[2,177]),o($V01,[2,178]),o($V01,[2,179]),o($V01,[2,180]),o($V01,[2,181]),o($V01,[2,182]),o($V01,[2,183]),o($V01,[2,184]),o($V01,[2,185]),o($V01,[2,186]),o($V01,[2,187]),o($V01,[2,188]),o($V01,[2,189]),o($V01,[2,190]),{9:130,20:$VG,21:$VH,23:$VI},{11:131,14:[1,132]},o($V11,[2,8]),o($V4,[2,20]),o($V4,[2,26]),o($V4,[2,27]),{21:[1,133]},o($V21,[2,34],{30:134,22:$VE}),o($VF,[2,35]),{50:135,51:45,52:$Ve,54:46,66:$Vf,67:$Vg,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,116:47,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC},o($V31,[2,48]),o($V31,[2,49]),o($V31,[2,50]),o($V41,[2,78],{79:136,68:[1,138],80:[1,137]}),{22:$V51,24:$V61,26:$V71,38:$V81,39:139,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o([52,66,67,68,80,91,95,105,106,109,111,112,122,123,124,125,126,127],[2,80]),o($VF,[2,36]),o($VF,[2,37]),o($VF,[2,38]),o($VF,[2,39]),o($VF,[2,40]),{22:$V51,24:$V61,26:$V71,38:$V81,39:163,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($Vo1,$V5,{17:164}),o($VF,[2,45]),o($VF,[2,46]),o($VJ,[2,53],{52:$Vp1}),{26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,97:166,102:[1,167],105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:98,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{95:[1,168],103:169,105:[1,170]},{26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,95:[1,171],97:172,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:98,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,97:173,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:98,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V11,[2,101],{22:[1,174],99:[1,175]}),o($V11,[2,105],{22:[1,176]}),o($V11,[2,109],{115:100,117:178,22:[1,177],26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ}),o($V11,[2,111],{22:[1,179]}),o($Vq1,[2,152]),o($Vq1,[2,154]),o($Vq1,[2,155]),o($Vq1,[2,156]),o($Vq1,[2,157]),o($Vr1,[2,162]),o($Vr1,[2,163]),o($Vr1,[2,164]),o($Vr1,[2,165]),o($Vr1,[2,166]),o($Vr1,[2,167]),o($Vr1,[2,168]),o($Vr1,[2,169]),o($Vr1,[2,170]),o($Vr1,[2,171]),o($Vr1,[2,172]),o($Vr1,[2,173]),o($Vr1,[2,174]),{52:$Ve,54:180,66:$Vf,67:$Vg,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,116:47,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC},{22:$V51,24:$V61,26:$V71,38:$V81,39:181,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:182,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:184,42:$V91,52:$VL,57:[1,183],66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:185,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:186,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:187,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{66:[1,188]},{22:$V51,24:$V61,26:$V71,38:$V81,39:189,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:190,42:$V91,52:$VL,66:$VM,67:$VN,71:[1,191],73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:192,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:193,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:194,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V01,[2,151]),o($Vs1,[2,3]),{8:195,15:$VD},{15:[2,7]},o($V4,[2,28]),o($V21,[2,33]),o($VJ,[2,51],{30:196,22:$VE}),o($V41,[2,75],{22:[1,197]}),{22:[1,198]},{22:$V51,24:$V61,26:$V71,38:$V81,39:199,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,82:[1,200],83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($Vr1,[2,82]),o($Vr1,[2,84]),o($Vr1,[2,140]),o($Vr1,[2,141]),o($Vr1,[2,142]),o($Vr1,[2,143]),o($Vr1,[2,144]),o($Vr1,[2,145]),o($Vr1,[2,146]),o($Vr1,[2,147]),o($Vr1,[2,148]),o($Vr1,[2,149]),o($Vr1,[2,85]),o($Vr1,[2,86]),o($Vr1,[2,87]),o($Vr1,[2,88]),o($Vr1,[2,89]),o($Vr1,[2,90]),o($Vr1,[2,91]),o($Vr1,[2,92]),o($Vr1,[2,93]),o($Vr1,[2,94]),o($Vr1,[2,95]),{9:203,20:$VG,21:$VH,22:$V51,23:$VI,24:$V61,26:$V71,38:$V81,40:[1,202],42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{18:18,19:19,20:$V6,21:$V7,22:$V8,23:$V9,32:24,33:25,34:26,35:27,36:28,37:29,38:$Va,42:[1,204],43:31,44:$Vb,46:$Vc,48:$Vd,50:35,51:45,52:$Ve,54:46,66:$Vf,67:$Vg,86:$Vh,87:$Vi,88:$Vj,89:$Vk,90:$Vl,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,116:47,118:$Vt,119:$Vu,120:$Vv,121:$Vw,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC},{22:$VE,30:205},{22:[1,206],26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:178,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:[1,207]},{22:[1,208]},{22:[1,209],106:[1,210]},o($Vt1,[2,123]),{22:[1,211]},{22:[1,212],26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:178,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:[1,213],26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:178,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{84:[1,214]},o($V11,[2,103],{22:[1,215]}),{84:[1,216],101:[1,217]},{84:[1,218]},o($Vq1,[2,153]),{84:[1,219],101:[1,220]},o($V_,[2,57],{116:129,52:$Ve,66:$Vf,67:$Vg,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC}),{22:$V51,24:$V61,26:$V71,38:$V81,41:[1,221],42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,56:[1,222],66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:223,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,58:[1,224],66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,60:[1,225],66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,62:[1,226],66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,64:[1,227],66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{67:[1,228]},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,66:$VM,67:$VN,70:[1,229],73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,66:$VM,67:$VN,72:[1,230],73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,39:231,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,41:[1,232],42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,75:[1,233],77:[1,234],81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,75:[1,236],77:[1,235],81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{9:237,20:$VG,21:$VH,23:$VI},o($VJ,[2,52],{52:$Vp1}),o($V41,[2,77]),o($V41,[2,76]),{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,66:$VM,67:$VN,68:[1,238],73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V41,[2,79]),o($Vr1,[2,83]),{22:$V51,24:$V61,26:$V71,38:$V81,39:239,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($Vo1,$V5,{17:240}),o($VF,[2,43]),{51:241,52:$Ve,54:46,66:$Vf,67:$Vg,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,116:47,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:242,102:$Vy1,105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:256,102:$Vy1,105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:257,102:$Vy1,104:[1,258],105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:259,102:$Vy1,104:[1,260],105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},{105:[1,261]},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:262,102:$Vy1,105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:263,102:$Vy1,105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},{26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,97:264,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:98,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V11,[2,102]),{84:[1,265]},o($V11,[2,106],{22:[1,266]}),o($V11,[2,107]),o($V11,[2,110]),o($V11,[2,112],{22:[1,267]}),o($V11,[2,113]),o($V$,[2,58]),o($V$,[2,59]),{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,58:[1,268],66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V$,[2,66]),o($V$,[2,61]),o($V$,[2,62]),o($V$,[2,63]),{66:[1,269]},o($V$,[2,65]),o($V$,[2,67]),{22:$V51,24:$V61,26:$V71,38:$V81,42:$V91,52:$VL,66:$VM,67:$VN,72:[1,270],73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V$,[2,69]),o($V$,[2,70]),o($V$,[2,72]),o($V$,[2,71]),o($V$,[2,73]),o($Vs1,[2,4]),o([22,52,66,67,91,95,105,106,109,111,112,122,123,124,125,126,127],[2,81]),{22:$V51,24:$V61,26:$V71,38:$V81,41:[1,271],42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{18:18,19:19,20:$V6,21:$V7,22:$V8,23:$V9,32:24,33:25,34:26,35:27,36:28,37:29,38:$Va,42:[1,272],43:31,44:$Vb,46:$Vc,48:$Vd,50:35,51:45,52:$Ve,54:46,66:$Vf,67:$Vg,86:$Vh,87:$Vi,88:$Vj,89:$Vk,90:$Vl,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,116:47,118:$Vt,119:$Vu,120:$Vv,121:$Vw,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC},o($V_,[2,56]),o($V11,[2,115],{106:$VF1}),o($VG1,[2,125],{108:274,22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,102:$Vy1,105:$Vz1,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1}),o($VH1,[2,127]),o($VH1,[2,129]),o($VH1,[2,130]),o($VH1,[2,131]),o($VH1,[2,132]),o($VH1,[2,133]),o($VH1,[2,134]),o($VH1,[2,135]),o($VH1,[2,136]),o($VH1,[2,137]),o($VH1,[2,138]),o($VH1,[2,139]),o($V11,[2,116],{106:$VF1}),o($V11,[2,117],{106:$VF1}),{22:[1,275]},o($V11,[2,118],{106:$VF1}),{22:[1,276]},o($Vt1,[2,124]),o($V11,[2,98],{106:$VF1}),o($V11,[2,99],{106:$VF1}),o($V11,[2,100],{115:100,117:178,26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ}),o($V11,[2,104]),{101:[1,277]},{101:[1,278]},{58:[1,279]},{68:[1,280]},{72:[1,281]},{9:282,20:$VG,21:$VH,23:$VI},o($VF,[2,42]),{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,102:$Vy1,105:$Vz1,107:283,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},o($VH1,[2,128]),{26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,97:284,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:98,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,97:285,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,115:100,117:98,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V11,[2,108]),o($V11,[2,114]),o($V$,[2,60]),{22:$V51,24:$V61,26:$V71,38:$V81,39:286,42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:140,84:$Vc1,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},o($V$,[2,68]),o($Vo1,$V5,{17:287}),o($VG1,[2,126],{108:274,22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,102:$Vy1,105:$Vz1,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1}),o($V11,[2,121],{115:100,117:178,22:[1,288],26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ}),o($V11,[2,122],{115:100,117:178,22:[1,289],26:$VK,52:$VL,66:$VM,67:$VN,91:$VO,105:$VP,106:$VQ,109:$VR,111:$VS,112:$VT,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ}),{22:$V51,24:$V61,26:$V71,38:$V81,41:[1,290],42:$V91,52:$VL,66:$VM,67:$VN,73:$Va1,81:$Vb1,83:201,85:151,86:$Vd1,87:$Ve1,88:$Vf1,89:$Vg1,90:$Vh1,91:$Vi1,92:$Vj1,94:142,95:$Vk1,105:$VP,106:$VQ,109:$Vl1,111:$VS,112:$VT,113:$Vm1,114:$Vn1,115:148,122:$VU,123:$VV,124:$VW,125:$VX,126:$VY,127:$VZ},{18:18,19:19,20:$V6,21:$V7,22:$V8,23:$V9,32:24,33:25,34:26,35:27,36:28,37:29,38:$Va,42:[1,291],43:31,44:$Vb,46:$Vc,48:$Vd,50:35,51:45,52:$Ve,54:46,66:$Vf,67:$Vg,86:$Vh,87:$Vi,88:$Vj,89:$Vk,90:$Vl,91:$Vm,95:$Vn,105:$Vo,106:$Vp,109:$Vq,111:$Vr,112:$Vs,116:47,118:$Vt,119:$Vu,120:$Vv,121:$Vw,122:$Vx,123:$Vy,124:$Vz,125:$VA,126:$VB,127:$VC},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:292,102:$Vy1,105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},{22:$Vu1,66:$Vv1,67:$Vw1,86:$Vx1,96:293,102:$Vy1,105:$Vz1,107:243,108:244,109:$VA1,110:$VB1,111:$VC1,112:$VD1,113:$VE1},o($V$,[2,64]),o($VF,[2,41]),o($V11,[2,119],{106:$VF1}),o($V11,[2,120],{106:$VF1})],
|
3019 | defaultActions: {2:[2,1],9:[2,5],10:[2,2],132:[2,7]},
|
3020 | parseError: function parseError (str, hash) {
|
3021 | if (hash.recoverable) {
|
3022 | this.trace(str);
|
3023 | } else {
|
3024 | var error = new Error(str);
|
3025 | error.hash = hash;
|
3026 | throw error;
|
3027 | }
|
3028 | },
|
3029 | parse: function parse(input) {
|
3030 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
3031 | var args = lstack.slice.call(arguments, 1);
|
3032 | var lexer = Object.create(this.lexer);
|
3033 | var sharedState = { yy: {} };
|
3034 | for (var k in this.yy) {
|
3035 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
3036 | sharedState.yy[k] = this.yy[k];
|
3037 | }
|
3038 | }
|
3039 | lexer.setInput(input, sharedState.yy);
|
3040 | sharedState.yy.lexer = lexer;
|
3041 | sharedState.yy.parser = this;
|
3042 | if (typeof lexer.yylloc == 'undefined') {
|
3043 | lexer.yylloc = {};
|
3044 | }
|
3045 | var yyloc = lexer.yylloc;
|
3046 | lstack.push(yyloc);
|
3047 | var ranges = lexer.options && lexer.options.ranges;
|
3048 | if (typeof sharedState.yy.parseError === 'function') {
|
3049 | this.parseError = sharedState.yy.parseError;
|
3050 | } else {
|
3051 | this.parseError = Object.getPrototypeOf(this).parseError;
|
3052 | }
|
3053 | function popStack(n) {
|
3054 | stack.length = stack.length - 2 * n;
|
3055 | vstack.length = vstack.length - n;
|
3056 | lstack.length = lstack.length - n;
|
3057 | }
|
3058 | function lex() {
|
3059 | var token;
|
3060 | token = tstack.pop() || lexer.lex() || EOF;
|
3061 | if (typeof token !== 'number') {
|
3062 | if (token instanceof Array) {
|
3063 | tstack = token;
|
3064 | token = tstack.pop();
|
3065 | }
|
3066 | token = self.symbols_[token] || token;
|
3067 | }
|
3068 | return token;
|
3069 | }
|
3070 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
3071 | while (true) {
|
3072 | state = stack[stack.length - 1];
|
3073 | if (this.defaultActions[state]) {
|
3074 | action = this.defaultActions[state];
|
3075 | } else {
|
3076 | if (symbol === null || typeof symbol == 'undefined') {
|
3077 | symbol = lex();
|
3078 | }
|
3079 | action = table[state] && table[state][symbol];
|
3080 | }
|
3081 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
3082 | var errStr = '';
|
3083 | expected = [];
|
3084 | for (p in table[state]) {
|
3085 | if (this.terminals_[p] && p > TERROR) {
|
3086 | expected.push('\'' + this.terminals_[p] + '\'');
|
3087 | }
|
3088 | }
|
3089 | if (lexer.showPosition) {
|
3090 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
3091 | } else {
|
3092 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
3093 | }
|
3094 | this.parseError(errStr, {
|
3095 | text: lexer.match,
|
3096 | token: this.terminals_[symbol] || symbol,
|
3097 | line: lexer.yylineno,
|
3098 | loc: yyloc,
|
3099 | expected: expected
|
3100 | });
|
3101 | }
|
3102 | if (action[0] instanceof Array && action.length > 1) {
|
3103 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
3104 | }
|
3105 | switch (action[0]) {
|
3106 | case 1:
|
3107 | stack.push(symbol);
|
3108 | vstack.push(lexer.yytext);
|
3109 | lstack.push(lexer.yylloc);
|
3110 | stack.push(action[1]);
|
3111 | symbol = null;
|
3112 | if (!preErrorSymbol) {
|
3113 | yyleng = lexer.yyleng;
|
3114 | yytext = lexer.yytext;
|
3115 | yylineno = lexer.yylineno;
|
3116 | yyloc = lexer.yylloc;
|
3117 | if (recovering > 0) {
|
3118 | recovering--;
|
3119 | }
|
3120 | } else {
|
3121 | symbol = preErrorSymbol;
|
3122 | preErrorSymbol = null;
|
3123 | }
|
3124 | break;
|
3125 | case 2:
|
3126 | len = this.productions_[action[1]][1];
|
3127 | yyval.$ = vstack[vstack.length - len];
|
3128 | yyval._$ = {
|
3129 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
3130 | last_line: lstack[lstack.length - 1].last_line,
|
3131 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
3132 | last_column: lstack[lstack.length - 1].last_column
|
3133 | };
|
3134 | if (ranges) {
|
3135 | yyval._$.range = [
|
3136 | lstack[lstack.length - (len || 1)].range[0],
|
3137 | lstack[lstack.length - 1].range[1]
|
3138 | ];
|
3139 | }
|
3140 | r = this.performAction.apply(yyval, [
|
3141 | yytext,
|
3142 | yyleng,
|
3143 | yylineno,
|
3144 | sharedState.yy,
|
3145 | action[1],
|
3146 | vstack,
|
3147 | lstack
|
3148 | ].concat(args));
|
3149 | if (typeof r !== 'undefined') {
|
3150 | return r;
|
3151 | }
|
3152 | if (len) {
|
3153 | stack = stack.slice(0, -1 * len * 2);
|
3154 | vstack = vstack.slice(0, -1 * len);
|
3155 | lstack = lstack.slice(0, -1 * len);
|
3156 | }
|
3157 | stack.push(this.productions_[action[1]][0]);
|
3158 | vstack.push(yyval.$);
|
3159 | lstack.push(yyval._$);
|
3160 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
3161 | stack.push(newState);
|
3162 | break;
|
3163 | case 3:
|
3164 | return true;
|
3165 | }
|
3166 | }
|
3167 | return true;
|
3168 | }};
|
3169 |
|
3170 |
|
3171 | var lexer = (function(){
|
3172 | var lexer = ({
|
3173 |
|
3174 | EOF:1,
|
3175 |
|
3176 | parseError:function parseError(str, hash) {
|
3177 | if (this.yy.parser) {
|
3178 | this.yy.parser.parseError(str, hash);
|
3179 | } else {
|
3180 | throw new Error(str);
|
3181 | }
|
3182 | },
|
3183 |
|
3184 |
|
3185 | setInput:function (input, yy) {
|
3186 | this.yy = yy || this.yy || {};
|
3187 | this._input = input;
|
3188 | this._more = this._backtrack = this.done = false;
|
3189 | this.yylineno = this.yyleng = 0;
|
3190 | this.yytext = this.matched = this.match = '';
|
3191 | this.conditionStack = ['INITIAL'];
|
3192 | this.yylloc = {
|
3193 | first_line: 1,
|
3194 | first_column: 0,
|
3195 | last_line: 1,
|
3196 | last_column: 0
|
3197 | };
|
3198 | if (this.options.ranges) {
|
3199 | this.yylloc.range = [0,0];
|
3200 | }
|
3201 | this.offset = 0;
|
3202 | return this;
|
3203 | },
|
3204 |
|
3205 |
|
3206 | input:function () {
|
3207 | var ch = this._input[0];
|
3208 | this.yytext += ch;
|
3209 | this.yyleng++;
|
3210 | this.offset++;
|
3211 | this.match += ch;
|
3212 | this.matched += ch;
|
3213 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
3214 | if (lines) {
|
3215 | this.yylineno++;
|
3216 | this.yylloc.last_line++;
|
3217 | } else {
|
3218 | this.yylloc.last_column++;
|
3219 | }
|
3220 | if (this.options.ranges) {
|
3221 | this.yylloc.range[1]++;
|
3222 | }
|
3223 |
|
3224 | this._input = this._input.slice(1);
|
3225 | return ch;
|
3226 | },
|
3227 |
|
3228 |
|
3229 | unput:function (ch) {
|
3230 | var len = ch.length;
|
3231 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
3232 |
|
3233 | this._input = ch + this._input;
|
3234 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
3235 |
|
3236 | this.offset -= len;
|
3237 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
3238 | this.match = this.match.substr(0, this.match.length - 1);
|
3239 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
3240 |
|
3241 | if (lines.length - 1) {
|
3242 | this.yylineno -= lines.length - 1;
|
3243 | }
|
3244 | var r = this.yylloc.range;
|
3245 |
|
3246 | this.yylloc = {
|
3247 | first_line: this.yylloc.first_line,
|
3248 | last_line: this.yylineno + 1,
|
3249 | first_column: this.yylloc.first_column,
|
3250 | last_column: lines ?
|
3251 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
3252 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
3253 | this.yylloc.first_column - len
|
3254 | };
|
3255 |
|
3256 | if (this.options.ranges) {
|
3257 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
3258 | }
|
3259 | this.yyleng = this.yytext.length;
|
3260 | return this;
|
3261 | },
|
3262 |
|
3263 |
|
3264 | more:function () {
|
3265 | this._more = true;
|
3266 | return this;
|
3267 | },
|
3268 |
|
3269 |
|
3270 | reject:function () {
|
3271 | if (this.options.backtrack_lexer) {
|
3272 | this._backtrack = true;
|
3273 | } else {
|
3274 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
|
3275 | text: "",
|
3276 | token: null,
|
3277 | line: this.yylineno
|
3278 | });
|
3279 |
|
3280 | }
|
3281 | return this;
|
3282 | },
|
3283 |
|
3284 |
|
3285 | less:function (n) {
|
3286 | this.unput(this.match.slice(n));
|
3287 | },
|
3288 |
|
3289 |
|
3290 | pastInput:function () {
|
3291 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
3292 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
3293 | },
|
3294 |
|
3295 |
|
3296 | upcomingInput:function () {
|
3297 | var next = this.match;
|
3298 | if (next.length < 20) {
|
3299 | next += this._input.substr(0, 20-next.length);
|
3300 | }
|
3301 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
3302 | },
|
3303 |
|
3304 |
|
3305 | showPosition:function () {
|
3306 | var pre = this.pastInput();
|
3307 | var c = new Array(pre.length + 1).join("-");
|
3308 | return pre + this.upcomingInput() + "\n" + c + "^";
|
3309 | },
|
3310 |
|
3311 |
|
3312 | test_match:function(match, indexed_rule) {
|
3313 | var token,
|
3314 | lines,
|
3315 | backup;
|
3316 |
|
3317 | if (this.options.backtrack_lexer) {
|
3318 |
|
3319 | backup = {
|
3320 | yylineno: this.yylineno,
|
3321 | yylloc: {
|
3322 | first_line: this.yylloc.first_line,
|
3323 | last_line: this.last_line,
|
3324 | first_column: this.yylloc.first_column,
|
3325 | last_column: this.yylloc.last_column
|
3326 | },
|
3327 | yytext: this.yytext,
|
3328 | match: this.match,
|
3329 | matches: this.matches,
|
3330 | matched: this.matched,
|
3331 | yyleng: this.yyleng,
|
3332 | offset: this.offset,
|
3333 | _more: this._more,
|
3334 | _input: this._input,
|
3335 | yy: this.yy,
|
3336 | conditionStack: this.conditionStack.slice(0),
|
3337 | done: this.done
|
3338 | };
|
3339 | if (this.options.ranges) {
|
3340 | backup.yylloc.range = this.yylloc.range.slice(0);
|
3341 | }
|
3342 | }
|
3343 |
|
3344 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
3345 | if (lines) {
|
3346 | this.yylineno += lines.length;
|
3347 | }
|
3348 | this.yylloc = {
|
3349 | first_line: this.yylloc.last_line,
|
3350 | last_line: this.yylineno + 1,
|
3351 | first_column: this.yylloc.last_column,
|
3352 | last_column: lines ?
|
3353 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
3354 | this.yylloc.last_column + match[0].length
|
3355 | };
|
3356 | this.yytext += match[0];
|
3357 | this.match += match[0];
|
3358 | this.matches = match;
|
3359 | this.yyleng = this.yytext.length;
|
3360 | if (this.options.ranges) {
|
3361 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
3362 | }
|
3363 | this._more = false;
|
3364 | this._backtrack = false;
|
3365 | this._input = this._input.slice(match[0].length);
|
3366 | this.matched += match[0];
|
3367 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
3368 | if (this.done && this._input) {
|
3369 | this.done = false;
|
3370 | }
|
3371 | if (token) {
|
3372 | return token;
|
3373 | } else if (this._backtrack) {
|
3374 |
|
3375 | for (var k in backup) {
|
3376 | this[k] = backup[k];
|
3377 | }
|
3378 | return false;
|
3379 | }
|
3380 | return false;
|
3381 | },
|
3382 |
|
3383 |
|
3384 | next:function () {
|
3385 | if (this.done) {
|
3386 | return this.EOF;
|
3387 | }
|
3388 | if (!this._input) {
|
3389 | this.done = true;
|
3390 | }
|
3391 |
|
3392 | var token,
|
3393 | match,
|
3394 | tempMatch,
|
3395 | index;
|
3396 | if (!this._more) {
|
3397 | this.yytext = '';
|
3398 | this.match = '';
|
3399 | }
|
3400 | var rules = this._currentRules();
|
3401 | for (var i = 0; i < rules.length; i++) {
|
3402 | tempMatch = this._input.match(this.rules[rules[i]]);
|
3403 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
3404 | match = tempMatch;
|
3405 | index = i;
|
3406 | if (this.options.backtrack_lexer) {
|
3407 | token = this.test_match(tempMatch, rules[i]);
|
3408 | if (token !== false) {
|
3409 | return token;
|
3410 | } else if (this._backtrack) {
|
3411 | match = false;
|
3412 | continue;
|
3413 | } else {
|
3414 |
|
3415 | return false;
|
3416 | }
|
3417 | } else if (!this.options.flex) {
|
3418 | break;
|
3419 | }
|
3420 | }
|
3421 | }
|
3422 | if (match) {
|
3423 | token = this.test_match(match, rules[index]);
|
3424 | if (token !== false) {
|
3425 | return token;
|
3426 | }
|
3427 |
|
3428 | return false;
|
3429 | }
|
3430 | if (this._input === "") {
|
3431 | return this.EOF;
|
3432 | } else {
|
3433 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
3434 | text: "",
|
3435 | token: null,
|
3436 | line: this.yylineno
|
3437 | });
|
3438 | }
|
3439 | },
|
3440 |
|
3441 |
|
3442 | lex:function lex () {
|
3443 | var r = this.next();
|
3444 | if (r) {
|
3445 | return r;
|
3446 | } else {
|
3447 | return this.lex();
|
3448 | }
|
3449 | },
|
3450 |
|
3451 |
|
3452 | begin:function begin (condition) {
|
3453 | this.conditionStack.push(condition);
|
3454 | },
|
3455 |
|
3456 |
|
3457 | popState:function popState () {
|
3458 | var n = this.conditionStack.length - 1;
|
3459 | if (n > 0) {
|
3460 | return this.conditionStack.pop();
|
3461 | } else {
|
3462 | return this.conditionStack[0];
|
3463 | }
|
3464 | },
|
3465 |
|
3466 |
|
3467 | _currentRules:function _currentRules () {
|
3468 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
3469 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
3470 | } else {
|
3471 | return this.conditions["INITIAL"].rules;
|
3472 | }
|
3473 | },
|
3474 |
|
3475 |
|
3476 | topState:function topState (n) {
|
3477 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
3478 | if (n >= 0) {
|
3479 | return this.conditionStack[n];
|
3480 | } else {
|
3481 | return "INITIAL";
|
3482 | }
|
3483 | },
|
3484 |
|
3485 |
|
3486 | pushState:function pushState (condition) {
|
3487 | this.begin(condition);
|
3488 | },
|
3489 |
|
3490 |
|
3491 | stateStackSize:function stateStackSize() {
|
3492 | return this.conditionStack.length;
|
3493 | },
|
3494 | options: {},
|
3495 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
3496 | var YYSTATE=YY_START;
|
3497 | switch($avoiding_name_collisions) {
|
3498 | case 0: this.begin('open_directive'); return 12;
|
3499 | break;
|
3500 | case 1: this.begin('type_directive'); return 13;
|
3501 | break;
|
3502 | case 2: this.popState(); this.begin('arg_directive'); return 10;
|
3503 | break;
|
3504 | case 3: this.popState(); this.popState(); return 15;
|
3505 | break;
|
3506 | case 4:return 14;
|
3507 | break;
|
3508 | case 5:
|
3509 | break;
|
3510 | case 6:
|
3511 | break;
|
3512 | case 7: this.begin("acc_title");return 44;
|
3513 | break;
|
3514 | case 8: this.popState(); return "acc_title_value";
|
3515 | break;
|
3516 | case 9: this.begin("acc_descr");return 46;
|
3517 | break;
|
3518 | case 10: this.popState(); return "acc_descr_value";
|
3519 | break;
|
3520 | case 11: this.begin("acc_descr_multiline");
|
3521 | break;
|
3522 | case 12: this.popState();
|
3523 | break;
|
3524 | case 13:return "acc_descr_multiline_value";
|
3525 | break;
|
3526 | case 14:this.begin("string");
|
3527 | break;
|
3528 | case 15:this.popState();
|
3529 | break;
|
3530 | case 16:return "STR";
|
3531 | break;
|
3532 | case 17:return 86;
|
3533 | break;
|
3534 | case 18:return 95;
|
3535 | break;
|
3536 | case 19:return 87;
|
3537 | break;
|
3538 | case 20:return 104;
|
3539 | break;
|
3540 | case 21:return 88;
|
3541 | break;
|
3542 | case 22:return 89;
|
3543 | break;
|
3544 | case 23:this.begin("href");
|
3545 | break;
|
3546 | case 24:this.popState();
|
3547 | break;
|
3548 | case 25:return 100;
|
3549 | break;
|
3550 | case 26:this.begin("callbackname");
|
3551 | break;
|
3552 | case 27:this.popState();
|
3553 | break;
|
3554 | case 28:this.popState(); this.begin("callbackargs");
|
3555 | break;
|
3556 | case 29:return 98;
|
3557 | break;
|
3558 | case 30:this.popState();
|
3559 | break;
|
3560 | case 31:return 99;
|
3561 | break;
|
3562 | case 32:this.begin("click");
|
3563 | break;
|
3564 | case 33:this.popState();
|
3565 | break;
|
3566 | case 34:return 90;
|
3567 | break;
|
3568 | case 35:if(yy.lex.firstGraph()){this.begin("dir");} return 24;
|
3569 | break;
|
3570 | case 36:if(yy.lex.firstGraph()){this.begin("dir");} return 24;
|
3571 | break;
|
3572 | case 37:return 38;
|
3573 | break;
|
3574 | case 38:return 42;
|
3575 | break;
|
3576 | case 39:return 101;
|
3577 | break;
|
3578 | case 40:return 101;
|
3579 | break;
|
3580 | case 41:return 101;
|
3581 | break;
|
3582 | case 42:return 101;
|
3583 | break;
|
3584 | case 43: this.popState(); return 25;
|
3585 | break;
|
3586 | case 44: this.popState(); return 26;
|
3587 | break;
|
3588 | case 45: this.popState(); return 26;
|
3589 | break;
|
3590 | case 46: this.popState(); return 26;
|
3591 | break;
|
3592 | case 47: this.popState(); return 26;
|
3593 | break;
|
3594 | case 48: this.popState(); return 26;
|
3595 | break;
|
3596 | case 49: this.popState(); return 26;
|
3597 | break;
|
3598 | case 50: this.popState(); return 26;
|
3599 | break;
|
3600 | case 51: this.popState(); return 26;
|
3601 | break;
|
3602 | case 52: this.popState(); return 26;
|
3603 | break;
|
3604 | case 53: this.popState(); return 26;
|
3605 | break;
|
3606 | case 54:return 118;
|
3607 | break;
|
3608 | case 55:return 119;
|
3609 | break;
|
3610 | case 56:return 120;
|
3611 | break;
|
3612 | case 57:return 121;
|
3613 | break;
|
3614 | case 58: return 105;
|
3615 | break;
|
3616 | case 59:return 111;
|
3617 | break;
|
3618 | case 60:return 53;
|
3619 | break;
|
3620 | case 61:return 67;
|
3621 | break;
|
3622 | case 62:return 52;
|
3623 | break;
|
3624 | case 63:return 20;
|
3625 | break;
|
3626 | case 64:return 106;
|
3627 | break;
|
3628 | case 65:return 126;
|
3629 | break;
|
3630 | case 66:return 82;
|
3631 | break;
|
3632 | case 67:return 82;
|
3633 | break;
|
3634 | case 68:return 82;
|
3635 | break;
|
3636 | case 69:return 81;
|
3637 | break;
|
3638 | case 70:return 81;
|
3639 | break;
|
3640 | case 71:return 81;
|
3641 | break;
|
3642 | case 72:return 59;
|
3643 | break;
|
3644 | case 73:return 60;
|
3645 | break;
|
3646 | case 74:return 61;
|
3647 | break;
|
3648 | case 75:return 62;
|
3649 | break;
|
3650 | case 76:return 63;
|
3651 | break;
|
3652 | case 77:return 64;
|
3653 | break;
|
3654 | case 78:return 65;
|
3655 | break;
|
3656 | case 79:return 69;
|
3657 | break;
|
3658 | case 80:return 70;
|
3659 | break;
|
3660 | case 81:return 55;
|
3661 | break;
|
3662 | case 82:return 56;
|
3663 | break;
|
3664 | case 83:return 109;
|
3665 | break;
|
3666 | case 84:return 112;
|
3667 | break;
|
3668 | case 85:return 127;
|
3669 | break;
|
3670 | case 86:return 124;
|
3671 | break;
|
3672 | case 87:return 113;
|
3673 | break;
|
3674 | case 88:return 125;
|
3675 | break;
|
3676 | case 89:return 125;
|
3677 | break;
|
3678 | case 90:return 114;
|
3679 | break;
|
3680 | case 91:return 73;
|
3681 | break;
|
3682 | case 92:return 92;
|
3683 | break;
|
3684 | case 93:return 'SEP';
|
3685 | break;
|
3686 | case 94:return 91;
|
3687 | break;
|
3688 | case 95:return 66;
|
3689 | break;
|
3690 | case 96:return 75;
|
3691 | break;
|
3692 | case 97:return 74;
|
3693 | break;
|
3694 | case 98:return 77;
|
3695 | break;
|
3696 | case 99:return 76;
|
3697 | break;
|
3698 | case 100:return 122;
|
3699 | break;
|
3700 | case 101:return 123;
|
3701 | break;
|
3702 | case 102:return 68;
|
3703 | break;
|
3704 | case 103:return 57;
|
3705 | break;
|
3706 | case 104:return 58;
|
3707 | break;
|
3708 | case 105:return 40;
|
3709 | break;
|
3710 | case 106:return 41;
|
3711 | break;
|
3712 | case 107:return 71
|
3713 | break;
|
3714 | case 108:return 72
|
3715 | break;
|
3716 | case 109:return 133;
|
3717 | break;
|
3718 | case 110:return 21;
|
3719 | break;
|
3720 | case 111:return 22;
|
3721 | break;
|
3722 | case 112:return 23;
|
3723 | break;
|
3724 | }
|
3725 | },
|
3726 | rules: [/^(?:%%\{)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)[^\n]*)/,/^(?:[^\}]%%[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:style\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:href[\s]+["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:click[\s]+)/,/^(?:[\s\n])/,/^(?:[^\s\n]*)/,/^(?:graph\b)/,/^(?:flowchart\b)/,/^(?:subgraph\b)/,/^(?:end\b\s*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:(\r?\n)*\s*\n)/,/^(?:\s*LR\b)/,/^(?:\s*RL\b)/,/^(?:\s*TB\b)/,/^(?:\s*BT\b)/,/^(?:\s*TD\b)/,/^(?:\s*BR\b)/,/^(?:\s*<)/,/^(?:\s*>)/,/^(?:\s*\^)/,/^(?:\s*v\b)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\[)/,/^(?:\]\))/,/^(?:\[\[)/,/^(?:\]\])/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\])/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:-)/,/^(?:\.)/,/^(?:[\_])/,/^(?:\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:<)/,/^(?:>)/,/^(?:\^)/,/^(?:\\\|)/,/^(?:v\b)/,/^(?:[A-Za-z]+)/,/^(?:\\\])/,/^(?:\[\/)/,/^(?:\/\])/,/^(?:\[\\)/,/^(?:[!"#$%&'*+,-.`?\\_/])/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:")/,/^(?:(\r?\n)+)/,/^(?:\s)/,/^(?:$)/],
|
3727 | conditions: {"close_directive":{"rules":[],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"open_directive":{"rules":[1],"inclusive":false},"callbackargs":{"rules":[30,31],"inclusive":false},"callbackname":{"rules":[27,28,29],"inclusive":false},"href":{"rules":[24,25],"inclusive":false},"click":{"rules":[33,34],"inclusive":false},"vertex":{"rules":[],"inclusive":false},"dir":{"rules":[43,44,45,46,47,48,49,50,51,52,53],"inclusive":false},"acc_descr_multiline":{"rules":[12,13],"inclusive":false},"acc_descr":{"rules":[10],"inclusive":false},"acc_title":{"rules":[8],"inclusive":false},"string":{"rules":[15,16],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,9,11,14,17,18,19,20,21,22,23,26,32,35,36,37,38,39,40,41,42,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112],"inclusive":true}}
|
3728 | });
|
3729 | return lexer;
|
3730 | })();
|
3731 | parser.lexer = lexer;
|
3732 | function Parser () {
|
3733 | this.yy = {};
|
3734 | }
|
3735 | Parser.prototype = parser;parser.Parser = Parser;
|
3736 | return new Parser;
|
3737 | })();
|
3738 |
|
3739 |
|
3740 | if (true) {
|
3741 | exports.parser = parser;
|
3742 | exports.Parser = parser.Parser;
|
3743 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
3744 | exports.main = function commonjsMain (args) {
|
3745 | if (!args[1]) {
|
3746 | console.log('Usage: '+args[0]+' FILE');
|
3747 | process.exit(1);
|
3748 | }
|
3749 | var source = (__webpack_require__(/*! fs */ "?dbae").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
|
3750 | return exports.parser.parse(source);
|
3751 | };
|
3752 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
3753 | exports.main(process.argv.slice(1));
|
3754 | }
|
3755 | }
|
3756 |
|
3757 | /***/ }),
|
3758 |
|
3759 | /***/ "./src/diagrams/gantt/parser/gantt.jison":
|
3760 | /*!***********************************************!*\
|
3761 | !*** ./src/diagrams/gantt/parser/gantt.jison ***!
|
3762 | \***********************************************/
|
3763 | /***/ ((module, exports, __webpack_require__) => {
|
3764 |
|
3765 | /* module decorator */ module = __webpack_require__.nmd(module);
|
3766 | /* parser generated by jison 0.4.18 */
|
3767 | /*
|
3768 | Returns a Parser object of the following structure:
|
3769 |
|
3770 | Parser: {
|
3771 | yy: {}
|
3772 | }
|
3773 |
|
3774 | Parser.prototype: {
|
3775 | yy: {},
|
3776 | trace: function(),
|
3777 | symbols_: {associative list: name ==> number},
|
3778 | terminals_: {associative list: number ==> name},
|
3779 | productions_: [...],
|
3780 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
3781 | table: [...],
|
3782 | defaultActions: {...},
|
3783 | parseError: function(str, hash),
|
3784 | parse: function(input),
|
3785 |
|
3786 | lexer: {
|
3787 | EOF: 1,
|
3788 | parseError: function(str, hash),
|
3789 | setInput: function(input),
|
3790 | input: function(),
|
3791 | unput: function(str),
|
3792 | more: function(),
|
3793 | less: function(n),
|
3794 | pastInput: function(),
|
3795 | upcomingInput: function(),
|
3796 | showPosition: function(),
|
3797 | test_match: function(regex_match_array, rule_index),
|
3798 | next: function(),
|
3799 | lex: function(),
|
3800 | begin: function(condition),
|
3801 | popState: function(),
|
3802 | _currentRules: function(),
|
3803 | topState: function(),
|
3804 | pushState: function(condition),
|
3805 |
|
3806 | options: {
|
3807 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
3808 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
3809 | backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
|
3810 | },
|
3811 |
|
3812 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
3813 | rules: [...],
|
3814 | conditions: {associative list: name ==> set},
|
3815 | }
|
3816 | }
|
3817 |
|
3818 |
|
3819 | token location info (@$, _$, etc.): {
|
3820 | first_line: n,
|
3821 | last_line: n,
|
3822 | first_column: n,
|
3823 | last_column: n,
|
3824 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
3825 | }
|
3826 |
|
3827 |
|
3828 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
3829 | text: (matched text)
|
3830 | token: (the produced terminal token, if any)
|
3831 | line: (yylineno)
|
3832 | }
|
3833 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
3834 | loc: (yylloc)
|
3835 | expected: (string describing the set of expected tokens)
|
3836 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
3837 | }
|
3838 | */
|
3839 | var parser = (function(){
|
3840 | var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,3],$V1=[1,5],$V2=[7,9,11,12,13,14,15,16,17,18,19,20,22,24,25,27,34,39],$V3=[1,15],$V4=[1,16],$V5=[1,17],$V6=[1,18],$V7=[1,19],$V8=[1,20],$V9=[1,21],$Va=[1,22],$Vb=[1,23],$Vc=[1,24],$Vd=[1,25],$Ve=[1,26],$Vf=[1,28],$Vg=[1,30],$Vh=[1,33],$Vi=[5,7,9,11,12,13,14,15,16,17,18,19,20,22,24,25,27,34,39];
|
3841 | var parser = {trace: function trace () { },
|
3842 | yy: {},
|
3843 | symbols_: {"error":2,"start":3,"directive":4,"gantt":5,"document":6,"EOF":7,"line":8,"SPACE":9,"statement":10,"NL":11,"dateFormat":12,"inclusiveEndDates":13,"topAxis":14,"axisFormat":15,"excludes":16,"includes":17,"todayMarker":18,"title":19,"acc_title":20,"acc_title_value":21,"acc_descr":22,"acc_descr_value":23,"acc_descr_multiline_value":24,"section":25,"clickStatement":26,"taskTxt":27,"taskData":28,"openDirective":29,"typeDirective":30,"closeDirective":31,":":32,"argDirective":33,"click":34,"callbackname":35,"callbackargs":36,"href":37,"clickStatementDebug":38,"open_directive":39,"type_directive":40,"arg_directive":41,"close_directive":42,"$accept":0,"$end":1},
|
3844 | terminals_: {2:"error",5:"gantt",7:"EOF",9:"SPACE",11:"NL",12:"dateFormat",13:"inclusiveEndDates",14:"topAxis",15:"axisFormat",16:"excludes",17:"includes",18:"todayMarker",19:"title",20:"acc_title",21:"acc_title_value",22:"acc_descr",23:"acc_descr_value",24:"acc_descr_multiline_value",25:"section",27:"taskTxt",28:"taskData",32:":",34:"click",35:"callbackname",36:"callbackargs",37:"href",39:"open_directive",40:"type_directive",41:"arg_directive",42:"close_directive"},
|
3845 | productions_: [0,[3,2],[3,3],[6,0],[6,2],[8,2],[8,1],[8,1],[8,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[10,1],[10,1],[10,2],[10,1],[4,4],[4,6],[26,2],[26,3],[26,3],[26,4],[26,3],[26,4],[26,2],[38,2],[38,3],[38,3],[38,4],[38,3],[38,4],[38,2],[29,1],[30,1],[33,1],[31,1]],
|
3846 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
3847 | /* this == yyval */
|
3848 |
|
3849 | var $0 = $$.length - 1;
|
3850 | switch (yystate) {
|
3851 | case 2:
|
3852 | return $$[$0-1];
|
3853 | break;
|
3854 | case 3:
|
3855 | this.$ = []
|
3856 | break;
|
3857 | case 4:
|
3858 | $$[$0-1].push($$[$0]);this.$ = $$[$0-1]
|
3859 | break;
|
3860 | case 5: case 6:
|
3861 | this.$ = $$[$0]
|
3862 | break;
|
3863 | case 7: case 8:
|
3864 | this.$=[];
|
3865 | break;
|
3866 | case 9:
|
3867 | yy.setDateFormat($$[$0].substr(11));this.$=$$[$0].substr(11);
|
3868 | break;
|
3869 | case 10:
|
3870 | yy.enableInclusiveEndDates();this.$=$$[$0].substr(18);
|
3871 | break;
|
3872 | case 11:
|
3873 | yy.TopAxis();this.$=$$[$0].substr(8);
|
3874 | break;
|
3875 | case 12:
|
3876 | yy.setAxisFormat($$[$0].substr(11));this.$=$$[$0].substr(11);
|
3877 | break;
|
3878 | case 13:
|
3879 | yy.setExcludes($$[$0].substr(9));this.$=$$[$0].substr(9);
|
3880 | break;
|
3881 | case 14:
|
3882 | yy.setIncludes($$[$0].substr(9));this.$=$$[$0].substr(9);
|
3883 | break;
|
3884 | case 15:
|
3885 | yy.setTodayMarker($$[$0].substr(12));this.$=$$[$0].substr(12);
|
3886 | break;
|
3887 | case 16:
|
3888 | yy.setDiagramTitle($$[$0].substr(6));this.$=$$[$0].substr(6);
|
3889 | break;
|
3890 | case 17:
|
3891 | this.$=$$[$0].trim();yy.setAccTitle(this.$);
|
3892 | break;
|
3893 | case 18: case 19:
|
3894 | this.$=$$[$0].trim();yy.setAccDescription(this.$);
|
3895 | break;
|
3896 | case 20:
|
3897 | yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8);
|
3898 | break;
|
3899 | case 22:
|
3900 | yy.addTask($$[$0-1],$$[$0]);this.$='task';
|
3901 | break;
|
3902 | case 26:
|
3903 | this.$ = $$[$0-1];yy.setClickEvent($$[$0-1], $$[$0], null);
|
3904 | break;
|
3905 | case 27:
|
3906 | this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]);
|
3907 | break;
|
3908 | case 28:
|
3909 | this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], null);yy.setLink($$[$0-2],$$[$0]);
|
3910 | break;
|
3911 | case 29:
|
3912 | this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-2], $$[$0-1]);yy.setLink($$[$0-3],$$[$0]);
|
3913 | break;
|
3914 | case 30:
|
3915 | this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0], null);yy.setLink($$[$0-2],$$[$0-1]);
|
3916 | break;
|
3917 | case 31:
|
3918 | this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-1], $$[$0]);yy.setLink($$[$0-3],$$[$0-2]);
|
3919 | break;
|
3920 | case 32:
|
3921 | this.$ = $$[$0-1];yy.setLink($$[$0-1], $$[$0]);
|
3922 | break;
|
3923 | case 33: case 39:
|
3924 | this.$=$$[$0-1] + ' ' + $$[$0];
|
3925 | break;
|
3926 | case 34: case 35: case 37:
|
3927 | this.$=$$[$0-2] + ' ' + $$[$0-1] + ' ' + $$[$0];
|
3928 | break;
|
3929 | case 36: case 38:
|
3930 | this.$=$$[$0-3] + ' ' + $$[$0-2] + ' ' + $$[$0-1] + ' ' + $$[$0];
|
3931 | break;
|
3932 | case 40:
|
3933 | yy.parseDirective('%%{', 'open_directive');
|
3934 | break;
|
3935 | case 41:
|
3936 | yy.parseDirective($$[$0], 'type_directive');
|
3937 | break;
|
3938 | case 42:
|
3939 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
3940 | break;
|
3941 | case 43:
|
3942 | yy.parseDirective('}%%', 'close_directive', 'gantt');
|
3943 | break;
|
3944 | }
|
3945 | },
|
3946 | table: [{3:1,4:2,5:$V0,29:4,39:$V1},{1:[3]},{3:6,4:2,5:$V0,29:4,39:$V1},o($V2,[2,3],{6:7}),{30:8,40:[1,9]},{40:[2,40]},{1:[2,1]},{4:29,7:[1,10],8:11,9:[1,12],10:13,11:[1,14],12:$V3,13:$V4,14:$V5,15:$V6,16:$V7,17:$V8,18:$V9,19:$Va,20:$Vb,22:$Vc,24:$Vd,25:$Ve,26:27,27:$Vf,29:4,34:$Vg,39:$V1},{31:31,32:[1,32],42:$Vh},o([32,42],[2,41]),o($V2,[2,8],{1:[2,2]}),o($V2,[2,4]),{4:29,10:34,12:$V3,13:$V4,14:$V5,15:$V6,16:$V7,17:$V8,18:$V9,19:$Va,20:$Vb,22:$Vc,24:$Vd,25:$Ve,26:27,27:$Vf,29:4,34:$Vg,39:$V1},o($V2,[2,6]),o($V2,[2,7]),o($V2,[2,9]),o($V2,[2,10]),o($V2,[2,11]),o($V2,[2,12]),o($V2,[2,13]),o($V2,[2,14]),o($V2,[2,15]),o($V2,[2,16]),{21:[1,35]},{23:[1,36]},o($V2,[2,19]),o($V2,[2,20]),o($V2,[2,21]),{28:[1,37]},o($V2,[2,23]),{35:[1,38],37:[1,39]},{11:[1,40]},{33:41,41:[1,42]},{11:[2,43]},o($V2,[2,5]),o($V2,[2,17]),o($V2,[2,18]),o($V2,[2,22]),o($V2,[2,26],{36:[1,43],37:[1,44]}),o($V2,[2,32],{35:[1,45]}),o($Vi,[2,24]),{31:46,42:$Vh},{42:[2,42]},o($V2,[2,27],{37:[1,47]}),o($V2,[2,28]),o($V2,[2,30],{36:[1,48]}),{11:[1,49]},o($V2,[2,29]),o($V2,[2,31]),o($Vi,[2,25])],
|
3947 | defaultActions: {5:[2,40],6:[2,1],33:[2,43],42:[2,42]},
|
3948 | parseError: function parseError (str, hash) {
|
3949 | if (hash.recoverable) {
|
3950 | this.trace(str);
|
3951 | } else {
|
3952 | var error = new Error(str);
|
3953 | error.hash = hash;
|
3954 | throw error;
|
3955 | }
|
3956 | },
|
3957 | parse: function parse(input) {
|
3958 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
3959 | var args = lstack.slice.call(arguments, 1);
|
3960 | var lexer = Object.create(this.lexer);
|
3961 | var sharedState = { yy: {} };
|
3962 | for (var k in this.yy) {
|
3963 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
3964 | sharedState.yy[k] = this.yy[k];
|
3965 | }
|
3966 | }
|
3967 | lexer.setInput(input, sharedState.yy);
|
3968 | sharedState.yy.lexer = lexer;
|
3969 | sharedState.yy.parser = this;
|
3970 | if (typeof lexer.yylloc == 'undefined') {
|
3971 | lexer.yylloc = {};
|
3972 | }
|
3973 | var yyloc = lexer.yylloc;
|
3974 | lstack.push(yyloc);
|
3975 | var ranges = lexer.options && lexer.options.ranges;
|
3976 | if (typeof sharedState.yy.parseError === 'function') {
|
3977 | this.parseError = sharedState.yy.parseError;
|
3978 | } else {
|
3979 | this.parseError = Object.getPrototypeOf(this).parseError;
|
3980 | }
|
3981 | function popStack(n) {
|
3982 | stack.length = stack.length - 2 * n;
|
3983 | vstack.length = vstack.length - n;
|
3984 | lstack.length = lstack.length - n;
|
3985 | }
|
3986 | function lex() {
|
3987 | var token;
|
3988 | token = tstack.pop() || lexer.lex() || EOF;
|
3989 | if (typeof token !== 'number') {
|
3990 | if (token instanceof Array) {
|
3991 | tstack = token;
|
3992 | token = tstack.pop();
|
3993 | }
|
3994 | token = self.symbols_[token] || token;
|
3995 | }
|
3996 | return token;
|
3997 | }
|
3998 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
3999 | while (true) {
|
4000 | state = stack[stack.length - 1];
|
4001 | if (this.defaultActions[state]) {
|
4002 | action = this.defaultActions[state];
|
4003 | } else {
|
4004 | if (symbol === null || typeof symbol == 'undefined') {
|
4005 | symbol = lex();
|
4006 | }
|
4007 | action = table[state] && table[state][symbol];
|
4008 | }
|
4009 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
4010 | var errStr = '';
|
4011 | expected = [];
|
4012 | for (p in table[state]) {
|
4013 | if (this.terminals_[p] && p > TERROR) {
|
4014 | expected.push('\'' + this.terminals_[p] + '\'');
|
4015 | }
|
4016 | }
|
4017 | if (lexer.showPosition) {
|
4018 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
4019 | } else {
|
4020 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
4021 | }
|
4022 | this.parseError(errStr, {
|
4023 | text: lexer.match,
|
4024 | token: this.terminals_[symbol] || symbol,
|
4025 | line: lexer.yylineno,
|
4026 | loc: yyloc,
|
4027 | expected: expected
|
4028 | });
|
4029 | }
|
4030 | if (action[0] instanceof Array && action.length > 1) {
|
4031 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
4032 | }
|
4033 | switch (action[0]) {
|
4034 | case 1:
|
4035 | stack.push(symbol);
|
4036 | vstack.push(lexer.yytext);
|
4037 | lstack.push(lexer.yylloc);
|
4038 | stack.push(action[1]);
|
4039 | symbol = null;
|
4040 | if (!preErrorSymbol) {
|
4041 | yyleng = lexer.yyleng;
|
4042 | yytext = lexer.yytext;
|
4043 | yylineno = lexer.yylineno;
|
4044 | yyloc = lexer.yylloc;
|
4045 | if (recovering > 0) {
|
4046 | recovering--;
|
4047 | }
|
4048 | } else {
|
4049 | symbol = preErrorSymbol;
|
4050 | preErrorSymbol = null;
|
4051 | }
|
4052 | break;
|
4053 | case 2:
|
4054 | len = this.productions_[action[1]][1];
|
4055 | yyval.$ = vstack[vstack.length - len];
|
4056 | yyval._$ = {
|
4057 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
4058 | last_line: lstack[lstack.length - 1].last_line,
|
4059 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
4060 | last_column: lstack[lstack.length - 1].last_column
|
4061 | };
|
4062 | if (ranges) {
|
4063 | yyval._$.range = [
|
4064 | lstack[lstack.length - (len || 1)].range[0],
|
4065 | lstack[lstack.length - 1].range[1]
|
4066 | ];
|
4067 | }
|
4068 | r = this.performAction.apply(yyval, [
|
4069 | yytext,
|
4070 | yyleng,
|
4071 | yylineno,
|
4072 | sharedState.yy,
|
4073 | action[1],
|
4074 | vstack,
|
4075 | lstack
|
4076 | ].concat(args));
|
4077 | if (typeof r !== 'undefined') {
|
4078 | return r;
|
4079 | }
|
4080 | if (len) {
|
4081 | stack = stack.slice(0, -1 * len * 2);
|
4082 | vstack = vstack.slice(0, -1 * len);
|
4083 | lstack = lstack.slice(0, -1 * len);
|
4084 | }
|
4085 | stack.push(this.productions_[action[1]][0]);
|
4086 | vstack.push(yyval.$);
|
4087 | lstack.push(yyval._$);
|
4088 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
4089 | stack.push(newState);
|
4090 | break;
|
4091 | case 3:
|
4092 | return true;
|
4093 | }
|
4094 | }
|
4095 | return true;
|
4096 | }};
|
4097 |
|
4098 | /* generated by jison-lex 0.3.4 */
|
4099 | var lexer = (function(){
|
4100 | var lexer = ({
|
4101 |
|
4102 | EOF:1,
|
4103 |
|
4104 | parseError:function parseError(str, hash) {
|
4105 | if (this.yy.parser) {
|
4106 | this.yy.parser.parseError(str, hash);
|
4107 | } else {
|
4108 | throw new Error(str);
|
4109 | }
|
4110 | },
|
4111 |
|
4112 | // resets the lexer, sets new input
|
4113 | setInput:function (input, yy) {
|
4114 | this.yy = yy || this.yy || {};
|
4115 | this._input = input;
|
4116 | this._more = this._backtrack = this.done = false;
|
4117 | this.yylineno = this.yyleng = 0;
|
4118 | this.yytext = this.matched = this.match = '';
|
4119 | this.conditionStack = ['INITIAL'];
|
4120 | this.yylloc = {
|
4121 | first_line: 1,
|
4122 | first_column: 0,
|
4123 | last_line: 1,
|
4124 | last_column: 0
|
4125 | };
|
4126 | if (this.options.ranges) {
|
4127 | this.yylloc.range = [0,0];
|
4128 | }
|
4129 | this.offset = 0;
|
4130 | return this;
|
4131 | },
|
4132 |
|
4133 | // consumes and returns one char from the input
|
4134 | input:function () {
|
4135 | var ch = this._input[0];
|
4136 | this.yytext += ch;
|
4137 | this.yyleng++;
|
4138 | this.offset++;
|
4139 | this.match += ch;
|
4140 | this.matched += ch;
|
4141 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
4142 | if (lines) {
|
4143 | this.yylineno++;
|
4144 | this.yylloc.last_line++;
|
4145 | } else {
|
4146 | this.yylloc.last_column++;
|
4147 | }
|
4148 | if (this.options.ranges) {
|
4149 | this.yylloc.range[1]++;
|
4150 | }
|
4151 |
|
4152 | this._input = this._input.slice(1);
|
4153 | return ch;
|
4154 | },
|
4155 |
|
4156 | // unshifts one char (or a string) into the input
|
4157 | unput:function (ch) {
|
4158 | var len = ch.length;
|
4159 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
4160 |
|
4161 | this._input = ch + this._input;
|
4162 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
4163 | //this.yyleng -= len;
|
4164 | this.offset -= len;
|
4165 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
4166 | this.match = this.match.substr(0, this.match.length - 1);
|
4167 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
4168 |
|
4169 | if (lines.length - 1) {
|
4170 | this.yylineno -= lines.length - 1;
|
4171 | }
|
4172 | var r = this.yylloc.range;
|
4173 |
|
4174 | this.yylloc = {
|
4175 | first_line: this.yylloc.first_line,
|
4176 | last_line: this.yylineno + 1,
|
4177 | first_column: this.yylloc.first_column,
|
4178 | last_column: lines ?
|
4179 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
4180 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
4181 | this.yylloc.first_column - len
|
4182 | };
|
4183 |
|
4184 | if (this.options.ranges) {
|
4185 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
4186 | }
|
4187 | this.yyleng = this.yytext.length;
|
4188 | return this;
|
4189 | },
|
4190 |
|
4191 | // When called from action, caches matched text and appends it on next action
|
4192 | more:function () {
|
4193 | this._more = true;
|
4194 | return this;
|
4195 | },
|
4196 |
|
4197 | // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
|
4198 | reject:function () {
|
4199 | if (this.options.backtrack_lexer) {
|
4200 | this._backtrack = true;
|
4201 | } else {
|
4202 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
|
4203 | text: "",
|
4204 | token: null,
|
4205 | line: this.yylineno
|
4206 | });
|
4207 |
|
4208 | }
|
4209 | return this;
|
4210 | },
|
4211 |
|
4212 | // retain first n characters of the match
|
4213 | less:function (n) {
|
4214 | this.unput(this.match.slice(n));
|
4215 | },
|
4216 |
|
4217 | // displays already matched input, i.e. for error messages
|
4218 | pastInput:function () {
|
4219 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
4220 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
4221 | },
|
4222 |
|
4223 | // displays upcoming input, i.e. for error messages
|
4224 | upcomingInput:function () {
|
4225 | var next = this.match;
|
4226 | if (next.length < 20) {
|
4227 | next += this._input.substr(0, 20-next.length);
|
4228 | }
|
4229 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
4230 | },
|
4231 |
|
4232 | // displays the character position where the lexing error occurred, i.e. for error messages
|
4233 | showPosition:function () {
|
4234 | var pre = this.pastInput();
|
4235 | var c = new Array(pre.length + 1).join("-");
|
4236 | return pre + this.upcomingInput() + "\n" + c + "^";
|
4237 | },
|
4238 |
|
4239 | // test the lexed token: return FALSE when not a match, otherwise return token
|
4240 | test_match:function(match, indexed_rule) {
|
4241 | var token,
|
4242 | lines,
|
4243 | backup;
|
4244 |
|
4245 | if (this.options.backtrack_lexer) {
|
4246 | // save context
|
4247 | backup = {
|
4248 | yylineno: this.yylineno,
|
4249 | yylloc: {
|
4250 | first_line: this.yylloc.first_line,
|
4251 | last_line: this.last_line,
|
4252 | first_column: this.yylloc.first_column,
|
4253 | last_column: this.yylloc.last_column
|
4254 | },
|
4255 | yytext: this.yytext,
|
4256 | match: this.match,
|
4257 | matches: this.matches,
|
4258 | matched: this.matched,
|
4259 | yyleng: this.yyleng,
|
4260 | offset: this.offset,
|
4261 | _more: this._more,
|
4262 | _input: this._input,
|
4263 | yy: this.yy,
|
4264 | conditionStack: this.conditionStack.slice(0),
|
4265 | done: this.done
|
4266 | };
|
4267 | if (this.options.ranges) {
|
4268 | backup.yylloc.range = this.yylloc.range.slice(0);
|
4269 | }
|
4270 | }
|
4271 |
|
4272 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
4273 | if (lines) {
|
4274 | this.yylineno += lines.length;
|
4275 | }
|
4276 | this.yylloc = {
|
4277 | first_line: this.yylloc.last_line,
|
4278 | last_line: this.yylineno + 1,
|
4279 | first_column: this.yylloc.last_column,
|
4280 | last_column: lines ?
|
4281 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
4282 | this.yylloc.last_column + match[0].length
|
4283 | };
|
4284 | this.yytext += match[0];
|
4285 | this.match += match[0];
|
4286 | this.matches = match;
|
4287 | this.yyleng = this.yytext.length;
|
4288 | if (this.options.ranges) {
|
4289 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
4290 | }
|
4291 | this._more = false;
|
4292 | this._backtrack = false;
|
4293 | this._input = this._input.slice(match[0].length);
|
4294 | this.matched += match[0];
|
4295 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
4296 | if (this.done && this._input) {
|
4297 | this.done = false;
|
4298 | }
|
4299 | if (token) {
|
4300 | return token;
|
4301 | } else if (this._backtrack) {
|
4302 | // recover context
|
4303 | for (var k in backup) {
|
4304 | this[k] = backup[k];
|
4305 | }
|
4306 | return false; // rule action called reject() implying the next rule should be tested instead.
|
4307 | }
|
4308 | return false;
|
4309 | },
|
4310 |
|
4311 | // return next match in input
|
4312 | next:function () {
|
4313 | if (this.done) {
|
4314 | return this.EOF;
|
4315 | }
|
4316 | if (!this._input) {
|
4317 | this.done = true;
|
4318 | }
|
4319 |
|
4320 | var token,
|
4321 | match,
|
4322 | tempMatch,
|
4323 | index;
|
4324 | if (!this._more) {
|
4325 | this.yytext = '';
|
4326 | this.match = '';
|
4327 | }
|
4328 | var rules = this._currentRules();
|
4329 | for (var i = 0; i < rules.length; i++) {
|
4330 | tempMatch = this._input.match(this.rules[rules[i]]);
|
4331 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
4332 | match = tempMatch;
|
4333 | index = i;
|
4334 | if (this.options.backtrack_lexer) {
|
4335 | token = this.test_match(tempMatch, rules[i]);
|
4336 | if (token !== false) {
|
4337 | return token;
|
4338 | } else if (this._backtrack) {
|
4339 | match = false;
|
4340 | continue; // rule action called reject() implying a rule MISmatch.
|
4341 | } else {
|
4342 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
4343 | return false;
|
4344 | }
|
4345 | } else if (!this.options.flex) {
|
4346 | break;
|
4347 | }
|
4348 | }
|
4349 | }
|
4350 | if (match) {
|
4351 | token = this.test_match(match, rules[index]);
|
4352 | if (token !== false) {
|
4353 | return token;
|
4354 | }
|
4355 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
4356 | return false;
|
4357 | }
|
4358 | if (this._input === "") {
|
4359 | return this.EOF;
|
4360 | } else {
|
4361 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
4362 | text: "",
|
4363 | token: null,
|
4364 | line: this.yylineno
|
4365 | });
|
4366 | }
|
4367 | },
|
4368 |
|
4369 | // return next match that has a token
|
4370 | lex:function lex () {
|
4371 | var r = this.next();
|
4372 | if (r) {
|
4373 | return r;
|
4374 | } else {
|
4375 | return this.lex();
|
4376 | }
|
4377 | },
|
4378 |
|
4379 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
4380 | begin:function begin (condition) {
|
4381 | this.conditionStack.push(condition);
|
4382 | },
|
4383 |
|
4384 | // pop the previously active lexer condition state off the condition stack
|
4385 | popState:function popState () {
|
4386 | var n = this.conditionStack.length - 1;
|
4387 | if (n > 0) {
|
4388 | return this.conditionStack.pop();
|
4389 | } else {
|
4390 | return this.conditionStack[0];
|
4391 | }
|
4392 | },
|
4393 |
|
4394 | // produce the lexer rule set which is active for the currently active lexer condition state
|
4395 | _currentRules:function _currentRules () {
|
4396 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
4397 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
4398 | } else {
|
4399 | return this.conditions["INITIAL"].rules;
|
4400 | }
|
4401 | },
|
4402 |
|
4403 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
4404 | topState:function topState (n) {
|
4405 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
4406 | if (n >= 0) {
|
4407 | return this.conditionStack[n];
|
4408 | } else {
|
4409 | return "INITIAL";
|
4410 | }
|
4411 | },
|
4412 |
|
4413 | // alias for begin(condition)
|
4414 | pushState:function pushState (condition) {
|
4415 | this.begin(condition);
|
4416 | },
|
4417 |
|
4418 | // return the number of states currently on the stack
|
4419 | stateStackSize:function stateStackSize() {
|
4420 | return this.conditionStack.length;
|
4421 | },
|
4422 | options: {"case-insensitive":true},
|
4423 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
4424 | var YYSTATE=YY_START;
|
4425 | switch($avoiding_name_collisions) {
|
4426 | case 0: this.begin('open_directive'); return 39;
|
4427 | break;
|
4428 | case 1: this.begin('type_directive'); return 40;
|
4429 | break;
|
4430 | case 2: this.popState(); this.begin('arg_directive'); return 32;
|
4431 | break;
|
4432 | case 3: this.popState(); this.popState(); return 42;
|
4433 | break;
|
4434 | case 4:return 41;
|
4435 | break;
|
4436 | case 5: this.begin("acc_title");return 20;
|
4437 | break;
|
4438 | case 6: this.popState(); return "acc_title_value";
|
4439 | break;
|
4440 | case 7: this.begin("acc_descr");return 22;
|
4441 | break;
|
4442 | case 8: this.popState(); return "acc_descr_value";
|
4443 | break;
|
4444 | case 9: this.begin("acc_descr_multiline");
|
4445 | break;
|
4446 | case 10: this.popState();
|
4447 | break;
|
4448 | case 11:return "acc_descr_multiline_value";
|
4449 | break;
|
4450 | case 12:/* skip comments */
|
4451 | break;
|
4452 | case 13:/* skip comments */
|
4453 | break;
|
4454 | case 14:/* do nothing */
|
4455 | break;
|
4456 | case 15:return 11;
|
4457 | break;
|
4458 | case 16:/* skip whitespace */
|
4459 | break;
|
4460 | case 17:/* skip comments */
|
4461 | break;
|
4462 | case 18:/* skip comments */
|
4463 | break;
|
4464 | case 19:this.begin("href");
|
4465 | break;
|
4466 | case 20:this.popState();
|
4467 | break;
|
4468 | case 21:return 37;
|
4469 | break;
|
4470 | case 22:this.begin("callbackname");
|
4471 | break;
|
4472 | case 23:this.popState();
|
4473 | break;
|
4474 | case 24:this.popState(); this.begin("callbackargs");
|
4475 | break;
|
4476 | case 25:return 35;
|
4477 | break;
|
4478 | case 26:this.popState();
|
4479 | break;
|
4480 | case 27:return 36;
|
4481 | break;
|
4482 | case 28:this.begin("click");
|
4483 | break;
|
4484 | case 29:this.popState();
|
4485 | break;
|
4486 | case 30:return 34;
|
4487 | break;
|
4488 | case 31:return 5;
|
4489 | break;
|
4490 | case 32:return 12;
|
4491 | break;
|
4492 | case 33:return 13;
|
4493 | break;
|
4494 | case 34:return 14;
|
4495 | break;
|
4496 | case 35:return 15;
|
4497 | break;
|
4498 | case 36:return 17;
|
4499 | break;
|
4500 | case 37:return 16;
|
4501 | break;
|
4502 | case 38:return 18;
|
4503 | break;
|
4504 | case 39:return 'date';
|
4505 | break;
|
4506 | case 40:return 19;
|
4507 | break;
|
4508 | case 41:return 'accDescription'
|
4509 | break;
|
4510 | case 42:return 25;
|
4511 | break;
|
4512 | case 43:return 27;
|
4513 | break;
|
4514 | case 44:return 28;
|
4515 | break;
|
4516 | case 45:return 32;
|
4517 | break;
|
4518 | case 46:return 7;
|
4519 | break;
|
4520 | case 47:return 'INVALID';
|
4521 | break;
|
4522 | }
|
4523 | },
|
4524 | rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:%%(?!\{)*[^\n]*)/i,/^(?:[^\}]%%*[^\n]*)/i,/^(?:%%*[^\n]*[\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:href[\s]+["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:call[\s]+)/i,/^(?:\([\s]*\))/i,/^(?:\()/i,/^(?:[^(]*)/i,/^(?:\))/i,/^(?:[^)]*)/i,/^(?:click[\s]+)/i,/^(?:[\s\n])/i,/^(?:[^\s\n]*)/i,/^(?:gantt\b)/i,/^(?:dateFormat\s[^#\n;]+)/i,/^(?:inclusiveEndDates\b)/i,/^(?:topAxis\b)/i,/^(?:axisFormat\s[^#\n;]+)/i,/^(?:includes\s[^#\n;]+)/i,/^(?:excludes\s[^#\n;]+)/i,/^(?:todayMarker\s[^\n;]+)/i,/^(?:\d\d\d\d-\d\d-\d\d\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accDescription\s[^#\n;]+)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],
|
4525 | conditions: {"acc_descr_multiline":{"rules":[10,11],"inclusive":false},"acc_descr":{"rules":[8],"inclusive":false},"acc_title":{"rules":[6],"inclusive":false},"close_directive":{"rules":[],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"open_directive":{"rules":[1],"inclusive":false},"callbackargs":{"rules":[26,27],"inclusive":false},"callbackname":{"rules":[23,24,25],"inclusive":false},"href":{"rules":[20,21],"inclusive":false},"click":{"rules":[29,30],"inclusive":false},"INITIAL":{"rules":[0,5,7,9,12,13,14,15,16,17,18,19,22,28,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],"inclusive":true}}
|
4526 | });
|
4527 | return lexer;
|
4528 | })();
|
4529 | parser.lexer = lexer;
|
4530 | function Parser () {
|
4531 | this.yy = {};
|
4532 | }
|
4533 | Parser.prototype = parser;parser.Parser = Parser;
|
4534 | return new Parser;
|
4535 | })();
|
4536 |
|
4537 |
|
4538 | if (true) {
|
4539 | exports.parser = parser;
|
4540 | exports.Parser = parser.Parser;
|
4541 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
4542 | exports.main = function commonjsMain (args) {
|
4543 | if (!args[1]) {
|
4544 | console.log('Usage: '+args[0]+' FILE');
|
4545 | process.exit(1);
|
4546 | }
|
4547 | var source = (__webpack_require__(/*! fs */ "?8ed1").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
|
4548 | return exports.parser.parse(source);
|
4549 | };
|
4550 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
4551 | exports.main(process.argv.slice(1));
|
4552 | }
|
4553 | }
|
4554 |
|
4555 | /***/ }),
|
4556 |
|
4557 | /***/ "./src/diagrams/git/parser/gitGraph.jison":
|
4558 | /*!************************************************!*\
|
4559 | !*** ./src/diagrams/git/parser/gitGraph.jison ***!
|
4560 | \************************************************/
|
4561 | /***/ ((module, exports, __webpack_require__) => {
|
4562 |
|
4563 | /* module decorator */ module = __webpack_require__.nmd(module);
|
4564 | /* parser generated by jison 0.4.18 */
|
4565 | /*
|
4566 | Returns a Parser object of the following structure:
|
4567 |
|
4568 | Parser: {
|
4569 | yy: {}
|
4570 | }
|
4571 |
|
4572 | Parser.prototype: {
|
4573 | yy: {},
|
4574 | trace: function(),
|
4575 | symbols_: {associative list: name ==> number},
|
4576 | terminals_: {associative list: number ==> name},
|
4577 | productions_: [...],
|
4578 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
4579 | table: [...],
|
4580 | defaultActions: {...},
|
4581 | parseError: function(str, hash),
|
4582 | parse: function(input),
|
4583 |
|
4584 | lexer: {
|
4585 | EOF: 1,
|
4586 | parseError: function(str, hash),
|
4587 | setInput: function(input),
|
4588 | input: function(),
|
4589 | unput: function(str),
|
4590 | more: function(),
|
4591 | less: function(n),
|
4592 | pastInput: function(),
|
4593 | upcomingInput: function(),
|
4594 | showPosition: function(),
|
4595 | test_match: function(regex_match_array, rule_index),
|
4596 | next: function(),
|
4597 | lex: function(),
|
4598 | begin: function(condition),
|
4599 | popState: function(),
|
4600 | _currentRules: function(),
|
4601 | topState: function(),
|
4602 | pushState: function(condition),
|
4603 |
|
4604 | options: {
|
4605 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
4606 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
4607 | backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
|
4608 | },
|
4609 |
|
4610 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
4611 | rules: [...],
|
4612 | conditions: {associative list: name ==> set},
|
4613 | }
|
4614 | }
|
4615 |
|
4616 |
|
4617 | token location info (@$, _$, etc.): {
|
4618 | first_line: n,
|
4619 | last_line: n,
|
4620 | first_column: n,
|
4621 | last_column: n,
|
4622 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
4623 | }
|
4624 |
|
4625 |
|
4626 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
4627 | text: (matched text)
|
4628 | token: (the produced terminal token, if any)
|
4629 | line: (yylineno)
|
4630 | }
|
4631 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
4632 | loc: (yylloc)
|
4633 | expected: (string describing the set of expected tokens)
|
4634 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
4635 | }
|
4636 | */
|
4637 | var parser = (function(){
|
4638 | var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,4],$V1=[1,7],$V2=[1,5],$V3=[1,9],$V4=[1,6],$V5=[2,6],$V6=[1,16],$V7=[6,8,14,20,22,24,25,27,29,32,35,37,49,53],$V8=[8,14,20,22,24,25,27,29,32,35,37],$V9=[8,13,14,20,22,24,25,27,29,32,35,37],$Va=[1,26],$Vb=[6,8,14,49,53],$Vc=[8,14,53],$Vd=[1,64],$Ve=[1,65],$Vf=[1,66],$Vg=[8,14,33,36,41,53];
|
4639 | var parser = {trace: function trace () { },
|
4640 | yy: {},
|
4641 | symbols_: {"error":2,"start":3,"eol":4,"directive":5,"GG":6,"document":7,"EOF":8,":":9,"DIR":10,"options":11,"body":12,"OPT":13,"NL":14,"line":15,"statement":16,"commitStatement":17,"mergeStatement":18,"cherryPickStatement":19,"acc_title":20,"acc_title_value":21,"acc_descr":22,"acc_descr_value":23,"acc_descr_multiline_value":24,"section":25,"branchStatement":26,"CHECKOUT":27,"ID":28,"BRANCH":29,"ORDER":30,"NUM":31,"CHERRY_PICK":32,"COMMIT_ID":33,"STR":34,"MERGE":35,"COMMIT_TAG":36,"COMMIT":37,"commit_arg":38,"COMMIT_TYPE":39,"commitType":40,"COMMIT_MSG":41,"NORMAL":42,"REVERSE":43,"HIGHLIGHT":44,"openDirective":45,"typeDirective":46,"closeDirective":47,"argDirective":48,"open_directive":49,"type_directive":50,"arg_directive":51,"close_directive":52,";":53,"$accept":0,"$end":1},
|
4642 | terminals_: {2:"error",6:"GG",8:"EOF",9:":",10:"DIR",13:"OPT",14:"NL",20:"acc_title",21:"acc_title_value",22:"acc_descr",23:"acc_descr_value",24:"acc_descr_multiline_value",25:"section",27:"CHECKOUT",28:"ID",29:"BRANCH",30:"ORDER",31:"NUM",32:"CHERRY_PICK",33:"COMMIT_ID",34:"STR",35:"MERGE",36:"COMMIT_TAG",37:"COMMIT",39:"COMMIT_TYPE",41:"COMMIT_MSG",42:"NORMAL",43:"REVERSE",44:"HIGHLIGHT",49:"open_directive",50:"type_directive",51:"arg_directive",52:"close_directive",53:";"},
|
4643 | productions_: [0,[3,2],[3,2],[3,3],[3,4],[3,5],[7,0],[7,2],[11,2],[11,1],[12,0],[12,2],[15,2],[15,1],[16,1],[16,1],[16,1],[16,2],[16,2],[16,1],[16,1],[16,1],[16,2],[26,2],[26,4],[19,3],[18,2],[18,4],[17,2],[17,3],[17,3],[17,5],[17,5],[17,3],[17,5],[17,5],[17,5],[17,5],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,3],[17,5],[17,5],[17,5],[17,5],[17,5],[17,5],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[38,0],[38,1],[40,1],[40,1],[40,1],[5,3],[5,5],[45,1],[46,1],[48,1],[47,1],[4,1],[4,1],[4,1]],
|
4644 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
4645 | /* this == yyval */
|
4646 |
|
4647 | var $0 = $$.length - 1;
|
4648 | switch (yystate) {
|
4649 | case 3:
|
4650 | return $$[$0];
|
4651 | break;
|
4652 | case 4:
|
4653 | return $$[$0-1];
|
4654 | break;
|
4655 | case 5:
|
4656 | yy.setDirection($$[$0-3]); return $$[$0-1];
|
4657 | break;
|
4658 | case 7:
|
4659 | yy.setOptions($$[$0-1]); this.$ = $$[$0]
|
4660 | break;
|
4661 | case 8:
|
4662 | $$[$0-1] +=$$[$0]; this.$=$$[$0-1]
|
4663 | break;
|
4664 | case 10:
|
4665 | this.$ = []
|
4666 | break;
|
4667 | case 11:
|
4668 | $$[$0-1].push($$[$0]); this.$=$$[$0-1];
|
4669 | break;
|
4670 | case 12:
|
4671 | this.$ =$$[$0-1]
|
4672 | break;
|
4673 | case 17:
|
4674 | this.$=$$[$0].trim();yy.setAccTitle(this.$);
|
4675 | break;
|
4676 | case 18: case 19:
|
4677 | this.$=$$[$0].trim();yy.setAccDescription(this.$);
|
4678 | break;
|
4679 | case 20:
|
4680 | yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8);
|
4681 | break;
|
4682 | case 22:
|
4683 | yy.checkout($$[$0])
|
4684 | break;
|
4685 | case 23:
|
4686 | yy.branch($$[$0])
|
4687 | break;
|
4688 | case 24:
|
4689 | yy.branch($$[$0-2], $$[$0])
|
4690 | break;
|
4691 | case 25:
|
4692 | yy.cherryPick($$[$0])
|
4693 | break;
|
4694 | case 26:
|
4695 | yy.merge($$[$0])
|
4696 | break;
|
4697 | case 27:
|
4698 | yy.merge($$[$0-2], $$[$0])
|
4699 | break;
|
4700 | case 28:
|
4701 | yy.commit($$[$0])
|
4702 | break;
|
4703 | case 29:
|
4704 | yy.commit('','',yy.commitType.NORMAL,$$[$0])
|
4705 | break;
|
4706 | case 30:
|
4707 | yy.commit('','',$$[$0],'')
|
4708 | break;
|
4709 | case 31:
|
4710 | yy.commit('','',$$[$0],$$[$0-2])
|
4711 | break;
|
4712 | case 32:
|
4713 | yy.commit('','',$$[$0-2],$$[$0])
|
4714 | break;
|
4715 | case 33:
|
4716 | yy.commit('',$$[$0],yy.commitType.NORMAL,'')
|
4717 | break;
|
4718 | case 34:
|
4719 | yy.commit('',$$[$0-2],yy.commitType.NORMAL,$$[$0])
|
4720 | break;
|
4721 | case 35:
|
4722 | yy.commit('',$$[$0],yy.commitType.NORMAL,$$[$0-2])
|
4723 | break;
|
4724 | case 36:
|
4725 | yy.commit('',$$[$0-2],$$[$0],'')
|
4726 | break;
|
4727 | case 37:
|
4728 | yy.commit('',$$[$0],$$[$0-2],'')
|
4729 | break;
|
4730 | case 38:
|
4731 | yy.commit('',$$[$0-4],$$[$0-2],$$[$0])
|
4732 | break;
|
4733 | case 39:
|
4734 | yy.commit('',$$[$0-4],$$[$0],$$[$0-2])
|
4735 | break;
|
4736 | case 40:
|
4737 | yy.commit('',$$[$0-2],$$[$0-4],$$[$0])
|
4738 | break;
|
4739 | case 41:
|
4740 | yy.commit('',$$[$0],$$[$0-4],$$[$0-2])
|
4741 | break;
|
4742 | case 42:
|
4743 | yy.commit('',$$[$0],$$[$0-2],$$[$0-4])
|
4744 | break;
|
4745 | case 43:
|
4746 | yy.commit('',$$[$0-2],$$[$0],$$[$0-4])
|
4747 | break;
|
4748 | case 44:
|
4749 | yy.commit($$[$0],'',yy.commitType.NORMAL,'')
|
4750 | break;
|
4751 | case 45:
|
4752 | yy.commit($$[$0],'',yy.commitType.NORMAL,$$[$0-2])
|
4753 | break;
|
4754 | case 46:
|
4755 | yy.commit($$[$0-2],'',yy.commitType.NORMAL,$$[$0])
|
4756 | break;
|
4757 | case 47:
|
4758 | yy.commit($$[$0-2],'',$$[$0],'')
|
4759 | break;
|
4760 | case 48:
|
4761 | yy.commit($$[$0],'',$$[$0-2],'')
|
4762 | break;
|
4763 | case 49:
|
4764 | yy.commit($$[$0],$$[$0-2],yy.commitType.NORMAL,'')
|
4765 | break;
|
4766 | case 50:
|
4767 | yy.commit($$[$0-2],$$[$0],yy.commitType.NORMAL,'')
|
4768 | break;
|
4769 | case 51:
|
4770 | yy.commit($$[$0-4],'',$$[$0-2],$$[$0])
|
4771 | break;
|
4772 | case 52:
|
4773 | yy.commit($$[$0-4],'',$$[$0],$$[$0-2])
|
4774 | break;
|
4775 | case 53:
|
4776 | yy.commit($$[$0-2],'',$$[$0-4],$$[$0])
|
4777 | break;
|
4778 | case 54:
|
4779 | yy.commit($$[$0],'',$$[$0-4],$$[$0-2])
|
4780 | break;
|
4781 | case 55:
|
4782 | yy.commit($$[$0],'',$$[$0-2],$$[$0-4])
|
4783 | break;
|
4784 | case 56:
|
4785 | yy.commit($$[$0-2],'',$$[$0],$$[$0-4])
|
4786 | break;
|
4787 | case 57:
|
4788 | yy.commit($$[$0-4],$$[$0],$$[$0-2],'')
|
4789 | break;
|
4790 | case 58:
|
4791 | yy.commit($$[$0-4],$$[$0-2],$$[$0],'')
|
4792 | break;
|
4793 | case 59:
|
4794 | yy.commit($$[$0-2],$$[$0],$$[$0-4],'')
|
4795 | break;
|
4796 | case 60:
|
4797 | yy.commit($$[$0],$$[$0-2],$$[$0-4],'')
|
4798 | break;
|
4799 | case 61:
|
4800 | yy.commit($$[$0],$$[$0-4],$$[$0-2],'')
|
4801 | break;
|
4802 | case 62:
|
4803 | yy.commit($$[$0-2],$$[$0-4],$$[$0],'')
|
4804 | break;
|
4805 | case 63:
|
4806 | yy.commit($$[$0-4],$$[$0],yy.commitType.NORMAL,$$[$0-2])
|
4807 | break;
|
4808 | case 64:
|
4809 | yy.commit($$[$0-4],$$[$0-2],yy.commitType.NORMAL,$$[$0])
|
4810 | break;
|
4811 | case 65:
|
4812 | yy.commit($$[$0-2],$$[$0],yy.commitType.NORMAL,$$[$0-4])
|
4813 | break;
|
4814 | case 66:
|
4815 | yy.commit($$[$0],$$[$0-2],yy.commitType.NORMAL,$$[$0-4])
|
4816 | break;
|
4817 | case 67:
|
4818 | yy.commit($$[$0],$$[$0-4],yy.commitType.NORMAL,$$[$0-2])
|
4819 | break;
|
4820 | case 68:
|
4821 | yy.commit($$[$0-2],$$[$0-4],yy.commitType.NORMAL,$$[$0])
|
4822 | break;
|
4823 | case 69:
|
4824 | yy.commit($$[$0-6],$$[$0-4],$$[$0-2],$$[$0])
|
4825 | break;
|
4826 | case 70:
|
4827 | yy.commit($$[$0-6],$$[$0-4],$$[$0],$$[$0-2])
|
4828 | break;
|
4829 | case 71:
|
4830 | yy.commit($$[$0-6],$$[$0-2],$$[$0-4],$$[$0])
|
4831 | break;
|
4832 | case 72:
|
4833 | yy.commit($$[$0-6],$$[$0],$$[$0-4],$$[$0-2])
|
4834 | break;
|
4835 | case 73:
|
4836 | yy.commit($$[$0-6],$$[$0-2],$$[$0],$$[$0-4])
|
4837 | break;
|
4838 | case 74:
|
4839 | yy.commit($$[$0-6],$$[$0],$$[$0-2],$$[$0-4])
|
4840 | break;
|
4841 | case 75:
|
4842 | yy.commit($$[$0-4],$$[$0-6],$$[$0-2],$$[$0])
|
4843 | break;
|
4844 | case 76:
|
4845 | yy.commit($$[$0-4],$$[$0-6],$$[$0],$$[$0-2])
|
4846 | break;
|
4847 | case 77:
|
4848 | yy.commit($$[$0-2],$$[$0-6],$$[$0-4],$$[$0])
|
4849 | break;
|
4850 | case 78:
|
4851 | yy.commit($$[$0],$$[$0-6],$$[$0-4],$$[$0-2])
|
4852 | break;
|
4853 | case 79:
|
4854 | yy.commit($$[$0-2],$$[$0-6],$$[$0],$$[$0-4])
|
4855 | break;
|
4856 | case 80:
|
4857 | yy.commit($$[$0],$$[$0-6],$$[$0-2],$$[$0-4])
|
4858 | break;
|
4859 | case 81:
|
4860 | yy.commit($$[$0],$$[$0-4],$$[$0-2],$$[$0-6])
|
4861 | break;
|
4862 | case 82:
|
4863 | yy.commit($$[$0-2],$$[$0-4],$$[$0],$$[$0-6])
|
4864 | break;
|
4865 | case 83:
|
4866 | yy.commit($$[$0],$$[$0-2],$$[$0-4],$$[$0-6])
|
4867 | break;
|
4868 | case 84:
|
4869 | yy.commit($$[$0-2],$$[$0],$$[$0-4],$$[$0-6])
|
4870 | break;
|
4871 | case 85:
|
4872 | yy.commit($$[$0-4],$$[$0-2],$$[$0],$$[$0-6])
|
4873 | break;
|
4874 | case 86:
|
4875 | yy.commit($$[$0-4],$$[$0],$$[$0-2],$$[$0-6])
|
4876 | break;
|
4877 | case 87:
|
4878 | yy.commit($$[$0-2],$$[$0-4],$$[$0-6],$$[$0])
|
4879 | break;
|
4880 | case 88:
|
4881 | yy.commit($$[$0],$$[$0-4],$$[$0-6],$$[$0-2])
|
4882 | break;
|
4883 | case 89:
|
4884 | yy.commit($$[$0-2],$$[$0],$$[$0-6],$$[$0-4])
|
4885 | break;
|
4886 | case 90:
|
4887 | yy.commit($$[$0],$$[$0-2],$$[$0-6],$$[$0-4])
|
4888 | break;
|
4889 | case 91:
|
4890 | yy.commit($$[$0-4],$$[$0-2],$$[$0-6],$$[$0])
|
4891 | break;
|
4892 | case 92:
|
4893 | yy.commit($$[$0-4],$$[$0],$$[$0-6],$$[$0-2])
|
4894 | break;
|
4895 | case 93:
|
4896 | this.$ = ""
|
4897 | break;
|
4898 | case 94:
|
4899 | this.$=$$[$0]
|
4900 | break;
|
4901 | case 95:
|
4902 | this.$=yy.commitType.NORMAL;
|
4903 | break;
|
4904 | case 96:
|
4905 | this.$=yy.commitType.REVERSE;
|
4906 | break;
|
4907 | case 97:
|
4908 | this.$=yy.commitType.HIGHLIGHT;
|
4909 | break;
|
4910 | case 100:
|
4911 | yy.parseDirective('%%{', 'open_directive');
|
4912 | break;
|
4913 | case 101:
|
4914 | yy.parseDirective($$[$0], 'type_directive');
|
4915 | break;
|
4916 | case 102:
|
4917 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
4918 | break;
|
4919 | case 103:
|
4920 | yy.parseDirective('}%%', 'close_directive', 'gitGraph');
|
4921 | break;
|
4922 | }
|
4923 | },
|
4924 | table: [{3:1,4:2,5:3,6:$V0,8:$V1,14:$V2,45:8,49:$V3,53:$V4},{1:[3]},{3:10,4:2,5:3,6:$V0,8:$V1,14:$V2,45:8,49:$V3,53:$V4},{3:11,4:2,5:3,6:$V0,8:$V1,14:$V2,45:8,49:$V3,53:$V4},{7:12,8:$V5,9:[1,13],10:[1,14],11:15,14:$V6},o($V7,[2,104]),o($V7,[2,105]),o($V7,[2,106]),{46:17,50:[1,18]},{50:[2,100]},{1:[2,1]},{1:[2,2]},{8:[1,19]},{7:20,8:$V5,11:15,14:$V6},{9:[1,21]},o($V8,[2,10],{12:22,13:[1,23]}),o($V9,[2,9]),{9:[1,25],47:24,52:$Va},o([9,52],[2,101]),{1:[2,3]},{8:[1,27]},{7:28,8:$V5,11:15,14:$V6},{8:[2,7],14:[1,31],15:29,16:30,17:32,18:33,19:34,20:[1,35],22:[1,36],24:[1,37],25:[1,38],26:39,27:[1,40],29:[1,44],32:[1,43],35:[1,42],37:[1,41]},o($V9,[2,8]),o($Vb,[2,98]),{48:45,51:[1,46]},o($Vb,[2,103]),{1:[2,4]},{8:[1,47]},o($V8,[2,11]),{4:48,8:$V1,14:$V2,53:$V4},o($V8,[2,13]),o($Vc,[2,14]),o($Vc,[2,15]),o($Vc,[2,16]),{21:[1,49]},{23:[1,50]},o($Vc,[2,19]),o($Vc,[2,20]),o($Vc,[2,21]),{28:[1,51]},o($Vc,[2,93],{38:52,33:[1,55],34:[1,57],36:[1,53],39:[1,54],41:[1,56]}),{28:[1,58]},{33:[1,59]},{28:[1,60]},{47:61,52:$Va},{52:[2,102]},{1:[2,5]},o($V8,[2,12]),o($Vc,[2,17]),o($Vc,[2,18]),o($Vc,[2,22]),o($Vc,[2,28]),{34:[1,62]},{40:63,42:$Vd,43:$Ve,44:$Vf},{34:[1,67]},{34:[1,68]},o($Vc,[2,94]),o($Vc,[2,26],{36:[1,69]}),{34:[1,70]},o($Vc,[2,23],{30:[1,71]}),o($Vb,[2,99]),o($Vc,[2,29],{33:[1,73],39:[1,72],41:[1,74]}),o($Vc,[2,30],{33:[1,76],36:[1,75],41:[1,77]}),o($Vg,[2,95]),o($Vg,[2,96]),o($Vg,[2,97]),o($Vc,[2,33],{36:[1,78],39:[1,79],41:[1,80]}),o($Vc,[2,44],{33:[1,83],36:[1,81],39:[1,82]}),{34:[1,84]},o($Vc,[2,25]),{31:[1,85]},{40:86,42:$Vd,43:$Ve,44:$Vf},{34:[1,87]},{34:[1,88]},{34:[1,89]},{34:[1,90]},{34:[1,91]},{34:[1,92]},{40:93,42:$Vd,43:$Ve,44:$Vf},{34:[1,94]},{34:[1,95]},{40:96,42:$Vd,43:$Ve,44:$Vf},{34:[1,97]},o($Vc,[2,27]),o($Vc,[2,24]),o($Vc,[2,31],{33:[1,98],41:[1,99]}),o($Vc,[2,35],{39:[1,100],41:[1,101]}),o($Vc,[2,45],{33:[1,103],39:[1,102]}),o($Vc,[2,32],{33:[1,104],41:[1,105]}),o($Vc,[2,37],{36:[1,106],41:[1,107]}),o($Vc,[2,48],{33:[1,109],36:[1,108]}),o($Vc,[2,34],{39:[1,110],41:[1,111]}),o($Vc,[2,36],{36:[1,112],41:[1,113]}),o($Vc,[2,49],{36:[1,115],39:[1,114]}),o($Vc,[2,46],{33:[1,117],39:[1,116]}),o($Vc,[2,47],{33:[1,119],36:[1,118]}),o($Vc,[2,50],{36:[1,121],39:[1,120]}),{34:[1,122]},{34:[1,123]},{40:124,42:$Vd,43:$Ve,44:$Vf},{34:[1,125]},{40:126,42:$Vd,43:$Ve,44:$Vf},{34:[1,127]},{34:[1,128]},{34:[1,129]},{34:[1,130]},{34:[1,131]},{34:[1,132]},{34:[1,133]},{40:134,42:$Vd,43:$Ve,44:$Vf},{34:[1,135]},{34:[1,136]},{34:[1,137]},{40:138,42:$Vd,43:$Ve,44:$Vf},{34:[1,139]},{40:140,42:$Vd,43:$Ve,44:$Vf},{34:[1,141]},{34:[1,142]},{34:[1,143]},{40:144,42:$Vd,43:$Ve,44:$Vf},{34:[1,145]},o($Vc,[2,42],{41:[1,146]}),o($Vc,[2,55],{33:[1,147]}),o($Vc,[2,43],{41:[1,148]}),o($Vc,[2,66],{39:[1,149]}),o($Vc,[2,56],{33:[1,150]}),o($Vc,[2,65],{39:[1,151]}),o($Vc,[2,41],{41:[1,152]}),o($Vc,[2,54],{33:[1,153]}),o($Vc,[2,40],{41:[1,154]}),o($Vc,[2,60],{36:[1,155]}),o($Vc,[2,53],{33:[1,156]}),o($Vc,[2,59],{36:[1,157]}),o($Vc,[2,39],{41:[1,158]}),o($Vc,[2,67],{39:[1,159]}),o($Vc,[2,38],{41:[1,160]}),o($Vc,[2,61],{36:[1,161]}),o($Vc,[2,62],{36:[1,162]}),o($Vc,[2,68],{39:[1,163]}),o($Vc,[2,52],{33:[1,164]}),o($Vc,[2,63],{39:[1,165]}),o($Vc,[2,51],{33:[1,166]}),o($Vc,[2,57],{36:[1,167]}),o($Vc,[2,58],{36:[1,168]}),o($Vc,[2,64],{39:[1,169]}),{34:[1,170]},{34:[1,171]},{34:[1,172]},{40:173,42:$Vd,43:$Ve,44:$Vf},{34:[1,174]},{40:175,42:$Vd,43:$Ve,44:$Vf},{34:[1,176]},{34:[1,177]},{34:[1,178]},{34:[1,179]},{34:[1,180]},{34:[1,181]},{34:[1,182]},{40:183,42:$Vd,43:$Ve,44:$Vf},{34:[1,184]},{34:[1,185]},{34:[1,186]},{40:187,42:$Vd,43:$Ve,44:$Vf},{34:[1,188]},{40:189,42:$Vd,43:$Ve,44:$Vf},{34:[1,190]},{34:[1,191]},{34:[1,192]},{40:193,42:$Vd,43:$Ve,44:$Vf},o($Vc,[2,83]),o($Vc,[2,84]),o($Vc,[2,81]),o($Vc,[2,82]),o($Vc,[2,86]),o($Vc,[2,85]),o($Vc,[2,90]),o($Vc,[2,89]),o($Vc,[2,88]),o($Vc,[2,87]),o($Vc,[2,92]),o($Vc,[2,91]),o($Vc,[2,80]),o($Vc,[2,79]),o($Vc,[2,78]),o($Vc,[2,77]),o($Vc,[2,75]),o($Vc,[2,76]),o($Vc,[2,74]),o($Vc,[2,73]),o($Vc,[2,72]),o($Vc,[2,71]),o($Vc,[2,69]),o($Vc,[2,70])],
|
4925 | defaultActions: {9:[2,100],10:[2,1],11:[2,2],19:[2,3],27:[2,4],46:[2,102],47:[2,5]},
|
4926 | parseError: function parseError (str, hash) {
|
4927 | if (hash.recoverable) {
|
4928 | this.trace(str);
|
4929 | } else {
|
4930 | var error = new Error(str);
|
4931 | error.hash = hash;
|
4932 | throw error;
|
4933 | }
|
4934 | },
|
4935 | parse: function parse(input) {
|
4936 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
4937 | var args = lstack.slice.call(arguments, 1);
|
4938 | var lexer = Object.create(this.lexer);
|
4939 | var sharedState = { yy: {} };
|
4940 | for (var k in this.yy) {
|
4941 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
4942 | sharedState.yy[k] = this.yy[k];
|
4943 | }
|
4944 | }
|
4945 | lexer.setInput(input, sharedState.yy);
|
4946 | sharedState.yy.lexer = lexer;
|
4947 | sharedState.yy.parser = this;
|
4948 | if (typeof lexer.yylloc == 'undefined') {
|
4949 | lexer.yylloc = {};
|
4950 | }
|
4951 | var yyloc = lexer.yylloc;
|
4952 | lstack.push(yyloc);
|
4953 | var ranges = lexer.options && lexer.options.ranges;
|
4954 | if (typeof sharedState.yy.parseError === 'function') {
|
4955 | this.parseError = sharedState.yy.parseError;
|
4956 | } else {
|
4957 | this.parseError = Object.getPrototypeOf(this).parseError;
|
4958 | }
|
4959 | function popStack(n) {
|
4960 | stack.length = stack.length - 2 * n;
|
4961 | vstack.length = vstack.length - n;
|
4962 | lstack.length = lstack.length - n;
|
4963 | }
|
4964 | function lex() {
|
4965 | var token;
|
4966 | token = tstack.pop() || lexer.lex() || EOF;
|
4967 | if (typeof token !== 'number') {
|
4968 | if (token instanceof Array) {
|
4969 | tstack = token;
|
4970 | token = tstack.pop();
|
4971 | }
|
4972 | token = self.symbols_[token] || token;
|
4973 | }
|
4974 | return token;
|
4975 | }
|
4976 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
4977 | while (true) {
|
4978 | state = stack[stack.length - 1];
|
4979 | if (this.defaultActions[state]) {
|
4980 | action = this.defaultActions[state];
|
4981 | } else {
|
4982 | if (symbol === null || typeof symbol == 'undefined') {
|
4983 | symbol = lex();
|
4984 | }
|
4985 | action = table[state] && table[state][symbol];
|
4986 | }
|
4987 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
4988 | var errStr = '';
|
4989 | expected = [];
|
4990 | for (p in table[state]) {
|
4991 | if (this.terminals_[p] && p > TERROR) {
|
4992 | expected.push('\'' + this.terminals_[p] + '\'');
|
4993 | }
|
4994 | }
|
4995 | if (lexer.showPosition) {
|
4996 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
4997 | } else {
|
4998 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
4999 | }
|
5000 | this.parseError(errStr, {
|
5001 | text: lexer.match,
|
5002 | token: this.terminals_[symbol] || symbol,
|
5003 | line: lexer.yylineno,
|
5004 | loc: yyloc,
|
5005 | expected: expected
|
5006 | });
|
5007 | }
|
5008 | if (action[0] instanceof Array && action.length > 1) {
|
5009 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
5010 | }
|
5011 | switch (action[0]) {
|
5012 | case 1:
|
5013 | stack.push(symbol);
|
5014 | vstack.push(lexer.yytext);
|
5015 | lstack.push(lexer.yylloc);
|
5016 | stack.push(action[1]);
|
5017 | symbol = null;
|
5018 | if (!preErrorSymbol) {
|
5019 | yyleng = lexer.yyleng;
|
5020 | yytext = lexer.yytext;
|
5021 | yylineno = lexer.yylineno;
|
5022 | yyloc = lexer.yylloc;
|
5023 | if (recovering > 0) {
|
5024 | recovering--;
|
5025 | }
|
5026 | } else {
|
5027 | symbol = preErrorSymbol;
|
5028 | preErrorSymbol = null;
|
5029 | }
|
5030 | break;
|
5031 | case 2:
|
5032 | len = this.productions_[action[1]][1];
|
5033 | yyval.$ = vstack[vstack.length - len];
|
5034 | yyval._$ = {
|
5035 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
5036 | last_line: lstack[lstack.length - 1].last_line,
|
5037 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
5038 | last_column: lstack[lstack.length - 1].last_column
|
5039 | };
|
5040 | if (ranges) {
|
5041 | yyval._$.range = [
|
5042 | lstack[lstack.length - (len || 1)].range[0],
|
5043 | lstack[lstack.length - 1].range[1]
|
5044 | ];
|
5045 | }
|
5046 | r = this.performAction.apply(yyval, [
|
5047 | yytext,
|
5048 | yyleng,
|
5049 | yylineno,
|
5050 | sharedState.yy,
|
5051 | action[1],
|
5052 | vstack,
|
5053 | lstack
|
5054 | ].concat(args));
|
5055 | if (typeof r !== 'undefined') {
|
5056 | return r;
|
5057 | }
|
5058 | if (len) {
|
5059 | stack = stack.slice(0, -1 * len * 2);
|
5060 | vstack = vstack.slice(0, -1 * len);
|
5061 | lstack = lstack.slice(0, -1 * len);
|
5062 | }
|
5063 | stack.push(this.productions_[action[1]][0]);
|
5064 | vstack.push(yyval.$);
|
5065 | lstack.push(yyval._$);
|
5066 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
5067 | stack.push(newState);
|
5068 | break;
|
5069 | case 3:
|
5070 | return true;
|
5071 | }
|
5072 | }
|
5073 | return true;
|
5074 | }};
|
5075 | /* generated by jison-lex 0.3.4 */
|
5076 | var lexer = (function(){
|
5077 | var lexer = ({
|
5078 |
|
5079 | EOF:1,
|
5080 |
|
5081 | parseError:function parseError(str, hash) {
|
5082 | if (this.yy.parser) {
|
5083 | this.yy.parser.parseError(str, hash);
|
5084 | } else {
|
5085 | throw new Error(str);
|
5086 | }
|
5087 | },
|
5088 |
|
5089 | // resets the lexer, sets new input
|
5090 | setInput:function (input, yy) {
|
5091 | this.yy = yy || this.yy || {};
|
5092 | this._input = input;
|
5093 | this._more = this._backtrack = this.done = false;
|
5094 | this.yylineno = this.yyleng = 0;
|
5095 | this.yytext = this.matched = this.match = '';
|
5096 | this.conditionStack = ['INITIAL'];
|
5097 | this.yylloc = {
|
5098 | first_line: 1,
|
5099 | first_column: 0,
|
5100 | last_line: 1,
|
5101 | last_column: 0
|
5102 | };
|
5103 | if (this.options.ranges) {
|
5104 | this.yylloc.range = [0,0];
|
5105 | }
|
5106 | this.offset = 0;
|
5107 | return this;
|
5108 | },
|
5109 |
|
5110 | // consumes and returns one char from the input
|
5111 | input:function () {
|
5112 | var ch = this._input[0];
|
5113 | this.yytext += ch;
|
5114 | this.yyleng++;
|
5115 | this.offset++;
|
5116 | this.match += ch;
|
5117 | this.matched += ch;
|
5118 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
5119 | if (lines) {
|
5120 | this.yylineno++;
|
5121 | this.yylloc.last_line++;
|
5122 | } else {
|
5123 | this.yylloc.last_column++;
|
5124 | }
|
5125 | if (this.options.ranges) {
|
5126 | this.yylloc.range[1]++;
|
5127 | }
|
5128 |
|
5129 | this._input = this._input.slice(1);
|
5130 | return ch;
|
5131 | },
|
5132 |
|
5133 | // unshifts one char (or a string) into the input
|
5134 | unput:function (ch) {
|
5135 | var len = ch.length;
|
5136 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
5137 |
|
5138 | this._input = ch + this._input;
|
5139 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
5140 | //this.yyleng -= len;
|
5141 | this.offset -= len;
|
5142 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
5143 | this.match = this.match.substr(0, this.match.length - 1);
|
5144 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
5145 |
|
5146 | if (lines.length - 1) {
|
5147 | this.yylineno -= lines.length - 1;
|
5148 | }
|
5149 | var r = this.yylloc.range;
|
5150 |
|
5151 | this.yylloc = {
|
5152 | first_line: this.yylloc.first_line,
|
5153 | last_line: this.yylineno + 1,
|
5154 | first_column: this.yylloc.first_column,
|
5155 | last_column: lines ?
|
5156 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
5157 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
5158 | this.yylloc.first_column - len
|
5159 | };
|
5160 |
|
5161 | if (this.options.ranges) {
|
5162 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
5163 | }
|
5164 | this.yyleng = this.yytext.length;
|
5165 | return this;
|
5166 | },
|
5167 |
|
5168 | // When called from action, caches matched text and appends it on next action
|
5169 | more:function () {
|
5170 | this._more = true;
|
5171 | return this;
|
5172 | },
|
5173 |
|
5174 | // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
|
5175 | reject:function () {
|
5176 | if (this.options.backtrack_lexer) {
|
5177 | this._backtrack = true;
|
5178 | } else {
|
5179 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
|
5180 | text: "",
|
5181 | token: null,
|
5182 | line: this.yylineno
|
5183 | });
|
5184 |
|
5185 | }
|
5186 | return this;
|
5187 | },
|
5188 |
|
5189 | // retain first n characters of the match
|
5190 | less:function (n) {
|
5191 | this.unput(this.match.slice(n));
|
5192 | },
|
5193 |
|
5194 | // displays already matched input, i.e. for error messages
|
5195 | pastInput:function () {
|
5196 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
5197 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
5198 | },
|
5199 |
|
5200 | // displays upcoming input, i.e. for error messages
|
5201 | upcomingInput:function () {
|
5202 | var next = this.match;
|
5203 | if (next.length < 20) {
|
5204 | next += this._input.substr(0, 20-next.length);
|
5205 | }
|
5206 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
5207 | },
|
5208 |
|
5209 | // displays the character position where the lexing error occurred, i.e. for error messages
|
5210 | showPosition:function () {
|
5211 | var pre = this.pastInput();
|
5212 | var c = new Array(pre.length + 1).join("-");
|
5213 | return pre + this.upcomingInput() + "\n" + c + "^";
|
5214 | },
|
5215 |
|
5216 | // test the lexed token: return FALSE when not a match, otherwise return token
|
5217 | test_match:function(match, indexed_rule) {
|
5218 | var token,
|
5219 | lines,
|
5220 | backup;
|
5221 |
|
5222 | if (this.options.backtrack_lexer) {
|
5223 | // save context
|
5224 | backup = {
|
5225 | yylineno: this.yylineno,
|
5226 | yylloc: {
|
5227 | first_line: this.yylloc.first_line,
|
5228 | last_line: this.last_line,
|
5229 | first_column: this.yylloc.first_column,
|
5230 | last_column: this.yylloc.last_column
|
5231 | },
|
5232 | yytext: this.yytext,
|
5233 | match: this.match,
|
5234 | matches: this.matches,
|
5235 | matched: this.matched,
|
5236 | yyleng: this.yyleng,
|
5237 | offset: this.offset,
|
5238 | _more: this._more,
|
5239 | _input: this._input,
|
5240 | yy: this.yy,
|
5241 | conditionStack: this.conditionStack.slice(0),
|
5242 | done: this.done
|
5243 | };
|
5244 | if (this.options.ranges) {
|
5245 | backup.yylloc.range = this.yylloc.range.slice(0);
|
5246 | }
|
5247 | }
|
5248 |
|
5249 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
5250 | if (lines) {
|
5251 | this.yylineno += lines.length;
|
5252 | }
|
5253 | this.yylloc = {
|
5254 | first_line: this.yylloc.last_line,
|
5255 | last_line: this.yylineno + 1,
|
5256 | first_column: this.yylloc.last_column,
|
5257 | last_column: lines ?
|
5258 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
5259 | this.yylloc.last_column + match[0].length
|
5260 | };
|
5261 | this.yytext += match[0];
|
5262 | this.match += match[0];
|
5263 | this.matches = match;
|
5264 | this.yyleng = this.yytext.length;
|
5265 | if (this.options.ranges) {
|
5266 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
5267 | }
|
5268 | this._more = false;
|
5269 | this._backtrack = false;
|
5270 | this._input = this._input.slice(match[0].length);
|
5271 | this.matched += match[0];
|
5272 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
5273 | if (this.done && this._input) {
|
5274 | this.done = false;
|
5275 | }
|
5276 | if (token) {
|
5277 | return token;
|
5278 | } else if (this._backtrack) {
|
5279 | // recover context
|
5280 | for (var k in backup) {
|
5281 | this[k] = backup[k];
|
5282 | }
|
5283 | return false; // rule action called reject() implying the next rule should be tested instead.
|
5284 | }
|
5285 | return false;
|
5286 | },
|
5287 |
|
5288 | // return next match in input
|
5289 | next:function () {
|
5290 | if (this.done) {
|
5291 | return this.EOF;
|
5292 | }
|
5293 | if (!this._input) {
|
5294 | this.done = true;
|
5295 | }
|
5296 |
|
5297 | var token,
|
5298 | match,
|
5299 | tempMatch,
|
5300 | index;
|
5301 | if (!this._more) {
|
5302 | this.yytext = '';
|
5303 | this.match = '';
|
5304 | }
|
5305 | var rules = this._currentRules();
|
5306 | for (var i = 0; i < rules.length; i++) {
|
5307 | tempMatch = this._input.match(this.rules[rules[i]]);
|
5308 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
5309 | match = tempMatch;
|
5310 | index = i;
|
5311 | if (this.options.backtrack_lexer) {
|
5312 | token = this.test_match(tempMatch, rules[i]);
|
5313 | if (token !== false) {
|
5314 | return token;
|
5315 | } else if (this._backtrack) {
|
5316 | match = false;
|
5317 | continue; // rule action called reject() implying a rule MISmatch.
|
5318 | } else {
|
5319 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
5320 | return false;
|
5321 | }
|
5322 | } else if (!this.options.flex) {
|
5323 | break;
|
5324 | }
|
5325 | }
|
5326 | }
|
5327 | if (match) {
|
5328 | token = this.test_match(match, rules[index]);
|
5329 | if (token !== false) {
|
5330 | return token;
|
5331 | }
|
5332 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
5333 | return false;
|
5334 | }
|
5335 | if (this._input === "") {
|
5336 | return this.EOF;
|
5337 | } else {
|
5338 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
5339 | text: "",
|
5340 | token: null,
|
5341 | line: this.yylineno
|
5342 | });
|
5343 | }
|
5344 | },
|
5345 |
|
5346 | // return next match that has a token
|
5347 | lex:function lex () {
|
5348 | var r = this.next();
|
5349 | if (r) {
|
5350 | return r;
|
5351 | } else {
|
5352 | return this.lex();
|
5353 | }
|
5354 | },
|
5355 |
|
5356 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
5357 | begin:function begin (condition) {
|
5358 | this.conditionStack.push(condition);
|
5359 | },
|
5360 |
|
5361 | // pop the previously active lexer condition state off the condition stack
|
5362 | popState:function popState () {
|
5363 | var n = this.conditionStack.length - 1;
|
5364 | if (n > 0) {
|
5365 | return this.conditionStack.pop();
|
5366 | } else {
|
5367 | return this.conditionStack[0];
|
5368 | }
|
5369 | },
|
5370 |
|
5371 | // produce the lexer rule set which is active for the currently active lexer condition state
|
5372 | _currentRules:function _currentRules () {
|
5373 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
5374 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
5375 | } else {
|
5376 | return this.conditions["INITIAL"].rules;
|
5377 | }
|
5378 | },
|
5379 |
|
5380 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
5381 | topState:function topState (n) {
|
5382 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
5383 | if (n >= 0) {
|
5384 | return this.conditionStack[n];
|
5385 | } else {
|
5386 | return "INITIAL";
|
5387 | }
|
5388 | },
|
5389 |
|
5390 | // alias for begin(condition)
|
5391 | pushState:function pushState (condition) {
|
5392 | this.begin(condition);
|
5393 | },
|
5394 |
|
5395 | // return the number of states currently on the stack
|
5396 | stateStackSize:function stateStackSize() {
|
5397 | return this.conditionStack.length;
|
5398 | },
|
5399 | options: {"case-insensitive":true},
|
5400 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
5401 | var YYSTATE=YY_START;
|
5402 | switch($avoiding_name_collisions) {
|
5403 | case 0: this.begin('open_directive'); return 49;
|
5404 | break;
|
5405 | case 1: this.begin('type_directive'); return 50;
|
5406 | break;
|
5407 | case 2: this.popState(); this.begin('arg_directive'); return 9;
|
5408 | break;
|
5409 | case 3: this.popState(); this.popState(); return 52;
|
5410 | break;
|
5411 | case 4:return 51;
|
5412 | break;
|
5413 | case 5: this.begin("acc_title");return 20;
|
5414 | break;
|
5415 | case 6: this.popState(); return "acc_title_value";
|
5416 | break;
|
5417 | case 7: this.begin("acc_descr");return 22;
|
5418 | break;
|
5419 | case 8: this.popState(); return "acc_descr_value";
|
5420 | break;
|
5421 | case 9: this.begin("acc_descr_multiline");
|
5422 | break;
|
5423 | case 10: this.popState();
|
5424 | break;
|
5425 | case 11:return "acc_descr_multiline_value";
|
5426 | break;
|
5427 | case 12:/*{console.log('New line');return 14;}*/ return 14;
|
5428 | break;
|
5429 | case 13:/* skip all whitespace */
|
5430 | break;
|
5431 | case 14:/* skip comments */
|
5432 | break;
|
5433 | case 15:/* skip comments */
|
5434 | break;
|
5435 | case 16:return 6;
|
5436 | break;
|
5437 | case 17:return 37;
|
5438 | break;
|
5439 | case 18:return 33;
|
5440 | break;
|
5441 | case 19:return 39;
|
5442 | break;
|
5443 | case 20:return 41;
|
5444 | break;
|
5445 | case 21:return 42;
|
5446 | break;
|
5447 | case 22:return 43;
|
5448 | break;
|
5449 | case 23:return 44;
|
5450 | break;
|
5451 | case 24:return 36;
|
5452 | break;
|
5453 | case 25:return 29;
|
5454 | break;
|
5455 | case 26:return 30;
|
5456 | break;
|
5457 | case 27:return 35;
|
5458 | break;
|
5459 | case 28:return 32;
|
5460 | break;
|
5461 | case 29:return 27;
|
5462 | break;
|
5463 | case 30:return 10;
|
5464 | break;
|
5465 | case 31:return 10;
|
5466 | break;
|
5467 | case 32:return 9;
|
5468 | break;
|
5469 | case 33:return 'CARET'
|
5470 | break;
|
5471 | case 34:this.begin("options"); //
|
5472 | break;
|
5473 | case 35:this.popState(); // not used anymore in the renderer, fixed for backward compatibility
|
5474 | break;
|
5475 | case 36:return 13; //
|
5476 | break;
|
5477 | case 37:this.begin("string");
|
5478 | break;
|
5479 | case 38:this.popState();
|
5480 | break;
|
5481 | case 39:return 34;
|
5482 | break;
|
5483 | case 40:return 31;
|
5484 | break;
|
5485 | case 41:return 28;
|
5486 | break;
|
5487 | case 42:return 8;
|
5488 | break;
|
5489 | }
|
5490 | },
|
5491 | rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:gitGraph\b)/i,/^(?:commit\b)/i,/^(?:id:)/i,/^(?:type:)/i,/^(?:msg:)/i,/^(?:NORMAL\b)/i,/^(?:REVERSE\b)/i,/^(?:HIGHLIGHT\b)/i,/^(?:tag:)/i,/^(?:branch\b)/i,/^(?:order:)/i,/^(?:merge\b)/i,/^(?:cherry-pick\b)/i,/^(?:checkout\b)/i,/^(?:LR\b)/i,/^(?:BT\b)/i,/^(?::)/i,/^(?:\^)/i,/^(?:options\r?\n)/i,/^(?:[ \r\n\t]+end\b)/i,/^(?:[\s\S]+(?=[ \r\n\t]+end))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[0-9]+)/i,/^(?:[a-zA-Z][-_\./a-zA-Z0-9]*[-_a-zA-Z0-9])/i,/^(?:$)/i],
|
5492 | conditions: {"acc_descr_multiline":{"rules":[10,11],"inclusive":false},"acc_descr":{"rules":[8],"inclusive":false},"acc_title":{"rules":[6],"inclusive":false},"close_directive":{"rules":[],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"open_directive":{"rules":[1],"inclusive":false},"options":{"rules":[35,36],"inclusive":false},"string":{"rules":[38,39],"inclusive":false},"INITIAL":{"rules":[0,5,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,37,40,41,42],"inclusive":true}}
|
5493 | });
|
5494 | return lexer;
|
5495 | })();
|
5496 | parser.lexer = lexer;
|
5497 | function Parser () {
|
5498 | this.yy = {};
|
5499 | }
|
5500 | Parser.prototype = parser;parser.Parser = Parser;
|
5501 | return new Parser;
|
5502 | })();
|
5503 |
|
5504 |
|
5505 | if (true) {
|
5506 | exports.parser = parser;
|
5507 | exports.Parser = parser.Parser;
|
5508 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
5509 | exports.main = function commonjsMain (args) {
|
5510 | if (!args[1]) {
|
5511 | console.log('Usage: '+args[0]+' FILE');
|
5512 | process.exit(1);
|
5513 | }
|
5514 | var source = (__webpack_require__(/*! fs */ "?2b40").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
|
5515 | return exports.parser.parse(source);
|
5516 | };
|
5517 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
5518 | exports.main(process.argv.slice(1));
|
5519 | }
|
5520 | }
|
5521 |
|
5522 | /***/ }),
|
5523 |
|
5524 | /***/ "./src/diagrams/info/parser/info.jison":
|
5525 | /*!*********************************************!*\
|
5526 | !*** ./src/diagrams/info/parser/info.jison ***!
|
5527 | \*********************************************/
|
5528 | /***/ ((module, exports, __webpack_require__) => {
|
5529 |
|
5530 | /* module decorator */ module = __webpack_require__.nmd(module);
|
5531 | /* parser generated by jison 0.4.18 */
|
5532 | /*
|
5533 | Returns a Parser object of the following structure:
|
5534 |
|
5535 | Parser: {
|
5536 | yy: {}
|
5537 | }
|
5538 |
|
5539 | Parser.prototype: {
|
5540 | yy: {},
|
5541 | trace: function(),
|
5542 | symbols_: {associative list: name ==> number},
|
5543 | terminals_: {associative list: number ==> name},
|
5544 | productions_: [...],
|
5545 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
5546 | table: [...],
|
5547 | defaultActions: {...},
|
5548 | parseError: function(str, hash),
|
5549 | parse: function(input),
|
5550 |
|
5551 | lexer: {
|
5552 | EOF: 1,
|
5553 | parseError: function(str, hash),
|
5554 | setInput: function(input),
|
5555 | input: function(),
|
5556 | unput: function(str),
|
5557 | more: function(),
|
5558 | less: function(n),
|
5559 | pastInput: function(),
|
5560 | upcomingInput: function(),
|
5561 | showPosition: function(),
|
5562 | test_match: function(regex_match_array, rule_index),
|
5563 | next: function(),
|
5564 | lex: function(),
|
5565 | begin: function(condition),
|
5566 | popState: function(),
|
5567 | _currentRules: function(),
|
5568 | topState: function(),
|
5569 | pushState: function(condition),
|
5570 |
|
5571 | options: {
|
5572 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
5573 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
5574 | backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
|
5575 | },
|
5576 |
|
5577 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
5578 | rules: [...],
|
5579 | conditions: {associative list: name ==> set},
|
5580 | }
|
5581 | }
|
5582 |
|
5583 |
|
5584 | token location info (@$, _$, etc.): {
|
5585 | first_line: n,
|
5586 | last_line: n,
|
5587 | first_column: n,
|
5588 | last_column: n,
|
5589 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
5590 | }
|
5591 |
|
5592 |
|
5593 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
5594 | text: (matched text)
|
5595 | token: (the produced terminal token, if any)
|
5596 | line: (yylineno)
|
5597 | }
|
5598 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
5599 | loc: (yylloc)
|
5600 | expected: (string describing the set of expected tokens)
|
5601 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
5602 | }
|
5603 | */
|
5604 | var parser = (function(){
|
5605 | var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,9,10];
|
5606 | var parser = {trace: function trace () { },
|
5607 | yy: {},
|
5608 | symbols_: {"error":2,"start":3,"info":4,"document":5,"EOF":6,"line":7,"statement":8,"NL":9,"showInfo":10,"$accept":0,"$end":1},
|
5609 | terminals_: {2:"error",4:"info",6:"EOF",9:"NL",10:"showInfo"},
|
5610 | productions_: [0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],
|
5611 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
5612 | /* this == yyval */
|
5613 |
|
5614 | var $0 = $$.length - 1;
|
5615 | switch (yystate) {
|
5616 | case 1:
|
5617 | return yy;
|
5618 | break;
|
5619 | case 4:
|
5620 |
|
5621 | break;
|
5622 | case 6:
|
5623 | yy.setInfo(true);
|
5624 | break;
|
5625 | }
|
5626 | },
|
5627 | table: [{3:1,4:[1,2]},{1:[3]},o($V0,[2,2],{5:3}),{6:[1,4],7:5,8:6,9:[1,7],10:[1,8]},{1:[2,1]},o($V0,[2,3]),o($V0,[2,4]),o($V0,[2,5]),o($V0,[2,6])],
|
5628 | defaultActions: {4:[2,1]},
|
5629 | parseError: function parseError (str, hash) {
|
5630 | if (hash.recoverable) {
|
5631 | this.trace(str);
|
5632 | } else {
|
5633 | var error = new Error(str);
|
5634 | error.hash = hash;
|
5635 | throw error;
|
5636 | }
|
5637 | },
|
5638 | parse: function parse(input) {
|
5639 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
5640 | var args = lstack.slice.call(arguments, 1);
|
5641 | var lexer = Object.create(this.lexer);
|
5642 | var sharedState = { yy: {} };
|
5643 | for (var k in this.yy) {
|
5644 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
5645 | sharedState.yy[k] = this.yy[k];
|
5646 | }
|
5647 | }
|
5648 | lexer.setInput(input, sharedState.yy);
|
5649 | sharedState.yy.lexer = lexer;
|
5650 | sharedState.yy.parser = this;
|
5651 | if (typeof lexer.yylloc == 'undefined') {
|
5652 | lexer.yylloc = {};
|
5653 | }
|
5654 | var yyloc = lexer.yylloc;
|
5655 | lstack.push(yyloc);
|
5656 | var ranges = lexer.options && lexer.options.ranges;
|
5657 | if (typeof sharedState.yy.parseError === 'function') {
|
5658 | this.parseError = sharedState.yy.parseError;
|
5659 | } else {
|
5660 | this.parseError = Object.getPrototypeOf(this).parseError;
|
5661 | }
|
5662 | function popStack(n) {
|
5663 | stack.length = stack.length - 2 * n;
|
5664 | vstack.length = vstack.length - n;
|
5665 | lstack.length = lstack.length - n;
|
5666 | }
|
5667 | function lex() {
|
5668 | var token;
|
5669 | token = tstack.pop() || lexer.lex() || EOF;
|
5670 | if (typeof token !== 'number') {
|
5671 | if (token instanceof Array) {
|
5672 | tstack = token;
|
5673 | token = tstack.pop();
|
5674 | }
|
5675 | token = self.symbols_[token] || token;
|
5676 | }
|
5677 | return token;
|
5678 | }
|
5679 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
5680 | while (true) {
|
5681 | state = stack[stack.length - 1];
|
5682 | if (this.defaultActions[state]) {
|
5683 | action = this.defaultActions[state];
|
5684 | } else {
|
5685 | if (symbol === null || typeof symbol == 'undefined') {
|
5686 | symbol = lex();
|
5687 | }
|
5688 | action = table[state] && table[state][symbol];
|
5689 | }
|
5690 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
5691 | var errStr = '';
|
5692 | expected = [];
|
5693 | for (p in table[state]) {
|
5694 | if (this.terminals_[p] && p > TERROR) {
|
5695 | expected.push('\'' + this.terminals_[p] + '\'');
|
5696 | }
|
5697 | }
|
5698 | if (lexer.showPosition) {
|
5699 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
5700 | } else {
|
5701 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
5702 | }
|
5703 | this.parseError(errStr, {
|
5704 | text: lexer.match,
|
5705 | token: this.terminals_[symbol] || symbol,
|
5706 | line: lexer.yylineno,
|
5707 | loc: yyloc,
|
5708 | expected: expected
|
5709 | });
|
5710 | }
|
5711 | if (action[0] instanceof Array && action.length > 1) {
|
5712 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
5713 | }
|
5714 | switch (action[0]) {
|
5715 | case 1:
|
5716 | stack.push(symbol);
|
5717 | vstack.push(lexer.yytext);
|
5718 | lstack.push(lexer.yylloc);
|
5719 | stack.push(action[1]);
|
5720 | symbol = null;
|
5721 | if (!preErrorSymbol) {
|
5722 | yyleng = lexer.yyleng;
|
5723 | yytext = lexer.yytext;
|
5724 | yylineno = lexer.yylineno;
|
5725 | yyloc = lexer.yylloc;
|
5726 | if (recovering > 0) {
|
5727 | recovering--;
|
5728 | }
|
5729 | } else {
|
5730 | symbol = preErrorSymbol;
|
5731 | preErrorSymbol = null;
|
5732 | }
|
5733 | break;
|
5734 | case 2:
|
5735 | len = this.productions_[action[1]][1];
|
5736 | yyval.$ = vstack[vstack.length - len];
|
5737 | yyval._$ = {
|
5738 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
5739 | last_line: lstack[lstack.length - 1].last_line,
|
5740 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
5741 | last_column: lstack[lstack.length - 1].last_column
|
5742 | };
|
5743 | if (ranges) {
|
5744 | yyval._$.range = [
|
5745 | lstack[lstack.length - (len || 1)].range[0],
|
5746 | lstack[lstack.length - 1].range[1]
|
5747 | ];
|
5748 | }
|
5749 | r = this.performAction.apply(yyval, [
|
5750 | yytext,
|
5751 | yyleng,
|
5752 | yylineno,
|
5753 | sharedState.yy,
|
5754 | action[1],
|
5755 | vstack,
|
5756 | lstack
|
5757 | ].concat(args));
|
5758 | if (typeof r !== 'undefined') {
|
5759 | return r;
|
5760 | }
|
5761 | if (len) {
|
5762 | stack = stack.slice(0, -1 * len * 2);
|
5763 | vstack = vstack.slice(0, -1 * len);
|
5764 | lstack = lstack.slice(0, -1 * len);
|
5765 | }
|
5766 | stack.push(this.productions_[action[1]][0]);
|
5767 | vstack.push(yyval.$);
|
5768 | lstack.push(yyval._$);
|
5769 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
5770 | stack.push(newState);
|
5771 | break;
|
5772 | case 3:
|
5773 | return true;
|
5774 | }
|
5775 | }
|
5776 | return true;
|
5777 | }};
|
5778 |
|
5779 | /* generated by jison-lex 0.3.4 */
|
5780 | var lexer = (function(){
|
5781 | var lexer = ({
|
5782 |
|
5783 | EOF:1,
|
5784 |
|
5785 | parseError:function parseError(str, hash) {
|
5786 | if (this.yy.parser) {
|
5787 | this.yy.parser.parseError(str, hash);
|
5788 | } else {
|
5789 | throw new Error(str);
|
5790 | }
|
5791 | },
|
5792 |
|
5793 | // resets the lexer, sets new input
|
5794 | setInput:function (input, yy) {
|
5795 | this.yy = yy || this.yy || {};
|
5796 | this._input = input;
|
5797 | this._more = this._backtrack = this.done = false;
|
5798 | this.yylineno = this.yyleng = 0;
|
5799 | this.yytext = this.matched = this.match = '';
|
5800 | this.conditionStack = ['INITIAL'];
|
5801 | this.yylloc = {
|
5802 | first_line: 1,
|
5803 | first_column: 0,
|
5804 | last_line: 1,
|
5805 | last_column: 0
|
5806 | };
|
5807 | if (this.options.ranges) {
|
5808 | this.yylloc.range = [0,0];
|
5809 | }
|
5810 | this.offset = 0;
|
5811 | return this;
|
5812 | },
|
5813 |
|
5814 | // consumes and returns one char from the input
|
5815 | input:function () {
|
5816 | var ch = this._input[0];
|
5817 | this.yytext += ch;
|
5818 | this.yyleng++;
|
5819 | this.offset++;
|
5820 | this.match += ch;
|
5821 | this.matched += ch;
|
5822 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
5823 | if (lines) {
|
5824 | this.yylineno++;
|
5825 | this.yylloc.last_line++;
|
5826 | } else {
|
5827 | this.yylloc.last_column++;
|
5828 | }
|
5829 | if (this.options.ranges) {
|
5830 | this.yylloc.range[1]++;
|
5831 | }
|
5832 |
|
5833 | this._input = this._input.slice(1);
|
5834 | return ch;
|
5835 | },
|
5836 |
|
5837 | // unshifts one char (or a string) into the input
|
5838 | unput:function (ch) {
|
5839 | var len = ch.length;
|
5840 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
5841 |
|
5842 | this._input = ch + this._input;
|
5843 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
5844 | //this.yyleng -= len;
|
5845 | this.offset -= len;
|
5846 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
5847 | this.match = this.match.substr(0, this.match.length - 1);
|
5848 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
5849 |
|
5850 | if (lines.length - 1) {
|
5851 | this.yylineno -= lines.length - 1;
|
5852 | }
|
5853 | var r = this.yylloc.range;
|
5854 |
|
5855 | this.yylloc = {
|
5856 | first_line: this.yylloc.first_line,
|
5857 | last_line: this.yylineno + 1,
|
5858 | first_column: this.yylloc.first_column,
|
5859 | last_column: lines ?
|
5860 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
5861 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
5862 | this.yylloc.first_column - len
|
5863 | };
|
5864 |
|
5865 | if (this.options.ranges) {
|
5866 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
5867 | }
|
5868 | this.yyleng = this.yytext.length;
|
5869 | return this;
|
5870 | },
|
5871 |
|
5872 | // When called from action, caches matched text and appends it on next action
|
5873 | more:function () {
|
5874 | this._more = true;
|
5875 | return this;
|
5876 | },
|
5877 |
|
5878 | // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
|
5879 | reject:function () {
|
5880 | if (this.options.backtrack_lexer) {
|
5881 | this._backtrack = true;
|
5882 | } else {
|
5883 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
|
5884 | text: "",
|
5885 | token: null,
|
5886 | line: this.yylineno
|
5887 | });
|
5888 |
|
5889 | }
|
5890 | return this;
|
5891 | },
|
5892 |
|
5893 | // retain first n characters of the match
|
5894 | less:function (n) {
|
5895 | this.unput(this.match.slice(n));
|
5896 | },
|
5897 |
|
5898 | // displays already matched input, i.e. for error messages
|
5899 | pastInput:function () {
|
5900 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
5901 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
5902 | },
|
5903 |
|
5904 | // displays upcoming input, i.e. for error messages
|
5905 | upcomingInput:function () {
|
5906 | var next = this.match;
|
5907 | if (next.length < 20) {
|
5908 | next += this._input.substr(0, 20-next.length);
|
5909 | }
|
5910 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
5911 | },
|
5912 |
|
5913 | // displays the character position where the lexing error occurred, i.e. for error messages
|
5914 | showPosition:function () {
|
5915 | var pre = this.pastInput();
|
5916 | var c = new Array(pre.length + 1).join("-");
|
5917 | return pre + this.upcomingInput() + "\n" + c + "^";
|
5918 | },
|
5919 |
|
5920 | // test the lexed token: return FALSE when not a match, otherwise return token
|
5921 | test_match:function(match, indexed_rule) {
|
5922 | var token,
|
5923 | lines,
|
5924 | backup;
|
5925 |
|
5926 | if (this.options.backtrack_lexer) {
|
5927 | // save context
|
5928 | backup = {
|
5929 | yylineno: this.yylineno,
|
5930 | yylloc: {
|
5931 | first_line: this.yylloc.first_line,
|
5932 | last_line: this.last_line,
|
5933 | first_column: this.yylloc.first_column,
|
5934 | last_column: this.yylloc.last_column
|
5935 | },
|
5936 | yytext: this.yytext,
|
5937 | match: this.match,
|
5938 | matches: this.matches,
|
5939 | matched: this.matched,
|
5940 | yyleng: this.yyleng,
|
5941 | offset: this.offset,
|
5942 | _more: this._more,
|
5943 | _input: this._input,
|
5944 | yy: this.yy,
|
5945 | conditionStack: this.conditionStack.slice(0),
|
5946 | done: this.done
|
5947 | };
|
5948 | if (this.options.ranges) {
|
5949 | backup.yylloc.range = this.yylloc.range.slice(0);
|
5950 | }
|
5951 | }
|
5952 |
|
5953 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
5954 | if (lines) {
|
5955 | this.yylineno += lines.length;
|
5956 | }
|
5957 | this.yylloc = {
|
5958 | first_line: this.yylloc.last_line,
|
5959 | last_line: this.yylineno + 1,
|
5960 | first_column: this.yylloc.last_column,
|
5961 | last_column: lines ?
|
5962 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
5963 | this.yylloc.last_column + match[0].length
|
5964 | };
|
5965 | this.yytext += match[0];
|
5966 | this.match += match[0];
|
5967 | this.matches = match;
|
5968 | this.yyleng = this.yytext.length;
|
5969 | if (this.options.ranges) {
|
5970 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
5971 | }
|
5972 | this._more = false;
|
5973 | this._backtrack = false;
|
5974 | this._input = this._input.slice(match[0].length);
|
5975 | this.matched += match[0];
|
5976 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
5977 | if (this.done && this._input) {
|
5978 | this.done = false;
|
5979 | }
|
5980 | if (token) {
|
5981 | return token;
|
5982 | } else if (this._backtrack) {
|
5983 | // recover context
|
5984 | for (var k in backup) {
|
5985 | this[k] = backup[k];
|
5986 | }
|
5987 | return false; // rule action called reject() implying the next rule should be tested instead.
|
5988 | }
|
5989 | return false;
|
5990 | },
|
5991 |
|
5992 | // return next match in input
|
5993 | next:function () {
|
5994 | if (this.done) {
|
5995 | return this.EOF;
|
5996 | }
|
5997 | if (!this._input) {
|
5998 | this.done = true;
|
5999 | }
|
6000 |
|
6001 | var token,
|
6002 | match,
|
6003 | tempMatch,
|
6004 | index;
|
6005 | if (!this._more) {
|
6006 | this.yytext = '';
|
6007 | this.match = '';
|
6008 | }
|
6009 | var rules = this._currentRules();
|
6010 | for (var i = 0; i < rules.length; i++) {
|
6011 | tempMatch = this._input.match(this.rules[rules[i]]);
|
6012 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
6013 | match = tempMatch;
|
6014 | index = i;
|
6015 | if (this.options.backtrack_lexer) {
|
6016 | token = this.test_match(tempMatch, rules[i]);
|
6017 | if (token !== false) {
|
6018 | return token;
|
6019 | } else if (this._backtrack) {
|
6020 | match = false;
|
6021 | continue; // rule action called reject() implying a rule MISmatch.
|
6022 | } else {
|
6023 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
6024 | return false;
|
6025 | }
|
6026 | } else if (!this.options.flex) {
|
6027 | break;
|
6028 | }
|
6029 | }
|
6030 | }
|
6031 | if (match) {
|
6032 | token = this.test_match(match, rules[index]);
|
6033 | if (token !== false) {
|
6034 | return token;
|
6035 | }
|
6036 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
6037 | return false;
|
6038 | }
|
6039 | if (this._input === "") {
|
6040 | return this.EOF;
|
6041 | } else {
|
6042 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
6043 | text: "",
|
6044 | token: null,
|
6045 | line: this.yylineno
|
6046 | });
|
6047 | }
|
6048 | },
|
6049 |
|
6050 | // return next match that has a token
|
6051 | lex:function lex () {
|
6052 | var r = this.next();
|
6053 | if (r) {
|
6054 | return r;
|
6055 | } else {
|
6056 | return this.lex();
|
6057 | }
|
6058 | },
|
6059 |
|
6060 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
6061 | begin:function begin (condition) {
|
6062 | this.conditionStack.push(condition);
|
6063 | },
|
6064 |
|
6065 | // pop the previously active lexer condition state off the condition stack
|
6066 | popState:function popState () {
|
6067 | var n = this.conditionStack.length - 1;
|
6068 | if (n > 0) {
|
6069 | return this.conditionStack.pop();
|
6070 | } else {
|
6071 | return this.conditionStack[0];
|
6072 | }
|
6073 | },
|
6074 |
|
6075 | // produce the lexer rule set which is active for the currently active lexer condition state
|
6076 | _currentRules:function _currentRules () {
|
6077 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
6078 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
6079 | } else {
|
6080 | return this.conditions["INITIAL"].rules;
|
6081 | }
|
6082 | },
|
6083 |
|
6084 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
6085 | topState:function topState (n) {
|
6086 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
6087 | if (n >= 0) {
|
6088 | return this.conditionStack[n];
|
6089 | } else {
|
6090 | return "INITIAL";
|
6091 | }
|
6092 | },
|
6093 |
|
6094 | // alias for begin(condition)
|
6095 | pushState:function pushState (condition) {
|
6096 | this.begin(condition);
|
6097 | },
|
6098 |
|
6099 | // return the number of states currently on the stack
|
6100 | stateStackSize:function stateStackSize() {
|
6101 | return this.conditionStack.length;
|
6102 | },
|
6103 | options: {"case-insensitive":true},
|
6104 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
6105 | // Pre-lexer code can go here
|
6106 |
|
6107 | var YYSTATE=YY_START;
|
6108 | switch($avoiding_name_collisions) {
|
6109 | case 0:return 4 ;
|
6110 | break;
|
6111 | case 1:return 9 ;
|
6112 | break;
|
6113 | case 2:return 'space';
|
6114 | break;
|
6115 | case 3:return 10;
|
6116 | break;
|
6117 | case 4:return 6 ;
|
6118 | break;
|
6119 | case 5:return 'TXT' ;
|
6120 | break;
|
6121 | }
|
6122 | },
|
6123 | rules: [/^(?:info\b)/i,/^(?:[\s\n\r]+)/i,/^(?:[\s]+)/i,/^(?:showInfo\b)/i,/^(?:$)/i,/^(?:.)/i],
|
6124 | conditions: {"INITIAL":{"rules":[0,1,2,3,4,5],"inclusive":true}}
|
6125 | });
|
6126 | return lexer;
|
6127 | })();
|
6128 | parser.lexer = lexer;
|
6129 | function Parser () {
|
6130 | this.yy = {};
|
6131 | }
|
6132 | Parser.prototype = parser;parser.Parser = Parser;
|
6133 | return new Parser;
|
6134 | })();
|
6135 |
|
6136 |
|
6137 | if (true) {
|
6138 | exports.parser = parser;
|
6139 | exports.Parser = parser.Parser;
|
6140 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
6141 | exports.main = function commonjsMain (args) {
|
6142 | if (!args[1]) {
|
6143 | console.log('Usage: '+args[0]+' FILE');
|
6144 | process.exit(1);
|
6145 | }
|
6146 | var source = (__webpack_require__(/*! fs */ "?c5f1").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
|
6147 | return exports.parser.parse(source);
|
6148 | };
|
6149 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
6150 | exports.main(process.argv.slice(1));
|
6151 | }
|
6152 | }
|
6153 |
|
6154 | /***/ }),
|
6155 |
|
6156 | /***/ "./src/diagrams/pie/parser/pie.jison":
|
6157 | /*!*******************************************!*\
|
6158 | !*** ./src/diagrams/pie/parser/pie.jison ***!
|
6159 | \*******************************************/
|
6160 | /***/ ((module, exports, __webpack_require__) => {
|
6161 |
|
6162 | /* module decorator */ module = __webpack_require__.nmd(module);
|
6163 | /* parser generated by jison 0.4.18 */
|
6164 | /*
|
6165 | Returns a Parser object of the following structure:
|
6166 |
|
6167 | Parser: {
|
6168 | yy: {}
|
6169 | }
|
6170 |
|
6171 | Parser.prototype: {
|
6172 | yy: {},
|
6173 | trace: function(),
|
6174 | symbols_: {associative list: name ==> number},
|
6175 | terminals_: {associative list: number ==> name},
|
6176 | productions_: [...],
|
6177 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
6178 | table: [...],
|
6179 | defaultActions: {...},
|
6180 | parseError: function(str, hash),
|
6181 | parse: function(input),
|
6182 |
|
6183 | lexer: {
|
6184 | EOF: 1,
|
6185 | parseError: function(str, hash),
|
6186 | setInput: function(input),
|
6187 | input: function(),
|
6188 | unput: function(str),
|
6189 | more: function(),
|
6190 | less: function(n),
|
6191 | pastInput: function(),
|
6192 | upcomingInput: function(),
|
6193 | showPosition: function(),
|
6194 | test_match: function(regex_match_array, rule_index),
|
6195 | next: function(),
|
6196 | lex: function(),
|
6197 | begin: function(condition),
|
6198 | popState: function(),
|
6199 | _currentRules: function(),
|
6200 | topState: function(),
|
6201 | pushState: function(condition),
|
6202 |
|
6203 | options: {
|
6204 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
6205 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
6206 | backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
|
6207 | },
|
6208 |
|
6209 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
6210 | rules: [...],
|
6211 | conditions: {associative list: name ==> set},
|
6212 | }
|
6213 | }
|
6214 |
|
6215 |
|
6216 | token location info (@$, _$, etc.): {
|
6217 | first_line: n,
|
6218 | last_line: n,
|
6219 | first_column: n,
|
6220 | last_column: n,
|
6221 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
6222 | }
|
6223 |
|
6224 |
|
6225 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
6226 | text: (matched text)
|
6227 | token: (the produced terminal token, if any)
|
6228 | line: (yylineno)
|
6229 | }
|
6230 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
6231 | loc: (yylloc)
|
6232 | expected: (string describing the set of expected tokens)
|
6233 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
6234 | }
|
6235 | */
|
6236 | var parser = (function(){
|
6237 | var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,4],$V1=[1,5],$V2=[1,6],$V3=[1,7],$V4=[1,9],$V5=[1,11,13,15,17,19,20,26,27,28,29],$V6=[2,5],$V7=[1,6,11,13,15,17,19,20,26,27,28,29],$V8=[26,27,28],$V9=[2,8],$Va=[1,18],$Vb=[1,19],$Vc=[1,20],$Vd=[1,21],$Ve=[1,22],$Vf=[1,23],$Vg=[1,28],$Vh=[6,26,27,28,29];
|
6238 | var parser = {trace: function trace () { },
|
6239 | yy: {},
|
6240 | symbols_: {"error":2,"start":3,"eol":4,"directive":5,"PIE":6,"document":7,"showData":8,"line":9,"statement":10,"txt":11,"value":12,"title":13,"title_value":14,"acc_title":15,"acc_title_value":16,"acc_descr":17,"acc_descr_value":18,"acc_descr_multiline_value":19,"section":20,"openDirective":21,"typeDirective":22,"closeDirective":23,":":24,"argDirective":25,"NEWLINE":26,";":27,"EOF":28,"open_directive":29,"type_directive":30,"arg_directive":31,"close_directive":32,"$accept":0,"$end":1},
|
6241 | terminals_: {2:"error",6:"PIE",8:"showData",11:"txt",12:"value",13:"title",14:"title_value",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",24:":",26:"NEWLINE",27:";",28:"EOF",29:"open_directive",30:"type_directive",31:"arg_directive",32:"close_directive"},
|
6242 | productions_: [0,[3,2],[3,2],[3,2],[3,3],[7,0],[7,2],[9,2],[10,0],[10,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,1],[5,3],[5,5],[4,1],[4,1],[4,1],[21,1],[22,1],[25,1],[23,1]],
|
6243 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
6244 | /* this == yyval */
|
6245 |
|
6246 | var $0 = $$.length - 1;
|
6247 | switch (yystate) {
|
6248 | case 4:
|
6249 | yy.setShowData(true);
|
6250 | break;
|
6251 | case 7:
|
6252 | this.$ = $$[$0-1]
|
6253 | break;
|
6254 | case 9:
|
6255 | yy.addSection($$[$0-1],yy.cleanupValue($$[$0]));
|
6256 | break;
|
6257 | case 10:
|
6258 | this.$=$$[$0].trim();yy.setDiagramTitle(this.$);
|
6259 | break;
|
6260 | case 11:
|
6261 | this.$=$$[$0].trim();yy.setAccTitle(this.$);
|
6262 | break;
|
6263 | case 12: case 13:
|
6264 | this.$=$$[$0].trim();yy.setAccDescription(this.$);
|
6265 | break;
|
6266 | case 14:
|
6267 | yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8);
|
6268 | break;
|
6269 | case 21:
|
6270 | yy.parseDirective('%%{', 'open_directive');
|
6271 | break;
|
6272 | case 22:
|
6273 | yy.parseDirective($$[$0], 'type_directive');
|
6274 | break;
|
6275 | case 23:
|
6276 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
6277 | break;
|
6278 | case 24:
|
6279 | yy.parseDirective('}%%', 'close_directive', 'pie');
|
6280 | break;
|
6281 | }
|
6282 | },
|
6283 | table: [{3:1,4:2,5:3,6:$V0,21:8,26:$V1,27:$V2,28:$V3,29:$V4},{1:[3]},{3:10,4:2,5:3,6:$V0,21:8,26:$V1,27:$V2,28:$V3,29:$V4},{3:11,4:2,5:3,6:$V0,21:8,26:$V1,27:$V2,28:$V3,29:$V4},o($V5,$V6,{7:12,8:[1,13]}),o($V7,[2,18]),o($V7,[2,19]),o($V7,[2,20]),{22:14,30:[1,15]},{30:[2,21]},{1:[2,1]},{1:[2,2]},o($V8,$V9,{21:8,9:16,10:17,5:24,1:[2,3],11:$Va,13:$Vb,15:$Vc,17:$Vd,19:$Ve,20:$Vf,29:$V4}),o($V5,$V6,{7:25}),{23:26,24:[1,27],32:$Vg},o([24,32],[2,22]),o($V5,[2,6]),{4:29,26:$V1,27:$V2,28:$V3},{12:[1,30]},{14:[1,31]},{16:[1,32]},{18:[1,33]},o($V8,[2,13]),o($V8,[2,14]),o($V8,[2,15]),o($V8,$V9,{21:8,9:16,10:17,5:24,1:[2,4],11:$Va,13:$Vb,15:$Vc,17:$Vd,19:$Ve,20:$Vf,29:$V4}),o($Vh,[2,16]),{25:34,31:[1,35]},o($Vh,[2,24]),o($V5,[2,7]),o($V8,[2,9]),o($V8,[2,10]),o($V8,[2,11]),o($V8,[2,12]),{23:36,32:$Vg},{32:[2,23]},o($Vh,[2,17])],
|
6284 | defaultActions: {9:[2,21],10:[2,1],11:[2,2],35:[2,23]},
|
6285 | parseError: function parseError (str, hash) {
|
6286 | if (hash.recoverable) {
|
6287 | this.trace(str);
|
6288 | } else {
|
6289 | var error = new Error(str);
|
6290 | error.hash = hash;
|
6291 | throw error;
|
6292 | }
|
6293 | },
|
6294 | parse: function parse(input) {
|
6295 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
6296 | var args = lstack.slice.call(arguments, 1);
|
6297 | var lexer = Object.create(this.lexer);
|
6298 | var sharedState = { yy: {} };
|
6299 | for (var k in this.yy) {
|
6300 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
6301 | sharedState.yy[k] = this.yy[k];
|
6302 | }
|
6303 | }
|
6304 | lexer.setInput(input, sharedState.yy);
|
6305 | sharedState.yy.lexer = lexer;
|
6306 | sharedState.yy.parser = this;
|
6307 | if (typeof lexer.yylloc == 'undefined') {
|
6308 | lexer.yylloc = {};
|
6309 | }
|
6310 | var yyloc = lexer.yylloc;
|
6311 | lstack.push(yyloc);
|
6312 | var ranges = lexer.options && lexer.options.ranges;
|
6313 | if (typeof sharedState.yy.parseError === 'function') {
|
6314 | this.parseError = sharedState.yy.parseError;
|
6315 | } else {
|
6316 | this.parseError = Object.getPrototypeOf(this).parseError;
|
6317 | }
|
6318 | function popStack(n) {
|
6319 | stack.length = stack.length - 2 * n;
|
6320 | vstack.length = vstack.length - n;
|
6321 | lstack.length = lstack.length - n;
|
6322 | }
|
6323 | function lex() {
|
6324 | var token;
|
6325 | token = tstack.pop() || lexer.lex() || EOF;
|
6326 | if (typeof token !== 'number') {
|
6327 | if (token instanceof Array) {
|
6328 | tstack = token;
|
6329 | token = tstack.pop();
|
6330 | }
|
6331 | token = self.symbols_[token] || token;
|
6332 | }
|
6333 | return token;
|
6334 | }
|
6335 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
6336 | while (true) {
|
6337 | state = stack[stack.length - 1];
|
6338 | if (this.defaultActions[state]) {
|
6339 | action = this.defaultActions[state];
|
6340 | } else {
|
6341 | if (symbol === null || typeof symbol == 'undefined') {
|
6342 | symbol = lex();
|
6343 | }
|
6344 | action = table[state] && table[state][symbol];
|
6345 | }
|
6346 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
6347 | var errStr = '';
|
6348 | expected = [];
|
6349 | for (p in table[state]) {
|
6350 | if (this.terminals_[p] && p > TERROR) {
|
6351 | expected.push('\'' + this.terminals_[p] + '\'');
|
6352 | }
|
6353 | }
|
6354 | if (lexer.showPosition) {
|
6355 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
6356 | } else {
|
6357 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
6358 | }
|
6359 | this.parseError(errStr, {
|
6360 | text: lexer.match,
|
6361 | token: this.terminals_[symbol] || symbol,
|
6362 | line: lexer.yylineno,
|
6363 | loc: yyloc,
|
6364 | expected: expected
|
6365 | });
|
6366 | }
|
6367 | if (action[0] instanceof Array && action.length > 1) {
|
6368 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
6369 | }
|
6370 | switch (action[0]) {
|
6371 | case 1:
|
6372 | stack.push(symbol);
|
6373 | vstack.push(lexer.yytext);
|
6374 | lstack.push(lexer.yylloc);
|
6375 | stack.push(action[1]);
|
6376 | symbol = null;
|
6377 | if (!preErrorSymbol) {
|
6378 | yyleng = lexer.yyleng;
|
6379 | yytext = lexer.yytext;
|
6380 | yylineno = lexer.yylineno;
|
6381 | yyloc = lexer.yylloc;
|
6382 | if (recovering > 0) {
|
6383 | recovering--;
|
6384 | }
|
6385 | } else {
|
6386 | symbol = preErrorSymbol;
|
6387 | preErrorSymbol = null;
|
6388 | }
|
6389 | break;
|
6390 | case 2:
|
6391 | len = this.productions_[action[1]][1];
|
6392 | yyval.$ = vstack[vstack.length - len];
|
6393 | yyval._$ = {
|
6394 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
6395 | last_line: lstack[lstack.length - 1].last_line,
|
6396 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
6397 | last_column: lstack[lstack.length - 1].last_column
|
6398 | };
|
6399 | if (ranges) {
|
6400 | yyval._$.range = [
|
6401 | lstack[lstack.length - (len || 1)].range[0],
|
6402 | lstack[lstack.length - 1].range[1]
|
6403 | ];
|
6404 | }
|
6405 | r = this.performAction.apply(yyval, [
|
6406 | yytext,
|
6407 | yyleng,
|
6408 | yylineno,
|
6409 | sharedState.yy,
|
6410 | action[1],
|
6411 | vstack,
|
6412 | lstack
|
6413 | ].concat(args));
|
6414 | if (typeof r !== 'undefined') {
|
6415 | return r;
|
6416 | }
|
6417 | if (len) {
|
6418 | stack = stack.slice(0, -1 * len * 2);
|
6419 | vstack = vstack.slice(0, -1 * len);
|
6420 | lstack = lstack.slice(0, -1 * len);
|
6421 | }
|
6422 | stack.push(this.productions_[action[1]][0]);
|
6423 | vstack.push(yyval.$);
|
6424 | lstack.push(yyval._$);
|
6425 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
6426 | stack.push(newState);
|
6427 | break;
|
6428 | case 3:
|
6429 | return true;
|
6430 | }
|
6431 | }
|
6432 | return true;
|
6433 | }};
|
6434 |
|
6435 | /* generated by jison-lex 0.3.4 */
|
6436 | var lexer = (function(){
|
6437 | var lexer = ({
|
6438 |
|
6439 | EOF:1,
|
6440 |
|
6441 | parseError:function parseError(str, hash) {
|
6442 | if (this.yy.parser) {
|
6443 | this.yy.parser.parseError(str, hash);
|
6444 | } else {
|
6445 | throw new Error(str);
|
6446 | }
|
6447 | },
|
6448 |
|
6449 | // resets the lexer, sets new input
|
6450 | setInput:function (input, yy) {
|
6451 | this.yy = yy || this.yy || {};
|
6452 | this._input = input;
|
6453 | this._more = this._backtrack = this.done = false;
|
6454 | this.yylineno = this.yyleng = 0;
|
6455 | this.yytext = this.matched = this.match = '';
|
6456 | this.conditionStack = ['INITIAL'];
|
6457 | this.yylloc = {
|
6458 | first_line: 1,
|
6459 | first_column: 0,
|
6460 | last_line: 1,
|
6461 | last_column: 0
|
6462 | };
|
6463 | if (this.options.ranges) {
|
6464 | this.yylloc.range = [0,0];
|
6465 | }
|
6466 | this.offset = 0;
|
6467 | return this;
|
6468 | },
|
6469 |
|
6470 | // consumes and returns one char from the input
|
6471 | input:function () {
|
6472 | var ch = this._input[0];
|
6473 | this.yytext += ch;
|
6474 | this.yyleng++;
|
6475 | this.offset++;
|
6476 | this.match += ch;
|
6477 | this.matched += ch;
|
6478 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
6479 | if (lines) {
|
6480 | this.yylineno++;
|
6481 | this.yylloc.last_line++;
|
6482 | } else {
|
6483 | this.yylloc.last_column++;
|
6484 | }
|
6485 | if (this.options.ranges) {
|
6486 | this.yylloc.range[1]++;
|
6487 | }
|
6488 |
|
6489 | this._input = this._input.slice(1);
|
6490 | return ch;
|
6491 | },
|
6492 |
|
6493 | // unshifts one char (or a string) into the input
|
6494 | unput:function (ch) {
|
6495 | var len = ch.length;
|
6496 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
6497 |
|
6498 | this._input = ch + this._input;
|
6499 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
6500 | //this.yyleng -= len;
|
6501 | this.offset -= len;
|
6502 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
6503 | this.match = this.match.substr(0, this.match.length - 1);
|
6504 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
6505 |
|
6506 | if (lines.length - 1) {
|
6507 | this.yylineno -= lines.length - 1;
|
6508 | }
|
6509 | var r = this.yylloc.range;
|
6510 |
|
6511 | this.yylloc = {
|
6512 | first_line: this.yylloc.first_line,
|
6513 | last_line: this.yylineno + 1,
|
6514 | first_column: this.yylloc.first_column,
|
6515 | last_column: lines ?
|
6516 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
6517 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
6518 | this.yylloc.first_column - len
|
6519 | };
|
6520 |
|
6521 | if (this.options.ranges) {
|
6522 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
6523 | }
|
6524 | this.yyleng = this.yytext.length;
|
6525 | return this;
|
6526 | },
|
6527 |
|
6528 | // When called from action, caches matched text and appends it on next action
|
6529 | more:function () {
|
6530 | this._more = true;
|
6531 | return this;
|
6532 | },
|
6533 |
|
6534 | // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
|
6535 | reject:function () {
|
6536 | if (this.options.backtrack_lexer) {
|
6537 | this._backtrack = true;
|
6538 | } else {
|
6539 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
|
6540 | text: "",
|
6541 | token: null,
|
6542 | line: this.yylineno
|
6543 | });
|
6544 |
|
6545 | }
|
6546 | return this;
|
6547 | },
|
6548 |
|
6549 | // retain first n characters of the match
|
6550 | less:function (n) {
|
6551 | this.unput(this.match.slice(n));
|
6552 | },
|
6553 |
|
6554 | // displays already matched input, i.e. for error messages
|
6555 | pastInput:function () {
|
6556 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
6557 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
6558 | },
|
6559 |
|
6560 | // displays upcoming input, i.e. for error messages
|
6561 | upcomingInput:function () {
|
6562 | var next = this.match;
|
6563 | if (next.length < 20) {
|
6564 | next += this._input.substr(0, 20-next.length);
|
6565 | }
|
6566 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
6567 | },
|
6568 |
|
6569 | // displays the character position where the lexing error occurred, i.e. for error messages
|
6570 | showPosition:function () {
|
6571 | var pre = this.pastInput();
|
6572 | var c = new Array(pre.length + 1).join("-");
|
6573 | return pre + this.upcomingInput() + "\n" + c + "^";
|
6574 | },
|
6575 |
|
6576 | // test the lexed token: return FALSE when not a match, otherwise return token
|
6577 | test_match:function(match, indexed_rule) {
|
6578 | var token,
|
6579 | lines,
|
6580 | backup;
|
6581 |
|
6582 | if (this.options.backtrack_lexer) {
|
6583 | // save context
|
6584 | backup = {
|
6585 | yylineno: this.yylineno,
|
6586 | yylloc: {
|
6587 | first_line: this.yylloc.first_line,
|
6588 | last_line: this.last_line,
|
6589 | first_column: this.yylloc.first_column,
|
6590 | last_column: this.yylloc.last_column
|
6591 | },
|
6592 | yytext: this.yytext,
|
6593 | match: this.match,
|
6594 | matches: this.matches,
|
6595 | matched: this.matched,
|
6596 | yyleng: this.yyleng,
|
6597 | offset: this.offset,
|
6598 | _more: this._more,
|
6599 | _input: this._input,
|
6600 | yy: this.yy,
|
6601 | conditionStack: this.conditionStack.slice(0),
|
6602 | done: this.done
|
6603 | };
|
6604 | if (this.options.ranges) {
|
6605 | backup.yylloc.range = this.yylloc.range.slice(0);
|
6606 | }
|
6607 | }
|
6608 |
|
6609 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
6610 | if (lines) {
|
6611 | this.yylineno += lines.length;
|
6612 | }
|
6613 | this.yylloc = {
|
6614 | first_line: this.yylloc.last_line,
|
6615 | last_line: this.yylineno + 1,
|
6616 | first_column: this.yylloc.last_column,
|
6617 | last_column: lines ?
|
6618 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
6619 | this.yylloc.last_column + match[0].length
|
6620 | };
|
6621 | this.yytext += match[0];
|
6622 | this.match += match[0];
|
6623 | this.matches = match;
|
6624 | this.yyleng = this.yytext.length;
|
6625 | if (this.options.ranges) {
|
6626 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
6627 | }
|
6628 | this._more = false;
|
6629 | this._backtrack = false;
|
6630 | this._input = this._input.slice(match[0].length);
|
6631 | this.matched += match[0];
|
6632 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
6633 | if (this.done && this._input) {
|
6634 | this.done = false;
|
6635 | }
|
6636 | if (token) {
|
6637 | return token;
|
6638 | } else if (this._backtrack) {
|
6639 | // recover context
|
6640 | for (var k in backup) {
|
6641 | this[k] = backup[k];
|
6642 | }
|
6643 | return false; // rule action called reject() implying the next rule should be tested instead.
|
6644 | }
|
6645 | return false;
|
6646 | },
|
6647 |
|
6648 | // return next match in input
|
6649 | next:function () {
|
6650 | if (this.done) {
|
6651 | return this.EOF;
|
6652 | }
|
6653 | if (!this._input) {
|
6654 | this.done = true;
|
6655 | }
|
6656 |
|
6657 | var token,
|
6658 | match,
|
6659 | tempMatch,
|
6660 | index;
|
6661 | if (!this._more) {
|
6662 | this.yytext = '';
|
6663 | this.match = '';
|
6664 | }
|
6665 | var rules = this._currentRules();
|
6666 | for (var i = 0; i < rules.length; i++) {
|
6667 | tempMatch = this._input.match(this.rules[rules[i]]);
|
6668 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
6669 | match = tempMatch;
|
6670 | index = i;
|
6671 | if (this.options.backtrack_lexer) {
|
6672 | token = this.test_match(tempMatch, rules[i]);
|
6673 | if (token !== false) {
|
6674 | return token;
|
6675 | } else if (this._backtrack) {
|
6676 | match = false;
|
6677 | continue; // rule action called reject() implying a rule MISmatch.
|
6678 | } else {
|
6679 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
6680 | return false;
|
6681 | }
|
6682 | } else if (!this.options.flex) {
|
6683 | break;
|
6684 | }
|
6685 | }
|
6686 | }
|
6687 | if (match) {
|
6688 | token = this.test_match(match, rules[index]);
|
6689 | if (token !== false) {
|
6690 | return token;
|
6691 | }
|
6692 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
6693 | return false;
|
6694 | }
|
6695 | if (this._input === "") {
|
6696 | return this.EOF;
|
6697 | } else {
|
6698 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
6699 | text: "",
|
6700 | token: null,
|
6701 | line: this.yylineno
|
6702 | });
|
6703 | }
|
6704 | },
|
6705 |
|
6706 | // return next match that has a token
|
6707 | lex:function lex () {
|
6708 | var r = this.next();
|
6709 | if (r) {
|
6710 | return r;
|
6711 | } else {
|
6712 | return this.lex();
|
6713 | }
|
6714 | },
|
6715 |
|
6716 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
6717 | begin:function begin (condition) {
|
6718 | this.conditionStack.push(condition);
|
6719 | },
|
6720 |
|
6721 | // pop the previously active lexer condition state off the condition stack
|
6722 | popState:function popState () {
|
6723 | var n = this.conditionStack.length - 1;
|
6724 | if (n > 0) {
|
6725 | return this.conditionStack.pop();
|
6726 | } else {
|
6727 | return this.conditionStack[0];
|
6728 | }
|
6729 | },
|
6730 |
|
6731 | // produce the lexer rule set which is active for the currently active lexer condition state
|
6732 | _currentRules:function _currentRules () {
|
6733 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
6734 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
6735 | } else {
|
6736 | return this.conditions["INITIAL"].rules;
|
6737 | }
|
6738 | },
|
6739 |
|
6740 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
6741 | topState:function topState (n) {
|
6742 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
6743 | if (n >= 0) {
|
6744 | return this.conditionStack[n];
|
6745 | } else {
|
6746 | return "INITIAL";
|
6747 | }
|
6748 | },
|
6749 |
|
6750 | // alias for begin(condition)
|
6751 | pushState:function pushState (condition) {
|
6752 | this.begin(condition);
|
6753 | },
|
6754 |
|
6755 | // return the number of states currently on the stack
|
6756 | stateStackSize:function stateStackSize() {
|
6757 | return this.conditionStack.length;
|
6758 | },
|
6759 | options: {"case-insensitive":true},
|
6760 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
6761 | var YYSTATE=YY_START;
|
6762 | switch($avoiding_name_collisions) {
|
6763 | case 0: this.begin('open_directive'); return 29;
|
6764 | break;
|
6765 | case 1: this.begin('type_directive'); return 30;
|
6766 | break;
|
6767 | case 2: this.popState(); this.begin('arg_directive'); return 24;
|
6768 | break;
|
6769 | case 3: this.popState(); this.popState(); return 32;
|
6770 | break;
|
6771 | case 4:return 31;
|
6772 | break;
|
6773 | case 5:/* skip comments */
|
6774 | break;
|
6775 | case 6:/* skip comments */{ /*console.log('');*/ }
|
6776 | break;
|
6777 | case 7:return 26;
|
6778 | break;
|
6779 | case 8:/* do nothing */
|
6780 | break;
|
6781 | case 9:/* ignore */
|
6782 | break;
|
6783 | case 10: this.begin("title");return 13;
|
6784 | break;
|
6785 | case 11: this.popState(); return "title_value";
|
6786 | break;
|
6787 | case 12: this.begin("acc_title");return 15;
|
6788 | break;
|
6789 | case 13: this.popState(); return "acc_title_value";
|
6790 | break;
|
6791 | case 14: this.begin("acc_descr");return 17;
|
6792 | break;
|
6793 | case 15: this.popState(); return "acc_descr_value";
|
6794 | break;
|
6795 | case 16: this.begin("acc_descr_multiline");
|
6796 | break;
|
6797 | case 17: this.popState();
|
6798 | break;
|
6799 | case 18:return "acc_descr_multiline_value";
|
6800 | break;
|
6801 | case 19: this.begin("string");
|
6802 | break;
|
6803 | case 20: this.popState();
|
6804 | break;
|
6805 | case 21: return "txt";
|
6806 | break;
|
6807 | case 22:return 6;
|
6808 | break;
|
6809 | case 23:return 8;
|
6810 | break;
|
6811 | case 24:return "value";
|
6812 | break;
|
6813 | case 25:return 28;
|
6814 | break;
|
6815 | }
|
6816 | },
|
6817 | rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[\s]+)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:pie\b)/i,/^(?:showData\b)/i,/^(?::[\s]*[\d]+(?:\.[\d]+)?)/i,/^(?:$)/i],
|
6818 | conditions: {"acc_descr_multiline":{"rules":[17,18],"inclusive":false},"acc_descr":{"rules":[15],"inclusive":false},"acc_title":{"rules":[13],"inclusive":false},"close_directive":{"rules":[],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"open_directive":{"rules":[1],"inclusive":false},"title":{"rules":[11],"inclusive":false},"string":{"rules":[20,21],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,12,14,16,19,22,23,24,25],"inclusive":true}}
|
6819 | });
|
6820 | return lexer;
|
6821 | })();
|
6822 | parser.lexer = lexer;
|
6823 | function Parser () {
|
6824 | this.yy = {};
|
6825 | }
|
6826 | Parser.prototype = parser;parser.Parser = Parser;
|
6827 | return new Parser;
|
6828 | })();
|
6829 |
|
6830 |
|
6831 | if (true) {
|
6832 | exports.parser = parser;
|
6833 | exports.Parser = parser.Parser;
|
6834 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
6835 | exports.main = function commonjsMain (args) {
|
6836 | if (!args[1]) {
|
6837 | console.log('Usage: '+args[0]+' FILE');
|
6838 | process.exit(1);
|
6839 | }
|
6840 | var source = (__webpack_require__(/*! fs */ "?a3fa").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
|
6841 | return exports.parser.parse(source);
|
6842 | };
|
6843 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
6844 | exports.main(process.argv.slice(1));
|
6845 | }
|
6846 | }
|
6847 |
|
6848 | /***/ }),
|
6849 |
|
6850 | /***/ "./src/diagrams/requirement/parser/requirementDiagram.jison":
|
6851 | /*!******************************************************************!*\
|
6852 | !*** ./src/diagrams/requirement/parser/requirementDiagram.jison ***!
|
6853 | \******************************************************************/
|
6854 | /***/ ((module, exports, __webpack_require__) => {
|
6855 |
|
6856 | /* module decorator */ module = __webpack_require__.nmd(module);
|
6857 | /* parser generated by jison 0.4.18 */
|
6858 | /*
|
6859 | Returns a Parser object of the following structure:
|
6860 |
|
6861 | Parser: {
|
6862 | yy: {}
|
6863 | }
|
6864 |
|
6865 | Parser.prototype: {
|
6866 | yy: {},
|
6867 | trace: function(),
|
6868 | symbols_: {associative list: name ==> number},
|
6869 | terminals_: {associative list: number ==> name},
|
6870 | productions_: [...],
|
6871 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
6872 | table: [...],
|
6873 | defaultActions: {...},
|
6874 | parseError: function(str, hash),
|
6875 | parse: function(input),
|
6876 |
|
6877 | lexer: {
|
6878 | EOF: 1,
|
6879 | parseError: function(str, hash),
|
6880 | setInput: function(input),
|
6881 | input: function(),
|
6882 | unput: function(str),
|
6883 | more: function(),
|
6884 | less: function(n),
|
6885 | pastInput: function(),
|
6886 | upcomingInput: function(),
|
6887 | showPosition: function(),
|
6888 | test_match: function(regex_match_array, rule_index),
|
6889 | next: function(),
|
6890 | lex: function(),
|
6891 | begin: function(condition),
|
6892 | popState: function(),
|
6893 | _currentRules: function(),
|
6894 | topState: function(),
|
6895 | pushState: function(condition),
|
6896 |
|
6897 | options: {
|
6898 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
6899 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
6900 | backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
|
6901 | },
|
6902 |
|
6903 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
6904 | rules: [...],
|
6905 | conditions: {associative list: name ==> set},
|
6906 | }
|
6907 | }
|
6908 |
|
6909 |
|
6910 | token location info (@$, _$, etc.): {
|
6911 | first_line: n,
|
6912 | last_line: n,
|
6913 | first_column: n,
|
6914 | last_column: n,
|
6915 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
6916 | }
|
6917 |
|
6918 |
|
6919 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
6920 | text: (matched text)
|
6921 | token: (the produced terminal token, if any)
|
6922 | line: (yylineno)
|
6923 | }
|
6924 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
6925 | loc: (yylloc)
|
6926 | expected: (string describing the set of expected tokens)
|
6927 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
6928 | }
|
6929 | */
|
6930 | var parser = (function(){
|
6931 | var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,3],$V1=[1,5],$V2=[1,6],$V3=[1,7],$V4=[1,8],$V5=[5,6,8,14,16,18,19,40,41,42,43,44,45,53,71,72],$V6=[1,22],$V7=[2,13],$V8=[1,26],$V9=[1,27],$Va=[1,28],$Vb=[1,29],$Vc=[1,30],$Vd=[1,31],$Ve=[1,24],$Vf=[1,32],$Vg=[1,33],$Vh=[1,36],$Vi=[71,72],$Vj=[5,8,14,16,18,19,40,41,42,43,44,45,53,60,62,71,72],$Vk=[1,56],$Vl=[1,57],$Vm=[1,58],$Vn=[1,59],$Vo=[1,60],$Vp=[1,61],$Vq=[1,62],$Vr=[62,63],$Vs=[1,74],$Vt=[1,70],$Vu=[1,71],$Vv=[1,72],$Vw=[1,73],$Vx=[1,75],$Vy=[1,79],$Vz=[1,80],$VA=[1,77],$VB=[1,78],$VC=[5,8,14,16,18,19,40,41,42,43,44,45,53,71,72];
|
6932 | var parser = {trace: function trace () { },
|
6933 | yy: {},
|
6934 | symbols_: {"error":2,"start":3,"directive":4,"NEWLINE":5,"RD":6,"diagram":7,"EOF":8,"openDirective":9,"typeDirective":10,"closeDirective":11,":":12,"argDirective":13,"acc_title":14,"acc_title_value":15,"acc_descr":16,"acc_descr_value":17,"acc_descr_multiline_value":18,"open_directive":19,"type_directive":20,"arg_directive":21,"close_directive":22,"requirementDef":23,"elementDef":24,"relationshipDef":25,"requirementType":26,"requirementName":27,"STRUCT_START":28,"requirementBody":29,"ID":30,"COLONSEP":31,"id":32,"TEXT":33,"text":34,"RISK":35,"riskLevel":36,"VERIFYMTHD":37,"verifyType":38,"STRUCT_STOP":39,"REQUIREMENT":40,"FUNCTIONAL_REQUIREMENT":41,"INTERFACE_REQUIREMENT":42,"PERFORMANCE_REQUIREMENT":43,"PHYSICAL_REQUIREMENT":44,"DESIGN_CONSTRAINT":45,"LOW_RISK":46,"MED_RISK":47,"HIGH_RISK":48,"VERIFY_ANALYSIS":49,"VERIFY_DEMONSTRATION":50,"VERIFY_INSPECTION":51,"VERIFY_TEST":52,"ELEMENT":53,"elementName":54,"elementBody":55,"TYPE":56,"type":57,"DOCREF":58,"ref":59,"END_ARROW_L":60,"relationship":61,"LINE":62,"END_ARROW_R":63,"CONTAINS":64,"COPIES":65,"DERIVES":66,"SATISFIES":67,"VERIFIES":68,"REFINES":69,"TRACES":70,"unqString":71,"qString":72,"$accept":0,"$end":1},
|
6935 | terminals_: {2:"error",5:"NEWLINE",6:"RD",8:"EOF",12:":",14:"acc_title",15:"acc_title_value",16:"acc_descr",17:"acc_descr_value",18:"acc_descr_multiline_value",19:"open_directive",20:"type_directive",21:"arg_directive",22:"close_directive",28:"STRUCT_START",30:"ID",31:"COLONSEP",33:"TEXT",35:"RISK",37:"VERIFYMTHD",39:"STRUCT_STOP",40:"REQUIREMENT",41:"FUNCTIONAL_REQUIREMENT",42:"INTERFACE_REQUIREMENT",43:"PERFORMANCE_REQUIREMENT",44:"PHYSICAL_REQUIREMENT",45:"DESIGN_CONSTRAINT",46:"LOW_RISK",47:"MED_RISK",48:"HIGH_RISK",49:"VERIFY_ANALYSIS",50:"VERIFY_DEMONSTRATION",51:"VERIFY_INSPECTION",52:"VERIFY_TEST",53:"ELEMENT",56:"TYPE",58:"DOCREF",60:"END_ARROW_L",62:"LINE",63:"END_ARROW_R",64:"CONTAINS",65:"COPIES",66:"DERIVES",67:"SATISFIES",68:"VERIFIES",69:"REFINES",70:"TRACES",71:"unqString",72:"qString"},
|
6936 | productions_: [0,[3,3],[3,2],[3,4],[4,3],[4,5],[4,2],[4,2],[4,1],[9,1],[10,1],[13,1],[11,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[23,5],[29,5],[29,5],[29,5],[29,5],[29,2],[29,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[36,1],[36,1],[36,1],[38,1],[38,1],[38,1],[38,1],[24,5],[55,5],[55,5],[55,2],[55,1],[25,5],[25,5],[61,1],[61,1],[61,1],[61,1],[61,1],[61,1],[61,1],[27,1],[27,1],[32,1],[32,1],[34,1],[34,1],[54,1],[54,1],[57,1],[57,1],[59,1],[59,1]],
|
6937 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
6938 | /* this == yyval */
|
6939 |
|
6940 | var $0 = $$.length - 1;
|
6941 | switch (yystate) {
|
6942 | case 6:
|
6943 | this.$=$$[$0].trim();yy.setAccTitle(this.$);
|
6944 | break;
|
6945 | case 7: case 8:
|
6946 | this.$=$$[$0].trim();yy.setAccDescription(this.$);
|
6947 | break;
|
6948 | case 9:
|
6949 | yy.parseDirective('%%{', 'open_directive');
|
6950 | break;
|
6951 | case 10:
|
6952 | yy.parseDirective($$[$0], 'type_directive');
|
6953 | break;
|
6954 | case 11:
|
6955 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
6956 | break;
|
6957 | case 12:
|
6958 | yy.parseDirective('}%%', 'close_directive', 'pie');
|
6959 | break;
|
6960 | case 13:
|
6961 | this.$ = []
|
6962 | break;
|
6963 | case 19:
|
6964 | yy.addRequirement($$[$0-3], $$[$0-4])
|
6965 | break;
|
6966 | case 20:
|
6967 | yy.setNewReqId($$[$0-2]);
|
6968 | break;
|
6969 | case 21:
|
6970 | yy.setNewReqText($$[$0-2]);
|
6971 | break;
|
6972 | case 22:
|
6973 | yy.setNewReqRisk($$[$0-2]);
|
6974 | break;
|
6975 | case 23:
|
6976 | yy.setNewReqVerifyMethod($$[$0-2]);
|
6977 | break;
|
6978 | case 26:
|
6979 | this.$=yy.RequirementType.REQUIREMENT;
|
6980 | break;
|
6981 | case 27:
|
6982 | this.$=yy.RequirementType.FUNCTIONAL_REQUIREMENT;
|
6983 | break;
|
6984 | case 28:
|
6985 | this.$=yy.RequirementType.INTERFACE_REQUIREMENT;
|
6986 | break;
|
6987 | case 29:
|
6988 | this.$=yy.RequirementType.PERFORMANCE_REQUIREMENT;
|
6989 | break;
|
6990 | case 30:
|
6991 | this.$=yy.RequirementType.PHYSICAL_REQUIREMENT;
|
6992 | break;
|
6993 | case 31:
|
6994 | this.$=yy.RequirementType.DESIGN_CONSTRAINT;
|
6995 | break;
|
6996 | case 32:
|
6997 | this.$=yy.RiskLevel.LOW_RISK;
|
6998 | break;
|
6999 | case 33:
|
7000 | this.$=yy.RiskLevel.MED_RISK;
|
7001 | break;
|
7002 | case 34:
|
7003 | this.$=yy.RiskLevel.HIGH_RISK;
|
7004 | break;
|
7005 | case 35:
|
7006 | this.$=yy.VerifyType.VERIFY_ANALYSIS;
|
7007 | break;
|
7008 | case 36:
|
7009 | this.$=yy.VerifyType.VERIFY_DEMONSTRATION;
|
7010 | break;
|
7011 | case 37:
|
7012 | this.$=yy.VerifyType.VERIFY_INSPECTION;
|
7013 | break;
|
7014 | case 38:
|
7015 | this.$=yy.VerifyType.VERIFY_TEST;
|
7016 | break;
|
7017 | case 39:
|
7018 | yy.addElement($$[$0-3])
|
7019 | break;
|
7020 | case 40:
|
7021 | yy.setNewElementType($$[$0-2]);
|
7022 | break;
|
7023 | case 41:
|
7024 | yy.setNewElementDocRef($$[$0-2]);
|
7025 | break;
|
7026 | case 44:
|
7027 | yy.addRelationship($$[$0-2], $$[$0], $$[$0-4])
|
7028 | break;
|
7029 | case 45:
|
7030 | yy.addRelationship($$[$0-2], $$[$0-4], $$[$0])
|
7031 | break;
|
7032 | case 46:
|
7033 | this.$=yy.Relationships.CONTAINS;
|
7034 | break;
|
7035 | case 47:
|
7036 | this.$=yy.Relationships.COPIES;
|
7037 | break;
|
7038 | case 48:
|
7039 | this.$=yy.Relationships.DERIVES;
|
7040 | break;
|
7041 | case 49:
|
7042 | this.$=yy.Relationships.SATISFIES;
|
7043 | break;
|
7044 | case 50:
|
7045 | this.$=yy.Relationships.VERIFIES;
|
7046 | break;
|
7047 | case 51:
|
7048 | this.$=yy.Relationships.REFINES;
|
7049 | break;
|
7050 | case 52:
|
7051 | this.$=yy.Relationships.TRACES;
|
7052 | break;
|
7053 | }
|
7054 | },
|
7055 | table: [{3:1,4:2,6:$V0,9:4,14:$V1,16:$V2,18:$V3,19:$V4},{1:[3]},{3:10,4:2,5:[1,9],6:$V0,9:4,14:$V1,16:$V2,18:$V3,19:$V4},{5:[1,11]},{10:12,20:[1,13]},{15:[1,14]},{17:[1,15]},o($V5,[2,8]),{20:[2,9]},{3:16,4:2,6:$V0,9:4,14:$V1,16:$V2,18:$V3,19:$V4},{1:[2,2]},{4:21,5:$V6,7:17,8:$V7,9:4,14:$V1,16:$V2,18:$V3,19:$V4,23:18,24:19,25:20,26:23,32:25,40:$V8,41:$V9,42:$Va,43:$Vb,44:$Vc,45:$Vd,53:$Ve,71:$Vf,72:$Vg},{11:34,12:[1,35],22:$Vh},o([12,22],[2,10]),o($V5,[2,6]),o($V5,[2,7]),{1:[2,1]},{8:[1,37]},{4:21,5:$V6,7:38,8:$V7,9:4,14:$V1,16:$V2,18:$V3,19:$V4,23:18,24:19,25:20,26:23,32:25,40:$V8,41:$V9,42:$Va,43:$Vb,44:$Vc,45:$Vd,53:$Ve,71:$Vf,72:$Vg},{4:21,5:$V6,7:39,8:$V7,9:4,14:$V1,16:$V2,18:$V3,19:$V4,23:18,24:19,25:20,26:23,32:25,40:$V8,41:$V9,42:$Va,43:$Vb,44:$Vc,45:$Vd,53:$Ve,71:$Vf,72:$Vg},{4:21,5:$V6,7:40,8:$V7,9:4,14:$V1,16:$V2,18:$V3,19:$V4,23:18,24:19,25:20,26:23,32:25,40:$V8,41:$V9,42:$Va,43:$Vb,44:$Vc,45:$Vd,53:$Ve,71:$Vf,72:$Vg},{4:21,5:$V6,7:41,8:$V7,9:4,14:$V1,16:$V2,18:$V3,19:$V4,23:18,24:19,25:20,26:23,32:25,40:$V8,41:$V9,42:$Va,43:$Vb,44:$Vc,45:$Vd,53:$Ve,71:$Vf,72:$Vg},{4:21,5:$V6,7:42,8:$V7,9:4,14:$V1,16:$V2,18:$V3,19:$V4,23:18,24:19,25:20,26:23,32:25,40:$V8,41:$V9,42:$Va,43:$Vb,44:$Vc,45:$Vd,53:$Ve,71:$Vf,72:$Vg},{27:43,71:[1,44],72:[1,45]},{54:46,71:[1,47],72:[1,48]},{60:[1,49],62:[1,50]},o($Vi,[2,26]),o($Vi,[2,27]),o($Vi,[2,28]),o($Vi,[2,29]),o($Vi,[2,30]),o($Vi,[2,31]),o($Vj,[2,55]),o($Vj,[2,56]),o($V5,[2,4]),{13:51,21:[1,52]},o($V5,[2,12]),{1:[2,3]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{8:[2,17]},{8:[2,18]},{28:[1,53]},{28:[2,53]},{28:[2,54]},{28:[1,54]},{28:[2,59]},{28:[2,60]},{61:55,64:$Vk,65:$Vl,66:$Vm,67:$Vn,68:$Vo,69:$Vp,70:$Vq},{61:63,64:$Vk,65:$Vl,66:$Vm,67:$Vn,68:$Vo,69:$Vp,70:$Vq},{11:64,22:$Vh},{22:[2,11]},{5:[1,65]},{5:[1,66]},{62:[1,67]},o($Vr,[2,46]),o($Vr,[2,47]),o($Vr,[2,48]),o($Vr,[2,49]),o($Vr,[2,50]),o($Vr,[2,51]),o($Vr,[2,52]),{63:[1,68]},o($V5,[2,5]),{5:$Vs,29:69,30:$Vt,33:$Vu,35:$Vv,37:$Vw,39:$Vx},{5:$Vy,39:$Vz,55:76,56:$VA,58:$VB},{32:81,71:$Vf,72:$Vg},{32:82,71:$Vf,72:$Vg},o($VC,[2,19]),{31:[1,83]},{31:[1,84]},{31:[1,85]},{31:[1,86]},{5:$Vs,29:87,30:$Vt,33:$Vu,35:$Vv,37:$Vw,39:$Vx},o($VC,[2,25]),o($VC,[2,39]),{31:[1,88]},{31:[1,89]},{5:$Vy,39:$Vz,55:90,56:$VA,58:$VB},o($VC,[2,43]),o($VC,[2,44]),o($VC,[2,45]),{32:91,71:$Vf,72:$Vg},{34:92,71:[1,93],72:[1,94]},{36:95,46:[1,96],47:[1,97],48:[1,98]},{38:99,49:[1,100],50:[1,101],51:[1,102],52:[1,103]},o($VC,[2,24]),{57:104,71:[1,105],72:[1,106]},{59:107,71:[1,108],72:[1,109]},o($VC,[2,42]),{5:[1,110]},{5:[1,111]},{5:[2,57]},{5:[2,58]},{5:[1,112]},{5:[2,32]},{5:[2,33]},{5:[2,34]},{5:[1,113]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[2,38]},{5:[1,114]},{5:[2,61]},{5:[2,62]},{5:[1,115]},{5:[2,63]},{5:[2,64]},{5:$Vs,29:116,30:$Vt,33:$Vu,35:$Vv,37:$Vw,39:$Vx},{5:$Vs,29:117,30:$Vt,33:$Vu,35:$Vv,37:$Vw,39:$Vx},{5:$Vs,29:118,30:$Vt,33:$Vu,35:$Vv,37:$Vw,39:$Vx},{5:$Vs,29:119,30:$Vt,33:$Vu,35:$Vv,37:$Vw,39:$Vx},{5:$Vy,39:$Vz,55:120,56:$VA,58:$VB},{5:$Vy,39:$Vz,55:121,56:$VA,58:$VB},o($VC,[2,20]),o($VC,[2,21]),o($VC,[2,22]),o($VC,[2,23]),o($VC,[2,40]),o($VC,[2,41])],
|
7056 | defaultActions: {8:[2,9],10:[2,2],16:[2,1],37:[2,3],38:[2,14],39:[2,15],40:[2,16],41:[2,17],42:[2,18],44:[2,53],45:[2,54],47:[2,59],48:[2,60],52:[2,11],93:[2,57],94:[2,58],96:[2,32],97:[2,33],98:[2,34],100:[2,35],101:[2,36],102:[2,37],103:[2,38],105:[2,61],106:[2,62],108:[2,63],109:[2,64]},
|
7057 | parseError: function parseError (str, hash) {
|
7058 | if (hash.recoverable) {
|
7059 | this.trace(str);
|
7060 | } else {
|
7061 | var error = new Error(str);
|
7062 | error.hash = hash;
|
7063 | throw error;
|
7064 | }
|
7065 | },
|
7066 | parse: function parse(input) {
|
7067 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
7068 | var args = lstack.slice.call(arguments, 1);
|
7069 | var lexer = Object.create(this.lexer);
|
7070 | var sharedState = { yy: {} };
|
7071 | for (var k in this.yy) {
|
7072 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
7073 | sharedState.yy[k] = this.yy[k];
|
7074 | }
|
7075 | }
|
7076 | lexer.setInput(input, sharedState.yy);
|
7077 | sharedState.yy.lexer = lexer;
|
7078 | sharedState.yy.parser = this;
|
7079 | if (typeof lexer.yylloc == 'undefined') {
|
7080 | lexer.yylloc = {};
|
7081 | }
|
7082 | var yyloc = lexer.yylloc;
|
7083 | lstack.push(yyloc);
|
7084 | var ranges = lexer.options && lexer.options.ranges;
|
7085 | if (typeof sharedState.yy.parseError === 'function') {
|
7086 | this.parseError = sharedState.yy.parseError;
|
7087 | } else {
|
7088 | this.parseError = Object.getPrototypeOf(this).parseError;
|
7089 | }
|
7090 | function popStack(n) {
|
7091 | stack.length = stack.length - 2 * n;
|
7092 | vstack.length = vstack.length - n;
|
7093 | lstack.length = lstack.length - n;
|
7094 | }
|
7095 | function lex() {
|
7096 | var token;
|
7097 | token = tstack.pop() || lexer.lex() || EOF;
|
7098 | if (typeof token !== 'number') {
|
7099 | if (token instanceof Array) {
|
7100 | tstack = token;
|
7101 | token = tstack.pop();
|
7102 | }
|
7103 | token = self.symbols_[token] || token;
|
7104 | }
|
7105 | return token;
|
7106 | }
|
7107 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
7108 | while (true) {
|
7109 | state = stack[stack.length - 1];
|
7110 | if (this.defaultActions[state]) {
|
7111 | action = this.defaultActions[state];
|
7112 | } else {
|
7113 | if (symbol === null || typeof symbol == 'undefined') {
|
7114 | symbol = lex();
|
7115 | }
|
7116 | action = table[state] && table[state][symbol];
|
7117 | }
|
7118 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
7119 | var errStr = '';
|
7120 | expected = [];
|
7121 | for (p in table[state]) {
|
7122 | if (this.terminals_[p] && p > TERROR) {
|
7123 | expected.push('\'' + this.terminals_[p] + '\'');
|
7124 | }
|
7125 | }
|
7126 | if (lexer.showPosition) {
|
7127 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
7128 | } else {
|
7129 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
7130 | }
|
7131 | this.parseError(errStr, {
|
7132 | text: lexer.match,
|
7133 | token: this.terminals_[symbol] || symbol,
|
7134 | line: lexer.yylineno,
|
7135 | loc: yyloc,
|
7136 | expected: expected
|
7137 | });
|
7138 | }
|
7139 | if (action[0] instanceof Array && action.length > 1) {
|
7140 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
7141 | }
|
7142 | switch (action[0]) {
|
7143 | case 1:
|
7144 | stack.push(symbol);
|
7145 | vstack.push(lexer.yytext);
|
7146 | lstack.push(lexer.yylloc);
|
7147 | stack.push(action[1]);
|
7148 | symbol = null;
|
7149 | if (!preErrorSymbol) {
|
7150 | yyleng = lexer.yyleng;
|
7151 | yytext = lexer.yytext;
|
7152 | yylineno = lexer.yylineno;
|
7153 | yyloc = lexer.yylloc;
|
7154 | if (recovering > 0) {
|
7155 | recovering--;
|
7156 | }
|
7157 | } else {
|
7158 | symbol = preErrorSymbol;
|
7159 | preErrorSymbol = null;
|
7160 | }
|
7161 | break;
|
7162 | case 2:
|
7163 | len = this.productions_[action[1]][1];
|
7164 | yyval.$ = vstack[vstack.length - len];
|
7165 | yyval._$ = {
|
7166 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
7167 | last_line: lstack[lstack.length - 1].last_line,
|
7168 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
7169 | last_column: lstack[lstack.length - 1].last_column
|
7170 | };
|
7171 | if (ranges) {
|
7172 | yyval._$.range = [
|
7173 | lstack[lstack.length - (len || 1)].range[0],
|
7174 | lstack[lstack.length - 1].range[1]
|
7175 | ];
|
7176 | }
|
7177 | r = this.performAction.apply(yyval, [
|
7178 | yytext,
|
7179 | yyleng,
|
7180 | yylineno,
|
7181 | sharedState.yy,
|
7182 | action[1],
|
7183 | vstack,
|
7184 | lstack
|
7185 | ].concat(args));
|
7186 | if (typeof r !== 'undefined') {
|
7187 | return r;
|
7188 | }
|
7189 | if (len) {
|
7190 | stack = stack.slice(0, -1 * len * 2);
|
7191 | vstack = vstack.slice(0, -1 * len);
|
7192 | lstack = lstack.slice(0, -1 * len);
|
7193 | }
|
7194 | stack.push(this.productions_[action[1]][0]);
|
7195 | vstack.push(yyval.$);
|
7196 | lstack.push(yyval._$);
|
7197 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
7198 | stack.push(newState);
|
7199 | break;
|
7200 | case 3:
|
7201 | return true;
|
7202 | }
|
7203 | }
|
7204 | return true;
|
7205 | }};
|
7206 |
|
7207 | /* generated by jison-lex 0.3.4 */
|
7208 | var lexer = (function(){
|
7209 | var lexer = ({
|
7210 |
|
7211 | EOF:1,
|
7212 |
|
7213 | parseError:function parseError(str, hash) {
|
7214 | if (this.yy.parser) {
|
7215 | this.yy.parser.parseError(str, hash);
|
7216 | } else {
|
7217 | throw new Error(str);
|
7218 | }
|
7219 | },
|
7220 |
|
7221 | // resets the lexer, sets new input
|
7222 | setInput:function (input, yy) {
|
7223 | this.yy = yy || this.yy || {};
|
7224 | this._input = input;
|
7225 | this._more = this._backtrack = this.done = false;
|
7226 | this.yylineno = this.yyleng = 0;
|
7227 | this.yytext = this.matched = this.match = '';
|
7228 | this.conditionStack = ['INITIAL'];
|
7229 | this.yylloc = {
|
7230 | first_line: 1,
|
7231 | first_column: 0,
|
7232 | last_line: 1,
|
7233 | last_column: 0
|
7234 | };
|
7235 | if (this.options.ranges) {
|
7236 | this.yylloc.range = [0,0];
|
7237 | }
|
7238 | this.offset = 0;
|
7239 | return this;
|
7240 | },
|
7241 |
|
7242 | // consumes and returns one char from the input
|
7243 | input:function () {
|
7244 | var ch = this._input[0];
|
7245 | this.yytext += ch;
|
7246 | this.yyleng++;
|
7247 | this.offset++;
|
7248 | this.match += ch;
|
7249 | this.matched += ch;
|
7250 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
7251 | if (lines) {
|
7252 | this.yylineno++;
|
7253 | this.yylloc.last_line++;
|
7254 | } else {
|
7255 | this.yylloc.last_column++;
|
7256 | }
|
7257 | if (this.options.ranges) {
|
7258 | this.yylloc.range[1]++;
|
7259 | }
|
7260 |
|
7261 | this._input = this._input.slice(1);
|
7262 | return ch;
|
7263 | },
|
7264 |
|
7265 | // unshifts one char (or a string) into the input
|
7266 | unput:function (ch) {
|
7267 | var len = ch.length;
|
7268 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
7269 |
|
7270 | this._input = ch + this._input;
|
7271 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
7272 | //this.yyleng -= len;
|
7273 | this.offset -= len;
|
7274 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
7275 | this.match = this.match.substr(0, this.match.length - 1);
|
7276 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
7277 |
|
7278 | if (lines.length - 1) {
|
7279 | this.yylineno -= lines.length - 1;
|
7280 | }
|
7281 | var r = this.yylloc.range;
|
7282 |
|
7283 | this.yylloc = {
|
7284 | first_line: this.yylloc.first_line,
|
7285 | last_line: this.yylineno + 1,
|
7286 | first_column: this.yylloc.first_column,
|
7287 | last_column: lines ?
|
7288 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
7289 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
7290 | this.yylloc.first_column - len
|
7291 | };
|
7292 |
|
7293 | if (this.options.ranges) {
|
7294 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
7295 | }
|
7296 | this.yyleng = this.yytext.length;
|
7297 | return this;
|
7298 | },
|
7299 |
|
7300 | // When called from action, caches matched text and appends it on next action
|
7301 | more:function () {
|
7302 | this._more = true;
|
7303 | return this;
|
7304 | },
|
7305 |
|
7306 | // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
|
7307 | reject:function () {
|
7308 | if (this.options.backtrack_lexer) {
|
7309 | this._backtrack = true;
|
7310 | } else {
|
7311 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
|
7312 | text: "",
|
7313 | token: null,
|
7314 | line: this.yylineno
|
7315 | });
|
7316 |
|
7317 | }
|
7318 | return this;
|
7319 | },
|
7320 |
|
7321 | // retain first n characters of the match
|
7322 | less:function (n) {
|
7323 | this.unput(this.match.slice(n));
|
7324 | },
|
7325 |
|
7326 | // displays already matched input, i.e. for error messages
|
7327 | pastInput:function () {
|
7328 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
7329 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
7330 | },
|
7331 |
|
7332 | // displays upcoming input, i.e. for error messages
|
7333 | upcomingInput:function () {
|
7334 | var next = this.match;
|
7335 | if (next.length < 20) {
|
7336 | next += this._input.substr(0, 20-next.length);
|
7337 | }
|
7338 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
7339 | },
|
7340 |
|
7341 | // displays the character position where the lexing error occurred, i.e. for error messages
|
7342 | showPosition:function () {
|
7343 | var pre = this.pastInput();
|
7344 | var c = new Array(pre.length + 1).join("-");
|
7345 | return pre + this.upcomingInput() + "\n" + c + "^";
|
7346 | },
|
7347 |
|
7348 | // test the lexed token: return FALSE when not a match, otherwise return token
|
7349 | test_match:function(match, indexed_rule) {
|
7350 | var token,
|
7351 | lines,
|
7352 | backup;
|
7353 |
|
7354 | if (this.options.backtrack_lexer) {
|
7355 | // save context
|
7356 | backup = {
|
7357 | yylineno: this.yylineno,
|
7358 | yylloc: {
|
7359 | first_line: this.yylloc.first_line,
|
7360 | last_line: this.last_line,
|
7361 | first_column: this.yylloc.first_column,
|
7362 | last_column: this.yylloc.last_column
|
7363 | },
|
7364 | yytext: this.yytext,
|
7365 | match: this.match,
|
7366 | matches: this.matches,
|
7367 | matched: this.matched,
|
7368 | yyleng: this.yyleng,
|
7369 | offset: this.offset,
|
7370 | _more: this._more,
|
7371 | _input: this._input,
|
7372 | yy: this.yy,
|
7373 | conditionStack: this.conditionStack.slice(0),
|
7374 | done: this.done
|
7375 | };
|
7376 | if (this.options.ranges) {
|
7377 | backup.yylloc.range = this.yylloc.range.slice(0);
|
7378 | }
|
7379 | }
|
7380 |
|
7381 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
7382 | if (lines) {
|
7383 | this.yylineno += lines.length;
|
7384 | }
|
7385 | this.yylloc = {
|
7386 | first_line: this.yylloc.last_line,
|
7387 | last_line: this.yylineno + 1,
|
7388 | first_column: this.yylloc.last_column,
|
7389 | last_column: lines ?
|
7390 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
7391 | this.yylloc.last_column + match[0].length
|
7392 | };
|
7393 | this.yytext += match[0];
|
7394 | this.match += match[0];
|
7395 | this.matches = match;
|
7396 | this.yyleng = this.yytext.length;
|
7397 | if (this.options.ranges) {
|
7398 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
7399 | }
|
7400 | this._more = false;
|
7401 | this._backtrack = false;
|
7402 | this._input = this._input.slice(match[0].length);
|
7403 | this.matched += match[0];
|
7404 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
7405 | if (this.done && this._input) {
|
7406 | this.done = false;
|
7407 | }
|
7408 | if (token) {
|
7409 | return token;
|
7410 | } else if (this._backtrack) {
|
7411 | // recover context
|
7412 | for (var k in backup) {
|
7413 | this[k] = backup[k];
|
7414 | }
|
7415 | return false; // rule action called reject() implying the next rule should be tested instead.
|
7416 | }
|
7417 | return false;
|
7418 | },
|
7419 |
|
7420 | // return next match in input
|
7421 | next:function () {
|
7422 | if (this.done) {
|
7423 | return this.EOF;
|
7424 | }
|
7425 | if (!this._input) {
|
7426 | this.done = true;
|
7427 | }
|
7428 |
|
7429 | var token,
|
7430 | match,
|
7431 | tempMatch,
|
7432 | index;
|
7433 | if (!this._more) {
|
7434 | this.yytext = '';
|
7435 | this.match = '';
|
7436 | }
|
7437 | var rules = this._currentRules();
|
7438 | for (var i = 0; i < rules.length; i++) {
|
7439 | tempMatch = this._input.match(this.rules[rules[i]]);
|
7440 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
7441 | match = tempMatch;
|
7442 | index = i;
|
7443 | if (this.options.backtrack_lexer) {
|
7444 | token = this.test_match(tempMatch, rules[i]);
|
7445 | if (token !== false) {
|
7446 | return token;
|
7447 | } else if (this._backtrack) {
|
7448 | match = false;
|
7449 | continue; // rule action called reject() implying a rule MISmatch.
|
7450 | } else {
|
7451 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
7452 | return false;
|
7453 | }
|
7454 | } else if (!this.options.flex) {
|
7455 | break;
|
7456 | }
|
7457 | }
|
7458 | }
|
7459 | if (match) {
|
7460 | token = this.test_match(match, rules[index]);
|
7461 | if (token !== false) {
|
7462 | return token;
|
7463 | }
|
7464 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
7465 | return false;
|
7466 | }
|
7467 | if (this._input === "") {
|
7468 | return this.EOF;
|
7469 | } else {
|
7470 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
7471 | text: "",
|
7472 | token: null,
|
7473 | line: this.yylineno
|
7474 | });
|
7475 | }
|
7476 | },
|
7477 |
|
7478 | // return next match that has a token
|
7479 | lex:function lex () {
|
7480 | var r = this.next();
|
7481 | if (r) {
|
7482 | return r;
|
7483 | } else {
|
7484 | return this.lex();
|
7485 | }
|
7486 | },
|
7487 |
|
7488 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
7489 | begin:function begin (condition) {
|
7490 | this.conditionStack.push(condition);
|
7491 | },
|
7492 |
|
7493 | // pop the previously active lexer condition state off the condition stack
|
7494 | popState:function popState () {
|
7495 | var n = this.conditionStack.length - 1;
|
7496 | if (n > 0) {
|
7497 | return this.conditionStack.pop();
|
7498 | } else {
|
7499 | return this.conditionStack[0];
|
7500 | }
|
7501 | },
|
7502 |
|
7503 | // produce the lexer rule set which is active for the currently active lexer condition state
|
7504 | _currentRules:function _currentRules () {
|
7505 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
7506 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
7507 | } else {
|
7508 | return this.conditions["INITIAL"].rules;
|
7509 | }
|
7510 | },
|
7511 |
|
7512 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
7513 | topState:function topState (n) {
|
7514 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
7515 | if (n >= 0) {
|
7516 | return this.conditionStack[n];
|
7517 | } else {
|
7518 | return "INITIAL";
|
7519 | }
|
7520 | },
|
7521 |
|
7522 | // alias for begin(condition)
|
7523 | pushState:function pushState (condition) {
|
7524 | this.begin(condition);
|
7525 | },
|
7526 |
|
7527 | // return the number of states currently on the stack
|
7528 | stateStackSize:function stateStackSize() {
|
7529 | return this.conditionStack.length;
|
7530 | },
|
7531 | options: {"case-insensitive":true},
|
7532 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
7533 | var YYSTATE=YY_START;
|
7534 | switch($avoiding_name_collisions) {
|
7535 | case 0: this.begin('open_directive'); return 19;
|
7536 | break;
|
7537 | case 1: this.begin('type_directive'); return 20;
|
7538 | break;
|
7539 | case 2: this.popState(); this.begin('arg_directive'); return 12;
|
7540 | break;
|
7541 | case 3: this.popState(); this.popState(); return 22;
|
7542 | break;
|
7543 | case 4:return 21;
|
7544 | break;
|
7545 | case 5:return 'title';
|
7546 | break;
|
7547 | case 6: this.begin("acc_title");return 14;
|
7548 | break;
|
7549 | case 7: this.popState(); return "acc_title_value";
|
7550 | break;
|
7551 | case 8: this.begin("acc_descr");return 16;
|
7552 | break;
|
7553 | case 9: this.popState(); return "acc_descr_value";
|
7554 | break;
|
7555 | case 10: this.begin("acc_descr_multiline");
|
7556 | break;
|
7557 | case 11: this.popState();
|
7558 | break;
|
7559 | case 12:return "acc_descr_multiline_value";
|
7560 | break;
|
7561 | case 13:return 5;
|
7562 | break;
|
7563 | case 14:/* skip all whitespace */
|
7564 | break;
|
7565 | case 15:/* skip comments */
|
7566 | break;
|
7567 | case 16:/* skip comments */
|
7568 | break;
|
7569 | case 17:return 8;
|
7570 | break;
|
7571 | case 18:return 6;
|
7572 | break;
|
7573 | case 19:return 28;
|
7574 | break;
|
7575 | case 20:return 39;
|
7576 | break;
|
7577 | case 21:return 31;
|
7578 | break;
|
7579 | case 22:return 30;
|
7580 | break;
|
7581 | case 23:return 33;
|
7582 | break;
|
7583 | case 24:return 35;
|
7584 | break;
|
7585 | case 25:return 37;
|
7586 | break;
|
7587 | case 26:return 40;
|
7588 | break;
|
7589 | case 27:return 41;
|
7590 | break;
|
7591 | case 28:return 42;
|
7592 | break;
|
7593 | case 29:return 43;
|
7594 | break;
|
7595 | case 30:return 44;
|
7596 | break;
|
7597 | case 31:return 45;
|
7598 | break;
|
7599 | case 32:return 46;
|
7600 | break;
|
7601 | case 33:return 47;
|
7602 | break;
|
7603 | case 34:return 48;
|
7604 | break;
|
7605 | case 35:return 49;
|
7606 | break;
|
7607 | case 36:return 50;
|
7608 | break;
|
7609 | case 37:return 51;
|
7610 | break;
|
7611 | case 38:return 52;
|
7612 | break;
|
7613 | case 39:return 53;
|
7614 | break;
|
7615 | case 40:return 64;
|
7616 | break;
|
7617 | case 41:return 65;
|
7618 | break;
|
7619 | case 42:return 66;
|
7620 | break;
|
7621 | case 43:return 67;
|
7622 | break;
|
7623 | case 44:return 68;
|
7624 | break;
|
7625 | case 45:return 69;
|
7626 | break;
|
7627 | case 46:return 70;
|
7628 | break;
|
7629 | case 47:return 56;
|
7630 | break;
|
7631 | case 48:return 58;
|
7632 | break;
|
7633 | case 49:return 60;
|
7634 | break;
|
7635 | case 50:return 63;
|
7636 | break;
|
7637 | case 51:return 62;
|
7638 | break;
|
7639 | case 52: this.begin("string");
|
7640 | break;
|
7641 | case 53: this.popState();
|
7642 | break;
|
7643 | case 54: return "qString";
|
7644 | break;
|
7645 | case 55: yy_.yytext = yy_.yytext.trim(); return 71;
|
7646 | break;
|
7647 | }
|
7648 | },
|
7649 | rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\b)/i,/^(?:\{)/i,/^(?:\})/i,/^(?::)/i,/^(?:id\b)/i,/^(?:text\b)/i,/^(?:risk\b)/i,/^(?:verifyMethod\b)/i,/^(?:requirement\b)/i,/^(?:functionalRequirement\b)/i,/^(?:interfaceRequirement\b)/i,/^(?:performanceRequirement\b)/i,/^(?:physicalRequirement\b)/i,/^(?:designConstraint\b)/i,/^(?:low\b)/i,/^(?:medium\b)/i,/^(?:high\b)/i,/^(?:analysis\b)/i,/^(?:demonstration\b)/i,/^(?:inspection\b)/i,/^(?:test\b)/i,/^(?:element\b)/i,/^(?:contains\b)/i,/^(?:copies\b)/i,/^(?:derives\b)/i,/^(?:satisfies\b)/i,/^(?:verifies\b)/i,/^(?:refines\b)/i,/^(?:traces\b)/i,/^(?:type\b)/i,/^(?:docref\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[\w][^\r\n\{\<\>\-\=]*)/i],
|
7650 | conditions: {"acc_descr_multiline":{"rules":[11,12],"inclusive":false},"acc_descr":{"rules":[9],"inclusive":false},"acc_title":{"rules":[7],"inclusive":false},"close_directive":{"rules":[],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"open_directive":{"rules":[1],"inclusive":false},"unqString":{"rules":[],"inclusive":false},"token":{"rules":[],"inclusive":false},"string":{"rules":[53,54],"inclusive":false},"INITIAL":{"rules":[0,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,55],"inclusive":true}}
|
7651 | });
|
7652 | return lexer;
|
7653 | })();
|
7654 | parser.lexer = lexer;
|
7655 | function Parser () {
|
7656 | this.yy = {};
|
7657 | }
|
7658 | Parser.prototype = parser;parser.Parser = Parser;
|
7659 | return new Parser;
|
7660 | })();
|
7661 |
|
7662 |
|
7663 | if (true) {
|
7664 | exports.parser = parser;
|
7665 | exports.Parser = parser.Parser;
|
7666 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
7667 | exports.main = function commonjsMain (args) {
|
7668 | if (!args[1]) {
|
7669 | console.log('Usage: '+args[0]+' FILE');
|
7670 | process.exit(1);
|
7671 | }
|
7672 | var source = (__webpack_require__(/*! fs */ "?ebf4").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
|
7673 | return exports.parser.parse(source);
|
7674 | };
|
7675 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
7676 | exports.main(process.argv.slice(1));
|
7677 | }
|
7678 | }
|
7679 |
|
7680 | /***/ }),
|
7681 |
|
7682 | /***/ "./src/diagrams/sequence/parser/sequenceDiagram.jison":
|
7683 | /*!************************************************************!*\
|
7684 | !*** ./src/diagrams/sequence/parser/sequenceDiagram.jison ***!
|
7685 | \************************************************************/
|
7686 | /***/ ((module, exports, __webpack_require__) => {
|
7687 |
|
7688 | /* module decorator */ module = __webpack_require__.nmd(module);
|
7689 | /* parser generated by jison 0.4.18 */
|
7690 | /*
|
7691 | Returns a Parser object of the following structure:
|
7692 |
|
7693 | Parser: {
|
7694 | yy: {}
|
7695 | }
|
7696 |
|
7697 | Parser.prototype: {
|
7698 | yy: {},
|
7699 | trace: function(),
|
7700 | symbols_: {associative list: name ==> number},
|
7701 | terminals_: {associative list: number ==> name},
|
7702 | productions_: [...],
|
7703 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
7704 | table: [...],
|
7705 | defaultActions: {...},
|
7706 | parseError: function(str, hash),
|
7707 | parse: function(input),
|
7708 |
|
7709 | lexer: {
|
7710 | EOF: 1,
|
7711 | parseError: function(str, hash),
|
7712 | setInput: function(input),
|
7713 | input: function(),
|
7714 | unput: function(str),
|
7715 | more: function(),
|
7716 | less: function(n),
|
7717 | pastInput: function(),
|
7718 | upcomingInput: function(),
|
7719 | showPosition: function(),
|
7720 | test_match: function(regex_match_array, rule_index),
|
7721 | next: function(),
|
7722 | lex: function(),
|
7723 | begin: function(condition),
|
7724 | popState: function(),
|
7725 | _currentRules: function(),
|
7726 | topState: function(),
|
7727 | pushState: function(condition),
|
7728 |
|
7729 | options: {
|
7730 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
7731 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
7732 | backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
|
7733 | },
|
7734 |
|
7735 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
7736 | rules: [...],
|
7737 | conditions: {associative list: name ==> set},
|
7738 | }
|
7739 | }
|
7740 |
|
7741 |
|
7742 | token location info (@$, _$, etc.): {
|
7743 | first_line: n,
|
7744 | last_line: n,
|
7745 | first_column: n,
|
7746 | last_column: n,
|
7747 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
7748 | }
|
7749 |
|
7750 |
|
7751 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
7752 | text: (matched text)
|
7753 | token: (the produced terminal token, if any)
|
7754 | line: (yylineno)
|
7755 | }
|
7756 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
7757 | loc: (yylloc)
|
7758 | expected: (string describing the set of expected tokens)
|
7759 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
7760 | }
|
7761 | */
|
7762 | var parser = (function(){
|
7763 | var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,2],$V1=[1,3],$V2=[1,5],$V3=[1,7],$V4=[2,5],$V5=[1,15],$V6=[1,17],$V7=[1,18],$V8=[1,19],$V9=[1,21],$Va=[1,22],$Vb=[1,23],$Vc=[1,29],$Vd=[1,30],$Ve=[1,31],$Vf=[1,32],$Vg=[1,33],$Vh=[1,34],$Vi=[1,35],$Vj=[1,36],$Vk=[1,37],$Vl=[1,38],$Vm=[1,39],$Vn=[1,40],$Vo=[1,43],$Vp=[1,44],$Vq=[1,45],$Vr=[1,46],$Vs=[1,47],$Vt=[1,48],$Vu=[1,51],$Vv=[1,4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,51,52,53,58,59,60,61,69,79],$Vw=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,53,58,59,60,61,69,79],$Vx=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,52,53,58,59,60,61,69,79],$Vy=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,51,53,58,59,60,61,69,79],$Vz=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,53,58,59,60,61,69,79],$VA=[67,68,69],$VB=[1,121],$VC=[1,4,5,7,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,51,52,53,58,59,60,61,69,79];
|
7764 | var parser = {trace: function trace () { },
|
7765 | yy: {},
|
7766 | symbols_: {"error":2,"start":3,"SPACE":4,"NEWLINE":5,"directive":6,"SD":7,"document":8,"line":9,"statement":10,"openDirective":11,"typeDirective":12,"closeDirective":13,":":14,"argDirective":15,"participant":16,"actor":17,"AS":18,"restOfLine":19,"participant_actor":20,"signal":21,"autonumber":22,"NUM":23,"off":24,"activate":25,"deactivate":26,"note_statement":27,"links_statement":28,"link_statement":29,"properties_statement":30,"details_statement":31,"title":32,"legacy_title":33,"acc_title":34,"acc_title_value":35,"acc_descr":36,"acc_descr_value":37,"acc_descr_multiline_value":38,"loop":39,"end":40,"rect":41,"opt":42,"alt":43,"else_sections":44,"par":45,"par_sections":46,"critical":47,"option_sections":48,"break":49,"option":50,"and":51,"else":52,"note":53,"placement":54,"text2":55,"over":56,"actor_pair":57,"links":58,"link":59,"properties":60,"details":61,"spaceList":62,",":63,"left_of":64,"right_of":65,"signaltype":66,"+":67,"-":68,"ACTOR":69,"SOLID_OPEN_ARROW":70,"DOTTED_OPEN_ARROW":71,"SOLID_ARROW":72,"DOTTED_ARROW":73,"SOLID_CROSS":74,"DOTTED_CROSS":75,"SOLID_POINT":76,"DOTTED_POINT":77,"TXT":78,"open_directive":79,"type_directive":80,"arg_directive":81,"close_directive":82,"$accept":0,"$end":1},
|
7767 | terminals_: {2:"error",4:"SPACE",5:"NEWLINE",7:"SD",14:":",16:"participant",18:"AS",19:"restOfLine",20:"participant_actor",22:"autonumber",23:"NUM",24:"off",25:"activate",26:"deactivate",32:"title",33:"legacy_title",34:"acc_title",35:"acc_title_value",36:"acc_descr",37:"acc_descr_value",38:"acc_descr_multiline_value",39:"loop",40:"end",41:"rect",42:"opt",43:"alt",45:"par",47:"critical",49:"break",50:"option",51:"and",52:"else",53:"note",56:"over",58:"links",59:"link",60:"properties",61:"details",63:",",64:"left_of",65:"right_of",67:"+",68:"-",69:"ACTOR",70:"SOLID_OPEN_ARROW",71:"DOTTED_OPEN_ARROW",72:"SOLID_ARROW",73:"DOTTED_ARROW",74:"SOLID_CROSS",75:"DOTTED_CROSS",76:"SOLID_POINT",77:"DOTTED_POINT",78:"TXT",79:"open_directive",80:"type_directive",81:"arg_directive",82:"close_directive"},
|
7768 | productions_: [0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[6,4],[6,6],[10,5],[10,3],[10,5],[10,3],[10,2],[10,4],[10,3],[10,3],[10,2],[10,3],[10,3],[10,2],[10,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,2],[10,2],[10,1],[10,4],[10,4],[10,4],[10,4],[10,4],[10,4],[10,4],[10,1],[48,1],[48,4],[46,1],[46,4],[44,1],[44,4],[27,4],[27,4],[28,3],[29,3],[30,3],[31,3],[62,2],[62,1],[57,3],[57,1],[54,1],[54,1],[21,5],[21,5],[21,4],[17,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[55,1],[11,1],[12,1],[15,1],[13,1]],
|
7769 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
7770 | /* this == yyval */
|
7771 |
|
7772 | var $0 = $$.length - 1;
|
7773 | switch (yystate) {
|
7774 | case 4:
|
7775 | yy.apply($$[$0]);return $$[$0];
|
7776 | break;
|
7777 | case 5:
|
7778 | this.$ = []
|
7779 | break;
|
7780 | case 6:
|
7781 | $$[$0-1].push($$[$0]);this.$ = $$[$0-1]
|
7782 | break;
|
7783 | case 7: case 8:
|
7784 | this.$ = $$[$0]
|
7785 | break;
|
7786 | case 9:
|
7787 | this.$=[];
|
7788 | break;
|
7789 | case 12:
|
7790 | $$[$0-3].type='addParticipant';$$[$0-3].description=yy.parseMessage($$[$0-1]); this.$=$$[$0-3];
|
7791 | break;
|
7792 | case 13:
|
7793 | $$[$0-1].type='addParticipant';this.$=$$[$0-1];
|
7794 | break;
|
7795 | case 14:
|
7796 | $$[$0-3].type='addActor';$$[$0-3].description=yy.parseMessage($$[$0-1]); this.$=$$[$0-3];
|
7797 | break;
|
7798 | case 15:
|
7799 | $$[$0-1].type='addActor'; this.$=$$[$0-1];
|
7800 | break;
|
7801 | case 17:
|
7802 | this.$= {type:'sequenceIndex',sequenceIndex: Number($$[$0-2]), sequenceIndexStep:Number($$[$0-1]), sequenceVisible:true, signalType:yy.LINETYPE.AUTONUMBER};
|
7803 | break;
|
7804 | case 18:
|
7805 | this.$ = {type:'sequenceIndex',sequenceIndex: Number($$[$0-1]), sequenceIndexStep:1, sequenceVisible:true, signalType:yy.LINETYPE.AUTONUMBER};
|
7806 | break;
|
7807 | case 19:
|
7808 | this.$ = {type:'sequenceIndex', sequenceVisible:false, signalType:yy.LINETYPE.AUTONUMBER};
|
7809 | break;
|
7810 | case 20:
|
7811 | this.$ = {type:'sequenceIndex', sequenceVisible:true, signalType:yy.LINETYPE.AUTONUMBER};
|
7812 | break;
|
7813 | case 21:
|
7814 | this.$={type: 'activeStart', signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0-1]};
|
7815 | break;
|
7816 | case 22:
|
7817 | this.$={type: 'activeEnd', signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0-1]};
|
7818 | break;
|
7819 | case 28:
|
7820 | yy.setDiagramTitle($$[$0].substring(6));this.$=$$[$0].substring(6);
|
7821 | break;
|
7822 | case 29:
|
7823 | yy.setDiagramTitle($$[$0].substring(7));this.$=$$[$0].substring(7);
|
7824 | break;
|
7825 | case 30:
|
7826 | this.$=$$[$0].trim();yy.setAccTitle(this.$);
|
7827 | break;
|
7828 | case 31: case 32:
|
7829 | this.$=$$[$0].trim();yy.setAccDescription(this.$);
|
7830 | break;
|
7831 | case 33:
|
7832 |
|
7833 | $$[$0-1].unshift({type: 'loopStart', loopText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.LOOP_START});
|
7834 | $$[$0-1].push({type: 'loopEnd', loopText:$$[$0-2], signalType: yy.LINETYPE.LOOP_END});
|
7835 | this.$=$$[$0-1];
|
7836 | break;
|
7837 | case 34:
|
7838 |
|
7839 | $$[$0-1].unshift({type: 'rectStart', color:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.RECT_START });
|
7840 | $$[$0-1].push({type: 'rectEnd', color:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.RECT_END });
|
7841 | this.$=$$[$0-1];
|
7842 | break;
|
7843 | case 35:
|
7844 |
|
7845 | $$[$0-1].unshift({type: 'optStart', optText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.OPT_START});
|
7846 | $$[$0-1].push({type: 'optEnd', optText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.OPT_END});
|
7847 | this.$=$$[$0-1];
|
7848 | break;
|
7849 | case 36:
|
7850 |
|
7851 | // Alt start
|
7852 | $$[$0-1].unshift({type: 'altStart', altText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.ALT_START});
|
7853 | // Content in alt is already in $$[$0-1]
|
7854 | // End
|
7855 | $$[$0-1].push({type: 'altEnd', signalType: yy.LINETYPE.ALT_END});
|
7856 | this.$=$$[$0-1];
|
7857 | break;
|
7858 | case 37:
|
7859 |
|
7860 | // Parallel start
|
7861 | $$[$0-1].unshift({type: 'parStart', parText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.PAR_START});
|
7862 | // Content in par is already in $$[$0-1]
|
7863 | // End
|
7864 | $$[$0-1].push({type: 'parEnd', signalType: yy.LINETYPE.PAR_END});
|
7865 | this.$=$$[$0-1];
|
7866 | break;
|
7867 | case 38:
|
7868 |
|
7869 | // critical start
|
7870 | $$[$0-1].unshift({type: 'criticalStart', criticalText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.CRITICAL_START});
|
7871 | // Content in critical is already in $$[$0-1]
|
7872 | // critical end
|
7873 | $$[$0-1].push({type: 'criticalEnd', signalType: yy.LINETYPE.CRITICAL_END});
|
7874 | this.$=$$[$0-1];
|
7875 | break;
|
7876 | case 39:
|
7877 |
|
7878 | $$[$0-1].unshift({type: 'breakStart', breakText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.BREAK_START});
|
7879 | $$[$0-1].push({type: 'breakEnd', optText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.BREAK_END});
|
7880 | this.$=$$[$0-1];
|
7881 | break;
|
7882 | case 42:
|
7883 | this.$ = $$[$0-3].concat([{type: 'option', optionText:yy.parseMessage($$[$0-1]), signalType: yy.LINETYPE.CRITICAL_OPTION}, $$[$0]]);
|
7884 | break;
|
7885 | case 44:
|
7886 | this.$ = $$[$0-3].concat([{type: 'and', parText:yy.parseMessage($$[$0-1]), signalType: yy.LINETYPE.PAR_AND}, $$[$0]]);
|
7887 | break;
|
7888 | case 46:
|
7889 | this.$ = $$[$0-3].concat([{type: 'else', altText:yy.parseMessage($$[$0-1]), signalType: yy.LINETYPE.ALT_ELSE}, $$[$0]]);
|
7890 | break;
|
7891 | case 47:
|
7892 |
|
7893 | this.$ = [$$[$0-1], {type:'addNote', placement:$$[$0-2], actor:$$[$0-1].actor, text:$$[$0]}];
|
7894 | break;
|
7895 | case 48:
|
7896 |
|
7897 | // Coerce actor_pair into a [to, from, ...] array
|
7898 | $$[$0-2] = [].concat($$[$0-1], $$[$0-1]).slice(0, 2);
|
7899 | $$[$0-2][0] = $$[$0-2][0].actor;
|
7900 | $$[$0-2][1] = $$[$0-2][1].actor;
|
7901 | this.$ = [$$[$0-1], {type:'addNote', placement:yy.PLACEMENT.OVER, actor:$$[$0-2].slice(0, 2), text:$$[$0]}];
|
7902 | break;
|
7903 | case 49:
|
7904 |
|
7905 | this.$ = [$$[$0-1], {type:'addLinks', actor:$$[$0-1].actor, text:$$[$0]}];
|
7906 |
|
7907 | break;
|
7908 | case 50:
|
7909 |
|
7910 | this.$ = [$$[$0-1], {type:'addALink', actor:$$[$0-1].actor, text:$$[$0]}];
|
7911 |
|
7912 | break;
|
7913 | case 51:
|
7914 |
|
7915 | this.$ = [$$[$0-1], {type:'addProperties', actor:$$[$0-1].actor, text:$$[$0]}];
|
7916 |
|
7917 | break;
|
7918 | case 52:
|
7919 |
|
7920 | this.$ = [$$[$0-1], {type:'addDetails', actor:$$[$0-1].actor, text:$$[$0]}];
|
7921 |
|
7922 | break;
|
7923 | case 55:
|
7924 | this.$ = [$$[$0-2], $$[$0]];
|
7925 | break;
|
7926 | case 56:
|
7927 | this.$ = $$[$0];
|
7928 | break;
|
7929 | case 57:
|
7930 | this.$ = yy.PLACEMENT.LEFTOF;
|
7931 | break;
|
7932 | case 58:
|
7933 | this.$ = yy.PLACEMENT.RIGHTOF;
|
7934 | break;
|
7935 | case 59:
|
7936 | this.$ = [$$[$0-4],$$[$0-1],{type: 'addMessage', from:$$[$0-4].actor, to:$$[$0-1].actor, signalType:$$[$0-3], msg:$$[$0]},
|
7937 | {type: 'activeStart', signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0-1]}
|
7938 | ]
|
7939 | break;
|
7940 | case 60:
|
7941 | this.$ = [$$[$0-4],$$[$0-1],{type: 'addMessage', from:$$[$0-4].actor, to:$$[$0-1].actor, signalType:$$[$0-3], msg:$$[$0]},
|
7942 | {type: 'activeEnd', signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0-4]}
|
7943 | ]
|
7944 | break;
|
7945 | case 61:
|
7946 | this.$ = [$$[$0-3],$$[$0-1],{type: 'addMessage', from:$$[$0-3].actor, to:$$[$0-1].actor, signalType:$$[$0-2], msg:$$[$0]}]
|
7947 | break;
|
7948 | case 62:
|
7949 | this.$={ type: 'addParticipant', actor:$$[$0]}
|
7950 | break;
|
7951 | case 63:
|
7952 | this.$ = yy.LINETYPE.SOLID_OPEN;
|
7953 | break;
|
7954 | case 64:
|
7955 | this.$ = yy.LINETYPE.DOTTED_OPEN;
|
7956 | break;
|
7957 | case 65:
|
7958 | this.$ = yy.LINETYPE.SOLID;
|
7959 | break;
|
7960 | case 66:
|
7961 | this.$ = yy.LINETYPE.DOTTED;
|
7962 | break;
|
7963 | case 67:
|
7964 | this.$ = yy.LINETYPE.SOLID_CROSS;
|
7965 | break;
|
7966 | case 68:
|
7967 | this.$ = yy.LINETYPE.DOTTED_CROSS;
|
7968 | break;
|
7969 | case 69:
|
7970 | this.$ = yy.LINETYPE.SOLID_POINT;
|
7971 | break;
|
7972 | case 70:
|
7973 | this.$ = yy.LINETYPE.DOTTED_POINT;
|
7974 | break;
|
7975 | case 71:
|
7976 | this.$ = yy.parseMessage($$[$0].trim().substring(1))
|
7977 | break;
|
7978 | case 72:
|
7979 | yy.parseDirective('%%{', 'open_directive');
|
7980 | break;
|
7981 | case 73:
|
7982 | yy.parseDirective($$[$0], 'type_directive');
|
7983 | break;
|
7984 | case 74:
|
7985 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
7986 | break;
|
7987 | case 75:
|
7988 | yy.parseDirective('}%%', 'close_directive', 'sequence');
|
7989 | break;
|
7990 | }
|
7991 | },
|
7992 | table: [{3:1,4:$V0,5:$V1,6:4,7:$V2,11:6,79:$V3},{1:[3]},{3:8,4:$V0,5:$V1,6:4,7:$V2,11:6,79:$V3},{3:9,4:$V0,5:$V1,6:4,7:$V2,11:6,79:$V3},{3:10,4:$V0,5:$V1,6:4,7:$V2,11:6,79:$V3},o([1,4,5,16,20,22,25,26,32,33,34,36,38,39,41,42,43,45,47,49,53,58,59,60,61,69,79],$V4,{8:11}),{12:12,80:[1,13]},{80:[2,72]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{13:49,14:[1,50],82:$Vu},o([14,82],[2,73]),o($Vv,[2,6]),{6:41,10:52,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},o($Vv,[2,8]),o($Vv,[2,9]),{17:53,69:$Vt},{17:54,69:$Vt},{5:[1,55]},{5:[1,58],23:[1,56],24:[1,57]},{17:59,69:$Vt},{17:60,69:$Vt},{5:[1,61]},{5:[1,62]},{5:[1,63]},{5:[1,64]},{5:[1,65]},o($Vv,[2,28]),o($Vv,[2,29]),{35:[1,66]},{37:[1,67]},o($Vv,[2,32]),{19:[1,68]},{19:[1,69]},{19:[1,70]},{19:[1,71]},{19:[1,72]},{19:[1,73]},{19:[1,74]},o($Vv,[2,40]),{66:75,70:[1,76],71:[1,77],72:[1,78],73:[1,79],74:[1,80],75:[1,81],76:[1,82],77:[1,83]},{54:84,56:[1,85],64:[1,86],65:[1,87]},{17:88,69:$Vt},{17:89,69:$Vt},{17:90,69:$Vt},{17:91,69:$Vt},o([5,18,63,70,71,72,73,74,75,76,77,78],[2,62]),{5:[1,92]},{15:93,81:[1,94]},{5:[2,75]},o($Vv,[2,7]),{5:[1,96],18:[1,95]},{5:[1,98],18:[1,97]},o($Vv,[2,16]),{5:[1,100],23:[1,99]},{5:[1,101]},o($Vv,[2,20]),{5:[1,102]},{5:[1,103]},o($Vv,[2,23]),o($Vv,[2,24]),o($Vv,[2,25]),o($Vv,[2,26]),o($Vv,[2,27]),o($Vv,[2,30]),o($Vv,[2,31]),o($Vw,$V4,{8:104}),o($Vw,$V4,{8:105}),o($Vw,$V4,{8:106}),o($Vx,$V4,{44:107,8:108}),o($Vy,$V4,{46:109,8:110}),o($Vz,$V4,{48:111,8:112}),o($Vw,$V4,{8:113}),{17:116,67:[1,114],68:[1,115],69:$Vt},o($VA,[2,63]),o($VA,[2,64]),o($VA,[2,65]),o($VA,[2,66]),o($VA,[2,67]),o($VA,[2,68]),o($VA,[2,69]),o($VA,[2,70]),{17:117,69:$Vt},{17:119,57:118,69:$Vt},{69:[2,57]},{69:[2,58]},{55:120,78:$VB},{55:122,78:$VB},{55:123,78:$VB},{55:124,78:$VB},o($VC,[2,10]),{13:125,82:$Vu},{82:[2,74]},{19:[1,126]},o($Vv,[2,13]),{19:[1,127]},o($Vv,[2,15]),{5:[1,128]},o($Vv,[2,18]),o($Vv,[2,19]),o($Vv,[2,21]),o($Vv,[2,22]),{4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,40:[1,129],41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,40:[1,130],41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,40:[1,131],41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{40:[1,132]},{4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,40:[2,45],41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,52:[1,133],53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{40:[1,134]},{4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,40:[2,43],41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,51:[1,135],53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{40:[1,136]},{4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,40:[2,41],41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,50:[1,137],53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{4:$V5,5:$V6,6:41,9:14,10:16,11:6,16:$V7,17:42,20:$V8,21:20,22:$V9,25:$Va,26:$Vb,27:24,28:25,29:26,30:27,31:28,32:$Vc,33:$Vd,34:$Ve,36:$Vf,38:$Vg,39:$Vh,40:[1,138],41:$Vi,42:$Vj,43:$Vk,45:$Vl,47:$Vm,49:$Vn,53:$Vo,58:$Vp,59:$Vq,60:$Vr,61:$Vs,69:$Vt,79:$V3},{17:139,69:$Vt},{17:140,69:$Vt},{55:141,78:$VB},{55:142,78:$VB},{55:143,78:$VB},{63:[1,144],78:[2,56]},{5:[2,49]},{5:[2,71]},{5:[2,50]},{5:[2,51]},{5:[2,52]},{5:[1,145]},{5:[1,146]},{5:[1,147]},o($Vv,[2,17]),o($Vv,[2,33]),o($Vv,[2,34]),o($Vv,[2,35]),o($Vv,[2,36]),{19:[1,148]},o($Vv,[2,37]),{19:[1,149]},o($Vv,[2,38]),{19:[1,150]},o($Vv,[2,39]),{55:151,78:$VB},{55:152,78:$VB},{5:[2,61]},{5:[2,47]},{5:[2,48]},{17:153,69:$Vt},o($VC,[2,11]),o($Vv,[2,12]),o($Vv,[2,14]),o($Vx,$V4,{8:108,44:154}),o($Vy,$V4,{8:110,46:155}),o($Vz,$V4,{8:112,48:156}),{5:[2,59]},{5:[2,60]},{78:[2,55]},{40:[2,46]},{40:[2,44]},{40:[2,42]}],
|
7993 | defaultActions: {7:[2,72],8:[2,1],9:[2,2],10:[2,3],51:[2,75],86:[2,57],87:[2,58],94:[2,74],120:[2,49],121:[2,71],122:[2,50],123:[2,51],124:[2,52],141:[2,61],142:[2,47],143:[2,48],151:[2,59],152:[2,60],153:[2,55],154:[2,46],155:[2,44],156:[2,42]},
|
7994 | parseError: function parseError (str, hash) {
|
7995 | if (hash.recoverable) {
|
7996 | this.trace(str);
|
7997 | } else {
|
7998 | var error = new Error(str);
|
7999 | error.hash = hash;
|
8000 | throw error;
|
8001 | }
|
8002 | },
|
8003 | parse: function parse(input) {
|
8004 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
8005 | var args = lstack.slice.call(arguments, 1);
|
8006 | var lexer = Object.create(this.lexer);
|
8007 | var sharedState = { yy: {} };
|
8008 | for (var k in this.yy) {
|
8009 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
8010 | sharedState.yy[k] = this.yy[k];
|
8011 | }
|
8012 | }
|
8013 | lexer.setInput(input, sharedState.yy);
|
8014 | sharedState.yy.lexer = lexer;
|
8015 | sharedState.yy.parser = this;
|
8016 | if (typeof lexer.yylloc == 'undefined') {
|
8017 | lexer.yylloc = {};
|
8018 | }
|
8019 | var yyloc = lexer.yylloc;
|
8020 | lstack.push(yyloc);
|
8021 | var ranges = lexer.options && lexer.options.ranges;
|
8022 | if (typeof sharedState.yy.parseError === 'function') {
|
8023 | this.parseError = sharedState.yy.parseError;
|
8024 | } else {
|
8025 | this.parseError = Object.getPrototypeOf(this).parseError;
|
8026 | }
|
8027 | function popStack(n) {
|
8028 | stack.length = stack.length - 2 * n;
|
8029 | vstack.length = vstack.length - n;
|
8030 | lstack.length = lstack.length - n;
|
8031 | }
|
8032 | function lex() {
|
8033 | var token;
|
8034 | token = tstack.pop() || lexer.lex() || EOF;
|
8035 | if (typeof token !== 'number') {
|
8036 | if (token instanceof Array) {
|
8037 | tstack = token;
|
8038 | token = tstack.pop();
|
8039 | }
|
8040 | token = self.symbols_[token] || token;
|
8041 | }
|
8042 | return token;
|
8043 | }
|
8044 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
8045 | while (true) {
|
8046 | state = stack[stack.length - 1];
|
8047 | if (this.defaultActions[state]) {
|
8048 | action = this.defaultActions[state];
|
8049 | } else {
|
8050 | if (symbol === null || typeof symbol == 'undefined') {
|
8051 | symbol = lex();
|
8052 | }
|
8053 | action = table[state] && table[state][symbol];
|
8054 | }
|
8055 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
8056 | var errStr = '';
|
8057 | expected = [];
|
8058 | for (p in table[state]) {
|
8059 | if (this.terminals_[p] && p > TERROR) {
|
8060 | expected.push('\'' + this.terminals_[p] + '\'');
|
8061 | }
|
8062 | }
|
8063 | if (lexer.showPosition) {
|
8064 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
8065 | } else {
|
8066 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
8067 | }
|
8068 | this.parseError(errStr, {
|
8069 | text: lexer.match,
|
8070 | token: this.terminals_[symbol] || symbol,
|
8071 | line: lexer.yylineno,
|
8072 | loc: yyloc,
|
8073 | expected: expected
|
8074 | });
|
8075 | }
|
8076 | if (action[0] instanceof Array && action.length > 1) {
|
8077 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
8078 | }
|
8079 | switch (action[0]) {
|
8080 | case 1:
|
8081 | stack.push(symbol);
|
8082 | vstack.push(lexer.yytext);
|
8083 | lstack.push(lexer.yylloc);
|
8084 | stack.push(action[1]);
|
8085 | symbol = null;
|
8086 | if (!preErrorSymbol) {
|
8087 | yyleng = lexer.yyleng;
|
8088 | yytext = lexer.yytext;
|
8089 | yylineno = lexer.yylineno;
|
8090 | yyloc = lexer.yylloc;
|
8091 | if (recovering > 0) {
|
8092 | recovering--;
|
8093 | }
|
8094 | } else {
|
8095 | symbol = preErrorSymbol;
|
8096 | preErrorSymbol = null;
|
8097 | }
|
8098 | break;
|
8099 | case 2:
|
8100 | len = this.productions_[action[1]][1];
|
8101 | yyval.$ = vstack[vstack.length - len];
|
8102 | yyval._$ = {
|
8103 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
8104 | last_line: lstack[lstack.length - 1].last_line,
|
8105 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
8106 | last_column: lstack[lstack.length - 1].last_column
|
8107 | };
|
8108 | if (ranges) {
|
8109 | yyval._$.range = [
|
8110 | lstack[lstack.length - (len || 1)].range[0],
|
8111 | lstack[lstack.length - 1].range[1]
|
8112 | ];
|
8113 | }
|
8114 | r = this.performAction.apply(yyval, [
|
8115 | yytext,
|
8116 | yyleng,
|
8117 | yylineno,
|
8118 | sharedState.yy,
|
8119 | action[1],
|
8120 | vstack,
|
8121 | lstack
|
8122 | ].concat(args));
|
8123 | if (typeof r !== 'undefined') {
|
8124 | return r;
|
8125 | }
|
8126 | if (len) {
|
8127 | stack = stack.slice(0, -1 * len * 2);
|
8128 | vstack = vstack.slice(0, -1 * len);
|
8129 | lstack = lstack.slice(0, -1 * len);
|
8130 | }
|
8131 | stack.push(this.productions_[action[1]][0]);
|
8132 | vstack.push(yyval.$);
|
8133 | lstack.push(yyval._$);
|
8134 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
8135 | stack.push(newState);
|
8136 | break;
|
8137 | case 3:
|
8138 | return true;
|
8139 | }
|
8140 | }
|
8141 | return true;
|
8142 | }};
|
8143 |
|
8144 | /* generated by jison-lex 0.3.4 */
|
8145 | var lexer = (function(){
|
8146 | var lexer = ({
|
8147 |
|
8148 | EOF:1,
|
8149 |
|
8150 | parseError:function parseError(str, hash) {
|
8151 | if (this.yy.parser) {
|
8152 | this.yy.parser.parseError(str, hash);
|
8153 | } else {
|
8154 | throw new Error(str);
|
8155 | }
|
8156 | },
|
8157 |
|
8158 | // resets the lexer, sets new input
|
8159 | setInput:function (input, yy) {
|
8160 | this.yy = yy || this.yy || {};
|
8161 | this._input = input;
|
8162 | this._more = this._backtrack = this.done = false;
|
8163 | this.yylineno = this.yyleng = 0;
|
8164 | this.yytext = this.matched = this.match = '';
|
8165 | this.conditionStack = ['INITIAL'];
|
8166 | this.yylloc = {
|
8167 | first_line: 1,
|
8168 | first_column: 0,
|
8169 | last_line: 1,
|
8170 | last_column: 0
|
8171 | };
|
8172 | if (this.options.ranges) {
|
8173 | this.yylloc.range = [0,0];
|
8174 | }
|
8175 | this.offset = 0;
|
8176 | return this;
|
8177 | },
|
8178 |
|
8179 | // consumes and returns one char from the input
|
8180 | input:function () {
|
8181 | var ch = this._input[0];
|
8182 | this.yytext += ch;
|
8183 | this.yyleng++;
|
8184 | this.offset++;
|
8185 | this.match += ch;
|
8186 | this.matched += ch;
|
8187 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
8188 | if (lines) {
|
8189 | this.yylineno++;
|
8190 | this.yylloc.last_line++;
|
8191 | } else {
|
8192 | this.yylloc.last_column++;
|
8193 | }
|
8194 | if (this.options.ranges) {
|
8195 | this.yylloc.range[1]++;
|
8196 | }
|
8197 |
|
8198 | this._input = this._input.slice(1);
|
8199 | return ch;
|
8200 | },
|
8201 |
|
8202 | // unshifts one char (or a string) into the input
|
8203 | unput:function (ch) {
|
8204 | var len = ch.length;
|
8205 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
8206 |
|
8207 | this._input = ch + this._input;
|
8208 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
8209 | //this.yyleng -= len;
|
8210 | this.offset -= len;
|
8211 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
8212 | this.match = this.match.substr(0, this.match.length - 1);
|
8213 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
8214 |
|
8215 | if (lines.length - 1) {
|
8216 | this.yylineno -= lines.length - 1;
|
8217 | }
|
8218 | var r = this.yylloc.range;
|
8219 |
|
8220 | this.yylloc = {
|
8221 | first_line: this.yylloc.first_line,
|
8222 | last_line: this.yylineno + 1,
|
8223 | first_column: this.yylloc.first_column,
|
8224 | last_column: lines ?
|
8225 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
8226 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
8227 | this.yylloc.first_column - len
|
8228 | };
|
8229 |
|
8230 | if (this.options.ranges) {
|
8231 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
8232 | }
|
8233 | this.yyleng = this.yytext.length;
|
8234 | return this;
|
8235 | },
|
8236 |
|
8237 | // When called from action, caches matched text and appends it on next action
|
8238 | more:function () {
|
8239 | this._more = true;
|
8240 | return this;
|
8241 | },
|
8242 |
|
8243 | // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
|
8244 | reject:function () {
|
8245 | if (this.options.backtrack_lexer) {
|
8246 | this._backtrack = true;
|
8247 | } else {
|
8248 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
|
8249 | text: "",
|
8250 | token: null,
|
8251 | line: this.yylineno
|
8252 | });
|
8253 |
|
8254 | }
|
8255 | return this;
|
8256 | },
|
8257 |
|
8258 | // retain first n characters of the match
|
8259 | less:function (n) {
|
8260 | this.unput(this.match.slice(n));
|
8261 | },
|
8262 |
|
8263 | // displays already matched input, i.e. for error messages
|
8264 | pastInput:function () {
|
8265 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
8266 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
8267 | },
|
8268 |
|
8269 | // displays upcoming input, i.e. for error messages
|
8270 | upcomingInput:function () {
|
8271 | var next = this.match;
|
8272 | if (next.length < 20) {
|
8273 | next += this._input.substr(0, 20-next.length);
|
8274 | }
|
8275 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
8276 | },
|
8277 |
|
8278 | // displays the character position where the lexing error occurred, i.e. for error messages
|
8279 | showPosition:function () {
|
8280 | var pre = this.pastInput();
|
8281 | var c = new Array(pre.length + 1).join("-");
|
8282 | return pre + this.upcomingInput() + "\n" + c + "^";
|
8283 | },
|
8284 |
|
8285 | // test the lexed token: return FALSE when not a match, otherwise return token
|
8286 | test_match:function(match, indexed_rule) {
|
8287 | var token,
|
8288 | lines,
|
8289 | backup;
|
8290 |
|
8291 | if (this.options.backtrack_lexer) {
|
8292 | // save context
|
8293 | backup = {
|
8294 | yylineno: this.yylineno,
|
8295 | yylloc: {
|
8296 | first_line: this.yylloc.first_line,
|
8297 | last_line: this.last_line,
|
8298 | first_column: this.yylloc.first_column,
|
8299 | last_column: this.yylloc.last_column
|
8300 | },
|
8301 | yytext: this.yytext,
|
8302 | match: this.match,
|
8303 | matches: this.matches,
|
8304 | matched: this.matched,
|
8305 | yyleng: this.yyleng,
|
8306 | offset: this.offset,
|
8307 | _more: this._more,
|
8308 | _input: this._input,
|
8309 | yy: this.yy,
|
8310 | conditionStack: this.conditionStack.slice(0),
|
8311 | done: this.done
|
8312 | };
|
8313 | if (this.options.ranges) {
|
8314 | backup.yylloc.range = this.yylloc.range.slice(0);
|
8315 | }
|
8316 | }
|
8317 |
|
8318 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
8319 | if (lines) {
|
8320 | this.yylineno += lines.length;
|
8321 | }
|
8322 | this.yylloc = {
|
8323 | first_line: this.yylloc.last_line,
|
8324 | last_line: this.yylineno + 1,
|
8325 | first_column: this.yylloc.last_column,
|
8326 | last_column: lines ?
|
8327 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
8328 | this.yylloc.last_column + match[0].length
|
8329 | };
|
8330 | this.yytext += match[0];
|
8331 | this.match += match[0];
|
8332 | this.matches = match;
|
8333 | this.yyleng = this.yytext.length;
|
8334 | if (this.options.ranges) {
|
8335 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
8336 | }
|
8337 | this._more = false;
|
8338 | this._backtrack = false;
|
8339 | this._input = this._input.slice(match[0].length);
|
8340 | this.matched += match[0];
|
8341 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
8342 | if (this.done && this._input) {
|
8343 | this.done = false;
|
8344 | }
|
8345 | if (token) {
|
8346 | return token;
|
8347 | } else if (this._backtrack) {
|
8348 | // recover context
|
8349 | for (var k in backup) {
|
8350 | this[k] = backup[k];
|
8351 | }
|
8352 | return false; // rule action called reject() implying the next rule should be tested instead.
|
8353 | }
|
8354 | return false;
|
8355 | },
|
8356 |
|
8357 | // return next match in input
|
8358 | next:function () {
|
8359 | if (this.done) {
|
8360 | return this.EOF;
|
8361 | }
|
8362 | if (!this._input) {
|
8363 | this.done = true;
|
8364 | }
|
8365 |
|
8366 | var token,
|
8367 | match,
|
8368 | tempMatch,
|
8369 | index;
|
8370 | if (!this._more) {
|
8371 | this.yytext = '';
|
8372 | this.match = '';
|
8373 | }
|
8374 | var rules = this._currentRules();
|
8375 | for (var i = 0; i < rules.length; i++) {
|
8376 | tempMatch = this._input.match(this.rules[rules[i]]);
|
8377 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
8378 | match = tempMatch;
|
8379 | index = i;
|
8380 | if (this.options.backtrack_lexer) {
|
8381 | token = this.test_match(tempMatch, rules[i]);
|
8382 | if (token !== false) {
|
8383 | return token;
|
8384 | } else if (this._backtrack) {
|
8385 | match = false;
|
8386 | continue; // rule action called reject() implying a rule MISmatch.
|
8387 | } else {
|
8388 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
8389 | return false;
|
8390 | }
|
8391 | } else if (!this.options.flex) {
|
8392 | break;
|
8393 | }
|
8394 | }
|
8395 | }
|
8396 | if (match) {
|
8397 | token = this.test_match(match, rules[index]);
|
8398 | if (token !== false) {
|
8399 | return token;
|
8400 | }
|
8401 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
8402 | return false;
|
8403 | }
|
8404 | if (this._input === "") {
|
8405 | return this.EOF;
|
8406 | } else {
|
8407 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
8408 | text: "",
|
8409 | token: null,
|
8410 | line: this.yylineno
|
8411 | });
|
8412 | }
|
8413 | },
|
8414 |
|
8415 | // return next match that has a token
|
8416 | lex:function lex () {
|
8417 | var r = this.next();
|
8418 | if (r) {
|
8419 | return r;
|
8420 | } else {
|
8421 | return this.lex();
|
8422 | }
|
8423 | },
|
8424 |
|
8425 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
8426 | begin:function begin (condition) {
|
8427 | this.conditionStack.push(condition);
|
8428 | },
|
8429 |
|
8430 | // pop the previously active lexer condition state off the condition stack
|
8431 | popState:function popState () {
|
8432 | var n = this.conditionStack.length - 1;
|
8433 | if (n > 0) {
|
8434 | return this.conditionStack.pop();
|
8435 | } else {
|
8436 | return this.conditionStack[0];
|
8437 | }
|
8438 | },
|
8439 |
|
8440 | // produce the lexer rule set which is active for the currently active lexer condition state
|
8441 | _currentRules:function _currentRules () {
|
8442 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
8443 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
8444 | } else {
|
8445 | return this.conditions["INITIAL"].rules;
|
8446 | }
|
8447 | },
|
8448 |
|
8449 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
8450 | topState:function topState (n) {
|
8451 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
8452 | if (n >= 0) {
|
8453 | return this.conditionStack[n];
|
8454 | } else {
|
8455 | return "INITIAL";
|
8456 | }
|
8457 | },
|
8458 |
|
8459 | // alias for begin(condition)
|
8460 | pushState:function pushState (condition) {
|
8461 | this.begin(condition);
|
8462 | },
|
8463 |
|
8464 | // return the number of states currently on the stack
|
8465 | stateStackSize:function stateStackSize() {
|
8466 | return this.conditionStack.length;
|
8467 | },
|
8468 | options: {"case-insensitive":true},
|
8469 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
8470 | var YYSTATE=YY_START;
|
8471 | switch($avoiding_name_collisions) {
|
8472 | case 0: this.begin('open_directive'); return 79;
|
8473 | break;
|
8474 | case 1: this.begin('type_directive'); return 80;
|
8475 | break;
|
8476 | case 2: this.popState(); this.begin('arg_directive'); return 14;
|
8477 | break;
|
8478 | case 3: this.popState(); this.popState(); return 82;
|
8479 | break;
|
8480 | case 4:return 81;
|
8481 | break;
|
8482 | case 5:return 5;
|
8483 | break;
|
8484 | case 6:/* skip all whitespace */
|
8485 | break;
|
8486 | case 7:/* skip same-line whitespace */
|
8487 | break;
|
8488 | case 8:/* skip comments */
|
8489 | break;
|
8490 | case 9:/* skip comments */
|
8491 | break;
|
8492 | case 10:/* skip comments */
|
8493 | break;
|
8494 | case 11:return 23;
|
8495 | break;
|
8496 | case 12: this.begin('ID'); return 16;
|
8497 | break;
|
8498 | case 13: this.begin('ID'); return 20;
|
8499 | break;
|
8500 | case 14: yy_.yytext = yy_.yytext.trim(); this.begin('ALIAS'); return 69;
|
8501 | break;
|
8502 | case 15: this.popState(); this.popState(); this.begin('LINE'); return 18;
|
8503 | break;
|
8504 | case 16: this.popState(); this.popState(); return 5;
|
8505 | break;
|
8506 | case 17: this.begin('LINE'); return 39;
|
8507 | break;
|
8508 | case 18: this.begin('LINE'); return 41;
|
8509 | break;
|
8510 | case 19: this.begin('LINE'); return 42;
|
8511 | break;
|
8512 | case 20: this.begin('LINE'); return 43;
|
8513 | break;
|
8514 | case 21: this.begin('LINE'); return 52;
|
8515 | break;
|
8516 | case 22: this.begin('LINE'); return 45;
|
8517 | break;
|
8518 | case 23: this.begin('LINE'); return 51;
|
8519 | break;
|
8520 | case 24: this.begin('LINE'); return 47;
|
8521 | break;
|
8522 | case 25: this.begin('LINE'); return 50;
|
8523 | break;
|
8524 | case 26: this.begin('LINE'); return 49;
|
8525 | break;
|
8526 | case 27: this.popState(); return 19;
|
8527 | break;
|
8528 | case 28:return 40;
|
8529 | break;
|
8530 | case 29:return 64;
|
8531 | break;
|
8532 | case 30:return 65;
|
8533 | break;
|
8534 | case 31:return 58;
|
8535 | break;
|
8536 | case 32:return 59;
|
8537 | break;
|
8538 | case 33:return 60;
|
8539 | break;
|
8540 | case 34:return 61;
|
8541 | break;
|
8542 | case 35:return 56;
|
8543 | break;
|
8544 | case 36:return 53;
|
8545 | break;
|
8546 | case 37: this.begin('ID'); return 25;
|
8547 | break;
|
8548 | case 38: this.begin('ID'); return 26;
|
8549 | break;
|
8550 | case 39:return 32;
|
8551 | break;
|
8552 | case 40:return 33;
|
8553 | break;
|
8554 | case 41: this.begin("acc_title");return 34;
|
8555 | break;
|
8556 | case 42: this.popState(); return "acc_title_value";
|
8557 | break;
|
8558 | case 43: this.begin("acc_descr");return 36;
|
8559 | break;
|
8560 | case 44: this.popState(); return "acc_descr_value";
|
8561 | break;
|
8562 | case 45: this.begin("acc_descr_multiline");
|
8563 | break;
|
8564 | case 46: this.popState();
|
8565 | break;
|
8566 | case 47:return "acc_descr_multiline_value";
|
8567 | break;
|
8568 | case 48:return 7;
|
8569 | break;
|
8570 | case 49:return 22;
|
8571 | break;
|
8572 | case 50:return 24;
|
8573 | break;
|
8574 | case 51:return 63;
|
8575 | break;
|
8576 | case 52:return 5;
|
8577 | break;
|
8578 | case 53: yy_.yytext = yy_.yytext.trim(); return 69;
|
8579 | break;
|
8580 | case 54:return 72;
|
8581 | break;
|
8582 | case 55:return 73;
|
8583 | break;
|
8584 | case 56:return 70;
|
8585 | break;
|
8586 | case 57:return 71;
|
8587 | break;
|
8588 | case 58:return 74;
|
8589 | break;
|
8590 | case 59:return 75;
|
8591 | break;
|
8592 | case 60:return 76;
|
8593 | break;
|
8594 | case 61:return 77;
|
8595 | break;
|
8596 | case 62:return 78;
|
8597 | break;
|
8598 | case 63:return 67;
|
8599 | break;
|
8600 | case 64:return 68;
|
8601 | break;
|
8602 | case 65:return 5;
|
8603 | break;
|
8604 | case 66:return 'INVALID';
|
8605 | break;
|
8606 | }
|
8607 | },
|
8608 | rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[0-9]+(?=[ \n]+))/i,/^(?:participant\b)/i,/^(?:actor\b)/i,/^(?:[^\->:\n,;]+?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i,/^(?:as\b)/i,/^(?:(?:))/i,/^(?:loop\b)/i,/^(?:rect\b)/i,/^(?:opt\b)/i,/^(?:alt\b)/i,/^(?:else\b)/i,/^(?:par\b)/i,/^(?:and\b)/i,/^(?:critical\b)/i,/^(?:option\b)/i,/^(?:break\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i,/^(?:end\b)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:links\b)/i,/^(?:link\b)/i,/^(?:properties\b)/i,/^(?:details\b)/i,/^(?:over\b)/i,/^(?:note\b)/i,/^(?:activate\b)/i,/^(?:deactivate\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:title:\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\b)/i,/^(?:off\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\+\->:\n,;]+((?!(-x|--x|-\)|--\)))[\-]*[^\+\->:\n,;]+)*)/i,/^(?:->>)/i,/^(?:-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\)])/i,/^(?:--[\)])/i,/^(?::(?:(?:no)?wrap)?[^#\n;]+)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:$)/i,/^(?:.)/i],
|
8609 | conditions: {"acc_descr_multiline":{"rules":[46,47],"inclusive":false},"acc_descr":{"rules":[44],"inclusive":false},"acc_title":{"rules":[42],"inclusive":false},"open_directive":{"rules":[1,8],"inclusive":false},"type_directive":{"rules":[2,3,8],"inclusive":false},"arg_directive":{"rules":[3,4,8],"inclusive":false},"ID":{"rules":[7,8,14],"inclusive":false},"ALIAS":{"rules":[7,8,15,16],"inclusive":false},"LINE":{"rules":[7,8,27],"inclusive":false},"INITIAL":{"rules":[0,5,6,8,9,10,11,12,13,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,45,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66],"inclusive":true}}
|
8610 | });
|
8611 | return lexer;
|
8612 | })();
|
8613 | parser.lexer = lexer;
|
8614 | function Parser () {
|
8615 | this.yy = {};
|
8616 | }
|
8617 | Parser.prototype = parser;parser.Parser = Parser;
|
8618 | return new Parser;
|
8619 | })();
|
8620 |
|
8621 |
|
8622 | if (true) {
|
8623 | exports.parser = parser;
|
8624 | exports.Parser = parser.Parser;
|
8625 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
8626 | exports.main = function commonjsMain (args) {
|
8627 | if (!args[1]) {
|
8628 | console.log('Usage: '+args[0]+' FILE');
|
8629 | process.exit(1);
|
8630 | }
|
8631 | var source = (__webpack_require__(/*! fs */ "?e940").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
|
8632 | return exports.parser.parse(source);
|
8633 | };
|
8634 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
8635 | exports.main(process.argv.slice(1));
|
8636 | }
|
8637 | }
|
8638 |
|
8639 | /***/ }),
|
8640 |
|
8641 | /***/ "./src/diagrams/state/parser/stateDiagram.jison":
|
8642 | /*!******************************************************!*\
|
8643 | !*** ./src/diagrams/state/parser/stateDiagram.jison ***!
|
8644 | \******************************************************/
|
8645 | /***/ ((module, exports, __webpack_require__) => {
|
8646 |
|
8647 | /* module decorator */ module = __webpack_require__.nmd(module);
|
8648 | /* parser generated by jison 0.4.18 */
|
8649 | /*
|
8650 | Returns a Parser object of the following structure:
|
8651 |
|
8652 | Parser: {
|
8653 | yy: {}
|
8654 | }
|
8655 |
|
8656 | Parser.prototype: {
|
8657 | yy: {},
|
8658 | trace: function(),
|
8659 | symbols_: {associative list: name ==> number},
|
8660 | terminals_: {associative list: number ==> name},
|
8661 | productions_: [...],
|
8662 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
8663 | table: [...],
|
8664 | defaultActions: {...},
|
8665 | parseError: function(str, hash),
|
8666 | parse: function(input),
|
8667 |
|
8668 | lexer: {
|
8669 | EOF: 1,
|
8670 | parseError: function(str, hash),
|
8671 | setInput: function(input),
|
8672 | input: function(),
|
8673 | unput: function(str),
|
8674 | more: function(),
|
8675 | less: function(n),
|
8676 | pastInput: function(),
|
8677 | upcomingInput: function(),
|
8678 | showPosition: function(),
|
8679 | test_match: function(regex_match_array, rule_index),
|
8680 | next: function(),
|
8681 | lex: function(),
|
8682 | begin: function(condition),
|
8683 | popState: function(),
|
8684 | _currentRules: function(),
|
8685 | topState: function(),
|
8686 | pushState: function(condition),
|
8687 |
|
8688 | options: {
|
8689 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
8690 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
8691 | backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
|
8692 | },
|
8693 |
|
8694 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
8695 | rules: [...],
|
8696 | conditions: {associative list: name ==> set},
|
8697 | }
|
8698 | }
|
8699 |
|
8700 |
|
8701 | token location info (@$, _$, etc.): {
|
8702 | first_line: n,
|
8703 | last_line: n,
|
8704 | first_column: n,
|
8705 | last_column: n,
|
8706 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
8707 | }
|
8708 |
|
8709 |
|
8710 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
8711 | text: (matched text)
|
8712 | token: (the produced terminal token, if any)
|
8713 | line: (yylineno)
|
8714 | }
|
8715 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
8716 | loc: (yylloc)
|
8717 | expected: (string describing the set of expected tokens)
|
8718 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
8719 | }
|
8720 | */
|
8721 | var parser = (function(){
|
8722 | var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,2],$V1=[1,3],$V2=[1,5],$V3=[1,7],$V4=[2,5],$V5=[1,15],$V6=[1,17],$V7=[1,19],$V8=[1,20],$V9=[1,21],$Va=[1,22],$Vb=[1,33],$Vc=[1,23],$Vd=[1,24],$Ve=[1,25],$Vf=[1,26],$Vg=[1,27],$Vh=[1,30],$Vi=[1,31],$Vj=[1,32],$Vk=[1,35],$Vl=[1,36],$Vm=[1,37],$Vn=[1,38],$Vo=[1,34],$Vp=[1,41],$Vq=[1,4,5,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],$Vr=[1,4,5,12,13,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],$Vs=[1,4,5,7,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],$Vt=[4,5,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50];
|
8723 | var parser = {trace: function trace () { },
|
8724 | yy: {},
|
8725 | symbols_: {"error":2,"start":3,"SPACE":4,"NL":5,"directive":6,"SD":7,"document":8,"line":9,"statement":10,"idStatement":11,"DESCR":12,"-->":13,"HIDE_EMPTY":14,"scale":15,"WIDTH":16,"COMPOSIT_STATE":17,"STRUCT_START":18,"STRUCT_STOP":19,"STATE_DESCR":20,"AS":21,"ID":22,"FORK":23,"JOIN":24,"CHOICE":25,"CONCURRENT":26,"note":27,"notePosition":28,"NOTE_TEXT":29,"direction":30,"acc_title":31,"acc_title_value":32,"acc_descr":33,"acc_descr_value":34,"acc_descr_multiline_value":35,"openDirective":36,"typeDirective":37,"closeDirective":38,":":39,"argDirective":40,"direction_tb":41,"direction_bt":42,"direction_rl":43,"direction_lr":44,"eol":45,";":46,"EDGE_STATE":47,"left_of":48,"right_of":49,"open_directive":50,"type_directive":51,"arg_directive":52,"close_directive":53,"$accept":0,"$end":1},
|
8726 | terminals_: {2:"error",4:"SPACE",5:"NL",7:"SD",12:"DESCR",13:"-->",14:"HIDE_EMPTY",15:"scale",16:"WIDTH",17:"COMPOSIT_STATE",18:"STRUCT_START",19:"STRUCT_STOP",20:"STATE_DESCR",21:"AS",22:"ID",23:"FORK",24:"JOIN",25:"CHOICE",26:"CONCURRENT",27:"note",29:"NOTE_TEXT",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",39:":",41:"direction_tb",42:"direction_bt",43:"direction_rl",44:"direction_lr",46:";",47:"EDGE_STATE",48:"left_of",49:"right_of",50:"open_directive",51:"type_directive",52:"arg_directive",53:"close_directive"},
|
8727 | productions_: [0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,1],[10,2],[10,1],[10,4],[10,3],[10,6],[10,1],[10,1],[10,1],[10,1],[10,4],[10,4],[10,1],[10,1],[10,2],[10,2],[10,1],[6,3],[6,5],[30,1],[30,1],[30,1],[30,1],[45,1],[45,1],[11,1],[11,1],[28,1],[28,1],[36,1],[37,1],[40,1],[38,1]],
|
8728 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
8729 | /* this == yyval */
|
8730 |
|
8731 | var $0 = $$.length - 1;
|
8732 | switch (yystate) {
|
8733 | case 4:
|
8734 | /*console.warn('Root document', $$[$0]);*/ yy.setRootDoc($$[$0]);return $$[$0];
|
8735 | break;
|
8736 | case 5:
|
8737 | this.$ = []
|
8738 | break;
|
8739 | case 6:
|
8740 |
|
8741 | if($$[$0]!='nl'){
|
8742 | $$[$0-1].push($$[$0]);this.$ = $$[$0-1]
|
8743 | }
|
8744 | // console.warn('Got document',$$[$0-1], $$[$0]);
|
8745 |
|
8746 | break;
|
8747 | case 7: case 8:
|
8748 | this.$ = $$[$0]
|
8749 | break;
|
8750 | case 9:
|
8751 | this.$='nl';
|
8752 | break;
|
8753 | case 10:
|
8754 | /*console.warn('got id and descr', $$[$0]);*/this.$={ stmt: 'state', id: $$[$0], type: 'default', description: ''};
|
8755 | break;
|
8756 | case 11:
|
8757 | /*console.warn('got id and descr', $$[$0-1], $$[$0].trim());*/this.$={ stmt: 'state', id: $$[$0-1], type: 'default', description: yy.trimColon($$[$0])};
|
8758 | break;
|
8759 | case 12:
|
8760 |
|
8761 | /*console.warn('got id', $$[$0-2]);yy.addRelation($$[$0-2], $$[$0]);*/
|
8762 | this.$={ stmt: 'relation', state1: { stmt: 'state', id: $$[$0-2], type: 'default', description: '' }, state2:{ stmt: 'state', id: $$[$0] ,type: 'default', description: ''}};
|
8763 |
|
8764 | break;
|
8765 | case 13:
|
8766 |
|
8767 | /*yy.addRelation($$[$0-3], $$[$0-1], $$[$0].substr(1).trim());*/
|
8768 | this.$={ stmt: 'relation', state1: { stmt: 'state', id: $$[$0-3], type: 'default', description: '' }, state2:{ stmt: 'state', id: $$[$0-1] ,type: 'default', description: ''}, description: $$[$0].substr(1).trim()};
|
8769 |
|
8770 | break;
|
8771 | case 17:
|
8772 |
|
8773 | /* console.warn('Adding document for state without id ', $$[$0-3]);*/
|
8774 | this.$={ stmt: 'state', id: $$[$0-3], type: 'default', description: '', doc: $$[$0-1] }
|
8775 |
|
8776 | break;
|
8777 | case 18:
|
8778 |
|
8779 | var id=$$[$0];
|
8780 | var description = $$[$0-2].trim();
|
8781 | if($$[$0].match(':')){
|
8782 | var parts = $$[$0].split(':');
|
8783 | id=parts[0];
|
8784 | description = [description, parts[1]];
|
8785 | }
|
8786 | this.$={stmt: 'state', id: id, type: 'default', description: description};
|
8787 |
|
8788 |
|
8789 | break;
|
8790 | case 19:
|
8791 |
|
8792 | // console.warn('Adding document for state with id zxzx', $$[$0-3], $$[$0-2], yy.getDirection()); yy.addDocument($$[$0-3]);
|
8793 | this.$={ stmt: 'state', id: $$[$0-3], type: 'default', description: $$[$0-5], doc: $$[$0-1] }
|
8794 |
|
8795 | break;
|
8796 | case 20:
|
8797 |
|
8798 | this.$={ stmt: 'state', id: $$[$0], type: 'fork' }
|
8799 |
|
8800 | break;
|
8801 | case 21:
|
8802 |
|
8803 | this.$={ stmt: 'state', id: $$[$0], type: 'join' }
|
8804 |
|
8805 | break;
|
8806 | case 22:
|
8807 |
|
8808 | this.$={ stmt: 'state', id: $$[$0], type: 'choice' }
|
8809 |
|
8810 | break;
|
8811 | case 23:
|
8812 |
|
8813 | this.$={ stmt: 'state', id: yy.getDividerId(), type: 'divider' }
|
8814 |
|
8815 | break;
|
8816 | case 24:
|
8817 |
|
8818 | /* console.warn('got NOTE, position: ', $$[$0-2].trim(), 'id = ', $$[$0-1].trim(), 'note: ', $$[$0]);*/
|
8819 | this.$={ stmt: 'state', id: $$[$0-1].trim(), note:{position: $$[$0-2].trim(), text: $$[$0].trim()}};
|
8820 |
|
8821 | break;
|
8822 | case 28:
|
8823 | this.$=$$[$0].trim();yy.setAccTitle(this.$);
|
8824 | break;
|
8825 | case 29: case 30:
|
8826 | this.$=$$[$0].trim();yy.setAccDescription(this.$);
|
8827 | break;
|
8828 | case 33:
|
8829 | yy.setDirection('TB');this.$={stmt:'dir', value:'TB'};
|
8830 | break;
|
8831 | case 34:
|
8832 | yy.setDirection('BT');this.$={stmt:'dir', value:'BT'};
|
8833 | break;
|
8834 | case 35:
|
8835 | yy.setDirection('RL'); this.$={stmt:'dir', value:'RL'};
|
8836 | break;
|
8837 | case 36:
|
8838 | yy.setDirection('LR');this.$={stmt:'dir', value:'LR'};
|
8839 | break;
|
8840 | case 39: case 40:
|
8841 | this.$=$$[$0];
|
8842 | break;
|
8843 | case 43:
|
8844 | yy.parseDirective('%%{', 'open_directive');
|
8845 | break;
|
8846 | case 44:
|
8847 | yy.parseDirective($$[$0], 'type_directive');
|
8848 | break;
|
8849 | case 45:
|
8850 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
8851 | break;
|
8852 | case 46:
|
8853 | yy.parseDirective('}%%', 'close_directive', 'state');
|
8854 | break;
|
8855 | }
|
8856 | },
|
8857 | table: [{3:1,4:$V0,5:$V1,6:4,7:$V2,36:6,50:$V3},{1:[3]},{3:8,4:$V0,5:$V1,6:4,7:$V2,36:6,50:$V3},{3:9,4:$V0,5:$V1,6:4,7:$V2,36:6,50:$V3},{3:10,4:$V0,5:$V1,6:4,7:$V2,36:6,50:$V3},o([1,4,5,14,15,17,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],$V4,{8:11}),{37:12,51:[1,13]},{51:[2,43]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:$V5,5:$V6,6:28,9:14,10:16,11:18,14:$V7,15:$V8,17:$V9,20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,27:$Vg,30:29,31:$Vh,33:$Vi,35:$Vj,36:6,41:$Vk,42:$Vl,43:$Vm,44:$Vn,47:$Vo,50:$V3},{38:39,39:[1,40],53:$Vp},o([39,53],[2,44]),o($Vq,[2,6]),{6:28,10:42,11:18,14:$V7,15:$V8,17:$V9,20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,27:$Vg,30:29,31:$Vh,33:$Vi,35:$Vj,36:6,41:$Vk,42:$Vl,43:$Vm,44:$Vn,47:$Vo,50:$V3},o($Vq,[2,8]),o($Vq,[2,9]),o($Vq,[2,10],{12:[1,43],13:[1,44]}),o($Vq,[2,14]),{16:[1,45]},o($Vq,[2,16],{18:[1,46]}),{21:[1,47]},o($Vq,[2,20]),o($Vq,[2,21]),o($Vq,[2,22]),o($Vq,[2,23]),{28:48,29:[1,49],48:[1,50],49:[1,51]},o($Vq,[2,26]),o($Vq,[2,27]),{32:[1,52]},{34:[1,53]},o($Vq,[2,30]),o($Vr,[2,39]),o($Vr,[2,40]),o($Vq,[2,33]),o($Vq,[2,34]),o($Vq,[2,35]),o($Vq,[2,36]),o($Vs,[2,31]),{40:54,52:[1,55]},o($Vs,[2,46]),o($Vq,[2,7]),o($Vq,[2,11]),{11:56,22:$Vb,47:$Vo},o($Vq,[2,15]),o($Vt,$V4,{8:57}),{22:[1,58]},{22:[1,59]},{21:[1,60]},{22:[2,41]},{22:[2,42]},o($Vq,[2,28]),o($Vq,[2,29]),{38:61,53:$Vp},{53:[2,45]},o($Vq,[2,12],{12:[1,62]}),{4:$V5,5:$V6,6:28,9:14,10:16,11:18,14:$V7,15:$V8,17:$V9,19:[1,63],20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,27:$Vg,30:29,31:$Vh,33:$Vi,35:$Vj,36:6,41:$Vk,42:$Vl,43:$Vm,44:$Vn,47:$Vo,50:$V3},o($Vq,[2,18],{18:[1,64]}),{29:[1,65]},{22:[1,66]},o($Vs,[2,32]),o($Vq,[2,13]),o($Vq,[2,17]),o($Vt,$V4,{8:67}),o($Vq,[2,24]),o($Vq,[2,25]),{4:$V5,5:$V6,6:28,9:14,10:16,11:18,14:$V7,15:$V8,17:$V9,19:[1,68],20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,27:$Vg,30:29,31:$Vh,33:$Vi,35:$Vj,36:6,41:$Vk,42:$Vl,43:$Vm,44:$Vn,47:$Vo,50:$V3},o($Vq,[2,19])],
|
8858 | defaultActions: {7:[2,43],8:[2,1],9:[2,2],10:[2,3],50:[2,41],51:[2,42],55:[2,45]},
|
8859 | parseError: function parseError (str, hash) {
|
8860 | if (hash.recoverable) {
|
8861 | this.trace(str);
|
8862 | } else {
|
8863 | var error = new Error(str);
|
8864 | error.hash = hash;
|
8865 | throw error;
|
8866 | }
|
8867 | },
|
8868 | parse: function parse(input) {
|
8869 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
8870 | var args = lstack.slice.call(arguments, 1);
|
8871 | var lexer = Object.create(this.lexer);
|
8872 | var sharedState = { yy: {} };
|
8873 | for (var k in this.yy) {
|
8874 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
8875 | sharedState.yy[k] = this.yy[k];
|
8876 | }
|
8877 | }
|
8878 | lexer.setInput(input, sharedState.yy);
|
8879 | sharedState.yy.lexer = lexer;
|
8880 | sharedState.yy.parser = this;
|
8881 | if (typeof lexer.yylloc == 'undefined') {
|
8882 | lexer.yylloc = {};
|
8883 | }
|
8884 | var yyloc = lexer.yylloc;
|
8885 | lstack.push(yyloc);
|
8886 | var ranges = lexer.options && lexer.options.ranges;
|
8887 | if (typeof sharedState.yy.parseError === 'function') {
|
8888 | this.parseError = sharedState.yy.parseError;
|
8889 | } else {
|
8890 | this.parseError = Object.getPrototypeOf(this).parseError;
|
8891 | }
|
8892 | function popStack(n) {
|
8893 | stack.length = stack.length - 2 * n;
|
8894 | vstack.length = vstack.length - n;
|
8895 | lstack.length = lstack.length - n;
|
8896 | }
|
8897 | function lex() {
|
8898 | var token;
|
8899 | token = tstack.pop() || lexer.lex() || EOF;
|
8900 | if (typeof token !== 'number') {
|
8901 | if (token instanceof Array) {
|
8902 | tstack = token;
|
8903 | token = tstack.pop();
|
8904 | }
|
8905 | token = self.symbols_[token] || token;
|
8906 | }
|
8907 | return token;
|
8908 | }
|
8909 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
8910 | while (true) {
|
8911 | state = stack[stack.length - 1];
|
8912 | if (this.defaultActions[state]) {
|
8913 | action = this.defaultActions[state];
|
8914 | } else {
|
8915 | if (symbol === null || typeof symbol == 'undefined') {
|
8916 | symbol = lex();
|
8917 | }
|
8918 | action = table[state] && table[state][symbol];
|
8919 | }
|
8920 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
8921 | var errStr = '';
|
8922 | expected = [];
|
8923 | for (p in table[state]) {
|
8924 | if (this.terminals_[p] && p > TERROR) {
|
8925 | expected.push('\'' + this.terminals_[p] + '\'');
|
8926 | }
|
8927 | }
|
8928 | if (lexer.showPosition) {
|
8929 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
8930 | } else {
|
8931 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
8932 | }
|
8933 | this.parseError(errStr, {
|
8934 | text: lexer.match,
|
8935 | token: this.terminals_[symbol] || symbol,
|
8936 | line: lexer.yylineno,
|
8937 | loc: yyloc,
|
8938 | expected: expected
|
8939 | });
|
8940 | }
|
8941 | if (action[0] instanceof Array && action.length > 1) {
|
8942 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
8943 | }
|
8944 | switch (action[0]) {
|
8945 | case 1:
|
8946 | stack.push(symbol);
|
8947 | vstack.push(lexer.yytext);
|
8948 | lstack.push(lexer.yylloc);
|
8949 | stack.push(action[1]);
|
8950 | symbol = null;
|
8951 | if (!preErrorSymbol) {
|
8952 | yyleng = lexer.yyleng;
|
8953 | yytext = lexer.yytext;
|
8954 | yylineno = lexer.yylineno;
|
8955 | yyloc = lexer.yylloc;
|
8956 | if (recovering > 0) {
|
8957 | recovering--;
|
8958 | }
|
8959 | } else {
|
8960 | symbol = preErrorSymbol;
|
8961 | preErrorSymbol = null;
|
8962 | }
|
8963 | break;
|
8964 | case 2:
|
8965 | len = this.productions_[action[1]][1];
|
8966 | yyval.$ = vstack[vstack.length - len];
|
8967 | yyval._$ = {
|
8968 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
8969 | last_line: lstack[lstack.length - 1].last_line,
|
8970 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
8971 | last_column: lstack[lstack.length - 1].last_column
|
8972 | };
|
8973 | if (ranges) {
|
8974 | yyval._$.range = [
|
8975 | lstack[lstack.length - (len || 1)].range[0],
|
8976 | lstack[lstack.length - 1].range[1]
|
8977 | ];
|
8978 | }
|
8979 | r = this.performAction.apply(yyval, [
|
8980 | yytext,
|
8981 | yyleng,
|
8982 | yylineno,
|
8983 | sharedState.yy,
|
8984 | action[1],
|
8985 | vstack,
|
8986 | lstack
|
8987 | ].concat(args));
|
8988 | if (typeof r !== 'undefined') {
|
8989 | return r;
|
8990 | }
|
8991 | if (len) {
|
8992 | stack = stack.slice(0, -1 * len * 2);
|
8993 | vstack = vstack.slice(0, -1 * len);
|
8994 | lstack = lstack.slice(0, -1 * len);
|
8995 | }
|
8996 | stack.push(this.productions_[action[1]][0]);
|
8997 | vstack.push(yyval.$);
|
8998 | lstack.push(yyval._$);
|
8999 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
9000 | stack.push(newState);
|
9001 | break;
|
9002 | case 3:
|
9003 | return true;
|
9004 | }
|
9005 | }
|
9006 | return true;
|
9007 | }};
|
9008 |
|
9009 | /* generated by jison-lex 0.3.4 */
|
9010 | var lexer = (function(){
|
9011 | var lexer = ({
|
9012 |
|
9013 | EOF:1,
|
9014 |
|
9015 | parseError:function parseError(str, hash) {
|
9016 | if (this.yy.parser) {
|
9017 | this.yy.parser.parseError(str, hash);
|
9018 | } else {
|
9019 | throw new Error(str);
|
9020 | }
|
9021 | },
|
9022 |
|
9023 | // resets the lexer, sets new input
|
9024 | setInput:function (input, yy) {
|
9025 | this.yy = yy || this.yy || {};
|
9026 | this._input = input;
|
9027 | this._more = this._backtrack = this.done = false;
|
9028 | this.yylineno = this.yyleng = 0;
|
9029 | this.yytext = this.matched = this.match = '';
|
9030 | this.conditionStack = ['INITIAL'];
|
9031 | this.yylloc = {
|
9032 | first_line: 1,
|
9033 | first_column: 0,
|
9034 | last_line: 1,
|
9035 | last_column: 0
|
9036 | };
|
9037 | if (this.options.ranges) {
|
9038 | this.yylloc.range = [0,0];
|
9039 | }
|
9040 | this.offset = 0;
|
9041 | return this;
|
9042 | },
|
9043 |
|
9044 | // consumes and returns one char from the input
|
9045 | input:function () {
|
9046 | var ch = this._input[0];
|
9047 | this.yytext += ch;
|
9048 | this.yyleng++;
|
9049 | this.offset++;
|
9050 | this.match += ch;
|
9051 | this.matched += ch;
|
9052 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
9053 | if (lines) {
|
9054 | this.yylineno++;
|
9055 | this.yylloc.last_line++;
|
9056 | } else {
|
9057 | this.yylloc.last_column++;
|
9058 | }
|
9059 | if (this.options.ranges) {
|
9060 | this.yylloc.range[1]++;
|
9061 | }
|
9062 |
|
9063 | this._input = this._input.slice(1);
|
9064 | return ch;
|
9065 | },
|
9066 |
|
9067 | // unshifts one char (or a string) into the input
|
9068 | unput:function (ch) {
|
9069 | var len = ch.length;
|
9070 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
9071 |
|
9072 | this._input = ch + this._input;
|
9073 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
9074 | //this.yyleng -= len;
|
9075 | this.offset -= len;
|
9076 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
9077 | this.match = this.match.substr(0, this.match.length - 1);
|
9078 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
9079 |
|
9080 | if (lines.length - 1) {
|
9081 | this.yylineno -= lines.length - 1;
|
9082 | }
|
9083 | var r = this.yylloc.range;
|
9084 |
|
9085 | this.yylloc = {
|
9086 | first_line: this.yylloc.first_line,
|
9087 | last_line: this.yylineno + 1,
|
9088 | first_column: this.yylloc.first_column,
|
9089 | last_column: lines ?
|
9090 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
9091 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
9092 | this.yylloc.first_column - len
|
9093 | };
|
9094 |
|
9095 | if (this.options.ranges) {
|
9096 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
9097 | }
|
9098 | this.yyleng = this.yytext.length;
|
9099 | return this;
|
9100 | },
|
9101 |
|
9102 | // When called from action, caches matched text and appends it on next action
|
9103 | more:function () {
|
9104 | this._more = true;
|
9105 | return this;
|
9106 | },
|
9107 |
|
9108 | // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
|
9109 | reject:function () {
|
9110 | if (this.options.backtrack_lexer) {
|
9111 | this._backtrack = true;
|
9112 | } else {
|
9113 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
|
9114 | text: "",
|
9115 | token: null,
|
9116 | line: this.yylineno
|
9117 | });
|
9118 |
|
9119 | }
|
9120 | return this;
|
9121 | },
|
9122 |
|
9123 | // retain first n characters of the match
|
9124 | less:function (n) {
|
9125 | this.unput(this.match.slice(n));
|
9126 | },
|
9127 |
|
9128 | // displays already matched input, i.e. for error messages
|
9129 | pastInput:function () {
|
9130 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
9131 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
9132 | },
|
9133 |
|
9134 | // displays upcoming input, i.e. for error messages
|
9135 | upcomingInput:function () {
|
9136 | var next = this.match;
|
9137 | if (next.length < 20) {
|
9138 | next += this._input.substr(0, 20-next.length);
|
9139 | }
|
9140 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
9141 | },
|
9142 |
|
9143 | // displays the character position where the lexing error occurred, i.e. for error messages
|
9144 | showPosition:function () {
|
9145 | var pre = this.pastInput();
|
9146 | var c = new Array(pre.length + 1).join("-");
|
9147 | return pre + this.upcomingInput() + "\n" + c + "^";
|
9148 | },
|
9149 |
|
9150 | // test the lexed token: return FALSE when not a match, otherwise return token
|
9151 | test_match:function(match, indexed_rule) {
|
9152 | var token,
|
9153 | lines,
|
9154 | backup;
|
9155 |
|
9156 | if (this.options.backtrack_lexer) {
|
9157 | // save context
|
9158 | backup = {
|
9159 | yylineno: this.yylineno,
|
9160 | yylloc: {
|
9161 | first_line: this.yylloc.first_line,
|
9162 | last_line: this.last_line,
|
9163 | first_column: this.yylloc.first_column,
|
9164 | last_column: this.yylloc.last_column
|
9165 | },
|
9166 | yytext: this.yytext,
|
9167 | match: this.match,
|
9168 | matches: this.matches,
|
9169 | matched: this.matched,
|
9170 | yyleng: this.yyleng,
|
9171 | offset: this.offset,
|
9172 | _more: this._more,
|
9173 | _input: this._input,
|
9174 | yy: this.yy,
|
9175 | conditionStack: this.conditionStack.slice(0),
|
9176 | done: this.done
|
9177 | };
|
9178 | if (this.options.ranges) {
|
9179 | backup.yylloc.range = this.yylloc.range.slice(0);
|
9180 | }
|
9181 | }
|
9182 |
|
9183 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
9184 | if (lines) {
|
9185 | this.yylineno += lines.length;
|
9186 | }
|
9187 | this.yylloc = {
|
9188 | first_line: this.yylloc.last_line,
|
9189 | last_line: this.yylineno + 1,
|
9190 | first_column: this.yylloc.last_column,
|
9191 | last_column: lines ?
|
9192 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
9193 | this.yylloc.last_column + match[0].length
|
9194 | };
|
9195 | this.yytext += match[0];
|
9196 | this.match += match[0];
|
9197 | this.matches = match;
|
9198 | this.yyleng = this.yytext.length;
|
9199 | if (this.options.ranges) {
|
9200 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
9201 | }
|
9202 | this._more = false;
|
9203 | this._backtrack = false;
|
9204 | this._input = this._input.slice(match[0].length);
|
9205 | this.matched += match[0];
|
9206 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
9207 | if (this.done && this._input) {
|
9208 | this.done = false;
|
9209 | }
|
9210 | if (token) {
|
9211 | return token;
|
9212 | } else if (this._backtrack) {
|
9213 | // recover context
|
9214 | for (var k in backup) {
|
9215 | this[k] = backup[k];
|
9216 | }
|
9217 | return false; // rule action called reject() implying the next rule should be tested instead.
|
9218 | }
|
9219 | return false;
|
9220 | },
|
9221 |
|
9222 | // return next match in input
|
9223 | next:function () {
|
9224 | if (this.done) {
|
9225 | return this.EOF;
|
9226 | }
|
9227 | if (!this._input) {
|
9228 | this.done = true;
|
9229 | }
|
9230 |
|
9231 | var token,
|
9232 | match,
|
9233 | tempMatch,
|
9234 | index;
|
9235 | if (!this._more) {
|
9236 | this.yytext = '';
|
9237 | this.match = '';
|
9238 | }
|
9239 | var rules = this._currentRules();
|
9240 | for (var i = 0; i < rules.length; i++) {
|
9241 | tempMatch = this._input.match(this.rules[rules[i]]);
|
9242 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
9243 | match = tempMatch;
|
9244 | index = i;
|
9245 | if (this.options.backtrack_lexer) {
|
9246 | token = this.test_match(tempMatch, rules[i]);
|
9247 | if (token !== false) {
|
9248 | return token;
|
9249 | } else if (this._backtrack) {
|
9250 | match = false;
|
9251 | continue; // rule action called reject() implying a rule MISmatch.
|
9252 | } else {
|
9253 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
9254 | return false;
|
9255 | }
|
9256 | } else if (!this.options.flex) {
|
9257 | break;
|
9258 | }
|
9259 | }
|
9260 | }
|
9261 | if (match) {
|
9262 | token = this.test_match(match, rules[index]);
|
9263 | if (token !== false) {
|
9264 | return token;
|
9265 | }
|
9266 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
9267 | return false;
|
9268 | }
|
9269 | if (this._input === "") {
|
9270 | return this.EOF;
|
9271 | } else {
|
9272 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
9273 | text: "",
|
9274 | token: null,
|
9275 | line: this.yylineno
|
9276 | });
|
9277 | }
|
9278 | },
|
9279 |
|
9280 | // return next match that has a token
|
9281 | lex:function lex () {
|
9282 | var r = this.next();
|
9283 | if (r) {
|
9284 | return r;
|
9285 | } else {
|
9286 | return this.lex();
|
9287 | }
|
9288 | },
|
9289 |
|
9290 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
9291 | begin:function begin (condition) {
|
9292 | this.conditionStack.push(condition);
|
9293 | },
|
9294 |
|
9295 | // pop the previously active lexer condition state off the condition stack
|
9296 | popState:function popState () {
|
9297 | var n = this.conditionStack.length - 1;
|
9298 | if (n > 0) {
|
9299 | return this.conditionStack.pop();
|
9300 | } else {
|
9301 | return this.conditionStack[0];
|
9302 | }
|
9303 | },
|
9304 |
|
9305 | // produce the lexer rule set which is active for the currently active lexer condition state
|
9306 | _currentRules:function _currentRules () {
|
9307 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
9308 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
9309 | } else {
|
9310 | return this.conditions["INITIAL"].rules;
|
9311 | }
|
9312 | },
|
9313 |
|
9314 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
9315 | topState:function topState (n) {
|
9316 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
9317 | if (n >= 0) {
|
9318 | return this.conditionStack[n];
|
9319 | } else {
|
9320 | return "INITIAL";
|
9321 | }
|
9322 | },
|
9323 |
|
9324 | // alias for begin(condition)
|
9325 | pushState:function pushState (condition) {
|
9326 | this.begin(condition);
|
9327 | },
|
9328 |
|
9329 | // return the number of states currently on the stack
|
9330 | stateStackSize:function stateStackSize() {
|
9331 | return this.conditionStack.length;
|
9332 | },
|
9333 | options: {"case-insensitive":true},
|
9334 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
9335 | var YYSTATE=YY_START;
|
9336 | switch($avoiding_name_collisions) {
|
9337 | case 0:return 41;
|
9338 | break;
|
9339 | case 1:return 42;
|
9340 | break;
|
9341 | case 2:return 43;
|
9342 | break;
|
9343 | case 3:return 44;
|
9344 | break;
|
9345 | case 4: this.begin('open_directive'); return 50;
|
9346 | break;
|
9347 | case 5: this.begin('type_directive'); return 51;
|
9348 | break;
|
9349 | case 6: this.popState(); this.begin('arg_directive'); return 39;
|
9350 | break;
|
9351 | case 7: this.popState(); this.popState(); return 53;
|
9352 | break;
|
9353 | case 8:return 52;
|
9354 | break;
|
9355 | case 9:/* skip comments */
|
9356 | break;
|
9357 | case 10:/* skip comments */{ /*console.log('Crap after close');*/ }
|
9358 | break;
|
9359 | case 11:return 5;
|
9360 | break;
|
9361 | case 12:/* skip all whitespace */
|
9362 | break;
|
9363 | case 13:/* skip same-line whitespace */
|
9364 | break;
|
9365 | case 14:/* skip comments */
|
9366 | break;
|
9367 | case 15:/* skip comments */
|
9368 | break;
|
9369 | case 16: this.pushState('SCALE'); /* console.log('Got scale', yy_.yytext);*/ return 15;
|
9370 | break;
|
9371 | case 17:return 16;
|
9372 | break;
|
9373 | case 18:this.popState();
|
9374 | break;
|
9375 | case 19: this.begin("acc_title");return 31;
|
9376 | break;
|
9377 | case 20: this.popState(); return "acc_title_value";
|
9378 | break;
|
9379 | case 21: this.begin("acc_descr");return 33;
|
9380 | break;
|
9381 | case 22: this.popState(); return "acc_descr_value";
|
9382 | break;
|
9383 | case 23: this.begin("acc_descr_multiline");
|
9384 | break;
|
9385 | case 24: this.popState();
|
9386 | break;
|
9387 | case 25:return "acc_descr_multiline_value";
|
9388 | break;
|
9389 | case 26: /*console.log('Starting STATE zxzx'+yy.getDirection());*/this.pushState('STATE');
|
9390 | break;
|
9391 | case 27:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim(); /*console.warn('Fork Fork: ',yy_.yytext);*/return 23;
|
9392 | break;
|
9393 | case 28:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 24;
|
9394 | break;
|
9395 | case 29:this.popState();yy_.yytext=yy_.yytext.slice(0,-10).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 25;
|
9396 | break;
|
9397 | case 30:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Fork: ',yy_.yytext);*/return 23;
|
9398 | break;
|
9399 | case 31:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 24;
|
9400 | break;
|
9401 | case 32:this.popState();yy_.yytext=yy_.yytext.slice(0,-10).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 25;
|
9402 | break;
|
9403 | case 33: return 41;
|
9404 | break;
|
9405 | case 34: return 42;
|
9406 | break;
|
9407 | case 35: return 43;
|
9408 | break;
|
9409 | case 36: return 44;
|
9410 | break;
|
9411 | case 37: /*console.log('Starting STATE_STRING zxzx');*/this.begin("STATE_STRING");
|
9412 | break;
|
9413 | case 38:this.popState();this.pushState('STATE_ID');return "AS";
|
9414 | break;
|
9415 | case 39:this.popState();/* console.log('STATE_ID', yy_.yytext);*/return "ID";
|
9416 | break;
|
9417 | case 40:this.popState();
|
9418 | break;
|
9419 | case 41: /*console.log('Long description:', yy_.yytext);*/return "STATE_DESCR";
|
9420 | break;
|
9421 | case 42:/*console.log('COMPOSIT_STATE', yy_.yytext);*/return 17;
|
9422 | break;
|
9423 | case 43:this.popState();
|
9424 | break;
|
9425 | case 44:this.popState();this.pushState('struct'); /*console.log('begin struct', yy_.yytext);*/return 18;
|
9426 | break;
|
9427 | case 45: /*console.log('Ending struct');*/ this.popState(); return 19;
|
9428 | break;
|
9429 | case 46:/* nothing */
|
9430 | break;
|
9431 | case 47: this.begin('NOTE'); return 27;
|
9432 | break;
|
9433 | case 48: this.popState();this.pushState('NOTE_ID');return 48;
|
9434 | break;
|
9435 | case 49: this.popState();this.pushState('NOTE_ID');return 49;
|
9436 | break;
|
9437 | case 50: this.popState();this.pushState('FLOATING_NOTE');
|
9438 | break;
|
9439 | case 51:this.popState();this.pushState('FLOATING_NOTE_ID');return "AS";
|
9440 | break;
|
9441 | case 52:/**/
|
9442 | break;
|
9443 | case 53: /*console.log('Floating note text: ', yy_.yytext);*/return "NOTE_TEXT";
|
9444 | break;
|
9445 | case 54:this.popState();/*console.log('Floating note ID', yy_.yytext);*/return "ID";
|
9446 | break;
|
9447 | case 55: this.popState();this.pushState('NOTE_TEXT');/*console.log('Got ID for note', yy_.yytext);*/return 22;
|
9448 | break;
|
9449 | case 56: this.popState();/*console.log('Got NOTE_TEXT for note',yy_.yytext);*/yy_.yytext = yy_.yytext.substr(2).trim();return 29;
|
9450 | break;
|
9451 | case 57: this.popState();/*console.log('Got NOTE_TEXT for note',yy_.yytext);*/yy_.yytext = yy_.yytext.slice(0,-8).trim();return 29;
|
9452 | break;
|
9453 | case 58: /*console.log('Got state diagram', yy_.yytext,'#');*/return 7;
|
9454 | break;
|
9455 | case 59: /*console.log('Got state diagram', yy_.yytext,'#');*/return 7;
|
9456 | break;
|
9457 | case 60: /*console.log('HIDE_EMPTY', yy_.yytext,'#');*/return 14;
|
9458 | break;
|
9459 | case 61: /*console.log('EDGE_STATE=',yy_.yytext);*/ return 47;
|
9460 | break;
|
9461 | case 62: /*console.log('=>ID=',yy_.yytext);*/ return 22;
|
9462 | break;
|
9463 | case 63: yy_.yytext = yy_.yytext.trim(); /*console.log('Descr = ', yy_.yytext);*/ return 12;
|
9464 | break;
|
9465 | case 64:return 13;
|
9466 | break;
|
9467 | case 65:return 26;
|
9468 | break;
|
9469 | case 66:return 5;
|
9470 | break;
|
9471 | case 67:return 'INVALID';
|
9472 | break;
|
9473 | }
|
9474 | },
|
9475 | rules: [/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*<<choice>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?:$)/i,/^(?:.)/i],
|
9476 | conditions: {"LINE":{"rules":[13,14],"inclusive":false},"close_directive":{"rules":[13,14],"inclusive":false},"arg_directive":{"rules":[7,8,13,14],"inclusive":false},"type_directive":{"rules":[6,7,13,14],"inclusive":false},"open_directive":{"rules":[5,13,14],"inclusive":false},"struct":{"rules":[13,14,26,33,34,35,36,45,46,47,61,62,63,64,65],"inclusive":false},"FLOATING_NOTE_ID":{"rules":[54],"inclusive":false},"FLOATING_NOTE":{"rules":[51,52,53],"inclusive":false},"NOTE_TEXT":{"rules":[56,57],"inclusive":false},"NOTE_ID":{"rules":[55],"inclusive":false},"NOTE":{"rules":[48,49,50],"inclusive":false},"acc_descr_multiline":{"rules":[24,25],"inclusive":false},"acc_descr":{"rules":[22],"inclusive":false},"acc_title":{"rules":[20],"inclusive":false},"SCALE":{"rules":[17,18],"inclusive":false},"ALIAS":{"rules":[],"inclusive":false},"STATE_ID":{"rules":[39],"inclusive":false},"STATE_STRING":{"rules":[40,41],"inclusive":false},"FORK_STATE":{"rules":[],"inclusive":false},"STATE":{"rules":[13,14,27,28,29,30,31,32,37,38,42,43,44],"inclusive":false},"ID":{"rules":[13,14],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,9,10,11,12,14,15,16,19,21,23,26,44,47,58,59,60,61,62,63,64,66,67],"inclusive":true}}
|
9477 | });
|
9478 | return lexer;
|
9479 | })();
|
9480 | parser.lexer = lexer;
|
9481 | function Parser () {
|
9482 | this.yy = {};
|
9483 | }
|
9484 | Parser.prototype = parser;parser.Parser = Parser;
|
9485 | return new Parser;
|
9486 | })();
|
9487 |
|
9488 |
|
9489 | if (true) {
|
9490 | exports.parser = parser;
|
9491 | exports.Parser = parser.Parser;
|
9492 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
9493 | exports.main = function commonjsMain (args) {
|
9494 | if (!args[1]) {
|
9495 | console.log('Usage: '+args[0]+' FILE');
|
9496 | process.exit(1);
|
9497 | }
|
9498 | var source = (__webpack_require__(/*! fs */ "?a3b8").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
|
9499 | return exports.parser.parse(source);
|
9500 | };
|
9501 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
9502 | exports.main(process.argv.slice(1));
|
9503 | }
|
9504 | }
|
9505 |
|
9506 | /***/ }),
|
9507 |
|
9508 | /***/ "./src/diagrams/user-journey/parser/journey.jison":
|
9509 | /*!********************************************************!*\
|
9510 | !*** ./src/diagrams/user-journey/parser/journey.jison ***!
|
9511 | \********************************************************/
|
9512 | /***/ ((module, exports, __webpack_require__) => {
|
9513 |
|
9514 | /* module decorator */ module = __webpack_require__.nmd(module);
|
9515 | /* parser generated by jison 0.4.18 */
|
9516 | /*
|
9517 | Returns a Parser object of the following structure:
|
9518 |
|
9519 | Parser: {
|
9520 | yy: {}
|
9521 | }
|
9522 |
|
9523 | Parser.prototype: {
|
9524 | yy: {},
|
9525 | trace: function(),
|
9526 | symbols_: {associative list: name ==> number},
|
9527 | terminals_: {associative list: number ==> name},
|
9528 | productions_: [...],
|
9529 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
9530 | table: [...],
|
9531 | defaultActions: {...},
|
9532 | parseError: function(str, hash),
|
9533 | parse: function(input),
|
9534 |
|
9535 | lexer: {
|
9536 | EOF: 1,
|
9537 | parseError: function(str, hash),
|
9538 | setInput: function(input),
|
9539 | input: function(),
|
9540 | unput: function(str),
|
9541 | more: function(),
|
9542 | less: function(n),
|
9543 | pastInput: function(),
|
9544 | upcomingInput: function(),
|
9545 | showPosition: function(),
|
9546 | test_match: function(regex_match_array, rule_index),
|
9547 | next: function(),
|
9548 | lex: function(),
|
9549 | begin: function(condition),
|
9550 | popState: function(),
|
9551 | _currentRules: function(),
|
9552 | topState: function(),
|
9553 | pushState: function(condition),
|
9554 |
|
9555 | options: {
|
9556 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
9557 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
9558 | backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
|
9559 | },
|
9560 |
|
9561 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
9562 | rules: [...],
|
9563 | conditions: {associative list: name ==> set},
|
9564 | }
|
9565 | }
|
9566 |
|
9567 |
|
9568 | token location info (@$, _$, etc.): {
|
9569 | first_line: n,
|
9570 | last_line: n,
|
9571 | first_column: n,
|
9572 | last_column: n,
|
9573 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
9574 | }
|
9575 |
|
9576 |
|
9577 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
9578 | text: (matched text)
|
9579 | token: (the produced terminal token, if any)
|
9580 | line: (yylineno)
|
9581 | }
|
9582 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
9583 | loc: (yylloc)
|
9584 | expected: (string describing the set of expected tokens)
|
9585 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
9586 | }
|
9587 | */
|
9588 | var parser = (function(){
|
9589 | var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,2],$V1=[1,5],$V2=[6,9,11,17,18,20,22,23,24,26],$V3=[1,15],$V4=[1,16],$V5=[1,17],$V6=[1,18],$V7=[1,19],$V8=[1,20],$V9=[1,24],$Va=[4,6,9,11,17,18,20,22,23,24,26];
|
9590 | var parser = {trace: function trace () { },
|
9591 | yy: {},
|
9592 | symbols_: {"error":2,"start":3,"journey":4,"document":5,"EOF":6,"directive":7,"line":8,"SPACE":9,"statement":10,"NEWLINE":11,"openDirective":12,"typeDirective":13,"closeDirective":14,":":15,"argDirective":16,"title":17,"acc_title":18,"acc_title_value":19,"acc_descr":20,"acc_descr_value":21,"acc_descr_multiline_value":22,"section":23,"taskName":24,"taskData":25,"open_directive":26,"type_directive":27,"arg_directive":28,"close_directive":29,"$accept":0,"$end":1},
|
9593 | terminals_: {2:"error",4:"journey",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",17:"title",18:"acc_title",19:"acc_title_value",20:"acc_descr",21:"acc_descr_value",22:"acc_descr_multiline_value",23:"section",24:"taskName",25:"taskData",26:"open_directive",27:"type_directive",28:"arg_directive",29:"close_directive"},
|
9594 | productions_: [0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,2],[10,2],[10,1],[10,1],[10,2],[10,1],[12,1],[13,1],[16,1],[14,1]],
|
9595 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
9596 | /* this == yyval */
|
9597 |
|
9598 | var $0 = $$.length - 1;
|
9599 | switch (yystate) {
|
9600 | case 1:
|
9601 | return $$[$0-1];
|
9602 | break;
|
9603 | case 3:
|
9604 | this.$ = []
|
9605 | break;
|
9606 | case 4:
|
9607 | $$[$0-1].push($$[$0]);this.$ = $$[$0-1]
|
9608 | break;
|
9609 | case 5: case 6:
|
9610 | this.$ = $$[$0]
|
9611 | break;
|
9612 | case 7: case 8:
|
9613 | this.$=[];
|
9614 | break;
|
9615 | case 11:
|
9616 | yy.setDiagramTitle($$[$0].substr(6));this.$=$$[$0].substr(6);
|
9617 | break;
|
9618 | case 12:
|
9619 | this.$=$$[$0].trim();yy.setAccTitle(this.$);
|
9620 | break;
|
9621 | case 13: case 14:
|
9622 | this.$=$$[$0].trim();yy.setAccDescription(this.$);
|
9623 | break;
|
9624 | case 15:
|
9625 | yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8);
|
9626 | break;
|
9627 | case 16:
|
9628 | yy.addTask($$[$0-1], $$[$0]);this.$='task';
|
9629 | break;
|
9630 | case 18:
|
9631 | yy.parseDirective('%%{', 'open_directive');
|
9632 | break;
|
9633 | case 19:
|
9634 | yy.parseDirective($$[$0], 'type_directive');
|
9635 | break;
|
9636 | case 20:
|
9637 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
9638 | break;
|
9639 | case 21:
|
9640 | yy.parseDirective('}%%', 'close_directive', 'journey');
|
9641 | break;
|
9642 | }
|
9643 | },
|
9644 | table: [{3:1,4:$V0,7:3,12:4,26:$V1},{1:[3]},o($V2,[2,3],{5:6}),{3:7,4:$V0,7:3,12:4,26:$V1},{13:8,27:[1,9]},{27:[2,18]},{6:[1,10],7:21,8:11,9:[1,12],10:13,11:[1,14],12:4,17:$V3,18:$V4,20:$V5,22:$V6,23:$V7,24:$V8,26:$V1},{1:[2,2]},{14:22,15:[1,23],29:$V9},o([15,29],[2,19]),o($V2,[2,8],{1:[2,1]}),o($V2,[2,4]),{7:21,10:25,12:4,17:$V3,18:$V4,20:$V5,22:$V6,23:$V7,24:$V8,26:$V1},o($V2,[2,6]),o($V2,[2,7]),o($V2,[2,11]),{19:[1,26]},{21:[1,27]},o($V2,[2,14]),o($V2,[2,15]),{25:[1,28]},o($V2,[2,17]),{11:[1,29]},{16:30,28:[1,31]},{11:[2,21]},o($V2,[2,5]),o($V2,[2,12]),o($V2,[2,13]),o($V2,[2,16]),o($Va,[2,9]),{14:32,29:$V9},{29:[2,20]},{11:[1,33]},o($Va,[2,10])],
|
9645 | defaultActions: {5:[2,18],7:[2,2],24:[2,21],31:[2,20]},
|
9646 | parseError: function parseError (str, hash) {
|
9647 | if (hash.recoverable) {
|
9648 | this.trace(str);
|
9649 | } else {
|
9650 | var error = new Error(str);
|
9651 | error.hash = hash;
|
9652 | throw error;
|
9653 | }
|
9654 | },
|
9655 | parse: function parse(input) {
|
9656 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
9657 | var args = lstack.slice.call(arguments, 1);
|
9658 | var lexer = Object.create(this.lexer);
|
9659 | var sharedState = { yy: {} };
|
9660 | for (var k in this.yy) {
|
9661 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
9662 | sharedState.yy[k] = this.yy[k];
|
9663 | }
|
9664 | }
|
9665 | lexer.setInput(input, sharedState.yy);
|
9666 | sharedState.yy.lexer = lexer;
|
9667 | sharedState.yy.parser = this;
|
9668 | if (typeof lexer.yylloc == 'undefined') {
|
9669 | lexer.yylloc = {};
|
9670 | }
|
9671 | var yyloc = lexer.yylloc;
|
9672 | lstack.push(yyloc);
|
9673 | var ranges = lexer.options && lexer.options.ranges;
|
9674 | if (typeof sharedState.yy.parseError === 'function') {
|
9675 | this.parseError = sharedState.yy.parseError;
|
9676 | } else {
|
9677 | this.parseError = Object.getPrototypeOf(this).parseError;
|
9678 | }
|
9679 | function popStack(n) {
|
9680 | stack.length = stack.length - 2 * n;
|
9681 | vstack.length = vstack.length - n;
|
9682 | lstack.length = lstack.length - n;
|
9683 | }
|
9684 | function lex() {
|
9685 | var token;
|
9686 | token = tstack.pop() || lexer.lex() || EOF;
|
9687 | if (typeof token !== 'number') {
|
9688 | if (token instanceof Array) {
|
9689 | tstack = token;
|
9690 | token = tstack.pop();
|
9691 | }
|
9692 | token = self.symbols_[token] || token;
|
9693 | }
|
9694 | return token;
|
9695 | }
|
9696 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
9697 | while (true) {
|
9698 | state = stack[stack.length - 1];
|
9699 | if (this.defaultActions[state]) {
|
9700 | action = this.defaultActions[state];
|
9701 | } else {
|
9702 | if (symbol === null || typeof symbol == 'undefined') {
|
9703 | symbol = lex();
|
9704 | }
|
9705 | action = table[state] && table[state][symbol];
|
9706 | }
|
9707 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
9708 | var errStr = '';
|
9709 | expected = [];
|
9710 | for (p in table[state]) {
|
9711 | if (this.terminals_[p] && p > TERROR) {
|
9712 | expected.push('\'' + this.terminals_[p] + '\'');
|
9713 | }
|
9714 | }
|
9715 | if (lexer.showPosition) {
|
9716 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
9717 | } else {
|
9718 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
9719 | }
|
9720 | this.parseError(errStr, {
|
9721 | text: lexer.match,
|
9722 | token: this.terminals_[symbol] || symbol,
|
9723 | line: lexer.yylineno,
|
9724 | loc: yyloc,
|
9725 | expected: expected
|
9726 | });
|
9727 | }
|
9728 | if (action[0] instanceof Array && action.length > 1) {
|
9729 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
9730 | }
|
9731 | switch (action[0]) {
|
9732 | case 1:
|
9733 | stack.push(symbol);
|
9734 | vstack.push(lexer.yytext);
|
9735 | lstack.push(lexer.yylloc);
|
9736 | stack.push(action[1]);
|
9737 | symbol = null;
|
9738 | if (!preErrorSymbol) {
|
9739 | yyleng = lexer.yyleng;
|
9740 | yytext = lexer.yytext;
|
9741 | yylineno = lexer.yylineno;
|
9742 | yyloc = lexer.yylloc;
|
9743 | if (recovering > 0) {
|
9744 | recovering--;
|
9745 | }
|
9746 | } else {
|
9747 | symbol = preErrorSymbol;
|
9748 | preErrorSymbol = null;
|
9749 | }
|
9750 | break;
|
9751 | case 2:
|
9752 | len = this.productions_[action[1]][1];
|
9753 | yyval.$ = vstack[vstack.length - len];
|
9754 | yyval._$ = {
|
9755 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
9756 | last_line: lstack[lstack.length - 1].last_line,
|
9757 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
9758 | last_column: lstack[lstack.length - 1].last_column
|
9759 | };
|
9760 | if (ranges) {
|
9761 | yyval._$.range = [
|
9762 | lstack[lstack.length - (len || 1)].range[0],
|
9763 | lstack[lstack.length - 1].range[1]
|
9764 | ];
|
9765 | }
|
9766 | r = this.performAction.apply(yyval, [
|
9767 | yytext,
|
9768 | yyleng,
|
9769 | yylineno,
|
9770 | sharedState.yy,
|
9771 | action[1],
|
9772 | vstack,
|
9773 | lstack
|
9774 | ].concat(args));
|
9775 | if (typeof r !== 'undefined') {
|
9776 | return r;
|
9777 | }
|
9778 | if (len) {
|
9779 | stack = stack.slice(0, -1 * len * 2);
|
9780 | vstack = vstack.slice(0, -1 * len);
|
9781 | lstack = lstack.slice(0, -1 * len);
|
9782 | }
|
9783 | stack.push(this.productions_[action[1]][0]);
|
9784 | vstack.push(yyval.$);
|
9785 | lstack.push(yyval._$);
|
9786 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
9787 | stack.push(newState);
|
9788 | break;
|
9789 | case 3:
|
9790 | return true;
|
9791 | }
|
9792 | }
|
9793 | return true;
|
9794 | }};
|
9795 |
|
9796 | /* generated by jison-lex 0.3.4 */
|
9797 | var lexer = (function(){
|
9798 | var lexer = ({
|
9799 |
|
9800 | EOF:1,
|
9801 |
|
9802 | parseError:function parseError(str, hash) {
|
9803 | if (this.yy.parser) {
|
9804 | this.yy.parser.parseError(str, hash);
|
9805 | } else {
|
9806 | throw new Error(str);
|
9807 | }
|
9808 | },
|
9809 |
|
9810 | // resets the lexer, sets new input
|
9811 | setInput:function (input, yy) {
|
9812 | this.yy = yy || this.yy || {};
|
9813 | this._input = input;
|
9814 | this._more = this._backtrack = this.done = false;
|
9815 | this.yylineno = this.yyleng = 0;
|
9816 | this.yytext = this.matched = this.match = '';
|
9817 | this.conditionStack = ['INITIAL'];
|
9818 | this.yylloc = {
|
9819 | first_line: 1,
|
9820 | first_column: 0,
|
9821 | last_line: 1,
|
9822 | last_column: 0
|
9823 | };
|
9824 | if (this.options.ranges) {
|
9825 | this.yylloc.range = [0,0];
|
9826 | }
|
9827 | this.offset = 0;
|
9828 | return this;
|
9829 | },
|
9830 |
|
9831 | // consumes and returns one char from the input
|
9832 | input:function () {
|
9833 | var ch = this._input[0];
|
9834 | this.yytext += ch;
|
9835 | this.yyleng++;
|
9836 | this.offset++;
|
9837 | this.match += ch;
|
9838 | this.matched += ch;
|
9839 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
9840 | if (lines) {
|
9841 | this.yylineno++;
|
9842 | this.yylloc.last_line++;
|
9843 | } else {
|
9844 | this.yylloc.last_column++;
|
9845 | }
|
9846 | if (this.options.ranges) {
|
9847 | this.yylloc.range[1]++;
|
9848 | }
|
9849 |
|
9850 | this._input = this._input.slice(1);
|
9851 | return ch;
|
9852 | },
|
9853 |
|
9854 | // unshifts one char (or a string) into the input
|
9855 | unput:function (ch) {
|
9856 | var len = ch.length;
|
9857 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
9858 |
|
9859 | this._input = ch + this._input;
|
9860 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
9861 | //this.yyleng -= len;
|
9862 | this.offset -= len;
|
9863 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
9864 | this.match = this.match.substr(0, this.match.length - 1);
|
9865 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
9866 |
|
9867 | if (lines.length - 1) {
|
9868 | this.yylineno -= lines.length - 1;
|
9869 | }
|
9870 | var r = this.yylloc.range;
|
9871 |
|
9872 | this.yylloc = {
|
9873 | first_line: this.yylloc.first_line,
|
9874 | last_line: this.yylineno + 1,
|
9875 | first_column: this.yylloc.first_column,
|
9876 | last_column: lines ?
|
9877 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
9878 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
9879 | this.yylloc.first_column - len
|
9880 | };
|
9881 |
|
9882 | if (this.options.ranges) {
|
9883 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
9884 | }
|
9885 | this.yyleng = this.yytext.length;
|
9886 | return this;
|
9887 | },
|
9888 |
|
9889 | // When called from action, caches matched text and appends it on next action
|
9890 | more:function () {
|
9891 | this._more = true;
|
9892 | return this;
|
9893 | },
|
9894 |
|
9895 | // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
|
9896 | reject:function () {
|
9897 | if (this.options.backtrack_lexer) {
|
9898 | this._backtrack = true;
|
9899 | } else {
|
9900 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
|
9901 | text: "",
|
9902 | token: null,
|
9903 | line: this.yylineno
|
9904 | });
|
9905 |
|
9906 | }
|
9907 | return this;
|
9908 | },
|
9909 |
|
9910 | // retain first n characters of the match
|
9911 | less:function (n) {
|
9912 | this.unput(this.match.slice(n));
|
9913 | },
|
9914 |
|
9915 | // displays already matched input, i.e. for error messages
|
9916 | pastInput:function () {
|
9917 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
9918 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
9919 | },
|
9920 |
|
9921 | // displays upcoming input, i.e. for error messages
|
9922 | upcomingInput:function () {
|
9923 | var next = this.match;
|
9924 | if (next.length < 20) {
|
9925 | next += this._input.substr(0, 20-next.length);
|
9926 | }
|
9927 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
9928 | },
|
9929 |
|
9930 | // displays the character position where the lexing error occurred, i.e. for error messages
|
9931 | showPosition:function () {
|
9932 | var pre = this.pastInput();
|
9933 | var c = new Array(pre.length + 1).join("-");
|
9934 | return pre + this.upcomingInput() + "\n" + c + "^";
|
9935 | },
|
9936 |
|
9937 | // test the lexed token: return FALSE when not a match, otherwise return token
|
9938 | test_match:function(match, indexed_rule) {
|
9939 | var token,
|
9940 | lines,
|
9941 | backup;
|
9942 |
|
9943 | if (this.options.backtrack_lexer) {
|
9944 | // save context
|
9945 | backup = {
|
9946 | yylineno: this.yylineno,
|
9947 | yylloc: {
|
9948 | first_line: this.yylloc.first_line,
|
9949 | last_line: this.last_line,
|
9950 | first_column: this.yylloc.first_column,
|
9951 | last_column: this.yylloc.last_column
|
9952 | },
|
9953 | yytext: this.yytext,
|
9954 | match: this.match,
|
9955 | matches: this.matches,
|
9956 | matched: this.matched,
|
9957 | yyleng: this.yyleng,
|
9958 | offset: this.offset,
|
9959 | _more: this._more,
|
9960 | _input: this._input,
|
9961 | yy: this.yy,
|
9962 | conditionStack: this.conditionStack.slice(0),
|
9963 | done: this.done
|
9964 | };
|
9965 | if (this.options.ranges) {
|
9966 | backup.yylloc.range = this.yylloc.range.slice(0);
|
9967 | }
|
9968 | }
|
9969 |
|
9970 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
9971 | if (lines) {
|
9972 | this.yylineno += lines.length;
|
9973 | }
|
9974 | this.yylloc = {
|
9975 | first_line: this.yylloc.last_line,
|
9976 | last_line: this.yylineno + 1,
|
9977 | first_column: this.yylloc.last_column,
|
9978 | last_column: lines ?
|
9979 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
9980 | this.yylloc.last_column + match[0].length
|
9981 | };
|
9982 | this.yytext += match[0];
|
9983 | this.match += match[0];
|
9984 | this.matches = match;
|
9985 | this.yyleng = this.yytext.length;
|
9986 | if (this.options.ranges) {
|
9987 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
9988 | }
|
9989 | this._more = false;
|
9990 | this._backtrack = false;
|
9991 | this._input = this._input.slice(match[0].length);
|
9992 | this.matched += match[0];
|
9993 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
9994 | if (this.done && this._input) {
|
9995 | this.done = false;
|
9996 | }
|
9997 | if (token) {
|
9998 | return token;
|
9999 | } else if (this._backtrack) {
|
10000 | // recover context
|
10001 | for (var k in backup) {
|
10002 | this[k] = backup[k];
|
10003 | }
|
10004 | return false; // rule action called reject() implying the next rule should be tested instead.
|
10005 | }
|
10006 | return false;
|
10007 | },
|
10008 |
|
10009 | // return next match in input
|
10010 | next:function () {
|
10011 | if (this.done) {
|
10012 | return this.EOF;
|
10013 | }
|
10014 | if (!this._input) {
|
10015 | this.done = true;
|
10016 | }
|
10017 |
|
10018 | var token,
|
10019 | match,
|
10020 | tempMatch,
|
10021 | index;
|
10022 | if (!this._more) {
|
10023 | this.yytext = '';
|
10024 | this.match = '';
|
10025 | }
|
10026 | var rules = this._currentRules();
|
10027 | for (var i = 0; i < rules.length; i++) {
|
10028 | tempMatch = this._input.match(this.rules[rules[i]]);
|
10029 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
10030 | match = tempMatch;
|
10031 | index = i;
|
10032 | if (this.options.backtrack_lexer) {
|
10033 | token = this.test_match(tempMatch, rules[i]);
|
10034 | if (token !== false) {
|
10035 | return token;
|
10036 | } else if (this._backtrack) {
|
10037 | match = false;
|
10038 | continue; // rule action called reject() implying a rule MISmatch.
|
10039 | } else {
|
10040 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
10041 | return false;
|
10042 | }
|
10043 | } else if (!this.options.flex) {
|
10044 | break;
|
10045 | }
|
10046 | }
|
10047 | }
|
10048 | if (match) {
|
10049 | token = this.test_match(match, rules[index]);
|
10050 | if (token !== false) {
|
10051 | return token;
|
10052 | }
|
10053 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
10054 | return false;
|
10055 | }
|
10056 | if (this._input === "") {
|
10057 | return this.EOF;
|
10058 | } else {
|
10059 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
10060 | text: "",
|
10061 | token: null,
|
10062 | line: this.yylineno
|
10063 | });
|
10064 | }
|
10065 | },
|
10066 |
|
10067 | // return next match that has a token
|
10068 | lex:function lex () {
|
10069 | var r = this.next();
|
10070 | if (r) {
|
10071 | return r;
|
10072 | } else {
|
10073 | return this.lex();
|
10074 | }
|
10075 | },
|
10076 |
|
10077 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
10078 | begin:function begin (condition) {
|
10079 | this.conditionStack.push(condition);
|
10080 | },
|
10081 |
|
10082 | // pop the previously active lexer condition state off the condition stack
|
10083 | popState:function popState () {
|
10084 | var n = this.conditionStack.length - 1;
|
10085 | if (n > 0) {
|
10086 | return this.conditionStack.pop();
|
10087 | } else {
|
10088 | return this.conditionStack[0];
|
10089 | }
|
10090 | },
|
10091 |
|
10092 | // produce the lexer rule set which is active for the currently active lexer condition state
|
10093 | _currentRules:function _currentRules () {
|
10094 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
10095 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
10096 | } else {
|
10097 | return this.conditions["INITIAL"].rules;
|
10098 | }
|
10099 | },
|
10100 |
|
10101 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
10102 | topState:function topState (n) {
|
10103 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
10104 | if (n >= 0) {
|
10105 | return this.conditionStack[n];
|
10106 | } else {
|
10107 | return "INITIAL";
|
10108 | }
|
10109 | },
|
10110 |
|
10111 | // alias for begin(condition)
|
10112 | pushState:function pushState (condition) {
|
10113 | this.begin(condition);
|
10114 | },
|
10115 |
|
10116 | // return the number of states currently on the stack
|
10117 | stateStackSize:function stateStackSize() {
|
10118 | return this.conditionStack.length;
|
10119 | },
|
10120 | options: {"case-insensitive":true},
|
10121 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
10122 | var YYSTATE=YY_START;
|
10123 | switch($avoiding_name_collisions) {
|
10124 | case 0: this.begin('open_directive'); return 26;
|
10125 | break;
|
10126 | case 1: this.begin('type_directive'); return 27;
|
10127 | break;
|
10128 | case 2: this.popState(); this.begin('arg_directive'); return 15;
|
10129 | break;
|
10130 | case 3: this.popState(); this.popState(); return 29;
|
10131 | break;
|
10132 | case 4:return 28;
|
10133 | break;
|
10134 | case 5:/* skip comments */
|
10135 | break;
|
10136 | case 6:/* skip comments */
|
10137 | break;
|
10138 | case 7:return 11;
|
10139 | break;
|
10140 | case 8:/* skip whitespace */
|
10141 | break;
|
10142 | case 9:/* skip comments */
|
10143 | break;
|
10144 | case 10:return 4;
|
10145 | break;
|
10146 | case 11:return 17;
|
10147 | break;
|
10148 | case 12: this.begin("acc_title");return 18;
|
10149 | break;
|
10150 | case 13: this.popState(); return "acc_title_value";
|
10151 | break;
|
10152 | case 14: this.begin("acc_descr");return 20;
|
10153 | break;
|
10154 | case 15: this.popState(); return "acc_descr_value";
|
10155 | break;
|
10156 | case 16: this.begin("acc_descr_multiline");
|
10157 | break;
|
10158 | case 17: this.popState();
|
10159 | break;
|
10160 | case 18:return "acc_descr_multiline_value";
|
10161 | break;
|
10162 | case 19:return 23;
|
10163 | break;
|
10164 | case 20:return 24;
|
10165 | break;
|
10166 | case 21:return 25;
|
10167 | break;
|
10168 | case 22:return 15;
|
10169 | break;
|
10170 | case 23:return 6;
|
10171 | break;
|
10172 | case 24:return 'INVALID';
|
10173 | break;
|
10174 | }
|
10175 | },
|
10176 | rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],
|
10177 | conditions: {"open_directive":{"rules":[1],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"acc_descr_multiline":{"rules":[17,18],"inclusive":false},"acc_descr":{"rules":[15],"inclusive":false},"acc_title":{"rules":[13],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,11,12,14,16,19,20,21,22,23,24],"inclusive":true}}
|
10178 | });
|
10179 | return lexer;
|
10180 | })();
|
10181 | parser.lexer = lexer;
|
10182 | function Parser () {
|
10183 | this.yy = {};
|
10184 | }
|
10185 | Parser.prototype = parser;parser.Parser = Parser;
|
10186 | return new Parser;
|
10187 | })();
|
10188 |
|
10189 |
|
10190 | if (true) {
|
10191 | exports.parser = parser;
|
10192 | exports.Parser = parser.Parser;
|
10193 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
10194 | exports.main = function commonjsMain (args) {
|
10195 | if (!args[1]) {
|
10196 | console.log('Usage: '+args[0]+' FILE');
|
10197 | process.exit(1);
|
10198 | }
|
10199 | var source = (__webpack_require__(/*! fs */ "?0f62").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
|
10200 | return exports.parser.parse(source);
|
10201 | };
|
10202 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
10203 | exports.main(process.argv.slice(1));
|
10204 | }
|
10205 | }
|
10206 |
|
10207 | /***/ }),
|
10208 |
|
10209 | /***/ "./src/Diagram.js":
|
10210 | /*!************************!*\
|
10211 | !*** ./src/Diagram.js ***!
|
10212 | \************************/
|
10213 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10214 |
|
10215 | "use strict";
|
10216 | __webpack_require__.r(__webpack_exports__);
|
10217 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10218 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
10219 | /* harmony export */ });
|
10220 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./config */ "./src/config.js");
|
10221 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
|
10222 | /* harmony import */ var _diagram_api_diagramAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./diagram-api/diagramAPI */ "./src/diagram-api/diagramAPI.js");
|
10223 | /* harmony import */ var _diagram_api_detectType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./diagram-api/detectType */ "./src/diagram-api/detectType.js");
|
10224 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
10225 |
|
10226 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
10227 |
|
10228 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
10229 |
|
10230 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
10231 |
|
10232 |
|
10233 |
|
10234 |
|
10235 |
|
10236 |
|
10237 |
|
10238 | var Diagram = /*#__PURE__*/function () {
|
10239 | function Diagram(txt) {
|
10240 | var _this$db$clear, _this$db;
|
10241 |
|
10242 | _classCallCheck(this, Diagram);
|
10243 |
|
10244 | _defineProperty(this, "type", 'graph');
|
10245 |
|
10246 | _defineProperty(this, "parser", void 0);
|
10247 |
|
10248 | _defineProperty(this, "renderer", void 0);
|
10249 |
|
10250 | _defineProperty(this, "db", void 0);
|
10251 |
|
10252 | var diagrams = (0,_diagram_api_diagramAPI__WEBPACK_IMPORTED_MODULE_0__.getDiagrams)();
|
10253 | var cnf = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig();
|
10254 | this.txt = txt;
|
10255 | this.type = (0,_diagram_api_detectType__WEBPACK_IMPORTED_MODULE_2__["default"])(txt, cnf);
|
10256 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('Type ' + this.type); // console.log('this.type', this.type, diagrams[this.type]);
|
10257 | // Setup diagram
|
10258 |
|
10259 | this.db = diagrams[this.type].db;
|
10260 | (_this$db$clear = (_this$db = this.db).clear) === null || _this$db$clear === void 0 ? void 0 : _this$db$clear.call(_this$db);
|
10261 | this.renderer = diagrams[this.type].renderer;
|
10262 | this.parser = diagrams[this.type].parser;
|
10263 | this.parser.parser.yy = this.db;
|
10264 |
|
10265 | if (typeof diagrams[this.type].init === 'function') {
|
10266 | diagrams[this.type].init(cnf);
|
10267 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('Initialized diagram ' + this.type, cnf);
|
10268 | }
|
10269 |
|
10270 | this.txt = this.txt + '\n';
|
10271 | this.parser.parser.yy.graphType = this.type;
|
10272 |
|
10273 | this.parser.parser.yy.parseError = function (str, hash) {
|
10274 | var error = {
|
10275 | str: str,
|
10276 | hash: hash
|
10277 | };
|
10278 | throw error;
|
10279 | };
|
10280 |
|
10281 | this.parser.parse(this.txt);
|
10282 | }
|
10283 |
|
10284 | _createClass(Diagram, [{
|
10285 | key: "parse",
|
10286 | value: function parse(text) {
|
10287 | var parseEncounteredException = false;
|
10288 |
|
10289 | try {
|
10290 | text = text + '\n';
|
10291 | this.db.clear();
|
10292 | this.parser.parse(text);
|
10293 | } catch (error) {
|
10294 | parseEncounteredException = true; // Is this the correct way to access mermiad's parseError()
|
10295 | // method ? (or global.mermaid.parseError()) ?
|
10296 |
|
10297 | if (__webpack_require__.g.mermaid.parseError) {
|
10298 | if (error.str != undefined) {
|
10299 | // handle case where error string and hash were
|
10300 | // wrapped in object like`const error = { str, hash };`
|
10301 | __webpack_require__.g.mermaid.parseError(error.str, error.hash);
|
10302 | } else {
|
10303 | // assume it is just error string and pass it on
|
10304 | __webpack_require__.g.mermaid.parseError(error);
|
10305 | }
|
10306 | } else {
|
10307 | // No mermaid.parseError() handler defined, so re-throw it
|
10308 | throw error;
|
10309 | }
|
10310 | }
|
10311 |
|
10312 | return !parseEncounteredException;
|
10313 | }
|
10314 | }, {
|
10315 | key: "getParser",
|
10316 | value: function getParser() {
|
10317 | return this.parser;
|
10318 | }
|
10319 | }, {
|
10320 | key: "getType",
|
10321 | value: function getType() {
|
10322 | return this.type;
|
10323 | }
|
10324 | }]);
|
10325 |
|
10326 | return Diagram;
|
10327 | }();
|
10328 |
|
10329 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Diagram);
|
10330 |
|
10331 | /***/ }),
|
10332 |
|
10333 | /***/ "./src/accessibility.js":
|
10334 | /*!******************************!*\
|
10335 | !*** ./src/accessibility.js ***!
|
10336 | \******************************/
|
10337 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10338 |
|
10339 | "use strict";
|
10340 | __webpack_require__.r(__webpack_exports__);
|
10341 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10342 | /* harmony export */ "default": () => (/* binding */ addSVGAccessibilityFields)
|
10343 | /* harmony export */ });
|
10344 | /**
|
10345 | * This method will add a basic title and description element to a chart. The yy parser will need to
|
10346 | * respond to getAccTitle and getAccDescription, where the title is the title element on the chart,
|
10347 | * which is generally not displayed and the accDescription is the description element on the chart,
|
10348 | * which is never displayed.
|
10349 | *
|
10350 | * The following charts display their title as a visual and accessibility element: gantt
|
10351 | *
|
10352 | * @param yy_parser
|
10353 | * @param svg
|
10354 | * @param id
|
10355 | */
|
10356 | function addSVGAccessibilityFields(yy_parser, svg, id) {
|
10357 | if (typeof svg.insert === 'undefined') {
|
10358 | return;
|
10359 | }
|
10360 |
|
10361 | var title_string = yy_parser.getAccTitle();
|
10362 | var description = yy_parser.getAccDescription();
|
10363 | svg.attr('role', 'img').attr('aria-labelledby', 'chart-title-' + id + ' chart-desc-' + id);
|
10364 | svg.insert('desc', ':first-child').attr('id', 'chart-desc-' + id).text(description);
|
10365 | svg.insert('title', ':first-child').attr('id', 'chart-title-' + id).text(title_string);
|
10366 | }
|
10367 |
|
10368 | /***/ }),
|
10369 |
|
10370 | /***/ "./src/assignWithDepth.js":
|
10371 | /*!********************************!*\
|
10372 | !*** ./src/assignWithDepth.js ***!
|
10373 | \********************************/
|
10374 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10375 |
|
10376 | "use strict";
|
10377 | __webpack_require__.r(__webpack_exports__);
|
10378 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10379 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
10380 | /* harmony export */ });
|
10381 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
10382 |
|
10383 | /**
|
10384 | * @function assignWithDepth Extends the functionality of {@link ObjectConstructor.assign} with the
|
10385 | * ability to merge arbitrary-depth objects For each key in src with path `k` (recursively)
|
10386 | * performs an Object.assign(dst[`k`], src[`k`]) with a slight change from the typical handling of
|
10387 | * undefined for dst[`k`]: instead of raising an error, dst[`k`] is auto-initialized to {} and
|
10388 | * effectively merged with src[`k`]<p> Additionally, dissimilar types will not clobber unless the
|
10389 | * config.clobber parameter === true. Example:
|
10390 | *
|
10391 | * ```js
|
10392 | * let config_0 = { foo: { bar: 'bar' }, bar: 'foo' };
|
10393 | * let config_1 = { foo: 'foo', bar: 'bar' };
|
10394 | * let result = assignWithDepth(config_0, config_1);
|
10395 | * console.log(result);
|
10396 | * //-> result: { foo: { bar: 'bar' }, bar: 'bar' }
|
10397 | * ```
|
10398 | *
|
10399 | * Traditional Object.assign would have clobbered foo in config_0 with foo in config_1. If src is a
|
10400 | * destructured array of objects and dst is not an array, assignWithDepth will apply each element
|
10401 | * of src to dst in order.
|
10402 | * @param dst
|
10403 | * @param src
|
10404 | * @param config
|
10405 | * @param dst
|
10406 | * @param src
|
10407 | * @param config
|
10408 | * @param dst
|
10409 | * @param src
|
10410 | * @param config
|
10411 | * @param {any} dst - The destination of the merge
|
10412 | * @param {any} src - The source object(s) to merge into destination
|
10413 | * @param {{ depth: number; clobber: boolean }} [config={ depth: 2, clobber: false }] - Depth: depth
|
10414 | * to traverse within src and dst for merging - clobber: should dissimilar types clobber (default:
|
10415 | * { depth: 2, clobber: false }). Default is `{ depth: 2, clobber: false }`
|
10416 | * @returns {any}
|
10417 | */
|
10418 | var assignWithDepth = function assignWithDepth(dst, src, config) {
|
10419 | var _Object$assign = Object.assign({
|
10420 | depth: 2,
|
10421 | clobber: false
|
10422 | }, config),
|
10423 | depth = _Object$assign.depth,
|
10424 | clobber = _Object$assign.clobber;
|
10425 |
|
10426 | if (Array.isArray(src) && !Array.isArray(dst)) {
|
10427 | src.forEach(function (s) {
|
10428 | return assignWithDepth(dst, s, config);
|
10429 | });
|
10430 | return dst;
|
10431 | } else if (Array.isArray(src) && Array.isArray(dst)) {
|
10432 | src.forEach(function (s) {
|
10433 | if (dst.indexOf(s) === -1) {
|
10434 | dst.push(s);
|
10435 | }
|
10436 | });
|
10437 | return dst;
|
10438 | }
|
10439 |
|
10440 | if (typeof dst === 'undefined' || depth <= 0) {
|
10441 | if (dst !== undefined && dst !== null && _typeof(dst) === 'object' && _typeof(src) === 'object') {
|
10442 | return Object.assign(dst, src);
|
10443 | } else {
|
10444 | return src;
|
10445 | }
|
10446 | }
|
10447 |
|
10448 | if (typeof src !== 'undefined' && _typeof(dst) === 'object' && _typeof(src) === 'object') {
|
10449 | Object.keys(src).forEach(function (key) {
|
10450 | if (_typeof(src[key]) === 'object' && (dst[key] === undefined || _typeof(dst[key]) === 'object')) {
|
10451 | if (dst[key] === undefined) {
|
10452 | dst[key] = Array.isArray(src[key]) ? [] : {};
|
10453 | }
|
10454 |
|
10455 | dst[key] = assignWithDepth(dst[key], src[key], {
|
10456 | depth: depth - 1,
|
10457 | clobber: clobber
|
10458 | });
|
10459 | } else if (clobber || _typeof(dst[key]) !== 'object' && _typeof(src[key]) !== 'object') {
|
10460 | dst[key] = src[key];
|
10461 | }
|
10462 | });
|
10463 | }
|
10464 |
|
10465 | return dst;
|
10466 | };
|
10467 |
|
10468 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (assignWithDepth);
|
10469 |
|
10470 | /***/ }),
|
10471 |
|
10472 | /***/ "./src/commonDb.js":
|
10473 | /*!*************************!*\
|
10474 | !*** ./src/commonDb.js ***!
|
10475 | \*************************/
|
10476 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10477 |
|
10478 | "use strict";
|
10479 | __webpack_require__.r(__webpack_exports__);
|
10480 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10481 | /* harmony export */ "clear": () => (/* binding */ clear),
|
10482 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
10483 | /* harmony export */ "getAccDescription": () => (/* binding */ getAccDescription),
|
10484 | /* harmony export */ "getAccTitle": () => (/* binding */ getAccTitle),
|
10485 | /* harmony export */ "getDiagramTitle": () => (/* binding */ getDiagramTitle),
|
10486 | /* harmony export */ "setAccDescription": () => (/* binding */ setAccDescription),
|
10487 | /* harmony export */ "setAccTitle": () => (/* binding */ setAccTitle),
|
10488 | /* harmony export */ "setDiagramTitle": () => (/* binding */ setDiagramTitle)
|
10489 | /* harmony export */ });
|
10490 | /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./diagrams/common/common */ "./src/diagrams/common/common.js");
|
10491 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./config */ "./src/config.js");
|
10492 |
|
10493 |
|
10494 | var title = '';
|
10495 | var diagramTitle = '';
|
10496 | var description = '';
|
10497 |
|
10498 | var sanitizeText = function sanitizeText(txt) {
|
10499 | return (0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_0__.sanitizeText)(txt, (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)());
|
10500 | };
|
10501 |
|
10502 | var clear = function clear() {
|
10503 | title = '';
|
10504 | description = '';
|
10505 | diagramTitle = '';
|
10506 | };
|
10507 | var setAccTitle = function setAccTitle(txt) {
|
10508 | title = sanitizeText(txt).replace(/^\s+/g, '');
|
10509 | };
|
10510 | var getAccTitle = function getAccTitle() {
|
10511 | return title || diagramTitle;
|
10512 | };
|
10513 | var setAccDescription = function setAccDescription(txt) {
|
10514 | description = sanitizeText(txt).replace(/\n\s+/g, '\n');
|
10515 | };
|
10516 | var getAccDescription = function getAccDescription() {
|
10517 | return description;
|
10518 | };
|
10519 | var setDiagramTitle = function setDiagramTitle(txt) {
|
10520 | diagramTitle = sanitizeText(txt);
|
10521 | };
|
10522 | var getDiagramTitle = function getDiagramTitle() {
|
10523 | return diagramTitle;
|
10524 | };
|
10525 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
10526 | setAccTitle: setAccTitle,
|
10527 | getAccTitle: getAccTitle,
|
10528 | setDiagramTitle: setDiagramTitle,
|
10529 | getDiagramTitle: getDiagramTitle,
|
10530 | getAccDescription: getAccDescription,
|
10531 | setAccDescription: setAccDescription,
|
10532 | clear: clear
|
10533 | });
|
10534 |
|
10535 | /***/ }),
|
10536 |
|
10537 | /***/ "./src/config.js":
|
10538 | /*!***********************!*\
|
10539 | !*** ./src/config.js ***!
|
10540 | \***********************/
|
10541 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10542 |
|
10543 | "use strict";
|
10544 | __webpack_require__.r(__webpack_exports__);
|
10545 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10546 | /* harmony export */ "addDirective": () => (/* binding */ addDirective),
|
10547 | /* harmony export */ "defaultConfig": () => (/* binding */ defaultConfig),
|
10548 | /* harmony export */ "getConfig": () => (/* binding */ getConfig),
|
10549 | /* harmony export */ "getSiteConfig": () => (/* binding */ getSiteConfig),
|
10550 | /* harmony export */ "reset": () => (/* binding */ reset),
|
10551 | /* harmony export */ "sanitize": () => (/* binding */ sanitize),
|
10552 | /* harmony export */ "saveConfigFromInitialize": () => (/* binding */ saveConfigFromInitialize),
|
10553 | /* harmony export */ "setConfig": () => (/* binding */ setConfig),
|
10554 | /* harmony export */ "setSiteConfig": () => (/* binding */ setSiteConfig),
|
10555 | /* harmony export */ "updateCurrentConfig": () => (/* binding */ updateCurrentConfig),
|
10556 | /* harmony export */ "updateSiteConfig": () => (/* binding */ updateSiteConfig)
|
10557 | /* harmony export */ });
|
10558 | /* harmony import */ var _assignWithDepth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assignWithDepth */ "./src/assignWithDepth.js");
|
10559 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
|
10560 | /* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
|
10561 | /* harmony import */ var _defaultConfig__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defaultConfig */ "./src/defaultConfig.js");
|
10562 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
10563 |
|
10564 |
|
10565 |
|
10566 |
|
10567 |
|
10568 | var defaultConfig = Object.freeze(_defaultConfig__WEBPACK_IMPORTED_MODULE_0__["default"]);
|
10569 | var siteConfig = (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_1__["default"])({}, defaultConfig);
|
10570 | var configFromInitialize;
|
10571 | var directives = [];
|
10572 | var currentConfig = (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_1__["default"])({}, defaultConfig);
|
10573 | var updateCurrentConfig = function updateCurrentConfig(siteCfg, _directives) {
|
10574 | // start with config beeing the siteConfig
|
10575 | var cfg = (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_1__["default"])({}, siteCfg); // let sCfg = assignWithDepth(defaultConfig, siteConfigDelta);
|
10576 | // Join directives
|
10577 |
|
10578 | var sumOfDirectives = {};
|
10579 |
|
10580 | for (var i = 0; i < _directives.length; i++) {
|
10581 | var d = _directives[i];
|
10582 | sanitize(d); // Apply the data from the directive where the the overrides the themeVariables
|
10583 |
|
10584 | sumOfDirectives = (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_1__["default"])(sumOfDirectives, d);
|
10585 | }
|
10586 |
|
10587 | cfg = (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_1__["default"])(cfg, sumOfDirectives);
|
10588 |
|
10589 | if (sumOfDirectives.theme && _themes__WEBPACK_IMPORTED_MODULE_2__["default"][sumOfDirectives.theme]) {
|
10590 | var tmpConfigFromInitialize = (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_1__["default"])({}, configFromInitialize);
|
10591 | var themeVariables = (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_1__["default"])(tmpConfigFromInitialize.themeVariables || {}, sumOfDirectives.themeVariables);
|
10592 | cfg.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_2__["default"][cfg.theme].getThemeVariables(themeVariables);
|
10593 | }
|
10594 |
|
10595 | currentConfig = cfg;
|
10596 | return cfg;
|
10597 | };
|
10598 | /**
|
10599 | * ## setSiteConfig
|
10600 | *
|
10601 | * | Function | Description | Type | Values |
|
10602 | * | ------------- | ------------------------------------- | ----------- | --------------------------------------- |
|
10603 | * | setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array |
|
10604 | *
|
10605 | * **Notes:** Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls
|
10606 | * to reset() will reset the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig)
|
10607 | * will reset siteConfig and currentConfig to the defaultConfig Note: currentConfig is set in this
|
10608 | * function _Default value: At default, will mirror Global Config_
|
10609 | *
|
10610 | * @param conf - The base currentConfig to use as siteConfig
|
10611 | * @returns {object} - The siteConfig
|
10612 | */
|
10613 |
|
10614 | var setSiteConfig = function setSiteConfig(conf) {
|
10615 | siteConfig = (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_1__["default"])({}, defaultConfig);
|
10616 | siteConfig = (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_1__["default"])(siteConfig, conf);
|
10617 |
|
10618 | if (conf.theme && _themes__WEBPACK_IMPORTED_MODULE_2__["default"][conf.theme]) {
|
10619 | siteConfig.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_2__["default"][conf.theme].getThemeVariables(conf.themeVariables);
|
10620 | }
|
10621 |
|
10622 | currentConfig = updateCurrentConfig(siteConfig, directives);
|
10623 | return siteConfig;
|
10624 | };
|
10625 | var saveConfigFromInitialize = function saveConfigFromInitialize(conf) {
|
10626 | configFromInitialize = (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_1__["default"])({}, conf);
|
10627 | };
|
10628 | var updateSiteConfig = function updateSiteConfig(conf) {
|
10629 | siteConfig = (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_1__["default"])(siteConfig, conf);
|
10630 | updateCurrentConfig(siteConfig, directives);
|
10631 | return siteConfig;
|
10632 | };
|
10633 | /**
|
10634 | * ## getSiteConfig
|
10635 | *
|
10636 | * | Function | Description | Type | Values |
|
10637 | * | ------------- | ------------------------------------------------- | ----------- | -------------------------------- |
|
10638 | * | setSiteConfig | Returns the current siteConfig base configuration | Get Request | Returns Any Values in siteConfig |
|
10639 | *
|
10640 | * **Notes**: Returns **any** values in siteConfig.
|
10641 | *
|
10642 | * @returns {object} - The siteConfig
|
10643 | */
|
10644 |
|
10645 | var getSiteConfig = function getSiteConfig() {
|
10646 | return (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_1__["default"])({}, siteConfig);
|
10647 | };
|
10648 | /**
|
10649 | * ## setConfig
|
10650 | *
|
10651 | * | Function | Description | Type | Values |
|
10652 | * | ------------- | ------------------------------------- | ----------- | --------------------------------------- |
|
10653 | * | setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array |
|
10654 | *
|
10655 | * **Notes**: Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure
|
10656 | * keys. Any values found in conf with key found in siteConfig.secure will be replaced with the
|
10657 | * corresponding siteConfig value.
|
10658 | *
|
10659 | * @param {any} conf - The potential currentConfig
|
10660 | * @returns {any} - The currentConfig merged with the sanitized conf
|
10661 | */
|
10662 |
|
10663 | var setConfig = function setConfig(conf) {
|
10664 | // sanitize(conf);
|
10665 | // Object.keys(conf).forEach(key => {
|
10666 | // const manipulator = manipulators[key];
|
10667 | // conf[key] = manipulator ? manipulator(conf[key]) : conf[key];
|
10668 | // });
|
10669 | (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_1__["default"])(currentConfig, conf);
|
10670 | return getConfig();
|
10671 | };
|
10672 | /**
|
10673 | * ## getConfig
|
10674 | *
|
10675 | * | Function | Description | Type | Return Values |
|
10676 | * | --------- | ------------------------- | ----------- | ------------------------------ |
|
10677 | * | getConfig | Obtains the currentConfig | Get Request | Any Values from current Config |
|
10678 | *
|
10679 | * **Notes**: Returns **any** the currentConfig
|
10680 | *
|
10681 | * @returns {any} - The currentConfig
|
10682 | */
|
10683 |
|
10684 | var getConfig = function getConfig() {
|
10685 | return (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_1__["default"])({}, currentConfig);
|
10686 | };
|
10687 | /**
|
10688 | * ## sanitize
|
10689 | *
|
10690 | * | Function | Description | Type | Values |
|
10691 | * | -------- | -------------------------------------- | ----------- | ------ |
|
10692 | * | sanitize | Sets the siteConfig to desired values. | Put Request | None |
|
10693 | *
|
10694 | * Ensures options parameter does not attempt to override siteConfig secure keys **Notes**: modifies
|
10695 | * options in-place
|
10696 | *
|
10697 | * @param {any} options - The potential setConfig parameter
|
10698 | */
|
10699 |
|
10700 | var sanitize = function sanitize(options) {
|
10701 | // Checking that options are not in the list of excluded options
|
10702 | Object.keys(siteConfig.secure).forEach(function (key) {
|
10703 | if (typeof options[siteConfig.secure[key]] !== 'undefined') {
|
10704 | // DO NOT attempt to print options[siteConfig.secure[key]] within `${}` as a malicious script
|
10705 | // can exploit the logger's attempt to stringify the value and execute arbitrary code
|
10706 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug("Denied attempt to modify a secure key ".concat(siteConfig.secure[key]), options[siteConfig.secure[key]]);
|
10707 | delete options[siteConfig.secure[key]];
|
10708 | }
|
10709 | }); // Check that there no attempts of prototype pollution
|
10710 |
|
10711 | Object.keys(options).forEach(function (key) {
|
10712 | if (key.indexOf('__') === 0) {
|
10713 | delete options[key];
|
10714 | }
|
10715 | }); // Check that there no attempts of xss, there should be no tags at all in the directive
|
10716 | // blocking data urls as base64 urls can contain svgs with inline script tags
|
10717 |
|
10718 | Object.keys(options).forEach(function (key) {
|
10719 | if (typeof options[key] === 'string') {
|
10720 | if (options[key].indexOf('<') > -1 || options[key].indexOf('>') > -1 || options[key].indexOf('url(data:') > -1) {
|
10721 | delete options[key];
|
10722 | }
|
10723 | }
|
10724 |
|
10725 | if (_typeof(options[key]) === 'object') {
|
10726 | sanitize(options[key]);
|
10727 | }
|
10728 | });
|
10729 | };
|
10730 | /**
|
10731 | * Pushes in a directive to the configuration
|
10732 | *
|
10733 | * @param {object} directive The directive to push in
|
10734 | */
|
10735 |
|
10736 | var addDirective = function addDirective(directive) {
|
10737 | if (directive.fontFamily) {
|
10738 | if (!directive.themeVariables) {
|
10739 | directive.themeVariables = {
|
10740 | fontFamily: directive.fontFamily
|
10741 | };
|
10742 | } else {
|
10743 | if (!directive.themeVariables.fontFamily) {
|
10744 | directive.themeVariables = {
|
10745 | fontFamily: directive.fontFamily
|
10746 | };
|
10747 | }
|
10748 | }
|
10749 | }
|
10750 |
|
10751 | directives.push(directive);
|
10752 | updateCurrentConfig(siteConfig, directives);
|
10753 | };
|
10754 | /**
|
10755 | * ## reset
|
10756 | *
|
10757 | * | Function | Description | Type | Required | Values |
|
10758 | * | -------- | ---------------------------- | ----------- | -------- | ------ |
|
10759 | * | reset | Resets currentConfig to conf | Put Request | Required | None |
|
10760 | *
|
10761 | * ## conf
|
10762 | *
|
10763 | * | Parameter | Description | Type | Required | Values |
|
10764 | * | --------- | -------------------------------------------------------------- | ---------- | -------- | -------------------------------------------- |
|
10765 | * | conf | base set of values, which currentConfig could be **reset** to. | Dictionary | Required | Any Values, with respect to the secure Array |
|
10766 | *
|
10767 | * **Notes**: (default: current siteConfig ) (optional, default `getSiteConfig()`)
|
10768 | */
|
10769 |
|
10770 | var reset = function reset() {
|
10771 | // Replace current config with siteConfig
|
10772 | directives = [];
|
10773 | updateCurrentConfig(siteConfig, directives);
|
10774 | };
|
10775 |
|
10776 | /***/ }),
|
10777 |
|
10778 | /***/ "./src/dagre-wrapper/clusters.js":
|
10779 | /*!***************************************!*\
|
10780 | !*** ./src/dagre-wrapper/clusters.js ***!
|
10781 | \***************************************/
|
10782 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10783 |
|
10784 | "use strict";
|
10785 | __webpack_require__.r(__webpack_exports__);
|
10786 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10787 | /* harmony export */ "clear": () => (/* binding */ clear),
|
10788 | /* harmony export */ "getClusterTitleWidth": () => (/* binding */ getClusterTitleWidth),
|
10789 | /* harmony export */ "insertCluster": () => (/* binding */ insertCluster),
|
10790 | /* harmony export */ "positionCluster": () => (/* binding */ positionCluster)
|
10791 | /* harmony export */ });
|
10792 | /* harmony import */ var _intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./intersect/intersect-rect */ "./src/dagre-wrapper/intersect/intersect-rect.js");
|
10793 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
|
10794 | /* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
|
10795 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
10796 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
10797 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../config */ "./src/config.js");
|
10798 | /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js");
|
10799 |
|
10800 |
|
10801 |
|
10802 |
|
10803 |
|
10804 |
|
10805 |
|
10806 | var rect = function rect(parent, node) {
|
10807 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Creating subgraph rect for ', node.id, node); // Add outer g element
|
10808 |
|
10809 | var shapeSvg = parent.insert('g').attr('class', 'cluster' + (node.class ? ' ' + node.class : '')).attr('id', node.id); // add the rect
|
10810 |
|
10811 | var rect = shapeSvg.insert('rect', ':first-child'); // Create the label and insert it after the rect
|
10812 |
|
10813 | var label = shapeSvg.insert('g').attr('class', 'cluster-label');
|
10814 | var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true)); // Get the size of the label
|
10815 |
|
10816 | var bbox = text.getBBox();
|
10817 |
|
10818 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels)) {
|
10819 | var div = text.children[0];
|
10820 | var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text);
|
10821 | bbox = div.getBoundingClientRect();
|
10822 | dv.attr('width', bbox.width);
|
10823 | dv.attr('height', bbox.height);
|
10824 | }
|
10825 |
|
10826 | var padding = 0 * node.padding;
|
10827 | var halfPadding = padding / 2;
|
10828 | var width = node.width <= bbox.width + padding ? bbox.width + padding : node.width;
|
10829 |
|
10830 | if (node.width <= bbox.width + padding) {
|
10831 | node.diff = (bbox.width - node.width) / 2 - node.padding / 2;
|
10832 | } else {
|
10833 | node.diff = -node.padding / 2;
|
10834 | }
|
10835 |
|
10836 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Data ', node, JSON.stringify(node)); // center the rect around its coordinate
|
10837 |
|
10838 | rect.attr('style', node.style).attr('rx', node.rx).attr('ry', node.ry).attr('x', node.x - width / 2).attr('y', node.y - node.height / 2 - halfPadding).attr('width', width).attr('height', node.height + padding); // Center the label
|
10839 |
|
10840 | label.attr('transform', 'translate(' + (node.x - bbox.width / 2) + ', ' + (node.y - node.height / 2 + node.padding / 3) + ')');
|
10841 | var rectBox = rect.node().getBBox();
|
10842 | node.width = rectBox.width;
|
10843 | node.height = rectBox.height;
|
10844 |
|
10845 | node.intersect = function (point) {
|
10846 | return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point);
|
10847 | };
|
10848 |
|
10849 | return shapeSvg;
|
10850 | };
|
10851 | /**
|
10852 | * Non visible cluster where the note is group with its
|
10853 | *
|
10854 | * @param {any} parent
|
10855 | * @param {any} node
|
10856 | * @returns {any} ShapeSvg
|
10857 | */
|
10858 |
|
10859 |
|
10860 | var noteGroup = function noteGroup(parent, node) {
|
10861 | // Add outer g element
|
10862 | var shapeSvg = parent.insert('g').attr('class', 'note-cluster').attr('id', node.id); // add the rect
|
10863 |
|
10864 | var rect = shapeSvg.insert('rect', ':first-child');
|
10865 | var padding = 0 * node.padding;
|
10866 | var halfPadding = padding / 2; // center the rect around its coordinate
|
10867 |
|
10868 | rect.attr('rx', node.rx).attr('ry', node.ry).attr('x', node.x - node.width / 2 - halfPadding).attr('y', node.y - node.height / 2 - halfPadding).attr('width', node.width + padding).attr('height', node.height + padding).attr('fill', 'none');
|
10869 | var rectBox = rect.node().getBBox();
|
10870 | node.width = rectBox.width;
|
10871 | node.height = rectBox.height;
|
10872 |
|
10873 | node.intersect = function (point) {
|
10874 | return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point);
|
10875 | };
|
10876 |
|
10877 | return shapeSvg;
|
10878 | };
|
10879 |
|
10880 | var roundedWithTitle = function roundedWithTitle(parent, node) {
|
10881 | // Add outer g element
|
10882 | var shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id); // add the rect
|
10883 |
|
10884 | var rect = shapeSvg.insert('rect', ':first-child'); // Create the label and insert it after the rect
|
10885 |
|
10886 | var label = shapeSvg.insert('g').attr('class', 'cluster-label');
|
10887 | var innerRect = shapeSvg.append('rect');
|
10888 | var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true)); // Get the size of the label
|
10889 |
|
10890 | var bbox = text.getBBox();
|
10891 |
|
10892 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels)) {
|
10893 | var div = text.children[0];
|
10894 | var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text);
|
10895 | bbox = div.getBoundingClientRect();
|
10896 | dv.attr('width', bbox.width);
|
10897 | dv.attr('height', bbox.height);
|
10898 | }
|
10899 |
|
10900 | bbox = text.getBBox();
|
10901 | var padding = 0 * node.padding;
|
10902 | var halfPadding = padding / 2;
|
10903 | var width = node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width;
|
10904 |
|
10905 | if (node.width <= bbox.width + node.padding) {
|
10906 | node.diff = (bbox.width + node.padding * 0 - node.width) / 2;
|
10907 | } else {
|
10908 | node.diff = -node.padding / 2;
|
10909 | } // center the rect around its coordinate
|
10910 |
|
10911 |
|
10912 | rect.attr('class', 'outer').attr('x', node.x - width / 2 - halfPadding).attr('y', node.y - node.height / 2 - halfPadding).attr('width', width + padding).attr('height', node.height + padding);
|
10913 | innerRect.attr('class', 'inner').attr('x', node.x - width / 2 - halfPadding).attr('y', node.y - node.height / 2 - halfPadding + bbox.height - 1).attr('width', width + padding).attr('height', node.height + padding - bbox.height - 3); // Center the label
|
10914 |
|
10915 | label.attr('transform', 'translate(' + (node.x - bbox.width / 2) + ', ' + (node.y - node.height / 2 - node.padding / 3 + ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels) ? 5 : 3)) + ')');
|
10916 | var rectBox = rect.node().getBBox();
|
10917 | node.height = rectBox.height;
|
10918 |
|
10919 | node.intersect = function (point) {
|
10920 | return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point);
|
10921 | };
|
10922 |
|
10923 | return shapeSvg;
|
10924 | };
|
10925 |
|
10926 | var divider = function divider(parent, node) {
|
10927 | // Add outer g element
|
10928 | var shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id); // add the rect
|
10929 |
|
10930 | var rect = shapeSvg.insert('rect', ':first-child');
|
10931 | var padding = 0 * node.padding;
|
10932 | var halfPadding = padding / 2; // center the rect around its coordinate
|
10933 |
|
10934 | rect.attr('class', 'divider').attr('x', node.x - node.width / 2 - halfPadding).attr('y', node.y - node.height / 2).attr('width', node.width + padding).attr('height', node.height + padding);
|
10935 | var rectBox = rect.node().getBBox();
|
10936 | node.width = rectBox.width;
|
10937 | node.height = rectBox.height;
|
10938 | node.diff = -node.padding / 2;
|
10939 |
|
10940 | node.intersect = function (point) {
|
10941 | return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point);
|
10942 | };
|
10943 |
|
10944 | return shapeSvg;
|
10945 | };
|
10946 |
|
10947 | var shapes = {
|
10948 | rect: rect,
|
10949 | roundedWithTitle: roundedWithTitle,
|
10950 | noteGroup: noteGroup,
|
10951 | divider: divider
|
10952 | };
|
10953 | var clusterElems = {};
|
10954 | var insertCluster = function insertCluster(elem, node) {
|
10955 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Inserting cluster');
|
10956 | var shape = node.shape || 'rect';
|
10957 | clusterElems[node.id] = shapes[shape](elem, node);
|
10958 | };
|
10959 | var getClusterTitleWidth = function getClusterTitleWidth(elem, node) {
|
10960 | var label = (0,_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true);
|
10961 | elem.node().appendChild(label);
|
10962 | var width = label.getBBox().width;
|
10963 | elem.node().removeChild(label);
|
10964 | return width;
|
10965 | };
|
10966 | var clear = function clear() {
|
10967 | clusterElems = {};
|
10968 | };
|
10969 | var positionCluster = function positionCluster(node) {
|
10970 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Position cluster (' + node.id + ', ' + node.x + ', ' + node.y + ')');
|
10971 | var el = clusterElems[node.id];
|
10972 | el.attr('transform', 'translate(' + node.x + ', ' + node.y + ')');
|
10973 | };
|
10974 |
|
10975 | /***/ }),
|
10976 |
|
10977 | /***/ "./src/dagre-wrapper/createLabel.js":
|
10978 | /*!******************************************!*\
|
10979 | !*** ./src/dagre-wrapper/createLabel.js ***!
|
10980 | \******************************************/
|
10981 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10982 |
|
10983 | "use strict";
|
10984 | __webpack_require__.r(__webpack_exports__);
|
10985 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10986 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
10987 | /* harmony export */ });
|
10988 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
10989 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
10990 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
|
10991 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../config */ "./src/config.js");
|
10992 | /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js");
|
10993 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../mermaidAPI */ "./src/mermaidAPI.js");
|
10994 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
10995 |
|
10996 |
|
10997 | // eslint-disable-line
|
10998 |
|
10999 |
|
11000 |
|
11001 |
|
11002 |
|
11003 | var sanitizeTxt = function sanitizeTxt(txt) {
|
11004 | return (0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.sanitizeText)(txt, (0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)());
|
11005 | };
|
11006 | /**
|
11007 | * @param dom
|
11008 | * @param styleFn
|
11009 | */
|
11010 |
|
11011 |
|
11012 | function applyStyle(dom, styleFn) {
|
11013 | if (styleFn) {
|
11014 | dom.attr('style', styleFn);
|
11015 | }
|
11016 | }
|
11017 | /**
|
11018 | * @param {any} node
|
11019 | * @returns {SVGForeignObjectElement} Node
|
11020 | */
|
11021 |
|
11022 |
|
11023 | function addHtmlLabel(node) {
|
11024 | var fo = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject'));
|
11025 | var div = fo.append('xhtml:div');
|
11026 | var label = node.label;
|
11027 | var labelClass = node.isNode ? 'nodeLabel' : 'edgeLabel';
|
11028 | div.html('<span class="' + labelClass + '" ' + (node.labelStyle ? 'style="' + node.labelStyle + '"' : '') + '>' + label + '</span>');
|
11029 | applyStyle(div, node.labelStyle);
|
11030 | div.style('display', 'inline-block'); // Fix for firefox
|
11031 |
|
11032 | div.style('white-space', 'nowrap');
|
11033 | div.attr('xmlns', 'http://www.w3.org/1999/xhtml');
|
11034 | return fo.node();
|
11035 | }
|
11036 |
|
11037 | var createLabel = function createLabel(_vertexText, style, isTitle, isNode) {
|
11038 | var vertexText = _vertexText || '';
|
11039 | if (_typeof(vertexText) === 'object') vertexText = vertexText[0];
|
11040 |
|
11041 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) {
|
11042 | // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
|
11043 | vertexText = vertexText.replace(/\\n|\n/g, '<br />');
|
11044 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('vertexText' + vertexText);
|
11045 | var node = {
|
11046 | isNode: isNode,
|
11047 | label: (0,_mermaidAPI__WEBPACK_IMPORTED_MODULE_4__.decodeEntities)(vertexText).replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
|
11048 | return "<i class='".concat(s.replace(':', ' '), "'></i>");
|
11049 | }),
|
11050 | labelStyle: style.replace('fill:', 'color:')
|
11051 | };
|
11052 | var vertexNode = addHtmlLabel(node); // vertexNode.parentNode.removeChild(vertexNode);
|
11053 |
|
11054 | return vertexNode;
|
11055 | } else {
|
11056 | var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
11057 | svgLabel.setAttribute('style', style.replace('color:', 'fill:'));
|
11058 | var rows = [];
|
11059 |
|
11060 | if (typeof vertexText === 'string') {
|
11061 | rows = vertexText.split(/\\n|\n|<br\s*\/?>/gi);
|
11062 | } else if (Array.isArray(vertexText)) {
|
11063 | rows = vertexText;
|
11064 | } else {
|
11065 | rows = [];
|
11066 | }
|
11067 |
|
11068 | for (var j = 0; j < rows.length; j++) {
|
11069 | var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
11070 | tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
11071 | tspan.setAttribute('dy', '1em');
|
11072 | tspan.setAttribute('x', '0');
|
11073 |
|
11074 | if (isTitle) {
|
11075 | tspan.setAttribute('class', 'title-row');
|
11076 | } else {
|
11077 | tspan.setAttribute('class', 'row');
|
11078 | }
|
11079 |
|
11080 | tspan.textContent = rows[j].trim();
|
11081 | svgLabel.appendChild(tspan);
|
11082 | }
|
11083 |
|
11084 | return svgLabel;
|
11085 | }
|
11086 | };
|
11087 |
|
11088 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (createLabel);
|
11089 |
|
11090 | /***/ }),
|
11091 |
|
11092 | /***/ "./src/dagre-wrapper/edges.js":
|
11093 | /*!************************************!*\
|
11094 | !*** ./src/dagre-wrapper/edges.js ***!
|
11095 | \************************************/
|
11096 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
11097 |
|
11098 | "use strict";
|
11099 | __webpack_require__.r(__webpack_exports__);
|
11100 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
11101 | /* harmony export */ "clear": () => (/* binding */ clear),
|
11102 | /* harmony export */ "insertEdge": () => (/* binding */ insertEdge),
|
11103 | /* harmony export */ "insertEdgeLabel": () => (/* binding */ insertEdgeLabel),
|
11104 | /* harmony export */ "intersection": () => (/* binding */ intersection),
|
11105 | /* harmony export */ "positionEdgeLabel": () => (/* binding */ positionEdgeLabel)
|
11106 | /* harmony export */ });
|
11107 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
|
11108 | /* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
|
11109 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
11110 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
11111 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../config */ "./src/config.js");
|
11112 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils */ "./src/utils.js");
|
11113 | /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js");
|
11114 | // eslint-disable-line
|
11115 |
|
11116 |
|
11117 |
|
11118 |
|
11119 |
|
11120 |
|
11121 | var edgeLabels = {};
|
11122 | var terminalLabels = {};
|
11123 | var clear = function clear() {
|
11124 | edgeLabels = {};
|
11125 | terminalLabels = {};
|
11126 | };
|
11127 | var insertEdgeLabel = function insertEdgeLabel(elem, edge) {
|
11128 | // Create the actual text element
|
11129 | var labelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.label, edge.labelStyle); // Create outer g, edgeLabel, this will be positioned after graph layout
|
11130 |
|
11131 | var edgeLabel = elem.insert('g').attr('class', 'edgeLabel'); // Create inner g, label, this will be positioned now for centering the text
|
11132 |
|
11133 | var label = edgeLabel.insert('g').attr('class', 'label');
|
11134 | label.node().appendChild(labelElement); // Center the label
|
11135 |
|
11136 | var bbox = labelElement.getBBox();
|
11137 |
|
11138 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().flowchart.htmlLabels)) {
|
11139 | var div = labelElement.children[0];
|
11140 | var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(labelElement);
|
11141 | bbox = div.getBoundingClientRect();
|
11142 | dv.attr('width', bbox.width);
|
11143 | dv.attr('height', bbox.height);
|
11144 | }
|
11145 |
|
11146 | label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')'); // Make element accessible by id for positioning
|
11147 |
|
11148 | edgeLabels[edge.id] = edgeLabel; // Update the abstract data of the edge with the new information about its width and height
|
11149 |
|
11150 | edge.width = bbox.width;
|
11151 | edge.height = bbox.height;
|
11152 | var fo;
|
11153 |
|
11154 | if (edge.startLabelLeft) {
|
11155 | // Create the actual text element
|
11156 | var startLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.startLabelLeft, edge.labelStyle);
|
11157 | var startEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');
|
11158 | var inner = startEdgeLabelLeft.insert('g').attr('class', 'inner');
|
11159 | fo = inner.node().appendChild(startLabelElement);
|
11160 | var slBox = startLabelElement.getBBox();
|
11161 | inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
11162 |
|
11163 | if (!terminalLabels[edge.id]) {
|
11164 | terminalLabels[edge.id] = {};
|
11165 | }
|
11166 |
|
11167 | terminalLabels[edge.id].startLeft = startEdgeLabelLeft;
|
11168 | setTerminalWidth(fo, edge.startLabelLeft);
|
11169 | }
|
11170 |
|
11171 | if (edge.startLabelRight) {
|
11172 | // Create the actual text element
|
11173 | var _startLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.startLabelRight, edge.labelStyle);
|
11174 |
|
11175 | var startEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
|
11176 |
|
11177 | var _inner = startEdgeLabelRight.insert('g').attr('class', 'inner');
|
11178 |
|
11179 | fo = startEdgeLabelRight.node().appendChild(_startLabelElement);
|
11180 |
|
11181 | _inner.node().appendChild(_startLabelElement);
|
11182 |
|
11183 | var _slBox = _startLabelElement.getBBox();
|
11184 |
|
11185 | _inner.attr('transform', 'translate(' + -_slBox.width / 2 + ', ' + -_slBox.height / 2 + ')');
|
11186 |
|
11187 | if (!terminalLabels[edge.id]) {
|
11188 | terminalLabels[edge.id] = {};
|
11189 | }
|
11190 |
|
11191 | terminalLabels[edge.id].startRight = startEdgeLabelRight;
|
11192 | setTerminalWidth(fo, edge.startLabelRight);
|
11193 | }
|
11194 |
|
11195 | if (edge.endLabelLeft) {
|
11196 | // Create the actual text element
|
11197 | var endLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.endLabelLeft, edge.labelStyle);
|
11198 | var endEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');
|
11199 |
|
11200 | var _inner2 = endEdgeLabelLeft.insert('g').attr('class', 'inner');
|
11201 |
|
11202 | fo = _inner2.node().appendChild(endLabelElement);
|
11203 |
|
11204 | var _slBox2 = endLabelElement.getBBox();
|
11205 |
|
11206 | _inner2.attr('transform', 'translate(' + -_slBox2.width / 2 + ', ' + -_slBox2.height / 2 + ')');
|
11207 |
|
11208 | endEdgeLabelLeft.node().appendChild(endLabelElement);
|
11209 |
|
11210 | if (!terminalLabels[edge.id]) {
|
11211 | terminalLabels[edge.id] = {};
|
11212 | }
|
11213 |
|
11214 | terminalLabels[edge.id].endLeft = endEdgeLabelLeft;
|
11215 | setTerminalWidth(fo, edge.endLabelLeft);
|
11216 | }
|
11217 |
|
11218 | if (edge.endLabelRight) {
|
11219 | // Create the actual text element
|
11220 | var _endLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.endLabelRight, edge.labelStyle);
|
11221 |
|
11222 | var endEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
|
11223 |
|
11224 | var _inner3 = endEdgeLabelRight.insert('g').attr('class', 'inner');
|
11225 |
|
11226 | fo = _inner3.node().appendChild(_endLabelElement);
|
11227 |
|
11228 | var _slBox3 = _endLabelElement.getBBox();
|
11229 |
|
11230 | _inner3.attr('transform', 'translate(' + -_slBox3.width / 2 + ', ' + -_slBox3.height / 2 + ')');
|
11231 |
|
11232 | endEdgeLabelRight.node().appendChild(_endLabelElement);
|
11233 |
|
11234 | if (!terminalLabels[edge.id]) {
|
11235 | terminalLabels[edge.id] = {};
|
11236 | }
|
11237 |
|
11238 | terminalLabels[edge.id].endRight = endEdgeLabelRight;
|
11239 | setTerminalWidth(fo, edge.endLabelRight);
|
11240 | }
|
11241 | };
|
11242 | /**
|
11243 | * @param {any} fo
|
11244 | * @param {any} value
|
11245 | */
|
11246 |
|
11247 | function setTerminalWidth(fo, value) {
|
11248 | if ((0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().flowchart.htmlLabels && fo) {
|
11249 | fo.style.width = value.length * 9 + 'px';
|
11250 | fo.style.height = '12px';
|
11251 | }
|
11252 | }
|
11253 |
|
11254 | var positionEdgeLabel = function positionEdgeLabel(edge, paths) {
|
11255 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Moving label abc78 ', edge.id, edge.label, edgeLabels[edge.id]);
|
11256 | var path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
|
11257 |
|
11258 | if (edge.label) {
|
11259 | var el = edgeLabels[edge.id];
|
11260 | var x = edge.x;
|
11261 | var y = edge.y;
|
11262 |
|
11263 | if (path) {
|
11264 | // // debugger;
|
11265 | var pos = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcLabelPosition(path);
|
11266 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Moving label from (', x, ',', y, ') to (', pos.x, ',', pos.y, ') abc78'); // x = pos.x;
|
11267 | // y = pos.y;
|
11268 | }
|
11269 |
|
11270 | el.attr('transform', 'translate(' + x + ', ' + y + ')');
|
11271 | } //let path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
|
11272 |
|
11273 |
|
11274 | if (edge.startLabelLeft) {
|
11275 | var _el = terminalLabels[edge.id].startLeft;
|
11276 | var _x2 = edge.x;
|
11277 | var _y2 = edge.y;
|
11278 |
|
11279 | if (path) {
|
11280 | // debugger;
|
11281 | var _pos = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, 'start_left', path);
|
11282 |
|
11283 | _x2 = _pos.x;
|
11284 | _y2 = _pos.y;
|
11285 | }
|
11286 |
|
11287 | _el.attr('transform', 'translate(' + _x2 + ', ' + _y2 + ')');
|
11288 | }
|
11289 |
|
11290 | if (edge.startLabelRight) {
|
11291 | var _el2 = terminalLabels[edge.id].startRight;
|
11292 | var _x3 = edge.x;
|
11293 | var _y3 = edge.y;
|
11294 |
|
11295 | if (path) {
|
11296 | // debugger;
|
11297 | var _pos2 = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, 'start_right', path);
|
11298 |
|
11299 | _x3 = _pos2.x;
|
11300 | _y3 = _pos2.y;
|
11301 | }
|
11302 |
|
11303 | _el2.attr('transform', 'translate(' + _x3 + ', ' + _y3 + ')');
|
11304 | }
|
11305 |
|
11306 | if (edge.endLabelLeft) {
|
11307 | var _el3 = terminalLabels[edge.id].endLeft;
|
11308 | var _x4 = edge.x;
|
11309 | var _y4 = edge.y;
|
11310 |
|
11311 | if (path) {
|
11312 | // debugger;
|
11313 | var _pos3 = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, 'end_left', path);
|
11314 |
|
11315 | _x4 = _pos3.x;
|
11316 | _y4 = _pos3.y;
|
11317 | }
|
11318 |
|
11319 | _el3.attr('transform', 'translate(' + _x4 + ', ' + _y4 + ')');
|
11320 | }
|
11321 |
|
11322 | if (edge.endLabelRight) {
|
11323 | var _el4 = terminalLabels[edge.id].endRight;
|
11324 | var _x5 = edge.x;
|
11325 | var _y5 = edge.y;
|
11326 |
|
11327 | if (path) {
|
11328 | // debugger;
|
11329 | var _pos4 = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, 'end_right', path);
|
11330 |
|
11331 | _x5 = _pos4.x;
|
11332 | _y5 = _pos4.y;
|
11333 | }
|
11334 |
|
11335 | _el4.attr('transform', 'translate(' + _x5 + ', ' + _y5 + ')');
|
11336 | }
|
11337 | };
|
11338 |
|
11339 | var outsideNode = function outsideNode(node, point) {
|
11340 | // log.warn('Checking bounds ', node, point);
|
11341 | var x = node.x;
|
11342 | var y = node.y;
|
11343 | var dx = Math.abs(point.x - x);
|
11344 | var dy = Math.abs(point.y - y);
|
11345 | var w = node.width / 2;
|
11346 | var h = node.height / 2;
|
11347 |
|
11348 | if (dx >= w || dy >= h) {
|
11349 | return true;
|
11350 | }
|
11351 |
|
11352 | return false;
|
11353 | };
|
11354 |
|
11355 | var intersection = function intersection(node, outsidePoint, insidePoint) {
|
11356 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("intersection calc abc89:\n outsidePoint: ".concat(JSON.stringify(outsidePoint), "\n insidePoint : ").concat(JSON.stringify(insidePoint), "\n node : x:").concat(node.x, " y:").concat(node.y, " w:").concat(node.width, " h:").concat(node.height));
|
11357 | var x = node.x;
|
11358 | var y = node.y;
|
11359 | var dx = Math.abs(x - insidePoint.x); // const dy = Math.abs(y - insidePoint.y);
|
11360 |
|
11361 | var w = node.width / 2;
|
11362 | var r = insidePoint.x < outsidePoint.x ? w - dx : w + dx;
|
11363 | var h = node.height / 2; // const edges = {
|
11364 | // x1: x - w,
|
11365 | // x2: x + w,
|
11366 | // y1: y - h,
|
11367 | // y2: y + h
|
11368 | // };
|
11369 | // if (
|
11370 | // outsidePoint.x === edges.x1 ||
|
11371 | // outsidePoint.x === edges.x2 ||
|
11372 | // outsidePoint.y === edges.y1 ||
|
11373 | // outsidePoint.y === edges.y2
|
11374 | // ) {
|
11375 | // log.warn('abc89 calc equals on edge', outsidePoint, edges);
|
11376 | // return outsidePoint;
|
11377 | // }
|
11378 |
|
11379 | var Q = Math.abs(outsidePoint.y - insidePoint.y);
|
11380 | var R = Math.abs(outsidePoint.x - insidePoint.x); // log.warn();
|
11381 |
|
11382 | if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {
|
11383 | // eslint-disable-line
|
11384 | // Intersection is top or bottom of rect.
|
11385 | // let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
|
11386 | var q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
|
11387 | r = R * q / Q;
|
11388 | var res = {
|
11389 | x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r,
|
11390 | y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q
|
11391 | };
|
11392 |
|
11393 | if (r === 0) {
|
11394 | res.x = outsidePoint.x;
|
11395 | res.y = outsidePoint.y;
|
11396 | }
|
11397 |
|
11398 | if (R === 0) {
|
11399 | res.x = outsidePoint.x;
|
11400 | }
|
11401 |
|
11402 | if (Q === 0) {
|
11403 | res.y = outsidePoint.y;
|
11404 | }
|
11405 |
|
11406 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("abc89 topp/bott calc, Q ".concat(Q, ", q ").concat(q, ", R ").concat(R, ", r ").concat(r), res);
|
11407 | return res;
|
11408 | } else {
|
11409 | // Intersection onn sides of rect
|
11410 | if (insidePoint.x < outsidePoint.x) {
|
11411 | r = outsidePoint.x - w - x;
|
11412 | } else {
|
11413 | // r = outsidePoint.x - w - x;
|
11414 | r = x - w - outsidePoint.x;
|
11415 | }
|
11416 |
|
11417 | var _q = Q * r / R; // OK let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x + dx - w;
|
11418 | // OK let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : outsidePoint.x + r;
|
11419 |
|
11420 |
|
11421 | var _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x - R + r; // let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : outsidePoint.x + r;
|
11422 |
|
11423 |
|
11424 | var _y = insidePoint.y < outsidePoint.y ? insidePoint.y + _q : insidePoint.y - _q;
|
11425 |
|
11426 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("sides calc abc89, Q ".concat(Q, ", q ").concat(_q, ", R ").concat(R, ", r ").concat(r), {
|
11427 | _x: _x,
|
11428 | _y: _y
|
11429 | });
|
11430 |
|
11431 | if (r === 0) {
|
11432 | _x = outsidePoint.x;
|
11433 | _y = outsidePoint.y;
|
11434 | }
|
11435 |
|
11436 | if (R === 0) {
|
11437 | _x = outsidePoint.x;
|
11438 | }
|
11439 |
|
11440 | if (Q === 0) {
|
11441 | _y = outsidePoint.y;
|
11442 | }
|
11443 |
|
11444 | return {
|
11445 | x: _x,
|
11446 | y: _y
|
11447 | };
|
11448 | }
|
11449 | };
|
11450 | /**
|
11451 | * This function will page a path and node where the last point(s) in the path is inside the node
|
11452 | * and return an update path ending by the border of the node.
|
11453 | *
|
11454 | * @param {Array} _points
|
11455 | * @param {any} boundryNode
|
11456 | * @returns {Array} Points
|
11457 | */
|
11458 |
|
11459 | var cutPathAtIntersect = function cutPathAtIntersect(_points, boundryNode) {
|
11460 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 cutPathAtIntersect', _points, boundryNode);
|
11461 | var points = [];
|
11462 | var lastPointOutside = _points[0];
|
11463 | var isInside = false;
|
11464 |
|
11465 | _points.forEach(function (point) {
|
11466 | // const node = clusterDb[edge.toCluster].node;
|
11467 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('abc88 checking point', point, boundryNode); // check if point is inside the boundry rect
|
11468 |
|
11469 | if (!outsideNode(boundryNode, point) && !isInside) {
|
11470 | // First point inside the rect found
|
11471 | // Calc the intersection coord between the point anf the last point outside the rect
|
11472 | var inter = intersection(boundryNode, lastPointOutside, point);
|
11473 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 inside', point, lastPointOutside, inter);
|
11474 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 intersection', inter); // // Check case where the intersection is the same as the last point
|
11475 |
|
11476 | var pointPresent = false;
|
11477 | points.forEach(function (p) {
|
11478 | pointPresent = pointPresent || p.x === inter.x && p.y === inter.y;
|
11479 | }); // // if (!pointPresent) {
|
11480 |
|
11481 | if (!points.find(function (e) {
|
11482 | return e.x === inter.x && e.y === inter.y;
|
11483 | })) {
|
11484 | points.push(inter);
|
11485 | } else {
|
11486 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 no intersect', inter, points);
|
11487 | } // points.push(inter);
|
11488 |
|
11489 |
|
11490 | isInside = true;
|
11491 | } else {
|
11492 | // Outside
|
11493 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 outside', point, lastPointOutside);
|
11494 | lastPointOutside = point; // points.push(point);
|
11495 |
|
11496 | if (!isInside) points.push(point);
|
11497 | }
|
11498 | });
|
11499 |
|
11500 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 returning points', points);
|
11501 | return points;
|
11502 | }; //(edgePaths, e, edge, clusterDb, diagramtype, graph)
|
11503 |
|
11504 |
|
11505 | var insertEdge = function insertEdge(elem, e, edge, clusterDb, diagramType, graph) {
|
11506 | var points = edge.points;
|
11507 | var pointsHasChanged = false;
|
11508 | var tail = graph.node(e.v);
|
11509 | var head = graph.node(e.w);
|
11510 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('abc88 InsertEdge: ', edge);
|
11511 |
|
11512 | if (head.intersect && tail.intersect) {
|
11513 | points = points.slice(1, edge.points.length - 1);
|
11514 | points.unshift(tail.intersect(points[0]));
|
11515 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Last point', points[points.length - 1], head, head.intersect(points[points.length - 1]));
|
11516 | points.push(head.intersect(points[points.length - 1]));
|
11517 | }
|
11518 |
|
11519 | if (edge.toCluster) {
|
11520 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('to cluster abc88', clusterDb[edge.toCluster]);
|
11521 | points = cutPathAtIntersect(edge.points, clusterDb[edge.toCluster].node); // log.trace('edge', edge);
|
11522 | // points = [];
|
11523 | // let lastPointOutside; // = edge.points[0];
|
11524 | // let isInside = false;
|
11525 | // edge.points.forEach(point => {
|
11526 | // const node = clusterDb[edge.toCluster].node;
|
11527 | // log.warn('checking from', edge.fromCluster, point, node);
|
11528 | // if (!outsideNode(node, point) && !isInside) {
|
11529 | // log.trace('inside', edge.toCluster, point, lastPointOutside);
|
11530 | // // First point inside the rect
|
11531 | // const inter = intersection(node, lastPointOutside, point);
|
11532 | // let pointPresent = false;
|
11533 | // points.forEach(p => {
|
11534 | // pointPresent = pointPresent || (p.x === inter.x && p.y === inter.y);
|
11535 | // });
|
11536 | // // if (!pointPresent) {
|
11537 | // if (!points.find(e => e.x === inter.x && e.y === inter.y)) {
|
11538 | // points.push(inter);
|
11539 | // } else {
|
11540 | // log.warn('no intersect', inter, points);
|
11541 | // }
|
11542 | // isInside = true;
|
11543 | // } else {
|
11544 | // // outside
|
11545 | // lastPointOutside = point;
|
11546 | // if (!isInside) points.push(point);
|
11547 | // }
|
11548 | // });
|
11549 |
|
11550 | pointsHasChanged = true;
|
11551 | }
|
11552 |
|
11553 | if (edge.fromCluster) {
|
11554 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('from cluster abc88', clusterDb[edge.fromCluster]);
|
11555 | points = cutPathAtIntersect(points.reverse(), clusterDb[edge.fromCluster].node).reverse();
|
11556 | pointsHasChanged = true;
|
11557 | } // The data for our line
|
11558 |
|
11559 |
|
11560 | var lineData = points.filter(function (p) {
|
11561 | return !Number.isNaN(p.y);
|
11562 | }); // This is the accessor function we talked about above
|
11563 |
|
11564 | var curve; // Currently only flowcharts get the curve from the settings, perhaps this should
|
11565 | // be expanded to a common setting? Restricting it for now in order not to cause side-effects that
|
11566 | // have not been thought through
|
11567 |
|
11568 | if (diagramType === 'graph' || diagramType === 'flowchart') {
|
11569 | curve = edge.curve || d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis;
|
11570 | } else {
|
11571 | curve = d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis;
|
11572 | } // curve = curveLinear;
|
11573 |
|
11574 |
|
11575 | var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) {
|
11576 | return d.x;
|
11577 | }).y(function (d) {
|
11578 | return d.y;
|
11579 | }).curve(curve); // Contruct stroke classes based on properties
|
11580 |
|
11581 | var strokeClasses;
|
11582 |
|
11583 | switch (edge.thickness) {
|
11584 | case 'normal':
|
11585 | strokeClasses = 'edge-thickness-normal';
|
11586 | break;
|
11587 |
|
11588 | case 'thick':
|
11589 | strokeClasses = 'edge-thickness-thick';
|
11590 | break;
|
11591 |
|
11592 | default:
|
11593 | strokeClasses = '';
|
11594 | }
|
11595 |
|
11596 | switch (edge.pattern) {
|
11597 | case 'solid':
|
11598 | strokeClasses += ' edge-pattern-solid';
|
11599 | break;
|
11600 |
|
11601 | case 'dotted':
|
11602 | strokeClasses += ' edge-pattern-dotted';
|
11603 | break;
|
11604 |
|
11605 | case 'dashed':
|
11606 | strokeClasses += ' edge-pattern-dashed';
|
11607 | break;
|
11608 | }
|
11609 |
|
11610 | var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', edge.id).attr('class', ' ' + strokeClasses + (edge.classes ? ' ' + edge.classes : '')).attr('style', edge.style); // DEBUG code, adds a red circle at each edge coordinate
|
11611 | // edge.points.forEach(point => {
|
11612 | // elem
|
11613 | // .append('circle')
|
11614 | // .style('stroke', 'red')
|
11615 | // .style('fill', 'red')
|
11616 | // .attr('r', 1)
|
11617 | // .attr('cx', point.x)
|
11618 | // .attr('cy', point.y);
|
11619 | // });
|
11620 |
|
11621 | var url = '';
|
11622 |
|
11623 | if ((0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().state.arrowMarkerAbsolute) {
|
11624 | url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
|
11625 | url = url.replace(/\(/g, '\\(');
|
11626 | url = url.replace(/\)/g, '\\)');
|
11627 | }
|
11628 |
|
11629 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('arrowTypeStart', edge.arrowTypeStart);
|
11630 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('arrowTypeEnd', edge.arrowTypeEnd);
|
11631 |
|
11632 | switch (edge.arrowTypeStart) {
|
11633 | case 'arrow_cross':
|
11634 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-crossStart' + ')');
|
11635 | break;
|
11636 |
|
11637 | case 'arrow_point':
|
11638 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-pointStart' + ')');
|
11639 | break;
|
11640 |
|
11641 | case 'arrow_barb':
|
11642 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-barbStart' + ')');
|
11643 | break;
|
11644 |
|
11645 | case 'arrow_circle':
|
11646 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-circleStart' + ')');
|
11647 | break;
|
11648 |
|
11649 | case 'aggregation':
|
11650 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-aggregationStart' + ')');
|
11651 | break;
|
11652 |
|
11653 | case 'extension':
|
11654 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-extensionStart' + ')');
|
11655 | break;
|
11656 |
|
11657 | case 'composition':
|
11658 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-compositionStart' + ')');
|
11659 | break;
|
11660 |
|
11661 | case 'dependency':
|
11662 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-dependencyStart' + ')');
|
11663 | break;
|
11664 |
|
11665 | default:
|
11666 | }
|
11667 |
|
11668 | switch (edge.arrowTypeEnd) {
|
11669 | case 'arrow_cross':
|
11670 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-crossEnd' + ')');
|
11671 | break;
|
11672 |
|
11673 | case 'arrow_point':
|
11674 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-pointEnd' + ')');
|
11675 | break;
|
11676 |
|
11677 | case 'arrow_barb':
|
11678 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-barbEnd' + ')');
|
11679 | break;
|
11680 |
|
11681 | case 'arrow_circle':
|
11682 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-circleEnd' + ')');
|
11683 | break;
|
11684 |
|
11685 | case 'aggregation':
|
11686 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-aggregationEnd' + ')');
|
11687 | break;
|
11688 |
|
11689 | case 'extension':
|
11690 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-extensionEnd' + ')');
|
11691 | break;
|
11692 |
|
11693 | case 'composition':
|
11694 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-compositionEnd' + ')');
|
11695 | break;
|
11696 |
|
11697 | case 'dependency':
|
11698 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-dependencyEnd' + ')');
|
11699 | break;
|
11700 |
|
11701 | default:
|
11702 | }
|
11703 |
|
11704 | var paths = {};
|
11705 |
|
11706 | if (pointsHasChanged) {
|
11707 | paths.updatedPath = points;
|
11708 | }
|
11709 |
|
11710 | paths.originalPath = edge.points;
|
11711 | return paths;
|
11712 | };
|
11713 |
|
11714 | /***/ }),
|
11715 |
|
11716 | /***/ "./src/dagre-wrapper/index.js":
|
11717 | /*!************************************!*\
|
11718 | !*** ./src/dagre-wrapper/index.js ***!
|
11719 | \************************************/
|
11720 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
11721 |
|
11722 | "use strict";
|
11723 | __webpack_require__.r(__webpack_exports__);
|
11724 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
11725 | /* harmony export */ "render": () => (/* binding */ render)
|
11726 | /* harmony export */ });
|
11727 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dagre */ "dagre");
|
11728 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_0__);
|
11729 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphlib */ "graphlib");
|
11730 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_1__);
|
11731 | /* harmony import */ var _markers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./markers */ "./src/dagre-wrapper/markers.js");
|
11732 | /* harmony import */ var _shapes_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shapes/util */ "./src/dagre-wrapper/shapes/util.js");
|
11733 | /* harmony import */ var _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./mermaid-graphlib */ "./src/dagre-wrapper/mermaid-graphlib.js");
|
11734 | /* harmony import */ var _nodes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./nodes */ "./src/dagre-wrapper/nodes.js");
|
11735 | /* harmony import */ var _clusters__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./clusters */ "./src/dagre-wrapper/clusters.js");
|
11736 | /* harmony import */ var _edges__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./edges */ "./src/dagre-wrapper/edges.js");
|
11737 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
|
11738 |
|
11739 |
|
11740 |
|
11741 |
|
11742 |
|
11743 |
|
11744 |
|
11745 |
|
11746 |
|
11747 |
|
11748 | var recursiveRender = function recursiveRender(_elem, graph, diagramtype, parentCluster) {
|
11749 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Graph in recursive render: XXX', graphlib__WEBPACK_IMPORTED_MODULE_1___default().json.write(graph), parentCluster);
|
11750 | var dir = graph.graph().rankdir;
|
11751 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Dir in recursive render - dir:', dir);
|
11752 |
|
11753 | var elem = _elem.insert('g').attr('class', 'root'); // eslint-disable-line
|
11754 |
|
11755 |
|
11756 | if (!graph.nodes()) {
|
11757 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('No nodes found for', graph);
|
11758 | } else {
|
11759 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Recursive render XXX', graph.nodes());
|
11760 | }
|
11761 |
|
11762 | if (graph.edges().length > 0) {
|
11763 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Recursive edges', graph.edge(graph.edges()[0]));
|
11764 | }
|
11765 |
|
11766 | var clusters = elem.insert('g').attr('class', 'clusters'); // eslint-disable-line
|
11767 |
|
11768 | var edgePaths = elem.insert('g').attr('class', 'edgePaths');
|
11769 | var edgeLabels = elem.insert('g').attr('class', 'edgeLabels');
|
11770 | var nodes = elem.insert('g').attr('class', 'nodes'); // Insert nodes, this will insert them into the dom and each node will get a size. The size is updated
|
11771 | // to the abstract node and is later used by dagre for the layout
|
11772 |
|
11773 | graph.nodes().forEach(function (v) {
|
11774 | var node = graph.node(v);
|
11775 |
|
11776 | if (typeof parentCluster !== 'undefined') {
|
11777 | var data = JSON.parse(JSON.stringify(parentCluster.clusterData)); // data.clusterPositioning = true;
|
11778 |
|
11779 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Setting data for cluster XXX (', v, ') ', data, parentCluster);
|
11780 | graph.setNode(parentCluster.id, data);
|
11781 |
|
11782 | if (!graph.parent(v)) {
|
11783 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Setting parent', v, parentCluster.id);
|
11784 | graph.setParent(v, parentCluster.id, data);
|
11785 | }
|
11786 | }
|
11787 |
|
11788 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('(Insert) Node XXX' + v + ': ' + JSON.stringify(graph.node(v)));
|
11789 |
|
11790 | if (node && node.clusterNode) {
|
11791 | // const children = graph.children(v);
|
11792 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Cluster identified', v, node.width, graph.node(v));
|
11793 | var o = recursiveRender(nodes, node.graph, diagramtype, graph.node(v));
|
11794 | var newEl = o.elem;
|
11795 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, newEl);
|
11796 | node.diff = o.diff || 0;
|
11797 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Node bounds (abc123)', v, node, node.width, node.x, node.y);
|
11798 | (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.setNodeElem)(newEl, node);
|
11799 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.warn('Recursive render complete ', newEl, node);
|
11800 | } else {
|
11801 | if (graph.children(v).length > 0) {
|
11802 | // This is a cluster but not to be rendered recursively
|
11803 | // Render as before
|
11804 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Cluster - the non recursive path XXX', v, node.id, node, graph);
|
11805 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info((0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.findNonClusterChild)(node.id, graph));
|
11806 | _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb[node.id] = {
|
11807 | id: (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.findNonClusterChild)(node.id, graph),
|
11808 | node: node
|
11809 | }; // insertCluster(clusters, graph.node(v));
|
11810 | } else {
|
11811 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Node - the non recursive path', v, node.id, node);
|
11812 | (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.insertNode)(nodes, graph.node(v), dir);
|
11813 | }
|
11814 | }
|
11815 | }); // Insert labels, this will insert them into the dom so that the width can be calculated
|
11816 | // Also figure out which edges point to/from clusters and adjust them accordingly
|
11817 | // Edges from/to clusters really points to the first child in the cluster.
|
11818 | // TODO: pick optimal child in the cluster to us as link anchor
|
11819 |
|
11820 | graph.edges().forEach(function (e) {
|
11821 | var edge = graph.edge(e.v, e.w, e.name);
|
11822 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
|
11823 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ', e, ' ', JSON.stringify(graph.edge(e))); // Check if link is either from or to a cluster
|
11824 |
|
11825 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Fix', _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb, 'ids:', e.v, e.w, 'Translateing: ', _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb[e.v], _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb[e.w]);
|
11826 | (0,_edges__WEBPACK_IMPORTED_MODULE_6__.insertEdgeLabel)(edgeLabels, edge);
|
11827 | });
|
11828 | graph.edges().forEach(function (e) {
|
11829 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
|
11830 | });
|
11831 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('#############################################');
|
11832 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('### Layout ###');
|
11833 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('#############################################');
|
11834 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info(graph);
|
11835 | dagre__WEBPACK_IMPORTED_MODULE_0___default().layout(graph);
|
11836 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Graph after layout:', graphlib__WEBPACK_IMPORTED_MODULE_1___default().json.write(graph)); // Move the nodes to the correct place
|
11837 |
|
11838 | var diff = 0;
|
11839 | (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.sortNodesByHierarchy)(graph).forEach(function (v) {
|
11840 | var node = graph.node(v);
|
11841 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Position ' + v + ': ' + JSON.stringify(graph.node(v)));
|
11842 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Position ' + v + ': (' + node.x, ',' + node.y, ') width: ', node.width, ' height: ', node.height);
|
11843 |
|
11844 | if (node && node.clusterNode) {
|
11845 | // clusterDb[node.id].node = node;
|
11846 | (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.positionNode)(node);
|
11847 | } else {
|
11848 | // Non cluster node
|
11849 | if (graph.children(v).length > 0) {
|
11850 | // A cluster in the non-recursive way
|
11851 | // positionCluster(node);
|
11852 | (0,_clusters__WEBPACK_IMPORTED_MODULE_7__.insertCluster)(clusters, node);
|
11853 | _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb[node.id].node = node;
|
11854 | } else {
|
11855 | (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.positionNode)(node);
|
11856 | }
|
11857 | }
|
11858 | }); // Move the edge labels to the correct place after layout
|
11859 |
|
11860 | graph.edges().forEach(function (e) {
|
11861 | var edge = graph.edge(e);
|
11862 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(edge), edge);
|
11863 | var paths = (0,_edges__WEBPACK_IMPORTED_MODULE_6__.insertEdge)(edgePaths, e, edge, _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb, diagramtype, graph);
|
11864 | (0,_edges__WEBPACK_IMPORTED_MODULE_6__.positionEdgeLabel)(edge, paths);
|
11865 | });
|
11866 | graph.nodes().forEach(function (v) {
|
11867 | var n = graph.node(v);
|
11868 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info(v, n.type, n.diff);
|
11869 |
|
11870 | if (n.type === 'group') {
|
11871 | diff = n.diff;
|
11872 | }
|
11873 | });
|
11874 | return {
|
11875 | elem: elem,
|
11876 | diff: diff
|
11877 | };
|
11878 | };
|
11879 |
|
11880 | var render = function render(elem, graph, markers, diagramtype, id) {
|
11881 | (0,_markers__WEBPACK_IMPORTED_MODULE_8__["default"])(elem, markers, diagramtype, id);
|
11882 | (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.clear)();
|
11883 | (0,_edges__WEBPACK_IMPORTED_MODULE_6__.clear)();
|
11884 | (0,_clusters__WEBPACK_IMPORTED_MODULE_7__.clear)();
|
11885 | (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clear)();
|
11886 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.warn('Graph at first:', graphlib__WEBPACK_IMPORTED_MODULE_1___default().json.write(graph));
|
11887 | (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.adjustClustersAndEdges)(graph);
|
11888 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.warn('Graph after:', graphlib__WEBPACK_IMPORTED_MODULE_1___default().json.write(graph)); // log.warn('Graph ever after:', graphlib.json.write(graph.node('A').graph));
|
11889 |
|
11890 | recursiveRender(elem, graph, diagramtype);
|
11891 | }; // const shapeDefinitions = {};
|
11892 | // export const addShape = ({ shapeType: fun }) => {
|
11893 | // shapeDefinitions[shapeType] = fun;
|
11894 | // };
|
11895 | // const arrowDefinitions = {};
|
11896 | // export const addArrow = ({ arrowType: fun }) => {
|
11897 | // arrowDefinitions[arrowType] = fun;
|
11898 | // };
|
11899 |
|
11900 | /***/ }),
|
11901 |
|
11902 | /***/ "./src/dagre-wrapper/intersect/index.js":
|
11903 | /*!**********************************************!*\
|
11904 | !*** ./src/dagre-wrapper/intersect/index.js ***!
|
11905 | \**********************************************/
|
11906 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
11907 |
|
11908 | "use strict";
|
11909 | __webpack_require__.r(__webpack_exports__);
|
11910 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
11911 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
11912 | /* harmony export */ });
|
11913 | /* harmony import */ var _intersect_node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-node.js */ "./src/dagre-wrapper/intersect/intersect-node.js");
|
11914 | /* harmony import */ var _intersect_node_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_intersect_node_js__WEBPACK_IMPORTED_MODULE_0__);
|
11915 | /* harmony import */ var _intersect_circle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./intersect-circle.js */ "./src/dagre-wrapper/intersect/intersect-circle.js");
|
11916 | /* harmony import */ var _intersect_ellipse_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./intersect-ellipse.js */ "./src/dagre-wrapper/intersect/intersect-ellipse.js");
|
11917 | /* harmony import */ var _intersect_polygon_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./intersect-polygon.js */ "./src/dagre-wrapper/intersect/intersect-polygon.js");
|
11918 | /* harmony import */ var _intersect_rect_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./intersect-rect.js */ "./src/dagre-wrapper/intersect/intersect-rect.js");
|
11919 | /*
|
11920 | * Borrowed with love from from dagrge-d3. Many thanks to cpettitt!
|
11921 | */
|
11922 |
|
11923 |
|
11924 |
|
11925 |
|
11926 |
|
11927 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
11928 | node: (_intersect_node_js__WEBPACK_IMPORTED_MODULE_0___default()),
|
11929 | circle: _intersect_circle_js__WEBPACK_IMPORTED_MODULE_1__["default"],
|
11930 | ellipse: _intersect_ellipse_js__WEBPACK_IMPORTED_MODULE_2__["default"],
|
11931 | polygon: _intersect_polygon_js__WEBPACK_IMPORTED_MODULE_3__["default"],
|
11932 | rect: _intersect_rect_js__WEBPACK_IMPORTED_MODULE_4__["default"]
|
11933 | });
|
11934 |
|
11935 | /***/ }),
|
11936 |
|
11937 | /***/ "./src/dagre-wrapper/intersect/intersect-circle.js":
|
11938 | /*!*********************************************************!*\
|
11939 | !*** ./src/dagre-wrapper/intersect/intersect-circle.js ***!
|
11940 | \*********************************************************/
|
11941 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
11942 |
|
11943 | "use strict";
|
11944 | __webpack_require__.r(__webpack_exports__);
|
11945 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
11946 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
11947 | /* harmony export */ });
|
11948 | /* harmony import */ var _intersect_ellipse__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-ellipse */ "./src/dagre-wrapper/intersect/intersect-ellipse.js");
|
11949 |
|
11950 | /**
|
11951 | * @param node
|
11952 | * @param rx
|
11953 | * @param point
|
11954 | */
|
11955 |
|
11956 | function intersectCircle(node, rx, point) {
|
11957 | return (0,_intersect_ellipse__WEBPACK_IMPORTED_MODULE_0__["default"])(node, rx, rx, point);
|
11958 | }
|
11959 |
|
11960 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectCircle);
|
11961 |
|
11962 | /***/ }),
|
11963 |
|
11964 | /***/ "./src/dagre-wrapper/intersect/intersect-ellipse.js":
|
11965 | /*!**********************************************************!*\
|
11966 | !*** ./src/dagre-wrapper/intersect/intersect-ellipse.js ***!
|
11967 | \**********************************************************/
|
11968 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
11969 |
|
11970 | "use strict";
|
11971 | __webpack_require__.r(__webpack_exports__);
|
11972 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
11973 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
11974 | /* harmony export */ });
|
11975 | /**
|
11976 | * @param node
|
11977 | * @param rx
|
11978 | * @param ry
|
11979 | * @param point
|
11980 | */
|
11981 | function intersectEllipse(node, rx, ry, point) {
|
11982 | // Formulae from: https://mathworld.wolfram.com/Ellipse-LineIntersection.html
|
11983 | var cx = node.x;
|
11984 | var cy = node.y;
|
11985 | var px = cx - point.x;
|
11986 | var py = cy - point.y;
|
11987 | var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
|
11988 | var dx = Math.abs(rx * ry * px / det);
|
11989 |
|
11990 | if (point.x < cx) {
|
11991 | dx = -dx;
|
11992 | }
|
11993 |
|
11994 | var dy = Math.abs(rx * ry * py / det);
|
11995 |
|
11996 | if (point.y < cy) {
|
11997 | dy = -dy;
|
11998 | }
|
11999 |
|
12000 | return {
|
12001 | x: cx + dx,
|
12002 | y: cy + dy
|
12003 | };
|
12004 | }
|
12005 |
|
12006 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectEllipse);
|
12007 |
|
12008 | /***/ }),
|
12009 |
|
12010 | /***/ "./src/dagre-wrapper/intersect/intersect-line.js":
|
12011 | /*!*******************************************************!*\
|
12012 | !*** ./src/dagre-wrapper/intersect/intersect-line.js ***!
|
12013 | \*******************************************************/
|
12014 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
12015 |
|
12016 | "use strict";
|
12017 | __webpack_require__.r(__webpack_exports__);
|
12018 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
12019 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
12020 | /* harmony export */ });
|
12021 | /**
|
12022 | * Returns the point at which two lines, p and q, intersect or returns undefined if they do not intersect.
|
12023 | *
|
12024 | * @param p1
|
12025 | * @param p2
|
12026 | * @param q1
|
12027 | * @param q2
|
12028 | */
|
12029 | function intersectLine(p1, p2, q1, q2) {
|
12030 | // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,
|
12031 | // p7 and p473.
|
12032 | var a1, a2, b1, b2, c1, c2;
|
12033 | var r1, r2, r3, r4;
|
12034 | var denom, offset, num;
|
12035 | var x, y; // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +
|
12036 | // b1 y + c1 = 0.
|
12037 |
|
12038 | a1 = p2.y - p1.y;
|
12039 | b1 = p1.x - p2.x;
|
12040 | c1 = p2.x * p1.y - p1.x * p2.y; // Compute r3 and r4.
|
12041 |
|
12042 | r3 = a1 * q1.x + b1 * q1.y + c1;
|
12043 | r4 = a1 * q2.x + b1 * q2.y + c1; // Check signs of r3 and r4. If both point 3 and point 4 lie on
|
12044 | // same side of line 1, the line segments do not intersect.
|
12045 |
|
12046 | if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
|
12047 | return;
|
12048 | } // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0
|
12049 |
|
12050 |
|
12051 | a2 = q2.y - q1.y;
|
12052 | b2 = q1.x - q2.x;
|
12053 | c2 = q2.x * q1.y - q1.x * q2.y; // Compute r1 and r2
|
12054 |
|
12055 | r1 = a2 * p1.x + b2 * p1.y + c2;
|
12056 | r2 = a2 * p2.x + b2 * p2.y + c2; // Check signs of r1 and r2. If both point 1 and point 2 lie
|
12057 | // on same side of second line segment, the line segments do
|
12058 | // not intersect.
|
12059 |
|
12060 | if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {
|
12061 | return;
|
12062 | } // Line segments intersect: compute intersection point.
|
12063 |
|
12064 |
|
12065 | denom = a1 * b2 - a2 * b1;
|
12066 |
|
12067 | if (denom === 0) {
|
12068 | return;
|
12069 | }
|
12070 |
|
12071 | offset = Math.abs(denom / 2); // The denom/2 is to get rounding instead of truncating. It
|
12072 | // is added or subtracted to the numerator, depending upon the
|
12073 | // sign of the numerator.
|
12074 |
|
12075 | num = b1 * c2 - b2 * c1;
|
12076 | x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
|
12077 | num = a2 * c1 - a1 * c2;
|
12078 | y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
|
12079 | return {
|
12080 | x: x,
|
12081 | y: y
|
12082 | };
|
12083 | }
|
12084 | /**
|
12085 | * @param r1
|
12086 | * @param r2
|
12087 | */
|
12088 |
|
12089 |
|
12090 | function sameSign(r1, r2) {
|
12091 | return r1 * r2 > 0;
|
12092 | }
|
12093 |
|
12094 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectLine);
|
12095 |
|
12096 | /***/ }),
|
12097 |
|
12098 | /***/ "./src/dagre-wrapper/intersect/intersect-node.js":
|
12099 | /*!*******************************************************!*\
|
12100 | !*** ./src/dagre-wrapper/intersect/intersect-node.js ***!
|
12101 | \*******************************************************/
|
12102 | /***/ ((module) => {
|
12103 |
|
12104 | module.exports = intersectNode;
|
12105 | /**
|
12106 | * @param node
|
12107 | * @param point
|
12108 | */
|
12109 |
|
12110 | function intersectNode(node, point) {
|
12111 | // console.info('Intersect Node');
|
12112 | return node.intersect(point);
|
12113 | }
|
12114 |
|
12115 | /***/ }),
|
12116 |
|
12117 | /***/ "./src/dagre-wrapper/intersect/intersect-polygon.js":
|
12118 | /*!**********************************************************!*\
|
12119 | !*** ./src/dagre-wrapper/intersect/intersect-polygon.js ***!
|
12120 | \**********************************************************/
|
12121 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
12122 |
|
12123 | "use strict";
|
12124 | __webpack_require__.r(__webpack_exports__);
|
12125 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
12126 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
12127 | /* harmony export */ });
|
12128 | /* harmony import */ var _intersect_line__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-line */ "./src/dagre-wrapper/intersect/intersect-line.js");
|
12129 | /* eslint "no-console": off */
|
12130 |
|
12131 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectPolygon);
|
12132 | /**
|
12133 | * Returns the point ({x, y}) at which the point argument intersects with the node argument assuming
|
12134 | * that it has the shape specified by polygon.
|
12135 | *
|
12136 | * @param node
|
12137 | * @param polyPoints
|
12138 | * @param point
|
12139 | */
|
12140 |
|
12141 | function intersectPolygon(node, polyPoints, point) {
|
12142 | var x1 = node.x;
|
12143 | var y1 = node.y;
|
12144 | var intersections = [];
|
12145 | var minX = Number.POSITIVE_INFINITY;
|
12146 | var minY = Number.POSITIVE_INFINITY;
|
12147 |
|
12148 | if (typeof polyPoints.forEach === 'function') {
|
12149 | polyPoints.forEach(function (entry) {
|
12150 | minX = Math.min(minX, entry.x);
|
12151 | minY = Math.min(minY, entry.y);
|
12152 | });
|
12153 | } else {
|
12154 | minX = Math.min(minX, polyPoints.x);
|
12155 | minY = Math.min(minY, polyPoints.y);
|
12156 | }
|
12157 |
|
12158 | var left = x1 - node.width / 2 - minX;
|
12159 | var top = y1 - node.height / 2 - minY;
|
12160 |
|
12161 | for (var i = 0; i < polyPoints.length; i++) {
|
12162 | var p1 = polyPoints[i];
|
12163 | var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
|
12164 | var intersect = (0,_intersect_line__WEBPACK_IMPORTED_MODULE_0__["default"])(node, point, {
|
12165 | x: left + p1.x,
|
12166 | y: top + p1.y
|
12167 | }, {
|
12168 | x: left + p2.x,
|
12169 | y: top + p2.y
|
12170 | });
|
12171 |
|
12172 | if (intersect) {
|
12173 | intersections.push(intersect);
|
12174 | }
|
12175 | }
|
12176 |
|
12177 | if (!intersections.length) {
|
12178 | // console.log('NO INTERSECTION FOUND, RETURN NODE CENTER', node);
|
12179 | return node;
|
12180 | }
|
12181 |
|
12182 | if (intersections.length > 1) {
|
12183 | // More intersections, find the one nearest to edge end point
|
12184 | intersections.sort(function (p, q) {
|
12185 | var pdx = p.x - point.x;
|
12186 | var pdy = p.y - point.y;
|
12187 | var distp = Math.sqrt(pdx * pdx + pdy * pdy);
|
12188 | var qdx = q.x - point.x;
|
12189 | var qdy = q.y - point.y;
|
12190 | var distq = Math.sqrt(qdx * qdx + qdy * qdy);
|
12191 | return distp < distq ? -1 : distp === distq ? 0 : 1;
|
12192 | });
|
12193 | }
|
12194 |
|
12195 | return intersections[0];
|
12196 | }
|
12197 |
|
12198 | /***/ }),
|
12199 |
|
12200 | /***/ "./src/dagre-wrapper/intersect/intersect-rect.js":
|
12201 | /*!*******************************************************!*\
|
12202 | !*** ./src/dagre-wrapper/intersect/intersect-rect.js ***!
|
12203 | \*******************************************************/
|
12204 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
12205 |
|
12206 | "use strict";
|
12207 | __webpack_require__.r(__webpack_exports__);
|
12208 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
12209 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
12210 | /* harmony export */ });
|
12211 | var intersectRect = function intersectRect(node, point) {
|
12212 | var x = node.x;
|
12213 | var y = node.y; // Rectangle intersection algorithm from:
|
12214 | // https://math.stackexchange.com/questions/108113/find-edge-between-two-boxes
|
12215 |
|
12216 | var dx = point.x - x;
|
12217 | var dy = point.y - y;
|
12218 | var w = node.width / 2;
|
12219 | var h = node.height / 2;
|
12220 | var sx, sy;
|
12221 |
|
12222 | if (Math.abs(dy) * w > Math.abs(dx) * h) {
|
12223 | // Intersection is top or bottom of rect.
|
12224 | if (dy < 0) {
|
12225 | h = -h;
|
12226 | }
|
12227 |
|
12228 | sx = dy === 0 ? 0 : h * dx / dy;
|
12229 | sy = h;
|
12230 | } else {
|
12231 | // Intersection is left or right of rect.
|
12232 | if (dx < 0) {
|
12233 | w = -w;
|
12234 | }
|
12235 |
|
12236 | sx = w;
|
12237 | sy = dx === 0 ? 0 : w * dy / dx;
|
12238 | }
|
12239 |
|
12240 | return {
|
12241 | x: x + sx,
|
12242 | y: y + sy
|
12243 | };
|
12244 | };
|
12245 |
|
12246 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectRect);
|
12247 |
|
12248 | /***/ }),
|
12249 |
|
12250 | /***/ "./src/dagre-wrapper/markers.js":
|
12251 | /*!**************************************!*\
|
12252 | !*** ./src/dagre-wrapper/markers.js ***!
|
12253 | \**************************************/
|
12254 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
12255 |
|
12256 | "use strict";
|
12257 | __webpack_require__.r(__webpack_exports__);
|
12258 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
12259 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
12260 | /* harmony export */ });
|
12261 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
|
12262 | /** Setup arrow head and define the marker. The result is appended to the svg. */
|
12263 | // Only add the number of markers that the diagram needs
|
12264 |
|
12265 | var insertMarkers = function insertMarkers(elem, markerArray, type, id) {
|
12266 | markerArray.forEach(function (markerName) {
|
12267 | markers[markerName](elem, type, id);
|
12268 | });
|
12269 | };
|
12270 |
|
12271 | var extension = function extension(elem, type, id) {
|
12272 | _logger__WEBPACK_IMPORTED_MODULE_0__.log.trace('Making markers for ', id);
|
12273 | elem.append('defs').append('marker').attr('id', type + '-extensionStart').attr('class', 'marker extension ' + type).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');
|
12274 | elem.append('defs').append('marker').attr('id', type + '-extensionEnd').attr('class', 'marker extension ' + type).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'); // this is actual shape for arrowhead
|
12275 | };
|
12276 |
|
12277 | var composition = function composition(elem, type) {
|
12278 | elem.append('defs').append('marker').attr('id', type + '-compositionStart').attr('class', 'marker composition ' + type).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');
|
12279 | elem.append('defs').append('marker').attr('id', type + '-compositionEnd').attr('class', 'marker composition ' + type).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');
|
12280 | };
|
12281 |
|
12282 | var aggregation = function aggregation(elem, type) {
|
12283 | elem.append('defs').append('marker').attr('id', type + '-aggregationStart').attr('class', 'marker aggregation ' + type).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');
|
12284 | elem.append('defs').append('marker').attr('id', type + '-aggregationEnd').attr('class', 'marker aggregation ' + type).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');
|
12285 | };
|
12286 |
|
12287 | var dependency = function dependency(elem, type) {
|
12288 | elem.append('defs').append('marker').attr('id', type + '-dependencyStart').attr('class', 'marker dependency ' + type).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');
|
12289 | elem.append('defs').append('marker').attr('id', type + '-dependencyEnd').attr('class', 'marker dependency ' + type).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');
|
12290 | };
|
12291 |
|
12292 | var point = function point(elem, type) {
|
12293 | elem.append('marker').attr('id', type + '-pointEnd').attr('class', 'marker ' + type).attr('viewBox', '0 0 10 10').attr('refX', 9).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 12).attr('markerHeight', 12).attr('orient', 'auto').append('path').attr('d', 'M 0 0 L 10 5 L 0 10 z').attr('class', 'arrowMarkerPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
|
12294 | elem.append('marker').attr('id', type + '-pointStart').attr('class', 'marker ' + type).attr('viewBox', '0 0 10 10').attr('refX', 0).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 12).attr('markerHeight', 12).attr('orient', 'auto').append('path').attr('d', 'M 0 5 L 10 10 L 10 0 z').attr('class', 'arrowMarkerPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
|
12295 | };
|
12296 |
|
12297 | var circle = function circle(elem, type) {
|
12298 | elem.append('marker').attr('id', type + '-circleEnd').attr('class', 'marker ' + type).attr('viewBox', '0 0 10 10').attr('refX', 11).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 11).attr('markerHeight', 11).attr('orient', 'auto').append('circle').attr('cx', '5').attr('cy', '5').attr('r', '5').attr('class', 'arrowMarkerPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
|
12299 | elem.append('marker').attr('id', type + '-circleStart').attr('class', 'marker ' + type).attr('viewBox', '0 0 10 10').attr('refX', -1).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 11).attr('markerHeight', 11).attr('orient', 'auto').append('circle').attr('cx', '5').attr('cy', '5').attr('r', '5').attr('class', 'arrowMarkerPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
|
12300 | };
|
12301 |
|
12302 | var cross = function cross(elem, type) {
|
12303 | elem.append('marker').attr('id', type + '-crossEnd').attr('class', 'marker cross ' + type).attr('viewBox', '0 0 11 11').attr('refX', 12).attr('refY', 5.2).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 11).attr('markerHeight', 11).attr('orient', 'auto').append('path') // .attr('stroke', 'black')
|
12304 | .attr('d', 'M 1,1 l 9,9 M 10,1 l -9,9').attr('class', 'arrowMarkerPath').style('stroke-width', 2).style('stroke-dasharray', '1,0');
|
12305 | elem.append('marker').attr('id', type + '-crossStart').attr('class', 'marker cross ' + type).attr('viewBox', '0 0 11 11').attr('refX', -1).attr('refY', 5.2).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 11).attr('markerHeight', 11).attr('orient', 'auto').append('path') // .attr('stroke', 'black')
|
12306 | .attr('d', 'M 1,1 l 9,9 M 10,1 l -9,9').attr('class', 'arrowMarkerPath').style('stroke-width', 2).style('stroke-dasharray', '1,0');
|
12307 | };
|
12308 |
|
12309 | var barb = function barb(elem, type) {
|
12310 | elem.append('defs').append('marker').attr('id', type + '-barbEnd').attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 14).attr('markerUnits', 'strokeWidth').attr('orient', 'auto').append('path').attr('d', 'M 19,7 L9,13 L14,7 L9,1 Z');
|
12311 | }; // TODO rename the class diagram markers to something shape descriptive and semantic free
|
12312 |
|
12313 |
|
12314 | var markers = {
|
12315 | extension: extension,
|
12316 | composition: composition,
|
12317 | aggregation: aggregation,
|
12318 | dependency: dependency,
|
12319 | point: point,
|
12320 | circle: circle,
|
12321 | cross: cross,
|
12322 | barb: barb
|
12323 | };
|
12324 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (insertMarkers);
|
12325 |
|
12326 | /***/ }),
|
12327 |
|
12328 | /***/ "./src/dagre-wrapper/mermaid-graphlib.js":
|
12329 | /*!***********************************************!*\
|
12330 | !*** ./src/dagre-wrapper/mermaid-graphlib.js ***!
|
12331 | \***********************************************/
|
12332 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
12333 |
|
12334 | "use strict";
|
12335 | __webpack_require__.r(__webpack_exports__);
|
12336 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
12337 | /* harmony export */ "adjustClustersAndEdges": () => (/* binding */ adjustClustersAndEdges),
|
12338 | /* harmony export */ "clear": () => (/* binding */ clear),
|
12339 | /* harmony export */ "clusterDb": () => (/* binding */ clusterDb),
|
12340 | /* harmony export */ "extractDecendants": () => (/* binding */ extractDecendants),
|
12341 | /* harmony export */ "extractor": () => (/* binding */ extractor),
|
12342 | /* harmony export */ "findNonClusterChild": () => (/* binding */ findNonClusterChild),
|
12343 | /* harmony export */ "sortNodesByHierarchy": () => (/* binding */ sortNodesByHierarchy),
|
12344 | /* harmony export */ "validate": () => (/* binding */ validate)
|
12345 | /* harmony export */ });
|
12346 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
|
12347 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
|
12348 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
|
12349 | /** Decorates with functions required by mermaids dagre-wrapper. */
|
12350 |
|
12351 |
|
12352 | var clusterDb = {};
|
12353 | var decendants = {};
|
12354 | var parents = {};
|
12355 | var clear = function clear() {
|
12356 | decendants = {};
|
12357 | parents = {};
|
12358 | clusterDb = {};
|
12359 | };
|
12360 |
|
12361 | var isDecendant = function isDecendant(id, ancenstorId) {
|
12362 | // if (id === ancenstorId) return true;
|
12363 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('In isDecendant', ancenstorId, ' ', id, ' = ', decendants[ancenstorId].indexOf(id) >= 0);
|
12364 | if (decendants[ancenstorId].indexOf(id) >= 0) return true;
|
12365 | return false;
|
12366 | };
|
12367 |
|
12368 | var edgeInCluster = function edgeInCluster(edge, clusterId) {
|
12369 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Decendants of ', clusterId, ' is ', decendants[clusterId]);
|
12370 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Edge is ', edge); // Edges to/from the cluster is not in the cluster, they are in the parent
|
12371 |
|
12372 | if (edge.v === clusterId) return false;
|
12373 | if (edge.w === clusterId) return false;
|
12374 |
|
12375 | if (!decendants[clusterId]) {
|
12376 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Tilt, ', clusterId, ',not in decendants');
|
12377 | return false;
|
12378 | }
|
12379 |
|
12380 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Here ');
|
12381 | if (decendants[clusterId].indexOf(edge.v) >= 0) return true;
|
12382 | if (isDecendant(edge.v, clusterId)) return true;
|
12383 | if (isDecendant(edge.w, clusterId)) return true;
|
12384 | if (decendants[clusterId].indexOf(edge.w) >= 0) return true;
|
12385 | return false;
|
12386 | };
|
12387 |
|
12388 | var copy = function copy(clusterId, graph, newGraph, rootId) {
|
12389 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Copying children of ', clusterId, 'root', rootId, 'data', graph.node(clusterId), rootId);
|
12390 | var nodes = graph.children(clusterId) || []; // Include cluster node if it is not the root
|
12391 |
|
12392 | if (clusterId !== rootId) {
|
12393 | nodes.push(clusterId);
|
12394 | }
|
12395 |
|
12396 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Copying (nodes) clusterId', clusterId, 'nodes', nodes);
|
12397 | nodes.forEach(function (node) {
|
12398 | if (graph.children(node).length > 0) {
|
12399 | copy(node, graph, newGraph, rootId);
|
12400 | } else {
|
12401 | var data = graph.node(node);
|
12402 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('cp ', node, ' to ', rootId, ' with parent ', clusterId); //,node, data, ' parent is ', clusterId);
|
12403 |
|
12404 | newGraph.setNode(node, data);
|
12405 |
|
12406 | if (rootId !== graph.parent(node)) {
|
12407 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Setting parent', node, graph.parent(node));
|
12408 | newGraph.setParent(node, graph.parent(node));
|
12409 | }
|
12410 |
|
12411 | if (clusterId !== rootId && node !== clusterId) {
|
12412 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Setting parent', node, clusterId);
|
12413 | newGraph.setParent(node, clusterId);
|
12414 | } else {
|
12415 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('In copy ', clusterId, 'root', rootId, 'data', graph.node(clusterId), rootId);
|
12416 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Not Setting parent for node=', node, 'cluster!==rootId', clusterId !== rootId, 'node!==clusterId', node !== clusterId);
|
12417 | }
|
12418 |
|
12419 | var edges = graph.edges(node);
|
12420 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Copying Edges', edges);
|
12421 | edges.forEach(function (edge) {
|
12422 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Edge', edge);
|
12423 | var data = graph.edge(edge.v, edge.w, edge.name);
|
12424 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Edge data', data, rootId);
|
12425 |
|
12426 | try {
|
12427 | // Do not copy edges in and out of the root cluster, they belong to the parent graph
|
12428 | if (edgeInCluster(edge, rootId)) {
|
12429 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Copying as ', edge.v, edge.w, data, edge.name);
|
12430 | newGraph.setEdge(edge.v, edge.w, data, edge.name);
|
12431 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('newGraph edges ', newGraph.edges(), newGraph.edge(newGraph.edges()[0]));
|
12432 | } else {
|
12433 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Skipping copy of edge ', edge.v, '-->', edge.w, ' rootId: ', rootId, ' clusterId:', clusterId);
|
12434 | }
|
12435 | } catch (e) {
|
12436 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error(e);
|
12437 | }
|
12438 | });
|
12439 | }
|
12440 |
|
12441 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Removing node', node);
|
12442 | graph.removeNode(node);
|
12443 | });
|
12444 | };
|
12445 |
|
12446 | var extractDecendants = function extractDecendants(id, graph) {
|
12447 | // log.debug('Extracting ', id);
|
12448 | var children = graph.children(id);
|
12449 | var res = [].concat(children);
|
12450 |
|
12451 | for (var i = 0; i < children.length; i++) {
|
12452 | parents[children[i]] = id;
|
12453 | res = res.concat(extractDecendants(children[i], graph));
|
12454 | }
|
12455 |
|
12456 | return res;
|
12457 | };
|
12458 | /**
|
12459 | * Validates the graph, checking that all parent child relation points to existing nodes and that
|
12460 | * edges between nodes also ia correct. When not correct the function logs the discrepancies.
|
12461 | *
|
12462 | * @param graph
|
12463 | */
|
12464 |
|
12465 | var validate = function validate(graph) {
|
12466 | var edges = graph.edges();
|
12467 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Edges: ', edges);
|
12468 |
|
12469 | for (var i = 0; i < edges.length; i++) {
|
12470 | if (graph.children(edges[i].v).length > 0) {
|
12471 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('The node ', edges[i].v, ' is part of and edge even though it has children');
|
12472 | return false;
|
12473 | }
|
12474 |
|
12475 | if (graph.children(edges[i].w).length > 0) {
|
12476 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('The node ', edges[i].w, ' is part of and edge even though it has children');
|
12477 | return false;
|
12478 | }
|
12479 | }
|
12480 |
|
12481 | return true;
|
12482 | };
|
12483 | /**
|
12484 | * Finds a child that is not a cluster. When faking a edge between a node and a cluster.
|
12485 | *
|
12486 | * @param {Finds a} id
|
12487 | * @param {any} graph
|
12488 | */
|
12489 |
|
12490 | var findNonClusterChild = function findNonClusterChild(id, graph) {
|
12491 | // const node = graph.node(id);
|
12492 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Searching', id); // const children = graph.children(id).reverse();
|
12493 |
|
12494 | var children = graph.children(id); //.reverse();
|
12495 |
|
12496 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Searching children of id ', id, children);
|
12497 |
|
12498 | if (children.length < 1) {
|
12499 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('This is a valid node', id);
|
12500 | return id;
|
12501 | }
|
12502 |
|
12503 | for (var i = 0; i < children.length; i++) {
|
12504 | var _id = findNonClusterChild(children[i], graph);
|
12505 |
|
12506 | if (_id) {
|
12507 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Found replacement for', id, ' => ', _id);
|
12508 | return _id;
|
12509 | }
|
12510 | }
|
12511 | };
|
12512 |
|
12513 | var getAnchorId = function getAnchorId(id) {
|
12514 | if (!clusterDb[id]) {
|
12515 | return id;
|
12516 | } // If the cluster has no external connections
|
12517 |
|
12518 |
|
12519 | if (!clusterDb[id].externalConnections) {
|
12520 | return id;
|
12521 | } // Return the replacement node
|
12522 |
|
12523 |
|
12524 | if (clusterDb[id]) {
|
12525 | return clusterDb[id].id;
|
12526 | }
|
12527 |
|
12528 | return id;
|
12529 | };
|
12530 |
|
12531 | var adjustClustersAndEdges = function adjustClustersAndEdges(graph, depth) {
|
12532 | if (!graph || depth > 10) {
|
12533 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Opting out, no graph ');
|
12534 | return;
|
12535 | } else {
|
12536 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Opting in, graph ');
|
12537 | } // Go through the nodes and for each cluster found, save a replacement node, this can be used when
|
12538 | // faking a link to a cluster
|
12539 |
|
12540 |
|
12541 | graph.nodes().forEach(function (id) {
|
12542 | var children = graph.children(id);
|
12543 |
|
12544 | if (children.length > 0) {
|
12545 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Cluster identified', id, ' Replacement id in edges: ', findNonClusterChild(id, graph));
|
12546 | decendants[id] = extractDecendants(id, graph);
|
12547 | clusterDb[id] = {
|
12548 | id: findNonClusterChild(id, graph),
|
12549 | clusterData: graph.node(id)
|
12550 | };
|
12551 | }
|
12552 | }); // Check incoming and outgoing edges for each cluster
|
12553 |
|
12554 | graph.nodes().forEach(function (id) {
|
12555 | var children = graph.children(id);
|
12556 | var edges = graph.edges();
|
12557 |
|
12558 | if (children.length > 0) {
|
12559 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Cluster identified', id, decendants);
|
12560 | edges.forEach(function (edge) {
|
12561 | // log.debug('Edge, decendants: ', edge, decendants[id]);
|
12562 | // Check if any edge leaves the cluster (not the actual cluster, thats a link from the box)
|
12563 | if (edge.v !== id && edge.w !== id) {
|
12564 | // Any edge where either the one of the nodes is decending to the cluster but not the other
|
12565 | // if (decendants[id].indexOf(edge.v) < 0 && decendants[id].indexOf(edge.w) < 0) {
|
12566 | var d1 = isDecendant(edge.v, id);
|
12567 | var d2 = isDecendant(edge.w, id); // d1 xor d2 - if either d1 is true and d2 is false or the other way around
|
12568 |
|
12569 | if (d1 ^ d2) {
|
12570 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Edge: ', edge, ' leaves cluster ', id);
|
12571 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Decendants of XXX ', id, ': ', decendants[id]);
|
12572 | clusterDb[id].externalConnections = true;
|
12573 | }
|
12574 | }
|
12575 | });
|
12576 | } else {
|
12577 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Not a cluster ', id, decendants);
|
12578 | }
|
12579 | }); // For clusters with incoming and/or outgoing edges translate those edges to a real node
|
12580 | // in the cluster in order to fake the edge
|
12581 |
|
12582 | graph.edges().forEach(function (e) {
|
12583 | var edge = graph.edge(e);
|
12584 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
|
12585 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));
|
12586 | var v = e.v;
|
12587 | var w = e.w; // Check if link is either from or to a cluster
|
12588 |
|
12589 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fix XXX', clusterDb, 'ids:', e.v, e.w, 'Translateing: ', clusterDb[e.v], ' --- ', clusterDb[e.w]);
|
12590 |
|
12591 | if (clusterDb[e.v] && clusterDb[e.w] && clusterDb[e.v] === clusterDb[e.w]) {
|
12592 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fixing and trixing link to self - removing XXX', e.v, e.w, e.name);
|
12593 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fixing and trixing - removing XXX', e.v, e.w, e.name);
|
12594 | v = getAnchorId(e.v);
|
12595 | w = getAnchorId(e.w);
|
12596 | graph.removeEdge(e.v, e.w, e.name);
|
12597 | var specialId = e.w + '---' + e.v;
|
12598 | graph.setNode(specialId, {
|
12599 | domId: specialId,
|
12600 | id: specialId,
|
12601 | labelStyle: '',
|
12602 | labelText: edge.label,
|
12603 | padding: 0,
|
12604 | shape: 'labelRect',
|
12605 | style: ''
|
12606 | });
|
12607 | var edge1 = JSON.parse(JSON.stringify(edge));
|
12608 | var edge2 = JSON.parse(JSON.stringify(edge));
|
12609 | edge1.label = '';
|
12610 | edge1.arrowTypeEnd = 'none';
|
12611 | edge2.label = '';
|
12612 | edge1.fromCluster = e.v;
|
12613 | edge2.toCluster = e.v;
|
12614 | graph.setEdge(v, specialId, edge1, e.name + '-cyclic-special');
|
12615 | graph.setEdge(specialId, w, edge2, e.name + '-cyclic-special');
|
12616 | } else if (clusterDb[e.v] || clusterDb[e.w]) {
|
12617 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fixing and trixing - removing XXX', e.v, e.w, e.name);
|
12618 | v = getAnchorId(e.v);
|
12619 | w = getAnchorId(e.w);
|
12620 | graph.removeEdge(e.v, e.w, e.name);
|
12621 | if (v !== e.v) edge.fromCluster = e.v;
|
12622 | if (w !== e.w) edge.toCluster = e.w;
|
12623 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fix Replacing with XXX', v, w, e.name);
|
12624 | graph.setEdge(v, w, edge, e.name);
|
12625 | }
|
12626 | });
|
12627 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Adjusted Graph', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph));
|
12628 | extractor(graph, 0);
|
12629 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace(clusterDb); // Remove references to extracted cluster
|
12630 | // graph.edges().forEach(edge => {
|
12631 | // if (isDecendant(edge.v, clusterId) || isDecendant(edge.w, clusterId)) {
|
12632 | // graph.removeEdge(edge);
|
12633 | // }
|
12634 | // });
|
12635 | };
|
12636 | var extractor = function extractor(graph, depth) {
|
12637 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('extractor - ', depth, graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph), graph.children('D'));
|
12638 |
|
12639 | if (depth > 10) {
|
12640 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('Bailing out');
|
12641 | return;
|
12642 | } // For clusters without incoming and/or outgoing edges, create a new cluster-node
|
12643 | // containing the nodes and edges in the custer in a new graph
|
12644 | // for (let i = 0;)
|
12645 |
|
12646 |
|
12647 | var nodes = graph.nodes();
|
12648 | var hasChildren = false;
|
12649 |
|
12650 | for (var i = 0; i < nodes.length; i++) {
|
12651 | var node = nodes[i];
|
12652 | var children = graph.children(node);
|
12653 | hasChildren = hasChildren || children.length > 0;
|
12654 | }
|
12655 |
|
12656 | if (!hasChildren) {
|
12657 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Done, no node has children', graph.nodes());
|
12658 | return;
|
12659 | } // const clusters = Object.keys(clusterDb);
|
12660 | // clusters.forEach(clusterId => {
|
12661 |
|
12662 |
|
12663 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Nodes = ', nodes, depth);
|
12664 |
|
12665 | for (var _i = 0; _i < nodes.length; _i++) {
|
12666 | var _node = nodes[_i];
|
12667 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Extracting node', _node, clusterDb, clusterDb[_node] && !clusterDb[_node].externalConnections, !graph.parent(_node), graph.node(_node), graph.children('D'), ' Depth ', depth); // Note that the node might have been removed after the Object.keys call so better check
|
12668 | // that it still is in the game
|
12669 |
|
12670 | if (!clusterDb[_node]) {
|
12671 | // Skip if the node is not a cluster
|
12672 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Not a cluster', _node, depth); // break;
|
12673 | } else if (!clusterDb[_node].externalConnections && // !graph.parent(node) &&
|
12674 | graph.children(_node) && graph.children(_node).length > 0) {
|
12675 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Cluster without external connections, without a parent and with children', _node, depth);
|
12676 | var graphSettings = graph.graph();
|
12677 | var dir = graphSettings.rankdir === 'TB' ? 'LR' : 'TB';
|
12678 |
|
12679 | if (clusterDb[_node]) {
|
12680 | if (clusterDb[_node].clusterData && clusterDb[_node].clusterData.dir) {
|
12681 | dir = clusterDb[_node].clusterData.dir;
|
12682 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fixing dir', clusterDb[_node].clusterData.dir, dir);
|
12683 | }
|
12684 | }
|
12685 |
|
12686 | var clusterGraph = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
|
12687 | multigraph: true,
|
12688 | compound: true
|
12689 | }).setGraph({
|
12690 | rankdir: dir,
|
12691 | // Todo: set proper spacing
|
12692 | nodesep: 50,
|
12693 | ranksep: 50,
|
12694 | marginx: 8,
|
12695 | marginy: 8
|
12696 | }).setDefaultEdgeLabel(function () {
|
12697 | return {};
|
12698 | });
|
12699 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Old graph before copy', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph));
|
12700 | copy(_node, graph, clusterGraph, _node);
|
12701 | graph.setNode(_node, {
|
12702 | clusterNode: true,
|
12703 | id: _node,
|
12704 | clusterData: clusterDb[_node].clusterData,
|
12705 | labelText: clusterDb[_node].labelText,
|
12706 | graph: clusterGraph
|
12707 | });
|
12708 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('New graph after copy node: (', _node, ')', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(clusterGraph));
|
12709 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Old graph after copy', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph));
|
12710 | } else {
|
12711 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Cluster ** ', _node, ' **not meeting the criteria !externalConnections:', !clusterDb[_node].externalConnections, ' no parent: ', !graph.parent(_node), ' children ', graph.children(_node) && graph.children(_node).length > 0, graph.children('D'), depth);
|
12712 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(clusterDb);
|
12713 | }
|
12714 | }
|
12715 |
|
12716 | nodes = graph.nodes();
|
12717 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('New list of nodes', nodes);
|
12718 |
|
12719 | for (var _i2 = 0; _i2 < nodes.length; _i2++) {
|
12720 | var _node2 = nodes[_i2];
|
12721 | var data = graph.node(_node2);
|
12722 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn(' Now next level', _node2, data);
|
12723 |
|
12724 | if (data.clusterNode) {
|
12725 | extractor(data.graph, depth + 1);
|
12726 | }
|
12727 | }
|
12728 | };
|
12729 |
|
12730 | var sorter = function sorter(graph, nodes) {
|
12731 | if (nodes.length === 0) return [];
|
12732 | var result = Object.assign(nodes);
|
12733 | nodes.forEach(function (node) {
|
12734 | var children = graph.children(node);
|
12735 | var sorted = sorter(graph, children);
|
12736 | result = result.concat(sorted);
|
12737 | });
|
12738 | return result;
|
12739 | };
|
12740 |
|
12741 | var sortNodesByHierarchy = function sortNodesByHierarchy(graph) {
|
12742 | return sorter(graph, graph.children());
|
12743 | };
|
12744 |
|
12745 | /***/ }),
|
12746 |
|
12747 | /***/ "./src/dagre-wrapper/nodes.js":
|
12748 | /*!************************************!*\
|
12749 | !*** ./src/dagre-wrapper/nodes.js ***!
|
12750 | \************************************/
|
12751 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
12752 |
|
12753 | "use strict";
|
12754 | __webpack_require__.r(__webpack_exports__);
|
12755 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
12756 | /* harmony export */ "clear": () => (/* binding */ clear),
|
12757 | /* harmony export */ "insertNode": () => (/* binding */ insertNode),
|
12758 | /* harmony export */ "positionNode": () => (/* binding */ positionNode),
|
12759 | /* harmony export */ "setNodeElem": () => (/* binding */ setNodeElem)
|
12760 | /* harmony export */ });
|
12761 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
12762 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
12763 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
|
12764 | /* harmony import */ var _shapes_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shapes/util */ "./src/dagre-wrapper/shapes/util.js");
|
12765 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../config */ "./src/config.js");
|
12766 | /* harmony import */ var _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./intersect/index.js */ "./src/dagre-wrapper/intersect/index.js");
|
12767 | /* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
|
12768 | /* harmony import */ var _shapes_note__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./shapes/note */ "./src/dagre-wrapper/shapes/note.js");
|
12769 | /* harmony import */ var _diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../diagrams/class/svgDraw */ "./src/diagrams/class/svgDraw.js");
|
12770 | /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js");
|
12771 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
12772 |
|
12773 |
|
12774 | // eslint-disable-line
|
12775 |
|
12776 |
|
12777 |
|
12778 |
|
12779 |
|
12780 |
|
12781 |
|
12782 |
|
12783 |
|
12784 | var sanitizeText = function sanitizeText(txt) {
|
12785 | return (0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.sanitizeText)(txt, (0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)());
|
12786 | };
|
12787 |
|
12788 | var question = function question(parent, node) {
|
12789 | var _labelHelper = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true),
|
12790 | shapeSvg = _labelHelper.shapeSvg,
|
12791 | bbox = _labelHelper.bbox;
|
12792 |
|
12793 | var w = bbox.width + node.padding;
|
12794 | var h = bbox.height + node.padding;
|
12795 | var s = w + h;
|
12796 | var points = [{
|
12797 | x: s / 2,
|
12798 | y: 0
|
12799 | }, {
|
12800 | x: s,
|
12801 | y: -s / 2
|
12802 | }, {
|
12803 | x: s / 2,
|
12804 | y: -s
|
12805 | }, {
|
12806 | x: 0,
|
12807 | y: -s / 2
|
12808 | }];
|
12809 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Question main (Circle)');
|
12810 | var questionElem = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, s, s, points);
|
12811 | questionElem.attr('style', node.style);
|
12812 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, questionElem);
|
12813 |
|
12814 | node.intersect = function (point) {
|
12815 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('Intersect called');
|
12816 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point);
|
12817 | };
|
12818 |
|
12819 | return shapeSvg;
|
12820 | };
|
12821 |
|
12822 | var choice = function choice(parent, node) {
|
12823 | var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
|
12824 | var s = 28;
|
12825 | var points = [{
|
12826 | x: 0,
|
12827 | y: s / 2
|
12828 | }, {
|
12829 | x: s / 2,
|
12830 | y: 0
|
12831 | }, {
|
12832 | x: 0,
|
12833 | y: -s / 2
|
12834 | }, {
|
12835 | x: -s / 2,
|
12836 | y: 0
|
12837 | }];
|
12838 | var choice = shapeSvg.insert('polygon', ':first-child').attr('points', points.map(function (d) {
|
12839 | return d.x + ',' + d.y;
|
12840 | }).join(' ')); // center the circle around its coordinate
|
12841 |
|
12842 | choice.attr('class', 'state-start').attr('r', 7).attr('width', 28).attr('height', 28);
|
12843 | node.width = 28;
|
12844 | node.height = 28;
|
12845 |
|
12846 | node.intersect = function (point) {
|
12847 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].circle(node, 14, point);
|
12848 | };
|
12849 |
|
12850 | return shapeSvg;
|
12851 | };
|
12852 |
|
12853 | var hexagon = function hexagon(parent, node) {
|
12854 | var _labelHelper2 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true),
|
12855 | shapeSvg = _labelHelper2.shapeSvg,
|
12856 | bbox = _labelHelper2.bbox;
|
12857 |
|
12858 | var f = 4;
|
12859 | var h = bbox.height + node.padding;
|
12860 | var m = h / f;
|
12861 | var w = bbox.width + 2 * m + node.padding;
|
12862 | var points = [{
|
12863 | x: m,
|
12864 | y: 0
|
12865 | }, {
|
12866 | x: w - m,
|
12867 | y: 0
|
12868 | }, {
|
12869 | x: w,
|
12870 | y: -h / 2
|
12871 | }, {
|
12872 | x: w - m,
|
12873 | y: -h
|
12874 | }, {
|
12875 | x: m,
|
12876 | y: -h
|
12877 | }, {
|
12878 | x: 0,
|
12879 | y: -h / 2
|
12880 | }];
|
12881 | var hex = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points);
|
12882 | hex.attr('style', node.style);
|
12883 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, hex);
|
12884 |
|
12885 | node.intersect = function (point) {
|
12886 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point);
|
12887 | };
|
12888 |
|
12889 | return shapeSvg;
|
12890 | };
|
12891 |
|
12892 | var rect_left_inv_arrow = function rect_left_inv_arrow(parent, node) {
|
12893 | var _labelHelper3 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true),
|
12894 | shapeSvg = _labelHelper3.shapeSvg,
|
12895 | bbox = _labelHelper3.bbox;
|
12896 |
|
12897 | var w = bbox.width + node.padding;
|
12898 | var h = bbox.height + node.padding;
|
12899 | var points = [{
|
12900 | x: -h / 2,
|
12901 | y: 0
|
12902 | }, {
|
12903 | x: w,
|
12904 | y: 0
|
12905 | }, {
|
12906 | x: w,
|
12907 | y: -h
|
12908 | }, {
|
12909 | x: -h / 2,
|
12910 | y: -h
|
12911 | }, {
|
12912 | x: 0,
|
12913 | y: -h / 2
|
12914 | }];
|
12915 | var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points);
|
12916 | el.attr('style', node.style);
|
12917 | node.width = w + h;
|
12918 | node.height = h;
|
12919 |
|
12920 | node.intersect = function (point) {
|
12921 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point);
|
12922 | };
|
12923 |
|
12924 | return shapeSvg;
|
12925 | };
|
12926 |
|
12927 | var lean_right = function lean_right(parent, node) {
|
12928 | var _labelHelper4 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true),
|
12929 | shapeSvg = _labelHelper4.shapeSvg,
|
12930 | bbox = _labelHelper4.bbox;
|
12931 |
|
12932 | var w = bbox.width + node.padding;
|
12933 | var h = bbox.height + node.padding;
|
12934 | var points = [{
|
12935 | x: -2 * h / 6,
|
12936 | y: 0
|
12937 | }, {
|
12938 | x: w - h / 6,
|
12939 | y: 0
|
12940 | }, {
|
12941 | x: w + 2 * h / 6,
|
12942 | y: -h
|
12943 | }, {
|
12944 | x: h / 6,
|
12945 | y: -h
|
12946 | }];
|
12947 | var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points);
|
12948 | el.attr('style', node.style);
|
12949 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, el);
|
12950 |
|
12951 | node.intersect = function (point) {
|
12952 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point);
|
12953 | };
|
12954 |
|
12955 | return shapeSvg;
|
12956 | };
|
12957 |
|
12958 | var lean_left = function lean_left(parent, node) {
|
12959 | var _labelHelper5 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true),
|
12960 | shapeSvg = _labelHelper5.shapeSvg,
|
12961 | bbox = _labelHelper5.bbox;
|
12962 |
|
12963 | var w = bbox.width + node.padding;
|
12964 | var h = bbox.height + node.padding;
|
12965 | var points = [{
|
12966 | x: 2 * h / 6,
|
12967 | y: 0
|
12968 | }, {
|
12969 | x: w + h / 6,
|
12970 | y: 0
|
12971 | }, {
|
12972 | x: w - 2 * h / 6,
|
12973 | y: -h
|
12974 | }, {
|
12975 | x: -h / 6,
|
12976 | y: -h
|
12977 | }];
|
12978 | var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points);
|
12979 | el.attr('style', node.style);
|
12980 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, el);
|
12981 |
|
12982 | node.intersect = function (point) {
|
12983 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point);
|
12984 | };
|
12985 |
|
12986 | return shapeSvg;
|
12987 | };
|
12988 |
|
12989 | var trapezoid = function trapezoid(parent, node) {
|
12990 | var _labelHelper6 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true),
|
12991 | shapeSvg = _labelHelper6.shapeSvg,
|
12992 | bbox = _labelHelper6.bbox;
|
12993 |
|
12994 | var w = bbox.width + node.padding;
|
12995 | var h = bbox.height + node.padding;
|
12996 | var points = [{
|
12997 | x: -2 * h / 6,
|
12998 | y: 0
|
12999 | }, {
|
13000 | x: w + 2 * h / 6,
|
13001 | y: 0
|
13002 | }, {
|
13003 | x: w - h / 6,
|
13004 | y: -h
|
13005 | }, {
|
13006 | x: h / 6,
|
13007 | y: -h
|
13008 | }];
|
13009 | var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points);
|
13010 | el.attr('style', node.style);
|
13011 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, el);
|
13012 |
|
13013 | node.intersect = function (point) {
|
13014 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point);
|
13015 | };
|
13016 |
|
13017 | return shapeSvg;
|
13018 | };
|
13019 |
|
13020 | var inv_trapezoid = function inv_trapezoid(parent, node) {
|
13021 | var _labelHelper7 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true),
|
13022 | shapeSvg = _labelHelper7.shapeSvg,
|
13023 | bbox = _labelHelper7.bbox;
|
13024 |
|
13025 | var w = bbox.width + node.padding;
|
13026 | var h = bbox.height + node.padding;
|
13027 | var points = [{
|
13028 | x: h / 6,
|
13029 | y: 0
|
13030 | }, {
|
13031 | x: w - h / 6,
|
13032 | y: 0
|
13033 | }, {
|
13034 | x: w + 2 * h / 6,
|
13035 | y: -h
|
13036 | }, {
|
13037 | x: -2 * h / 6,
|
13038 | y: -h
|
13039 | }];
|
13040 | var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points);
|
13041 | el.attr('style', node.style);
|
13042 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, el);
|
13043 |
|
13044 | node.intersect = function (point) {
|
13045 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point);
|
13046 | };
|
13047 |
|
13048 | return shapeSvg;
|
13049 | };
|
13050 |
|
13051 | var rect_right_inv_arrow = function rect_right_inv_arrow(parent, node) {
|
13052 | var _labelHelper8 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true),
|
13053 | shapeSvg = _labelHelper8.shapeSvg,
|
13054 | bbox = _labelHelper8.bbox;
|
13055 |
|
13056 | var w = bbox.width + node.padding;
|
13057 | var h = bbox.height + node.padding;
|
13058 | var points = [{
|
13059 | x: 0,
|
13060 | y: 0
|
13061 | }, {
|
13062 | x: w + h / 2,
|
13063 | y: 0
|
13064 | }, {
|
13065 | x: w,
|
13066 | y: -h / 2
|
13067 | }, {
|
13068 | x: w + h / 2,
|
13069 | y: -h
|
13070 | }, {
|
13071 | x: 0,
|
13072 | y: -h
|
13073 | }];
|
13074 | var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points);
|
13075 | el.attr('style', node.style);
|
13076 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, el);
|
13077 |
|
13078 | node.intersect = function (point) {
|
13079 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point);
|
13080 | };
|
13081 |
|
13082 | return shapeSvg;
|
13083 | };
|
13084 |
|
13085 | var cylinder = function cylinder(parent, node) {
|
13086 | var _labelHelper9 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true),
|
13087 | shapeSvg = _labelHelper9.shapeSvg,
|
13088 | bbox = _labelHelper9.bbox;
|
13089 |
|
13090 | var w = bbox.width + node.padding;
|
13091 | var rx = w / 2;
|
13092 | var ry = rx / (2.5 + w / 50);
|
13093 | var h = bbox.height + ry + node.padding;
|
13094 | var shape = 'M 0,' + ry + ' a ' + rx + ',' + ry + ' 0,0,0 ' + w + ' 0 a ' + rx + ',' + ry + ' 0,0,0 ' + -w + ' 0 l 0,' + h + ' a ' + rx + ',' + ry + ' 0,0,0 ' + w + ' 0 l 0,' + -h;
|
13095 | var el = shapeSvg.attr('label-offset-y', ry).insert('path', ':first-child').attr('style', node.style).attr('d', shape).attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')');
|
13096 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, el);
|
13097 |
|
13098 | node.intersect = function (point) {
|
13099 | var pos = _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].rect(node, point);
|
13100 | var x = pos.x - node.x;
|
13101 |
|
13102 | if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
|
13103 | // ellipsis equation: x*x / a*a + y*y / b*b = 1
|
13104 | // solve for y to get adjustion value for pos.y
|
13105 | var y = ry * ry * (1 - x * x / (rx * rx));
|
13106 | if (y != 0) y = Math.sqrt(y);
|
13107 | y = ry - y;
|
13108 | if (point.y - node.y > 0) y = -y;
|
13109 | pos.y += y;
|
13110 | }
|
13111 |
|
13112 | return pos;
|
13113 | };
|
13114 |
|
13115 | return shapeSvg;
|
13116 | };
|
13117 |
|
13118 | var rect = function rect(parent, node) {
|
13119 | var _labelHelper10 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, 'node ' + node.classes, true),
|
13120 | shapeSvg = _labelHelper10.shapeSvg,
|
13121 | bbox = _labelHelper10.bbox,
|
13122 | halfPadding = _labelHelper10.halfPadding;
|
13123 |
|
13124 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.trace('Classes = ', node.classes); // add the rect
|
13125 |
|
13126 | var rect = shapeSvg.insert('rect', ':first-child');
|
13127 | var totalWidth = bbox.width + node.padding;
|
13128 | var totalHeight = bbox.height + node.padding;
|
13129 | rect.attr('class', 'basic label-container').attr('style', node.style).attr('rx', node.rx).attr('ry', node.ry).attr('x', -bbox.width / 2 - halfPadding).attr('y', -bbox.height / 2 - halfPadding).attr('width', totalWidth).attr('height', totalHeight);
|
13130 |
|
13131 | if (node.props) {
|
13132 | var propKeys = new Set(Object.keys(node.props));
|
13133 |
|
13134 | if (node.props.borders) {
|
13135 | applyNodePropertyBorders(rect, node.props.borders, totalWidth, totalHeight);
|
13136 | propKeys.delete('borders');
|
13137 | }
|
13138 |
|
13139 | propKeys.forEach(function (propKey) {
|
13140 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("Unknown node property ".concat(propKey));
|
13141 | });
|
13142 | }
|
13143 |
|
13144 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, rect);
|
13145 |
|
13146 | node.intersect = function (point) {
|
13147 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].rect(node, point);
|
13148 | };
|
13149 |
|
13150 | return shapeSvg;
|
13151 | };
|
13152 |
|
13153 | var labelRect = function labelRect(parent, node) {
|
13154 | var _labelHelper11 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, 'label', true),
|
13155 | shapeSvg = _labelHelper11.shapeSvg,
|
13156 | bbox = _labelHelper11.bbox,
|
13157 | halfPadding = _labelHelper11.halfPadding;
|
13158 |
|
13159 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.trace('Classes = ', node.classes); // add the rect
|
13160 |
|
13161 | var rect = shapeSvg.insert('rect', ':first-child'); // Hide the rect we are only after the label
|
13162 |
|
13163 | var totalWidth = 0;
|
13164 | var totalHeight = 0;
|
13165 | rect.attr('width', totalWidth).attr('height', totalHeight);
|
13166 | shapeSvg.attr('class', 'label edgeLabel');
|
13167 |
|
13168 | if (node.props) {
|
13169 | var propKeys = new Set(Object.keys(node.props));
|
13170 |
|
13171 | if (node.props.borders) {
|
13172 | applyNodePropertyBorders(rect, node.props.borders, totalWidth, totalHeight);
|
13173 | propKeys.delete('borders');
|
13174 | }
|
13175 |
|
13176 | propKeys.forEach(function (propKey) {
|
13177 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("Unknown node property ".concat(propKey));
|
13178 | });
|
13179 | }
|
13180 |
|
13181 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, rect);
|
13182 |
|
13183 | node.intersect = function (point) {
|
13184 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].rect(node, point);
|
13185 | };
|
13186 |
|
13187 | return shapeSvg;
|
13188 | };
|
13189 | /**
|
13190 | * @param rect
|
13191 | * @param borders
|
13192 | * @param totalWidth
|
13193 | * @param totalHeight
|
13194 | */
|
13195 |
|
13196 |
|
13197 | function applyNodePropertyBorders(rect, borders, totalWidth, totalHeight) {
|
13198 | var strokeDashArray = [];
|
13199 |
|
13200 | var addBorder = function addBorder(length) {
|
13201 | strokeDashArray.push(length);
|
13202 | strokeDashArray.push(0);
|
13203 | };
|
13204 |
|
13205 | var skipBorder = function skipBorder(length) {
|
13206 | strokeDashArray.push(0);
|
13207 | strokeDashArray.push(length);
|
13208 | };
|
13209 |
|
13210 | if (borders.includes('t')) {
|
13211 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('add top border');
|
13212 | addBorder(totalWidth);
|
13213 | } else {
|
13214 | skipBorder(totalWidth);
|
13215 | }
|
13216 |
|
13217 | if (borders.includes('r')) {
|
13218 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('add right border');
|
13219 | addBorder(totalHeight);
|
13220 | } else {
|
13221 | skipBorder(totalHeight);
|
13222 | }
|
13223 |
|
13224 | if (borders.includes('b')) {
|
13225 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('add bottom border');
|
13226 | addBorder(totalWidth);
|
13227 | } else {
|
13228 | skipBorder(totalWidth);
|
13229 | }
|
13230 |
|
13231 | if (borders.includes('l')) {
|
13232 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('add left border');
|
13233 | addBorder(totalHeight);
|
13234 | } else {
|
13235 | skipBorder(totalHeight);
|
13236 | }
|
13237 |
|
13238 | rect.attr('stroke-dasharray', strokeDashArray.join(' '));
|
13239 | }
|
13240 |
|
13241 | var rectWithTitle = function rectWithTitle(parent, node) {
|
13242 | // const { shapeSvg, bbox, halfPadding } = labelHelper(parent, node, 'node ' + node.classes);
|
13243 | var classes;
|
13244 |
|
13245 | if (!node.classes) {
|
13246 | classes = 'node default';
|
13247 | } else {
|
13248 | classes = 'node ' + node.classes;
|
13249 | } // Add outer g element
|
13250 |
|
13251 |
|
13252 | var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the title label and insert it after the rect
|
13253 |
|
13254 | var rect = shapeSvg.insert('rect', ':first-child'); // const innerRect = shapeSvg.insert('rect');
|
13255 |
|
13256 | var innerLine = shapeSvg.insert('line');
|
13257 | var label = shapeSvg.insert('g').attr('class', 'label');
|
13258 | var text2 = node.labelText.flat ? node.labelText.flat() : node.labelText; // const text2 = typeof text2prim === 'object' ? text2prim[0] : text2prim;
|
13259 |
|
13260 | var title = '';
|
13261 |
|
13262 | if (_typeof(text2) === 'object') {
|
13263 | title = text2[0];
|
13264 | } else {
|
13265 | title = text2;
|
13266 | }
|
13267 |
|
13268 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Label text abc79', title, text2, _typeof(text2) === 'object');
|
13269 | var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_6__["default"])(title, node.labelStyle, true, true));
|
13270 | var bbox = {
|
13271 | width: 0,
|
13272 | height: 0
|
13273 | };
|
13274 |
|
13275 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) {
|
13276 | var div = text.children[0];
|
13277 | var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text);
|
13278 | bbox = div.getBoundingClientRect();
|
13279 | dv.attr('width', bbox.width);
|
13280 | dv.attr('height', bbox.height);
|
13281 | }
|
13282 |
|
13283 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Text 2', text2);
|
13284 | var textRows = text2.slice(1, text2.length);
|
13285 | var titleBox = text.getBBox();
|
13286 | var descr = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_6__["default"])(textRows.join ? textRows.join('<br/>') : textRows, node.labelStyle, true, true));
|
13287 |
|
13288 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) {
|
13289 | var _div = descr.children[0];
|
13290 |
|
13291 | var _dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(descr);
|
13292 |
|
13293 | bbox = _div.getBoundingClientRect();
|
13294 |
|
13295 | _dv.attr('width', bbox.width);
|
13296 |
|
13297 | _dv.attr('height', bbox.height);
|
13298 | } // bbox = label.getBBox();
|
13299 | // log.info(descr);
|
13300 |
|
13301 |
|
13302 | var halfPadding = node.padding / 2;
|
13303 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(descr).attr('transform', 'translate( ' + ( // (titleBox.width - bbox.width) / 2 +
|
13304 | bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ', ' + (titleBox.height + halfPadding + 5) + ')');
|
13305 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text).attr('transform', 'translate( ' + ( // (titleBox.width - bbox.width) / 2 +
|
13306 | bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ', ' + 0 + ')'); // Get the size of the label
|
13307 | // Bounding box for title and text
|
13308 |
|
13309 | bbox = label.node().getBBox(); // Center the label
|
13310 |
|
13311 | label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + (-bbox.height / 2 - halfPadding + 3) + ')');
|
13312 | rect.attr('class', 'outer title-state').attr('x', -bbox.width / 2 - halfPadding).attr('y', -bbox.height / 2 - halfPadding).attr('width', bbox.width + node.padding).attr('height', bbox.height + node.padding);
|
13313 | innerLine.attr('class', 'divider').attr('x1', -bbox.width / 2 - halfPadding).attr('x2', bbox.width / 2 + halfPadding).attr('y1', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding).attr('y2', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
|
13314 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, rect);
|
13315 |
|
13316 | node.intersect = function (point) {
|
13317 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].rect(node, point);
|
13318 | };
|
13319 |
|
13320 | return shapeSvg;
|
13321 | };
|
13322 |
|
13323 | var stadium = function stadium(parent, node) {
|
13324 | var _labelHelper12 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true),
|
13325 | shapeSvg = _labelHelper12.shapeSvg,
|
13326 | bbox = _labelHelper12.bbox;
|
13327 |
|
13328 | var h = bbox.height + node.padding;
|
13329 | var w = bbox.width + h / 4 + node.padding; // add the rect
|
13330 |
|
13331 | var rect = shapeSvg.insert('rect', ':first-child').attr('style', node.style).attr('rx', h / 2).attr('ry', h / 2).attr('x', -w / 2).attr('y', -h / 2).attr('width', w).attr('height', h);
|
13332 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, rect);
|
13333 |
|
13334 | node.intersect = function (point) {
|
13335 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].rect(node, point);
|
13336 | };
|
13337 |
|
13338 | return shapeSvg;
|
13339 | };
|
13340 |
|
13341 | var circle = function circle(parent, node) {
|
13342 | var _labelHelper13 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true),
|
13343 | shapeSvg = _labelHelper13.shapeSvg,
|
13344 | bbox = _labelHelper13.bbox,
|
13345 | halfPadding = _labelHelper13.halfPadding;
|
13346 |
|
13347 | var circle = shapeSvg.insert('circle', ':first-child'); // center the circle around its coordinate
|
13348 |
|
13349 | circle.attr('style', node.style).attr('rx', node.rx).attr('ry', node.ry).attr('r', bbox.width / 2 + halfPadding).attr('width', bbox.width + node.padding).attr('height', bbox.height + node.padding);
|
13350 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Circle main');
|
13351 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, circle);
|
13352 |
|
13353 | node.intersect = function (point) {
|
13354 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Circle intersect', node, bbox.width / 2 + halfPadding, point);
|
13355 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].circle(node, bbox.width / 2 + halfPadding, point);
|
13356 | };
|
13357 |
|
13358 | return shapeSvg;
|
13359 | };
|
13360 |
|
13361 | var doublecircle = function doublecircle(parent, node) {
|
13362 | var _labelHelper14 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true),
|
13363 | shapeSvg = _labelHelper14.shapeSvg,
|
13364 | bbox = _labelHelper14.bbox,
|
13365 | halfPadding = _labelHelper14.halfPadding;
|
13366 |
|
13367 | var gap = 5;
|
13368 | var circleGroup = shapeSvg.insert('g', ':first-child');
|
13369 | var outerCircle = circleGroup.insert('circle');
|
13370 | var innerCircle = circleGroup.insert('circle'); // center the circle around its coordinate
|
13371 |
|
13372 | outerCircle.attr('style', node.style).attr('rx', node.rx).attr('ry', node.ry).attr('r', bbox.width / 2 + halfPadding + gap).attr('width', bbox.width + node.padding + gap * 2).attr('height', bbox.height + node.padding + gap * 2);
|
13373 | innerCircle.attr('style', node.style).attr('rx', node.rx).attr('ry', node.ry).attr('r', bbox.width / 2 + halfPadding).attr('width', bbox.width + node.padding).attr('height', bbox.height + node.padding);
|
13374 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('DoubleCircle main');
|
13375 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, outerCircle);
|
13376 |
|
13377 | node.intersect = function (point) {
|
13378 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('DoubleCircle intersect', node, bbox.width / 2 + halfPadding + gap, point);
|
13379 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].circle(node, bbox.width / 2 + halfPadding + gap, point);
|
13380 | };
|
13381 |
|
13382 | return shapeSvg;
|
13383 | };
|
13384 |
|
13385 | var subroutine = function subroutine(parent, node) {
|
13386 | var _labelHelper15 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.labelHelper)(parent, node, undefined, true),
|
13387 | shapeSvg = _labelHelper15.shapeSvg,
|
13388 | bbox = _labelHelper15.bbox;
|
13389 |
|
13390 | var w = bbox.width + node.padding;
|
13391 | var h = bbox.height + node.padding;
|
13392 | var points = [{
|
13393 | x: 0,
|
13394 | y: 0
|
13395 | }, {
|
13396 | x: w,
|
13397 | y: 0
|
13398 | }, {
|
13399 | x: w,
|
13400 | y: -h
|
13401 | }, {
|
13402 | x: 0,
|
13403 | y: -h
|
13404 | }, {
|
13405 | x: 0,
|
13406 | y: 0
|
13407 | }, {
|
13408 | x: -8,
|
13409 | y: 0
|
13410 | }, {
|
13411 | x: w + 8,
|
13412 | y: 0
|
13413 | }, {
|
13414 | x: w + 8,
|
13415 | y: -h
|
13416 | }, {
|
13417 | x: -8,
|
13418 | y: -h
|
13419 | }, {
|
13420 | x: -8,
|
13421 | y: 0
|
13422 | }];
|
13423 | var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.insertPolygonShape)(shapeSvg, w, h, points);
|
13424 | el.attr('style', node.style);
|
13425 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, el);
|
13426 |
|
13427 | node.intersect = function (point) {
|
13428 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].polygon(node, points, point);
|
13429 | };
|
13430 |
|
13431 | return shapeSvg;
|
13432 | };
|
13433 |
|
13434 | var start = function start(parent, node) {
|
13435 | var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
|
13436 | var circle = shapeSvg.insert('circle', ':first-child'); // center the circle around its coordinate
|
13437 |
|
13438 | circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);
|
13439 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, circle);
|
13440 |
|
13441 | node.intersect = function (point) {
|
13442 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].circle(node, 7, point);
|
13443 | };
|
13444 |
|
13445 | return shapeSvg;
|
13446 | };
|
13447 |
|
13448 | var forkJoin = function forkJoin(parent, node, dir) {
|
13449 | var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
|
13450 | var width = 70;
|
13451 | var height = 10;
|
13452 |
|
13453 | if (dir === 'LR') {
|
13454 | width = 10;
|
13455 | height = 70;
|
13456 | }
|
13457 |
|
13458 | var shape = shapeSvg.append('rect').attr('x', -1 * width / 2).attr('y', -1 * height / 2).attr('width', width).attr('height', height).attr('class', 'fork-join');
|
13459 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, shape);
|
13460 | node.height = node.height + node.padding / 2;
|
13461 | node.width = node.width + node.padding / 2;
|
13462 |
|
13463 | node.intersect = function (point) {
|
13464 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].rect(node, point);
|
13465 | };
|
13466 |
|
13467 | return shapeSvg;
|
13468 | };
|
13469 |
|
13470 | var end = function end(parent, node) {
|
13471 | var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
|
13472 | var innerCircle = shapeSvg.insert('circle', ':first-child');
|
13473 | var circle = shapeSvg.insert('circle', ':first-child');
|
13474 | circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);
|
13475 | innerCircle.attr('class', 'state-end').attr('r', 5).attr('width', 10).attr('height', 10);
|
13476 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, circle);
|
13477 |
|
13478 | node.intersect = function (point) {
|
13479 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].circle(node, 7, point);
|
13480 | };
|
13481 |
|
13482 | return shapeSvg;
|
13483 | };
|
13484 |
|
13485 | var class_box = function class_box(parent, node) {
|
13486 | var halfPadding = node.padding / 2;
|
13487 | var rowPadding = 4;
|
13488 | var lineHeight = 8;
|
13489 | var classes;
|
13490 |
|
13491 | if (!node.classes) {
|
13492 | classes = 'node default';
|
13493 | } else {
|
13494 | classes = 'node ' + node.classes;
|
13495 | } // Add outer g element
|
13496 |
|
13497 |
|
13498 | var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the title label and insert it after the rect
|
13499 |
|
13500 | var rect = shapeSvg.insert('rect', ':first-child');
|
13501 | var topLine = shapeSvg.insert('line');
|
13502 | var bottomLine = shapeSvg.insert('line');
|
13503 | var maxWidth = 0;
|
13504 | var maxHeight = rowPadding;
|
13505 | var labelContainer = shapeSvg.insert('g').attr('class', 'label');
|
13506 | var verticalPos = 0;
|
13507 | var hasInterface = node.classData.annotations && node.classData.annotations[0]; // 1. Create the labels
|
13508 |
|
13509 | var interfaceLabelText = node.classData.annotations[0] ? '«' + node.classData.annotations[0] + '»' : '';
|
13510 | var interfaceLabel = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_6__["default"])(interfaceLabelText, node.labelStyle, true, true));
|
13511 | var interfaceBBox = interfaceLabel.getBBox();
|
13512 |
|
13513 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) {
|
13514 | var div = interfaceLabel.children[0];
|
13515 | var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(interfaceLabel);
|
13516 | interfaceBBox = div.getBoundingClientRect();
|
13517 | dv.attr('width', interfaceBBox.width);
|
13518 | dv.attr('height', interfaceBBox.height);
|
13519 | }
|
13520 |
|
13521 | if (node.classData.annotations[0]) {
|
13522 | maxHeight += interfaceBBox.height + rowPadding;
|
13523 | maxWidth += interfaceBBox.width;
|
13524 | }
|
13525 |
|
13526 | var classTitleString = node.classData.id;
|
13527 |
|
13528 | if (node.classData.type !== undefined && node.classData.type !== '') {
|
13529 | if ((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels) {
|
13530 | classTitleString += '<' + node.classData.type + '>';
|
13531 | } else {
|
13532 | classTitleString += '<' + node.classData.type + '>';
|
13533 | }
|
13534 | }
|
13535 |
|
13536 | var classTitleLabel = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_6__["default"])(classTitleString, node.labelStyle, true, true));
|
13537 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(classTitleLabel).attr('class', 'classTitle');
|
13538 | var classTitleBBox = classTitleLabel.getBBox();
|
13539 |
|
13540 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) {
|
13541 | var _div2 = classTitleLabel.children[0];
|
13542 |
|
13543 | var _dv2 = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(classTitleLabel);
|
13544 |
|
13545 | classTitleBBox = _div2.getBoundingClientRect();
|
13546 |
|
13547 | _dv2.attr('width', classTitleBBox.width);
|
13548 |
|
13549 | _dv2.attr('height', classTitleBBox.height);
|
13550 | }
|
13551 |
|
13552 | maxHeight += classTitleBBox.height + rowPadding;
|
13553 |
|
13554 | if (classTitleBBox.width > maxWidth) {
|
13555 | maxWidth = classTitleBBox.width;
|
13556 | }
|
13557 |
|
13558 | var classAttributes = [];
|
13559 | node.classData.members.forEach(function (str) {
|
13560 | var parsedInfo = (0,_diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__.parseMember)(str);
|
13561 | var parsedText = parsedInfo.displayText;
|
13562 |
|
13563 | if ((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels) {
|
13564 | parsedText = parsedText.replace(/</g, '<').replace(/>/g, '>');
|
13565 | }
|
13566 |
|
13567 | var lbl = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_6__["default"])(parsedText, parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle, true, true));
|
13568 | var bbox = lbl.getBBox();
|
13569 |
|
13570 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) {
|
13571 | var _div3 = lbl.children[0];
|
13572 |
|
13573 | var _dv3 = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl);
|
13574 |
|
13575 | bbox = _div3.getBoundingClientRect();
|
13576 |
|
13577 | _dv3.attr('width', bbox.width);
|
13578 |
|
13579 | _dv3.attr('height', bbox.height);
|
13580 | }
|
13581 |
|
13582 | if (bbox.width > maxWidth) {
|
13583 | maxWidth = bbox.width;
|
13584 | }
|
13585 |
|
13586 | maxHeight += bbox.height + rowPadding;
|
13587 | classAttributes.push(lbl);
|
13588 | });
|
13589 | maxHeight += lineHeight;
|
13590 | var classMethods = [];
|
13591 | node.classData.methods.forEach(function (str) {
|
13592 | var parsedInfo = (0,_diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__.parseMember)(str);
|
13593 | var displayText = parsedInfo.displayText;
|
13594 |
|
13595 | if ((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels) {
|
13596 | displayText = displayText.replace(/</g, '<').replace(/>/g, '>');
|
13597 | }
|
13598 |
|
13599 | var lbl = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_6__["default"])(displayText, parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle, true, true));
|
13600 | var bbox = lbl.getBBox();
|
13601 |
|
13602 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) {
|
13603 | var _div4 = lbl.children[0];
|
13604 |
|
13605 | var _dv4 = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl);
|
13606 |
|
13607 | bbox = _div4.getBoundingClientRect();
|
13608 |
|
13609 | _dv4.attr('width', bbox.width);
|
13610 |
|
13611 | _dv4.attr('height', bbox.height);
|
13612 | }
|
13613 |
|
13614 | if (bbox.width > maxWidth) {
|
13615 | maxWidth = bbox.width;
|
13616 | }
|
13617 |
|
13618 | maxHeight += bbox.height + rowPadding;
|
13619 | classMethods.push(lbl);
|
13620 | });
|
13621 | maxHeight += lineHeight; // 2. Position the labels
|
13622 | // position the interface label
|
13623 |
|
13624 | if (hasInterface) {
|
13625 | var _diffX = (maxWidth - interfaceBBox.width) / 2;
|
13626 |
|
13627 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(interfaceLabel).attr('transform', 'translate( ' + (-1 * maxWidth / 2 + _diffX) + ', ' + -1 * maxHeight / 2 + ')');
|
13628 | verticalPos = interfaceBBox.height + rowPadding;
|
13629 | } // Position the class title label
|
13630 |
|
13631 |
|
13632 | var diffX = (maxWidth - classTitleBBox.width) / 2;
|
13633 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(classTitleLabel).attr('transform', 'translate( ' + (-1 * maxWidth / 2 + diffX) + ', ' + (-1 * maxHeight / 2 + verticalPos) + ')');
|
13634 | verticalPos += classTitleBBox.height + rowPadding;
|
13635 | topLine.attr('class', 'divider').attr('x1', -maxWidth / 2 - halfPadding).attr('x2', maxWidth / 2 + halfPadding).attr('y1', -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr('y2', -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
|
13636 | verticalPos += lineHeight;
|
13637 | classAttributes.forEach(function (lbl) {
|
13638 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl).attr('transform', 'translate( ' + -maxWidth / 2 + ', ' + (-1 * maxHeight / 2 + verticalPos + lineHeight / 2) + ')');
|
13639 | verticalPos += classTitleBBox.height + rowPadding;
|
13640 | });
|
13641 | verticalPos += lineHeight;
|
13642 | bottomLine.attr('class', 'divider').attr('x1', -maxWidth / 2 - halfPadding).attr('x2', maxWidth / 2 + halfPadding).attr('y1', -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr('y2', -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
|
13643 | verticalPos += lineHeight;
|
13644 | classMethods.forEach(function (lbl) {
|
13645 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl).attr('transform', 'translate( ' + -maxWidth / 2 + ', ' + (-1 * maxHeight / 2 + verticalPos) + ')');
|
13646 | verticalPos += classTitleBBox.height + rowPadding;
|
13647 | }); //
|
13648 | // let bbox;
|
13649 | // if (evaluate(getConfig().flowchart.htmlLabels)) {
|
13650 | // const div = interfaceLabel.children[0];
|
13651 | // const dv = select(interfaceLabel);
|
13652 | // bbox = div.getBoundingClientRect();
|
13653 | // dv.attr('width', bbox.width);
|
13654 | // dv.attr('height', bbox.height);
|
13655 | // }
|
13656 | // bbox = labelContainer.getBBox();
|
13657 | // log.info('Text 2', text2);
|
13658 | // const textRows = text2.slice(1, text2.length);
|
13659 | // let titleBox = text.getBBox();
|
13660 | // const descr = label
|
13661 | // .node()
|
13662 | // .appendChild(createLabel(textRows.join('<br/>'), node.labelStyle, true, true));
|
13663 | // if (evaluate(getConfig().flowchart.htmlLabels)) {
|
13664 | // const div = descr.children[0];
|
13665 | // const dv = select(descr);
|
13666 | // bbox = div.getBoundingClientRect();
|
13667 | // dv.attr('width', bbox.width);
|
13668 | // dv.attr('height', bbox.height);
|
13669 | // }
|
13670 | // // bbox = label.getBBox();
|
13671 | // // log.info(descr);
|
13672 | // select(descr).attr(
|
13673 | // 'transform',
|
13674 | // 'translate( ' +
|
13675 | // // (titleBox.width - bbox.width) / 2 +
|
13676 | // (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) +
|
13677 | // ', ' +
|
13678 | // (titleBox.height + halfPadding + 5) +
|
13679 | // ')'
|
13680 | // );
|
13681 | // select(text).attr(
|
13682 | // 'transform',
|
13683 | // 'translate( ' +
|
13684 | // // (titleBox.width - bbox.width) / 2 +
|
13685 | // (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) +
|
13686 | // ', ' +
|
13687 | // 0 +
|
13688 | // ')'
|
13689 | // );
|
13690 | // // Get the size of the label
|
13691 | // // Bounding box for title and text
|
13692 | // bbox = label.node().getBBox();
|
13693 | // // Center the label
|
13694 | // label.attr(
|
13695 | // 'transform',
|
13696 | // 'translate(' + -bbox.width / 2 + ', ' + (-bbox.height / 2 - halfPadding + 3) + ')'
|
13697 | // );
|
13698 |
|
13699 | rect.attr('class', 'outer title-state').attr('x', -maxWidth / 2 - halfPadding).attr('y', -(maxHeight / 2) - halfPadding).attr('width', maxWidth + node.padding).attr('height', maxHeight + node.padding); // innerLine
|
13700 | // .attr('class', 'divider')
|
13701 | // .attr('x1', -bbox.width / 2 - halfPadding)
|
13702 | // .attr('x2', bbox.width / 2 + halfPadding)
|
13703 | // .attr('y1', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding)
|
13704 | // .attr('y2', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
|
13705 |
|
13706 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, rect);
|
13707 |
|
13708 | node.intersect = function (point) {
|
13709 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_5__["default"].rect(node, point);
|
13710 | };
|
13711 |
|
13712 | return shapeSvg;
|
13713 | };
|
13714 |
|
13715 | var shapes = {
|
13716 | question: question,
|
13717 | rect: rect,
|
13718 | labelRect: labelRect,
|
13719 | rectWithTitle: rectWithTitle,
|
13720 | choice: choice,
|
13721 | circle: circle,
|
13722 | doublecircle: doublecircle,
|
13723 | stadium: stadium,
|
13724 | hexagon: hexagon,
|
13725 | rect_left_inv_arrow: rect_left_inv_arrow,
|
13726 | lean_right: lean_right,
|
13727 | lean_left: lean_left,
|
13728 | trapezoid: trapezoid,
|
13729 | inv_trapezoid: inv_trapezoid,
|
13730 | rect_right_inv_arrow: rect_right_inv_arrow,
|
13731 | cylinder: cylinder,
|
13732 | start: start,
|
13733 | end: end,
|
13734 | note: _shapes_note__WEBPACK_IMPORTED_MODULE_8__["default"],
|
13735 | subroutine: subroutine,
|
13736 | fork: forkJoin,
|
13737 | join: forkJoin,
|
13738 | class_box: class_box
|
13739 | };
|
13740 | var nodeElems = {};
|
13741 | var insertNode = function insertNode(elem, node, dir) {
|
13742 | var newEl;
|
13743 | var el; // Add link when appropriate
|
13744 |
|
13745 | if (node.link) {
|
13746 | var target;
|
13747 |
|
13748 | if ((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().securityLevel === 'sandbox') {
|
13749 | target = '_top';
|
13750 | } else if (node.linkTarget) {
|
13751 | target = node.linkTarget || '_blank';
|
13752 | }
|
13753 |
|
13754 | newEl = elem.insert('svg:a').attr('xlink:href', node.link).attr('target', target);
|
13755 | el = shapes[node.shape](newEl, node, dir);
|
13756 | } else {
|
13757 | el = shapes[node.shape](elem, node, dir);
|
13758 | newEl = el;
|
13759 | }
|
13760 |
|
13761 | if (node.tooltip) {
|
13762 | el.attr('title', node.tooltip);
|
13763 | }
|
13764 |
|
13765 | if (node.class) {
|
13766 | el.attr('class', 'node default ' + node.class);
|
13767 | }
|
13768 |
|
13769 | nodeElems[node.id] = newEl;
|
13770 |
|
13771 | if (node.haveCallback) {
|
13772 | nodeElems[node.id].attr('class', nodeElems[node.id].attr('class') + ' clickable');
|
13773 | }
|
13774 | };
|
13775 | var setNodeElem = function setNodeElem(elem, node) {
|
13776 | nodeElems[node.id] = elem;
|
13777 | };
|
13778 | var clear = function clear() {
|
13779 | nodeElems = {};
|
13780 | };
|
13781 | var positionNode = function positionNode(node) {
|
13782 | var el = nodeElems[node.id];
|
13783 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.trace('Transforming node', node.diff, node, 'translate(' + (node.x - node.width / 2 - 5) + ', ' + node.width / 2 + ')');
|
13784 | var padding = 8;
|
13785 | var diff = node.diff || 0;
|
13786 |
|
13787 | if (node.clusterNode) {
|
13788 | el.attr('transform', 'translate(' + (node.x + diff - node.width / 2) + ', ' + (node.y - node.height / 2 - padding) + ')');
|
13789 | } else {
|
13790 | el.attr('transform', 'translate(' + node.x + ', ' + node.y + ')');
|
13791 | }
|
13792 |
|
13793 | return diff;
|
13794 | };
|
13795 |
|
13796 | /***/ }),
|
13797 |
|
13798 | /***/ "./src/dagre-wrapper/shapes/note.js":
|
13799 | /*!******************************************!*\
|
13800 | !*** ./src/dagre-wrapper/shapes/note.js ***!
|
13801 | \******************************************/
|
13802 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
13803 |
|
13804 | "use strict";
|
13805 | __webpack_require__.r(__webpack_exports__);
|
13806 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
13807 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
13808 | /* harmony export */ });
|
13809 | /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "./src/dagre-wrapper/shapes/util.js");
|
13810 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
13811 | /* harmony import */ var _intersect_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../intersect/index.js */ "./src/dagre-wrapper/intersect/index.js");
|
13812 |
|
13813 | // eslint-disable-line
|
13814 |
|
13815 |
|
13816 |
|
13817 | var note = function note(parent, node) {
|
13818 | var _labelHelper = (0,_util__WEBPACK_IMPORTED_MODULE_0__.labelHelper)(parent, node, 'node ' + node.classes, true),
|
13819 | shapeSvg = _labelHelper.shapeSvg,
|
13820 | bbox = _labelHelper.bbox,
|
13821 | halfPadding = _labelHelper.halfPadding;
|
13822 |
|
13823 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Classes = ', node.classes); // add the rect
|
13824 |
|
13825 | var rect = shapeSvg.insert('rect', ':first-child');
|
13826 | rect.attr('rx', node.rx).attr('ry', node.ry).attr('x', -bbox.width / 2 - halfPadding).attr('y', -bbox.height / 2 - halfPadding).attr('width', bbox.width + node.padding).attr('height', bbox.height + node.padding);
|
13827 | (0,_util__WEBPACK_IMPORTED_MODULE_0__.updateNodeBounds)(node, rect);
|
13828 |
|
13829 | node.intersect = function (point) {
|
13830 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_2__["default"].rect(node, point);
|
13831 | };
|
13832 |
|
13833 | return shapeSvg;
|
13834 | };
|
13835 |
|
13836 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (note);
|
13837 |
|
13838 | /***/ }),
|
13839 |
|
13840 | /***/ "./src/dagre-wrapper/shapes/util.js":
|
13841 | /*!******************************************!*\
|
13842 | !*** ./src/dagre-wrapper/shapes/util.js ***!
|
13843 | \******************************************/
|
13844 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
13845 |
|
13846 | "use strict";
|
13847 | __webpack_require__.r(__webpack_exports__);
|
13848 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
13849 | /* harmony export */ "insertPolygonShape": () => (/* binding */ insertPolygonShape),
|
13850 | /* harmony export */ "labelHelper": () => (/* binding */ labelHelper),
|
13851 | /* harmony export */ "updateNodeBounds": () => (/* binding */ updateNodeBounds)
|
13852 | /* harmony export */ });
|
13853 | /* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../createLabel */ "./src/dagre-wrapper/createLabel.js");
|
13854 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
13855 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
13856 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
13857 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
13858 | /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../diagrams/common/common */ "./src/diagrams/common/common.js");
|
13859 |
|
13860 |
|
13861 |
|
13862 |
|
13863 |
|
13864 | var labelHelper = function labelHelper(parent, node, _classes, isNode) {
|
13865 | var classes;
|
13866 |
|
13867 | if (!_classes) {
|
13868 | classes = 'node default';
|
13869 | } else {
|
13870 | classes = _classes;
|
13871 | } // Add outer g element
|
13872 |
|
13873 |
|
13874 | var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the label and insert it after the rect
|
13875 |
|
13876 | var label = shapeSvg.insert('g').attr('class', 'label').attr('style', node.labelStyle);
|
13877 | var labelText = typeof node.labelText === 'string' ? node.labelText : node.labelText[0];
|
13878 | var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__.sanitizeText)((0,_mermaidAPI__WEBPACK_IMPORTED_MODULE_3__.decodeEntities)(labelText), (0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)()), node.labelStyle, false, isNode)); // Get the size of the label
|
13879 |
|
13880 | var bbox = text.getBBox();
|
13881 |
|
13882 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels)) {
|
13883 | var div = text.children[0];
|
13884 | var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text);
|
13885 | bbox = div.getBoundingClientRect();
|
13886 | dv.attr('width', bbox.width);
|
13887 | dv.attr('height', bbox.height);
|
13888 | }
|
13889 |
|
13890 | var halfPadding = node.padding / 2; // Center the label
|
13891 |
|
13892 | label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')');
|
13893 | return {
|
13894 | shapeSvg: shapeSvg,
|
13895 | bbox: bbox,
|
13896 | halfPadding: halfPadding,
|
13897 | label: label
|
13898 | };
|
13899 | };
|
13900 | var updateNodeBounds = function updateNodeBounds(node, element) {
|
13901 | var bbox = element.node().getBBox();
|
13902 | node.width = bbox.width;
|
13903 | node.height = bbox.height;
|
13904 | };
|
13905 | /**
|
13906 | * @param parent
|
13907 | * @param w
|
13908 | * @param h
|
13909 | * @param points
|
13910 | */
|
13911 |
|
13912 | function insertPolygonShape(parent, w, h, points) {
|
13913 | return parent.insert('polygon', ':first-child').attr('points', points.map(function (d) {
|
13914 | return d.x + ',' + d.y;
|
13915 | }).join(' ')).attr('class', 'label-container').attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');
|
13916 | }
|
13917 |
|
13918 | /***/ }),
|
13919 |
|
13920 | /***/ "./src/defaultConfig.js":
|
13921 | /*!******************************!*\
|
13922 | !*** ./src/defaultConfig.js ***!
|
13923 | \******************************/
|
13924 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
13925 |
|
13926 | "use strict";
|
13927 | __webpack_require__.r(__webpack_exports__);
|
13928 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
13929 | /* harmony export */ "configKeys": () => (/* binding */ configKeys),
|
13930 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
13931 | /* harmony export */ });
|
13932 | /* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
|
13933 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
13934 |
|
13935 | function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
13936 |
|
13937 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
13938 |
|
13939 | function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
13940 |
|
13941 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
13942 |
|
13943 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
13944 |
|
13945 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
13946 |
|
13947 |
|
13948 | /**
|
13949 | * **Configuration methods in Mermaid version 8.6.0 have been updated, to learn more[[click
|
13950 | * here](8.6.0_docs.md)].**
|
13951 | *
|
13952 | * ## **What follows are config instructions for older versions**
|
13953 | *
|
13954 | * These are the default options which can be overridden with the initialization call like so:
|
13955 | *
|
13956 | * **Example 1:**<pre> mermaid.initialize({ flowchart:{ htmlLabels: false } }); </pre>
|
13957 | *
|
13958 | * **Example 2:**<pre> <script> var config = { startOnLoad:true, flowchart:{ useMaxWidth:true,
|
13959 | * htmlLabels:true, curve:'cardinal', },
|
13960 | *
|
13961 | * securityLevel:'loose',
|
13962 | *
|
13963 | * }; mermaid.initialize(config); </script> </pre>
|
13964 | *
|
13965 | * A summary of all options and their defaults is found [here](#mermaidapi-configuration-defaults).
|
13966 | * A description of each option follows below.
|
13967 | *
|
13968 | * @name Configuration
|
13969 | */
|
13970 |
|
13971 | var config = {
|
13972 | /**
|
13973 | * Theme , the CSS style sheet
|
13974 | *
|
13975 | * | Parameter | Description | Type | Required | Values |
|
13976 | * | --------- | --------------- | ------ | -------- | ---------------------------------------------- |
|
13977 | * | theme | Built in Themes | string | Optional | 'default', 'forest', 'dark', 'neutral', 'null' |
|
13978 | *
|
13979 | * **Notes:** To disable any pre-defined mermaid theme, use "null".<pre> "theme": "forest",
|
13980 | * "themeCSS": ".node rect { fill: red; }" </pre>
|
13981 | */
|
13982 | theme: 'default',
|
13983 | themeVariables: _themes__WEBPACK_IMPORTED_MODULE_0__["default"]["default"].getThemeVariables(),
|
13984 | themeCSS: undefined,
|
13985 |
|
13986 | /* **maxTextSize** - The maximum allowed size of the users text diagram */
|
13987 | maxTextSize: 50000,
|
13988 | darkMode: false,
|
13989 |
|
13990 | /**
|
13991 | * | Parameter | Description | Type | Required | Values |
|
13992 | * | ---------- | ------------------------------------------------------ | ------ | -------- | --------------------------- |
|
13993 | * | fontFamily | specifies the font to be used in the rendered diagrams | string | Required | Any Possible CSS FontFamily |
|
13994 | *
|
13995 | * **Notes:** Default value: '"trebuchet ms", verdana, arial, sans-serif;'.
|
13996 | */
|
13997 | fontFamily: '"trebuchet ms", verdana, arial, sans-serif;',
|
13998 |
|
13999 | /**
|
14000 | * | Parameter | Description | Type | Required | Values |
|
14001 | * | --------- | ----------------------------------------------------- | ---------------- | -------- | ------------- |
|
14002 | * | logLevel | This option decides the amount of logging to be used. | string \| number | Required | 1, 2, 3, 4, 5 |
|
14003 | *
|
14004 | * **Notes:**
|
14005 | *
|
14006 | * - Debug: 1
|
14007 | * - Info: 2
|
14008 | * - Warn: 3
|
14009 | * - Error: 4
|
14010 | * - Fatal: 5 (default)
|
14011 | */
|
14012 | logLevel: 5,
|
14013 |
|
14014 | /**
|
14015 | * | Parameter | Description | Type | Required | Values |
|
14016 | * | ------------- | --------------------------------- | ------ | -------- | ------------------------------- |
|
14017 | * | securitylevel | Level of trust for parsed diagram | string | Required | 'strict', 'loose', 'antiscript' |
|
14018 | *
|
14019 | * **Notes**:
|
14020 | *
|
14021 | * - **strict**: (**default**) tags in text are encoded, click functionality is disabled
|
14022 | * - **loose**: tags in text are allowed, click functionality is enabled
|
14023 | * - **antiscript**: html tags in text are allowed, (only script element is removed), click
|
14024 | * functionality is enabled
|
14025 | */
|
14026 | securityLevel: 'strict',
|
14027 |
|
14028 | /**
|
14029 | * | Parameter | Description | Type | Required | Values |
|
14030 | * | ----------- | -------------------------------------------- | ------- | -------- | ----------- |
|
14031 | * | startOnLoad | Dictates whether mermaid starts on Page load | boolean | Required | true, false |
|
14032 | *
|
14033 | * **Notes:** Default value: true
|
14034 | */
|
14035 | startOnLoad: true,
|
14036 |
|
14037 | /**
|
14038 | * | Parameter | Description | Type | Required | Values |
|
14039 | * | ------------------- | ---------------------------------------------------------------------------- | ------- | -------- | ----------- |
|
14040 | * | arrowMarkerAbsolute | Controls whether or arrow markers in html code are absolute paths or anchors | boolean | Required | true, false |
|
14041 | *
|
14042 | * **Notes**:
|
14043 | *
|
14044 | * This matters if you are using base tag settings.
|
14045 | *
|
14046 | * Default value: false
|
14047 | */
|
14048 | arrowMarkerAbsolute: false,
|
14049 |
|
14050 | /**
|
14051 | * This option controls which currentConfig keys are considered _secure_ and can only be changed
|
14052 | * via call to mermaidAPI.initialize. Calls to mermaidAPI.reinitialize cannot make changes to the
|
14053 | * `secure` keys in the current currentConfig. This prevents malicious graph directives from
|
14054 | * overriding a site's default security.
|
14055 | *
|
14056 | * **Notes**:
|
14057 | *
|
14058 | * Default value: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']
|
14059 | */
|
14060 | secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize'],
|
14061 |
|
14062 | /**
|
14063 | * This option controls if the generated ids of nodes in the SVG are generated randomly or based
|
14064 | * on a seed. If set to false, the IDs are generated based on the current date and thus are not
|
14065 | * deterministic. This is the default behaviour.
|
14066 | *
|
14067 | * **Notes**:
|
14068 | *
|
14069 | * This matters if your files are checked into sourcecontrol e.g. git and should not change unless
|
14070 | * content is changed.
|
14071 | *
|
14072 | * Default value: false
|
14073 | */
|
14074 | deterministicIds: false,
|
14075 |
|
14076 | /**
|
14077 | * This option is the optional seed for deterministic ids. if set to undefined but
|
14078 | * deterministicIds is true, a simple number iterator is used. You can set this attribute to base
|
14079 | * the seed on a static string.
|
14080 | */
|
14081 | deterministicIDSeed: undefined,
|
14082 |
|
14083 | /** The object containing configurations specific for flowcharts */
|
14084 | flowchart: {
|
14085 | /**
|
14086 | * | Parameter | Description | Type | Required | Values |
|
14087 | * | -------------- | ----------------------------------------------- | ------- | -------- | ------------------ |
|
14088 | * | diagramPadding | Amount of padding around the diagram as a whole | Integer | Required | Any Positive Value |
|
14089 | *
|
14090 | * **Notes:**
|
14091 | *
|
14092 | * The amount of padding around the diagram as a whole so that embedded diagrams have margins,
|
14093 | * expressed in pixels
|
14094 | *
|
14095 | * Default value: 8
|
14096 | */
|
14097 | diagramPadding: 8,
|
14098 |
|
14099 | /**
|
14100 | * | Parameter | Description | Type | Required | Values |
|
14101 | * | ---------- | -------------------------------------------------------------------------------------------- | ------- | -------- | ----------- |
|
14102 | * | htmlLabels | Flag for setting whether or not a html tag should be used for rendering labels on the edges. | boolean | Required | true, false |
|
14103 | *
|
14104 | * **Notes:** Default value: true.
|
14105 | */
|
14106 | htmlLabels: true,
|
14107 |
|
14108 | /**
|
14109 | * | Parameter | Description | Type | Required | Values |
|
14110 | * | ----------- | --------------------------------------------------- | ------- | -------- | ------------------- |
|
14111 | * | nodeSpacing | Defines the spacing between nodes on the same level | Integer | Required | Any positive Number |
|
14112 | *
|
14113 | * **Notes:**
|
14114 | *
|
14115 | * Pertains to horizontal spacing for TB (top to bottom) or BT (bottom to top) graphs, and the
|
14116 | * vertical spacing for LR as well as RL graphs.**
|
14117 | *
|
14118 | * Default value: 50
|
14119 | */
|
14120 | nodeSpacing: 50,
|
14121 |
|
14122 | /**
|
14123 | * | Parameter | Description | Type | Required | Values |
|
14124 | * | ----------- | ----------------------------------------------------- | ------- | -------- | ------------------- |
|
14125 | * | rankSpacing | Defines the spacing between nodes on different levels | Integer | Required | Any Positive Number |
|
14126 | *
|
14127 | * **Notes**:
|
14128 | *
|
14129 | * Pertains to vertical spacing for TB (top to bottom) or BT (bottom to top), and the horizontal
|
14130 | * spacing for LR as well as RL graphs.
|
14131 | *
|
14132 | * Default value 50
|
14133 | */
|
14134 | rankSpacing: 50,
|
14135 |
|
14136 | /**
|
14137 | * | Parameter | Description | Type | Required | Values |
|
14138 | * | --------- | -------------------------------------------------- | ------ | -------- | ----------------------------- |
|
14139 | * | curve | Defines how mermaid renders curves for flowcharts. | string | Required | 'basis', 'linear', 'cardinal' |
|
14140 | *
|
14141 | * **Notes:**
|
14142 | *
|
14143 | * Default Value: 'basis'
|
14144 | */
|
14145 | curve: 'basis',
|
14146 | // Only used in new experimental rendering
|
14147 | // represents the padding between the labels and the shape
|
14148 | padding: 15,
|
14149 |
|
14150 | /**
|
14151 | * | Parameter | Description | Type | Required | Values |
|
14152 | * | ----------- | ----------- | ------- | -------- | ----------- |
|
14153 | * | useMaxWidth | See notes | boolean | 4 | true, false |
|
14154 | *
|
14155 | * **Notes:**
|
14156 | *
|
14157 | * When this flag is set the height and width is set to 100% and is then scaling with the
|
14158 | * available space if not the absolute space required is used.
|
14159 | *
|
14160 | * Default value: true
|
14161 | */
|
14162 | useMaxWidth: true,
|
14163 |
|
14164 | /**
|
14165 | * | Parameter | Description | Type | Required | Values |
|
14166 | * | --------------- | ----------- | ------- | -------- | ----------------------- |
|
14167 | * | defaultRenderer | See notes | boolean | 4 | dagre-d3, dagre-wrapper |
|
14168 | *
|
14169 | * **Notes:**
|
14170 | *
|
14171 | * Decides which rendering engine that is to be used for the rendering. Legal values are:
|
14172 | * dagre-d3 dagre-wrapper - wrapper for dagre implemented in mermaid
|
14173 | *
|
14174 | * Default value: 'dagre-d3'
|
14175 | */
|
14176 | defaultRenderer: 'dagre-d3'
|
14177 | },
|
14178 |
|
14179 | /** The object containing configurations specific for sequence diagrams */
|
14180 | sequence: {
|
14181 | hideUnusedParticipants: false,
|
14182 |
|
14183 | /**
|
14184 | * | Parameter | Description | Type | Required | Values |
|
14185 | * | --------------- | ---------------------------- | ------- | -------- | ------------------ |
|
14186 | * | activationWidth | Width of the activation rect | Integer | Required | Any Positive Value |
|
14187 | *
|
14188 | * **Notes:** Default value :10
|
14189 | */
|
14190 | activationWidth: 10,
|
14191 |
|
14192 | /**
|
14193 | * | Parameter | Description | Type | Required | Values |
|
14194 | * | -------------- | ---------------------------------------------------- | ------- | -------- | ------------------ |
|
14195 | * | diagramMarginX | Margin to the right and left of the sequence diagram | Integer | Required | Any Positive Value |
|
14196 | *
|
14197 | * **Notes:** Default value: 50
|
14198 | */
|
14199 | diagramMarginX: 50,
|
14200 |
|
14201 | /**
|
14202 | * | Parameter | Description | Type | Required | Values |
|
14203 | * | -------------- | ------------------------------------------------- | ------- | -------- | ------------------ |
|
14204 | * | diagramMarginY | Margin to the over and under the sequence diagram | Integer | Required | Any Positive Value |
|
14205 | *
|
14206 | * **Notes:** Default value: 10
|
14207 | */
|
14208 | diagramMarginY: 10,
|
14209 |
|
14210 | /**
|
14211 | * | Parameter | Description | Type | Required | Values |
|
14212 | * | ----------- | --------------------- | ------- | -------- | ------------------ |
|
14213 | * | actorMargin | Margin between actors | Integer | Required | Any Positive Value |
|
14214 | *
|
14215 | * **Notes:** Default value: 50
|
14216 | */
|
14217 | actorMargin: 50,
|
14218 |
|
14219 | /**
|
14220 | * | Parameter | Description | Type | Required | Values |
|
14221 | * | --------- | -------------------- | ------- | -------- | ------------------ |
|
14222 | * | width | Width of actor boxes | Integer | Required | Any Positive Value |
|
14223 | *
|
14224 | * **Notes:** Default value: 150
|
14225 | */
|
14226 | width: 150,
|
14227 |
|
14228 | /**
|
14229 | * | Parameter | Description | Type | Required | Values |
|
14230 | * | --------- | --------------------- | ------- | -------- | ------------------ |
|
14231 | * | height | Height of actor boxes | Integer | Required | Any Positive Value |
|
14232 | *
|
14233 | * **Notes:** Default value: 65
|
14234 | */
|
14235 | height: 65,
|
14236 |
|
14237 | /**
|
14238 | * | Parameter | Description | Type | Required | Values |
|
14239 | * | --------- | ------------------------ | ------- | -------- | ------------------ |
|
14240 | * | boxMargin | Margin around loop boxes | Integer | Required | Any Positive Value |
|
14241 | *
|
14242 | * **Notes:** Default value: 10
|
14243 | */
|
14244 | boxMargin: 10,
|
14245 |
|
14246 | /**
|
14247 | * | Parameter | Description | Type | Required | Values |
|
14248 | * | ------------- | -------------------------------------------- | ------- | -------- | ------------------ |
|
14249 | * | boxTextMargin | Margin around the text in loop/alt/opt boxes | Integer | Required | Any Positive Value |
|
14250 | *
|
14251 | * **Notes:** Default value: 5
|
14252 | */
|
14253 | boxTextMargin: 5,
|
14254 |
|
14255 | /**
|
14256 | * | Parameter | Description | Type | Required | Values |
|
14257 | * | ---------- | ------------------- | ------- | -------- | ------------------ |
|
14258 | * | noteMargin | margin around notes | Integer | Required | Any Positive Value |
|
14259 | *
|
14260 | * **Notes:** Default value: 10
|
14261 | */
|
14262 | noteMargin: 10,
|
14263 |
|
14264 | /**
|
14265 | * | Parameter | Description | Type | Required | Values |
|
14266 | * | ------------- | ---------------------- | ------- | -------- | ------------------ |
|
14267 | * | messageMargin | Space between messages | Integer | Required | Any Positive Value |
|
14268 | *
|
14269 | * **Notes:** Default value: 35
|
14270 | */
|
14271 | messageMargin: 35,
|
14272 |
|
14273 | /**
|
14274 | * | Parameter | Description | Type | Required | Values |
|
14275 | * | ------------ | --------------------------- | ------ | -------- | ------------------------- |
|
14276 | * | messageAlign | Multiline message alignment | string | Required | 'left', 'center', 'right' |
|
14277 | *
|
14278 | * **Notes:** Default value: 'center'
|
14279 | */
|
14280 | messageAlign: 'center',
|
14281 |
|
14282 | /**
|
14283 | * | Parameter | Description | Type | Required | Values |
|
14284 | * | ------------ | --------------------------- | ------- | -------- | ----------- |
|
14285 | * | mirrorActors | Mirror actors under diagram | boolean | Required | true, false |
|
14286 | *
|
14287 | * **Notes:** Default value: true
|
14288 | */
|
14289 | mirrorActors: true,
|
14290 |
|
14291 | /**
|
14292 | * | Parameter | Description | Type | Required | Values |
|
14293 | * | ---------- | ----------------------------------------------------------------------- | ------- | -------- | ----------- |
|
14294 | * | forceMenus | forces actor popup menus to always be visible (to support E2E testing). | Boolean | Required | True, False |
|
14295 | *
|
14296 | * **Notes:**
|
14297 | *
|
14298 | * Default value: false.
|
14299 | */
|
14300 | forceMenus: false,
|
14301 |
|
14302 | /**
|
14303 | * | Parameter | Description | Type | Required | Values |
|
14304 | * | --------------- | ------------------------------------------ | ------- | -------- | ------------------ |
|
14305 | * | bottomMarginAdj | Prolongs the edge of the diagram downwards | Integer | Required | Any Positive Value |
|
14306 | *
|
14307 | * **Notes:**
|
14308 | *
|
14309 | * Depending on css styling this might need adjustment.
|
14310 | *
|
14311 | * Default value: 1
|
14312 | */
|
14313 | bottomMarginAdj: 1,
|
14314 |
|
14315 | /**
|
14316 | * | Parameter | Description | Type | Required | Values |
|
14317 | * | ----------- | ----------- | ------- | -------- | ----------- |
|
14318 | * | useMaxWidth | See Notes | boolean | Required | true, false |
|
14319 | *
|
14320 | * **Notes:** When this flag is set to true, the height and width is set to 100% and is then
|
14321 | * scaling with the available space. If set to false, the absolute space required is used.
|
14322 | *
|
14323 | * Default value: true
|
14324 | */
|
14325 | useMaxWidth: true,
|
14326 |
|
14327 | /**
|
14328 | * | Parameter | Description | Type | Required | Values |
|
14329 | * | ----------- | ------------------------------------ | ------- | -------- | ----------- |
|
14330 | * | rightAngles | display curve arrows as right angles | boolean | Required | true, false |
|
14331 | *
|
14332 | * **Notes:**
|
14333 | *
|
14334 | * This will display arrows that start and begin at the same node as right angles, rather than a curve
|
14335 | *
|
14336 | * Default value: false
|
14337 | */
|
14338 | rightAngles: false,
|
14339 |
|
14340 | /**
|
14341 | * | Parameter | Description | Type | Required | Values |
|
14342 | * | ------------------- | ------------------------------- | ------- | -------- | ----------- |
|
14343 | * | showSequenceNumbers | This will show the node numbers | boolean | Required | true, false |
|
14344 | *
|
14345 | * **Notes:** Default value: false
|
14346 | */
|
14347 | showSequenceNumbers: false,
|
14348 |
|
14349 | /**
|
14350 | * | Parameter | Description | Type | Required | Values |
|
14351 | * | ------------- | -------------------------------------------------- | ------- | -------- | ------------------ |
|
14352 | * | actorFontSize | This sets the font size of the actor's description | Integer | Require | Any Positive Value |
|
14353 | *
|
14354 | * **Notes:** **Default value 14**..
|
14355 | */
|
14356 | actorFontSize: 14,
|
14357 |
|
14358 | /**
|
14359 | * | Parameter | Description | Type | Required | Values |
|
14360 | * | --------------- | ---------------------------------------------------- | ------ | -------- | --------------------------- |
|
14361 | * | actorFontFamily | This sets the font family of the actor's description | string | Required | Any Possible CSS FontFamily |
|
14362 | *
|
14363 | * **Notes:** Default value: "'Open Sans", sans-serif'
|
14364 | */
|
14365 | actorFontFamily: '"Open Sans", sans-serif',
|
14366 |
|
14367 | /**
|
14368 | * This sets the font weight of the actor's description
|
14369 | *
|
14370 | * **Notes:** Default value: 400.
|
14371 | */
|
14372 | actorFontWeight: 400,
|
14373 |
|
14374 | /**
|
14375 | * | Parameter | Description | Type | Required | Values |
|
14376 | * | ------------ | ----------------------------------------------- | ------- | -------- | ------------------ |
|
14377 | * | noteFontSize | This sets the font size of actor-attached notes | Integer | Required | Any Positive Value |
|
14378 | *
|
14379 | * **Notes:** Default value: 14
|
14380 | */
|
14381 | noteFontSize: 14,
|
14382 |
|
14383 | /**
|
14384 | * | Parameter | Description | Type | Required | Values |
|
14385 | * | -------------- | -------------------------------------------------- | ------ | -------- | --------------------------- |
|
14386 | * | noteFontFamily | This sets the font family of actor-attached notes. | string | Required | Any Possible CSS FontFamily |
|
14387 | *
|
14388 | * **Notes:** Default value: ''"trebuchet ms", verdana, arial, sans-serif'
|
14389 | */
|
14390 | noteFontFamily: '"trebuchet ms", verdana, arial, sans-serif',
|
14391 |
|
14392 | /**
|
14393 | * This sets the font weight of the note's description
|
14394 | *
|
14395 | * **Notes:** Default value: 400
|
14396 | */
|
14397 | noteFontWeight: 400,
|
14398 |
|
14399 | /**
|
14400 | * | Parameter | Description | Type | Required | Values |
|
14401 | * | --------- | ---------------------------------------------------- | ------ | -------- | ------------------------- |
|
14402 | * | noteAlign | This sets the text alignment of actor-attached notes | string | required | 'left', 'center', 'right' |
|
14403 | *
|
14404 | * **Notes:** Default value: 'center'
|
14405 | */
|
14406 | noteAlign: 'center',
|
14407 |
|
14408 | /**
|
14409 | * | Parameter | Description | Type | Required | Values |
|
14410 | * | --------------- | ----------------------------------------- | ------- | -------- | ------------------- |
|
14411 | * | messageFontSize | This sets the font size of actor messages | Integer | Required | Any Positive Number |
|
14412 | *
|
14413 | * **Notes:** Default value: 16
|
14414 | */
|
14415 | messageFontSize: 16,
|
14416 |
|
14417 | /**
|
14418 | * | Parameter | Description | Type | Required | Values |
|
14419 | * | ----------------- | ------------------------------------------- | ------ | -------- | --------------------------- |
|
14420 | * | messageFontFamily | This sets the font family of actor messages | string | Required | Any Possible CSS FontFamily |
|
14421 | *
|
14422 | * **Notes:** Default value: '"trebuchet ms", verdana, arial, sans-serif'
|
14423 | */
|
14424 | messageFontFamily: '"trebuchet ms", verdana, arial, sans-serif',
|
14425 |
|
14426 | /**
|
14427 | * This sets the font weight of the message's description
|
14428 | *
|
14429 | * **Notes:** Default value: 400.
|
14430 | */
|
14431 | messageFontWeight: 400,
|
14432 |
|
14433 | /**
|
14434 | * This sets the auto-wrap state for the diagram
|
14435 | *
|
14436 | * **Notes:** Default value: false.
|
14437 | */
|
14438 | wrap: false,
|
14439 |
|
14440 | /**
|
14441 | * This sets the auto-wrap padding for the diagram (sides only)
|
14442 | *
|
14443 | * **Notes:** Default value: 0.
|
14444 | */
|
14445 | wrapPadding: 10,
|
14446 |
|
14447 | /**
|
14448 | * This sets the width of the loop-box (loop, alt, opt, par)
|
14449 | *
|
14450 | * **Notes:** Default value: 50.
|
14451 | */
|
14452 | labelBoxWidth: 50,
|
14453 |
|
14454 | /**
|
14455 | * This sets the height of the loop-box (loop, alt, opt, par)
|
14456 | *
|
14457 | * **Notes:** Default value: 20.
|
14458 | */
|
14459 | labelBoxHeight: 20,
|
14460 | messageFont: function messageFont() {
|
14461 | return {
|
14462 | fontFamily: this.messageFontFamily,
|
14463 | fontSize: this.messageFontSize,
|
14464 | fontWeight: this.messageFontWeight
|
14465 | };
|
14466 | },
|
14467 | noteFont: function noteFont() {
|
14468 | return {
|
14469 | fontFamily: this.noteFontFamily,
|
14470 | fontSize: this.noteFontSize,
|
14471 | fontWeight: this.noteFontWeight
|
14472 | };
|
14473 | },
|
14474 | actorFont: function actorFont() {
|
14475 | return {
|
14476 | fontFamily: this.actorFontFamily,
|
14477 | fontSize: this.actorFontSize,
|
14478 | fontWeight: this.actorFontWeight
|
14479 | };
|
14480 | }
|
14481 | },
|
14482 |
|
14483 | /** The object containing configurations specific for gantt diagrams */
|
14484 | gantt: {
|
14485 | /**
|
14486 | * ### titleTopMargin
|
14487 | *
|
14488 | * | Parameter | Description | Type | Required | Values |
|
14489 | * | -------------- | ---------------------------------------------- | ------- | -------- | ------------------ |
|
14490 | * | titleTopMargin | Margin top for the text over the gantt diagram | Integer | Required | Any Positive Value |
|
14491 | *
|
14492 | * **Notes:** Default value: 25
|
14493 | */
|
14494 | titleTopMargin: 25,
|
14495 |
|
14496 | /**
|
14497 | * | Parameter | Description | Type | Required | Values |
|
14498 | * | --------- | ----------------------------------- | ------- | -------- | ------------------ |
|
14499 | * | barHeight | The height of the bars in the graph | Integer | Required | Any Positive Value |
|
14500 | *
|
14501 | * **Notes:** Default value: 20
|
14502 | */
|
14503 | barHeight: 20,
|
14504 |
|
14505 | /**
|
14506 | * | Parameter | Description | Type | Required | Values |
|
14507 | * | --------- | ---------------------------------------------------------------- | ------- | -------- | ------------------ |
|
14508 | * | barGap | The margin between the different activities in the gantt diagram | Integer | Optional | Any Positive Value |
|
14509 | *
|
14510 | * **Notes:** Default value: 4
|
14511 | */
|
14512 | barGap: 4,
|
14513 |
|
14514 | /**
|
14515 | * | Parameter | Description | Type | Required | Values |
|
14516 | * | ---------- | -------------------------------------------------------------------------- | ------- | -------- | ------------------ |
|
14517 | * | topPadding | Margin between title and gantt diagram and between axis and gantt diagram. | Integer | Required | Any Positive Value |
|
14518 | *
|
14519 | * **Notes:** Default value: 50
|
14520 | */
|
14521 | topPadding: 50,
|
14522 |
|
14523 | /**
|
14524 | * | Parameter | Description | Type | Required | Values |
|
14525 | * | ------------ | ----------------------------------------------------------------------- | ------- | -------- | ------------------ |
|
14526 | * | rightPadding | The space allocated for the section name to the right of the activities | Integer | Required | Any Positive Value |
|
14527 | *
|
14528 | * **Notes:** Default value: 75
|
14529 | */
|
14530 | rightPadding: 75,
|
14531 |
|
14532 | /**
|
14533 | * | Parameter | Description | Type | Required | Values |
|
14534 | * | ----------- | ---------------------------------------------------------------------- | ------- | -------- | ------------------ |
|
14535 | * | leftPadding | The space allocated for the section name to the left of the activities | Integer | Required | Any Positive Value |
|
14536 | *
|
14537 | * **Notes:** Default value: 75
|
14538 | */
|
14539 | leftPadding: 75,
|
14540 |
|
14541 | /**
|
14542 | * | Parameter | Description | Type | Required | Values |
|
14543 | * | -------------------- | -------------------------------------------- | ------- | -------- | ------------------ |
|
14544 | * | gridLineStartPadding | Vertical starting position of the grid lines | Integer | Required | Any Positive Value |
|
14545 | *
|
14546 | * **Notes:** Default value: 35
|
14547 | */
|
14548 | gridLineStartPadding: 35,
|
14549 |
|
14550 | /**
|
14551 | * | Parameter | Description | Type | Required | Values |
|
14552 | * | --------- | ----------- | ------- | -------- | ------------------ |
|
14553 | * | fontSize | Font size | Integer | Required | Any Positive Value |
|
14554 | *
|
14555 | * **Notes:** Default value: 11
|
14556 | */
|
14557 | fontSize: 11,
|
14558 |
|
14559 | /**
|
14560 | * | Parameter | Description | Type | Required | Values |
|
14561 | * | --------------- | ---------------------- | ------- | -------- | ------------------ |
|
14562 | * | sectionFontSize | Font size for sections | Integer | Required | Any Positive Value |
|
14563 | *
|
14564 | * **Notes:** Default value: 11
|
14565 | */
|
14566 | sectionFontSize: 11,
|
14567 |
|
14568 | /**
|
14569 | * | Parameter | Description | Type | Required | Values |
|
14570 | * | ------------------- | ---------------------------------------- | ------- | -------- | ------------------ |
|
14571 | * | numberSectionStyles | The number of alternating section styles | Integer | 4 | Any Positive Value |
|
14572 | *
|
14573 | * **Notes:** Default value: 4
|
14574 | */
|
14575 | numberSectionStyles: 4,
|
14576 |
|
14577 | /**
|
14578 | * | Parameter | Description | Type | Required | Values |
|
14579 | * | ---------- | --------------------------- | ---- | -------- | ---------------- |
|
14580 | * | axisFormat | Datetime format of the axis | 3 | Required | Date in yy-mm-dd |
|
14581 | *
|
14582 | * **Notes:**
|
14583 | *
|
14584 | * This might need adjustment to match your locale and preferences
|
14585 | *
|
14586 | * Default value: '%Y-%m-%d'.
|
14587 | */
|
14588 | axisFormat: '%Y-%m-%d',
|
14589 |
|
14590 | /**
|
14591 | * | Parameter | Description | Type | Required | Values |
|
14592 | * | ----------- | ----------- | ------- | -------- | ----------- |
|
14593 | * | useMaxWidth | See notes | boolean | 4 | true, false |
|
14594 | *
|
14595 | * **Notes:**
|
14596 | *
|
14597 | * When this flag is set the height and width is set to 100% and is then scaling with the
|
14598 | * available space if not the absolute space required is used.
|
14599 | *
|
14600 | * Default value: true
|
14601 | */
|
14602 | useMaxWidth: true,
|
14603 |
|
14604 | /**
|
14605 | * | Parameter | Description | Type | Required | Values |
|
14606 | * | --------- | ----------- | ------- | -------- | ----------- |
|
14607 | * | topAxis | See notes | Boolean | 4 | True, False |
|
14608 | *
|
14609 | * **Notes:** when this flag is set date labels will be added to the top of the chart
|
14610 | *
|
14611 | * **Default value false**.
|
14612 | */
|
14613 | topAxis: false,
|
14614 | useWidth: undefined
|
14615 | },
|
14616 |
|
14617 | /** The object containing configurations specific for journey diagrams */
|
14618 | journey: {
|
14619 | /**
|
14620 | * | Parameter | Description | Type | Required | Values |
|
14621 | * | -------------- | ---------------------------------------------------- | ------- | -------- | ------------------ |
|
14622 | * | diagramMarginX | Margin to the right and left of the sequence diagram | Integer | Required | Any Positive Value |
|
14623 | *
|
14624 | * **Notes:** Default value: 50
|
14625 | */
|
14626 | diagramMarginX: 50,
|
14627 |
|
14628 | /**
|
14629 | * | Parameter | Description | Type | Required | Values |
|
14630 | * | -------------- | -------------------------------------------------- | ------- | -------- | ------------------ |
|
14631 | * | diagramMarginY | Margin to the over and under the sequence diagram. | Integer | Required | Any Positive Value |
|
14632 | *
|
14633 | * **Notes:** Default value: 10
|
14634 | */
|
14635 | diagramMarginY: 10,
|
14636 |
|
14637 | /**
|
14638 | * | Parameter | Description | Type | Required | Values |
|
14639 | * | ----------- | --------------------- | ------- | -------- | ------------------ |
|
14640 | * | actorMargin | Margin between actors | Integer | Required | Any Positive Value |
|
14641 | *
|
14642 | * **Notes:** Default value: 50
|
14643 | */
|
14644 | leftMargin: 150,
|
14645 |
|
14646 | /**
|
14647 | * | Parameter | Description | Type | Required | Values |
|
14648 | * | --------- | -------------------- | ------- | -------- | ------------------ |
|
14649 | * | width | Width of actor boxes | Integer | Required | Any Positive Value |
|
14650 | *
|
14651 | * **Notes:** Default value: 150
|
14652 | */
|
14653 | width: 150,
|
14654 |
|
14655 | /**
|
14656 | * | Parameter | Description | Type | Required | Values |
|
14657 | * | --------- | --------------------- | ------- | -------- | ------------------ |
|
14658 | * | height | Height of actor boxes | Integer | Required | Any Positive Value |
|
14659 | *
|
14660 | * **Notes:** Default value: 65
|
14661 | */
|
14662 | height: 50,
|
14663 |
|
14664 | /**
|
14665 | * | Parameter | Description | Type | Required | Values |
|
14666 | * | --------- | ------------------------ | ------- | -------- | ------------------ |
|
14667 | * | boxMargin | Margin around loop boxes | Integer | Required | Any Positive Value |
|
14668 | *
|
14669 | * **Notes:** Default value: 10
|
14670 | */
|
14671 | boxMargin: 10,
|
14672 |
|
14673 | /**
|
14674 | * | Parameter | Description | Type | Required | Values |
|
14675 | * | ------------- | -------------------------------------------- | ------- | -------- | ------------------ |
|
14676 | * | boxTextMargin | Margin around the text in loop/alt/opt boxes | Integer | Required | Any Positive Value |
|
14677 | *
|
14678 | * **Notes:** Default value: 5
|
14679 | */
|
14680 | boxTextMargin: 5,
|
14681 |
|
14682 | /**
|
14683 | * | Parameter | Description | Type | Required | Values |
|
14684 | * | ---------- | ------------------- | ------- | -------- | ------------------ |
|
14685 | * | noteMargin | Margin around notes | Integer | Required | Any Positive Value |
|
14686 | *
|
14687 | * **Notes:** Default value: 10
|
14688 | */
|
14689 | noteMargin: 10,
|
14690 |
|
14691 | /**
|
14692 | * | Parameter | Description | Type | Required | Values |
|
14693 | * | ------------- | ----------------------- | ------- | -------- | ------------------ |
|
14694 | * | messageMargin | Space between messages. | Integer | Required | Any Positive Value |
|
14695 | *
|
14696 | * **Notes:**
|
14697 | *
|
14698 | * Space between messages.
|
14699 | *
|
14700 | * Default value: 35
|
14701 | */
|
14702 | messageMargin: 35,
|
14703 |
|
14704 | /**
|
14705 | * | Parameter | Description | Type | Required | Values |
|
14706 | * | ------------ | --------------------------- | ---- | -------- | ------------------------- |
|
14707 | * | messageAlign | Multiline message alignment | 3 | 4 | 'left', 'center', 'right' |
|
14708 | *
|
14709 | * **Notes:** Default value: 'center'
|
14710 | */
|
14711 | messageAlign: 'center',
|
14712 |
|
14713 | /**
|
14714 | * | Parameter | Description | Type | Required | Values |
|
14715 | * | --------------- | ------------------------------------------ | ------- | -------- | ------------------ |
|
14716 | * | bottomMarginAdj | Prolongs the edge of the diagram downwards | Integer | 4 | Any Positive Value |
|
14717 | *
|
14718 | * **Notes:**
|
14719 | *
|
14720 | * Depending on css styling this might need adjustment.
|
14721 | *
|
14722 | * Default value: 1
|
14723 | */
|
14724 | bottomMarginAdj: 1,
|
14725 |
|
14726 | /**
|
14727 | * | Parameter | Description | Type | Required | Values |
|
14728 | * | ----------- | ----------- | ------- | -------- | ----------- |
|
14729 | * | useMaxWidth | See notes | boolean | 4 | true, false |
|
14730 | *
|
14731 | * **Notes:**
|
14732 | *
|
14733 | * When this flag is set the height and width is set to 100% and is then scaling with the
|
14734 | * available space if not the absolute space required is used.
|
14735 | *
|
14736 | * Default value: true
|
14737 | */
|
14738 | useMaxWidth: true,
|
14739 |
|
14740 | /**
|
14741 | * | Parameter | Description | Type | Required | Values |
|
14742 | * | ----------- | --------------------------------- | ---- | -------- | ----------- |
|
14743 | * | rightAngles | Curved Arrows become Right Angles | 3 | 4 | true, false |
|
14744 | *
|
14745 | * **Notes:**
|
14746 | *
|
14747 | * This will display arrows that start and begin at the same node as right angles, rather than a curves
|
14748 | *
|
14749 | * Default value: false
|
14750 | */
|
14751 | rightAngles: false,
|
14752 | taskFontSize: 14,
|
14753 | taskFontFamily: '"Open Sans", sans-serif',
|
14754 | taskMargin: 50,
|
14755 | // width of activation box
|
14756 | activationWidth: 10,
|
14757 | // text placement as: tspan | fo | old only text as before
|
14758 | textPlacement: 'fo',
|
14759 | actorColours: ['#8FBC8F', '#7CFC00', '#00FFFF', '#20B2AA', '#B0E0E6', '#FFFFE0'],
|
14760 | sectionFills: ['#191970', '#8B008B', '#4B0082', '#2F4F4F', '#800000', '#8B4513', '#00008B'],
|
14761 | sectionColours: ['#fff']
|
14762 | },
|
14763 | class: {
|
14764 | arrowMarkerAbsolute: false,
|
14765 | dividerMargin: 10,
|
14766 | padding: 5,
|
14767 | textHeight: 10,
|
14768 |
|
14769 | /**
|
14770 | * | Parameter | Description | Type | Required | Values |
|
14771 | * | ----------- | ----------- | ------- | -------- | ----------- |
|
14772 | * | useMaxWidth | See notes | boolean | 4 | true, false |
|
14773 | *
|
14774 | * **Notes:**
|
14775 | *
|
14776 | * When this flag is set the height and width is set to 100% and is then scaling with the
|
14777 | * available space if not the absolute space required is used.
|
14778 | *
|
14779 | * Default value: true
|
14780 | */
|
14781 | useMaxWidth: true,
|
14782 |
|
14783 | /**
|
14784 | * | Parameter | Description | Type | Required | Values |
|
14785 | * | --------------- | ----------- | ------- | -------- | ----------------------- |
|
14786 | * | defaultRenderer | See notes | boolean | 4 | dagre-d3, dagre-wrapper |
|
14787 | *
|
14788 | * **Notes**:
|
14789 | *
|
14790 | * Decides which rendering engine that is to be used for the rendering. Legal values are:
|
14791 | * dagre-d3 dagre-wrapper - wrapper for dagre implemented in mermaid
|
14792 | *
|
14793 | * Default value: 'dagre-d3'
|
14794 | */
|
14795 | defaultRenderer: 'dagre-wrapper'
|
14796 | },
|
14797 | state: {
|
14798 | dividerMargin: 10,
|
14799 | sizeUnit: 5,
|
14800 | padding: 8,
|
14801 | textHeight: 10,
|
14802 | titleShift: -15,
|
14803 | noteMargin: 10,
|
14804 | forkWidth: 70,
|
14805 | forkHeight: 7,
|
14806 | // Used
|
14807 | miniPadding: 2,
|
14808 | // Font size factor, this is used to guess the width of the edges labels before rendering by dagre
|
14809 | // layout. This might need updating if/when switching font
|
14810 | fontSizeFactor: 5.02,
|
14811 | fontSize: 24,
|
14812 | labelHeight: 16,
|
14813 | edgeLengthFactor: '20',
|
14814 | compositTitleSize: 35,
|
14815 | radius: 5,
|
14816 |
|
14817 | /**
|
14818 | * | Parameter | Description | Type | Required | Values |
|
14819 | * | ----------- | ----------- | ------- | -------- | ----------- |
|
14820 | * | useMaxWidth | See notes | boolean | 4 | true, false |
|
14821 | *
|
14822 | * **Notes:**
|
14823 | *
|
14824 | * When this flag is set the height and width is set to 100% and is then scaling with the
|
14825 | * available space if not the absolute space required is used.
|
14826 | *
|
14827 | * Default value: true
|
14828 | */
|
14829 | useMaxWidth: true,
|
14830 |
|
14831 | /**
|
14832 | * | Parameter | Description | Type | Required | Values |
|
14833 | * | --------------- | ----------- | ------- | -------- | ----------------------- |
|
14834 | * | defaultRenderer | See notes | boolean | 4 | dagre-d3, dagre-wrapper |
|
14835 | *
|
14836 | * **Notes:**
|
14837 | *
|
14838 | * Decides which rendering engine that is to be used for the rendering. Legal values are:
|
14839 | * dagre-d3 dagre-wrapper - wrapper for dagre implemented in mermaid
|
14840 | *
|
14841 | * Default value: 'dagre-d3'
|
14842 | */
|
14843 | defaultRenderer: 'dagre-wrapper'
|
14844 | },
|
14845 |
|
14846 | /** The object containing configurations specific for entity relationship diagrams */
|
14847 | er: {
|
14848 | /**
|
14849 | * | Parameter | Description | Type | Required | Values |
|
14850 | * | -------------- | ----------------------------------------------- | ------- | -------- | ------------------ |
|
14851 | * | diagramPadding | Amount of padding around the diagram as a whole | Integer | Required | Any Positive Value |
|
14852 | *
|
14853 | * **Notes:**
|
14854 | *
|
14855 | * The amount of padding around the diagram as a whole so that embedded diagrams have margins,
|
14856 | * expressed in pixels
|
14857 | *
|
14858 | * Default value: 20
|
14859 | */
|
14860 | diagramPadding: 20,
|
14861 |
|
14862 | /**
|
14863 | * | Parameter | Description | Type | Required | Values |
|
14864 | * | --------------- | ---------------------------------------- | ------ | -------- | ---------------------- |
|
14865 | * | layoutDirection | Directional bias for layout of entities. | string | Required | "TB", "BT", "LR", "RL" |
|
14866 | *
|
14867 | * **Notes:**
|
14868 | *
|
14869 | * 'TB' for Top-Bottom, 'BT'for Bottom-Top, 'LR' for Left-Right, or 'RL' for Right to Left.
|
14870 | *
|
14871 | * T = top, B = bottom, L = left, and R = right.
|
14872 | *
|
14873 | * Default value: 'TB'
|
14874 | */
|
14875 | layoutDirection: 'TB',
|
14876 |
|
14877 | /**
|
14878 | * | Parameter | Description | Type | Required | Values |
|
14879 | * | -------------- | ---------------------------------- | ------- | -------- | ------------------ |
|
14880 | * | minEntityWidth | The minimum width of an entity box | Integer | Required | Any Positive Value |
|
14881 | *
|
14882 | * **Notes:** Expressed in pixels. Default value: 100
|
14883 | */
|
14884 | minEntityWidth: 100,
|
14885 |
|
14886 | /**
|
14887 | * | Parameter | Description | Type | Required | Values |
|
14888 | * | --------------- | ----------------------------------- | ------- | -------- | ------------------ |
|
14889 | * | minEntityHeight | The minimum height of an entity box | Integer | 4 | Any Positive Value |
|
14890 | *
|
14891 | * **Notes:** Expressed in pixels Default value: 75
|
14892 | */
|
14893 | minEntityHeight: 75,
|
14894 |
|
14895 | /**
|
14896 | * | Parameter | Description | Type | Required | Values |
|
14897 | * | ------------- | ------------------------------------------------------------ | ------- | -------- | ------------------ |
|
14898 | * | entityPadding | Minimum internal padding between text in box and box borders | Integer | 4 | Any Positive Value |
|
14899 | *
|
14900 | * **Notes:**
|
14901 | *
|
14902 | * The minimum internal padding between text in an entity box and the enclosing box borders,
|
14903 | * expressed in pixels.
|
14904 | *
|
14905 | * Default value: 15
|
14906 | */
|
14907 | entityPadding: 15,
|
14908 |
|
14909 | /**
|
14910 | * | Parameter | Description | Type | Required | Values |
|
14911 | * | --------- | ----------------------------------- | ------ | -------- | -------------------- |
|
14912 | * | stroke | Stroke color of box edges and lines | string | 4 | Any recognized color |
|
14913 | *
|
14914 | * **Notes:** Default value: 'gray'
|
14915 | */
|
14916 | stroke: 'gray',
|
14917 |
|
14918 | /**
|
14919 | * | Parameter | Description | Type | Required | Values |
|
14920 | * | --------- | -------------------------- | ------ | -------- | -------------------- |
|
14921 | * | fill | Fill color of entity boxes | string | 4 | Any recognized color |
|
14922 | *
|
14923 | * **Notes:** Default value: 'honeydew'
|
14924 | */
|
14925 | fill: 'honeydew',
|
14926 |
|
14927 | /**
|
14928 | * | Parameter | Description | Type | Required | Values |
|
14929 | * | --------- | ------------------- | ------- | -------- | ------------------ |
|
14930 | * | fontSize | Font Size in pixels | Integer | | Any Positive Value |
|
14931 | *
|
14932 | * **Notes:**
|
14933 | *
|
14934 | * Font size (expressed as an integer representing a number of pixels) Default value: 12
|
14935 | */
|
14936 | fontSize: 12,
|
14937 |
|
14938 | /**
|
14939 | * | Parameter | Description | Type | Required | Values |
|
14940 | * | ----------- | ----------- | ------- | -------- | ----------- |
|
14941 | * | useMaxWidth | See Notes | boolean | Required | true, false |
|
14942 | *
|
14943 | * **Notes:**
|
14944 | *
|
14945 | * When this flag is set to true, the diagram width is locked to 100% and scaled based on
|
14946 | * available space. If set to false, the diagram reserves its absolute width.
|
14947 | *
|
14948 | * Default value: true
|
14949 | */
|
14950 | useMaxWidth: true
|
14951 | },
|
14952 |
|
14953 | /** The object containing configurations specific for pie diagrams */
|
14954 | pie: {
|
14955 | useWidth: undefined,
|
14956 |
|
14957 | /**
|
14958 | * | Parameter | Description | Type | Required | Values |
|
14959 | * | ----------- | ----------- | ------- | -------- | ----------- |
|
14960 | * | useMaxWidth | See Notes | boolean | Required | true, false |
|
14961 | *
|
14962 | * **Notes:**
|
14963 | *
|
14964 | * When this flag is set to true, the diagram width is locked to 100% and scaled based on
|
14965 | * available space. If set to false, the diagram reserves its absolute width.
|
14966 | *
|
14967 | * Default value: true
|
14968 | */
|
14969 | useMaxWidth: true
|
14970 | },
|
14971 |
|
14972 | /** The object containing configurations specific for req diagrams */
|
14973 | requirement: {
|
14974 | useWidth: undefined,
|
14975 |
|
14976 | /**
|
14977 | * | Parameter | Description | Type | Required | Values |
|
14978 | * | ----------- | ----------- | ------- | -------- | ----------- |
|
14979 | * | useMaxWidth | See Notes | boolean | Required | true, false |
|
14980 | *
|
14981 | * **Notes:**
|
14982 | *
|
14983 | * When this flag is set to true, the diagram width is locked to 100% and scaled based on
|
14984 | * available space. If set to false, the diagram reserves its absolute width.
|
14985 | *
|
14986 | * Default value: true
|
14987 | */
|
14988 | useMaxWidth: true,
|
14989 | rect_fill: '#f9f9f9',
|
14990 | text_color: '#333',
|
14991 | rect_border_size: '0.5px',
|
14992 | rect_border_color: '#bbb',
|
14993 | rect_min_width: 200,
|
14994 | rect_min_height: 200,
|
14995 | fontSize: 14,
|
14996 | rect_padding: 10,
|
14997 | line_height: 20
|
14998 | },
|
14999 | gitGraph: {
|
15000 | diagramPadding: 8,
|
15001 | nodeLabel: {
|
15002 | width: 75,
|
15003 | height: 100,
|
15004 | x: -25,
|
15005 | y: 0
|
15006 | },
|
15007 | mainBranchName: 'main',
|
15008 | mainBranchOrder: 0,
|
15009 | showCommitLabel: true,
|
15010 | showBranches: true,
|
15011 | rotateCommitLabel: true
|
15012 | },
|
15013 |
|
15014 | /** The object containing configurations specific for c4 diagrams */
|
15015 | c4: {
|
15016 | useWidth: undefined,
|
15017 |
|
15018 | /**
|
15019 | * | Parameter | Description | Type | Required | Values |
|
15020 | * | -------------- | ---------------------------------------------- | ------- | -------- | ------------------ |
|
15021 | * | diagramMarginX | Margin to the right and left of the c4 diagram | Integer | Required | Any Positive Value |
|
15022 | *
|
15023 | * **Notes:** Default value: 50
|
15024 | */
|
15025 | diagramMarginX: 50,
|
15026 |
|
15027 | /**
|
15028 | * | Parameter | Description | Type | Required | Values |
|
15029 | * | -------------- | ------------------------------------------- | ------- | -------- | ------------------ |
|
15030 | * | diagramMarginY | Margin to the over and under the c4 diagram | Integer | Required | Any Positive Value |
|
15031 | *
|
15032 | * **Notes:** Default value: 10
|
15033 | */
|
15034 | diagramMarginY: 10,
|
15035 |
|
15036 | /**
|
15037 | * | Parameter | Description | Type | Required | Values |
|
15038 | * | ------------- | --------------------- | ------- | -------- | ------------------ |
|
15039 | * | c4ShapeMargin | Margin between shapes | Integer | Required | Any Positive Value |
|
15040 | *
|
15041 | * **Notes:** Default value: 50
|
15042 | */
|
15043 | c4ShapeMargin: 50,
|
15044 |
|
15045 | /**
|
15046 | * | Parameter | Description | Type | Required | Values |
|
15047 | * | -------------- | ---------------------- | ------- | -------- | ------------------ |
|
15048 | * | c4ShapePadding | Padding between shapes | Integer | Required | Any Positive Value |
|
15049 | *
|
15050 | * **Notes:** Default value: 20
|
15051 | */
|
15052 | c4ShapePadding: 20,
|
15053 |
|
15054 | /**
|
15055 | * | Parameter | Description | Type | Required | Values |
|
15056 | * | --------- | --------------------- | ------- | -------- | ------------------ |
|
15057 | * | width | Width of person boxes | Integer | Required | Any Positive Value |
|
15058 | *
|
15059 | * **Notes:** Default value: 216
|
15060 | */
|
15061 | width: 216,
|
15062 |
|
15063 | /**
|
15064 | * | Parameter | Description | Type | Required | Values |
|
15065 | * | --------- | ---------------------- | ------- | -------- | ------------------ |
|
15066 | * | height | Height of person boxes | Integer | Required | Any Positive Value |
|
15067 | *
|
15068 | * **Notes:** Default value: 60
|
15069 | */
|
15070 | height: 60,
|
15071 |
|
15072 | /**
|
15073 | * | Parameter | Description | Type | Required | Values |
|
15074 | * | --------- | ------------------- | ------- | -------- | ------------------ |
|
15075 | * | boxMargin | Margin around boxes | Integer | Required | Any Positive Value |
|
15076 | *
|
15077 | * **Notes:** Default value: 10
|
15078 | */
|
15079 | boxMargin: 10,
|
15080 |
|
15081 | /**
|
15082 | * | Parameter | Description | Type | Required | Values |
|
15083 | * | ----------- | ----------- | ------- | -------- | ----------- |
|
15084 | * | useMaxWidth | See Notes | boolean | Required | true, false |
|
15085 | *
|
15086 | * **Notes:** When this flag is set to true, the height and width is set to 100% and is then
|
15087 | * scaling with the available space. If set to false, the absolute space required is used.
|
15088 | *
|
15089 | * Default value: true
|
15090 | */
|
15091 | useMaxWidth: true,
|
15092 |
|
15093 | /**
|
15094 | * | Parameter | Description | Type | Required | Values |
|
15095 | * | ------------ | ----------- | ------- | -------- | ------------------ |
|
15096 | * | c4ShapeInRow | See Notes | Integer | Required | Any Positive Value |
|
15097 | *
|
15098 | * **Notes:** How many shapes to place in each row.
|
15099 | *
|
15100 | * Default value: 4
|
15101 | */
|
15102 | c4ShapeInRow: 4,
|
15103 | nextLinePaddingX: 0,
|
15104 |
|
15105 | /**
|
15106 | * | Parameter | Description | Type | Required | Values |
|
15107 | * | --------------- | ----------- | ------- | -------- | ------------------ |
|
15108 | * | c4BoundaryInRow | See Notes | Integer | Required | Any Positive Value |
|
15109 | *
|
15110 | * **Notes:** How many boundarys to place in each row.
|
15111 | *
|
15112 | * Default value: 2
|
15113 | */
|
15114 | c4BoundaryInRow: 2,
|
15115 |
|
15116 | /**
|
15117 | * This sets the font size of Person shape for the diagram
|
15118 | *
|
15119 | * **Notes:** Default value: 14.
|
15120 | */
|
15121 | personFontSize: 14,
|
15122 |
|
15123 | /**
|
15124 | * This sets the font family of Person shape for the diagram
|
15125 | *
|
15126 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15127 | */
|
15128 | personFontFamily: '"Open Sans", sans-serif',
|
15129 |
|
15130 | /**
|
15131 | * This sets the font weight of Person shape for the diagram
|
15132 | *
|
15133 | * **Notes:** Default value: normal.
|
15134 | */
|
15135 | personFontWeight: 'normal',
|
15136 |
|
15137 | /**
|
15138 | * This sets the font size of External Person shape for the diagram
|
15139 | *
|
15140 | * **Notes:** Default value: 14.
|
15141 | */
|
15142 | external_personFontSize: 14,
|
15143 |
|
15144 | /**
|
15145 | * This sets the font family of External Person shape for the diagram
|
15146 | *
|
15147 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15148 | */
|
15149 | external_personFontFamily: '"Open Sans", sans-serif',
|
15150 |
|
15151 | /**
|
15152 | * This sets the font weight of External Person shape for the diagram
|
15153 | *
|
15154 | * **Notes:** Default value: normal.
|
15155 | */
|
15156 | external_personFontWeight: 'normal',
|
15157 |
|
15158 | /**
|
15159 | * This sets the font size of System shape for the diagram
|
15160 | *
|
15161 | * **Notes:** Default value: 14.
|
15162 | */
|
15163 | systemFontSize: 14,
|
15164 |
|
15165 | /**
|
15166 | * This sets the font family of System shape for the diagram
|
15167 | *
|
15168 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15169 | */
|
15170 | systemFontFamily: '"Open Sans", sans-serif',
|
15171 |
|
15172 | /**
|
15173 | * This sets the font weight of System shape for the diagram
|
15174 | *
|
15175 | * **Notes:** Default value: normal.
|
15176 | */
|
15177 | systemFontWeight: 'normal',
|
15178 |
|
15179 | /**
|
15180 | * This sets the font size of External System shape for the diagram
|
15181 | *
|
15182 | * **Notes:** Default value: 14.
|
15183 | */
|
15184 | external_systemFontSize: 14,
|
15185 |
|
15186 | /**
|
15187 | * This sets the font family of External System shape for the diagram
|
15188 | *
|
15189 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15190 | */
|
15191 | external_systemFontFamily: '"Open Sans", sans-serif',
|
15192 |
|
15193 | /**
|
15194 | * This sets the font weight of External System shape for the diagram
|
15195 | *
|
15196 | * **Notes:** Default value: normal.
|
15197 | */
|
15198 | external_systemFontWeight: 'normal',
|
15199 |
|
15200 | /**
|
15201 | * This sets the font size of System DB shape for the diagram
|
15202 | *
|
15203 | * **Notes:** Default value: 14.
|
15204 | */
|
15205 | system_dbFontSize: 14,
|
15206 |
|
15207 | /**
|
15208 | * This sets the font family of System DB shape for the diagram
|
15209 | *
|
15210 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15211 | */
|
15212 | system_dbFontFamily: '"Open Sans", sans-serif',
|
15213 |
|
15214 | /**
|
15215 | * This sets the font weight of System DB shape for the diagram
|
15216 | *
|
15217 | * **Notes:** Default value: normal.
|
15218 | */
|
15219 | system_dbFontWeight: 'normal',
|
15220 |
|
15221 | /**
|
15222 | * This sets the font size of External System DB shape for the diagram
|
15223 | *
|
15224 | * **Notes:** Default value: 14.
|
15225 | */
|
15226 | external_system_dbFontSize: 14,
|
15227 |
|
15228 | /**
|
15229 | * This sets the font family of External System DB shape for the diagram
|
15230 | *
|
15231 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15232 | */
|
15233 | external_system_dbFontFamily: '"Open Sans", sans-serif',
|
15234 |
|
15235 | /**
|
15236 | * This sets the font weight of External System DB shape for the diagram
|
15237 | *
|
15238 | * **Notes:** Default value: normal.
|
15239 | */
|
15240 | external_system_dbFontWeight: 'normal',
|
15241 |
|
15242 | /**
|
15243 | * This sets the font size of System Queue shape for the diagram
|
15244 | *
|
15245 | * **Notes:** Default value: 14.
|
15246 | */
|
15247 | system_queueFontSize: 14,
|
15248 |
|
15249 | /**
|
15250 | * This sets the font family of System Queue shape for the diagram
|
15251 | *
|
15252 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15253 | */
|
15254 | system_queueFontFamily: '"Open Sans", sans-serif',
|
15255 |
|
15256 | /**
|
15257 | * This sets the font weight of System Queue shape for the diagram
|
15258 | *
|
15259 | * **Notes:** Default value: normal.
|
15260 | */
|
15261 | system_queueFontWeight: 'normal',
|
15262 |
|
15263 | /**
|
15264 | * This sets the font size of External System Queue shape for the diagram
|
15265 | *
|
15266 | * **Notes:** Default value: 14.
|
15267 | */
|
15268 | external_system_queueFontSize: 14,
|
15269 |
|
15270 | /**
|
15271 | * This sets the font family of External System Queue shape for the diagram
|
15272 | *
|
15273 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15274 | */
|
15275 | external_system_queueFontFamily: '"Open Sans", sans-serif',
|
15276 |
|
15277 | /**
|
15278 | * This sets the font weight of External System Queue shape for the diagram
|
15279 | *
|
15280 | * **Notes:** Default value: normal.
|
15281 | */
|
15282 | external_system_queueFontWeight: 'normal',
|
15283 |
|
15284 | /**
|
15285 | * This sets the font size of Boundary shape for the diagram
|
15286 | *
|
15287 | * **Notes:** Default value: 14.
|
15288 | */
|
15289 | boundaryFontSize: 14,
|
15290 |
|
15291 | /**
|
15292 | * This sets the font family of Boundary shape for the diagram
|
15293 | *
|
15294 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15295 | */
|
15296 | boundaryFontFamily: '"Open Sans", sans-serif',
|
15297 |
|
15298 | /**
|
15299 | * This sets the font weight of Boundary shape for the diagram
|
15300 | *
|
15301 | * **Notes:** Default value: normal.
|
15302 | */
|
15303 | boundaryFontWeight: 'normal',
|
15304 |
|
15305 | /**
|
15306 | * This sets the font size of Message shape for the diagram
|
15307 | *
|
15308 | * **Notes:** Default value: 12.
|
15309 | */
|
15310 | messageFontSize: 12,
|
15311 |
|
15312 | /**
|
15313 | * This sets the font family of Message shape for the diagram
|
15314 | *
|
15315 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15316 | */
|
15317 | messageFontFamily: '"Open Sans", sans-serif',
|
15318 |
|
15319 | /**
|
15320 | * This sets the font weight of Message shape for the diagram
|
15321 | *
|
15322 | * **Notes:** Default value: normal.
|
15323 | */
|
15324 | messageFontWeight: 'normal',
|
15325 |
|
15326 | /**
|
15327 | * This sets the font size of Container shape for the diagram
|
15328 | *
|
15329 | * **Notes:** Default value: 14.
|
15330 | */
|
15331 | containerFontSize: 14,
|
15332 |
|
15333 | /**
|
15334 | * This sets the font family of Container shape for the diagram
|
15335 | *
|
15336 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15337 | */
|
15338 | containerFontFamily: '"Open Sans", sans-serif',
|
15339 |
|
15340 | /**
|
15341 | * This sets the font weight of Container shape for the diagram
|
15342 | *
|
15343 | * **Notes:** Default value: normal.
|
15344 | */
|
15345 | containerFontWeight: 'normal',
|
15346 |
|
15347 | /**
|
15348 | * This sets the font size of External Container shape for the diagram
|
15349 | *
|
15350 | * **Notes:** Default value: 14.
|
15351 | */
|
15352 | external_containerFontSize: 14,
|
15353 |
|
15354 | /**
|
15355 | * This sets the font family of External Container shape for the diagram
|
15356 | *
|
15357 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15358 | */
|
15359 | external_containerFontFamily: '"Open Sans", sans-serif',
|
15360 |
|
15361 | /**
|
15362 | * This sets the font weight of External Container shape for the diagram
|
15363 | *
|
15364 | * **Notes:** Default value: normal.
|
15365 | */
|
15366 | external_containerFontWeight: 'normal',
|
15367 |
|
15368 | /**
|
15369 | * This sets the font size of Container DB shape for the diagram
|
15370 | *
|
15371 | * **Notes:** Default value: 14.
|
15372 | */
|
15373 | container_dbFontSize: 14,
|
15374 |
|
15375 | /**
|
15376 | * This sets the font family of Container DB shape for the diagram
|
15377 | *
|
15378 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15379 | */
|
15380 | container_dbFontFamily: '"Open Sans", sans-serif',
|
15381 |
|
15382 | /**
|
15383 | * This sets the font weight of Container DB shape for the diagram
|
15384 | *
|
15385 | * **Notes:** Default value: normal.
|
15386 | */
|
15387 | container_dbFontWeight: 'normal',
|
15388 |
|
15389 | /**
|
15390 | * This sets the font size of External Container DB shape for the diagram
|
15391 | *
|
15392 | * **Notes:** Default value: 14.
|
15393 | */
|
15394 | external_container_dbFontSize: 14,
|
15395 |
|
15396 | /**
|
15397 | * This sets the font family of External Container DB shape for the diagram
|
15398 | *
|
15399 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15400 | */
|
15401 | external_container_dbFontFamily: '"Open Sans", sans-serif',
|
15402 |
|
15403 | /**
|
15404 | * This sets the font weight of External Container DB shape for the diagram
|
15405 | *
|
15406 | * **Notes:** Default value: normal.
|
15407 | */
|
15408 | external_container_dbFontWeight: 'normal',
|
15409 |
|
15410 | /**
|
15411 | * This sets the font size of Container Queue shape for the diagram
|
15412 | *
|
15413 | * **Notes:** Default value: 14.
|
15414 | */
|
15415 | container_queueFontSize: 14,
|
15416 |
|
15417 | /**
|
15418 | * This sets the font family of Container Queue shape for the diagram
|
15419 | *
|
15420 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15421 | */
|
15422 | container_queueFontFamily: '"Open Sans", sans-serif',
|
15423 |
|
15424 | /**
|
15425 | * This sets the font weight of Container Queue shape for the diagram
|
15426 | *
|
15427 | * **Notes:** Default value: normal.
|
15428 | */
|
15429 | container_queueFontWeight: 'normal',
|
15430 |
|
15431 | /**
|
15432 | * This sets the font size of External Container Queue shape for the diagram
|
15433 | *
|
15434 | * **Notes:** Default value: 14.
|
15435 | */
|
15436 | external_container_queueFontSize: 14,
|
15437 |
|
15438 | /**
|
15439 | * This sets the font family of External Container Queue shape for the diagram
|
15440 | *
|
15441 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15442 | */
|
15443 | external_container_queueFontFamily: '"Open Sans", sans-serif',
|
15444 |
|
15445 | /**
|
15446 | * This sets the font weight of External Container Queue shape for the diagram
|
15447 | *
|
15448 | * **Notes:** Default value: normal.
|
15449 | */
|
15450 | external_container_queueFontWeight: 'normal',
|
15451 |
|
15452 | /**
|
15453 | * This sets the font size of Component shape for the diagram
|
15454 | *
|
15455 | * **Notes:** Default value: 14.
|
15456 | */
|
15457 | componentFontSize: 14,
|
15458 |
|
15459 | /**
|
15460 | * This sets the font family of Component shape for the diagram
|
15461 | *
|
15462 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15463 | */
|
15464 | componentFontFamily: '"Open Sans", sans-serif',
|
15465 |
|
15466 | /**
|
15467 | * This sets the font weight of Component shape for the diagram
|
15468 | *
|
15469 | * **Notes:** Default value: normal.
|
15470 | */
|
15471 | componentFontWeight: 'normal',
|
15472 |
|
15473 | /**
|
15474 | * This sets the font size of External Component shape for the diagram
|
15475 | *
|
15476 | * **Notes:** Default value: 14.
|
15477 | */
|
15478 | external_componentFontSize: 14,
|
15479 |
|
15480 | /**
|
15481 | * This sets the font family of External Component shape for the diagram
|
15482 | *
|
15483 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15484 | */
|
15485 | external_componentFontFamily: '"Open Sans", sans-serif',
|
15486 |
|
15487 | /**
|
15488 | * This sets the font weight of External Component shape for the diagram
|
15489 | *
|
15490 | * **Notes:** Default value: normal.
|
15491 | */
|
15492 | external_componentFontWeight: 'normal',
|
15493 |
|
15494 | /**
|
15495 | * This sets the font size of Component DB shape for the diagram
|
15496 | *
|
15497 | * **Notes:** Default value: 14.
|
15498 | */
|
15499 | component_dbFontSize: 14,
|
15500 |
|
15501 | /**
|
15502 | * This sets the font family of Component DB shape for the diagram
|
15503 | *
|
15504 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15505 | */
|
15506 | component_dbFontFamily: '"Open Sans", sans-serif',
|
15507 |
|
15508 | /**
|
15509 | * This sets the font weight of Component DB shape for the diagram
|
15510 | *
|
15511 | * **Notes:** Default value: normal.
|
15512 | */
|
15513 | component_dbFontWeight: 'normal',
|
15514 |
|
15515 | /**
|
15516 | * This sets the font size of External Component DB shape for the diagram
|
15517 | *
|
15518 | * **Notes:** Default value: 14.
|
15519 | */
|
15520 | external_component_dbFontSize: 14,
|
15521 |
|
15522 | /**
|
15523 | * This sets the font family of External Component DB shape for the diagram
|
15524 | *
|
15525 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15526 | */
|
15527 | external_component_dbFontFamily: '"Open Sans", sans-serif',
|
15528 |
|
15529 | /**
|
15530 | * This sets the font weight of External Component DB shape for the diagram
|
15531 | *
|
15532 | * **Notes:** Default value: normal.
|
15533 | */
|
15534 | external_component_dbFontWeight: 'normal',
|
15535 |
|
15536 | /**
|
15537 | * This sets the font size of Component Queue shape for the diagram
|
15538 | *
|
15539 | * **Notes:** Default value: 14.
|
15540 | */
|
15541 | component_queueFontSize: 14,
|
15542 |
|
15543 | /**
|
15544 | * This sets the font family of Component Queue shape for the diagram
|
15545 | *
|
15546 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15547 | */
|
15548 | component_queueFontFamily: '"Open Sans", sans-serif',
|
15549 |
|
15550 | /**
|
15551 | * This sets the font weight of Component Queue shape for the diagram
|
15552 | *
|
15553 | * **Notes:** Default value: normal.
|
15554 | */
|
15555 | component_queueFontWeight: 'normal',
|
15556 |
|
15557 | /**
|
15558 | * This sets the font size of External Component Queue shape for the diagram
|
15559 | *
|
15560 | * **Notes:** Default value: 14.
|
15561 | */
|
15562 | external_component_queueFontSize: 14,
|
15563 |
|
15564 | /**
|
15565 | * This sets the font family of External Component Queue shape for the diagram
|
15566 | *
|
15567 | * **Notes:** Default value: "Open Sans", sans-serif.
|
15568 | */
|
15569 | external_component_queueFontFamily: '"Open Sans", sans-serif',
|
15570 |
|
15571 | /**
|
15572 | * This sets the font weight of External Component Queue shape for the diagram
|
15573 | *
|
15574 | * **Notes:** Default value: normal.
|
15575 | */
|
15576 | external_component_queueFontWeight: 'normal',
|
15577 |
|
15578 | /**
|
15579 | * This sets the auto-wrap state for the diagram
|
15580 | *
|
15581 | * **Notes:** Default value: true.
|
15582 | */
|
15583 | wrap: true,
|
15584 |
|
15585 | /**
|
15586 | * This sets the auto-wrap padding for the diagram (sides only)
|
15587 | *
|
15588 | * **Notes:** Default value: 0.
|
15589 | */
|
15590 | wrapPadding: 10,
|
15591 | personFont: function personFont() {
|
15592 | return {
|
15593 | fontFamily: this.personFontFamily,
|
15594 | fontSize: this.personFontSize,
|
15595 | fontWeight: this.personFontWeight
|
15596 | };
|
15597 | },
|
15598 | external_personFont: function external_personFont() {
|
15599 | return {
|
15600 | fontFamily: this.external_personFontFamily,
|
15601 | fontSize: this.external_personFontSize,
|
15602 | fontWeight: this.external_personFontWeight
|
15603 | };
|
15604 | },
|
15605 | systemFont: function systemFont() {
|
15606 | return {
|
15607 | fontFamily: this.systemFontFamily,
|
15608 | fontSize: this.systemFontSize,
|
15609 | fontWeight: this.systemFontWeight
|
15610 | };
|
15611 | },
|
15612 | external_systemFont: function external_systemFont() {
|
15613 | return {
|
15614 | fontFamily: this.external_systemFontFamily,
|
15615 | fontSize: this.external_systemFontSize,
|
15616 | fontWeight: this.external_systemFontWeight
|
15617 | };
|
15618 | },
|
15619 | system_dbFont: function system_dbFont() {
|
15620 | return {
|
15621 | fontFamily: this.system_dbFontFamily,
|
15622 | fontSize: this.system_dbFontSize,
|
15623 | fontWeight: this.system_dbFontWeight
|
15624 | };
|
15625 | },
|
15626 | external_system_dbFont: function external_system_dbFont() {
|
15627 | return {
|
15628 | fontFamily: this.external_system_dbFontFamily,
|
15629 | fontSize: this.external_system_dbFontSize,
|
15630 | fontWeight: this.external_system_dbFontWeight
|
15631 | };
|
15632 | },
|
15633 | system_queueFont: function system_queueFont() {
|
15634 | return {
|
15635 | fontFamily: this.system_queueFontFamily,
|
15636 | fontSize: this.system_queueFontSize,
|
15637 | fontWeight: this.system_queueFontWeight
|
15638 | };
|
15639 | },
|
15640 | external_system_queueFont: function external_system_queueFont() {
|
15641 | return {
|
15642 | fontFamily: this.external_system_queueFontFamily,
|
15643 | fontSize: this.external_system_queueFontSize,
|
15644 | fontWeight: this.external_system_queueFontWeight
|
15645 | };
|
15646 | },
|
15647 | containerFont: function containerFont() {
|
15648 | return {
|
15649 | fontFamily: this.containerFontFamily,
|
15650 | fontSize: this.containerFontSize,
|
15651 | fontWeight: this.containerFontWeight
|
15652 | };
|
15653 | },
|
15654 | external_containerFont: function external_containerFont() {
|
15655 | return {
|
15656 | fontFamily: this.external_containerFontFamily,
|
15657 | fontSize: this.external_containerFontSize,
|
15658 | fontWeight: this.external_containerFontWeight
|
15659 | };
|
15660 | },
|
15661 | container_dbFont: function container_dbFont() {
|
15662 | return {
|
15663 | fontFamily: this.container_dbFontFamily,
|
15664 | fontSize: this.container_dbFontSize,
|
15665 | fontWeight: this.container_dbFontWeight
|
15666 | };
|
15667 | },
|
15668 | external_container_dbFont: function external_container_dbFont() {
|
15669 | return {
|
15670 | fontFamily: this.external_container_dbFontFamily,
|
15671 | fontSize: this.external_container_dbFontSize,
|
15672 | fontWeight: this.external_container_dbFontWeight
|
15673 | };
|
15674 | },
|
15675 | container_queueFont: function container_queueFont() {
|
15676 | return {
|
15677 | fontFamily: this.container_queueFontFamily,
|
15678 | fontSize: this.container_queueFontSize,
|
15679 | fontWeight: this.container_queueFontWeight
|
15680 | };
|
15681 | },
|
15682 | external_container_queueFont: function external_container_queueFont() {
|
15683 | return {
|
15684 | fontFamily: this.external_container_queueFontFamily,
|
15685 | fontSize: this.external_container_queueFontSize,
|
15686 | fontWeight: this.external_container_queueFontWeight
|
15687 | };
|
15688 | },
|
15689 | componentFont: function componentFont() {
|
15690 | return {
|
15691 | fontFamily: this.componentFontFamily,
|
15692 | fontSize: this.componentFontSize,
|
15693 | fontWeight: this.componentFontWeight
|
15694 | };
|
15695 | },
|
15696 | external_componentFont: function external_componentFont() {
|
15697 | return {
|
15698 | fontFamily: this.external_componentFontFamily,
|
15699 | fontSize: this.external_componentFontSize,
|
15700 | fontWeight: this.external_componentFontWeight
|
15701 | };
|
15702 | },
|
15703 | component_dbFont: function component_dbFont() {
|
15704 | return {
|
15705 | fontFamily: this.component_dbFontFamily,
|
15706 | fontSize: this.component_dbFontSize,
|
15707 | fontWeight: this.component_dbFontWeight
|
15708 | };
|
15709 | },
|
15710 | external_component_dbFont: function external_component_dbFont() {
|
15711 | return {
|
15712 | fontFamily: this.external_component_dbFontFamily,
|
15713 | fontSize: this.external_component_dbFontSize,
|
15714 | fontWeight: this.external_component_dbFontWeight
|
15715 | };
|
15716 | },
|
15717 | component_queueFont: function component_queueFont() {
|
15718 | return {
|
15719 | fontFamily: this.component_queueFontFamily,
|
15720 | fontSize: this.component_queueFontSize,
|
15721 | fontWeight: this.component_queueFontWeight
|
15722 | };
|
15723 | },
|
15724 | external_component_queueFont: function external_component_queueFont() {
|
15725 | return {
|
15726 | fontFamily: this.external_component_queueFontFamily,
|
15727 | fontSize: this.external_component_queueFontSize,
|
15728 | fontWeight: this.external_component_queueFontWeight
|
15729 | };
|
15730 | },
|
15731 | boundaryFont: function boundaryFont() {
|
15732 | return {
|
15733 | fontFamily: this.boundaryFontFamily,
|
15734 | fontSize: this.boundaryFontSize,
|
15735 | fontWeight: this.boundaryFontWeight
|
15736 | };
|
15737 | },
|
15738 | messageFont: function messageFont() {
|
15739 | return {
|
15740 | fontFamily: this.messageFontFamily,
|
15741 | fontSize: this.messageFontSize,
|
15742 | fontWeight: this.messageFontWeight
|
15743 | };
|
15744 | },
|
15745 | // ' Colors
|
15746 | // ' ##################################
|
15747 | person_bg_color: '#08427B',
|
15748 | person_border_color: '#073B6F',
|
15749 | external_person_bg_color: '#686868',
|
15750 | external_person_border_color: '#8A8A8A',
|
15751 | system_bg_color: '#1168BD',
|
15752 | system_border_color: '#3C7FC0',
|
15753 | system_db_bg_color: '#1168BD',
|
15754 | system_db_border_color: '#3C7FC0',
|
15755 | system_queue_bg_color: '#1168BD',
|
15756 | system_queue_border_color: '#3C7FC0',
|
15757 | external_system_bg_color: '#999999',
|
15758 | external_system_border_color: '#8A8A8A',
|
15759 | external_system_db_bg_color: '#999999',
|
15760 | external_system_db_border_color: '#8A8A8A',
|
15761 | external_system_queue_bg_color: '#999999',
|
15762 | external_system_queue_border_color: '#8A8A8A',
|
15763 | container_bg_color: '#438DD5',
|
15764 | container_border_color: '#3C7FC0',
|
15765 | container_db_bg_color: '#438DD5',
|
15766 | container_db_border_color: '#3C7FC0',
|
15767 | container_queue_bg_color: '#438DD5',
|
15768 | container_queue_border_color: '#3C7FC0',
|
15769 | external_container_bg_color: '#B3B3B3',
|
15770 | external_container_border_color: '#A6A6A6',
|
15771 | external_container_db_bg_color: '#B3B3B3',
|
15772 | external_container_db_border_color: '#A6A6A6',
|
15773 | external_container_queue_bg_color: '#B3B3B3',
|
15774 | external_container_queue_border_color: '#A6A6A6',
|
15775 | component_bg_color: '#85BBF0',
|
15776 | component_border_color: '#78A8D8',
|
15777 | component_db_bg_color: '#85BBF0',
|
15778 | component_db_border_color: '#78A8D8',
|
15779 | component_queue_bg_color: '#85BBF0',
|
15780 | component_queue_border_color: '#78A8D8',
|
15781 | external_component_bg_color: '#CCCCCC',
|
15782 | external_component_border_color: '#BFBFBF',
|
15783 | external_component_db_bg_color: '#CCCCCC',
|
15784 | external_component_db_border_color: '#BFBFBF',
|
15785 | external_component_queue_bg_color: '#CCCCCC',
|
15786 | external_component_queue_border_color: '#BFBFBF'
|
15787 | }
|
15788 | };
|
15789 | config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
|
15790 | config.gitGraph.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
|
15791 |
|
15792 | var keyify = function keyify(obj) {
|
15793 | var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
15794 | return Object.keys(obj).reduce(function (res, el) {
|
15795 | if (Array.isArray(obj[el])) {
|
15796 | return res;
|
15797 | } else if (_typeof(obj[el]) === 'object' && obj[el] !== null) {
|
15798 | return [].concat(_toConsumableArray(res), [prefix + el], _toConsumableArray(keyify(obj[el], '')));
|
15799 | }
|
15800 |
|
15801 | return [].concat(_toConsumableArray(res), [prefix + el]);
|
15802 | }, []);
|
15803 | };
|
15804 |
|
15805 | var configKeys = keyify(config, '');
|
15806 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (config);
|
15807 |
|
15808 | /***/ }),
|
15809 |
|
15810 | /***/ "./src/diagram-api/detectType.js":
|
15811 | /*!***************************************!*\
|
15812 | !*** ./src/diagram-api/detectType.js ***!
|
15813 | \***************************************/
|
15814 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
15815 |
|
15816 | "use strict";
|
15817 | __webpack_require__.r(__webpack_exports__);
|
15818 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
15819 | /* harmony export */ "addDetector": () => (/* binding */ addDetector),
|
15820 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
15821 | /* harmony export */ });
|
15822 | var directive = /[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
|
15823 | var anyComment = /\s*%%.*\n/gm;
|
15824 | var detectors = {};
|
15825 | /**
|
15826 | * @function detectType Detects the type of the graph text. Takes into consideration the possible
|
15827 | * existence of an %%init directive
|
15828 | *
|
15829 | * ```mermaid
|
15830 | * %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%%
|
15831 | * graph LR
|
15832 | * a-->b
|
15833 | * b-->c
|
15834 | * c-->d
|
15835 | * d-->e
|
15836 | * e-->f
|
15837 | * f-->g
|
15838 | * g-->h
|
15839 | * ```
|
15840 | * @param {string} text The text defining the graph
|
15841 | * @param {{
|
15842 | * class: { defaultRenderer: string } | undefined;
|
15843 | * state: { defaultRenderer: string } | undefined;
|
15844 | * flowchart: { defaultRenderer: string } | undefined;
|
15845 | * }} [cnf]
|
15846 | * @returns {string} A graph definition key
|
15847 | */
|
15848 |
|
15849 | var detectType = function detectType(text, cnf) {
|
15850 | text = text.replace(directive, '').replace(anyComment, '\n');
|
15851 |
|
15852 | if (text.match(/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/)) {
|
15853 | return 'c4';
|
15854 | }
|
15855 |
|
15856 | if (text.match(/^\s*sequenceDiagram/)) {
|
15857 | return 'sequence';
|
15858 | }
|
15859 |
|
15860 | if (text.match(/^\s*gantt/)) {
|
15861 | return 'gantt';
|
15862 | }
|
15863 |
|
15864 | if (text.match(/^\s*classDiagram-v2/)) {
|
15865 | return 'classDiagram';
|
15866 | }
|
15867 |
|
15868 | if (text.match(/^\s*classDiagram/)) {
|
15869 | if (cnf && cnf.class && cnf.class.defaultRenderer === 'dagre-wrapper') return 'classDiagram';
|
15870 | return 'class';
|
15871 | }
|
15872 |
|
15873 | if (text.match(/^\s*stateDiagram-v2/)) {
|
15874 | return 'stateDiagram';
|
15875 | }
|
15876 |
|
15877 | if (text.match(/^\s*stateDiagram/)) {
|
15878 | if (cnf && cnf.class && cnf.state.defaultRenderer === 'dagre-wrapper') return 'stateDiagram';
|
15879 | return 'state';
|
15880 | } // if (text.match(/^\s*gitGraph/)) {
|
15881 | // return 'gitGraph';
|
15882 | // }
|
15883 |
|
15884 |
|
15885 | if (text.match(/^\s*flowchart/)) {
|
15886 | return 'flowchart-v2';
|
15887 | }
|
15888 |
|
15889 | if (text.match(/^\s*info/)) {
|
15890 | return 'info';
|
15891 | }
|
15892 |
|
15893 | if (text.match(/^\s*pie/)) {
|
15894 | return 'pie';
|
15895 | }
|
15896 |
|
15897 | if (text.match(/^\s*erDiagram/)) {
|
15898 | return 'er';
|
15899 | }
|
15900 |
|
15901 | if (text.match(/^\s*journey/)) {
|
15902 | return 'journey';
|
15903 | }
|
15904 |
|
15905 | if (text.match(/^\s*requirement/) || text.match(/^\s*requirementDiagram/)) {
|
15906 | return 'requirement';
|
15907 | }
|
15908 |
|
15909 | if (cnf && cnf.flowchart && cnf.flowchart.defaultRenderer === 'dagre-wrapper') return 'flowchart-v2';
|
15910 | var k = Object.keys(detectors);
|
15911 |
|
15912 | for (var i = 0; i < k.length; i++) {
|
15913 | var key = k[i];
|
15914 | var dia = detectors[key];
|
15915 |
|
15916 | if (dia && dia.detector(text)) {
|
15917 | return key;
|
15918 | }
|
15919 | }
|
15920 |
|
15921 | return 'flowchart';
|
15922 | };
|
15923 |
|
15924 | var addDetector = function addDetector(key, detector) {
|
15925 | detectors[key] = {
|
15926 | detector: detector
|
15927 | };
|
15928 | };
|
15929 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (detectType);
|
15930 |
|
15931 | /***/ }),
|
15932 |
|
15933 | /***/ "./src/diagram-api/diagram-orchestration.js":
|
15934 | /*!**************************************************!*\
|
15935 | !*** ./src/diagram-api/diagram-orchestration.js ***!
|
15936 | \**************************************************/
|
15937 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
15938 |
|
15939 | "use strict";
|
15940 | __webpack_require__.r(__webpack_exports__);
|
15941 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
15942 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
15943 | /* harmony export */ });
|
15944 | /* harmony import */ var _diagramAPI_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./diagramAPI.js */ "./src/diagram-api/diagramAPI.js");
|
15945 | /* harmony import */ var _diagrams_git_gitGraphAst__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../diagrams/git/gitGraphAst */ "./src/diagrams/git/gitGraphAst.js");
|
15946 | /* harmony import */ var _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../diagrams/git/gitGraphRenderer */ "./src/diagrams/git/gitGraphRenderer.js");
|
15947 | /* harmony import */ var _diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../diagrams/git/parser/gitGraph */ "./src/diagrams/git/parser/gitGraph.jison");
|
15948 | /* harmony import */ var _diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_1__);
|
15949 | /* harmony import */ var _diagrams_git_gitGraphDetector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../diagrams/git/gitGraphDetector */ "./src/diagrams/git/gitGraphDetector.js");
|
15950 | // import mindmapDb from '../diagrams/mindmap/mindmapDb';
|
15951 | // import mindmapRenderer from '../diagrams/mindmap/mindmapRenderer';
|
15952 | // import mindmapParser from '../diagrams/mindmap/parser/mindmapDiagram';
|
15953 | // import mindmapDetector from '../diagrams/mindmap/mindmapDetector';
|
15954 |
|
15955 |
|
15956 |
|
15957 |
|
15958 | // Register mindmap and other built-in diagrams
|
15959 | // registerDiagram(
|
15960 | // 'mindmap',
|
15961 | // mindmapParser,
|
15962 | // mindmapDb,
|
15963 | // mindmapRenderer,
|
15964 | // undefined,
|
15965 | // mindmapRenderer,
|
15966 | // mindmapDetector
|
15967 | // );
|
15968 |
|
15969 | var addDiagrams = function addDiagrams() {
|
15970 | (0,_diagramAPI_js__WEBPACK_IMPORTED_MODULE_0__.registerDiagram)('gitGraph', (_diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_1___default()), _diagrams_git_gitGraphAst__WEBPACK_IMPORTED_MODULE_2__["default"], _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_3__["default"], undefined, _diagrams_git_gitGraphDetector__WEBPACK_IMPORTED_MODULE_4__["default"]);
|
15971 | };
|
15972 |
|
15973 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (addDiagrams);
|
15974 |
|
15975 | /***/ }),
|
15976 |
|
15977 | /***/ "./src/diagram-api/diagramAPI.js":
|
15978 | /*!***************************************!*\
|
15979 | !*** ./src/diagram-api/diagramAPI.js ***!
|
15980 | \***************************************/
|
15981 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
15982 |
|
15983 | "use strict";
|
15984 | __webpack_require__.r(__webpack_exports__);
|
15985 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
15986 | /* harmony export */ "getDiagrams": () => (/* binding */ getDiagrams),
|
15987 | /* harmony export */ "registerDiagram": () => (/* binding */ registerDiagram)
|
15988 | /* harmony export */ });
|
15989 | /* harmony import */ var _diagrams_c4_c4Db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../diagrams/c4/c4Db */ "./src/diagrams/c4/c4Db.js");
|
15990 | /* harmony import */ var _diagrams_c4_c4Renderer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../diagrams/c4/c4Renderer */ "./src/diagrams/c4/c4Renderer.js");
|
15991 | /* harmony import */ var _diagrams_c4_parser_c4Diagram__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../diagrams/c4/parser/c4Diagram */ "./src/diagrams/c4/parser/c4Diagram.jison");
|
15992 | /* harmony import */ var _diagrams_c4_parser_c4Diagram__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_diagrams_c4_parser_c4Diagram__WEBPACK_IMPORTED_MODULE_2__);
|
15993 | /* harmony import */ var _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../diagrams/class/classDb */ "./src/diagrams/class/classDb.js");
|
15994 | /* harmony import */ var _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../diagrams/class/classRenderer */ "./src/diagrams/class/classRenderer.js");
|
15995 | /* harmony import */ var _diagrams_class_classRenderer_v2__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../diagrams/class/classRenderer-v2 */ "./src/diagrams/class/classRenderer-v2.js");
|
15996 | /* harmony import */ var _diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../diagrams/class/parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison");
|
15997 | /* harmony import */ var _diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_5__);
|
15998 | /* harmony import */ var _diagrams_er_erDb__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../diagrams/er/erDb */ "./src/diagrams/er/erDb.js");
|
15999 | /* harmony import */ var _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../diagrams/er/erRenderer */ "./src/diagrams/er/erRenderer.js");
|
16000 | /* harmony import */ var _diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../diagrams/er/parser/erDiagram */ "./src/diagrams/er/parser/erDiagram.jison");
|
16001 | /* harmony import */ var _diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_9__);
|
16002 | /* harmony import */ var _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../diagrams/flowchart/flowDb */ "./src/diagrams/flowchart/flowDb.js");
|
16003 | /* harmony import */ var _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../diagrams/flowchart/flowRenderer */ "./src/diagrams/flowchart/flowRenderer.js");
|
16004 | /* harmony import */ var _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../diagrams/flowchart/flowRenderer-v2 */ "./src/diagrams/flowchart/flowRenderer-v2.js");
|
16005 | /* harmony import */ var _diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../diagrams/flowchart/parser/flow */ "./src/diagrams/flowchart/parser/flow.jison");
|
16006 | /* harmony import */ var _diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_12__);
|
16007 | /* harmony import */ var _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../diagrams/gantt/ganttDb */ "./src/diagrams/gantt/ganttDb.js");
|
16008 | /* harmony import */ var _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../diagrams/gantt/ganttRenderer */ "./src/diagrams/gantt/ganttRenderer.js");
|
16009 | /* harmony import */ var _diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../diagrams/gantt/parser/gantt */ "./src/diagrams/gantt/parser/gantt.jison");
|
16010 | /* harmony import */ var _diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_16__);
|
16011 | /* harmony import */ var _diagrams_info_infoDb__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../diagrams/info/infoDb */ "./src/diagrams/info/infoDb.js");
|
16012 | /* harmony import */ var _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../diagrams/info/infoRenderer */ "./src/diagrams/info/infoRenderer.js");
|
16013 | /* harmony import */ var _diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../diagrams/info/parser/info */ "./src/diagrams/info/parser/info.jison");
|
16014 | /* harmony import */ var _diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_19___default = /*#__PURE__*/__webpack_require__.n(_diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_19__);
|
16015 | /* harmony import */ var _diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../diagrams/pie/parser/pie */ "./src/diagrams/pie/parser/pie.jison");
|
16016 | /* harmony import */ var _diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_22___default = /*#__PURE__*/__webpack_require__.n(_diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_22__);
|
16017 | /* harmony import */ var _diagrams_pie_pieDb__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../diagrams/pie/pieDb */ "./src/diagrams/pie/pieDb.js");
|
16018 | /* harmony import */ var _diagrams_pie_pieRenderer__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../diagrams/pie/pieRenderer */ "./src/diagrams/pie/pieRenderer.js");
|
16019 | /* harmony import */ var _diagrams_requirement_parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../diagrams/requirement/parser/requirementDiagram */ "./src/diagrams/requirement/parser/requirementDiagram.jison");
|
16020 | /* harmony import */ var _diagrams_requirement_parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_25___default = /*#__PURE__*/__webpack_require__.n(_diagrams_requirement_parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_25__);
|
16021 | /* harmony import */ var _diagrams_requirement_requirementDb__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../diagrams/requirement/requirementDb */ "./src/diagrams/requirement/requirementDb.js");
|
16022 | /* harmony import */ var _diagrams_requirement_requirementRenderer__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../diagrams/requirement/requirementRenderer */ "./src/diagrams/requirement/requirementRenderer.js");
|
16023 | /* harmony import */ var _diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../diagrams/sequence/parser/sequenceDiagram */ "./src/diagrams/sequence/parser/sequenceDiagram.jison");
|
16024 | /* harmony import */ var _diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_28___default = /*#__PURE__*/__webpack_require__.n(_diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_28__);
|
16025 | /* harmony import */ var _diagrams_sequence_sequenceDb__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ../diagrams/sequence/sequenceDb */ "./src/diagrams/sequence/sequenceDb.js");
|
16026 | /* harmony import */ var _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ../diagrams/sequence/sequenceRenderer */ "./src/diagrams/sequence/sequenceRenderer.js");
|
16027 | /* harmony import */ var _diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ../diagrams/state/parser/stateDiagram */ "./src/diagrams/state/parser/stateDiagram.jison");
|
16028 | /* harmony import */ var _diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_31___default = /*#__PURE__*/__webpack_require__.n(_diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_31__);
|
16029 | /* harmony import */ var _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ../diagrams/state/stateDb */ "./src/diagrams/state/stateDb.js");
|
16030 | /* harmony import */ var _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ../diagrams/state/stateRenderer */ "./src/diagrams/state/stateRenderer.js");
|
16031 | /* harmony import */ var _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ../diagrams/state/stateRenderer-v2 */ "./src/diagrams/state/stateRenderer-v2.js");
|
16032 | /* harmony import */ var _diagrams_user_journey_journeyDb__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ../diagrams/user-journey/journeyDb */ "./src/diagrams/user-journey/journeyDb.js");
|
16033 | /* harmony import */ var _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ../diagrams/user-journey/journeyRenderer */ "./src/diagrams/user-journey/journeyRenderer.js");
|
16034 | /* harmony import */ var _diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ../diagrams/user-journey/parser/journey */ "./src/diagrams/user-journey/parser/journey.jison");
|
16035 | /* harmony import */ var _diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_35___default = /*#__PURE__*/__webpack_require__.n(_diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_35__);
|
16036 | /* harmony import */ var _detectType__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./detectType */ "./src/diagram-api/detectType.js");
|
16037 |
|
16038 |
|
16039 |
|
16040 |
|
16041 |
|
16042 |
|
16043 |
|
16044 |
|
16045 |
|
16046 |
|
16047 |
|
16048 |
|
16049 |
|
16050 |
|
16051 |
|
16052 |
|
16053 |
|
16054 |
|
16055 |
|
16056 |
|
16057 |
|
16058 |
|
16059 |
|
16060 |
|
16061 |
|
16062 |
|
16063 |
|
16064 |
|
16065 |
|
16066 |
|
16067 |
|
16068 |
|
16069 |
|
16070 |
|
16071 |
|
16072 |
|
16073 |
|
16074 | var diagrams = {
|
16075 | c4: {
|
16076 | db: _diagrams_c4_c4Db__WEBPACK_IMPORTED_MODULE_0__["default"],
|
16077 | renderer: _diagrams_c4_c4Renderer__WEBPACK_IMPORTED_MODULE_1__["default"],
|
16078 | parser: (_diagrams_c4_parser_c4Diagram__WEBPACK_IMPORTED_MODULE_2___default()),
|
16079 | init: function init(cnf) {
|
16080 | _diagrams_c4_c4Renderer__WEBPACK_IMPORTED_MODULE_1__["default"].setConf(cnf.c4);
|
16081 | }
|
16082 | },
|
16083 | class: {
|
16084 | db: _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_3__["default"],
|
16085 | renderer: _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_4__["default"],
|
16086 | parser: (_diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_5___default()),
|
16087 | init: function init(cnf) {
|
16088 | cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
16089 | _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_3__["default"].clear();
|
16090 | }
|
16091 | },
|
16092 | classDiagram: {
|
16093 | db: _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_3__["default"],
|
16094 | renderer: _diagrams_class_classRenderer_v2__WEBPACK_IMPORTED_MODULE_6__["default"],
|
16095 | parser: (_diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_5___default()),
|
16096 | init: function init(cnf) {
|
16097 | cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
16098 | _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_3__["default"].clear();
|
16099 | }
|
16100 | },
|
16101 | er: {
|
16102 | db: _diagrams_er_erDb__WEBPACK_IMPORTED_MODULE_7__["default"],
|
16103 | renderer: _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_8__["default"],
|
16104 | parser: (_diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_9___default())
|
16105 | },
|
16106 | flowchart: {
|
16107 | db: _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_10__["default"],
|
16108 | renderer: _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_11__["default"],
|
16109 | parser: (_diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_12___default()),
|
16110 | init: function init(cnf) {
|
16111 | _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_11__["default"].setConf(cnf.flowchart);
|
16112 | cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
16113 | _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_10__["default"].clear();
|
16114 | _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_10__["default"].setGen('gen-1');
|
16115 | }
|
16116 | },
|
16117 | 'flowchart-v2': {
|
16118 | db: _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_10__["default"],
|
16119 | renderer: _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_13__["default"],
|
16120 | parser: (_diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_12___default()),
|
16121 | init: function init(cnf) {
|
16122 | _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_13__["default"].setConf(cnf.flowchart);
|
16123 | cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
16124 | _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_10__["default"].clear();
|
16125 | _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_10__["default"].setGen('gen-2');
|
16126 | }
|
16127 | },
|
16128 | gantt: {
|
16129 | db: _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_14__["default"],
|
16130 | renderer: _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_15__["default"],
|
16131 | parser: (_diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_16___default()),
|
16132 | init: function init(cnf) {
|
16133 | _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_15__["default"].setConf(cnf.gantt);
|
16134 | }
|
16135 | },
|
16136 | // git: {
|
16137 | // db: gitGraphAst,
|
16138 | // renderer: gitGraphRenderer,
|
16139 | // parser: gitGraphParser,
|
16140 | // },
|
16141 | info: {
|
16142 | db: _diagrams_info_infoDb__WEBPACK_IMPORTED_MODULE_17__["default"],
|
16143 | renderer: _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_18__["default"],
|
16144 | parser: (_diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_19___default())
|
16145 | },
|
16146 | pie: {
|
16147 | db: _diagrams_pie_pieDb__WEBPACK_IMPORTED_MODULE_20__["default"],
|
16148 | renderer: _diagrams_pie_pieRenderer__WEBPACK_IMPORTED_MODULE_21__["default"],
|
16149 | parser: (_diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_22___default())
|
16150 | },
|
16151 | requirement: {
|
16152 | db: _diagrams_requirement_requirementDb__WEBPACK_IMPORTED_MODULE_23__["default"],
|
16153 | renderer: _diagrams_requirement_requirementRenderer__WEBPACK_IMPORTED_MODULE_24__["default"],
|
16154 | parser: (_diagrams_requirement_parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_25___default())
|
16155 | },
|
16156 | sequence: {
|
16157 | db: _diagrams_sequence_sequenceDb__WEBPACK_IMPORTED_MODULE_26__["default"],
|
16158 | renderer: _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_27__["default"],
|
16159 | parser: (_diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_28___default()),
|
16160 | init: function init(cnf) {
|
16161 | cnf.sequence.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
16162 |
|
16163 | if (cnf.sequenceDiagram) {
|
16164 | // backwards compatibility
|
16165 | _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_27__["default"].setConf(Object.assign(cnf.sequence, cnf.sequenceDiagram));
|
16166 | console.error('`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.');
|
16167 | }
|
16168 |
|
16169 | _diagrams_sequence_sequenceDb__WEBPACK_IMPORTED_MODULE_26__["default"].setWrap(cnf.wrap);
|
16170 | _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_27__["default"].setConf(cnf.sequence);
|
16171 | }
|
16172 | },
|
16173 | state: {
|
16174 | db: _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_29__["default"],
|
16175 | renderer: _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_30__["default"],
|
16176 | parser: (_diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_31___default()),
|
16177 | init: function init(cnf) {
|
16178 | cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
16179 | _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_29__["default"].clear();
|
16180 | }
|
16181 | },
|
16182 | stateDiagram: {
|
16183 | db: _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_29__["default"],
|
16184 | renderer: _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_32__["default"],
|
16185 | parser: (_diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_31___default()),
|
16186 | init: function init(cnf) {
|
16187 | cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
16188 | _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_29__["default"].clear();
|
16189 | }
|
16190 | },
|
16191 | journey: {
|
16192 | db: _diagrams_user_journey_journeyDb__WEBPACK_IMPORTED_MODULE_33__["default"],
|
16193 | renderer: _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_34__["default"],
|
16194 | parser: (_diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_35___default()),
|
16195 | init: function init(cnf) {
|
16196 | _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_34__["default"].setConf(cnf.journey);
|
16197 | _diagrams_user_journey_journeyDb__WEBPACK_IMPORTED_MODULE_33__["default"].clear();
|
16198 | }
|
16199 | }
|
16200 | }; // console.log(sequenceDb);
|
16201 |
|
16202 | var registerDiagram = function registerDiagram(id, parser, db, renderer, init, detector) {
|
16203 | diagrams[id] = {
|
16204 | parser: parser,
|
16205 | db: db,
|
16206 | renderer: renderer,
|
16207 | init: init
|
16208 | };
|
16209 | (0,_detectType__WEBPACK_IMPORTED_MODULE_36__.addDetector)(id, detector);
|
16210 | };
|
16211 | var getDiagrams = function getDiagrams() {
|
16212 | // console.log('diagrams', diagrams);
|
16213 | return diagrams;
|
16214 | };
|
16215 |
|
16216 | /***/ }),
|
16217 |
|
16218 | /***/ "./src/diagrams/c4/c4Db.js":
|
16219 | /*!*********************************!*\
|
16220 | !*** ./src/diagrams/c4/c4Db.js ***!
|
16221 | \*********************************/
|
16222 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
16223 |
|
16224 | "use strict";
|
16225 | __webpack_require__.r(__webpack_exports__);
|
16226 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
16227 | /* harmony export */ "ARROWTYPE": () => (/* binding */ ARROWTYPE),
|
16228 | /* harmony export */ "LINETYPE": () => (/* binding */ LINETYPE),
|
16229 | /* harmony export */ "PLACEMENT": () => (/* binding */ PLACEMENT),
|
16230 | /* harmony export */ "addComponent": () => (/* binding */ addComponent),
|
16231 | /* harmony export */ "addContainer": () => (/* binding */ addContainer),
|
16232 | /* harmony export */ "addContainerBoundary": () => (/* binding */ addContainerBoundary),
|
16233 | /* harmony export */ "addDeploymentNode": () => (/* binding */ addDeploymentNode),
|
16234 | /* harmony export */ "addPersonOrSystem": () => (/* binding */ addPersonOrSystem),
|
16235 | /* harmony export */ "addPersonOrSystemBoundary": () => (/* binding */ addPersonOrSystemBoundary),
|
16236 | /* harmony export */ "addRel": () => (/* binding */ addRel),
|
16237 | /* harmony export */ "autoWrap": () => (/* binding */ autoWrap),
|
16238 | /* harmony export */ "clear": () => (/* binding */ clear),
|
16239 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
16240 | /* harmony export */ "getBoundarys": () => (/* binding */ getBoundarys),
|
16241 | /* harmony export */ "getC4BoundaryInRow": () => (/* binding */ getC4BoundaryInRow),
|
16242 | /* harmony export */ "getC4Shape": () => (/* binding */ getC4Shape),
|
16243 | /* harmony export */ "getC4ShapeArray": () => (/* binding */ getC4ShapeArray),
|
16244 | /* harmony export */ "getC4ShapeInRow": () => (/* binding */ getC4ShapeInRow),
|
16245 | /* harmony export */ "getC4ShapeKeys": () => (/* binding */ getC4ShapeKeys),
|
16246 | /* harmony export */ "getC4Type": () => (/* binding */ getC4Type),
|
16247 | /* harmony export */ "getCurrentBoundaryParse": () => (/* binding */ getCurrentBoundaryParse),
|
16248 | /* harmony export */ "getParentBoundaryParse": () => (/* binding */ getParentBoundaryParse),
|
16249 | /* harmony export */ "getRels": () => (/* binding */ getRels),
|
16250 | /* harmony export */ "getTitle": () => (/* binding */ getTitle),
|
16251 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
16252 | /* harmony export */ "popBoundaryParseStack": () => (/* binding */ popBoundaryParseStack),
|
16253 | /* harmony export */ "setC4Type": () => (/* binding */ setC4Type),
|
16254 | /* harmony export */ "setTitle": () => (/* binding */ setTitle),
|
16255 | /* harmony export */ "setWrap": () => (/* binding */ setWrap),
|
16256 | /* harmony export */ "updateElStyle": () => (/* binding */ updateElStyle),
|
16257 | /* harmony export */ "updateLayoutConfig": () => (/* binding */ updateLayoutConfig),
|
16258 | /* harmony export */ "updateRelStyle": () => (/* binding */ updateRelStyle)
|
16259 | /* harmony export */ });
|
16260 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
16261 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
16262 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
16263 | /* harmony import */ var _commonDb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../commonDb */ "./src/commonDb.js");
|
16264 | function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
16265 |
|
16266 | function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
16267 |
|
16268 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
16269 |
|
16270 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
16271 |
|
16272 | function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
16273 |
|
16274 | function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
16275 |
|
16276 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
16277 |
|
16278 |
|
16279 |
|
16280 |
|
16281 |
|
16282 |
|
16283 | var c4ShapeArray = [];
|
16284 | var boundaryParseStack = [''];
|
16285 | var currentBoundaryParse = 'global';
|
16286 | var parentBoundaryParse = '';
|
16287 | var boundarys = [{
|
16288 | alias: 'global',
|
16289 | label: {
|
16290 | text: 'global'
|
16291 | },
|
16292 | type: {
|
16293 | text: 'global'
|
16294 | },
|
16295 | tags: null,
|
16296 | link: null,
|
16297 | parentBoundary: ''
|
16298 | }];
|
16299 | var rels = [];
|
16300 | var title = '';
|
16301 | var wrapEnabled = false;
|
16302 | var description = '';
|
16303 | var c4ShapeInRow = 4;
|
16304 | var c4BoundaryInRow = 2;
|
16305 | var c4Type;
|
16306 | var getC4Type = function getC4Type() {
|
16307 | return c4Type;
|
16308 | };
|
16309 | var setC4Type = function setC4Type(c4TypeParam) {
|
16310 | var sanitizedText = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.sanitizeText)(c4TypeParam, _config__WEBPACK_IMPORTED_MODULE_1__.getConfig());
|
16311 | c4Type = sanitizedText;
|
16312 | };
|
16313 | var parseDirective = function parseDirective(statement, context, type) {
|
16314 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__["default"].parseDirective(this, statement, context, type);
|
16315 | }; //type, from, to, label, ?techn, ?descr, ?sprite, ?tags, $link
|
16316 |
|
16317 | var addRel = function addRel(type, from, to, label, techn, descr, sprite, tags, link) {
|
16318 | // Don't allow label nulling
|
16319 | if (type === undefined || type === null || from === undefined || from === null || to === undefined || to === null || label === undefined || label === null) return;
|
16320 | var rel = {};
|
16321 | var old = rels.find(function (rel) {
|
16322 | return rel.from === from && rel.to === to;
|
16323 | });
|
16324 |
|
16325 | if (old) {
|
16326 | rel = old;
|
16327 | } else {
|
16328 | rels.push(rel);
|
16329 | }
|
16330 |
|
16331 | rel.type = type;
|
16332 | rel.from = from;
|
16333 | rel.to = to;
|
16334 | rel.label = {
|
16335 | text: label
|
16336 | };
|
16337 |
|
16338 | if (techn === undefined || techn === null) {
|
16339 | rel.techn = {
|
16340 | text: ''
|
16341 | };
|
16342 | } else {
|
16343 | if (_typeof(techn) === 'object') {
|
16344 | var _Object$entries$ = _slicedToArray(Object.entries(techn)[0], 2),
|
16345 | key = _Object$entries$[0],
|
16346 | value = _Object$entries$[1];
|
16347 |
|
16348 | rel[key] = {
|
16349 | text: value
|
16350 | };
|
16351 | } else {
|
16352 | rel.techn = {
|
16353 | text: techn
|
16354 | };
|
16355 | }
|
16356 | }
|
16357 |
|
16358 | if (descr === undefined || descr === null) {
|
16359 | rel.descr = {
|
16360 | text: ''
|
16361 | };
|
16362 | } else {
|
16363 | if (_typeof(descr) === 'object') {
|
16364 | var _Object$entries$2 = _slicedToArray(Object.entries(descr)[0], 2),
|
16365 | _key = _Object$entries$2[0],
|
16366 | _value = _Object$entries$2[1];
|
16367 |
|
16368 | rel[_key] = {
|
16369 | text: _value
|
16370 | };
|
16371 | } else {
|
16372 | rel.descr = {
|
16373 | text: descr
|
16374 | };
|
16375 | }
|
16376 | }
|
16377 |
|
16378 | if (_typeof(sprite) === 'object') {
|
16379 | var _Object$entries$3 = _slicedToArray(Object.entries(sprite)[0], 2),
|
16380 | _key2 = _Object$entries$3[0],
|
16381 | _value2 = _Object$entries$3[1];
|
16382 |
|
16383 | rel[_key2] = _value2;
|
16384 | } else {
|
16385 | rel.sprite = sprite;
|
16386 | }
|
16387 |
|
16388 | if (_typeof(tags) === 'object') {
|
16389 | var _Object$entries$4 = _slicedToArray(Object.entries(tags)[0], 2),
|
16390 | _key3 = _Object$entries$4[0],
|
16391 | _value3 = _Object$entries$4[1];
|
16392 |
|
16393 | rel[_key3] = _value3;
|
16394 | } else {
|
16395 | rel.tags = tags;
|
16396 | }
|
16397 |
|
16398 | if (_typeof(link) === 'object') {
|
16399 | var _Object$entries$5 = _slicedToArray(Object.entries(link)[0], 2),
|
16400 | _key4 = _Object$entries$5[0],
|
16401 | _value4 = _Object$entries$5[1];
|
16402 |
|
16403 | rel[_key4] = _value4;
|
16404 | } else {
|
16405 | rel.link = link;
|
16406 | }
|
16407 |
|
16408 | rel.wrap = autoWrap();
|
16409 | }; //type, alias, label, ?descr, ?sprite, ?tags, $link
|
16410 |
|
16411 | var addPersonOrSystem = function addPersonOrSystem(typeC4Shape, alias, label, descr, sprite, tags, link) {
|
16412 | // Don't allow label nulling
|
16413 | if (alias === null || label === null) return;
|
16414 | var personOrSystem = {};
|
16415 | var old = c4ShapeArray.find(function (personOrSystem) {
|
16416 | return personOrSystem.alias === alias;
|
16417 | });
|
16418 |
|
16419 | if (old && alias === old.alias) {
|
16420 | personOrSystem = old;
|
16421 | } else {
|
16422 | personOrSystem.alias = alias;
|
16423 | c4ShapeArray.push(personOrSystem);
|
16424 | } // Don't allow null labels, either
|
16425 |
|
16426 |
|
16427 | if (label === undefined || label === null) {
|
16428 | personOrSystem.label = {
|
16429 | text: ''
|
16430 | };
|
16431 | } else {
|
16432 | personOrSystem.label = {
|
16433 | text: label
|
16434 | };
|
16435 | }
|
16436 |
|
16437 | if (descr === undefined || descr === null) {
|
16438 | personOrSystem.descr = {
|
16439 | text: ''
|
16440 | };
|
16441 | } else {
|
16442 | if (_typeof(descr) === 'object') {
|
16443 | var _Object$entries$6 = _slicedToArray(Object.entries(descr)[0], 2),
|
16444 | key = _Object$entries$6[0],
|
16445 | value = _Object$entries$6[1];
|
16446 |
|
16447 | personOrSystem[key] = {
|
16448 | text: value
|
16449 | };
|
16450 | } else {
|
16451 | personOrSystem.descr = {
|
16452 | text: descr
|
16453 | };
|
16454 | }
|
16455 | }
|
16456 |
|
16457 | if (_typeof(sprite) === 'object') {
|
16458 | var _Object$entries$7 = _slicedToArray(Object.entries(sprite)[0], 2),
|
16459 | _key5 = _Object$entries$7[0],
|
16460 | _value5 = _Object$entries$7[1];
|
16461 |
|
16462 | personOrSystem[_key5] = _value5;
|
16463 | } else {
|
16464 | personOrSystem.sprite = sprite;
|
16465 | }
|
16466 |
|
16467 | if (_typeof(tags) === 'object') {
|
16468 | var _Object$entries$8 = _slicedToArray(Object.entries(tags)[0], 2),
|
16469 | _key6 = _Object$entries$8[0],
|
16470 | _value6 = _Object$entries$8[1];
|
16471 |
|
16472 | personOrSystem[_key6] = _value6;
|
16473 | } else {
|
16474 | personOrSystem.tags = tags;
|
16475 | }
|
16476 |
|
16477 | if (_typeof(link) === 'object') {
|
16478 | var _Object$entries$9 = _slicedToArray(Object.entries(link)[0], 2),
|
16479 | _key7 = _Object$entries$9[0],
|
16480 | _value7 = _Object$entries$9[1];
|
16481 |
|
16482 | personOrSystem[_key7] = _value7;
|
16483 | } else {
|
16484 | personOrSystem.link = link;
|
16485 | }
|
16486 |
|
16487 | personOrSystem.typeC4Shape = {
|
16488 | text: typeC4Shape
|
16489 | };
|
16490 | personOrSystem.parentBoundary = currentBoundaryParse;
|
16491 | personOrSystem.wrap = autoWrap();
|
16492 | }; //type, alias, label, ?techn, ?descr ?sprite, ?tags, $link
|
16493 |
|
16494 | var addContainer = function addContainer(typeC4Shape, alias, label, techn, descr, sprite, tags, link) {
|
16495 | // Don't allow label nulling
|
16496 | if (alias === null || label === null) return;
|
16497 | var container = {};
|
16498 | var old = c4ShapeArray.find(function (container) {
|
16499 | return container.alias === alias;
|
16500 | });
|
16501 |
|
16502 | if (old && alias === old.alias) {
|
16503 | container = old;
|
16504 | } else {
|
16505 | container.alias = alias;
|
16506 | c4ShapeArray.push(container);
|
16507 | } // Don't allow null labels, either
|
16508 |
|
16509 |
|
16510 | if (label === undefined || label === null) {
|
16511 | container.label = {
|
16512 | text: ''
|
16513 | };
|
16514 | } else {
|
16515 | container.label = {
|
16516 | text: label
|
16517 | };
|
16518 | }
|
16519 |
|
16520 | if (techn === undefined || techn === null) {
|
16521 | container.techn = {
|
16522 | text: ''
|
16523 | };
|
16524 | } else {
|
16525 | if (_typeof(techn) === 'object') {
|
16526 | var _Object$entries$10 = _slicedToArray(Object.entries(techn)[0], 2),
|
16527 | key = _Object$entries$10[0],
|
16528 | value = _Object$entries$10[1];
|
16529 |
|
16530 | container[key] = {
|
16531 | text: value
|
16532 | };
|
16533 | } else {
|
16534 | container.techn = {
|
16535 | text: techn
|
16536 | };
|
16537 | }
|
16538 | }
|
16539 |
|
16540 | if (descr === undefined || descr === null) {
|
16541 | container.descr = {
|
16542 | text: ''
|
16543 | };
|
16544 | } else {
|
16545 | if (_typeof(descr) === 'object') {
|
16546 | var _Object$entries$11 = _slicedToArray(Object.entries(descr)[0], 2),
|
16547 | _key8 = _Object$entries$11[0],
|
16548 | _value8 = _Object$entries$11[1];
|
16549 |
|
16550 | container[_key8] = {
|
16551 | text: _value8
|
16552 | };
|
16553 | } else {
|
16554 | container.descr = {
|
16555 | text: descr
|
16556 | };
|
16557 | }
|
16558 | }
|
16559 |
|
16560 | if (_typeof(sprite) === 'object') {
|
16561 | var _Object$entries$12 = _slicedToArray(Object.entries(sprite)[0], 2),
|
16562 | _key9 = _Object$entries$12[0],
|
16563 | _value9 = _Object$entries$12[1];
|
16564 |
|
16565 | container[_key9] = _value9;
|
16566 | } else {
|
16567 | container.sprite = sprite;
|
16568 | }
|
16569 |
|
16570 | if (_typeof(tags) === 'object') {
|
16571 | var _Object$entries$13 = _slicedToArray(Object.entries(tags)[0], 2),
|
16572 | _key10 = _Object$entries$13[0],
|
16573 | _value10 = _Object$entries$13[1];
|
16574 |
|
16575 | container[_key10] = _value10;
|
16576 | } else {
|
16577 | container.tags = tags;
|
16578 | }
|
16579 |
|
16580 | if (_typeof(link) === 'object') {
|
16581 | var _Object$entries$14 = _slicedToArray(Object.entries(link)[0], 2),
|
16582 | _key11 = _Object$entries$14[0],
|
16583 | _value11 = _Object$entries$14[1];
|
16584 |
|
16585 | container[_key11] = _value11;
|
16586 | } else {
|
16587 | container.link = link;
|
16588 | }
|
16589 |
|
16590 | container.wrap = autoWrap();
|
16591 | container.typeC4Shape = {
|
16592 | text: typeC4Shape
|
16593 | };
|
16594 | container.parentBoundary = currentBoundaryParse;
|
16595 | }; //type, alias, label, ?techn, ?descr ?sprite, ?tags, $link
|
16596 |
|
16597 | var addComponent = function addComponent(typeC4Shape, alias, label, techn, descr, sprite, tags, link) {
|
16598 | // Don't allow label nulling
|
16599 | if (alias === null || label === null) return;
|
16600 | var component = {};
|
16601 | var old = c4ShapeArray.find(function (component) {
|
16602 | return component.alias === alias;
|
16603 | });
|
16604 |
|
16605 | if (old && alias === old.alias) {
|
16606 | component = old;
|
16607 | } else {
|
16608 | component.alias = alias;
|
16609 | c4ShapeArray.push(component);
|
16610 | } // Don't allow null labels, either
|
16611 |
|
16612 |
|
16613 | if (label === undefined || label === null) {
|
16614 | component.label = {
|
16615 | text: ''
|
16616 | };
|
16617 | } else {
|
16618 | component.label = {
|
16619 | text: label
|
16620 | };
|
16621 | }
|
16622 |
|
16623 | if (techn === undefined || techn === null) {
|
16624 | component.techn = {
|
16625 | text: ''
|
16626 | };
|
16627 | } else {
|
16628 | if (_typeof(techn) === 'object') {
|
16629 | var _Object$entries$15 = _slicedToArray(Object.entries(techn)[0], 2),
|
16630 | key = _Object$entries$15[0],
|
16631 | value = _Object$entries$15[1];
|
16632 |
|
16633 | component[key] = {
|
16634 | text: value
|
16635 | };
|
16636 | } else {
|
16637 | component.techn = {
|
16638 | text: techn
|
16639 | };
|
16640 | }
|
16641 | }
|
16642 |
|
16643 | if (descr === undefined || descr === null) {
|
16644 | component.descr = {
|
16645 | text: ''
|
16646 | };
|
16647 | } else {
|
16648 | if (_typeof(descr) === 'object') {
|
16649 | var _Object$entries$16 = _slicedToArray(Object.entries(descr)[0], 2),
|
16650 | _key12 = _Object$entries$16[0],
|
16651 | _value12 = _Object$entries$16[1];
|
16652 |
|
16653 | component[_key12] = {
|
16654 | text: _value12
|
16655 | };
|
16656 | } else {
|
16657 | component.descr = {
|
16658 | text: descr
|
16659 | };
|
16660 | }
|
16661 | }
|
16662 |
|
16663 | if (_typeof(sprite) === 'object') {
|
16664 | var _Object$entries$17 = _slicedToArray(Object.entries(sprite)[0], 2),
|
16665 | _key13 = _Object$entries$17[0],
|
16666 | _value13 = _Object$entries$17[1];
|
16667 |
|
16668 | component[_key13] = _value13;
|
16669 | } else {
|
16670 | component.sprite = sprite;
|
16671 | }
|
16672 |
|
16673 | if (_typeof(tags) === 'object') {
|
16674 | var _Object$entries$18 = _slicedToArray(Object.entries(tags)[0], 2),
|
16675 | _key14 = _Object$entries$18[0],
|
16676 | _value14 = _Object$entries$18[1];
|
16677 |
|
16678 | component[_key14] = _value14;
|
16679 | } else {
|
16680 | component.tags = tags;
|
16681 | }
|
16682 |
|
16683 | if (_typeof(link) === 'object') {
|
16684 | var _Object$entries$19 = _slicedToArray(Object.entries(link)[0], 2),
|
16685 | _key15 = _Object$entries$19[0],
|
16686 | _value15 = _Object$entries$19[1];
|
16687 |
|
16688 | component[_key15] = _value15;
|
16689 | } else {
|
16690 | component.link = link;
|
16691 | }
|
16692 |
|
16693 | component.wrap = autoWrap();
|
16694 | component.typeC4Shape = {
|
16695 | text: typeC4Shape
|
16696 | };
|
16697 | component.parentBoundary = currentBoundaryParse;
|
16698 | }; //alias, label, ?type, ?tags, $link
|
16699 |
|
16700 | var addPersonOrSystemBoundary = function addPersonOrSystemBoundary(alias, label, type, tags, link) {
|
16701 | // if (parentBoundary === null) return;
|
16702 | // Don't allow label nulling
|
16703 | if (alias === null || label === null) return;
|
16704 | var boundary = {};
|
16705 | var old = boundarys.find(function (boundary) {
|
16706 | return boundary.alias === alias;
|
16707 | });
|
16708 |
|
16709 | if (old && alias === old.alias) {
|
16710 | boundary = old;
|
16711 | } else {
|
16712 | boundary.alias = alias;
|
16713 | boundarys.push(boundary);
|
16714 | } // Don't allow null labels, either
|
16715 |
|
16716 |
|
16717 | if (label === undefined || label === null) {
|
16718 | boundary.label = {
|
16719 | text: ''
|
16720 | };
|
16721 | } else {
|
16722 | boundary.label = {
|
16723 | text: label
|
16724 | };
|
16725 | }
|
16726 |
|
16727 | if (type === undefined || type === null) {
|
16728 | boundary.type = {
|
16729 | text: 'system'
|
16730 | };
|
16731 | } else {
|
16732 | if (_typeof(type) === 'object') {
|
16733 | var _Object$entries$20 = _slicedToArray(Object.entries(type)[0], 2),
|
16734 | key = _Object$entries$20[0],
|
16735 | value = _Object$entries$20[1];
|
16736 |
|
16737 | boundary[key] = {
|
16738 | text: value
|
16739 | };
|
16740 | } else {
|
16741 | boundary.type = {
|
16742 | text: type
|
16743 | };
|
16744 | }
|
16745 | }
|
16746 |
|
16747 | if (_typeof(tags) === 'object') {
|
16748 | var _Object$entries$21 = _slicedToArray(Object.entries(tags)[0], 2),
|
16749 | _key16 = _Object$entries$21[0],
|
16750 | _value16 = _Object$entries$21[1];
|
16751 |
|
16752 | boundary[_key16] = _value16;
|
16753 | } else {
|
16754 | boundary.tags = tags;
|
16755 | }
|
16756 |
|
16757 | if (_typeof(link) === 'object') {
|
16758 | var _Object$entries$22 = _slicedToArray(Object.entries(link)[0], 2),
|
16759 | _key17 = _Object$entries$22[0],
|
16760 | _value17 = _Object$entries$22[1];
|
16761 |
|
16762 | boundary[_key17] = _value17;
|
16763 | } else {
|
16764 | boundary.link = link;
|
16765 | }
|
16766 |
|
16767 | boundary.parentBoundary = currentBoundaryParse;
|
16768 | boundary.wrap = autoWrap();
|
16769 | parentBoundaryParse = currentBoundaryParse;
|
16770 | currentBoundaryParse = alias;
|
16771 | boundaryParseStack.push(parentBoundaryParse);
|
16772 | }; //alias, label, ?type, ?tags, $link
|
16773 |
|
16774 | var addContainerBoundary = function addContainerBoundary(alias, label, type, tags, link) {
|
16775 | // if (parentBoundary === null) return;
|
16776 | // Don't allow label nulling
|
16777 | if (alias === null || label === null) return;
|
16778 | var boundary = {};
|
16779 | var old = boundarys.find(function (boundary) {
|
16780 | return boundary.alias === alias;
|
16781 | });
|
16782 |
|
16783 | if (old && alias === old.alias) {
|
16784 | boundary = old;
|
16785 | } else {
|
16786 | boundary.alias = alias;
|
16787 | boundarys.push(boundary);
|
16788 | } // Don't allow null labels, either
|
16789 |
|
16790 |
|
16791 | if (label === undefined || label === null) {
|
16792 | boundary.label = {
|
16793 | text: ''
|
16794 | };
|
16795 | } else {
|
16796 | boundary.label = {
|
16797 | text: label
|
16798 | };
|
16799 | }
|
16800 |
|
16801 | if (type === undefined || type === null) {
|
16802 | boundary.type = {
|
16803 | text: 'container'
|
16804 | };
|
16805 | } else {
|
16806 | if (_typeof(type) === 'object') {
|
16807 | var _Object$entries$23 = _slicedToArray(Object.entries(type)[0], 2),
|
16808 | key = _Object$entries$23[0],
|
16809 | value = _Object$entries$23[1];
|
16810 |
|
16811 | boundary[key] = {
|
16812 | text: value
|
16813 | };
|
16814 | } else {
|
16815 | boundary.type = {
|
16816 | text: type
|
16817 | };
|
16818 | }
|
16819 | }
|
16820 |
|
16821 | if (_typeof(tags) === 'object') {
|
16822 | var _Object$entries$24 = _slicedToArray(Object.entries(tags)[0], 2),
|
16823 | _key18 = _Object$entries$24[0],
|
16824 | _value18 = _Object$entries$24[1];
|
16825 |
|
16826 | boundary[_key18] = _value18;
|
16827 | } else {
|
16828 | boundary.tags = tags;
|
16829 | }
|
16830 |
|
16831 | if (_typeof(link) === 'object') {
|
16832 | var _Object$entries$25 = _slicedToArray(Object.entries(link)[0], 2),
|
16833 | _key19 = _Object$entries$25[0],
|
16834 | _value19 = _Object$entries$25[1];
|
16835 |
|
16836 | boundary[_key19] = _value19;
|
16837 | } else {
|
16838 | boundary.link = link;
|
16839 | }
|
16840 |
|
16841 | boundary.parentBoundary = currentBoundaryParse;
|
16842 | boundary.wrap = autoWrap();
|
16843 | parentBoundaryParse = currentBoundaryParse;
|
16844 | currentBoundaryParse = alias;
|
16845 | boundaryParseStack.push(parentBoundaryParse);
|
16846 | }; //alias, label, ?type, ?descr, ?sprite, ?tags, $link
|
16847 |
|
16848 | var addDeploymentNode = function addDeploymentNode(nodeType, alias, label, type, descr, sprite, tags, link) {
|
16849 | // if (parentBoundary === null) return;
|
16850 | // Don't allow label nulling
|
16851 | if (alias === null || label === null) return;
|
16852 | var boundary = {};
|
16853 | var old = boundarys.find(function (boundary) {
|
16854 | return boundary.alias === alias;
|
16855 | });
|
16856 |
|
16857 | if (old && alias === old.alias) {
|
16858 | boundary = old;
|
16859 | } else {
|
16860 | boundary.alias = alias;
|
16861 | boundarys.push(boundary);
|
16862 | } // Don't allow null labels, either
|
16863 |
|
16864 |
|
16865 | if (label === undefined || label === null) {
|
16866 | boundary.label = {
|
16867 | text: ''
|
16868 | };
|
16869 | } else {
|
16870 | boundary.label = {
|
16871 | text: label
|
16872 | };
|
16873 | }
|
16874 |
|
16875 | if (type === undefined || type === null) {
|
16876 | boundary.type = {
|
16877 | text: 'node'
|
16878 | };
|
16879 | } else {
|
16880 | if (_typeof(type) === 'object') {
|
16881 | var _Object$entries$26 = _slicedToArray(Object.entries(type)[0], 2),
|
16882 | key = _Object$entries$26[0],
|
16883 | value = _Object$entries$26[1];
|
16884 |
|
16885 | boundary[key] = {
|
16886 | text: value
|
16887 | };
|
16888 | } else {
|
16889 | boundary.type = {
|
16890 | text: type
|
16891 | };
|
16892 | }
|
16893 | }
|
16894 |
|
16895 | if (descr === undefined || descr === null) {
|
16896 | boundary.descr = {
|
16897 | text: ''
|
16898 | };
|
16899 | } else {
|
16900 | if (_typeof(descr) === 'object') {
|
16901 | var _Object$entries$27 = _slicedToArray(Object.entries(descr)[0], 2),
|
16902 | _key20 = _Object$entries$27[0],
|
16903 | _value20 = _Object$entries$27[1];
|
16904 |
|
16905 | boundary[_key20] = {
|
16906 | text: _value20
|
16907 | };
|
16908 | } else {
|
16909 | boundary.descr = {
|
16910 | text: descr
|
16911 | };
|
16912 | }
|
16913 | }
|
16914 |
|
16915 | if (_typeof(tags) === 'object') {
|
16916 | var _Object$entries$28 = _slicedToArray(Object.entries(tags)[0], 2),
|
16917 | _key21 = _Object$entries$28[0],
|
16918 | _value21 = _Object$entries$28[1];
|
16919 |
|
16920 | boundary[_key21] = _value21;
|
16921 | } else {
|
16922 | boundary.tags = tags;
|
16923 | }
|
16924 |
|
16925 | if (_typeof(link) === 'object') {
|
16926 | var _Object$entries$29 = _slicedToArray(Object.entries(link)[0], 2),
|
16927 | _key22 = _Object$entries$29[0],
|
16928 | _value22 = _Object$entries$29[1];
|
16929 |
|
16930 | boundary[_key22] = _value22;
|
16931 | } else {
|
16932 | boundary.link = link;
|
16933 | }
|
16934 |
|
16935 | boundary.nodeType = nodeType;
|
16936 | boundary.parentBoundary = currentBoundaryParse;
|
16937 | boundary.wrap = autoWrap();
|
16938 | parentBoundaryParse = currentBoundaryParse;
|
16939 | currentBoundaryParse = alias;
|
16940 | boundaryParseStack.push(parentBoundaryParse);
|
16941 | };
|
16942 | var popBoundaryParseStack = function popBoundaryParseStack() {
|
16943 | currentBoundaryParse = parentBoundaryParse;
|
16944 | boundaryParseStack.pop();
|
16945 | parentBoundaryParse = boundaryParseStack.pop();
|
16946 | boundaryParseStack.push(parentBoundaryParse);
|
16947 | }; //elementName, ?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?sprite, ?techn, ?legendText, ?legendSprite
|
16948 |
|
16949 | var updateElStyle = function updateElStyle(typeC4Shape, elementName, bgColor, fontColor, borderColor, shadowing, shape, sprite, techn, legendText, legendSprite) {
|
16950 | var old = c4ShapeArray.find(function (element) {
|
16951 | return element.alias === elementName;
|
16952 | });
|
16953 |
|
16954 | if (old === undefined) {
|
16955 | old = boundarys.find(function (element) {
|
16956 | return element.alias === elementName;
|
16957 | });
|
16958 |
|
16959 | if (old === undefined) {
|
16960 | return;
|
16961 | }
|
16962 | }
|
16963 |
|
16964 | if (bgColor !== undefined && bgColor !== null) {
|
16965 | if (_typeof(bgColor) === 'object') {
|
16966 | var _Object$entries$30 = _slicedToArray(Object.entries(bgColor)[0], 2),
|
16967 | key = _Object$entries$30[0],
|
16968 | value = _Object$entries$30[1];
|
16969 |
|
16970 | old[key] = value;
|
16971 | } else {
|
16972 | old.bgColor = bgColor;
|
16973 | }
|
16974 | }
|
16975 |
|
16976 | if (fontColor !== undefined && fontColor !== null) {
|
16977 | if (_typeof(fontColor) === 'object') {
|
16978 | var _Object$entries$31 = _slicedToArray(Object.entries(fontColor)[0], 2),
|
16979 | _key23 = _Object$entries$31[0],
|
16980 | _value23 = _Object$entries$31[1];
|
16981 |
|
16982 | old[_key23] = _value23;
|
16983 | } else {
|
16984 | old.fontColor = fontColor;
|
16985 | }
|
16986 | }
|
16987 |
|
16988 | if (borderColor !== undefined && borderColor !== null) {
|
16989 | if (_typeof(borderColor) === 'object') {
|
16990 | var _Object$entries$32 = _slicedToArray(Object.entries(borderColor)[0], 2),
|
16991 | _key24 = _Object$entries$32[0],
|
16992 | _value24 = _Object$entries$32[1];
|
16993 |
|
16994 | old[_key24] = _value24;
|
16995 | } else {
|
16996 | old.borderColor = borderColor;
|
16997 | }
|
16998 | }
|
16999 |
|
17000 | if (shadowing !== undefined && shadowing !== null) {
|
17001 | if (_typeof(shadowing) === 'object') {
|
17002 | var _Object$entries$33 = _slicedToArray(Object.entries(shadowing)[0], 2),
|
17003 | _key25 = _Object$entries$33[0],
|
17004 | _value25 = _Object$entries$33[1];
|
17005 |
|
17006 | old[_key25] = _value25;
|
17007 | } else {
|
17008 | old.shadowing = shadowing;
|
17009 | }
|
17010 | }
|
17011 |
|
17012 | if (shape !== undefined && shape !== null) {
|
17013 | if (_typeof(shape) === 'object') {
|
17014 | var _Object$entries$34 = _slicedToArray(Object.entries(shape)[0], 2),
|
17015 | _key26 = _Object$entries$34[0],
|
17016 | _value26 = _Object$entries$34[1];
|
17017 |
|
17018 | old[_key26] = _value26;
|
17019 | } else {
|
17020 | old.shape = shape;
|
17021 | }
|
17022 | }
|
17023 |
|
17024 | if (sprite !== undefined && sprite !== null) {
|
17025 | if (_typeof(sprite) === 'object') {
|
17026 | var _Object$entries$35 = _slicedToArray(Object.entries(sprite)[0], 2),
|
17027 | _key27 = _Object$entries$35[0],
|
17028 | _value27 = _Object$entries$35[1];
|
17029 |
|
17030 | old[_key27] = _value27;
|
17031 | } else {
|
17032 | old.sprite = sprite;
|
17033 | }
|
17034 | }
|
17035 |
|
17036 | if (techn !== undefined && techn !== null) {
|
17037 | if (_typeof(techn) === 'object') {
|
17038 | var _Object$entries$36 = _slicedToArray(Object.entries(techn)[0], 2),
|
17039 | _key28 = _Object$entries$36[0],
|
17040 | _value28 = _Object$entries$36[1];
|
17041 |
|
17042 | old[_key28] = _value28;
|
17043 | } else {
|
17044 | old.techn = techn;
|
17045 | }
|
17046 | }
|
17047 |
|
17048 | if (legendText !== undefined && legendText !== null) {
|
17049 | if (_typeof(legendText) === 'object') {
|
17050 | var _Object$entries$37 = _slicedToArray(Object.entries(legendText)[0], 2),
|
17051 | _key29 = _Object$entries$37[0],
|
17052 | _value29 = _Object$entries$37[1];
|
17053 |
|
17054 | old[_key29] = _value29;
|
17055 | } else {
|
17056 | old.legendText = legendText;
|
17057 | }
|
17058 | }
|
17059 |
|
17060 | if (legendSprite !== undefined && legendSprite !== null) {
|
17061 | if (_typeof(legendSprite) === 'object') {
|
17062 | var _Object$entries$38 = _slicedToArray(Object.entries(legendSprite)[0], 2),
|
17063 | _key30 = _Object$entries$38[0],
|
17064 | _value30 = _Object$entries$38[1];
|
17065 |
|
17066 | old[_key30] = _value30;
|
17067 | } else {
|
17068 | old.legendSprite = legendSprite;
|
17069 | }
|
17070 | }
|
17071 | }; //textColor, lineColor, ?offsetX, ?offsetY
|
17072 |
|
17073 | var updateRelStyle = function updateRelStyle(typeC4Shape, from, to, textColor, lineColor, offsetX, offsetY) {
|
17074 | var old = rels.find(function (rel) {
|
17075 | return rel.from === from && rel.to === to;
|
17076 | });
|
17077 |
|
17078 | if (old === undefined) {
|
17079 | return;
|
17080 | }
|
17081 |
|
17082 | if (textColor !== undefined && textColor !== null) {
|
17083 | if (_typeof(textColor) === 'object') {
|
17084 | var _Object$entries$39 = _slicedToArray(Object.entries(textColor)[0], 2),
|
17085 | key = _Object$entries$39[0],
|
17086 | value = _Object$entries$39[1];
|
17087 |
|
17088 | old[key] = value;
|
17089 | } else {
|
17090 | old.textColor = textColor;
|
17091 | }
|
17092 | }
|
17093 |
|
17094 | if (lineColor !== undefined && lineColor !== null) {
|
17095 | if (_typeof(lineColor) === 'object') {
|
17096 | var _Object$entries$40 = _slicedToArray(Object.entries(lineColor)[0], 2),
|
17097 | _key31 = _Object$entries$40[0],
|
17098 | _value31 = _Object$entries$40[1];
|
17099 |
|
17100 | old[_key31] = _value31;
|
17101 | } else {
|
17102 | old.lineColor = lineColor;
|
17103 | }
|
17104 | }
|
17105 |
|
17106 | if (offsetX !== undefined && offsetX !== null) {
|
17107 | if (_typeof(offsetX) === 'object') {
|
17108 | var _Object$entries$41 = _slicedToArray(Object.entries(offsetX)[0], 2),
|
17109 | _key32 = _Object$entries$41[0],
|
17110 | _value32 = _Object$entries$41[1];
|
17111 |
|
17112 | old[_key32] = parseInt(_value32);
|
17113 | } else {
|
17114 | old.offsetX = parseInt(offsetX);
|
17115 | }
|
17116 | }
|
17117 |
|
17118 | if (offsetY !== undefined && offsetY !== null) {
|
17119 | if (_typeof(offsetY) === 'object') {
|
17120 | var _Object$entries$42 = _slicedToArray(Object.entries(offsetY)[0], 2),
|
17121 | _key33 = _Object$entries$42[0],
|
17122 | _value33 = _Object$entries$42[1];
|
17123 |
|
17124 | old[_key33] = parseInt(_value33);
|
17125 | } else {
|
17126 | old.offsetY = parseInt(offsetY);
|
17127 | }
|
17128 | }
|
17129 | }; //?c4ShapeInRow, ?c4BoundaryInRow
|
17130 |
|
17131 | var updateLayoutConfig = function updateLayoutConfig(typeC4Shape, c4ShapeInRowParam, c4BoundaryInRowParam) {
|
17132 | var c4ShapeInRowValue = c4ShapeInRow;
|
17133 | var c4BoundaryInRowValue = c4BoundaryInRow;
|
17134 |
|
17135 | if (_typeof(c4ShapeInRowParam) === 'object') {
|
17136 | var _Object$entries$43 = _slicedToArray(Object.entries(c4ShapeInRowParam)[0], 2),
|
17137 | key = _Object$entries$43[0],
|
17138 | value = _Object$entries$43[1];
|
17139 |
|
17140 | c4ShapeInRowValue = parseInt(value);
|
17141 | } else {
|
17142 | c4ShapeInRowValue = parseInt(c4ShapeInRowParam);
|
17143 | }
|
17144 |
|
17145 | if (_typeof(c4BoundaryInRowParam) === 'object') {
|
17146 | var _Object$entries$44 = _slicedToArray(Object.entries(c4BoundaryInRowParam)[0], 2),
|
17147 | _key34 = _Object$entries$44[0],
|
17148 | _value34 = _Object$entries$44[1];
|
17149 |
|
17150 | c4BoundaryInRowValue = parseInt(_value34);
|
17151 | } else {
|
17152 | c4BoundaryInRowValue = parseInt(c4BoundaryInRowParam);
|
17153 | }
|
17154 |
|
17155 | if (c4ShapeInRowValue >= 1) c4ShapeInRow = c4ShapeInRowValue;
|
17156 | if (c4BoundaryInRowValue >= 1) c4BoundaryInRow = c4BoundaryInRowValue;
|
17157 | };
|
17158 | var getC4ShapeInRow = function getC4ShapeInRow() {
|
17159 | return c4ShapeInRow;
|
17160 | };
|
17161 | var getC4BoundaryInRow = function getC4BoundaryInRow() {
|
17162 | return c4BoundaryInRow;
|
17163 | };
|
17164 | var getCurrentBoundaryParse = function getCurrentBoundaryParse() {
|
17165 | return currentBoundaryParse;
|
17166 | };
|
17167 | var getParentBoundaryParse = function getParentBoundaryParse() {
|
17168 | return parentBoundaryParse;
|
17169 | };
|
17170 | var getC4ShapeArray = function getC4ShapeArray(parentBoundary) {
|
17171 | if (parentBoundary === undefined || parentBoundary === null) return c4ShapeArray;else return c4ShapeArray.filter(function (personOrSystem) {
|
17172 | return personOrSystem.parentBoundary === parentBoundary;
|
17173 | });
|
17174 | };
|
17175 | var getC4Shape = function getC4Shape(alias) {
|
17176 | return c4ShapeArray.find(function (personOrSystem) {
|
17177 | return personOrSystem.alias === alias;
|
17178 | });
|
17179 | };
|
17180 | var getC4ShapeKeys = function getC4ShapeKeys(parentBoundary) {
|
17181 | return Object.keys(getC4ShapeArray(parentBoundary));
|
17182 | };
|
17183 | var getBoundarys = function getBoundarys(parentBoundary) {
|
17184 | if (parentBoundary === undefined || parentBoundary === null) return boundarys;else return boundarys.filter(function (boundary) {
|
17185 | return boundary.parentBoundary === parentBoundary;
|
17186 | });
|
17187 | };
|
17188 | var getRels = function getRels() {
|
17189 | return rels;
|
17190 | };
|
17191 | var getTitle = function getTitle() {
|
17192 | return title;
|
17193 | };
|
17194 | var setWrap = function setWrap(wrapSetting) {
|
17195 | wrapEnabled = wrapSetting;
|
17196 | };
|
17197 | var autoWrap = function autoWrap() {
|
17198 | return wrapEnabled;
|
17199 | };
|
17200 | var clear = function clear() {
|
17201 | c4ShapeArray = [];
|
17202 | boundarys = [{
|
17203 | alias: 'global',
|
17204 | label: {
|
17205 | text: 'global'
|
17206 | },
|
17207 | type: {
|
17208 | text: 'global'
|
17209 | },
|
17210 | tags: null,
|
17211 | link: null,
|
17212 | parentBoundary: ''
|
17213 | }];
|
17214 | parentBoundaryParse = '';
|
17215 | currentBoundaryParse = 'global';
|
17216 | boundaryParseStack = [''];
|
17217 | rels = [];
|
17218 | boundaryParseStack = [''];
|
17219 | title = '';
|
17220 | wrapEnabled = false;
|
17221 | description = '';
|
17222 | c4ShapeInRow = 4;
|
17223 | c4BoundaryInRow = 2;
|
17224 | };
|
17225 | var LINETYPE = {
|
17226 | SOLID: 0,
|
17227 | DOTTED: 1,
|
17228 | NOTE: 2,
|
17229 | SOLID_CROSS: 3,
|
17230 | DOTTED_CROSS: 4,
|
17231 | SOLID_OPEN: 5,
|
17232 | DOTTED_OPEN: 6,
|
17233 | LOOP_START: 10,
|
17234 | LOOP_END: 11,
|
17235 | ALT_START: 12,
|
17236 | ALT_ELSE: 13,
|
17237 | ALT_END: 14,
|
17238 | OPT_START: 15,
|
17239 | OPT_END: 16,
|
17240 | ACTIVE_START: 17,
|
17241 | ACTIVE_END: 18,
|
17242 | PAR_START: 19,
|
17243 | PAR_AND: 20,
|
17244 | PAR_END: 21,
|
17245 | RECT_START: 22,
|
17246 | RECT_END: 23,
|
17247 | SOLID_POINT: 24,
|
17248 | DOTTED_POINT: 25
|
17249 | };
|
17250 | var ARROWTYPE = {
|
17251 | FILLED: 0,
|
17252 | OPEN: 1
|
17253 | };
|
17254 | var PLACEMENT = {
|
17255 | LEFTOF: 0,
|
17256 | RIGHTOF: 1,
|
17257 | OVER: 2
|
17258 | };
|
17259 | var setTitle = function setTitle(txt) {
|
17260 | var sanitizedText = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.sanitizeText)(txt, _config__WEBPACK_IMPORTED_MODULE_1__.getConfig());
|
17261 | title = sanitizedText;
|
17262 | };
|
17263 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
17264 | addPersonOrSystem: addPersonOrSystem,
|
17265 | addPersonOrSystemBoundary: addPersonOrSystemBoundary,
|
17266 | addContainer: addContainer,
|
17267 | addContainerBoundary: addContainerBoundary,
|
17268 | addComponent: addComponent,
|
17269 | addDeploymentNode: addDeploymentNode,
|
17270 | popBoundaryParseStack: popBoundaryParseStack,
|
17271 | addRel: addRel,
|
17272 | updateElStyle: updateElStyle,
|
17273 | updateRelStyle: updateRelStyle,
|
17274 | updateLayoutConfig: updateLayoutConfig,
|
17275 | autoWrap: autoWrap,
|
17276 | setWrap: setWrap,
|
17277 | getC4ShapeArray: getC4ShapeArray,
|
17278 | getC4Shape: getC4Shape,
|
17279 | getC4ShapeKeys: getC4ShapeKeys,
|
17280 | getBoundarys: getBoundarys,
|
17281 | getCurrentBoundaryParse: getCurrentBoundaryParse,
|
17282 | getParentBoundaryParse: getParentBoundaryParse,
|
17283 | getRels: getRels,
|
17284 | getTitle: getTitle,
|
17285 | getC4Type: getC4Type,
|
17286 | getC4ShapeInRow: getC4ShapeInRow,
|
17287 | getC4BoundaryInRow: getC4BoundaryInRow,
|
17288 | setAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_3__.setAccTitle,
|
17289 | getAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_3__.getAccTitle,
|
17290 | getAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_3__.getAccDescription,
|
17291 | setAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_3__.setAccDescription,
|
17292 | parseDirective: parseDirective,
|
17293 | getConfig: function getConfig() {
|
17294 | return _config__WEBPACK_IMPORTED_MODULE_1__.getConfig().c4;
|
17295 | },
|
17296 | clear: clear,
|
17297 | LINETYPE: LINETYPE,
|
17298 | ARROWTYPE: ARROWTYPE,
|
17299 | PLACEMENT: PLACEMENT,
|
17300 | setTitle: setTitle,
|
17301 | setC4Type: setC4Type // apply,
|
17302 |
|
17303 | });
|
17304 |
|
17305 | /***/ }),
|
17306 |
|
17307 | /***/ "./src/diagrams/c4/c4Renderer.js":
|
17308 | /*!***************************************!*\
|
17309 | !*** ./src/diagrams/c4/c4Renderer.js ***!
|
17310 | \***************************************/
|
17311 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
17312 |
|
17313 | "use strict";
|
17314 | __webpack_require__.r(__webpack_exports__);
|
17315 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
17316 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
17317 | /* harmony export */ "draw": () => (/* binding */ draw),
|
17318 | /* harmony export */ "drawBoundary": () => (/* binding */ drawBoundary),
|
17319 | /* harmony export */ "drawC4ShapeArray": () => (/* binding */ drawC4ShapeArray),
|
17320 | /* harmony export */ "drawRels": () => (/* binding */ drawRels),
|
17321 | /* harmony export */ "setConf": () => (/* binding */ setConf)
|
17322 | /* harmony export */ });
|
17323 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
17324 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
17325 | /* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/c4/svgDraw.js");
|
17326 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
17327 | /* harmony import */ var _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parser/c4Diagram */ "./src/diagrams/c4/parser/c4Diagram.jison");
|
17328 | /* harmony import */ var _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__);
|
17329 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
17330 | /* harmony import */ var _c4Db__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./c4Db */ "./src/diagrams/c4/c4Db.js");
|
17331 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
17332 | /* harmony import */ var _assignWithDepth__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../assignWithDepth */ "./src/assignWithDepth.js");
|
17333 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
17334 | /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js");
|
17335 | function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
17336 |
|
17337 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
17338 |
|
17339 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
17340 |
|
17341 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
17342 |
|
17343 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
17344 |
|
17345 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
17346 |
|
17347 |
|
17348 |
|
17349 |
|
17350 |
|
17351 |
|
17352 |
|
17353 |
|
17354 |
|
17355 |
|
17356 |
|
17357 | var globalBoundaryMaxX = 0,
|
17358 | globalBoundaryMaxY = 0;
|
17359 | var c4ShapeInRow = 4;
|
17360 | var c4BoundaryInRow = 2;
|
17361 | _parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy = _c4Db__WEBPACK_IMPORTED_MODULE_2__["default"];
|
17362 | var conf = {};
|
17363 |
|
17364 | var Bounds = /*#__PURE__*/function () {
|
17365 | function Bounds(diagObj) {
|
17366 | _classCallCheck(this, Bounds);
|
17367 |
|
17368 | this.name = '';
|
17369 | this.data = {};
|
17370 | this.data.startx = undefined;
|
17371 | this.data.stopx = undefined;
|
17372 | this.data.starty = undefined;
|
17373 | this.data.stopy = undefined;
|
17374 | this.data.widthLimit = undefined;
|
17375 | this.nextData = {};
|
17376 | this.nextData.startx = undefined;
|
17377 | this.nextData.stopx = undefined;
|
17378 | this.nextData.starty = undefined;
|
17379 | this.nextData.stopy = undefined;
|
17380 | this.nextData.cnt = 0;
|
17381 | setConf(diagObj.db.getConfig());
|
17382 | }
|
17383 |
|
17384 | _createClass(Bounds, [{
|
17385 | key: "setData",
|
17386 | value: function setData(startx, stopx, starty, stopy) {
|
17387 | this.nextData.startx = this.data.startx = startx;
|
17388 | this.nextData.stopx = this.data.stopx = stopx;
|
17389 | this.nextData.starty = this.data.starty = starty;
|
17390 | this.nextData.stopy = this.data.stopy = stopy;
|
17391 | }
|
17392 | }, {
|
17393 | key: "updateVal",
|
17394 | value: function updateVal(obj, key, val, fun) {
|
17395 | if (typeof obj[key] === 'undefined') {
|
17396 | obj[key] = val;
|
17397 | } else {
|
17398 | obj[key] = fun(val, obj[key]);
|
17399 | }
|
17400 | }
|
17401 | }, {
|
17402 | key: "insert",
|
17403 | value: function insert(c4Shape) {
|
17404 | this.nextData.cnt = this.nextData.cnt + 1;
|
17405 |
|
17406 | var _startx = this.nextData.startx === this.nextData.stopx ? this.nextData.stopx + c4Shape.margin : this.nextData.stopx + c4Shape.margin * 2;
|
17407 |
|
17408 | var _stopx = _startx + c4Shape.width;
|
17409 |
|
17410 | var _starty = this.nextData.starty + c4Shape.margin * 2;
|
17411 |
|
17412 | var _stopy = _starty + c4Shape.height;
|
17413 |
|
17414 | if (_startx >= this.data.widthLimit || _stopx >= this.data.widthLimit || this.nextData.cnt > c4ShapeInRow) {
|
17415 | _startx = this.nextData.startx + c4Shape.margin + conf.nextLinePaddingX;
|
17416 | _starty = this.nextData.stopy + c4Shape.margin * 2;
|
17417 | this.nextData.stopx = _stopx = _startx + c4Shape.width;
|
17418 | this.nextData.starty = this.nextData.stopy;
|
17419 | this.nextData.stopy = _stopy = _starty + c4Shape.height;
|
17420 | this.nextData.cnt = 1;
|
17421 | }
|
17422 |
|
17423 | c4Shape.x = _startx;
|
17424 | c4Shape.y = _starty;
|
17425 | this.updateVal(this.data, 'startx', _startx, Math.min);
|
17426 | this.updateVal(this.data, 'starty', _starty, Math.min);
|
17427 | this.updateVal(this.data, 'stopx', _stopx, Math.max);
|
17428 | this.updateVal(this.data, 'stopy', _stopy, Math.max);
|
17429 | this.updateVal(this.nextData, 'startx', _startx, Math.min);
|
17430 | this.updateVal(this.nextData, 'starty', _starty, Math.min);
|
17431 | this.updateVal(this.nextData, 'stopx', _stopx, Math.max);
|
17432 | this.updateVal(this.nextData, 'stopy', _stopy, Math.max);
|
17433 | }
|
17434 | }, {
|
17435 | key: "init",
|
17436 | value: function init(diagObj) {
|
17437 | this.name = '';
|
17438 | this.data = {
|
17439 | startx: undefined,
|
17440 | stopx: undefined,
|
17441 | starty: undefined,
|
17442 | stopy: undefined,
|
17443 | widthLimit: undefined
|
17444 | };
|
17445 | this.nextData = {
|
17446 | startx: undefined,
|
17447 | stopx: undefined,
|
17448 | starty: undefined,
|
17449 | stopy: undefined,
|
17450 | cnt: 0
|
17451 | };
|
17452 | setConf(diagObj.db.getConfig());
|
17453 | }
|
17454 | }, {
|
17455 | key: "bumpLastMargin",
|
17456 | value: function bumpLastMargin(margin) {
|
17457 | this.data.stopx += margin;
|
17458 | this.data.stopy += margin;
|
17459 | }
|
17460 | }]);
|
17461 |
|
17462 | return Bounds;
|
17463 | }();
|
17464 |
|
17465 | var setConf = function setConf(cnf) {
|
17466 | (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_3__["default"])(conf, cnf);
|
17467 |
|
17468 | if (cnf.fontFamily) {
|
17469 | conf.personFontFamily = conf.systemFontFamily = conf.messageFontFamily = cnf.fontFamily;
|
17470 | }
|
17471 |
|
17472 | if (cnf.fontSize) {
|
17473 | conf.personFontSize = conf.systemFontSize = conf.messageFontSize = cnf.fontSize;
|
17474 | }
|
17475 |
|
17476 | if (cnf.fontWeight) {
|
17477 | conf.personFontWeight = conf.systemFontWeight = conf.messageFontWeight = cnf.fontWeight;
|
17478 | }
|
17479 | };
|
17480 |
|
17481 | var c4ShapeFont = function c4ShapeFont(cnf, typeC4Shape) {
|
17482 | return {
|
17483 | fontFamily: cnf[typeC4Shape + 'FontFamily'],
|
17484 | fontSize: cnf[typeC4Shape + 'FontSize'],
|
17485 | fontWeight: cnf[typeC4Shape + 'FontWeight']
|
17486 | };
|
17487 | };
|
17488 |
|
17489 | var boundaryFont = function boundaryFont(cnf) {
|
17490 | return {
|
17491 | fontFamily: cnf.boundaryFontFamily,
|
17492 | fontSize: cnf.boundaryFontSize,
|
17493 | fontWeight: cnf.boundaryFontWeight
|
17494 | };
|
17495 | };
|
17496 |
|
17497 | var messageFont = function messageFont(cnf) {
|
17498 | return {
|
17499 | fontFamily: cnf.messageFontFamily,
|
17500 | fontSize: cnf.messageFontSize,
|
17501 | fontWeight: cnf.messageFontWeight
|
17502 | };
|
17503 | };
|
17504 | /**
|
17505 | * @param textType
|
17506 | * @param c4Shape
|
17507 | * @param c4ShapeTextWrap
|
17508 | * @param textConf
|
17509 | * @param textLimitWidth
|
17510 | */
|
17511 |
|
17512 |
|
17513 | function calcC4ShapeTextWH(textType, c4Shape, c4ShapeTextWrap, textConf, textLimitWidth) {
|
17514 | if (!c4Shape[textType].width) {
|
17515 | if (c4ShapeTextWrap) {
|
17516 | c4Shape[textType].text = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.wrapLabel)(c4Shape[textType].text, textLimitWidth, textConf);
|
17517 | c4Shape[textType].textLines = c4Shape[textType].text.split(_common_common__WEBPACK_IMPORTED_MODULE_5__["default"].lineBreakRegex).length; // c4Shape[textType].width = calculateTextWidth(c4Shape[textType].text, textConf);
|
17518 |
|
17519 | c4Shape[textType].width = textLimitWidth; // c4Shape[textType].height = c4Shape[textType].textLines * textConf.fontSize;
|
17520 |
|
17521 | c4Shape[textType].height = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.calculateTextHeight)(c4Shape[textType].text, textConf);
|
17522 | } else {
|
17523 | var lines = c4Shape[textType].text.split(_common_common__WEBPACK_IMPORTED_MODULE_5__["default"].lineBreakRegex);
|
17524 | c4Shape[textType].textLines = lines.length;
|
17525 | var lineHeight = 0;
|
17526 | c4Shape[textType].height = 0;
|
17527 | c4Shape[textType].width = 0;
|
17528 |
|
17529 | for (var i = 0; i < lines.length; i++) {
|
17530 | c4Shape[textType].width = Math.max((0,_utils__WEBPACK_IMPORTED_MODULE_4__.calculateTextWidth)(lines[i], textConf), c4Shape[textType].width);
|
17531 | lineHeight = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.calculateTextHeight)(lines[i], textConf);
|
17532 | c4Shape[textType].height = c4Shape[textType].height + lineHeight;
|
17533 | } // c4Shapes[textType].height = c4Shapes[textType].textLines * textConf.fontSize;
|
17534 |
|
17535 | }
|
17536 | }
|
17537 | }
|
17538 |
|
17539 | var drawBoundary = function drawBoundary(diagram, boundary, bounds) {
|
17540 | boundary.x = bounds.data.startx;
|
17541 | boundary.y = bounds.data.starty;
|
17542 | boundary.width = bounds.data.stopx - bounds.data.startx;
|
17543 | boundary.height = bounds.data.stopy - bounds.data.starty;
|
17544 | boundary.label.y = conf.c4ShapeMargin - 35;
|
17545 | var boundaryTextWrap = boundary.wrap && conf.wrap;
|
17546 | var boundaryLabelConf = boundaryFont(conf);
|
17547 | boundaryLabelConf.fontSize = boundaryLabelConf.fontSize + 2;
|
17548 | boundaryLabelConf.fontWeight = 'bold';
|
17549 | var textLimitWidth = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.calculateTextWidth)(boundary.label.text, boundaryLabelConf);
|
17550 | calcC4ShapeTextWH('label', boundary, boundaryTextWrap, boundaryLabelConf, textLimitWidth);
|
17551 | _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawBoundary(diagram, boundary, conf);
|
17552 | };
|
17553 | var drawC4ShapeArray = function drawC4ShapeArray(currentBounds, diagram, c4ShapeArray, c4ShapeKeys) {
|
17554 | // Upper Y is relative point
|
17555 | var Y = 0; // Draw the c4ShapeArray
|
17556 |
|
17557 | for (var i = 0; i < c4ShapeKeys.length; i++) {
|
17558 | Y = 0;
|
17559 | var c4Shape = c4ShapeArray[c4ShapeKeys[i]]; // calc c4 shape type width and height
|
17560 |
|
17561 | var c4ShapeTypeConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
|
17562 | c4ShapeTypeConf.fontSize = c4ShapeTypeConf.fontSize - 2;
|
17563 | c4Shape.typeC4Shape.width = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.calculateTextWidth)('<<' + c4Shape.typeC4Shape.text + '>>', c4ShapeTypeConf);
|
17564 | c4Shape.typeC4Shape.height = c4ShapeTypeConf.fontSize + 2;
|
17565 | c4Shape.typeC4Shape.Y = conf.c4ShapePadding;
|
17566 | Y = c4Shape.typeC4Shape.Y + c4Shape.typeC4Shape.height - 4; // set image width and height c4Shape.x + c4Shape.width / 2 - 24, c4Shape.y + 28
|
17567 | // let imageWidth = 0,
|
17568 | // imageHeight = 0,
|
17569 | // imageY = 0;
|
17570 | //
|
17571 |
|
17572 | c4Shape.image = {
|
17573 | width: 0,
|
17574 | height: 0,
|
17575 | Y: 0
|
17576 | };
|
17577 |
|
17578 | switch (c4Shape.typeC4Shape.text) {
|
17579 | case 'person':
|
17580 | case 'external_person':
|
17581 | c4Shape.image.width = 48;
|
17582 | c4Shape.image.height = 48;
|
17583 | c4Shape.image.Y = Y;
|
17584 | Y = c4Shape.image.Y + c4Shape.image.height;
|
17585 | break;
|
17586 | }
|
17587 |
|
17588 | if (c4Shape.sprite) {
|
17589 | c4Shape.image.width = 48;
|
17590 | c4Shape.image.height = 48;
|
17591 | c4Shape.image.Y = Y;
|
17592 | Y = c4Shape.image.Y + c4Shape.image.height;
|
17593 | } // Y = conf.c4ShapePadding + c4Shape.image.height;
|
17594 |
|
17595 |
|
17596 | var c4ShapeTextWrap = c4Shape.wrap && conf.wrap;
|
17597 | var textLimitWidth = conf.width - conf.c4ShapePadding * 2;
|
17598 | var c4ShapeLabelConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
|
17599 | c4ShapeLabelConf.fontSize = c4ShapeLabelConf.fontSize + 2;
|
17600 | c4ShapeLabelConf.fontWeight = 'bold';
|
17601 | calcC4ShapeTextWH('label', c4Shape, c4ShapeTextWrap, c4ShapeLabelConf, textLimitWidth);
|
17602 | c4Shape['label'].Y = Y + 8;
|
17603 | Y = c4Shape['label'].Y + c4Shape['label'].height;
|
17604 |
|
17605 | if (c4Shape.type && c4Shape.type.text !== '') {
|
17606 | c4Shape.type.text = '[' + c4Shape.type.text + ']';
|
17607 |
|
17608 | var _c4ShapeTypeConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
|
17609 |
|
17610 | calcC4ShapeTextWH('type', c4Shape, c4ShapeTextWrap, _c4ShapeTypeConf, textLimitWidth);
|
17611 | c4Shape['type'].Y = Y + 5;
|
17612 | Y = c4Shape['type'].Y + c4Shape['type'].height;
|
17613 | } else if (c4Shape.techn && c4Shape.techn.text !== '') {
|
17614 | c4Shape.techn.text = '[' + c4Shape.techn.text + ']';
|
17615 | var c4ShapeTechnConf = c4ShapeFont(conf, c4Shape.techn.text);
|
17616 | calcC4ShapeTextWH('techn', c4Shape, c4ShapeTextWrap, c4ShapeTechnConf, textLimitWidth);
|
17617 | c4Shape['techn'].Y = Y + 5;
|
17618 | Y = c4Shape['techn'].Y + c4Shape['techn'].height;
|
17619 | }
|
17620 |
|
17621 | var rectHeight = Y;
|
17622 | var rectWidth = c4Shape.label.width;
|
17623 |
|
17624 | if (c4Shape.descr && c4Shape.descr.text !== '') {
|
17625 | var c4ShapeDescrConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text);
|
17626 | calcC4ShapeTextWH('descr', c4Shape, c4ShapeTextWrap, c4ShapeDescrConf, textLimitWidth);
|
17627 | c4Shape['descr'].Y = Y + 20;
|
17628 | Y = c4Shape['descr'].Y + c4Shape['descr'].height;
|
17629 | rectWidth = Math.max(c4Shape.label.width, c4Shape.descr.width);
|
17630 | rectHeight = Y - c4Shape['descr'].textLines * 5;
|
17631 | }
|
17632 |
|
17633 | rectWidth = rectWidth + conf.c4ShapePadding; // let rectHeight =
|
17634 |
|
17635 | c4Shape.width = Math.max(c4Shape.width || conf.width, rectWidth, conf.width);
|
17636 | c4Shape.height = Math.max(c4Shape.height || conf.height, rectHeight, conf.height);
|
17637 | c4Shape.margin = c4Shape.margin || conf.c4ShapeMargin;
|
17638 | currentBounds.insert(c4Shape);
|
17639 | var height = _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawC4Shape(diagram, c4Shape, conf);
|
17640 | }
|
17641 |
|
17642 | currentBounds.bumpLastMargin(conf.c4ShapeMargin);
|
17643 | };
|
17644 |
|
17645 | var Point = /*#__PURE__*/_createClass(function Point(x, y) {
|
17646 | _classCallCheck(this, Point);
|
17647 |
|
17648 | this.x = x;
|
17649 | this.y = y;
|
17650 | });
|
17651 | /* * *
|
17652 | * Get the intersection of the line between the center point of a rectangle and a point outside the rectangle.
|
17653 | * Algorithm idea.
|
17654 | * Using a point outside the rectangle as the coordinate origin, the graph is divided into four quadrants, and each quadrant is divided into two cases, with separate treatment on the coordinate axes
|
17655 | * 1. The case of coordinate axes.
|
17656 | * 1. The case of the negative x-axis
|
17657 | * 2. The case of the positive x-axis
|
17658 | * 3. The case of the positive y-axis
|
17659 | * 4. The negative y-axis case
|
17660 | * 2. Quadrant cases.
|
17661 | * 2.1. first quadrant: the case where the line intersects the left side of the rectangle; the case where it intersects the lower side of the rectangle
|
17662 | * 2.2. second quadrant: the case where the line intersects the right side of the rectangle; the case where it intersects the lower edge of the rectangle
|
17663 | * 2.3. third quadrant: the case where the line intersects the right side of the rectangle; the case where it intersects the upper edge of the rectangle
|
17664 | * 2.4. fourth quadrant: the case where the line intersects the left side of the rectangle; the case where it intersects the upper side of the rectangle
|
17665 | *
|
17666 | */
|
17667 |
|
17668 |
|
17669 | var getIntersectPoint = function getIntersectPoint(fromNode, endPoint) {
|
17670 | var x1 = fromNode.x;
|
17671 | var y1 = fromNode.y;
|
17672 | var x2 = endPoint.x;
|
17673 | var y2 = endPoint.y;
|
17674 | var fromCenterX = x1 + fromNode.width / 2;
|
17675 | var fromCenterY = y1 + fromNode.height / 2;
|
17676 | var dx = Math.abs(x1 - x2);
|
17677 | var dy = Math.abs(y1 - y2);
|
17678 | var tanDYX = dy / dx;
|
17679 | var fromDYX = fromNode.height / fromNode.width;
|
17680 | var returnPoint = null;
|
17681 |
|
17682 | if (y1 == y2 && x1 < x2) {
|
17683 | returnPoint = new Point(x1 + fromNode.width, fromCenterY);
|
17684 | } else if (y1 == y2 && x1 > x2) {
|
17685 | returnPoint = new Point(x1, fromCenterY);
|
17686 | } else if (x1 == x2 && y1 < y2) {
|
17687 | returnPoint = new Point(fromCenterX, y1 + fromNode.height);
|
17688 | } else if (x1 == x2 && y1 > y2) {
|
17689 | returnPoint = new Point(fromCenterX, y1);
|
17690 | }
|
17691 |
|
17692 | if (x1 > x2 && y1 < y2) {
|
17693 | if (fromDYX >= tanDYX) {
|
17694 | returnPoint = new Point(x1, fromCenterY + tanDYX * fromNode.width / 2);
|
17695 | } else {
|
17696 | returnPoint = new Point(fromCenterX - dx / dy * fromNode.height / 2, y1 + fromNode.height);
|
17697 | }
|
17698 | } else if (x1 < x2 && y1 < y2) {
|
17699 | //
|
17700 | if (fromDYX >= tanDYX) {
|
17701 | returnPoint = new Point(x1 + fromNode.width, fromCenterY + tanDYX * fromNode.width / 2);
|
17702 | } else {
|
17703 | returnPoint = new Point(fromCenterX + dx / dy * fromNode.height / 2, y1 + fromNode.height);
|
17704 | }
|
17705 | } else if (x1 < x2 && y1 > y2) {
|
17706 | if (fromDYX >= tanDYX) {
|
17707 | returnPoint = new Point(x1 + fromNode.width, fromCenterY - tanDYX * fromNode.width / 2);
|
17708 | } else {
|
17709 | returnPoint = new Point(fromCenterX + fromNode.height / 2 * dx / dy, y1);
|
17710 | }
|
17711 | } else if (x1 > x2 && y1 > y2) {
|
17712 | if (fromDYX >= tanDYX) {
|
17713 | returnPoint = new Point(x1, fromCenterY - fromNode.width / 2 * tanDYX);
|
17714 | } else {
|
17715 | returnPoint = new Point(fromCenterX - fromNode.height / 2 * dx / dy, y1);
|
17716 | }
|
17717 | }
|
17718 |
|
17719 | return returnPoint;
|
17720 | };
|
17721 |
|
17722 | var getIntersectPoints = function getIntersectPoints(fromNode, endNode) {
|
17723 | var endIntersectPoint = {
|
17724 | x: 0,
|
17725 | y: 0
|
17726 | };
|
17727 | endIntersectPoint.x = endNode.x + endNode.width / 2;
|
17728 | endIntersectPoint.y = endNode.y + endNode.height / 2;
|
17729 | var startPoint = getIntersectPoint(fromNode, endIntersectPoint);
|
17730 | endIntersectPoint.x = fromNode.x + fromNode.width / 2;
|
17731 | endIntersectPoint.y = fromNode.y + fromNode.height / 2;
|
17732 | var endPoint = getIntersectPoint(endNode, endIntersectPoint);
|
17733 | return {
|
17734 | startPoint: startPoint,
|
17735 | endPoint: endPoint
|
17736 | };
|
17737 | };
|
17738 |
|
17739 | var drawRels = function drawRels(diagram, rels, getC4ShapeObj, diagObj) {
|
17740 | var i = 0;
|
17741 |
|
17742 | var _iterator = _createForOfIteratorHelper(rels),
|
17743 | _step;
|
17744 |
|
17745 | try {
|
17746 | for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
17747 | var rel = _step.value;
|
17748 | i = i + 1;
|
17749 | var relTextWrap = rel.wrap && conf.wrap;
|
17750 | var relConf = messageFont(conf);
|
17751 | var diagramType = diagObj.db.getC4Type();
|
17752 | if (diagramType === 'C4Dynamic') rel.label.text = i + ': ' + rel.label.text;
|
17753 | var textLimitWidth = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.calculateTextWidth)(rel.label.text, relConf);
|
17754 | calcC4ShapeTextWH('label', rel, relTextWrap, relConf, textLimitWidth);
|
17755 |
|
17756 | if (rel.techn && rel.techn.text !== '') {
|
17757 | textLimitWidth = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.calculateTextWidth)(rel.techn.text, relConf);
|
17758 | calcC4ShapeTextWH('techn', rel, relTextWrap, relConf, textLimitWidth);
|
17759 | }
|
17760 |
|
17761 | if (rel.descr && rel.descr.text !== '') {
|
17762 | textLimitWidth = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.calculateTextWidth)(rel.descr.text, relConf);
|
17763 | calcC4ShapeTextWH('descr', rel, relTextWrap, relConf, textLimitWidth);
|
17764 | }
|
17765 |
|
17766 | var fromNode = getC4ShapeObj(rel.from);
|
17767 | var endNode = getC4ShapeObj(rel.to);
|
17768 | var points = getIntersectPoints(fromNode, endNode);
|
17769 | rel.startPoint = points.startPoint;
|
17770 | rel.endPoint = points.endPoint;
|
17771 | }
|
17772 | } catch (err) {
|
17773 | _iterator.e(err);
|
17774 | } finally {
|
17775 | _iterator.f();
|
17776 | }
|
17777 |
|
17778 | _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawRels(diagram, rels, conf);
|
17779 | };
|
17780 | /**
|
17781 | * @param diagram
|
17782 | * @param parentBoundaryAlias
|
17783 | * @param parentBounds
|
17784 | * @param currentBoundarys
|
17785 | * @param diagObj
|
17786 | */
|
17787 |
|
17788 | function drawInsideBoundary(diagram, parentBoundaryAlias, parentBounds, currentBoundarys, diagObj) {
|
17789 | var currentBounds = new Bounds(diagObj); // Calculate the width limit of the boundar. label/type 的长度,
|
17790 |
|
17791 | currentBounds.data.widthLimit = parentBounds.data.widthLimit / Math.min(c4BoundaryInRow, currentBoundarys.length); // Math.min(
|
17792 | // conf.width * conf.c4ShapeInRow + conf.c4ShapeMargin * conf.c4ShapeInRow * 2,
|
17793 | // parentBounds.data.widthLimit / Math.min(conf.c4BoundaryInRow, currentBoundarys.length)
|
17794 | // );
|
17795 |
|
17796 | for (var i = 0; i < currentBoundarys.length; i++) {
|
17797 | var currentBoundary = currentBoundarys[i];
|
17798 | var Y = 0;
|
17799 | currentBoundary.image = {
|
17800 | width: 0,
|
17801 | height: 0,
|
17802 | Y: 0
|
17803 | };
|
17804 |
|
17805 | if (currentBoundary.sprite) {
|
17806 | currentBoundary.image.width = 48;
|
17807 | currentBoundary.image.height = 48;
|
17808 | currentBoundary.image.Y = Y;
|
17809 | Y = currentBoundary.image.Y + currentBoundary.image.height;
|
17810 | }
|
17811 |
|
17812 | var currentBoundaryTextWrap = currentBoundary.wrap && conf.wrap;
|
17813 | var currentBoundaryLabelConf = boundaryFont(conf);
|
17814 | currentBoundaryLabelConf.fontSize = currentBoundaryLabelConf.fontSize + 2;
|
17815 | currentBoundaryLabelConf.fontWeight = 'bold';
|
17816 | calcC4ShapeTextWH('label', currentBoundary, currentBoundaryTextWrap, currentBoundaryLabelConf, currentBounds.data.widthLimit);
|
17817 | currentBoundary['label'].Y = Y + 8;
|
17818 | Y = currentBoundary['label'].Y + currentBoundary['label'].height;
|
17819 |
|
17820 | if (currentBoundary.type && currentBoundary.type.text !== '') {
|
17821 | currentBoundary.type.text = '[' + currentBoundary.type.text + ']';
|
17822 | var currentBoundaryTypeConf = boundaryFont(conf);
|
17823 | calcC4ShapeTextWH('type', currentBoundary, currentBoundaryTextWrap, currentBoundaryTypeConf, currentBounds.data.widthLimit);
|
17824 | currentBoundary['type'].Y = Y + 5;
|
17825 | Y = currentBoundary['type'].Y + currentBoundary['type'].height;
|
17826 | }
|
17827 |
|
17828 | if (currentBoundary.descr && currentBoundary.descr.text !== '') {
|
17829 | var currentBoundaryDescrConf = boundaryFont(conf);
|
17830 | currentBoundaryDescrConf.fontSize = currentBoundaryDescrConf.fontSize - 2;
|
17831 | calcC4ShapeTextWH('descr', currentBoundary, currentBoundaryTextWrap, currentBoundaryDescrConf, currentBounds.data.widthLimit);
|
17832 | currentBoundary['descr'].Y = Y + 20;
|
17833 | Y = currentBoundary['descr'].Y + currentBoundary['descr'].height;
|
17834 | }
|
17835 |
|
17836 | if (i == 0 || i % c4BoundaryInRow === 0) {
|
17837 | // Calculate the drawing start point of the currentBoundarys.
|
17838 | var _x = parentBounds.data.startx + conf.diagramMarginX;
|
17839 |
|
17840 | var _y = parentBounds.data.stopy + conf.diagramMarginY + Y;
|
17841 |
|
17842 | currentBounds.setData(_x, _x, _y, _y);
|
17843 | } else {
|
17844 | // Calculate the drawing start point of the currentBoundarys.
|
17845 | var _x2 = currentBounds.data.stopx !== currentBounds.data.startx ? currentBounds.data.stopx + conf.diagramMarginX : currentBounds.data.startx;
|
17846 |
|
17847 | var _y2 = currentBounds.data.starty;
|
17848 | currentBounds.setData(_x2, _x2, _y2, _y2);
|
17849 | }
|
17850 |
|
17851 | currentBounds.name = currentBoundary.alias;
|
17852 | var currentPersonOrSystemArray = diagObj.db.getC4ShapeArray(currentBoundary.alias);
|
17853 | var currentPersonOrSystemKeys = diagObj.db.getC4ShapeKeys(currentBoundary.alias);
|
17854 |
|
17855 | if (currentPersonOrSystemKeys.length > 0) {
|
17856 | drawC4ShapeArray(currentBounds, diagram, currentPersonOrSystemArray, currentPersonOrSystemKeys);
|
17857 | }
|
17858 |
|
17859 | parentBoundaryAlias = currentBoundary.alias;
|
17860 | var nextCurrentBoundarys = diagObj.db.getBoundarys(parentBoundaryAlias);
|
17861 |
|
17862 | if (nextCurrentBoundarys.length > 0) {
|
17863 | // draw boundary inside currentBoundary
|
17864 | // bounds.init();
|
17865 | // parentBoundaryWidthLimit = bounds.data.stopx - bounds.startx;
|
17866 | drawInsideBoundary(diagram, parentBoundaryAlias, currentBounds, nextCurrentBoundarys, diagObj);
|
17867 | } // draw boundary
|
17868 |
|
17869 |
|
17870 | if (currentBoundary.alias !== 'global') drawBoundary(diagram, currentBoundary, currentBounds);
|
17871 | parentBounds.data.stopy = Math.max(currentBounds.data.stopy + conf.c4ShapeMargin, parentBounds.data.stopy);
|
17872 | parentBounds.data.stopx = Math.max(currentBounds.data.stopx + conf.c4ShapeMargin, parentBounds.data.stopx);
|
17873 | globalBoundaryMaxX = Math.max(globalBoundaryMaxX, parentBounds.data.stopx);
|
17874 | globalBoundaryMaxY = Math.max(globalBoundaryMaxY, parentBounds.data.stopy);
|
17875 | }
|
17876 | }
|
17877 | /**
|
17878 | * Draws a sequenceDiagram in the tag with id: id based on the graph definition in text.
|
17879 | *
|
17880 | * @param {any} text
|
17881 | * @param _text
|
17882 | * @param {any} id
|
17883 | * @param _version
|
17884 | * @param diagObj
|
17885 | */
|
17886 |
|
17887 |
|
17888 | var draw = function draw(_text, id, _version, diagObj) {
|
17889 | conf = _config__WEBPACK_IMPORTED_MODULE_7__.getConfig().c4;
|
17890 | var securityLevel = _config__WEBPACK_IMPORTED_MODULE_7__.getConfig().securityLevel; // Handle root and Document for when rendering in sanbox mode
|
17891 |
|
17892 | var sandboxElement;
|
17893 |
|
17894 | if (securityLevel === 'sandbox') {
|
17895 | sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#i' + id);
|
17896 | }
|
17897 |
|
17898 | var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body');
|
17899 | var db = diagObj.db;
|
17900 | diagObj.db.setWrap(conf.wrap);
|
17901 | c4ShapeInRow = db.getC4ShapeInRow();
|
17902 | c4BoundaryInRow = db.getC4BoundaryInRow();
|
17903 | _logger__WEBPACK_IMPORTED_MODULE_8__.log.debug("C:".concat(JSON.stringify(conf, null, 2)));
|
17904 | var diagram = securityLevel === 'sandbox' ? root.select("[id=\"".concat(id, "\"]")) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id=\"".concat(id, "\"]"));
|
17905 | _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].insertComputerIcon(diagram);
|
17906 | _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].insertDatabaseIcon(diagram);
|
17907 | _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].insertClockIcon(diagram);
|
17908 | var screenBounds = new Bounds(diagObj);
|
17909 | screenBounds.setData(conf.diagramMarginX, conf.diagramMarginX, conf.diagramMarginY, conf.diagramMarginY);
|
17910 | screenBounds.data.widthLimit = screen.availWidth;
|
17911 | globalBoundaryMaxX = conf.diagramMarginX;
|
17912 | globalBoundaryMaxY = conf.diagramMarginY;
|
17913 | var title = diagObj.db.getTitle();
|
17914 | var c4type = diagObj.db.getC4Type();
|
17915 | var currentBoundarys = diagObj.db.getBoundarys(''); // switch (c4type) {
|
17916 | // case 'C4Context':
|
17917 |
|
17918 | drawInsideBoundary(diagram, '', screenBounds, currentBoundarys, diagObj); // break;
|
17919 | // }
|
17920 | // The arrow head definition is attached to the svg once
|
17921 |
|
17922 | _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].insertArrowHead(diagram);
|
17923 | _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].insertArrowEnd(diagram);
|
17924 | _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].insertArrowCrossHead(diagram);
|
17925 | _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].insertArrowFilledHead(diagram);
|
17926 | drawRels(diagram, diagObj.db.getRels(), diagObj.db.getC4Shape, diagObj);
|
17927 | screenBounds.data.stopx = globalBoundaryMaxX;
|
17928 | screenBounds.data.stopy = globalBoundaryMaxY;
|
17929 | var box = screenBounds.data; // Make sure the height of the diagram supports long menus.
|
17930 |
|
17931 | var boxHeight = box.stopy - box.starty;
|
17932 | var height = boxHeight + 2 * conf.diagramMarginY; // Make sure the width of the diagram supports wide menus.
|
17933 |
|
17934 | var boxWidth = box.stopx - box.startx;
|
17935 | var width = boxWidth + 2 * conf.diagramMarginX;
|
17936 |
|
17937 | if (title) {
|
17938 | diagram.append('text').text(title).attr('x', (box.stopx - box.startx) / 2 - 4 * conf.diagramMarginX).attr('y', box.starty + conf.diagramMarginY);
|
17939 | }
|
17940 |
|
17941 | (0,_utils__WEBPACK_IMPORTED_MODULE_4__.configureSvgSize)(diagram, height, width, conf.useMaxWidth);
|
17942 | var extraVertForTitle = title ? 60 : 0;
|
17943 | diagram.attr('viewBox', box.startx - conf.diagramMarginX + ' -' + (conf.diagramMarginY + extraVertForTitle) + ' ' + width + ' ' + (height + extraVertForTitle));
|
17944 | (0,_accessibility__WEBPACK_IMPORTED_MODULE_9__["default"])(_parser_c4Diagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy, diagram, id);
|
17945 | _logger__WEBPACK_IMPORTED_MODULE_8__.log.debug("models:", box);
|
17946 | };
|
17947 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
17948 | drawPersonOrSystemArray: drawC4ShapeArray,
|
17949 | drawBoundary: drawBoundary,
|
17950 | setConf: setConf,
|
17951 | draw: draw
|
17952 | });
|
17953 |
|
17954 | /***/ }),
|
17955 |
|
17956 | /***/ "./src/diagrams/c4/styles.js":
|
17957 | /*!***********************************!*\
|
17958 | !*** ./src/diagrams/c4/styles.js ***!
|
17959 | \***********************************/
|
17960 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
17961 |
|
17962 | "use strict";
|
17963 | __webpack_require__.r(__webpack_exports__);
|
17964 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
17965 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
17966 | /* harmony export */ });
|
17967 | var getStyles = function getStyles(options) {
|
17968 | return ".person {\n stroke: ".concat(options.personBorder, ";\n fill: ").concat(options.personBkg, ";\n }\n");
|
17969 | };
|
17970 |
|
17971 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
17972 |
|
17973 | /***/ }),
|
17974 |
|
17975 | /***/ "./src/diagrams/c4/svgDraw.js":
|
17976 | /*!************************************!*\
|
17977 | !*** ./src/diagrams/c4/svgDraw.js ***!
|
17978 | \************************************/
|
17979 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
17980 |
|
17981 | "use strict";
|
17982 | __webpack_require__.r(__webpack_exports__);
|
17983 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
17984 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
17985 | /* harmony export */ "drawC4Shape": () => (/* binding */ drawC4Shape),
|
17986 | /* harmony export */ "drawEmbeddedImage": () => (/* binding */ drawEmbeddedImage),
|
17987 | /* harmony export */ "drawImage": () => (/* binding */ drawImage),
|
17988 | /* harmony export */ "drawLabel": () => (/* binding */ drawLabel),
|
17989 | /* harmony export */ "drawRect": () => (/* binding */ drawRect),
|
17990 | /* harmony export */ "drawRels": () => (/* binding */ drawRels),
|
17991 | /* harmony export */ "drawText": () => (/* binding */ drawText),
|
17992 | /* harmony export */ "getNoteRect": () => (/* binding */ getNoteRect),
|
17993 | /* harmony export */ "getTextObj": () => (/* binding */ getTextObj),
|
17994 | /* harmony export */ "insertArrowCrossHead": () => (/* binding */ insertArrowCrossHead),
|
17995 | /* harmony export */ "insertArrowEnd": () => (/* binding */ insertArrowEnd),
|
17996 | /* harmony export */ "insertArrowFilledHead": () => (/* binding */ insertArrowFilledHead),
|
17997 | /* harmony export */ "insertArrowHead": () => (/* binding */ insertArrowHead),
|
17998 | /* harmony export */ "insertClockIcon": () => (/* binding */ insertClockIcon),
|
17999 | /* harmony export */ "insertComputerIcon": () => (/* binding */ insertComputerIcon),
|
18000 | /* harmony export */ "insertDatabaseIcon": () => (/* binding */ insertDatabaseIcon),
|
18001 | /* harmony export */ "insertDynamicNumber": () => (/* binding */ insertDynamicNumber)
|
18002 | /* harmony export */ });
|
18003 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
18004 | /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @braintree/sanitize-url */ "@braintree/sanitize-url");
|
18005 | /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__);
|
18006 | function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
18007 |
|
18008 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
18009 |
|
18010 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
18011 |
|
18012 |
|
18013 |
|
18014 |
|
18015 | var drawRect = function drawRect(elem, rectData) {
|
18016 | var rectElem = elem.append('rect');
|
18017 | rectElem.attr('x', rectData.x);
|
18018 | rectElem.attr('y', rectData.y);
|
18019 | rectElem.attr('fill', rectData.fill);
|
18020 | rectElem.attr('stroke', rectData.stroke);
|
18021 | rectElem.attr('width', rectData.width);
|
18022 | rectElem.attr('height', rectData.height);
|
18023 | rectElem.attr('rx', rectData.rx);
|
18024 | rectElem.attr('ry', rectData.ry);
|
18025 |
|
18026 | if (rectData.attrs !== 'undefined' && rectData.attrs !== null) {
|
18027 | for (var attrKey in rectData.attrs) {
|
18028 | rectElem.attr(attrKey, rectData.attrs[attrKey]);
|
18029 | }
|
18030 | }
|
18031 |
|
18032 | if (rectData.class !== 'undefined') {
|
18033 | rectElem.attr('class', rectData.class);
|
18034 | }
|
18035 |
|
18036 | return rectElem;
|
18037 | };
|
18038 | var drawImage = function drawImage(elem, width, height, x, y, link) {
|
18039 | var imageElem = elem.append('image');
|
18040 | imageElem.attr('width', width);
|
18041 | imageElem.attr('height', height);
|
18042 | imageElem.attr('x', x);
|
18043 | imageElem.attr('y', y);
|
18044 | var sanitizedLink = link.startsWith('data:image/png;base64') ? link : (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__.sanitizeUrl)(link);
|
18045 | imageElem.attr('xlink:href', sanitizedLink);
|
18046 | };
|
18047 | var drawEmbeddedImage = function drawEmbeddedImage(elem, x, y, link) {
|
18048 | var imageElem = elem.append('use');
|
18049 | imageElem.attr('x', x);
|
18050 | imageElem.attr('y', y);
|
18051 | var sanitizedLink = (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__.sanitizeUrl)(link);
|
18052 | imageElem.attr('xlink:href', '#' + sanitizedLink);
|
18053 | };
|
18054 | var drawText = function drawText(elem, textData) {
|
18055 | var prevTextHeight = 0,
|
18056 | textHeight = 0;
|
18057 | var lines = textData.text.split(_common_common__WEBPACK_IMPORTED_MODULE_1__["default"].lineBreakRegex);
|
18058 | var textElems = [];
|
18059 | var dy = 0;
|
18060 |
|
18061 | var yfunc = function yfunc() {
|
18062 | return textData.y;
|
18063 | };
|
18064 |
|
18065 | if (typeof textData.valign !== 'undefined' && typeof textData.textMargin !== 'undefined' && textData.textMargin > 0) {
|
18066 | switch (textData.valign) {
|
18067 | case 'top':
|
18068 | case 'start':
|
18069 | yfunc = function yfunc() {
|
18070 | return Math.round(textData.y + textData.textMargin);
|
18071 | };
|
18072 |
|
18073 | break;
|
18074 |
|
18075 | case 'middle':
|
18076 | case 'center':
|
18077 | yfunc = function yfunc() {
|
18078 | return Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2);
|
18079 | };
|
18080 |
|
18081 | break;
|
18082 |
|
18083 | case 'bottom':
|
18084 | case 'end':
|
18085 | yfunc = function yfunc() {
|
18086 | return Math.round(textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin);
|
18087 | };
|
18088 |
|
18089 | break;
|
18090 | }
|
18091 | }
|
18092 |
|
18093 | if (typeof textData.anchor !== 'undefined' && typeof textData.textMargin !== 'undefined' && typeof textData.width !== 'undefined') {
|
18094 | switch (textData.anchor) {
|
18095 | case 'left':
|
18096 | case 'start':
|
18097 | textData.x = Math.round(textData.x + textData.textMargin);
|
18098 | textData.anchor = 'start';
|
18099 | textData.dominantBaseline = 'text-after-edge';
|
18100 | textData.alignmentBaseline = 'middle';
|
18101 | break;
|
18102 |
|
18103 | case 'middle':
|
18104 | case 'center':
|
18105 | textData.x = Math.round(textData.x + textData.width / 2);
|
18106 | textData.anchor = 'middle';
|
18107 | textData.dominantBaseline = 'middle';
|
18108 | textData.alignmentBaseline = 'middle';
|
18109 | break;
|
18110 |
|
18111 | case 'right':
|
18112 | case 'end':
|
18113 | textData.x = Math.round(textData.x + textData.width - textData.textMargin);
|
18114 | textData.anchor = 'end';
|
18115 | textData.dominantBaseline = 'text-before-edge';
|
18116 | textData.alignmentBaseline = 'middle';
|
18117 | break;
|
18118 | }
|
18119 | }
|
18120 |
|
18121 | for (var i = 0; i < lines.length; i++) {
|
18122 | var line = lines[i];
|
18123 |
|
18124 | if (typeof textData.textMargin !== 'undefined' && textData.textMargin === 0 && typeof textData.fontSize !== 'undefined') {
|
18125 | dy = i * textData.fontSize;
|
18126 | }
|
18127 |
|
18128 | var textElem = elem.append('text');
|
18129 | textElem.attr('x', textData.x);
|
18130 | textElem.attr('y', yfunc());
|
18131 |
|
18132 | if (typeof textData.anchor !== 'undefined') {
|
18133 | textElem.attr('text-anchor', textData.anchor).attr('dominant-baseline', textData.dominantBaseline).attr('alignment-baseline', textData.alignmentBaseline);
|
18134 | }
|
18135 |
|
18136 | if (typeof textData.fontFamily !== 'undefined') {
|
18137 | textElem.style('font-family', textData.fontFamily);
|
18138 | }
|
18139 |
|
18140 | if (typeof textData.fontSize !== 'undefined') {
|
18141 | textElem.style('font-size', textData.fontSize);
|
18142 | }
|
18143 |
|
18144 | if (typeof textData.fontWeight !== 'undefined') {
|
18145 | textElem.style('font-weight', textData.fontWeight);
|
18146 | }
|
18147 |
|
18148 | if (typeof textData.fill !== 'undefined') {
|
18149 | textElem.attr('fill', textData.fill);
|
18150 | }
|
18151 |
|
18152 | if (typeof textData.class !== 'undefined') {
|
18153 | textElem.attr('class', textData.class);
|
18154 | }
|
18155 |
|
18156 | if (typeof textData.dy !== 'undefined') {
|
18157 | textElem.attr('dy', textData.dy);
|
18158 | } else if (dy !== 0) {
|
18159 | textElem.attr('dy', dy);
|
18160 | }
|
18161 |
|
18162 | if (textData.tspan) {
|
18163 | var span = textElem.append('tspan');
|
18164 | span.attr('x', textData.x);
|
18165 |
|
18166 | if (typeof textData.fill !== 'undefined') {
|
18167 | span.attr('fill', textData.fill);
|
18168 | }
|
18169 |
|
18170 | span.text(line);
|
18171 | } else {
|
18172 | textElem.text(line);
|
18173 | }
|
18174 |
|
18175 | if (typeof textData.valign !== 'undefined' && typeof textData.textMargin !== 'undefined' && textData.textMargin > 0) {
|
18176 | textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
|
18177 | prevTextHeight = textHeight;
|
18178 | }
|
18179 |
|
18180 | textElems.push(textElem);
|
18181 | }
|
18182 |
|
18183 | return textElems;
|
18184 | };
|
18185 | var drawLabel = function drawLabel(elem, txtObject) {
|
18186 | /**
|
18187 | * @param {any} x
|
18188 | * @param {any} y
|
18189 | * @param {any} width
|
18190 | * @param {any} height
|
18191 | * @param {any} cut
|
18192 | * @returns {any}
|
18193 | */
|
18194 | function genPoints(x, y, width, height, cut) {
|
18195 | return x + ',' + y + ' ' + (x + width) + ',' + y + ' ' + (x + width) + ',' + (y + height - cut) + ' ' + (x + width - cut * 1.2) + ',' + (y + height) + ' ' + x + ',' + (y + height);
|
18196 | }
|
18197 |
|
18198 | var polygon = elem.append('polygon');
|
18199 | polygon.attr('points', genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7));
|
18200 | polygon.attr('class', 'labelBox');
|
18201 | txtObject.y = txtObject.y + txtObject.height / 2;
|
18202 | drawText(elem, txtObject);
|
18203 | return polygon;
|
18204 | };
|
18205 | var drawRels = function drawRels(elem, rels, conf) {
|
18206 | var relsElem = elem.append('g');
|
18207 | var i = 0;
|
18208 |
|
18209 | var _iterator = _createForOfIteratorHelper(rels),
|
18210 | _step;
|
18211 |
|
18212 | try {
|
18213 | for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
18214 | var rel = _step.value;
|
18215 | var textColor = rel.textColor ? rel.textColor : '#444444';
|
18216 | var strokeColor = rel.lineColor ? rel.lineColor : '#444444';
|
18217 | var offsetX = rel.offsetX ? parseInt(rel.offsetX) : 0;
|
18218 | var offsetY = rel.offsetY ? parseInt(rel.offsetY) : 0;
|
18219 | var url = '';
|
18220 |
|
18221 | if (i === 0) {
|
18222 | var line = relsElem.append('line');
|
18223 | line.attr('x1', rel.startPoint.x);
|
18224 | line.attr('y1', rel.startPoint.y);
|
18225 | line.attr('x2', rel.endPoint.x);
|
18226 | line.attr('y2', rel.endPoint.y);
|
18227 | line.attr('stroke-width', '1');
|
18228 | line.attr('stroke', strokeColor);
|
18229 | line.style('fill', 'none');
|
18230 | if (rel.type !== 'rel_b') line.attr('marker-end', 'url(' + url + '#arrowhead)');
|
18231 | if (rel.type === 'birel' || rel.type === 'rel_b') line.attr('marker-start', 'url(' + url + '#arrowend)');
|
18232 | i = -1;
|
18233 | } else {
|
18234 | var _line = relsElem.append('path');
|
18235 |
|
18236 | _line.attr('fill', 'none').attr('stroke-width', '1').attr('stroke', strokeColor).attr('d', 'Mstartx,starty Qcontrolx,controly stopx,stopy '.replaceAll('startx', rel.startPoint.x).replaceAll('starty', rel.startPoint.y).replaceAll('controlx', rel.startPoint.x + (rel.endPoint.x - rel.startPoint.x) / 2 - (rel.endPoint.x - rel.startPoint.x) / 4).replaceAll('controly', rel.startPoint.y + (rel.endPoint.y - rel.startPoint.y) / 2).replaceAll('stopx', rel.endPoint.x).replaceAll('stopy', rel.endPoint.y));
|
18237 |
|
18238 | if (rel.type !== 'rel_b') _line.attr('marker-end', 'url(' + url + '#arrowhead)');
|
18239 | if (rel.type === 'birel' || rel.type === 'rel_b') _line.attr('marker-start', 'url(' + url + '#arrowend)');
|
18240 | }
|
18241 |
|
18242 | var messageConf = conf.messageFont();
|
18243 |
|
18244 | _drawTextCandidateFunc(conf)(rel.label.text, relsElem, Math.min(rel.startPoint.x, rel.endPoint.x) + Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 + offsetX, Math.min(rel.startPoint.y, rel.endPoint.y) + Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 + offsetY, rel.label.width, rel.label.height, {
|
18245 | fill: textColor
|
18246 | }, messageConf);
|
18247 |
|
18248 | if (rel.techn && rel.techn.text !== '') {
|
18249 | messageConf = conf.messageFont();
|
18250 |
|
18251 | _drawTextCandidateFunc(conf)('[' + rel.techn.text + ']', relsElem, Math.min(rel.startPoint.x, rel.endPoint.x) + Math.abs(rel.endPoint.x - rel.startPoint.x) / 2 + offsetX, Math.min(rel.startPoint.y, rel.endPoint.y) + Math.abs(rel.endPoint.y - rel.startPoint.y) / 2 + conf.messageFontSize + 5 + offsetY, Math.max(rel.label.width, rel.techn.width), rel.techn.height, {
|
18252 | fill: textColor,
|
18253 | 'font-style': 'italic'
|
18254 | }, messageConf);
|
18255 | }
|
18256 | }
|
18257 | } catch (err) {
|
18258 | _iterator.e(err);
|
18259 | } finally {
|
18260 | _iterator.f();
|
18261 | }
|
18262 | };
|
18263 | /**
|
18264 | * Draws an boundary in the diagram
|
18265 | *
|
18266 | * @param {any} elem - The diagram we'll draw to.
|
18267 | * @param {any} boundary - The boundary to draw.
|
18268 | * @param {any} conf - DrawText implementation discriminator object
|
18269 | */
|
18270 |
|
18271 | var drawBoundary = function drawBoundary(elem, boundary, conf) {
|
18272 | var boundaryElem = elem.append('g');
|
18273 | var fillColor = boundary.bgColor ? boundary.bgColor : 'none';
|
18274 | var strokeColor = boundary.borderColor ? boundary.borderColor : '#444444';
|
18275 | var fontColor = boundary.fontColor ? boundary.fontColor : 'black';
|
18276 | var attrsValue = {
|
18277 | 'stroke-width': 1.0,
|
18278 | 'stroke-dasharray': '7.0,7.0'
|
18279 | };
|
18280 | if (boundary.nodeType) attrsValue = {
|
18281 | 'stroke-width': 1.0
|
18282 | };
|
18283 | var rectData = {
|
18284 | x: boundary.x,
|
18285 | y: boundary.y,
|
18286 | fill: fillColor,
|
18287 | stroke: strokeColor,
|
18288 | width: boundary.width,
|
18289 | height: boundary.height,
|
18290 | rx: 2.5,
|
18291 | ry: 2.5,
|
18292 | attrs: attrsValue
|
18293 | };
|
18294 | drawRect(boundaryElem, rectData); // draw label
|
18295 |
|
18296 | var boundaryConf = conf.boundaryFont();
|
18297 | boundaryConf.fontWeight = 'bold';
|
18298 | boundaryConf.fontSize = boundaryConf.fontSize + 2;
|
18299 | boundaryConf.fontColor = fontColor;
|
18300 |
|
18301 | _drawTextCandidateFunc(conf)(boundary.label.text, boundaryElem, boundary.x, boundary.y + boundary.label.Y, boundary.width, boundary.height, {
|
18302 | fill: '#444444'
|
18303 | }, boundaryConf); // draw type
|
18304 |
|
18305 |
|
18306 | if (boundary.type && boundary.type.text !== '') {
|
18307 | boundaryConf = conf.boundaryFont();
|
18308 | boundaryConf.fontColor = fontColor;
|
18309 |
|
18310 | _drawTextCandidateFunc(conf)(boundary.type.text, boundaryElem, boundary.x, boundary.y + boundary.type.Y, boundary.width, boundary.height, {
|
18311 | fill: '#444444'
|
18312 | }, boundaryConf);
|
18313 | } // draw descr
|
18314 |
|
18315 |
|
18316 | if (boundary.descr && boundary.descr.text !== '') {
|
18317 | boundaryConf = conf.boundaryFont();
|
18318 | boundaryConf.fontSize = boundaryConf.fontSize - 2;
|
18319 | boundaryConf.fontColor = fontColor;
|
18320 |
|
18321 | _drawTextCandidateFunc(conf)(boundary.descr.text, boundaryElem, boundary.x, boundary.y + boundary.descr.Y, boundary.width, boundary.height, {
|
18322 | fill: '#444444'
|
18323 | }, boundaryConf);
|
18324 | }
|
18325 | };
|
18326 |
|
18327 | var drawC4Shape = function drawC4Shape(elem, c4Shape, conf) {
|
18328 | var fillColor = c4Shape.bgColor ? c4Shape.bgColor : conf[c4Shape.typeC4Shape.text + '_bg_color'];
|
18329 | var strokeColor = c4Shape.borderColor ? c4Shape.borderColor : conf[c4Shape.typeC4Shape.text + '_border_color'];
|
18330 | var fontColor = c4Shape.fontColor ? c4Shape.fontColor : '#FFFFFF';
|
18331 | var personImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=';
|
18332 |
|
18333 | switch (c4Shape.typeC4Shape.text) {
|
18334 | case 'person':
|
18335 | personImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=';
|
18336 | break;
|
18337 |
|
18338 | case 'external_person':
|
18339 | personImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII=';
|
18340 | break;
|
18341 | }
|
18342 |
|
18343 | var c4ShapeElem = elem.append('g');
|
18344 | c4ShapeElem.attr('class', 'person-man'); // <rect fill="#08427B" height="119.2188" rx="2.5" ry="2.5" style="stroke:#073B6F;stroke-width:0.5;" width="110" x="120" y="7"/>
|
18345 | // draw rect of c4Shape
|
18346 |
|
18347 | var rect = getNoteRect();
|
18348 |
|
18349 | switch (c4Shape.typeC4Shape.text) {
|
18350 | case 'person':
|
18351 | case 'external_person':
|
18352 | case 'system':
|
18353 | case 'external_system':
|
18354 | case 'container':
|
18355 | case 'external_container':
|
18356 | case 'component':
|
18357 | case 'external_component':
|
18358 | rect.x = c4Shape.x;
|
18359 | rect.y = c4Shape.y;
|
18360 | rect.fill = fillColor;
|
18361 | rect.width = c4Shape.width;
|
18362 | rect.height = c4Shape.height;
|
18363 | rect.style = 'stroke:' + strokeColor + ';stroke-width:0.5;';
|
18364 | rect.rx = 2.5;
|
18365 | rect.ry = 2.5;
|
18366 | drawRect(c4ShapeElem, rect);
|
18367 | break;
|
18368 |
|
18369 | case 'system_db':
|
18370 | case 'external_system_db':
|
18371 | case 'container_db':
|
18372 | case 'external_container_db':
|
18373 | case 'component_db':
|
18374 | case 'external_component_db':
|
18375 | c4ShapeElem.append('path').attr('fill', fillColor).attr('stroke-width', '0.5').attr('stroke', strokeColor).attr('d', 'Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height'.replaceAll('startx', c4Shape.x).replaceAll('starty', c4Shape.y).replaceAll('half', c4Shape.width / 2).replaceAll('height', c4Shape.height));
|
18376 | c4ShapeElem.append('path').attr('fill', 'none').attr('stroke-width', '0.5').attr('stroke', strokeColor).attr('d', 'Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10'.replaceAll('startx', c4Shape.x).replaceAll('starty', c4Shape.y).replaceAll('half', c4Shape.width / 2));
|
18377 | break;
|
18378 |
|
18379 | case 'system_queue':
|
18380 | case 'external_system_queue':
|
18381 | case 'container_queue':
|
18382 | case 'external_container_queue':
|
18383 | case 'component_queue':
|
18384 | case 'external_component_queue':
|
18385 | c4ShapeElem.append('path').attr('fill', fillColor).attr('stroke-width', '0.5').attr('stroke', strokeColor).attr('d', 'Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half'.replaceAll('startx', c4Shape.x).replaceAll('starty', c4Shape.y).replaceAll('width', c4Shape.width).replaceAll('half', c4Shape.height / 2));
|
18386 | c4ShapeElem.append('path').attr('fill', 'none').attr('stroke-width', '0.5').attr('stroke', strokeColor).attr('d', 'Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half'.replaceAll('startx', c4Shape.x + c4Shape.width).replaceAll('starty', c4Shape.y).replaceAll('half', c4Shape.height / 2));
|
18387 | break;
|
18388 | } // draw type of c4Shape
|
18389 |
|
18390 |
|
18391 | var c4ShapeFontConf = getC4ShapeFont(conf, c4Shape.typeC4Shape.text);
|
18392 | c4ShapeElem.append('text').attr('fill', fontColor).attr('font-family', c4ShapeFontConf.fontFamily).attr('font-size', c4ShapeFontConf.fontSize - 2).attr('font-style', 'italic').attr('lengthAdjust', 'spacing').attr('textLength', c4Shape.typeC4Shape.width).attr('x', c4Shape.x + c4Shape.width / 2 - c4Shape.typeC4Shape.width / 2).attr('y', c4Shape.y + c4Shape.typeC4Shape.Y).text('<<' + c4Shape.typeC4Shape.text + '>>'); // draw image/sprite
|
18393 |
|
18394 | switch (c4Shape.typeC4Shape.text) {
|
18395 | case 'person':
|
18396 | case 'external_person':
|
18397 | drawImage(c4ShapeElem, 48, 48, c4Shape.x + c4Shape.width / 2 - 24, c4Shape.y + c4Shape.image.Y, personImg);
|
18398 | break;
|
18399 | } // draw label
|
18400 |
|
18401 |
|
18402 | var textFontConf = conf[c4Shape.typeC4Shape.text + 'Font']();
|
18403 | textFontConf.fontWeight = 'bold';
|
18404 | textFontConf.fontSize = textFontConf.fontSize + 2;
|
18405 | textFontConf.fontColor = fontColor;
|
18406 |
|
18407 | _drawTextCandidateFunc(conf)(c4Shape.label.text, c4ShapeElem, c4Shape.x, c4Shape.y + c4Shape.label.Y, c4Shape.width, c4Shape.height, {
|
18408 | fill: fontColor
|
18409 | }, textFontConf); // draw techn/type
|
18410 |
|
18411 |
|
18412 | textFontConf = conf[c4Shape.typeC4Shape.text + 'Font']();
|
18413 | textFontConf.fontColor = fontColor;
|
18414 |
|
18415 | if (c4Shape.thchn && c4Shape.thchn.text !== '') {
|
18416 | _drawTextCandidateFunc(conf)(c4Shape.thchn.text, c4ShapeElem, c4Shape.x, c4Shape.y + c4Shape.thchn.Y, c4Shape.width, c4Shape.height, {
|
18417 | fill: fontColor,
|
18418 | 'font-style': 'italic'
|
18419 | }, textFontConf);
|
18420 | } else if (c4Shape.type && c4Shape.type.text !== '') {
|
18421 | _drawTextCandidateFunc(conf)(c4Shape.type.text, c4ShapeElem, c4Shape.x, c4Shape.y + c4Shape.type.Y, c4Shape.width, c4Shape.height, {
|
18422 | fill: fontColor,
|
18423 | 'font-style': 'italic'
|
18424 | }, textFontConf);
|
18425 | } // draw descr
|
18426 |
|
18427 |
|
18428 | if (c4Shape.descr && c4Shape.descr.text !== '') {
|
18429 | textFontConf = conf.personFont();
|
18430 | textFontConf.fontColor = fontColor;
|
18431 |
|
18432 | _drawTextCandidateFunc(conf)(c4Shape.descr.text, c4ShapeElem, c4Shape.x, c4Shape.y + c4Shape.descr.Y, c4Shape.width, c4Shape.height, {
|
18433 | fill: fontColor
|
18434 | }, textFontConf);
|
18435 | }
|
18436 |
|
18437 | return c4Shape.height;
|
18438 | };
|
18439 | var insertDatabaseIcon = function insertDatabaseIcon(elem) {
|
18440 | elem.append('defs').append('symbol').attr('id', 'database').attr('fill-rule', 'evenodd').attr('clip-rule', 'evenodd').append('path').attr('transform', 'scale(.5)').attr('d', 'M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z');
|
18441 | };
|
18442 | var insertComputerIcon = function insertComputerIcon(elem) {
|
18443 | elem.append('defs').append('symbol').attr('id', 'computer').attr('width', '24').attr('height', '24').append('path').attr('transform', 'scale(.5)').attr('d', 'M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z');
|
18444 | };
|
18445 | var insertClockIcon = function insertClockIcon(elem) {
|
18446 | elem.append('defs').append('symbol').attr('id', 'clock').attr('width', '24').attr('height', '24').append('path').attr('transform', 'scale(.5)').attr('d', 'M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z');
|
18447 | };
|
18448 | /**
|
18449 | * Setup arrow head and define the marker. The result is appended to the svg.
|
18450 | *
|
18451 | * @param elem
|
18452 | */
|
18453 |
|
18454 | var insertArrowHead = function insertArrowHead(elem) {
|
18455 | elem.append('defs').append('marker').attr('id', 'arrowhead').attr('refX', 9).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 12).attr('markerHeight', 12).attr('orient', 'auto').append('path').attr('d', 'M 0 0 L 10 5 L 0 10 z'); // this is actual shape for arrowhead
|
18456 | };
|
18457 | var insertArrowEnd = function insertArrowEnd(elem) {
|
18458 | elem.append('defs').append('marker').attr('id', 'arrowend').attr('refX', 1).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 12).attr('markerHeight', 12).attr('orient', 'auto').append('path').attr('d', 'M 10 0 L 0 5 L 10 10 z'); // this is actual shape for arrowhead
|
18459 | };
|
18460 | /**
|
18461 | * Setup arrow head and define the marker. The result is appended to the svg.
|
18462 | *
|
18463 | * @param {any} elem
|
18464 | */
|
18465 |
|
18466 | var insertArrowFilledHead = function insertArrowFilledHead(elem) {
|
18467 | elem.append('defs').append('marker').attr('id', 'filled-head').attr('refX', 18).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');
|
18468 | };
|
18469 | /**
|
18470 | * Setup node number. The result is appended to the svg.
|
18471 | *
|
18472 | * @param {any} elem
|
18473 | */
|
18474 |
|
18475 | var insertDynamicNumber = function insertDynamicNumber(elem) {
|
18476 | elem.append('defs').append('marker').attr('id', 'sequencenumber').attr('refX', 15).attr('refY', 15).attr('markerWidth', 60).attr('markerHeight', 40).attr('orient', 'auto').append('circle').attr('cx', 15).attr('cy', 15).attr('r', 6); // .style("fill", '#f00');
|
18477 | };
|
18478 | /**
|
18479 | * Setup arrow head and define the marker. The result is appended to the svg.
|
18480 | *
|
18481 | * @param {any} elem
|
18482 | */
|
18483 |
|
18484 | var insertArrowCrossHead = function insertArrowCrossHead(elem) {
|
18485 | var defs = elem.append('defs');
|
18486 | var marker = defs.append('marker').attr('id', 'crosshead').attr('markerWidth', 15).attr('markerHeight', 8).attr('orient', 'auto').attr('refX', 16).attr('refY', 4); // The arrow
|
18487 |
|
18488 | marker.append('path').attr('fill', 'black').attr('stroke', '#000000').style('stroke-dasharray', '0, 0').attr('stroke-width', '1px').attr('d', 'M 9,2 V 6 L16,4 Z'); // The cross
|
18489 |
|
18490 | marker.append('path').attr('fill', 'none').attr('stroke', '#000000').style('stroke-dasharray', '0, 0').attr('stroke-width', '1px').attr('d', 'M 0,1 L 6,7 M 6,1 L 0,7'); // this is actual shape for arrowhead
|
18491 | };
|
18492 | var getTextObj = function getTextObj() {
|
18493 | return {
|
18494 | x: 0,
|
18495 | y: 0,
|
18496 | fill: undefined,
|
18497 | anchor: undefined,
|
18498 | style: '#666',
|
18499 | width: undefined,
|
18500 | height: undefined,
|
18501 | textMargin: 0,
|
18502 | rx: 0,
|
18503 | ry: 0,
|
18504 | tspan: true,
|
18505 | valign: undefined
|
18506 | };
|
18507 | };
|
18508 | var getNoteRect = function getNoteRect() {
|
18509 | return {
|
18510 | x: 0,
|
18511 | y: 0,
|
18512 | fill: '#EDF2AE',
|
18513 | stroke: '#666',
|
18514 | width: 100,
|
18515 | anchor: 'start',
|
18516 | height: 100,
|
18517 | rx: 0,
|
18518 | ry: 0
|
18519 | };
|
18520 | };
|
18521 |
|
18522 | var getC4ShapeFont = function getC4ShapeFont(cnf, typeC4Shape) {
|
18523 | return {
|
18524 | fontFamily: cnf[typeC4Shape + 'FontFamily'],
|
18525 | fontSize: cnf[typeC4Shape + 'FontSize'],
|
18526 | fontWeight: cnf[typeC4Shape + 'FontWeight']
|
18527 | };
|
18528 | };
|
18529 |
|
18530 | var _drawTextCandidateFunc = function () {
|
18531 | /**
|
18532 | * @param {any} content
|
18533 | * @param {any} g
|
18534 | * @param {any} x
|
18535 | * @param {any} y
|
18536 | * @param {any} width
|
18537 | * @param {any} height
|
18538 | * @param {any} textAttrs
|
18539 | */
|
18540 | function byText(content, g, x, y, width, height, textAttrs) {
|
18541 | var text = g.append('text').attr('x', x + width / 2).attr('y', y + height / 2 + 5).style('text-anchor', 'middle').text(content);
|
18542 |
|
18543 | _setTextAttrs(text, textAttrs);
|
18544 | }
|
18545 | /**
|
18546 | * @param {any} content
|
18547 | * @param {any} g
|
18548 | * @param {any} x
|
18549 | * @param {any} y
|
18550 | * @param {any} width
|
18551 | * @param {any} height
|
18552 | * @param {any} textAttrs
|
18553 | * @param {any} conf
|
18554 | */
|
18555 |
|
18556 |
|
18557 | function byTspan(content, g, x, y, width, height, textAttrs, conf) {
|
18558 | var fontSize = conf.fontSize,
|
18559 | fontFamily = conf.fontFamily,
|
18560 | fontWeight = conf.fontWeight;
|
18561 | var lines = content.split(_common_common__WEBPACK_IMPORTED_MODULE_1__["default"].lineBreakRegex);
|
18562 |
|
18563 | for (var i = 0; i < lines.length; i++) {
|
18564 | var dy = i * fontSize - fontSize * (lines.length - 1) / 2;
|
18565 | var text = g.append('text').attr('x', x + width / 2).attr('y', y).style('text-anchor', 'middle').attr('dominant-baseline', 'middle').style('font-size', fontSize).style('font-weight', fontWeight).style('font-family', fontFamily);
|
18566 | text.append('tspan') // .attr('x', x + width / 2)
|
18567 | .attr('dy', dy).text(lines[i]) // .attr('y', y + height / 2)
|
18568 | .attr('alignment-baseline', 'mathematical');
|
18569 |
|
18570 | _setTextAttrs(text, textAttrs);
|
18571 | }
|
18572 | }
|
18573 | /**
|
18574 | * @param {any} content
|
18575 | * @param {any} g
|
18576 | * @param {any} x
|
18577 | * @param {any} y
|
18578 | * @param {any} width
|
18579 | * @param {any} height
|
18580 | * @param {any} textAttrs
|
18581 | * @param {any} conf
|
18582 | */
|
18583 |
|
18584 |
|
18585 | function byFo(content, g, x, y, width, height, textAttrs, conf) {
|
18586 | var s = g.append('switch');
|
18587 | var f = s.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height);
|
18588 | var text = f.append('xhtml:div').style('display', 'table').style('height', '100%').style('width', '100%');
|
18589 | text.append('div').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle').text(content);
|
18590 | byTspan(content, s, x, y, width, height, textAttrs, conf);
|
18591 |
|
18592 | _setTextAttrs(text, textAttrs);
|
18593 | }
|
18594 | /**
|
18595 | * @param {any} toText
|
18596 | * @param {any} fromTextAttrsDict
|
18597 | */
|
18598 |
|
18599 |
|
18600 | function _setTextAttrs(toText, fromTextAttrsDict) {
|
18601 | for (var key in fromTextAttrsDict) {
|
18602 | if (fromTextAttrsDict.hasOwnProperty(key)) {
|
18603 | // eslint-disable-line
|
18604 | toText.attr(key, fromTextAttrsDict[key]);
|
18605 | }
|
18606 | }
|
18607 | }
|
18608 |
|
18609 | return function (conf) {
|
18610 | return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
|
18611 | };
|
18612 | }();
|
18613 |
|
18614 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
18615 | drawRect: drawRect,
|
18616 | drawText: drawText,
|
18617 | drawLabel: drawLabel,
|
18618 | drawBoundary: drawBoundary,
|
18619 | drawC4Shape: drawC4Shape,
|
18620 | drawRels: drawRels,
|
18621 | drawImage: drawImage,
|
18622 | drawEmbeddedImage: drawEmbeddedImage,
|
18623 | insertArrowHead: insertArrowHead,
|
18624 | insertArrowEnd: insertArrowEnd,
|
18625 | insertArrowFilledHead: insertArrowFilledHead,
|
18626 | insertDynamicNumber: insertDynamicNumber,
|
18627 | insertArrowCrossHead: insertArrowCrossHead,
|
18628 | insertDatabaseIcon: insertDatabaseIcon,
|
18629 | insertComputerIcon: insertComputerIcon,
|
18630 | insertClockIcon: insertClockIcon,
|
18631 | getTextObj: getTextObj,
|
18632 | getNoteRect: getNoteRect,
|
18633 | sanitizeUrl: _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__.sanitizeUrl
|
18634 | });
|
18635 |
|
18636 | /***/ }),
|
18637 |
|
18638 | /***/ "./src/diagrams/class/classDb.js":
|
18639 | /*!***************************************!*\
|
18640 | !*** ./src/diagrams/class/classDb.js ***!
|
18641 | \***************************************/
|
18642 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
18643 |
|
18644 | "use strict";
|
18645 | __webpack_require__.r(__webpack_exports__);
|
18646 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
18647 | /* harmony export */ "addAnnotation": () => (/* binding */ addAnnotation),
|
18648 | /* harmony export */ "addClass": () => (/* binding */ addClass),
|
18649 | /* harmony export */ "addMember": () => (/* binding */ addMember),
|
18650 | /* harmony export */ "addMembers": () => (/* binding */ addMembers),
|
18651 | /* harmony export */ "addRelation": () => (/* binding */ addRelation),
|
18652 | /* harmony export */ "bindFunctions": () => (/* binding */ bindFunctions),
|
18653 | /* harmony export */ "cleanupLabel": () => (/* binding */ cleanupLabel),
|
18654 | /* harmony export */ "clear": () => (/* binding */ clear),
|
18655 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
18656 | /* harmony export */ "getClass": () => (/* binding */ getClass),
|
18657 | /* harmony export */ "getClasses": () => (/* binding */ getClasses),
|
18658 | /* harmony export */ "getRelations": () => (/* binding */ getRelations),
|
18659 | /* harmony export */ "lineType": () => (/* binding */ lineType),
|
18660 | /* harmony export */ "lookUpDomId": () => (/* binding */ lookUpDomId),
|
18661 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
18662 | /* harmony export */ "relationType": () => (/* binding */ relationType),
|
18663 | /* harmony export */ "setClickEvent": () => (/* binding */ setClickEvent),
|
18664 | /* harmony export */ "setCssClass": () => (/* binding */ setCssClass),
|
18665 | /* harmony export */ "setLink": () => (/* binding */ setLink)
|
18666 | /* harmony export */ });
|
18667 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
18668 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
18669 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
18670 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
18671 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
18672 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
18673 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
18674 | /* harmony import */ var _commonDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../commonDb */ "./src/commonDb.js");
|
18675 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
18676 |
|
18677 | function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
18678 |
|
18679 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
18680 |
|
18681 | function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
18682 |
|
18683 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
18684 |
|
18685 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
18686 |
|
18687 |
|
18688 |
|
18689 |
|
18690 |
|
18691 |
|
18692 |
|
18693 |
|
18694 | var MERMAID_DOM_ID_PREFIX = 'classid-';
|
18695 | var relations = [];
|
18696 | var classes = {};
|
18697 | var classCounter = 0;
|
18698 | var funs = [];
|
18699 |
|
18700 | var sanitizeText = function sanitizeText(txt) {
|
18701 | return _common_common__WEBPACK_IMPORTED_MODULE_1__["default"].sanitizeText(txt, _config__WEBPACK_IMPORTED_MODULE_2__.getConfig());
|
18702 | };
|
18703 |
|
18704 | var parseDirective = function parseDirective(statement, context, type) {
|
18705 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_3__["default"].parseDirective(this, statement, context, type);
|
18706 | };
|
18707 |
|
18708 | var splitClassNameAndType = function splitClassNameAndType(id) {
|
18709 | var genericType = '';
|
18710 | var className = id;
|
18711 |
|
18712 | if (id.indexOf('~') > 0) {
|
18713 | var split = id.split('~');
|
18714 | className = split[0];
|
18715 | genericType = _common_common__WEBPACK_IMPORTED_MODULE_1__["default"].sanitizeText(split[1], _config__WEBPACK_IMPORTED_MODULE_2__.getConfig());
|
18716 | }
|
18717 |
|
18718 | return {
|
18719 | className: className,
|
18720 | type: genericType
|
18721 | };
|
18722 | };
|
18723 | /**
|
18724 | * Function called by parser when a node definition has been found.
|
18725 | *
|
18726 | * @param id
|
18727 | * @public
|
18728 | */
|
18729 |
|
18730 |
|
18731 | var addClass = function addClass(id) {
|
18732 | var classId = splitClassNameAndType(id); // Only add class if not exists
|
18733 |
|
18734 | if (typeof classes[classId.className] !== 'undefined') return;
|
18735 | classes[classId.className] = {
|
18736 | id: classId.className,
|
18737 | type: classId.type,
|
18738 | cssClasses: [],
|
18739 | methods: [],
|
18740 | members: [],
|
18741 | annotations: [],
|
18742 | domId: MERMAID_DOM_ID_PREFIX + classId.className + '-' + classCounter
|
18743 | };
|
18744 | classCounter++;
|
18745 | };
|
18746 | /**
|
18747 | * Function to lookup domId from id in the graph definition.
|
18748 | *
|
18749 | * @param id
|
18750 | * @public
|
18751 | */
|
18752 |
|
18753 | var lookUpDomId = function lookUpDomId(id) {
|
18754 | var classKeys = Object.keys(classes);
|
18755 |
|
18756 | for (var i = 0; i < classKeys.length; i++) {
|
18757 | if (classes[classKeys[i]].id === id) {
|
18758 | return classes[classKeys[i]].domId;
|
18759 | }
|
18760 | }
|
18761 | };
|
18762 | var clear = function clear() {
|
18763 | relations = [];
|
18764 | classes = {};
|
18765 | funs = [];
|
18766 | funs.push(setupToolTips);
|
18767 | (0,_commonDb__WEBPACK_IMPORTED_MODULE_4__.clear)();
|
18768 | };
|
18769 | var getClass = function getClass(id) {
|
18770 | return classes[id];
|
18771 | };
|
18772 | var getClasses = function getClasses() {
|
18773 | return classes;
|
18774 | };
|
18775 | var getRelations = function getRelations() {
|
18776 | return relations;
|
18777 | };
|
18778 | var addRelation = function addRelation(relation) {
|
18779 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug('Adding relation: ' + JSON.stringify(relation));
|
18780 | addClass(relation.id1);
|
18781 | addClass(relation.id2);
|
18782 | relation.id1 = splitClassNameAndType(relation.id1).className;
|
18783 | relation.id2 = splitClassNameAndType(relation.id2).className;
|
18784 | relation.relationTitle1 = _common_common__WEBPACK_IMPORTED_MODULE_1__["default"].sanitizeText(relation.relationTitle1.trim(), _config__WEBPACK_IMPORTED_MODULE_2__.getConfig());
|
18785 | relation.relationTitle2 = _common_common__WEBPACK_IMPORTED_MODULE_1__["default"].sanitizeText(relation.relationTitle2.trim(), _config__WEBPACK_IMPORTED_MODULE_2__.getConfig());
|
18786 | relations.push(relation);
|
18787 | };
|
18788 | /**
|
18789 | * Adds an annotation to the specified class Annotations mark special properties of the given type
|
18790 | * (like 'interface' or 'service')
|
18791 | *
|
18792 | * @param className The class name
|
18793 | * @param annotation The name of the annotation without any brackets
|
18794 | * @public
|
18795 | */
|
18796 |
|
18797 | var addAnnotation = function addAnnotation(className, annotation) {
|
18798 | var validatedClassName = splitClassNameAndType(className).className;
|
18799 | classes[validatedClassName].annotations.push(annotation);
|
18800 | };
|
18801 | /**
|
18802 | * Adds a member to the specified class
|
18803 | *
|
18804 | * @param className The class name
|
18805 | * @param member The full name of the member. If the member is enclosed in <<brackets>> it is
|
18806 | * treated as an annotation If the member is ending with a closing bracket ) it is treated as a
|
18807 | * method Otherwise the member will be treated as a normal property
|
18808 | * @public
|
18809 | */
|
18810 |
|
18811 | var addMember = function addMember(className, member) {
|
18812 | var validatedClassName = splitClassNameAndType(className).className;
|
18813 | var theClass = classes[validatedClassName];
|
18814 |
|
18815 | if (typeof member === 'string') {
|
18816 | // Member can contain white spaces, we trim them out
|
18817 | var memberString = member.trim();
|
18818 |
|
18819 | if (memberString.startsWith('<<') && memberString.endsWith('>>')) {
|
18820 | // Remove leading and trailing brackets
|
18821 | // theClass.annotations.push(memberString.substring(2, memberString.length - 2));
|
18822 | theClass.annotations.push(sanitizeText(memberString.substring(2, memberString.length - 2)));
|
18823 | } else if (memberString.indexOf(')') > 0) {
|
18824 | theClass.methods.push(sanitizeText(memberString));
|
18825 | } else if (memberString) {
|
18826 | theClass.members.push(sanitizeText(memberString));
|
18827 | }
|
18828 | }
|
18829 | };
|
18830 | var addMembers = function addMembers(className, members) {
|
18831 | if (Array.isArray(members)) {
|
18832 | members.reverse();
|
18833 | members.forEach(function (member) {
|
18834 | return addMember(className, member);
|
18835 | });
|
18836 | }
|
18837 | };
|
18838 | var cleanupLabel = function cleanupLabel(label) {
|
18839 | if (label.substring(0, 1) === ':') {
|
18840 | return _common_common__WEBPACK_IMPORTED_MODULE_1__["default"].sanitizeText(label.substr(1).trim(), _config__WEBPACK_IMPORTED_MODULE_2__.getConfig());
|
18841 | } else {
|
18842 | return sanitizeText(label.trim());
|
18843 | }
|
18844 | };
|
18845 | /**
|
18846 | * Called by parser when a special node is found, e.g. a clickable element.
|
18847 | *
|
18848 | * @param ids Comma separated list of ids
|
18849 | * @param className Class to add
|
18850 | */
|
18851 |
|
18852 | var setCssClass = function setCssClass(ids, className) {
|
18853 | ids.split(',').forEach(function (_id) {
|
18854 | var id = _id;
|
18855 | if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
18856 |
|
18857 | if (typeof classes[id] !== 'undefined') {
|
18858 | classes[id].cssClasses.push(className);
|
18859 | }
|
18860 | });
|
18861 | };
|
18862 | /**
|
18863 | * Called by parser when a tooltip is found, e.g. a clickable element.
|
18864 | *
|
18865 | * @param ids Comma separated list of ids
|
18866 | * @param tooltip Tooltip to add
|
18867 | */
|
18868 |
|
18869 | var setTooltip = function setTooltip(ids, tooltip) {
|
18870 | var config = _config__WEBPACK_IMPORTED_MODULE_2__.getConfig();
|
18871 | ids.split(',').forEach(function (id) {
|
18872 | if (typeof tooltip !== 'undefined') {
|
18873 | classes[id].tooltip = _common_common__WEBPACK_IMPORTED_MODULE_1__["default"].sanitizeText(tooltip, config);
|
18874 | }
|
18875 | });
|
18876 | };
|
18877 | /**
|
18878 | * Called by parser when a link is found. Adds the URL to the vertex data.
|
18879 | *
|
18880 | * @param ids Comma separated list of ids
|
18881 | * @param linkStr URL to create a link for
|
18882 | * @param target Target of the link, _blank by default as originally defined in the svgDraw.js file
|
18883 | */
|
18884 |
|
18885 |
|
18886 | var setLink = function setLink(ids, linkStr, target) {
|
18887 | var config = _config__WEBPACK_IMPORTED_MODULE_2__.getConfig();
|
18888 | ids.split(',').forEach(function (_id) {
|
18889 | var id = _id;
|
18890 | if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
18891 |
|
18892 | if (typeof classes[id] !== 'undefined') {
|
18893 | classes[id].link = _utils__WEBPACK_IMPORTED_MODULE_6__["default"].formatUrl(linkStr, config);
|
18894 |
|
18895 | if (config.securityLevel === 'sandbox') {
|
18896 | classes[id].linkTarget = '_top';
|
18897 | } else if (typeof target === 'string') {
|
18898 | classes[id].linkTarget = sanitizeText(target);
|
18899 | } else {
|
18900 | classes[id].linkTarget = '_blank';
|
18901 | }
|
18902 | }
|
18903 | });
|
18904 | setCssClass(ids, 'clickable');
|
18905 | };
|
18906 | /**
|
18907 | * Called by parser when a click definition is found. Registers an event handler.
|
18908 | *
|
18909 | * @param ids Comma separated list of ids
|
18910 | * @param functionName Function to be called on click
|
18911 | * @param functionArgs Function args the function should be called with
|
18912 | */
|
18913 |
|
18914 | var setClickEvent = function setClickEvent(ids, functionName, functionArgs) {
|
18915 | ids.split(',').forEach(function (id) {
|
18916 | setClickFunc(id, functionName, functionArgs);
|
18917 | classes[id].haveCallback = true;
|
18918 | });
|
18919 | setCssClass(ids, 'clickable');
|
18920 | };
|
18921 |
|
18922 | var setClickFunc = function setClickFunc(domId, functionName, functionArgs) {
|
18923 | var config = _config__WEBPACK_IMPORTED_MODULE_2__.getConfig();
|
18924 | var id = domId;
|
18925 | var elemId = lookUpDomId(id);
|
18926 |
|
18927 | if (config.securityLevel !== 'loose') {
|
18928 | return;
|
18929 | }
|
18930 |
|
18931 | if (typeof functionName === 'undefined') {
|
18932 | return;
|
18933 | }
|
18934 |
|
18935 | if (typeof classes[id] !== 'undefined') {
|
18936 | var argList = [];
|
18937 |
|
18938 | if (typeof functionArgs === 'string') {
|
18939 | /* Splits functionArgs by ',', ignoring all ',' in double quoted strings */
|
18940 | argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
|
18941 |
|
18942 | for (var i = 0; i < argList.length; i++) {
|
18943 | var item = argList[i].trim();
|
18944 | /* Removes all double quotes at the start and end of an argument */
|
18945 |
|
18946 | /* This preserves all starting and ending whitespace inside */
|
18947 |
|
18948 | if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
|
18949 | item = item.substr(1, item.length - 2);
|
18950 | }
|
18951 |
|
18952 | argList[i] = item;
|
18953 | }
|
18954 | }
|
18955 | /* if no arguments passed into callback, default to passing in id */
|
18956 |
|
18957 |
|
18958 | if (argList.length === 0) {
|
18959 | argList.push(elemId);
|
18960 | }
|
18961 |
|
18962 | funs.push(function () {
|
18963 | var elem = document.querySelector("[id=\"".concat(elemId, "\"]"));
|
18964 |
|
18965 | if (elem !== null) {
|
18966 | elem.addEventListener('click', function () {
|
18967 | _utils__WEBPACK_IMPORTED_MODULE_6__["default"].runFunc.apply(_utils__WEBPACK_IMPORTED_MODULE_6__["default"], [functionName].concat(_toConsumableArray(argList)));
|
18968 | }, false);
|
18969 | }
|
18970 | });
|
18971 | }
|
18972 | };
|
18973 |
|
18974 | var bindFunctions = function bindFunctions(element) {
|
18975 | funs.forEach(function (fun) {
|
18976 | fun(element);
|
18977 | });
|
18978 | };
|
18979 | var lineType = {
|
18980 | LINE: 0,
|
18981 | DOTTED_LINE: 1
|
18982 | };
|
18983 | var relationType = {
|
18984 | AGGREGATION: 0,
|
18985 | EXTENSION: 1,
|
18986 | COMPOSITION: 2,
|
18987 | DEPENDENCY: 3
|
18988 | };
|
18989 |
|
18990 | var setupToolTips = function setupToolTips(element) {
|
18991 | var tooltipElem = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('.mermaidTooltip');
|
18992 |
|
18993 | if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
|
18994 | tooltipElem = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
|
18995 | }
|
18996 |
|
18997 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(element).select('svg');
|
18998 | var nodes = svg.selectAll('g.node');
|
18999 | nodes.on('mouseover', function () {
|
19000 | var el = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(this);
|
19001 | var title = el.attr('title'); // Dont try to draw a tooltip if no data is provided
|
19002 |
|
19003 | if (title === null) {
|
19004 | return;
|
19005 | }
|
19006 |
|
19007 | var rect = this.getBoundingClientRect();
|
19008 | tooltipElem.transition().duration(200).style('opacity', '.9');
|
19009 | tooltipElem.text(el.attr('title')).style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px').style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px');
|
19010 | el.classed('hover', true);
|
19011 | }).on('mouseout', function () {
|
19012 | tooltipElem.transition().duration(500).style('opacity', 0);
|
19013 | var el = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(this);
|
19014 | el.classed('hover', false);
|
19015 | });
|
19016 | };
|
19017 |
|
19018 | funs.push(setupToolTips);
|
19019 | var direction = 'TB';
|
19020 |
|
19021 | var getDirection = function getDirection() {
|
19022 | return direction;
|
19023 | };
|
19024 |
|
19025 | var setDirection = function setDirection(dir) {
|
19026 | direction = dir;
|
19027 | };
|
19028 |
|
19029 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
19030 | parseDirective: parseDirective,
|
19031 | setAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_4__.setAccTitle,
|
19032 | getAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_4__.getAccTitle,
|
19033 | getAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_4__.getAccDescription,
|
19034 | setAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_4__.setAccDescription,
|
19035 | getConfig: function getConfig() {
|
19036 | return _config__WEBPACK_IMPORTED_MODULE_2__.getConfig().class;
|
19037 | },
|
19038 | addClass: addClass,
|
19039 | bindFunctions: bindFunctions,
|
19040 | clear: clear,
|
19041 | getClass: getClass,
|
19042 | getClasses: getClasses,
|
19043 | addAnnotation: addAnnotation,
|
19044 | getRelations: getRelations,
|
19045 | addRelation: addRelation,
|
19046 | getDirection: getDirection,
|
19047 | setDirection: setDirection,
|
19048 | addMember: addMember,
|
19049 | addMembers: addMembers,
|
19050 | cleanupLabel: cleanupLabel,
|
19051 | lineType: lineType,
|
19052 | relationType: relationType,
|
19053 | setClickEvent: setClickEvent,
|
19054 | setCssClass: setCssClass,
|
19055 | setLink: setLink,
|
19056 | setTooltip: setTooltip,
|
19057 | lookUpDomId: lookUpDomId
|
19058 | });
|
19059 |
|
19060 | /***/ }),
|
19061 |
|
19062 | /***/ "./src/diagrams/class/classRenderer-v2.js":
|
19063 | /*!************************************************!*\
|
19064 | !*** ./src/diagrams/class/classRenderer-v2.js ***!
|
19065 | \************************************************/
|
19066 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
19067 |
|
19068 | "use strict";
|
19069 | __webpack_require__.r(__webpack_exports__);
|
19070 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
19071 | /* harmony export */ "addClasses": () => (/* binding */ addClasses),
|
19072 | /* harmony export */ "addRelations": () => (/* binding */ addRelations),
|
19073 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
19074 | /* harmony export */ "draw": () => (/* binding */ draw),
|
19075 | /* harmony export */ "setConf": () => (/* binding */ setConf)
|
19076 | /* harmony export */ });
|
19077 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
19078 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
19079 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphlib */ "graphlib");
|
19080 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_1__);
|
19081 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
19082 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
19083 | /* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
|
19084 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
19085 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
19086 | /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js");
|
19087 |
|
19088 |
|
19089 |
|
19090 |
|
19091 | // import addHtmlLabel from 'dagre-d3/lib/label/add-html-label.js';
|
19092 |
|
19093 |
|
19094 |
|
19095 |
|
19096 |
|
19097 | var idCache = {};
|
19098 | var padding = 20;
|
19099 |
|
19100 | var sanitizeText = function sanitizeText(txt) {
|
19101 | return _common_common__WEBPACK_IMPORTED_MODULE_2__["default"].sanitizeText(txt, (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)());
|
19102 | };
|
19103 |
|
19104 | var conf = {
|
19105 | dividerMargin: 10,
|
19106 | padding: 5,
|
19107 | textHeight: 10
|
19108 | };
|
19109 | /**
|
19110 | * Function that adds the vertices found during parsing to the graph to be rendered.
|
19111 | *
|
19112 | * @param {Object<
|
19113 | * string,
|
19114 | * { cssClasses: string[]; text: string; id: string; type: string; domId: string }
|
19115 | * >} classes
|
19116 | * Object containing the vertices.
|
19117 | * @param {SVGGElement} g The graph that is to be drawn.
|
19118 | */
|
19119 |
|
19120 | var addClasses = function addClasses(classes, g) {
|
19121 | // const svg = select(`[id="${svgId}"]`);
|
19122 | var keys = Object.keys(classes);
|
19123 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('keys:', keys);
|
19124 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info(classes); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
|
19125 |
|
19126 | keys.forEach(function (id) {
|
19127 | var vertex = classes[id];
|
19128 | /**
|
19129 | * Variable for storing the classes for the vertex
|
19130 | *
|
19131 | * @type {string}
|
19132 | */
|
19133 |
|
19134 | var cssClassStr = '';
|
19135 |
|
19136 | if (vertex.cssClasses.length > 0) {
|
19137 | cssClassStr = cssClassStr + ' ' + vertex.cssClasses.join(' ');
|
19138 | } // if (vertex.classes.length > 0) {
|
19139 | // classStr = vertex.classes.join(' ');
|
19140 | // }
|
19141 |
|
19142 |
|
19143 | var styles = {
|
19144 | labelStyle: ''
|
19145 | }; //getStylesFromArray(vertex.styles);
|
19146 | // Use vertex id as text in the box if no text is provided by the graph definition
|
19147 |
|
19148 | var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
|
19149 | // let vertexNode;
|
19150 | // if (evaluate(getConfig().flowchart.htmlLabels)) {
|
19151 | // const node = {
|
19152 | // label: vertexText.replace(
|
19153 | // /fa[lrsb]?:fa-[\w-]+/g,
|
19154 | // s => `<i class='${s.replace(':', ' ')}'></i>`
|
19155 | // )
|
19156 | // };
|
19157 | // vertexNode = addHtmlLabel(svg, node).node();
|
19158 | // vertexNode.parentNode.removeChild(vertexNode);
|
19159 | // } else {
|
19160 | // const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
19161 | // svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
|
19162 | // const rows = vertexText.split(common.lineBreakRegex);
|
19163 | // for (let j = 0; j < rows.length; j++) {
|
19164 | // const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
19165 | // tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
19166 | // tspan.setAttribute('dy', '1em');
|
19167 | // tspan.setAttribute('x', '1');
|
19168 | // tspan.textContent = rows[j];
|
19169 | // svgLabel.appendChild(tspan);
|
19170 | // }
|
19171 | // vertexNode = svgLabel;
|
19172 | // }
|
19173 |
|
19174 | var radious = 0;
|
19175 | var _shape = ''; // Set the shape based parameters
|
19176 |
|
19177 | switch (vertex.type) {
|
19178 | case 'class':
|
19179 | _shape = 'class_box';
|
19180 | break;
|
19181 |
|
19182 | default:
|
19183 | _shape = 'class_box';
|
19184 | } // Add the node
|
19185 |
|
19186 |
|
19187 | g.setNode(vertex.id, {
|
19188 | labelStyle: styles.labelStyle,
|
19189 | shape: _shape,
|
19190 | labelText: sanitizeText(vertexText),
|
19191 | classData: vertex,
|
19192 | rx: radious,
|
19193 | ry: radious,
|
19194 | class: cssClassStr,
|
19195 | style: styles.style,
|
19196 | id: vertex.id,
|
19197 | domId: vertex.domId,
|
19198 | haveCallback: vertex.haveCallback,
|
19199 | link: vertex.link,
|
19200 | width: vertex.type === 'group' ? 500 : undefined,
|
19201 | type: vertex.type,
|
19202 | padding: (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().flowchart.padding
|
19203 | });
|
19204 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('setNode', {
|
19205 | labelStyle: styles.labelStyle,
|
19206 | shape: _shape,
|
19207 | labelText: vertexText,
|
19208 | rx: radious,
|
19209 | ry: radious,
|
19210 | class: cssClassStr,
|
19211 | style: styles.style,
|
19212 | id: vertex.id,
|
19213 | width: vertex.type === 'group' ? 500 : undefined,
|
19214 | type: vertex.type,
|
19215 | padding: (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().flowchart.padding
|
19216 | });
|
19217 | });
|
19218 | };
|
19219 | /**
|
19220 | * Add edges to graph based on parsed graph definition
|
19221 | *
|
19222 | * @param relations
|
19223 | * @param {object} g The graph object
|
19224 | */
|
19225 |
|
19226 | var addRelations = function addRelations(relations, g) {
|
19227 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().flowchart;
|
19228 | var cnt = 0;
|
19229 | var defaultStyle;
|
19230 | var defaultLabelStyle; // if (typeof relations.defaultStyle !== 'undefined') {
|
19231 | // const defaultStyles = getStylesFromArray(relations.defaultStyle);
|
19232 | // defaultStyle = defaultStyles.style;
|
19233 | // defaultLabelStyle = defaultStyles.labelStyle;
|
19234 | // }
|
19235 |
|
19236 | relations.forEach(function (edge) {
|
19237 | cnt++;
|
19238 | var edgeData = {}; //Set relationship style and line type
|
19239 |
|
19240 | edgeData.classes = 'relation';
|
19241 | edgeData.pattern = edge.relation.lineType == 1 ? 'dashed' : 'solid';
|
19242 | edgeData.id = 'id' + cnt; // Set link type for rendering
|
19243 |
|
19244 | if (edge.type === 'arrow_open') {
|
19245 | edgeData.arrowhead = 'none';
|
19246 | } else {
|
19247 | edgeData.arrowhead = 'normal';
|
19248 | }
|
19249 |
|
19250 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info(edgeData, edge); //Set edge extra labels
|
19251 | //edgeData.startLabelLeft = edge.relationTitle1;
|
19252 |
|
19253 | edgeData.startLabelRight = edge.relationTitle1 === 'none' ? '' : edge.relationTitle1;
|
19254 | edgeData.endLabelLeft = edge.relationTitle2 === 'none' ? '' : edge.relationTitle2; //edgeData.endLabelRight = edge.relationTitle2;
|
19255 | //Set relation arrow types
|
19256 |
|
19257 | edgeData.arrowTypeStart = getArrowMarker(edge.relation.type1);
|
19258 | edgeData.arrowTypeEnd = getArrowMarker(edge.relation.type2);
|
19259 | var style = '';
|
19260 | var labelStyle = '';
|
19261 |
|
19262 | if (typeof edge.style !== 'undefined') {
|
19263 | var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getStylesFromArray)(edge.style);
|
19264 | style = styles.style;
|
19265 | labelStyle = styles.labelStyle;
|
19266 | } else {
|
19267 | style = 'fill:none';
|
19268 |
|
19269 | if (typeof defaultStyle !== 'undefined') {
|
19270 | style = defaultStyle;
|
19271 | }
|
19272 |
|
19273 | if (typeof defaultLabelStyle !== 'undefined') {
|
19274 | labelStyle = defaultLabelStyle;
|
19275 | }
|
19276 | }
|
19277 |
|
19278 | edgeData.style = style;
|
19279 | edgeData.labelStyle = labelStyle;
|
19280 |
|
19281 | if (typeof edge.interpolate !== 'undefined') {
|
19282 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.interpolateToCurve)(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_0__.curveLinear);
|
19283 | } else if (typeof relations.defaultInterpolate !== 'undefined') {
|
19284 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.interpolateToCurve)(relations.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_0__.curveLinear);
|
19285 | } else {
|
19286 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.interpolateToCurve)(conf.curve, d3__WEBPACK_IMPORTED_MODULE_0__.curveLinear);
|
19287 | }
|
19288 |
|
19289 | edge.text = edge.title;
|
19290 |
|
19291 | if (typeof edge.text === 'undefined') {
|
19292 | if (typeof edge.style !== 'undefined') {
|
19293 | edgeData.arrowheadStyle = 'fill: #333';
|
19294 | }
|
19295 | } else {
|
19296 | edgeData.arrowheadStyle = 'fill: #333';
|
19297 | edgeData.labelpos = 'c';
|
19298 |
|
19299 | if ((0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().flowchart.htmlLabels) {
|
19300 | // eslint-disable-line
|
19301 | edgeData.labelType = 'html';
|
19302 | edgeData.label = '<span class="edgeLabel">' + edge.text + '</span>';
|
19303 | } else {
|
19304 | edgeData.labelType = 'text';
|
19305 | edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_2__["default"].lineBreakRegex, '\n');
|
19306 |
|
19307 | if (typeof edge.style === 'undefined') {
|
19308 | edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
|
19309 | }
|
19310 |
|
19311 | edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
|
19312 | }
|
19313 | } // Add the edge to the graph
|
19314 |
|
19315 |
|
19316 | g.setEdge(edge.id1, edge.id2, edgeData, cnt);
|
19317 | });
|
19318 | };
|
19319 | /**
|
19320 | * Gets the ID with the same label as in the cache
|
19321 | *
|
19322 | * @param {string} label The label to look for
|
19323 | * @returns {string} The resulting ID
|
19324 | */
|
19325 |
|
19326 | var getGraphId = function getGraphId(label) {
|
19327 | var foundEntry = Object.entries(idCache).find(function (entry) {
|
19328 | return entry[1].label === label;
|
19329 | });
|
19330 |
|
19331 | if (foundEntry) {
|
19332 | return foundEntry[0];
|
19333 | }
|
19334 | };
|
19335 | /**
|
19336 | * Merges the value of `conf` with the passed `cnf`
|
19337 | *
|
19338 | * @param {object} cnf Config to merge
|
19339 | */
|
19340 |
|
19341 |
|
19342 | var setConf = function setConf(cnf) {
|
19343 | var keys = Object.keys(cnf);
|
19344 | keys.forEach(function (key) {
|
19345 | conf[key] = cnf[key];
|
19346 | });
|
19347 | };
|
19348 | /**
|
19349 | * Draws a flowchart in the tag with id: id based on the graph definition in text.
|
19350 | *
|
19351 | * @param {string} text
|
19352 | * @param {string} id
|
19353 | * @param _version
|
19354 | * @param diagObj
|
19355 | */
|
19356 |
|
19357 | var draw = function draw(text, id, _version, diagObj) {
|
19358 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Drawing class - ', id); // diagObj.db.clear();
|
19359 | // const parser = diagObj.db.parser;
|
19360 | // parser.yy = classDb;
|
19361 | // Parse the graph definition
|
19362 | // try {
|
19363 | // parser.parse(text);
|
19364 | // } catch (err) {
|
19365 | // log.debug('Parsing failed');
|
19366 | // }
|
19367 | // Fetch the default direction, use TD if none was found
|
19368 | //let dir = 'TD';
|
19369 |
|
19370 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().flowchart;
|
19371 | var securityLevel = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().securityLevel;
|
19372 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('config:', conf);
|
19373 | var nodeSpacing = conf.nodeSpacing || 50;
|
19374 | var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
|
19375 |
|
19376 | var g = new (graphlib__WEBPACK_IMPORTED_MODULE_1___default().Graph)({
|
19377 | multigraph: true,
|
19378 | compound: true
|
19379 | }).setGraph({
|
19380 | rankdir: diagObj.db.getDirection(),
|
19381 | nodesep: nodeSpacing,
|
19382 | ranksep: rankSpacing,
|
19383 | marginx: 8,
|
19384 | marginy: 8
|
19385 | }).setDefaultEdgeLabel(function () {
|
19386 | return {};
|
19387 | }); // let subG;
|
19388 | // const subGraphs = flowDb.getSubGraphs();
|
19389 | // log.info('Subgraphs - ', subGraphs);
|
19390 | // for (let i = subGraphs.length - 1; i >= 0; i--) {
|
19391 | // subG = subGraphs[i];
|
19392 | // log.info('Subgraph - ', subG);
|
19393 | // flowDb.addVertex(subG.id, subG.title, 'group', undefined, subG.classes);
|
19394 | // }
|
19395 | // Fetch the vertices/nodes and edges/links from the parsed graph definition
|
19396 |
|
19397 | var classes = diagObj.db.getClasses();
|
19398 | var relations = diagObj.db.getRelations();
|
19399 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info(relations);
|
19400 | addClasses(classes, g, id);
|
19401 | addRelations(relations, g); // Add custom shapes
|
19402 | // flowChartShapes.addToRenderV2(addShape);
|
19403 | // Set up an SVG group so that we can translate the final graph.
|
19404 |
|
19405 | var sandboxElement;
|
19406 |
|
19407 | if (securityLevel === 'sandbox') {
|
19408 | sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#i' + id);
|
19409 | }
|
19410 |
|
19411 | var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body');
|
19412 | var svg = root.select("[id=\"".concat(id, "\"]")); // Run the renderer. This is what draws the final graph.
|
19413 |
|
19414 | var element = root.select('#' + id + ' g');
|
19415 | (0,_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_6__.render)(element, g, ['aggregation', 'extension', 'composition', 'dependency'], 'classDiagram', id);
|
19416 | (0,_utils__WEBPACK_IMPORTED_MODULE_5__.setupGraphViewbox)(g, svg, conf.diagramPadding, conf.useMaxWidth); // Add label rects for non html labels
|
19417 |
|
19418 | if (!conf.htmlLabels) {
|
19419 | var doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;
|
19420 | var labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
19421 |
|
19422 | for (var k = 0; k < labels.length; k++) {
|
19423 | var label = labels[k]; // Get dimensions of label
|
19424 |
|
19425 | var dim = label.getBBox();
|
19426 | var rect = doc.createElementNS('http://www.w3.org/2000/svg', 'rect');
|
19427 | rect.setAttribute('rx', 0);
|
19428 | rect.setAttribute('ry', 0);
|
19429 | rect.setAttribute('width', dim.width);
|
19430 | rect.setAttribute('height', dim.height); // rect.setAttribute('style', 'fill:#e8e8e8;');
|
19431 |
|
19432 | label.insertBefore(rect, label.firstChild);
|
19433 | }
|
19434 | }
|
19435 |
|
19436 | (0,_accessibility__WEBPACK_IMPORTED_MODULE_7__["default"])(diagObj.db, svg, id); // If node has a link, wrap it in an anchor SVG object.
|
19437 | // const keys = Object.keys(classes);
|
19438 | // keys.forEach(function(key) {
|
19439 | // const vertex = classes[key];
|
19440 | // if (vertex.link) {
|
19441 | // const node = select('#' + id + ' [id="' + key + '"]');
|
19442 | // if (node) {
|
19443 | // const link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
|
19444 | // link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
|
19445 | // link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
|
19446 | // link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
|
19447 | // const linkNode = node.insert(function() {
|
19448 | // return link;
|
19449 | // }, ':first-child');
|
19450 | // const shape = node.select('.label-container');
|
19451 | // if (shape) {
|
19452 | // linkNode.append(function() {
|
19453 | // return shape.node();
|
19454 | // });
|
19455 | // }
|
19456 | // const label = node.select('.label');
|
19457 | // if (label) {
|
19458 | // linkNode.append(function() {
|
19459 | // return label.node();
|
19460 | // });
|
19461 | // }
|
19462 | // }
|
19463 | // }
|
19464 | // });
|
19465 | };
|
19466 | /**
|
19467 | * Gets the arrow marker for a type index
|
19468 | *
|
19469 | * @param {number} type The type to look for
|
19470 | * @returns {'aggregation' | 'extension' | 'composition' | 'dependency'} The arrow marker
|
19471 | */
|
19472 |
|
19473 | function getArrowMarker(type) {
|
19474 | var marker;
|
19475 |
|
19476 | switch (type) {
|
19477 | case 0:
|
19478 | marker = 'aggregation';
|
19479 | break;
|
19480 |
|
19481 | case 1:
|
19482 | marker = 'extension';
|
19483 | break;
|
19484 |
|
19485 | case 2:
|
19486 | marker = 'composition';
|
19487 | break;
|
19488 |
|
19489 | case 3:
|
19490 | marker = 'dependency';
|
19491 | break;
|
19492 |
|
19493 | default:
|
19494 | marker = 'none';
|
19495 | }
|
19496 |
|
19497 | return marker;
|
19498 | }
|
19499 |
|
19500 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
19501 | setConf: setConf,
|
19502 | draw: draw
|
19503 | });
|
19504 |
|
19505 | /***/ }),
|
19506 |
|
19507 | /***/ "./src/diagrams/class/classRenderer.js":
|
19508 | /*!*********************************************!*\
|
19509 | !*** ./src/diagrams/class/classRenderer.js ***!
|
19510 | \*********************************************/
|
19511 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
19512 |
|
19513 | "use strict";
|
19514 | __webpack_require__.r(__webpack_exports__);
|
19515 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
19516 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
19517 | /* harmony export */ "draw": () => (/* binding */ draw)
|
19518 | /* harmony export */ });
|
19519 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
19520 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
19521 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
|
19522 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
|
19523 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
|
19524 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
|
19525 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
19526 | /* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/class/svgDraw.js");
|
19527 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
19528 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
19529 | /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js");
|
19530 |
|
19531 |
|
19532 |
|
19533 |
|
19534 |
|
19535 |
|
19536 |
|
19537 |
|
19538 | var idCache = {};
|
19539 | var padding = 20;
|
19540 | var confa = {
|
19541 | dividerMargin: 10,
|
19542 | padding: 5,
|
19543 | textHeight: 10
|
19544 | };
|
19545 | /**
|
19546 | * Gets the ID with the same label as in the cache
|
19547 | *
|
19548 | * @param {string} label The label to look for
|
19549 | * @returns {string} The resulting ID
|
19550 | */
|
19551 |
|
19552 | var getGraphId = function getGraphId(label) {
|
19553 | var foundEntry = Object.entries(idCache).find(function (entry) {
|
19554 | return entry[1].label === label;
|
19555 | });
|
19556 |
|
19557 | if (foundEntry) {
|
19558 | return foundEntry[0];
|
19559 | }
|
19560 | };
|
19561 | /**
|
19562 | * Setup arrow head and define the marker. The result is appended to the svg.
|
19563 | *
|
19564 | * @param {SVGSVGElement} elem The SVG element to append to
|
19565 | */
|
19566 |
|
19567 |
|
19568 | var insertMarkers = function insertMarkers(elem) {
|
19569 | elem.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');
|
19570 | elem.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'); // this is actual shape for arrowhead
|
19571 |
|
19572 | elem.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');
|
19573 | elem.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');
|
19574 | elem.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');
|
19575 | elem.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');
|
19576 | elem.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');
|
19577 | elem.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');
|
19578 | };
|
19579 | /**
|
19580 | * Draws a flowchart in the tag with id: id based on the graph definition in text.
|
19581 | *
|
19582 | * @param {string} text
|
19583 | * @param {string} id
|
19584 | * @param version
|
19585 | * @param _version
|
19586 | * @param diagObj
|
19587 | */
|
19588 |
|
19589 |
|
19590 | var draw = function draw(text, id, _version, diagObj) {
|
19591 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().class;
|
19592 | idCache = {}; // diagObj.db.clear();
|
19593 | // diagObj.parser.parse(text);
|
19594 |
|
19595 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Rendering diagram ' + text);
|
19596 | var securityLevel = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().securityLevel; // Handle root and Document for when rendering in sanbox mode
|
19597 |
|
19598 | var sandboxElement;
|
19599 |
|
19600 | if (securityLevel === 'sandbox') {
|
19601 | sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#i' + id);
|
19602 | }
|
19603 |
|
19604 | var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body');
|
19605 | var doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; // Fetch the default direction, use TD if none was found
|
19606 |
|
19607 | var diagram = root.select("[id='".concat(id, "']"));
|
19608 | insertMarkers(diagram); // Layout graph, Create a new directed graph
|
19609 |
|
19610 | var g = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
|
19611 | multigraph: true
|
19612 | }); // Set an object for the graph label
|
19613 |
|
19614 | g.setGraph({
|
19615 | isMultiGraph: true
|
19616 | }); // Default to assigning a new object as a label for each new edge.
|
19617 |
|
19618 | g.setDefaultEdgeLabel(function () {
|
19619 | return {};
|
19620 | });
|
19621 | var classes = diagObj.db.getClasses();
|
19622 | var keys = Object.keys(classes);
|
19623 |
|
19624 | for (var i = 0; i < keys.length; i++) {
|
19625 | var classDef = classes[keys[i]];
|
19626 | var node = _svgDraw__WEBPACK_IMPORTED_MODULE_5__["default"].drawClass(diagram, classDef, conf, diagObj);
|
19627 | idCache[node.id] = node; // Add nodes to the graph. The first argument is the node id. The second is
|
19628 | // metadata about the node. In this case we're going to add labels to each of
|
19629 | // our nodes.
|
19630 |
|
19631 | g.setNode(node.id, node);
|
19632 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Org height: ' + node.height);
|
19633 | }
|
19634 |
|
19635 | var relations = diagObj.db.getRelations();
|
19636 | relations.forEach(function (relation) {
|
19637 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation));
|
19638 | g.setEdge(getGraphId(relation.id1), getGraphId(relation.id2), {
|
19639 | relation: relation
|
19640 | }, relation.title || 'DEFAULT');
|
19641 | });
|
19642 | dagre__WEBPACK_IMPORTED_MODULE_1___default().layout(g);
|
19643 | g.nodes().forEach(function (v) {
|
19644 | if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') {
|
19645 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
|
19646 | root.select('#' + diagObj.db.lookUpDomId(v)).attr('transform', 'translate(' + (g.node(v).x - g.node(v).width / 2) + ',' + (g.node(v).y - g.node(v).height / 2) + ' )');
|
19647 | }
|
19648 | });
|
19649 | g.edges().forEach(function (e) {
|
19650 | if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') {
|
19651 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
|
19652 | _svgDraw__WEBPACK_IMPORTED_MODULE_5__["default"].drawEdge(diagram, g.edge(e), g.edge(e).relation, conf, diagObj);
|
19653 | }
|
19654 | });
|
19655 | var svgBounds = diagram.node().getBBox();
|
19656 | var width = svgBounds.width + padding * 2;
|
19657 | var height = svgBounds.height + padding * 2;
|
19658 | (0,_utils__WEBPACK_IMPORTED_MODULE_6__.configureSvgSize)(diagram, height, width, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
|
19659 |
|
19660 | var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
|
19661 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug("viewBox ".concat(vBox));
|
19662 | diagram.attr('viewBox', vBox);
|
19663 | (0,_accessibility__WEBPACK_IMPORTED_MODULE_7__["default"])(diagObj.db, diagram, id);
|
19664 | };
|
19665 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
19666 | draw: draw
|
19667 | });
|
19668 |
|
19669 | /***/ }),
|
19670 |
|
19671 | /***/ "./src/diagrams/class/styles.js":
|
19672 | /*!**************************************!*\
|
19673 | !*** ./src/diagrams/class/styles.js ***!
|
19674 | \**************************************/
|
19675 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
19676 |
|
19677 | "use strict";
|
19678 | __webpack_require__.r(__webpack_exports__);
|
19679 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
19680 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
19681 | /* harmony export */ });
|
19682 | var getStyles = function getStyles(options) {
|
19683 | return "g.classGroup text {\n fill: ".concat(options.nodeBorder, ";\n fill: ").concat(options.classText, ";\n stroke: none;\n font-family: ").concat(options.fontFamily, ";\n font-size: 10px;\n\n .title {\n font-weight: bolder;\n }\n\n}\n\n.nodeLabel, .edgeLabel {\n color: ").concat(options.classText, ";\n}\n.edgeLabel .label rect {\n fill: ").concat(options.mainBkg, ";\n}\n.label text {\n fill: ").concat(options.classText, ";\n}\n.edgeLabel .label span {\n background: ").concat(options.mainBkg, ";\n}\n\n.classTitle {\n font-weight: bolder;\n}\n.node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n stroke-width: 1px;\n }\n\n\n.divider {\n stroke: ").concat(options.nodeBorder, ";\n stroke: 1;\n}\n\ng.clickable {\n cursor: pointer;\n}\n\ng.classGroup rect {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n}\n\ng.classGroup line {\n stroke: ").concat(options.nodeBorder, ";\n stroke-width: 1;\n}\n\n.classLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ").concat(options.mainBkg, ";\n opacity: 0.5;\n}\n\n.classLabel .label {\n fill: ").concat(options.nodeBorder, ";\n font-size: 10px;\n}\n\n.relation {\n stroke: ").concat(options.lineColor, ";\n stroke-width: 1;\n fill: none;\n}\n\n.dashed-line{\n stroke-dasharray: 3;\n}\n\n#compositionStart, .composition {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#compositionEnd, .composition {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#dependencyStart, .dependency {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#dependencyStart, .dependency {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#extensionStart, .extension {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#extensionEnd, .extension {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#aggregationStart, .aggregation {\n fill: ").concat(options.mainBkg, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#aggregationEnd, .aggregation {\n fill: ").concat(options.mainBkg, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n.edgeTerminals {\n font-size: 11px;\n}\n\n");
|
19684 | };
|
19685 |
|
19686 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
19687 |
|
19688 | /***/ }),
|
19689 |
|
19690 | /***/ "./src/diagrams/class/svgDraw.js":
|
19691 | /*!***************************************!*\
|
19692 | !*** ./src/diagrams/class/svgDraw.js ***!
|
19693 | \***************************************/
|
19694 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
19695 |
|
19696 | "use strict";
|
19697 | __webpack_require__.r(__webpack_exports__);
|
19698 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
19699 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
19700 | /* harmony export */ "drawClass": () => (/* binding */ drawClass),
|
19701 | /* harmony export */ "drawEdge": () => (/* binding */ drawEdge),
|
19702 | /* harmony export */ "parseMember": () => (/* binding */ parseMember)
|
19703 | /* harmony export */ });
|
19704 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
19705 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
19706 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
19707 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
19708 |
|
19709 |
|
19710 |
|
19711 | var edgeCount = 0;
|
19712 | var drawEdge = function drawEdge(elem, path, relation, conf, diagObj) {
|
19713 | var getRelationType = function getRelationType(type) {
|
19714 | switch (type) {
|
19715 | case diagObj.db.relationType.AGGREGATION:
|
19716 | return 'aggregation';
|
19717 |
|
19718 | case diagObj.db.EXTENSION:
|
19719 | return 'extension';
|
19720 |
|
19721 | case diagObj.db.COMPOSITION:
|
19722 | return 'composition';
|
19723 |
|
19724 | case diagObj.db.DEPENDENCY:
|
19725 | return 'dependency';
|
19726 | }
|
19727 | };
|
19728 |
|
19729 | path.points = path.points.filter(function (p) {
|
19730 | return !Number.isNaN(p.y);
|
19731 | }); // The data for our line
|
19732 |
|
19733 | var lineData = path.points; // This is the accessor function we talked about above
|
19734 |
|
19735 | var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) {
|
19736 | return d.x;
|
19737 | }).y(function (d) {
|
19738 | return d.y;
|
19739 | }).curve(d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis);
|
19740 | var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', 'edge' + edgeCount).attr('class', 'relation');
|
19741 | var url = '';
|
19742 |
|
19743 | if (conf.arrowMarkerAbsolute) {
|
19744 | url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
|
19745 | url = url.replace(/\(/g, '\\(');
|
19746 | url = url.replace(/\)/g, '\\)');
|
19747 | }
|
19748 |
|
19749 | if (relation.relation.lineType == 1) {
|
19750 | svgPath.attr('class', 'relation dashed-line');
|
19751 | }
|
19752 |
|
19753 | if (relation.relation.type1 !== 'none') {
|
19754 | svgPath.attr('marker-start', 'url(' + url + '#' + getRelationType(relation.relation.type1) + 'Start' + ')');
|
19755 | }
|
19756 |
|
19757 | if (relation.relation.type2 !== 'none') {
|
19758 | svgPath.attr('marker-end', 'url(' + url + '#' + getRelationType(relation.relation.type2) + 'End' + ')');
|
19759 | }
|
19760 |
|
19761 | var x, y;
|
19762 | var l = path.points.length; // Calculate Label position
|
19763 |
|
19764 | var labelPosition = _utils__WEBPACK_IMPORTED_MODULE_1__["default"].calcLabelPosition(path.points);
|
19765 | x = labelPosition.x;
|
19766 | y = labelPosition.y;
|
19767 | var p1_card_x, p1_card_y;
|
19768 | var p2_card_x, p2_card_y;
|
19769 |
|
19770 | if (l % 2 !== 0 && l > 1) {
|
19771 | var cardinality_1_point = _utils__WEBPACK_IMPORTED_MODULE_1__["default"].calcCardinalityPosition(relation.relation.type1 !== 'none', path.points, path.points[0]);
|
19772 | var cardinality_2_point = _utils__WEBPACK_IMPORTED_MODULE_1__["default"].calcCardinalityPosition(relation.relation.type2 !== 'none', path.points, path.points[l - 1]);
|
19773 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('cardinality_1_point ' + JSON.stringify(cardinality_1_point));
|
19774 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('cardinality_2_point ' + JSON.stringify(cardinality_2_point));
|
19775 | p1_card_x = cardinality_1_point.x;
|
19776 | p1_card_y = cardinality_1_point.y;
|
19777 | p2_card_x = cardinality_2_point.x;
|
19778 | p2_card_y = cardinality_2_point.y;
|
19779 | }
|
19780 |
|
19781 | if (typeof relation.title !== 'undefined') {
|
19782 | var g = elem.append('g').attr('class', 'classLabel');
|
19783 | var label = g.append('text').attr('class', 'label').attr('x', x).attr('y', y).attr('fill', 'red').attr('text-anchor', 'middle').text(relation.title);
|
19784 | window.label = label;
|
19785 | var bounds = label.node().getBBox();
|
19786 | g.insert('rect', ':first-child').attr('class', 'box').attr('x', bounds.x - conf.padding / 2).attr('y', bounds.y - conf.padding / 2).attr('width', bounds.width + conf.padding).attr('height', bounds.height + conf.padding);
|
19787 | }
|
19788 |
|
19789 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Rendering relation ' + JSON.stringify(relation));
|
19790 |
|
19791 | if (typeof relation.relationTitle1 !== 'undefined' && relation.relationTitle1 !== 'none') {
|
19792 | var _g = elem.append('g').attr('class', 'cardinality');
|
19793 |
|
19794 | _g.append('text').attr('class', 'type1').attr('x', p1_card_x).attr('y', p1_card_y).attr('fill', 'black').attr('font-size', '6').text(relation.relationTitle1);
|
19795 | }
|
19796 |
|
19797 | if (typeof relation.relationTitle2 !== 'undefined' && relation.relationTitle2 !== 'none') {
|
19798 | var _g2 = elem.append('g').attr('class', 'cardinality');
|
19799 |
|
19800 | _g2.append('text').attr('class', 'type2').attr('x', p2_card_x).attr('y', p2_card_y).attr('fill', 'black').attr('font-size', '6').text(relation.relationTitle2);
|
19801 | }
|
19802 |
|
19803 | edgeCount++;
|
19804 | };
|
19805 | /**
|
19806 | * Renders a class diagram
|
19807 | *
|
19808 | * @param {SVGSVGElement} elem The element to draw it into
|
19809 | * @param classDef
|
19810 | * @param conf
|
19811 | * @param diagObj
|
19812 | * @todo Add more information in the JSDOC here
|
19813 | */
|
19814 |
|
19815 | var drawClass = function drawClass(elem, classDef, conf, diagObj) {
|
19816 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('Rendering class ', classDef, conf);
|
19817 | var id = classDef.id;
|
19818 | var classInfo = {
|
19819 | id: id,
|
19820 | label: classDef.id,
|
19821 | width: 0,
|
19822 | height: 0
|
19823 | }; // add class group
|
19824 |
|
19825 | var g = elem.append('g').attr('id', diagObj.db.lookUpDomId(id)).attr('class', 'classGroup'); // add title
|
19826 |
|
19827 | var title;
|
19828 |
|
19829 | if (classDef.link) {
|
19830 | title = g.append('svg:a').attr('xlink:href', classDef.link).attr('target', classDef.linkTarget).append('text').attr('y', conf.textHeight + conf.padding).attr('x', 0);
|
19831 | } else {
|
19832 | title = g.append('text').attr('y', conf.textHeight + conf.padding).attr('x', 0);
|
19833 | } // add annotations
|
19834 |
|
19835 |
|
19836 | var isFirst = true;
|
19837 | classDef.annotations.forEach(function (member) {
|
19838 | var titleText2 = title.append('tspan').text('«' + member + '»');
|
19839 | if (!isFirst) titleText2.attr('dy', conf.textHeight);
|
19840 | isFirst = false;
|
19841 | });
|
19842 | var classTitleString = classDef.id;
|
19843 |
|
19844 | if (classDef.type !== undefined && classDef.type !== '') {
|
19845 | classTitleString += '<' + classDef.type + '>';
|
19846 | }
|
19847 |
|
19848 | var classTitle = title.append('tspan').text(classTitleString).attr('class', 'title'); // If class has annotations the title needs to have an offset of the text height
|
19849 |
|
19850 | if (!isFirst) classTitle.attr('dy', conf.textHeight);
|
19851 | var titleHeight = title.node().getBBox().height;
|
19852 | var membersLine = g.append('line') // text label for the x axis
|
19853 | .attr('x1', 0).attr('y1', conf.padding + titleHeight + conf.dividerMargin / 2).attr('y2', conf.padding + titleHeight + conf.dividerMargin / 2);
|
19854 | var members = g.append('text') // text label for the x axis
|
19855 | .attr('x', conf.padding).attr('y', titleHeight + conf.dividerMargin + conf.textHeight).attr('fill', 'white').attr('class', 'classText');
|
19856 | isFirst = true;
|
19857 | classDef.members.forEach(function (member) {
|
19858 | addTspan(members, member, isFirst, conf);
|
19859 | isFirst = false;
|
19860 | });
|
19861 | var membersBox = members.node().getBBox();
|
19862 | var methodsLine = g.append('line') // text label for the x axis
|
19863 | .attr('x1', 0).attr('y1', conf.padding + titleHeight + conf.dividerMargin + membersBox.height).attr('y2', conf.padding + titleHeight + conf.dividerMargin + membersBox.height);
|
19864 | var methods = g.append('text') // text label for the x axis
|
19865 | .attr('x', conf.padding).attr('y', titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight).attr('fill', 'white').attr('class', 'classText');
|
19866 | isFirst = true;
|
19867 | classDef.methods.forEach(function (method) {
|
19868 | addTspan(methods, method, isFirst, conf);
|
19869 | isFirst = false;
|
19870 | });
|
19871 | var classBox = g.node().getBBox();
|
19872 | var cssClassStr = ' ';
|
19873 |
|
19874 | if (classDef.cssClasses.length > 0) {
|
19875 | cssClassStr = cssClassStr + classDef.cssClasses.join(' ');
|
19876 | }
|
19877 |
|
19878 | var rect = g.insert('rect', ':first-child').attr('x', 0).attr('y', 0).attr('width', classBox.width + 2 * conf.padding).attr('height', classBox.height + conf.padding + 0.5 * conf.dividerMargin).attr('class', cssClassStr);
|
19879 | var rectWidth = rect.node().getBBox().width; // Center title
|
19880 | // We subtract the width of each text element from the class box width and divide it by 2
|
19881 |
|
19882 | title.node().childNodes.forEach(function (x) {
|
19883 | x.setAttribute('x', (rectWidth - x.getBBox().width) / 2);
|
19884 | });
|
19885 |
|
19886 | if (classDef.tooltip) {
|
19887 | title.insert('title').text(classDef.tooltip);
|
19888 | }
|
19889 |
|
19890 | membersLine.attr('x2', rectWidth);
|
19891 | methodsLine.attr('x2', rectWidth);
|
19892 | classInfo.width = rectWidth;
|
19893 | classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
|
19894 | return classInfo;
|
19895 | };
|
19896 | var parseMember = function parseMember(text) {
|
19897 | var fieldRegEx = /^(\+|-|~|#)?(\w+)(~\w+~|\[\])?\s+(\w+) *(\*|\$)?$/;
|
19898 | var methodRegEx = /^([+|\-|~|#])?(\w+) *\( *(.*)\) *(\*|\$)? *(\w*[~|[\]]*\s*\w*~?)$/;
|
19899 | var fieldMatch = text.match(fieldRegEx);
|
19900 | var methodMatch = text.match(methodRegEx);
|
19901 |
|
19902 | if (fieldMatch && !methodMatch) {
|
19903 | return buildFieldDisplay(fieldMatch);
|
19904 | } else if (methodMatch) {
|
19905 | return buildMethodDisplay(methodMatch);
|
19906 | } else {
|
19907 | return buildLegacyDisplay(text);
|
19908 | }
|
19909 | };
|
19910 |
|
19911 | var buildFieldDisplay = function buildFieldDisplay(parsedText) {
|
19912 | var cssStyle = '';
|
19913 | var displayText = '';
|
19914 |
|
19915 | try {
|
19916 | var visibility = parsedText[1] ? parsedText[1].trim() : '';
|
19917 | var fieldType = parsedText[2] ? parsedText[2].trim() : '';
|
19918 | var genericType = parsedText[3] ? parseGenericTypes(parsedText[3].trim()) : '';
|
19919 | var fieldName = parsedText[4] ? parsedText[4].trim() : '';
|
19920 | var classifier = parsedText[5] ? parsedText[5].trim() : '';
|
19921 | displayText = visibility + fieldType + genericType + ' ' + fieldName;
|
19922 | cssStyle = parseClassifier(classifier);
|
19923 | } catch (err) {
|
19924 | displayText = parsedText;
|
19925 | }
|
19926 |
|
19927 | return {
|
19928 | displayText: displayText,
|
19929 | cssStyle: cssStyle
|
19930 | };
|
19931 | };
|
19932 |
|
19933 | var buildMethodDisplay = function buildMethodDisplay(parsedText) {
|
19934 | var cssStyle = '';
|
19935 | var displayText = '';
|
19936 |
|
19937 | try {
|
19938 | var visibility = parsedText[1] ? parsedText[1].trim() : '';
|
19939 | var methodName = parsedText[2] ? parsedText[2].trim() : '';
|
19940 | var parameters = parsedText[3] ? parseGenericTypes(parsedText[3].trim()) : '';
|
19941 | var classifier = parsedText[4] ? parsedText[4].trim() : '';
|
19942 | var returnType = parsedText[5] ? ' : ' + parseGenericTypes(parsedText[5]).trim() : '';
|
19943 | displayText = visibility + methodName + '(' + parameters + ')' + returnType;
|
19944 | cssStyle = parseClassifier(classifier);
|
19945 | } catch (err) {
|
19946 | displayText = parsedText;
|
19947 | }
|
19948 |
|
19949 | return {
|
19950 | displayText: displayText,
|
19951 | cssStyle: cssStyle
|
19952 | };
|
19953 | };
|
19954 |
|
19955 | var buildLegacyDisplay = function buildLegacyDisplay(text) {
|
19956 | // if for some reason we dont have any match, use old format to parse text
|
19957 | var displayText = '';
|
19958 | var cssStyle = '';
|
19959 | var memberText = '';
|
19960 | var returnType = '';
|
19961 | var methodStart = text.indexOf('(');
|
19962 | var methodEnd = text.indexOf(')');
|
19963 |
|
19964 | if (methodStart > 1 && methodEnd > methodStart && methodEnd <= text.length) {
|
19965 | var visibility = '';
|
19966 | var methodName = '';
|
19967 | var firstChar = text.substring(0, 1);
|
19968 |
|
19969 | if (firstChar.match(/\w/)) {
|
19970 | methodName = text.substring(0, methodStart).trim();
|
19971 | } else {
|
19972 | if (firstChar.match(/\+|-|~|#/)) {
|
19973 | visibility = firstChar;
|
19974 | }
|
19975 |
|
19976 | methodName = text.substring(1, methodStart).trim();
|
19977 | }
|
19978 |
|
19979 | var parameters = text.substring(methodStart + 1, methodEnd);
|
19980 | var classifier = text.substring(methodEnd + 1, 1);
|
19981 | cssStyle = parseClassifier(classifier);
|
19982 | displayText = visibility + methodName + '(' + parseGenericTypes(parameters.trim()) + ')';
|
19983 |
|
19984 | if (methodEnd < memberText.length) {
|
19985 | returnType = text.substring(methodEnd + 2).trim();
|
19986 |
|
19987 | if (returnType !== '') {
|
19988 | returnType = ' : ' + parseGenericTypes(returnType);
|
19989 | }
|
19990 | }
|
19991 | } else {
|
19992 | // finally - if all else fails, just send the text back as written (other than parsing for generic types)
|
19993 | displayText = parseGenericTypes(text);
|
19994 | }
|
19995 |
|
19996 | return {
|
19997 | displayText: displayText,
|
19998 | cssStyle: cssStyle
|
19999 | };
|
20000 | };
|
20001 | /**
|
20002 | * Adds a <tspan> for a member in a diagram
|
20003 | *
|
20004 | * @param {SVGElement} textEl The element to append to
|
20005 | * @param {string} txt The member
|
20006 | * @param {boolean} isFirst
|
20007 | * @param {{ padding: string; textHeight: string }} conf The configuration for the member
|
20008 | */
|
20009 |
|
20010 |
|
20011 | var addTspan = function addTspan(textEl, txt, isFirst, conf) {
|
20012 | var member = parseMember(txt);
|
20013 | var tSpan = textEl.append('tspan').attr('x', conf.padding).text(member.displayText);
|
20014 |
|
20015 | if (member.cssStyle !== '') {
|
20016 | tSpan.attr('style', member.cssStyle);
|
20017 | }
|
20018 |
|
20019 | if (!isFirst) {
|
20020 | tSpan.attr('dy', conf.textHeight);
|
20021 | }
|
20022 | };
|
20023 | /**
|
20024 | * Makes generics in typescript syntax
|
20025 | *
|
20026 | * @example <caption>Array of array of strings in typescript syntax</caption>
|
20027 | * // returns "Array<Array<string>>"
|
20028 | * parseGenericTypes('Array~Array~string~~');
|
20029 | *
|
20030 | * @param {string} text The text to convert
|
20031 | * @returns {string} The converted string
|
20032 | */
|
20033 |
|
20034 |
|
20035 | var parseGenericTypes = function parseGenericTypes(text) {
|
20036 | var cleanedText = text;
|
20037 |
|
20038 | if (text.indexOf('~') != -1) {
|
20039 | cleanedText = cleanedText.replace('~', '<');
|
20040 | cleanedText = cleanedText.replace('~', '>');
|
20041 | return parseGenericTypes(cleanedText);
|
20042 | } else {
|
20043 | return cleanedText;
|
20044 | }
|
20045 | };
|
20046 | /**
|
20047 | * Gives the styles for a classifier
|
20048 | *
|
20049 | * @param {'+' | '-' | '#' | '~' | '*' | '$'} classifier The classifier string
|
20050 | * @returns {string} Styling for the classifier
|
20051 | */
|
20052 |
|
20053 |
|
20054 | var parseClassifier = function parseClassifier(classifier) {
|
20055 | switch (classifier) {
|
20056 | case '*':
|
20057 | return 'font-style:italic;';
|
20058 |
|
20059 | case '$':
|
20060 | return 'text-decoration:underline;';
|
20061 |
|
20062 | default:
|
20063 | return '';
|
20064 | }
|
20065 | };
|
20066 |
|
20067 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
20068 | drawClass: drawClass,
|
20069 | drawEdge: drawEdge,
|
20070 | parseMember: parseMember
|
20071 | });
|
20072 |
|
20073 | /***/ }),
|
20074 |
|
20075 | /***/ "./src/diagrams/common/common.js":
|
20076 | /*!***************************************!*\
|
20077 | !*** ./src/diagrams/common/common.js ***!
|
20078 | \***************************************/
|
20079 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
20080 |
|
20081 | "use strict";
|
20082 | __webpack_require__.r(__webpack_exports__);
|
20083 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
20084 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
20085 | /* harmony export */ "evaluate": () => (/* binding */ evaluate),
|
20086 | /* harmony export */ "getRows": () => (/* binding */ getRows),
|
20087 | /* harmony export */ "hasBreaks": () => (/* binding */ hasBreaks),
|
20088 | /* harmony export */ "lineBreakRegex": () => (/* binding */ lineBreakRegex),
|
20089 | /* harmony export */ "removeEscapes": () => (/* binding */ removeEscapes),
|
20090 | /* harmony export */ "removeScript": () => (/* binding */ removeScript),
|
20091 | /* harmony export */ "sanitizeText": () => (/* binding */ sanitizeText),
|
20092 | /* harmony export */ "sanitizeTextOrArray": () => (/* binding */ sanitizeTextOrArray),
|
20093 | /* harmony export */ "splitBreaks": () => (/* binding */ splitBreaks)
|
20094 | /* harmony export */ });
|
20095 | /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dompurify */ "dompurify");
|
20096 | /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dompurify__WEBPACK_IMPORTED_MODULE_0__);
|
20097 |
|
20098 | /**
|
20099 | * Gets the number of lines in a string
|
20100 | *
|
20101 | * @param {string | undefined} s The string to check the lines for
|
20102 | * @returns {number} The number of lines in that string
|
20103 | */
|
20104 |
|
20105 | var getRows = function getRows(s) {
|
20106 | if (!s) return 1;
|
20107 | var str = breakToPlaceholder(s);
|
20108 | str = str.replace(/\\n/g, '#br#');
|
20109 | return str.split('#br#');
|
20110 | };
|
20111 | var removeEscapes = function removeEscapes(text) {
|
20112 | var newStr = text.replace(/\\u[\dA-F]{4}/gi, function (match) {
|
20113 | return String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16));
|
20114 | });
|
20115 | newStr = newStr.replace(/\\x([0-9a-f]{2})/gi, function (_, c) {
|
20116 | return String.fromCharCode(parseInt(c, 16));
|
20117 | });
|
20118 | newStr = newStr.replace(/\\[\d\d\d]{3}/gi, function (match) {
|
20119 | return String.fromCharCode(parseInt(match.replace(/\\/g, ''), 8));
|
20120 | });
|
20121 | newStr = newStr.replace(/\\[\d\d\d]{2}/gi, function (match) {
|
20122 | return String.fromCharCode(parseInt(match.replace(/\\/g, ''), 8));
|
20123 | });
|
20124 | return newStr;
|
20125 | };
|
20126 | /**
|
20127 | * Removes script tags from a text
|
20128 | *
|
20129 | * @param {string} txt The text to sanitize
|
20130 | * @returns {string} The safer text
|
20131 | */
|
20132 |
|
20133 | var removeScript = function removeScript(txt) {
|
20134 | var rs = '';
|
20135 | var idx = 0;
|
20136 |
|
20137 | while (idx >= 0) {
|
20138 | idx = txt.indexOf('<script');
|
20139 |
|
20140 | if (idx >= 0) {
|
20141 | rs += txt.substr(0, idx);
|
20142 | txt = txt.substr(idx + 1);
|
20143 | idx = txt.indexOf('</script>');
|
20144 |
|
20145 | if (idx >= 0) {
|
20146 | idx += 9;
|
20147 | txt = txt.substr(idx);
|
20148 | }
|
20149 | } else {
|
20150 | rs += txt;
|
20151 | idx = -1;
|
20152 | break;
|
20153 | }
|
20154 | }
|
20155 |
|
20156 | var decodedText = removeEscapes(rs);
|
20157 | decodedText = decodedText.replaceAll(/script>/gi, '#');
|
20158 | decodedText = decodedText.replaceAll(/javascript:/gi, '#');
|
20159 | decodedText = decodedText.replaceAll(/javascript&colon/gi, '#');
|
20160 | decodedText = decodedText.replaceAll(/onerror=/gi, 'onerror:');
|
20161 | decodedText = decodedText.replaceAll(/<iframe/gi, '');
|
20162 | return decodedText;
|
20163 | };
|
20164 |
|
20165 | var sanitizeMore = function sanitizeMore(text, config) {
|
20166 | var txt = text;
|
20167 | var htmlLabels = true;
|
20168 |
|
20169 | if (config.flowchart && (config.flowchart.htmlLabels === false || config.flowchart.htmlLabels === 'false')) {
|
20170 | htmlLabels = false;
|
20171 | }
|
20172 |
|
20173 | if (htmlLabels) {
|
20174 | var level = config.securityLevel;
|
20175 |
|
20176 | if (level === 'antiscript' || level === 'strict') {
|
20177 | txt = removeScript(txt);
|
20178 | } else if (level !== 'loose') {
|
20179 | // eslint-disable-line
|
20180 | txt = breakToPlaceholder(txt);
|
20181 | txt = txt.replace(/</g, '<').replace(/>/g, '>');
|
20182 | txt = txt.replace(/=/g, '=');
|
20183 | txt = placeholderToBreak(txt);
|
20184 | }
|
20185 | }
|
20186 |
|
20187 | return txt;
|
20188 | };
|
20189 |
|
20190 | var sanitizeText = function sanitizeText(text, config) {
|
20191 | if (!text) return text;
|
20192 | var txt = '';
|
20193 |
|
20194 | if (config['dompurifyConfig']) {
|
20195 | txt = dompurify__WEBPACK_IMPORTED_MODULE_0___default().sanitize(sanitizeMore(text, config), config['dompurifyConfig']);
|
20196 | } else {
|
20197 | txt = dompurify__WEBPACK_IMPORTED_MODULE_0___default().sanitize(sanitizeMore(text, config));
|
20198 | }
|
20199 |
|
20200 | return txt;
|
20201 | };
|
20202 | var sanitizeTextOrArray = function sanitizeTextOrArray(a, config) {
|
20203 | if (typeof a === 'string') return sanitizeText(a, config);
|
20204 |
|
20205 | var f = function f(x) {
|
20206 | return sanitizeText(x, config);
|
20207 | };
|
20208 |
|
20209 | return a.flat().map(f);
|
20210 | };
|
20211 | var lineBreakRegex = /<br\s*\/?>/gi;
|
20212 | /**
|
20213 | * Whether or not a text has any linebreaks
|
20214 | *
|
20215 | * @param {string} text The text to test
|
20216 | * @returns {boolean} Whether or not the text has breaks
|
20217 | */
|
20218 |
|
20219 | var hasBreaks = function hasBreaks(text) {
|
20220 | return lineBreakRegex.test(text);
|
20221 | };
|
20222 | /**
|
20223 | * Splits on <br> tags
|
20224 | *
|
20225 | * @param {string} text Text to split
|
20226 | * @returns {string[]} List of lines as strings
|
20227 | */
|
20228 |
|
20229 | var splitBreaks = function splitBreaks(text) {
|
20230 | return text.split(lineBreakRegex);
|
20231 | };
|
20232 | /**
|
20233 | * Converts placeholders to linebreaks in HTML
|
20234 | *
|
20235 | * @param {string} s HTML with placeholders
|
20236 | * @returns {string} HTML with breaks instead of placeholders
|
20237 | */
|
20238 |
|
20239 | var placeholderToBreak = function placeholderToBreak(s) {
|
20240 | return s.replace(/#br#/g, '<br/>');
|
20241 | };
|
20242 | /**
|
20243 | * Opposite of `placeholderToBreak`, converts breaks to placeholders
|
20244 | *
|
20245 | * @param {string} s HTML string
|
20246 | * @returns {string} String with placeholders
|
20247 | */
|
20248 |
|
20249 |
|
20250 | var breakToPlaceholder = function breakToPlaceholder(s) {
|
20251 | return s.replace(lineBreakRegex, '#br#');
|
20252 | };
|
20253 | /**
|
20254 | * Gets the current URL
|
20255 | *
|
20256 | * @param {boolean} useAbsolute Whether to return the absolute URL or not
|
20257 | * @returns {string} The current URL
|
20258 | */
|
20259 |
|
20260 |
|
20261 | var getUrl = function getUrl(useAbsolute) {
|
20262 | var url = '';
|
20263 |
|
20264 | if (useAbsolute) {
|
20265 | url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
|
20266 | url = url.replace(/\(/g, '\\(');
|
20267 | url = url.replace(/\)/g, '\\)');
|
20268 | }
|
20269 |
|
20270 | return url;
|
20271 | };
|
20272 | /**
|
20273 | * Converts a string/boolean into a boolean
|
20274 | *
|
20275 | * @param {string | boolean} val String or boolean to convert
|
20276 | * @returns {boolean} The result from the input
|
20277 | */
|
20278 |
|
20279 |
|
20280 | var evaluate = function evaluate(val) {
|
20281 | return val === 'false' || val === false ? false : true;
|
20282 | };
|
20283 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
20284 | getRows: getRows,
|
20285 | sanitizeText: sanitizeText,
|
20286 | sanitizeTextOrArray: sanitizeTextOrArray,
|
20287 | hasBreaks: hasBreaks,
|
20288 | splitBreaks: splitBreaks,
|
20289 | lineBreakRegex: lineBreakRegex,
|
20290 | removeScript: removeScript,
|
20291 | getUrl: getUrl,
|
20292 | evaluate: evaluate,
|
20293 | removeEscapes: removeEscapes
|
20294 | });
|
20295 |
|
20296 | /***/ }),
|
20297 |
|
20298 | /***/ "./src/diagrams/er/erDb.js":
|
20299 | /*!*********************************!*\
|
20300 | !*** ./src/diagrams/er/erDb.js ***!
|
20301 | \*********************************/
|
20302 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
20303 |
|
20304 | "use strict";
|
20305 | __webpack_require__.r(__webpack_exports__);
|
20306 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
20307 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
20308 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective)
|
20309 | /* harmony export */ });
|
20310 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
20311 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
20312 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
20313 | /* harmony import */ var _commonDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../commonDb */ "./src/commonDb.js");
|
20314 |
|
20315 |
|
20316 |
|
20317 |
|
20318 |
|
20319 | var entities = {};
|
20320 | var relationships = [];
|
20321 | var title = '';
|
20322 | var description = '';
|
20323 | var Cardinality = {
|
20324 | ZERO_OR_ONE: 'ZERO_OR_ONE',
|
20325 | ZERO_OR_MORE: 'ZERO_OR_MORE',
|
20326 | ONE_OR_MORE: 'ONE_OR_MORE',
|
20327 | ONLY_ONE: 'ONLY_ONE'
|
20328 | };
|
20329 | var Identification = {
|
20330 | NON_IDENTIFYING: 'NON_IDENTIFYING',
|
20331 | IDENTIFYING: 'IDENTIFYING'
|
20332 | };
|
20333 | var parseDirective = function parseDirective(statement, context, type) {
|
20334 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
|
20335 | };
|
20336 |
|
20337 | var addEntity = function addEntity(name) {
|
20338 | if (typeof entities[name] === 'undefined') {
|
20339 | entities[name] = {
|
20340 | attributes: []
|
20341 | };
|
20342 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Added new entity :', name);
|
20343 | }
|
20344 |
|
20345 | return entities[name];
|
20346 | };
|
20347 |
|
20348 | var getEntities = function getEntities() {
|
20349 | return entities;
|
20350 | };
|
20351 |
|
20352 | var addAttributes = function addAttributes(entityName, attribs) {
|
20353 | var entity = addEntity(entityName); // May do nothing (if entity has already been added)
|
20354 | // Process attribs in reverse order due to effect of recursive construction (last attribute is first)
|
20355 |
|
20356 | var i;
|
20357 |
|
20358 | for (i = attribs.length - 1; i >= 0; i--) {
|
20359 | entity.attributes.push(attribs[i]);
|
20360 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Added attribute ', attribs[i].attributeName);
|
20361 | }
|
20362 | };
|
20363 | /**
|
20364 | * Add a relationship
|
20365 | *
|
20366 | * @param entA The first entity in the relationship
|
20367 | * @param rolA The role played by the first entity in relation to the second
|
20368 | * @param entB The second entity in the relationship
|
20369 | * @param rSpec The details of the relationship between the two entities
|
20370 | */
|
20371 |
|
20372 |
|
20373 | var addRelationship = function addRelationship(entA, rolA, entB, rSpec) {
|
20374 | var rel = {
|
20375 | entityA: entA,
|
20376 | roleA: rolA,
|
20377 | entityB: entB,
|
20378 | relSpec: rSpec
|
20379 | };
|
20380 | relationships.push(rel);
|
20381 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Added new relationship :', rel);
|
20382 | };
|
20383 |
|
20384 | var getRelationships = function getRelationships() {
|
20385 | return relationships;
|
20386 | };
|
20387 |
|
20388 | var clear = function clear() {
|
20389 | entities = {};
|
20390 | relationships = [];
|
20391 | title = '';
|
20392 | (0,_commonDb__WEBPACK_IMPORTED_MODULE_2__.clear)();
|
20393 | };
|
20394 |
|
20395 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
20396 | Cardinality: Cardinality,
|
20397 | Identification: Identification,
|
20398 | parseDirective: parseDirective,
|
20399 | getConfig: function getConfig() {
|
20400 | return _config__WEBPACK_IMPORTED_MODULE_3__.getConfig().er;
|
20401 | },
|
20402 | addEntity: addEntity,
|
20403 | addAttributes: addAttributes,
|
20404 | getEntities: getEntities,
|
20405 | addRelationship: addRelationship,
|
20406 | getRelationships: getRelationships,
|
20407 | clear: clear,
|
20408 | setAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_2__.setAccTitle,
|
20409 | getAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_2__.getAccTitle,
|
20410 | setAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_2__.setAccDescription,
|
20411 | getAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_2__.getAccDescription
|
20412 | });
|
20413 |
|
20414 | /***/ }),
|
20415 |
|
20416 | /***/ "./src/diagrams/er/erMarkers.js":
|
20417 | /*!**************************************!*\
|
20418 | !*** ./src/diagrams/er/erMarkers.js ***!
|
20419 | \**************************************/
|
20420 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
20421 |
|
20422 | "use strict";
|
20423 | __webpack_require__.r(__webpack_exports__);
|
20424 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
20425 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
20426 | /* harmony export */ });
|
20427 | var ERMarkers = {
|
20428 | ONLY_ONE_START: 'ONLY_ONE_START',
|
20429 | ONLY_ONE_END: 'ONLY_ONE_END',
|
20430 | ZERO_OR_ONE_START: 'ZERO_OR_ONE_START',
|
20431 | ZERO_OR_ONE_END: 'ZERO_OR_ONE_END',
|
20432 | ONE_OR_MORE_START: 'ONE_OR_MORE_START',
|
20433 | ONE_OR_MORE_END: 'ONE_OR_MORE_END',
|
20434 | ZERO_OR_MORE_START: 'ZERO_OR_MORE_START',
|
20435 | ZERO_OR_MORE_END: 'ZERO_OR_MORE_END'
|
20436 | };
|
20437 | /**
|
20438 | * Put the markers into the svg DOM for later use with edge paths
|
20439 | *
|
20440 | * @param elem
|
20441 | * @param conf
|
20442 | */
|
20443 |
|
20444 | var insertMarkers = function insertMarkers(elem, conf) {
|
20445 | var marker;
|
20446 | elem.append('defs').append('marker').attr('id', ERMarkers.ONLY_ONE_START).attr('refX', 0).attr('refY', 9).attr('markerWidth', 18).attr('markerHeight', 18).attr('orient', 'auto').append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M9,0 L9,18 M15,0 L15,18');
|
20447 | elem.append('defs').append('marker').attr('id', ERMarkers.ONLY_ONE_END).attr('refX', 18).attr('refY', 9).attr('markerWidth', 18).attr('markerHeight', 18).attr('orient', 'auto').append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M3,0 L3,18 M9,0 L9,18');
|
20448 | marker = elem.append('defs').append('marker').attr('id', ERMarkers.ZERO_OR_ONE_START).attr('refX', 0).attr('refY', 9).attr('markerWidth', 30).attr('markerHeight', 18).attr('orient', 'auto');
|
20449 | marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 21).attr('cy', 9).attr('r', 6);
|
20450 | marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M9,0 L9,18');
|
20451 | marker = elem.append('defs').append('marker').attr('id', ERMarkers.ZERO_OR_ONE_END).attr('refX', 30).attr('refY', 9).attr('markerWidth', 30).attr('markerHeight', 18).attr('orient', 'auto');
|
20452 | marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 9).attr('cy', 9).attr('r', 6);
|
20453 | marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M21,0 L21,18');
|
20454 | elem.append('defs').append('marker').attr('id', ERMarkers.ONE_OR_MORE_START).attr('refX', 18).attr('refY', 18).attr('markerWidth', 45).attr('markerHeight', 36).attr('orient', 'auto').append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27');
|
20455 | elem.append('defs').append('marker').attr('id', ERMarkers.ONE_OR_MORE_END).attr('refX', 27).attr('refY', 18).attr('markerWidth', 45).attr('markerHeight', 36).attr('orient', 'auto').append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18');
|
20456 | marker = elem.append('defs').append('marker').attr('id', ERMarkers.ZERO_OR_MORE_START).attr('refX', 18).attr('refY', 18).attr('markerWidth', 57).attr('markerHeight', 36).attr('orient', 'auto');
|
20457 | marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 48).attr('cy', 18).attr('r', 6);
|
20458 | marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M0,18 Q18,0 36,18 Q18,36 0,18');
|
20459 | marker = elem.append('defs').append('marker').attr('id', ERMarkers.ZERO_OR_MORE_END).attr('refX', 39).attr('refY', 18).attr('markerWidth', 57).attr('markerHeight', 36).attr('orient', 'auto');
|
20460 | marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 9).attr('cy', 18).attr('r', 6);
|
20461 | marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M21,18 Q39,0 57,18 Q39,36 21,18');
|
20462 | return;
|
20463 | };
|
20464 |
|
20465 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
20466 | ERMarkers: ERMarkers,
|
20467 | insertMarkers: insertMarkers
|
20468 | });
|
20469 |
|
20470 | /***/ }),
|
20471 |
|
20472 | /***/ "./src/diagrams/er/erRenderer.js":
|
20473 | /*!***************************************!*\
|
20474 | !*** ./src/diagrams/er/erRenderer.js ***!
|
20475 | \***************************************/
|
20476 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
20477 |
|
20478 | "use strict";
|
20479 | __webpack_require__.r(__webpack_exports__);
|
20480 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
20481 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
20482 | /* harmony export */ "draw": () => (/* binding */ draw),
|
20483 | /* harmony export */ "setConf": () => (/* binding */ setConf)
|
20484 | /* harmony export */ });
|
20485 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
|
20486 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
|
20487 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
|
20488 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
|
20489 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dagre */ "dagre");
|
20490 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_2__);
|
20491 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
20492 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
20493 | /* harmony import */ var _erMarkers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./erMarkers */ "./src/diagrams/er/erMarkers.js");
|
20494 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
20495 | /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js");
|
20496 |
|
20497 | // import erDb from './erDb';
|
20498 | // import erParser from './parser/erDiagram';
|
20499 |
|
20500 |
|
20501 |
|
20502 |
|
20503 |
|
20504 |
|
20505 |
|
20506 | var conf = {};
|
20507 | /**
|
20508 | * Allows the top-level API module to inject config specific to this renderer, storing it in the
|
20509 | * local conf object. Note that generic config still needs to be retrieved using getConfig()
|
20510 | * imported from the config module
|
20511 | *
|
20512 | * @param cnf
|
20513 | */
|
20514 |
|
20515 | var setConf = function setConf(cnf) {
|
20516 | var keys = Object.keys(cnf);
|
20517 |
|
20518 | for (var i = 0; i < keys.length; i++) {
|
20519 | conf[keys[i]] = cnf[keys[i]];
|
20520 | }
|
20521 | };
|
20522 | /**
|
20523 | * Draw attributes for an entity
|
20524 | *
|
20525 | * @param groupNode The svg group node for the entity
|
20526 | * @param entityTextNode The svg node for the entity label text
|
20527 | * @param attributes An array of attributes defined for the entity (each attribute has a type and a name)
|
20528 | * @returns The bounding box of the entity, after attributes have been added
|
20529 | */
|
20530 |
|
20531 | var drawAttributes = function drawAttributes(groupNode, entityTextNode, attributes) {
|
20532 | var heightPadding = conf.entityPadding / 3; // Padding internal to attribute boxes
|
20533 |
|
20534 | var widthPadding = conf.entityPadding / 3; // Ditto
|
20535 |
|
20536 | var attrFontSize = conf.fontSize * 0.85;
|
20537 | var labelBBox = entityTextNode.node().getBBox();
|
20538 | var attributeNodes = []; // Intermediate storage for attribute nodes created so that we can do a second pass
|
20539 |
|
20540 | var hasKeyType = false;
|
20541 | var hasComment = false;
|
20542 | var maxTypeWidth = 0;
|
20543 | var maxNameWidth = 0;
|
20544 | var maxKeyWidth = 0;
|
20545 | var maxCommentWidth = 0;
|
20546 | var cumulativeHeight = labelBBox.height + heightPadding * 2;
|
20547 | var attrNum = 1; // Check to see if any of the attributes has a key or a comment
|
20548 |
|
20549 | attributes.forEach(function (item) {
|
20550 | if (item.attributeKeyType !== undefined) {
|
20551 | hasKeyType = true;
|
20552 | }
|
20553 |
|
20554 | if (item.attributeComment !== undefined) {
|
20555 | hasComment = true;
|
20556 | }
|
20557 | });
|
20558 | attributes.forEach(function (item) {
|
20559 | var attrPrefix = "".concat(entityTextNode.node().id, "-attr-").concat(attrNum);
|
20560 | var nodeHeight = 0; // Add a text node for the attribute type
|
20561 |
|
20562 | var typeNode = groupNode.append('text').attr('class', 'er entityLabel').attr('id', "".concat(attrPrefix, "-type")).attr('x', 0).attr('y', 0).attr('dominant-baseline', 'middle').attr('text-anchor', 'left').attr('style', 'font-family: ' + (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().fontFamily + '; font-size: ' + attrFontSize + 'px').text(item.attributeType); // Add a text node for the attribute name
|
20563 |
|
20564 | var nameNode = groupNode.append('text').attr('class', 'er entityLabel').attr('id', "".concat(attrPrefix, "-name")).attr('x', 0).attr('y', 0).attr('dominant-baseline', 'middle').attr('text-anchor', 'left').attr('style', 'font-family: ' + (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().fontFamily + '; font-size: ' + attrFontSize + 'px').text(item.attributeName);
|
20565 | var attributeNode = {};
|
20566 | attributeNode.tn = typeNode;
|
20567 | attributeNode.nn = nameNode;
|
20568 | var typeBBox = typeNode.node().getBBox();
|
20569 | var nameBBox = nameNode.node().getBBox();
|
20570 | maxTypeWidth = Math.max(maxTypeWidth, typeBBox.width);
|
20571 | maxNameWidth = Math.max(maxNameWidth, nameBBox.width);
|
20572 | nodeHeight = Math.max(typeBBox.height, nameBBox.height);
|
20573 |
|
20574 | if (hasKeyType) {
|
20575 | var keyTypeNode = groupNode.append('text').attr('class', 'er entityLabel').attr('id', "".concat(attrPrefix, "-key")).attr('x', 0).attr('y', 0).attr('dominant-baseline', 'middle').attr('text-anchor', 'left').attr('style', 'font-family: ' + (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().fontFamily + '; font-size: ' + attrFontSize + 'px').text(item.attributeKeyType || '');
|
20576 | attributeNode.kn = keyTypeNode;
|
20577 | var keyTypeBBox = keyTypeNode.node().getBBox();
|
20578 | maxKeyWidth = Math.max(maxKeyWidth, keyTypeBBox.width);
|
20579 | nodeHeight = Math.max(nodeHeight, keyTypeBBox.height);
|
20580 | }
|
20581 |
|
20582 | if (hasComment) {
|
20583 | var commentNode = groupNode.append('text').attr('class', 'er entityLabel').attr('id', "".concat(attrPrefix, "-comment")).attr('x', 0).attr('y', 0).attr('dominant-baseline', 'middle').attr('text-anchor', 'left').attr('style', 'font-family: ' + (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().fontFamily + '; font-size: ' + attrFontSize + 'px').text(item.attributeComment || '');
|
20584 | attributeNode.cn = commentNode;
|
20585 | var commentNodeBBox = commentNode.node().getBBox();
|
20586 | maxCommentWidth = Math.max(maxCommentWidth, commentNodeBBox.width);
|
20587 | nodeHeight = Math.max(nodeHeight, commentNodeBBox.height);
|
20588 | }
|
20589 |
|
20590 | attributeNode.height = nodeHeight; // Keep a reference to the nodes so that we can iterate through them later
|
20591 |
|
20592 | attributeNodes.push(attributeNode);
|
20593 | cumulativeHeight += nodeHeight + heightPadding * 2;
|
20594 | attrNum += 1;
|
20595 | });
|
20596 | var widthPaddingFactor = 4;
|
20597 |
|
20598 | if (hasKeyType) {
|
20599 | widthPaddingFactor += 2;
|
20600 | }
|
20601 |
|
20602 | if (hasComment) {
|
20603 | widthPaddingFactor += 2;
|
20604 | }
|
20605 |
|
20606 | var maxWidth = maxTypeWidth + maxNameWidth + maxKeyWidth + maxCommentWidth; // Calculate the new bounding box of the overall entity, now that attributes have been added
|
20607 |
|
20608 | var bBox = {
|
20609 | width: Math.max(conf.minEntityWidth, Math.max(labelBBox.width + conf.entityPadding * 2, maxWidth + widthPadding * widthPaddingFactor)),
|
20610 | height: attributes.length > 0 ? cumulativeHeight : Math.max(conf.minEntityHeight, labelBBox.height + conf.entityPadding * 2)
|
20611 | };
|
20612 |
|
20613 | if (attributes.length > 0) {
|
20614 | // There might be some spare width for padding out attributes if the entity name is very long
|
20615 | var spareColumnWidth = Math.max(0, (bBox.width - maxWidth - widthPadding * widthPaddingFactor) / (widthPaddingFactor / 2)); // Position the entity label near the top of the entity bounding box
|
20616 |
|
20617 | entityTextNode.attr('transform', 'translate(' + bBox.width / 2 + ',' + (heightPadding + labelBBox.height / 2) + ')'); // Add rectangular boxes for the attribute types/names
|
20618 |
|
20619 | var heightOffset = labelBBox.height + heightPadding * 2; // Start at the bottom of the entity label
|
20620 |
|
20621 | var attribStyle = 'attributeBoxOdd'; // We will flip the style on alternate rows to achieve a banded effect
|
20622 |
|
20623 | attributeNodes.forEach(function (attributeNode) {
|
20624 | // Calculate the alignment y co-ordinate for the type/name of the attribute
|
20625 | var alignY = heightOffset + heightPadding + attributeNode.height / 2; // Position the type attribute
|
20626 |
|
20627 | attributeNode.tn.attr('transform', 'translate(' + widthPadding + ',' + alignY + ')'); // TODO Handle spareWidth in attr('width')
|
20628 | // Insert a rectangle for the type
|
20629 |
|
20630 | var typeRect = groupNode.insert('rect', '#' + attributeNode.tn.node().id).attr('class', "er ".concat(attribStyle)).attr('fill', conf.fill).attr('fill-opacity', '100%').attr('stroke', conf.stroke).attr('x', 0).attr('y', heightOffset).attr('width', maxTypeWidth + widthPadding * 2 + spareColumnWidth).attr('height', attributeNode.height + heightPadding * 2);
|
20631 | var nameXOffset = parseFloat(typeRect.attr('x')) + parseFloat(typeRect.attr('width')); // Position the name attribute
|
20632 |
|
20633 | attributeNode.nn.attr('transform', 'translate(' + (nameXOffset + widthPadding) + ',' + alignY + ')'); // Insert a rectangle for the name
|
20634 |
|
20635 | var nameRect = groupNode.insert('rect', '#' + attributeNode.nn.node().id).attr('class', "er ".concat(attribStyle)).attr('fill', conf.fill).attr('fill-opacity', '100%').attr('stroke', conf.stroke).attr('x', nameXOffset).attr('y', heightOffset).attr('width', maxNameWidth + widthPadding * 2 + spareColumnWidth).attr('height', attributeNode.height + heightPadding * 2);
|
20636 | var keyTypeAndCommentXOffset = parseFloat(nameRect.attr('x')) + parseFloat(nameRect.attr('width'));
|
20637 |
|
20638 | if (hasKeyType) {
|
20639 | // Position the key type attribute
|
20640 | attributeNode.kn.attr('transform', 'translate(' + (keyTypeAndCommentXOffset + widthPadding) + ',' + alignY + ')'); // Insert a rectangle for the key type
|
20641 |
|
20642 | var keyTypeRect = groupNode.insert('rect', '#' + attributeNode.kn.node().id).attr('class', "er ".concat(attribStyle)).attr('fill', conf.fill).attr('fill-opacity', '100%').attr('stroke', conf.stroke).attr('x', keyTypeAndCommentXOffset).attr('y', heightOffset).attr('width', maxKeyWidth + widthPadding * 2 + spareColumnWidth).attr('height', attributeNode.height + heightPadding * 2);
|
20643 | keyTypeAndCommentXOffset = parseFloat(keyTypeRect.attr('x')) + parseFloat(keyTypeRect.attr('width'));
|
20644 | }
|
20645 |
|
20646 | if (hasComment) {
|
20647 | // Position the comment attribute
|
20648 | attributeNode.cn.attr('transform', 'translate(' + (keyTypeAndCommentXOffset + widthPadding) + ',' + alignY + ')'); // Insert a rectangle for the comment
|
20649 |
|
20650 | groupNode.insert('rect', '#' + attributeNode.cn.node().id).attr('class', "er ".concat(attribStyle)).attr('fill', conf.fill).attr('fill-opacity', '100%').attr('stroke', conf.stroke).attr('x', keyTypeAndCommentXOffset).attr('y', heightOffset).attr('width', maxCommentWidth + widthPadding * 2 + spareColumnWidth).attr('height', attributeNode.height + heightPadding * 2);
|
20651 | } // Increment the height offset to move to the next row
|
20652 |
|
20653 |
|
20654 | heightOffset += attributeNode.height + heightPadding * 2; // Flip the attribute style for row banding
|
20655 |
|
20656 | attribStyle = attribStyle == 'attributeBoxOdd' ? 'attributeBoxEven' : 'attributeBoxOdd';
|
20657 | });
|
20658 | } else {
|
20659 | // Ensure the entity box is a decent size without any attributes
|
20660 | bBox.height = Math.max(conf.minEntityHeight, cumulativeHeight); // Position the entity label in the middle of the box
|
20661 |
|
20662 | entityTextNode.attr('transform', 'translate(' + bBox.width / 2 + ',' + bBox.height / 2 + ')');
|
20663 | }
|
20664 |
|
20665 | return bBox;
|
20666 | };
|
20667 | /**
|
20668 | * Use D3 to construct the svg elements for the entities
|
20669 | *
|
20670 | * @param svgNode The svg node that contains the diagram
|
20671 | * @param entities The entities to be drawn
|
20672 | * @param graph The graph that contains the vertex and edge definitions post-layout
|
20673 | * @returns The first entity that was inserted
|
20674 | */
|
20675 |
|
20676 |
|
20677 | var drawEntities = function drawEntities(svgNode, entities, graph) {
|
20678 | var keys = Object.keys(entities);
|
20679 | var firstOne;
|
20680 | keys.forEach(function (id) {
|
20681 | // Create a group for each entity
|
20682 | var groupNode = svgNode.append('g').attr('id', id);
|
20683 | firstOne = firstOne === undefined ? id : firstOne; // Label the entity - this is done first so that we can get the bounding box
|
20684 | // which then determines the size of the rectangle
|
20685 |
|
20686 | var textId = 'entity-' + id;
|
20687 | var textNode = groupNode.append('text').attr('class', 'er entityLabel').attr('id', textId).attr('x', 0).attr('y', 0).attr('dominant-baseline', 'middle').attr('text-anchor', 'middle').attr('style', 'font-family: ' + (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().fontFamily + '; font-size: ' + conf.fontSize + 'px').text(id);
|
20688 |
|
20689 | var _drawAttributes = drawAttributes(groupNode, textNode, entities[id].attributes),
|
20690 | entityWidth = _drawAttributes.width,
|
20691 | entityHeight = _drawAttributes.height; // Draw the rectangle - insert it before the text so that the text is not obscured
|
20692 |
|
20693 |
|
20694 | var rectNode = groupNode.insert('rect', '#' + textId).attr('class', 'er entityBox').attr('fill', conf.fill).attr('fill-opacity', '100%').attr('stroke', conf.stroke).attr('x', 0).attr('y', 0).attr('width', entityWidth).attr('height', entityHeight);
|
20695 | var rectBBox = rectNode.node().getBBox(); // Add the entity to the graph
|
20696 |
|
20697 | graph.setNode(id, {
|
20698 | width: rectBBox.width,
|
20699 | height: rectBBox.height,
|
20700 | shape: 'rect',
|
20701 | id: id
|
20702 | });
|
20703 | });
|
20704 | return firstOne;
|
20705 | }; // drawEntities
|
20706 |
|
20707 |
|
20708 | var adjustEntities = function adjustEntities(svgNode, graph) {
|
20709 | graph.nodes().forEach(function (v) {
|
20710 | if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
|
20711 | svgNode.select('#' + v).attr('transform', 'translate(' + (graph.node(v).x - graph.node(v).width / 2) + ',' + (graph.node(v).y - graph.node(v).height / 2) + ' )');
|
20712 | }
|
20713 | });
|
20714 | return;
|
20715 | };
|
20716 |
|
20717 | var getEdgeName = function getEdgeName(rel) {
|
20718 | return (rel.entityA + rel.roleA + rel.entityB).replace(/\s/g, '');
|
20719 | };
|
20720 | /**
|
20721 | * Add each relationship to the graph
|
20722 | *
|
20723 | * @param relationships The relationships to be added
|
20724 | * @param g The graph
|
20725 | * @returns {Array} The array of relationships
|
20726 | */
|
20727 |
|
20728 |
|
20729 | var addRelationships = function addRelationships(relationships, g) {
|
20730 | relationships.forEach(function (r) {
|
20731 | g.setEdge(r.entityA, r.entityB, {
|
20732 | relationship: r
|
20733 | }, getEdgeName(r));
|
20734 | });
|
20735 | return relationships;
|
20736 | }; // addRelationships
|
20737 |
|
20738 |
|
20739 | var relCnt = 0;
|
20740 | /**
|
20741 | * Draw a relationship using edge information from the graph
|
20742 | *
|
20743 | * @param svg The svg node
|
20744 | * @param rel The relationship to draw in the svg
|
20745 | * @param g The graph containing the edge information
|
20746 | * @param insert The insertion point in the svg DOM (because relationships have markers that need to
|
20747 | * sit 'behind' opaque entity boxes)
|
20748 | * @param diagObj
|
20749 | */
|
20750 |
|
20751 | var drawRelationshipFromLayout = function drawRelationshipFromLayout(svg, rel, g, insert, diagObj) {
|
20752 | relCnt++; // Find the edge relating to this relationship
|
20753 |
|
20754 | var edge = g.edge(rel.entityA, rel.entityB, getEdgeName(rel)); // Get a function that will generate the line path
|
20755 |
|
20756 | var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_1__.line)().x(function (d) {
|
20757 | return d.x;
|
20758 | }).y(function (d) {
|
20759 | return d.y;
|
20760 | }).curve(d3__WEBPACK_IMPORTED_MODULE_1__.curveBasis); // Insert the line at the right place
|
20761 |
|
20762 | var svgPath = svg.insert('path', '#' + insert).attr('class', 'er relationshipLine').attr('d', lineFunction(edge.points)).attr('stroke', conf.stroke).attr('fill', 'none'); // ...and with dashes if necessary
|
20763 |
|
20764 | if (rel.relSpec.relType === diagObj.db.Identification.NON_IDENTIFYING) {
|
20765 | svgPath.attr('stroke-dasharray', '8,8');
|
20766 | } // TODO: Understand this better
|
20767 |
|
20768 |
|
20769 | var url = '';
|
20770 |
|
20771 | if (conf.arrowMarkerAbsolute) {
|
20772 | url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
|
20773 | url = url.replace(/\(/g, '\\(');
|
20774 | url = url.replace(/\)/g, '\\)');
|
20775 | } // Decide which start and end markers it needs. It may be possible to be more concise here
|
20776 | // by reversing a start marker to make an end marker...but this will do for now
|
20777 | // Note that the 'A' entity's marker is at the end of the relationship and the 'B' entity's marker is at the start
|
20778 |
|
20779 |
|
20780 | switch (rel.relSpec.cardA) {
|
20781 | case diagObj.db.Cardinality.ZERO_OR_ONE:
|
20782 | svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_4__["default"].ERMarkers.ZERO_OR_ONE_END + ')');
|
20783 | break;
|
20784 |
|
20785 | case diagObj.db.Cardinality.ZERO_OR_MORE:
|
20786 | svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_4__["default"].ERMarkers.ZERO_OR_MORE_END + ')');
|
20787 | break;
|
20788 |
|
20789 | case diagObj.db.Cardinality.ONE_OR_MORE:
|
20790 | svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_4__["default"].ERMarkers.ONE_OR_MORE_END + ')');
|
20791 | break;
|
20792 |
|
20793 | case diagObj.db.Cardinality.ONLY_ONE:
|
20794 | svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_4__["default"].ERMarkers.ONLY_ONE_END + ')');
|
20795 | break;
|
20796 | }
|
20797 |
|
20798 | switch (rel.relSpec.cardB) {
|
20799 | case diagObj.db.Cardinality.ZERO_OR_ONE:
|
20800 | svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_4__["default"].ERMarkers.ZERO_OR_ONE_START + ')');
|
20801 | break;
|
20802 |
|
20803 | case diagObj.db.Cardinality.ZERO_OR_MORE:
|
20804 | svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_4__["default"].ERMarkers.ZERO_OR_MORE_START + ')');
|
20805 | break;
|
20806 |
|
20807 | case diagObj.db.Cardinality.ONE_OR_MORE:
|
20808 | svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_4__["default"].ERMarkers.ONE_OR_MORE_START + ')');
|
20809 | break;
|
20810 |
|
20811 | case diagObj.db.Cardinality.ONLY_ONE:
|
20812 | svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_4__["default"].ERMarkers.ONLY_ONE_START + ')');
|
20813 | break;
|
20814 | } // Now label the relationship
|
20815 | // Find the half-way point
|
20816 |
|
20817 |
|
20818 | var len = svgPath.node().getTotalLength();
|
20819 | var labelPoint = svgPath.node().getPointAtLength(len * 0.5); // Append a text node containing the label
|
20820 |
|
20821 | var labelId = 'rel' + relCnt;
|
20822 | var labelNode = svg.append('text').attr('class', 'er relationshipLabel').attr('id', labelId).attr('x', labelPoint.x).attr('y', labelPoint.y).attr('text-anchor', 'middle').attr('dominant-baseline', 'middle').attr('style', 'font-family: ' + (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().fontFamily + '; font-size: ' + conf.fontSize + 'px').text(rel.roleA); // Figure out how big the opaque 'container' rectangle needs to be
|
20823 |
|
20824 | var labelBBox = labelNode.node().getBBox(); // Insert the opaque rectangle before the text label
|
20825 |
|
20826 | svg.insert('rect', '#' + labelId).attr('class', 'er relationshipLabelBox').attr('x', labelPoint.x - labelBBox.width / 2).attr('y', labelPoint.y - labelBBox.height / 2).attr('width', labelBBox.width).attr('height', labelBBox.height).attr('fill', 'white').attr('fill-opacity', '85%');
|
20827 | return;
|
20828 | };
|
20829 | /**
|
20830 | * Draw en E-R diagram in the tag with id: id based on the text definition of the diagram
|
20831 | *
|
20832 | * @param text The text of the diagram
|
20833 | * @param id The unique id of the DOM node that contains the diagram
|
20834 | * @param _version
|
20835 | * @param diag
|
20836 | * @param diagObj
|
20837 | */
|
20838 |
|
20839 |
|
20840 | var draw = function draw(text, id, _version, diagObj) {
|
20841 | conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().er;
|
20842 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Drawing ER diagram'); // diag.db.clear();
|
20843 |
|
20844 | var securityLevel = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().securityLevel; // Handle root and Document for when rendering in sanbox mode
|
20845 |
|
20846 | var sandboxElement;
|
20847 |
|
20848 | if (securityLevel === 'sandbox') {
|
20849 | sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#i' + id);
|
20850 | }
|
20851 |
|
20852 | var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('body'); // const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;
|
20853 | // Parse the text to populate erDb
|
20854 | // try {
|
20855 | // parser.parse(text);
|
20856 | // } catch (err) {
|
20857 | // log.debug('Parsing failed');
|
20858 | // }
|
20859 | // Get a reference to the svg node that contains the text
|
20860 |
|
20861 | var svg = root.select("[id='".concat(id, "']")); // Add cardinality marker definitions to the svg
|
20862 |
|
20863 | _erMarkers__WEBPACK_IMPORTED_MODULE_4__["default"].insertMarkers(svg, conf); // Now we have to construct the diagram in a specific way:
|
20864 | // ---
|
20865 | // 1. Create all the entities in the svg node at 0,0, but with the correct dimensions (allowing for text content)
|
20866 | // 2. Make sure they are all added to the graph
|
20867 | // 3. Add all the edges (relationships) to the graph as well
|
20868 | // 4. Let dagre do its magic to layout the graph. This assigns:
|
20869 | // - the centre co-ordinates for each node, bearing in mind the dimensions and edge relationships
|
20870 | // - the path co-ordinates for each edge
|
20871 | // But it has no impact on the svg child nodes - the diagram remains with every entity rooted at 0,0
|
20872 | // 5. Now assign a transform to each entity in the svg node so that it gets drawn in the correct place, as determined by
|
20873 | // its centre point, which is obtained from the graph, and it's width and height
|
20874 | // 6. And finally, create all the edges in the svg node using information from the graph
|
20875 | // ---
|
20876 | // Create the graph
|
20877 |
|
20878 | var g; // TODO: Explore directed vs undirected graphs, and how the layout is affected
|
20879 | // An E-R diagram could be said to be undirected, but there is merit in setting
|
20880 | // the direction from parent to child in a one-to-many as this influences graphlib to
|
20881 | // put the parent above the child (does it?), which is intuitive. Most relationships
|
20882 | // in ER diagrams are one-to-many.
|
20883 |
|
20884 | g = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
|
20885 | multigraph: true,
|
20886 | directed: true,
|
20887 | compound: false
|
20888 | }).setGraph({
|
20889 | rankdir: conf.layoutDirection,
|
20890 | marginx: 20,
|
20891 | marginy: 20,
|
20892 | nodesep: 100,
|
20893 | edgesep: 100,
|
20894 | ranksep: 100
|
20895 | }).setDefaultEdgeLabel(function () {
|
20896 | return {};
|
20897 | }); // Draw the entities (at 0,0), returning the first svg node that got
|
20898 | // inserted - this represents the insertion point for relationship paths
|
20899 |
|
20900 | var firstEntity = drawEntities(svg, diagObj.db.getEntities(), g); // TODO: externalise the addition of entities to the graph - it's a bit 'buried' in the above
|
20901 | // Add all the relationships to the graph
|
20902 |
|
20903 | var relationships = addRelationships(diagObj.db.getRelationships(), g);
|
20904 | dagre__WEBPACK_IMPORTED_MODULE_2___default().layout(g); // Node and edge positions will be updated
|
20905 | // Adjust the positions of the entities so that they adhere to the layout
|
20906 |
|
20907 | adjustEntities(svg, g); // Draw the relationships
|
20908 |
|
20909 | relationships.forEach(function (rel) {
|
20910 | drawRelationshipFromLayout(svg, rel, g, firstEntity, diagObj);
|
20911 | });
|
20912 | var padding = conf.diagramPadding;
|
20913 | var svgBounds = svg.node().getBBox();
|
20914 | var width = svgBounds.width + padding * 2;
|
20915 | var height = svgBounds.height + padding * 2;
|
20916 | (0,_utils__WEBPACK_IMPORTED_MODULE_6__.configureSvgSize)(svg, height, width, conf.useMaxWidth);
|
20917 | svg.attr('viewBox', "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height));
|
20918 | (0,_accessibility__WEBPACK_IMPORTED_MODULE_7__["default"])(diagObj.db, svg, id);
|
20919 | }; // draw
|
20920 |
|
20921 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
20922 | setConf: setConf,
|
20923 | draw: draw
|
20924 | });
|
20925 |
|
20926 | /***/ }),
|
20927 |
|
20928 | /***/ "./src/diagrams/er/styles.js":
|
20929 | /*!***********************************!*\
|
20930 | !*** ./src/diagrams/er/styles.js ***!
|
20931 | \***********************************/
|
20932 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
20933 |
|
20934 | "use strict";
|
20935 | __webpack_require__.r(__webpack_exports__);
|
20936 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
20937 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
20938 | /* harmony export */ });
|
20939 | var getStyles = function getStyles(options) {
|
20940 | return "\n .entityBox {\n fill: ".concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n }\n\n .attributeBoxOdd {\n fill: #ffffff;\n stroke: ").concat(options.nodeBorder, ";\n }\n\n .attributeBoxEven {\n fill: #f2f2f2;\n stroke: ").concat(options.nodeBorder, ";\n }\n\n .relationshipLabelBox {\n fill: ").concat(options.tertiaryColor, ";\n opacity: 0.7;\n background-color: ").concat(options.tertiaryColor, ";\n rect {\n opacity: 0.5;\n }\n }\n\n .relationshipLine {\n stroke: ").concat(options.lineColor, ";\n }\n");
|
20941 | };
|
20942 |
|
20943 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
20944 |
|
20945 | /***/ }),
|
20946 |
|
20947 | /***/ "./src/diagrams/flowchart/flowChartShapes.js":
|
20948 | /*!***************************************************!*\
|
20949 | !*** ./src/diagrams/flowchart/flowChartShapes.js ***!
|
20950 | \***************************************************/
|
20951 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
20952 |
|
20953 | "use strict";
|
20954 | __webpack_require__.r(__webpack_exports__);
|
20955 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
20956 | /* harmony export */ "addToRender": () => (/* binding */ addToRender),
|
20957 | /* harmony export */ "addToRenderV2": () => (/* binding */ addToRenderV2),
|
20958 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
20959 | /* harmony export */ });
|
20960 | /* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dagre-d3 */ "dagre-d3");
|
20961 | /* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dagre_d3__WEBPACK_IMPORTED_MODULE_0__);
|
20962 |
|
20963 | /**
|
20964 | * @param parent
|
20965 | * @param bbox
|
20966 | * @param node
|
20967 | */
|
20968 |
|
20969 | function question(parent, bbox, node) {
|
20970 | var w = bbox.width;
|
20971 | var h = bbox.height;
|
20972 | var s = (w + h) * 0.9;
|
20973 | var points = [{
|
20974 | x: s / 2,
|
20975 | y: 0
|
20976 | }, {
|
20977 | x: s,
|
20978 | y: -s / 2
|
20979 | }, {
|
20980 | x: s / 2,
|
20981 | y: -s
|
20982 | }, {
|
20983 | x: 0,
|
20984 | y: -s / 2
|
20985 | }];
|
20986 | var shapeSvg = insertPolygonShape(parent, s, s, points);
|
20987 |
|
20988 | node.intersect = function (point) {
|
20989 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
20990 | };
|
20991 |
|
20992 | return shapeSvg;
|
20993 | }
|
20994 | /**
|
20995 | * @param parent
|
20996 | * @param bbox
|
20997 | * @param node
|
20998 | */
|
20999 |
|
21000 |
|
21001 | function hexagon(parent, bbox, node) {
|
21002 | var f = 4;
|
21003 | var h = bbox.height;
|
21004 | var m = h / f;
|
21005 | var w = bbox.width + 2 * m;
|
21006 | var points = [{
|
21007 | x: m,
|
21008 | y: 0
|
21009 | }, {
|
21010 | x: w - m,
|
21011 | y: 0
|
21012 | }, {
|
21013 | x: w,
|
21014 | y: -h / 2
|
21015 | }, {
|
21016 | x: w - m,
|
21017 | y: -h
|
21018 | }, {
|
21019 | x: m,
|
21020 | y: -h
|
21021 | }, {
|
21022 | x: 0,
|
21023 | y: -h / 2
|
21024 | }];
|
21025 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
21026 |
|
21027 | node.intersect = function (point) {
|
21028 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
21029 | };
|
21030 |
|
21031 | return shapeSvg;
|
21032 | }
|
21033 | /**
|
21034 | * @param parent
|
21035 | * @param bbox
|
21036 | * @param node
|
21037 | */
|
21038 |
|
21039 |
|
21040 | function rect_left_inv_arrow(parent, bbox, node) {
|
21041 | var w = bbox.width;
|
21042 | var h = bbox.height;
|
21043 | var points = [{
|
21044 | x: -h / 2,
|
21045 | y: 0
|
21046 | }, {
|
21047 | x: w,
|
21048 | y: 0
|
21049 | }, {
|
21050 | x: w,
|
21051 | y: -h
|
21052 | }, {
|
21053 | x: -h / 2,
|
21054 | y: -h
|
21055 | }, {
|
21056 | x: 0,
|
21057 | y: -h / 2
|
21058 | }];
|
21059 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
21060 |
|
21061 | node.intersect = function (point) {
|
21062 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
21063 | };
|
21064 |
|
21065 | return shapeSvg;
|
21066 | }
|
21067 | /**
|
21068 | * @param parent
|
21069 | * @param bbox
|
21070 | * @param node
|
21071 | */
|
21072 |
|
21073 |
|
21074 | function lean_right(parent, bbox, node) {
|
21075 | var w = bbox.width;
|
21076 | var h = bbox.height;
|
21077 | var points = [{
|
21078 | x: -2 * h / 6,
|
21079 | y: 0
|
21080 | }, {
|
21081 | x: w - h / 6,
|
21082 | y: 0
|
21083 | }, {
|
21084 | x: w + 2 * h / 6,
|
21085 | y: -h
|
21086 | }, {
|
21087 | x: h / 6,
|
21088 | y: -h
|
21089 | }];
|
21090 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
21091 |
|
21092 | node.intersect = function (point) {
|
21093 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
21094 | };
|
21095 |
|
21096 | return shapeSvg;
|
21097 | }
|
21098 | /**
|
21099 | * @param parent
|
21100 | * @param bbox
|
21101 | * @param node
|
21102 | */
|
21103 |
|
21104 |
|
21105 | function lean_left(parent, bbox, node) {
|
21106 | var w = bbox.width;
|
21107 | var h = bbox.height;
|
21108 | var points = [{
|
21109 | x: 2 * h / 6,
|
21110 | y: 0
|
21111 | }, {
|
21112 | x: w + h / 6,
|
21113 | y: 0
|
21114 | }, {
|
21115 | x: w - 2 * h / 6,
|
21116 | y: -h
|
21117 | }, {
|
21118 | x: -h / 6,
|
21119 | y: -h
|
21120 | }];
|
21121 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
21122 |
|
21123 | node.intersect = function (point) {
|
21124 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
21125 | };
|
21126 |
|
21127 | return shapeSvg;
|
21128 | }
|
21129 | /**
|
21130 | * @param parent
|
21131 | * @param bbox
|
21132 | * @param node
|
21133 | */
|
21134 |
|
21135 |
|
21136 | function trapezoid(parent, bbox, node) {
|
21137 | var w = bbox.width;
|
21138 | var h = bbox.height;
|
21139 | var points = [{
|
21140 | x: -2 * h / 6,
|
21141 | y: 0
|
21142 | }, {
|
21143 | x: w + 2 * h / 6,
|
21144 | y: 0
|
21145 | }, {
|
21146 | x: w - h / 6,
|
21147 | y: -h
|
21148 | }, {
|
21149 | x: h / 6,
|
21150 | y: -h
|
21151 | }];
|
21152 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
21153 |
|
21154 | node.intersect = function (point) {
|
21155 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
21156 | };
|
21157 |
|
21158 | return shapeSvg;
|
21159 | }
|
21160 | /**
|
21161 | * @param parent
|
21162 | * @param bbox
|
21163 | * @param node
|
21164 | */
|
21165 |
|
21166 |
|
21167 | function inv_trapezoid(parent, bbox, node) {
|
21168 | var w = bbox.width;
|
21169 | var h = bbox.height;
|
21170 | var points = [{
|
21171 | x: h / 6,
|
21172 | y: 0
|
21173 | }, {
|
21174 | x: w - h / 6,
|
21175 | y: 0
|
21176 | }, {
|
21177 | x: w + 2 * h / 6,
|
21178 | y: -h
|
21179 | }, {
|
21180 | x: -2 * h / 6,
|
21181 | y: -h
|
21182 | }];
|
21183 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
21184 |
|
21185 | node.intersect = function (point) {
|
21186 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
21187 | };
|
21188 |
|
21189 | return shapeSvg;
|
21190 | }
|
21191 | /**
|
21192 | * @param parent
|
21193 | * @param bbox
|
21194 | * @param node
|
21195 | */
|
21196 |
|
21197 |
|
21198 | function rect_right_inv_arrow(parent, bbox, node) {
|
21199 | var w = bbox.width;
|
21200 | var h = bbox.height;
|
21201 | var points = [{
|
21202 | x: 0,
|
21203 | y: 0
|
21204 | }, {
|
21205 | x: w + h / 2,
|
21206 | y: 0
|
21207 | }, {
|
21208 | x: w,
|
21209 | y: -h / 2
|
21210 | }, {
|
21211 | x: w + h / 2,
|
21212 | y: -h
|
21213 | }, {
|
21214 | x: 0,
|
21215 | y: -h
|
21216 | }];
|
21217 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
21218 |
|
21219 | node.intersect = function (point) {
|
21220 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
21221 | };
|
21222 |
|
21223 | return shapeSvg;
|
21224 | }
|
21225 | /**
|
21226 | * @param parent
|
21227 | * @param bbox
|
21228 | * @param node
|
21229 | */
|
21230 |
|
21231 |
|
21232 | function stadium(parent, bbox, node) {
|
21233 | var h = bbox.height;
|
21234 | var w = bbox.width + h / 4;
|
21235 | var shapeSvg = parent.insert('rect', ':first-child').attr('rx', h / 2).attr('ry', h / 2).attr('x', -w / 2).attr('y', -h / 2).attr('width', w).attr('height', h);
|
21236 |
|
21237 | node.intersect = function (point) {
|
21238 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.rect(node, point);
|
21239 | };
|
21240 |
|
21241 | return shapeSvg;
|
21242 | }
|
21243 | /**
|
21244 | * @param parent
|
21245 | * @param bbox
|
21246 | * @param node
|
21247 | */
|
21248 |
|
21249 |
|
21250 | function subroutine(parent, bbox, node) {
|
21251 | var w = bbox.width;
|
21252 | var h = bbox.height;
|
21253 | var points = [{
|
21254 | x: 0,
|
21255 | y: 0
|
21256 | }, {
|
21257 | x: w,
|
21258 | y: 0
|
21259 | }, {
|
21260 | x: w,
|
21261 | y: -h
|
21262 | }, {
|
21263 | x: 0,
|
21264 | y: -h
|
21265 | }, {
|
21266 | x: 0,
|
21267 | y: 0
|
21268 | }, {
|
21269 | x: -8,
|
21270 | y: 0
|
21271 | }, {
|
21272 | x: w + 8,
|
21273 | y: 0
|
21274 | }, {
|
21275 | x: w + 8,
|
21276 | y: -h
|
21277 | }, {
|
21278 | x: -8,
|
21279 | y: -h
|
21280 | }, {
|
21281 | x: -8,
|
21282 | y: 0
|
21283 | }];
|
21284 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
21285 |
|
21286 | node.intersect = function (point) {
|
21287 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
21288 | };
|
21289 |
|
21290 | return shapeSvg;
|
21291 | }
|
21292 | /**
|
21293 | * @param parent
|
21294 | * @param bbox
|
21295 | * @param node
|
21296 | */
|
21297 |
|
21298 |
|
21299 | function cylinder(parent, bbox, node) {
|
21300 | var w = bbox.width;
|
21301 | var rx = w / 2;
|
21302 | var ry = rx / (2.5 + w / 50);
|
21303 | var h = bbox.height + ry;
|
21304 | var shape = 'M 0,' + ry + ' a ' + rx + ',' + ry + ' 0,0,0 ' + w + ' 0 a ' + rx + ',' + ry + ' 0,0,0 ' + -w + ' 0 l 0,' + h + ' a ' + rx + ',' + ry + ' 0,0,0 ' + w + ' 0 l 0,' + -h;
|
21305 | var shapeSvg = parent.attr('label-offset-y', ry).insert('path', ':first-child').attr('d', shape).attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')');
|
21306 |
|
21307 | node.intersect = function (point) {
|
21308 | var pos = dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.rect(node, point);
|
21309 | var x = pos.x - node.x;
|
21310 |
|
21311 | if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
|
21312 | // ellipsis equation: x*x / a*a + y*y / b*b = 1
|
21313 | // solve for y to get adjustion value for pos.y
|
21314 | var y = ry * ry * (1 - x * x / (rx * rx));
|
21315 | if (y != 0) y = Math.sqrt(y);
|
21316 | y = ry - y;
|
21317 | if (point.y - node.y > 0) y = -y;
|
21318 | pos.y += y;
|
21319 | }
|
21320 |
|
21321 | return pos;
|
21322 | };
|
21323 |
|
21324 | return shapeSvg;
|
21325 | }
|
21326 | /** @param render */
|
21327 |
|
21328 |
|
21329 | function addToRender(render) {
|
21330 | render.shapes().question = question;
|
21331 | render.shapes().hexagon = hexagon;
|
21332 | render.shapes().stadium = stadium;
|
21333 | render.shapes().subroutine = subroutine;
|
21334 | render.shapes().cylinder = cylinder; // Add custom shape for box with inverted arrow on left side
|
21335 |
|
21336 | render.shapes().rect_left_inv_arrow = rect_left_inv_arrow; // Add custom shape for box with inverted arrow on left side
|
21337 |
|
21338 | render.shapes().lean_right = lean_right; // Add custom shape for box with inverted arrow on left side
|
21339 |
|
21340 | render.shapes().lean_left = lean_left; // Add custom shape for box with inverted arrow on left side
|
21341 |
|
21342 | render.shapes().trapezoid = trapezoid; // Add custom shape for box with inverted arrow on left side
|
21343 |
|
21344 | render.shapes().inv_trapezoid = inv_trapezoid; // Add custom shape for box with inverted arrow on right side
|
21345 |
|
21346 | render.shapes().rect_right_inv_arrow = rect_right_inv_arrow;
|
21347 | }
|
21348 | /** @param addShape */
|
21349 |
|
21350 | function addToRenderV2(addShape) {
|
21351 | addShape({
|
21352 | question: question
|
21353 | });
|
21354 | addShape({
|
21355 | hexagon: hexagon
|
21356 | });
|
21357 | addShape({
|
21358 | stadium: stadium
|
21359 | });
|
21360 | addShape({
|
21361 | subroutine: subroutine
|
21362 | });
|
21363 | addShape({
|
21364 | cylinder: cylinder
|
21365 | }); // Add custom shape for box with inverted arrow on left side
|
21366 |
|
21367 | addShape({
|
21368 | rect_left_inv_arrow: rect_left_inv_arrow
|
21369 | }); // Add custom shape for box with inverted arrow on left side
|
21370 |
|
21371 | addShape({
|
21372 | lean_right: lean_right
|
21373 | }); // Add custom shape for box with inverted arrow on left side
|
21374 |
|
21375 | addShape({
|
21376 | lean_left: lean_left
|
21377 | }); // Add custom shape for box with inverted arrow on left side
|
21378 |
|
21379 | addShape({
|
21380 | trapezoid: trapezoid
|
21381 | }); // Add custom shape for box with inverted arrow on left side
|
21382 |
|
21383 | addShape({
|
21384 | inv_trapezoid: inv_trapezoid
|
21385 | }); // Add custom shape for box with inverted arrow on right side
|
21386 |
|
21387 | addShape({
|
21388 | rect_right_inv_arrow: rect_right_inv_arrow
|
21389 | });
|
21390 | }
|
21391 | /**
|
21392 | * @param parent
|
21393 | * @param w
|
21394 | * @param h
|
21395 | * @param points
|
21396 | */
|
21397 |
|
21398 | function insertPolygonShape(parent, w, h, points) {
|
21399 | return parent.insert('polygon', ':first-child').attr('points', points.map(function (d) {
|
21400 | return d.x + ',' + d.y;
|
21401 | }).join(' ')).attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');
|
21402 | }
|
21403 |
|
21404 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
21405 | addToRender: addToRender,
|
21406 | addToRenderV2: addToRenderV2
|
21407 | });
|
21408 |
|
21409 | /***/ }),
|
21410 |
|
21411 | /***/ "./src/diagrams/flowchart/flowDb.js":
|
21412 | /*!******************************************!*\
|
21413 | !*** ./src/diagrams/flowchart/flowDb.js ***!
|
21414 | \******************************************/
|
21415 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
21416 |
|
21417 | "use strict";
|
21418 | __webpack_require__.r(__webpack_exports__);
|
21419 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
21420 | /* harmony export */ "addClass": () => (/* binding */ addClass),
|
21421 | /* harmony export */ "addLink": () => (/* binding */ addLink),
|
21422 | /* harmony export */ "addSingleLink": () => (/* binding */ addSingleLink),
|
21423 | /* harmony export */ "addSubGraph": () => (/* binding */ addSubGraph),
|
21424 | /* harmony export */ "addVertex": () => (/* binding */ addVertex),
|
21425 | /* harmony export */ "bindFunctions": () => (/* binding */ bindFunctions),
|
21426 | /* harmony export */ "clear": () => (/* binding */ clear),
|
21427 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
21428 | /* harmony export */ "defaultStyle": () => (/* binding */ defaultStyle),
|
21429 | /* harmony export */ "firstGraph": () => (/* binding */ firstGraph),
|
21430 | /* harmony export */ "getClasses": () => (/* binding */ getClasses),
|
21431 | /* harmony export */ "getDepthFirstPos": () => (/* binding */ getDepthFirstPos),
|
21432 | /* harmony export */ "getDirection": () => (/* binding */ getDirection),
|
21433 | /* harmony export */ "getEdges": () => (/* binding */ getEdges),
|
21434 | /* harmony export */ "getSubGraphs": () => (/* binding */ getSubGraphs),
|
21435 | /* harmony export */ "getTooltip": () => (/* binding */ getTooltip),
|
21436 | /* harmony export */ "getVertices": () => (/* binding */ getVertices),
|
21437 | /* harmony export */ "indexNodes": () => (/* binding */ indexNodes),
|
21438 | /* harmony export */ "lookUpDomId": () => (/* binding */ lookUpDomId),
|
21439 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
21440 | /* harmony export */ "setClass": () => (/* binding */ setClass),
|
21441 | /* harmony export */ "setClickEvent": () => (/* binding */ setClickEvent),
|
21442 | /* harmony export */ "setDirection": () => (/* binding */ setDirection),
|
21443 | /* harmony export */ "setGen": () => (/* binding */ setGen),
|
21444 | /* harmony export */ "setLink": () => (/* binding */ setLink),
|
21445 | /* harmony export */ "updateLink": () => (/* binding */ updateLink),
|
21446 | /* harmony export */ "updateLinkInterpolate": () => (/* binding */ updateLinkInterpolate)
|
21447 | /* harmony export */ });
|
21448 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
21449 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
21450 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
21451 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
21452 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
21453 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
21454 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
21455 | /* harmony import */ var _commonDb__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../commonDb */ "./src/commonDb.js");
|
21456 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
21457 |
|
21458 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
21459 |
|
21460 | function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
21461 |
|
21462 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
21463 |
|
21464 | function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
21465 |
|
21466 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
21467 |
|
21468 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
21469 |
|
21470 |
|
21471 |
|
21472 |
|
21473 |
|
21474 |
|
21475 |
|
21476 |
|
21477 | var MERMAID_DOM_ID_PREFIX = 'flowchart-';
|
21478 | var vertexCounter = 0;
|
21479 | var config = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig();
|
21480 | var vertices = {};
|
21481 | var edges = [];
|
21482 | var classes = [];
|
21483 | var subGraphs = [];
|
21484 | var subGraphLookup = {};
|
21485 | var tooltips = {};
|
21486 | var subCount = 0;
|
21487 | var firstGraphFlag = true;
|
21488 | var direction;
|
21489 | var version; // As in graph
|
21490 | // Functions to be run after graph rendering
|
21491 |
|
21492 | var funs = [];
|
21493 |
|
21494 | var sanitizeText = function sanitizeText(txt) {
|
21495 | return _common_common__WEBPACK_IMPORTED_MODULE_2__["default"].sanitizeText(txt, config);
|
21496 | };
|
21497 |
|
21498 | var parseDirective = function parseDirective(statement, context, type) {
|
21499 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_3__["default"].parseDirective(this, statement, context, type);
|
21500 | };
|
21501 | /**
|
21502 | * Function to lookup domId from id in the graph definition.
|
21503 | *
|
21504 | * @param id
|
21505 | * @public
|
21506 | */
|
21507 |
|
21508 | var lookUpDomId = function lookUpDomId(id) {
|
21509 | var veritceKeys = Object.keys(vertices);
|
21510 |
|
21511 | for (var i = 0; i < veritceKeys.length; i++) {
|
21512 | if (vertices[veritceKeys[i]].id === id) {
|
21513 | return vertices[veritceKeys[i]].domId;
|
21514 | }
|
21515 | }
|
21516 |
|
21517 | return id;
|
21518 | };
|
21519 | /**
|
21520 | * Function called by parser when a node definition has been found
|
21521 | *
|
21522 | * @param _id
|
21523 | * @param text
|
21524 | * @param type
|
21525 | * @param style
|
21526 | * @param classes
|
21527 | * @param dir
|
21528 | * @param props
|
21529 | */
|
21530 |
|
21531 | var addVertex = function addVertex(_id, text, type, style, classes, dir) {
|
21532 | var props = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
|
21533 | var txt;
|
21534 | var id = _id;
|
21535 |
|
21536 | if (typeof id === 'undefined') {
|
21537 | return;
|
21538 | }
|
21539 |
|
21540 | if (id.trim().length === 0) {
|
21541 | return;
|
21542 | } // if (id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
21543 |
|
21544 |
|
21545 | if (typeof vertices[id] === 'undefined') {
|
21546 | vertices[id] = {
|
21547 | id: id,
|
21548 | domId: MERMAID_DOM_ID_PREFIX + id + '-' + vertexCounter,
|
21549 | styles: [],
|
21550 | classes: []
|
21551 | };
|
21552 | }
|
21553 |
|
21554 | vertexCounter++;
|
21555 |
|
21556 | if (typeof text !== 'undefined') {
|
21557 | config = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig();
|
21558 | txt = sanitizeText(text.trim()); // strip quotes if string starts and ends with a quote
|
21559 |
|
21560 | if (txt[0] === '"' && txt[txt.length - 1] === '"') {
|
21561 | txt = txt.substring(1, txt.length - 1);
|
21562 | }
|
21563 |
|
21564 | vertices[id].text = txt;
|
21565 | } else {
|
21566 | if (typeof vertices[id].text === 'undefined') {
|
21567 | vertices[id].text = _id;
|
21568 | }
|
21569 | }
|
21570 |
|
21571 | if (typeof type !== 'undefined') {
|
21572 | vertices[id].type = type;
|
21573 | }
|
21574 |
|
21575 | if (typeof style !== 'undefined') {
|
21576 | if (style !== null) {
|
21577 | style.forEach(function (s) {
|
21578 | vertices[id].styles.push(s);
|
21579 | });
|
21580 | }
|
21581 | }
|
21582 |
|
21583 | if (typeof classes !== 'undefined') {
|
21584 | if (classes !== null) {
|
21585 | classes.forEach(function (s) {
|
21586 | vertices[id].classes.push(s);
|
21587 | });
|
21588 | }
|
21589 | }
|
21590 |
|
21591 | if (typeof dir !== 'undefined') {
|
21592 | vertices[id].dir = dir;
|
21593 | }
|
21594 |
|
21595 | vertices[id].props = props;
|
21596 | };
|
21597 | /**
|
21598 | * Function called by parser when a link/edge definition has been found
|
21599 | *
|
21600 | * @param _start
|
21601 | * @param _end
|
21602 | * @param type
|
21603 | * @param linktext
|
21604 | */
|
21605 |
|
21606 | var addSingleLink = function addSingleLink(_start, _end, type, linktext) {
|
21607 | var start = _start;
|
21608 | var end = _end; // if (start[0].match(/\d/)) start = MERMAID_DOM_ID_PREFIX + start;
|
21609 | // if (end[0].match(/\d/)) end = MERMAID_DOM_ID_PREFIX + end;
|
21610 | // log.info('Got edge...', start, end);
|
21611 |
|
21612 | var edge = {
|
21613 | start: start,
|
21614 | end: end,
|
21615 | type: undefined,
|
21616 | text: ''
|
21617 | };
|
21618 | linktext = type.text;
|
21619 |
|
21620 | if (typeof linktext !== 'undefined') {
|
21621 | edge.text = sanitizeText(linktext.trim()); // strip quotes if string starts and exnds with a quote
|
21622 |
|
21623 | if (edge.text[0] === '"' && edge.text[edge.text.length - 1] === '"') {
|
21624 | edge.text = edge.text.substring(1, edge.text.length - 1);
|
21625 | }
|
21626 | }
|
21627 |
|
21628 | if (typeof type !== 'undefined') {
|
21629 | edge.type = type.type;
|
21630 | edge.stroke = type.stroke;
|
21631 | edge.length = type.length;
|
21632 | }
|
21633 |
|
21634 | edges.push(edge);
|
21635 | };
|
21636 | var addLink = function addLink(_start, _end, type, linktext) {
|
21637 | var i, j;
|
21638 |
|
21639 | for (i = 0; i < _start.length; i++) {
|
21640 | for (j = 0; j < _end.length; j++) {
|
21641 | addSingleLink(_start[i], _end[j], type, linktext);
|
21642 | }
|
21643 | }
|
21644 | };
|
21645 | /**
|
21646 | * Updates a link's line interpolation algorithm
|
21647 | *
|
21648 | * @param positions
|
21649 | * @param interp
|
21650 | */
|
21651 |
|
21652 | var updateLinkInterpolate = function updateLinkInterpolate(positions, interp) {
|
21653 | positions.forEach(function (pos) {
|
21654 | if (pos === 'default') {
|
21655 | edges.defaultInterpolate = interp;
|
21656 | } else {
|
21657 | edges[pos].interpolate = interp;
|
21658 | }
|
21659 | });
|
21660 | };
|
21661 | /**
|
21662 | * Updates a link with a style
|
21663 | *
|
21664 | * @param positions
|
21665 | * @param style
|
21666 | */
|
21667 |
|
21668 | var updateLink = function updateLink(positions, style) {
|
21669 | positions.forEach(function (pos) {
|
21670 | if (pos === 'default') {
|
21671 | edges.defaultStyle = style;
|
21672 | } else {
|
21673 | if (_utils__WEBPACK_IMPORTED_MODULE_4__["default"].isSubstringInArray('fill', style) === -1) {
|
21674 | style.push('fill:none');
|
21675 | }
|
21676 |
|
21677 | edges[pos].style = style;
|
21678 | }
|
21679 | });
|
21680 | };
|
21681 | var addClass = function addClass(id, style) {
|
21682 | if (typeof classes[id] === 'undefined') {
|
21683 | classes[id] = {
|
21684 | id: id,
|
21685 | styles: [],
|
21686 | textStyles: []
|
21687 | };
|
21688 | }
|
21689 |
|
21690 | if (typeof style !== 'undefined') {
|
21691 | if (style !== null) {
|
21692 | style.forEach(function (s) {
|
21693 | if (s.match('color')) {
|
21694 | var newStyle1 = s.replace('fill', 'bgFill');
|
21695 | var newStyle2 = newStyle1.replace('color', 'fill');
|
21696 | classes[id].textStyles.push(newStyle2);
|
21697 | }
|
21698 |
|
21699 | classes[id].styles.push(s);
|
21700 | });
|
21701 | }
|
21702 | }
|
21703 | };
|
21704 | /**
|
21705 | * Called by parser when a graph definition is found, stores the direction of the chart.
|
21706 | *
|
21707 | * @param dir
|
21708 | */
|
21709 |
|
21710 | var setDirection = function setDirection(dir) {
|
21711 | direction = dir;
|
21712 |
|
21713 | if (direction.match(/.*</)) {
|
21714 | direction = 'RL';
|
21715 | }
|
21716 |
|
21717 | if (direction.match(/.*\^/)) {
|
21718 | direction = 'BT';
|
21719 | }
|
21720 |
|
21721 | if (direction.match(/.*>/)) {
|
21722 | direction = 'LR';
|
21723 | }
|
21724 |
|
21725 | if (direction.match(/.*v/)) {
|
21726 | direction = 'TB';
|
21727 | }
|
21728 | };
|
21729 | /**
|
21730 | * Called by parser when a special node is found, e.g. a clickable element.
|
21731 | *
|
21732 | * @param ids Comma separated list of ids
|
21733 | * @param className Class to add
|
21734 | */
|
21735 |
|
21736 | var setClass = function setClass(ids, className) {
|
21737 | ids.split(',').forEach(function (_id) {
|
21738 | // let id = version === 'gen-2' ? lookUpDomId(_id) : _id;
|
21739 | var id = _id; // if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
21740 |
|
21741 | if (typeof vertices[id] !== 'undefined') {
|
21742 | vertices[id].classes.push(className);
|
21743 | }
|
21744 |
|
21745 | if (typeof subGraphLookup[id] !== 'undefined') {
|
21746 | subGraphLookup[id].classes.push(className);
|
21747 | }
|
21748 | });
|
21749 | };
|
21750 |
|
21751 | var setTooltip = function setTooltip(ids, tooltip) {
|
21752 | ids.split(',').forEach(function (id) {
|
21753 | if (typeof tooltip !== 'undefined') {
|
21754 | tooltips[version === 'gen-1' ? lookUpDomId(id) : id] = sanitizeText(tooltip);
|
21755 | }
|
21756 | });
|
21757 | };
|
21758 |
|
21759 | var setClickFun = function setClickFun(id, functionName, functionArgs) {
|
21760 | var domId = lookUpDomId(id); // if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
21761 |
|
21762 | if (_config__WEBPACK_IMPORTED_MODULE_1__.getConfig().securityLevel !== 'loose') {
|
21763 | return;
|
21764 | }
|
21765 |
|
21766 | if (typeof functionName === 'undefined') {
|
21767 | return;
|
21768 | }
|
21769 |
|
21770 | var argList = [];
|
21771 |
|
21772 | if (typeof functionArgs === 'string') {
|
21773 | /* Splits functionArgs by ',', ignoring all ',' in double quoted strings */
|
21774 | argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
|
21775 |
|
21776 | for (var i = 0; i < argList.length; i++) {
|
21777 | var item = argList[i].trim();
|
21778 | /* Removes all double quotes at the start and end of an argument */
|
21779 |
|
21780 | /* This preserves all starting and ending whitespace inside */
|
21781 |
|
21782 | if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
|
21783 | item = item.substr(1, item.length - 2);
|
21784 | }
|
21785 |
|
21786 | argList[i] = item;
|
21787 | }
|
21788 | }
|
21789 | /* if no arguments passed into callback, default to passing in id */
|
21790 |
|
21791 |
|
21792 | if (argList.length === 0) {
|
21793 | argList.push(id);
|
21794 | }
|
21795 |
|
21796 | if (typeof vertices[id] !== 'undefined') {
|
21797 | vertices[id].haveCallback = true;
|
21798 | funs.push(function () {
|
21799 | var elem = document.querySelector("[id=\"".concat(domId, "\"]"));
|
21800 |
|
21801 | if (elem !== null) {
|
21802 | elem.addEventListener('click', function () {
|
21803 | _utils__WEBPACK_IMPORTED_MODULE_4__["default"].runFunc.apply(_utils__WEBPACK_IMPORTED_MODULE_4__["default"], [functionName].concat(_toConsumableArray(argList)));
|
21804 | }, false);
|
21805 | }
|
21806 | });
|
21807 | }
|
21808 | };
|
21809 | /**
|
21810 | * Called by parser when a link is found. Adds the URL to the vertex data.
|
21811 | *
|
21812 | * @param ids Comma separated list of ids
|
21813 | * @param linkStr URL to create a link for
|
21814 | * @param target
|
21815 | */
|
21816 |
|
21817 |
|
21818 | var setLink = function setLink(ids, linkStr, target) {
|
21819 | ids.split(',').forEach(function (id) {
|
21820 | if (typeof vertices[id] !== 'undefined') {
|
21821 | vertices[id].link = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].formatUrl(linkStr, config);
|
21822 | vertices[id].linkTarget = target;
|
21823 | }
|
21824 | });
|
21825 | setClass(ids, 'clickable');
|
21826 | };
|
21827 | var getTooltip = function getTooltip(id) {
|
21828 | return tooltips[id];
|
21829 | };
|
21830 | /**
|
21831 | * Called by parser when a click definition is found. Registers an event handler.
|
21832 | *
|
21833 | * @param ids Comma separated list of ids
|
21834 | * @param functionName Function to be called on click
|
21835 | * @param functionArgs
|
21836 | */
|
21837 |
|
21838 | var setClickEvent = function setClickEvent(ids, functionName, functionArgs) {
|
21839 | ids.split(',').forEach(function (id) {
|
21840 | setClickFun(id, functionName, functionArgs);
|
21841 | });
|
21842 | setClass(ids, 'clickable');
|
21843 | };
|
21844 | var bindFunctions = function bindFunctions(element) {
|
21845 | funs.forEach(function (fun) {
|
21846 | fun(element);
|
21847 | });
|
21848 | };
|
21849 | var getDirection = function getDirection() {
|
21850 | return direction.trim();
|
21851 | };
|
21852 | /**
|
21853 | * Retrieval function for fetching the found nodes after parsing has completed.
|
21854 | *
|
21855 | * @returns {{} | any | vertices}
|
21856 | */
|
21857 |
|
21858 | var getVertices = function getVertices() {
|
21859 | return vertices;
|
21860 | };
|
21861 | /**
|
21862 | * Retrieval function for fetching the found links after parsing has completed.
|
21863 | *
|
21864 | * @returns {{} | any | edges}
|
21865 | */
|
21866 |
|
21867 | var getEdges = function getEdges() {
|
21868 | return edges;
|
21869 | };
|
21870 | /**
|
21871 | * Retrieval function for fetching the found class definitions after parsing has completed.
|
21872 | *
|
21873 | * @returns {{} | any | classes}
|
21874 | */
|
21875 |
|
21876 | var getClasses = function getClasses() {
|
21877 | return classes;
|
21878 | };
|
21879 |
|
21880 | var setupToolTips = function setupToolTips(element) {
|
21881 | var tooltipElem = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('.mermaidTooltip');
|
21882 |
|
21883 | if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
|
21884 | tooltipElem = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
|
21885 | }
|
21886 |
|
21887 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(element).select('svg');
|
21888 | var nodes = svg.selectAll('g.node');
|
21889 | nodes.on('mouseover', function () {
|
21890 | var el = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(this);
|
21891 | var title = el.attr('title'); // Dont try to draw a tooltip if no data is provided
|
21892 |
|
21893 | if (title === null) {
|
21894 | return;
|
21895 | }
|
21896 |
|
21897 | var rect = this.getBoundingClientRect();
|
21898 | tooltipElem.transition().duration(200).style('opacity', '.9');
|
21899 | tooltipElem.text(el.attr('title')).style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px').style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px');
|
21900 | el.classed('hover', true);
|
21901 | }).on('mouseout', function () {
|
21902 | tooltipElem.transition().duration(500).style('opacity', 0);
|
21903 | var el = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(this);
|
21904 | el.classed('hover', false);
|
21905 | });
|
21906 | };
|
21907 |
|
21908 | funs.push(setupToolTips);
|
21909 | /**
|
21910 | * Clears the internal graph db so that a new graph can be parsed.
|
21911 | *
|
21912 | * @param ver
|
21913 | */
|
21914 |
|
21915 | var clear = function clear(ver) {
|
21916 | vertices = {};
|
21917 | classes = {};
|
21918 | edges = [];
|
21919 | funs = [];
|
21920 | funs.push(setupToolTips);
|
21921 | subGraphs = [];
|
21922 | subGraphLookup = {};
|
21923 | subCount = 0;
|
21924 | tooltips = [];
|
21925 | firstGraphFlag = true;
|
21926 | version = ver || 'gen-1';
|
21927 | (0,_commonDb__WEBPACK_IMPORTED_MODULE_5__.clear)();
|
21928 | };
|
21929 | var setGen = function setGen(ver) {
|
21930 | version = ver || 'gen-1';
|
21931 | };
|
21932 | /** @returns {string} */
|
21933 |
|
21934 | var defaultStyle = function defaultStyle() {
|
21935 | return 'fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;';
|
21936 | };
|
21937 | /**
|
21938 | * Clears the internal graph db so that a new graph can be parsed.
|
21939 | *
|
21940 | * @param _id
|
21941 | * @param list
|
21942 | * @param _title
|
21943 | */
|
21944 |
|
21945 | var addSubGraph = function addSubGraph(_id, list, _title) {
|
21946 | // console.log('addSubGraph', _id, list, _title);
|
21947 | var id = _id.trim();
|
21948 |
|
21949 | var title = _title;
|
21950 |
|
21951 | if (_id === _title && _title.match(/\s/)) {
|
21952 | id = undefined;
|
21953 | }
|
21954 | /** @param a */
|
21955 |
|
21956 |
|
21957 | function uniq(a) {
|
21958 | var prims = {
|
21959 | boolean: {},
|
21960 | number: {},
|
21961 | string: {}
|
21962 | };
|
21963 | var objs = [];
|
21964 | var dir; // = undefined; direction.trim();
|
21965 |
|
21966 | var nodeList = a.filter(function (item) {
|
21967 | var type = _typeof(item);
|
21968 |
|
21969 | if (item.stmt && item.stmt === 'dir') {
|
21970 | dir = item.value;
|
21971 | return false;
|
21972 | }
|
21973 |
|
21974 | if (item.trim() === '') {
|
21975 | return false;
|
21976 | }
|
21977 |
|
21978 | if (type in prims) {
|
21979 | return prims[type].hasOwnProperty(item) ? false : prims[type][item] = true; // eslint-disable-line
|
21980 | } else {
|
21981 | return objs.indexOf(item) >= 0 ? false : objs.push(item);
|
21982 | }
|
21983 | });
|
21984 | return {
|
21985 | nodeList: nodeList,
|
21986 | dir: dir
|
21987 | };
|
21988 | }
|
21989 |
|
21990 | var nodeList = [];
|
21991 |
|
21992 | var _uniq = uniq(nodeList.concat.apply(nodeList, list)),
|
21993 | nl = _uniq.nodeList,
|
21994 | dir = _uniq.dir;
|
21995 |
|
21996 | nodeList = nl;
|
21997 |
|
21998 | if (version === 'gen-1') {
|
21999 | for (var i = 0; i < nodeList.length; i++) {
|
22000 | nodeList[i] = lookUpDomId(nodeList[i]);
|
22001 | }
|
22002 | }
|
22003 |
|
22004 | id = id || 'subGraph' + subCount; // if (id[0].match(/\d/)) id = lookUpDomId(id);
|
22005 |
|
22006 | title = title || '';
|
22007 | title = sanitizeText(title);
|
22008 | subCount = subCount + 1;
|
22009 | var subGraph = {
|
22010 | id: id,
|
22011 | nodes: nodeList,
|
22012 | title: title.trim(),
|
22013 | classes: [],
|
22014 | dir: dir
|
22015 | };
|
22016 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('Adding', subGraph.id, subGraph.nodes, subGraph.dir);
|
22017 | /** Deletes an id from all subgraphs */
|
22018 | // const del = _id => {
|
22019 | // subGraphs.forEach(sg => {
|
22020 | // const pos = sg.nodes.indexOf(_id);
|
22021 | // if (pos >= 0) {
|
22022 | // sg.nodes.splice(pos, 1);
|
22023 | // }
|
22024 | // });
|
22025 | // };
|
22026 | // // Removes the members of this subgraph from any other subgraphs, a node only belong to one subgraph
|
22027 | // subGraph.nodes.forEach(_id => del(_id));
|
22028 | // Remove the members in the new subgraph if they already belong to another subgraph
|
22029 |
|
22030 | subGraph.nodes = makeUniq(subGraph, subGraphs).nodes;
|
22031 | subGraphs.push(subGraph);
|
22032 | subGraphLookup[id] = subGraph;
|
22033 | return id;
|
22034 | };
|
22035 |
|
22036 | var getPosForId = function getPosForId(id) {
|
22037 | for (var i = 0; i < subGraphs.length; i++) {
|
22038 | if (subGraphs[i].id === id) {
|
22039 | return i;
|
22040 | }
|
22041 | }
|
22042 |
|
22043 | return -1;
|
22044 | };
|
22045 |
|
22046 | var secCount = -1;
|
22047 | var posCrossRef = [];
|
22048 |
|
22049 | var indexNodes2 = function indexNodes2(id, pos) {
|
22050 | var nodes = subGraphs[pos].nodes;
|
22051 | secCount = secCount + 1;
|
22052 |
|
22053 | if (secCount > 2000) {
|
22054 | return;
|
22055 | }
|
22056 |
|
22057 | posCrossRef[secCount] = pos; // Check if match
|
22058 |
|
22059 | if (subGraphs[pos].id === id) {
|
22060 | return {
|
22061 | result: true,
|
22062 | count: 0
|
22063 | };
|
22064 | }
|
22065 |
|
22066 | var count = 0;
|
22067 | var posCount = 1;
|
22068 |
|
22069 | while (count < nodes.length) {
|
22070 | var childPos = getPosForId(nodes[count]); // Ignore regular nodes (pos will be -1)
|
22071 |
|
22072 | if (childPos >= 0) {
|
22073 | var res = indexNodes2(id, childPos);
|
22074 |
|
22075 | if (res.result) {
|
22076 | return {
|
22077 | result: true,
|
22078 | count: posCount + res.count
|
22079 | };
|
22080 | } else {
|
22081 | posCount = posCount + res.count;
|
22082 | }
|
22083 | }
|
22084 |
|
22085 | count = count + 1;
|
22086 | }
|
22087 |
|
22088 | return {
|
22089 | result: false,
|
22090 | count: posCount
|
22091 | };
|
22092 | };
|
22093 |
|
22094 | var getDepthFirstPos = function getDepthFirstPos(pos) {
|
22095 | return posCrossRef[pos];
|
22096 | };
|
22097 | var indexNodes = function indexNodes() {
|
22098 | secCount = -1;
|
22099 |
|
22100 | if (subGraphs.length > 0) {
|
22101 | indexNodes2('none', subGraphs.length - 1, 0);
|
22102 | }
|
22103 | };
|
22104 | var getSubGraphs = function getSubGraphs() {
|
22105 | return subGraphs;
|
22106 | };
|
22107 | var firstGraph = function firstGraph() {
|
22108 | if (firstGraphFlag) {
|
22109 | firstGraphFlag = false;
|
22110 | return true;
|
22111 | }
|
22112 |
|
22113 | return false;
|
22114 | };
|
22115 |
|
22116 | var destructStartLink = function destructStartLink(_str) {
|
22117 | var str = _str.trim();
|
22118 |
|
22119 | var type = 'arrow_open';
|
22120 |
|
22121 | switch (str[0]) {
|
22122 | case '<':
|
22123 | type = 'arrow_point';
|
22124 | str = str.slice(1);
|
22125 | break;
|
22126 |
|
22127 | case 'x':
|
22128 | type = 'arrow_cross';
|
22129 | str = str.slice(1);
|
22130 | break;
|
22131 |
|
22132 | case 'o':
|
22133 | type = 'arrow_circle';
|
22134 | str = str.slice(1);
|
22135 | break;
|
22136 | }
|
22137 |
|
22138 | var stroke = 'normal';
|
22139 |
|
22140 | if (str.indexOf('=') !== -1) {
|
22141 | stroke = 'thick';
|
22142 | }
|
22143 |
|
22144 | if (str.indexOf('.') !== -1) {
|
22145 | stroke = 'dotted';
|
22146 | }
|
22147 |
|
22148 | return {
|
22149 | type: type,
|
22150 | stroke: stroke
|
22151 | };
|
22152 | };
|
22153 |
|
22154 | var countChar = function countChar(char, str) {
|
22155 | var length = str.length;
|
22156 | var count = 0;
|
22157 |
|
22158 | for (var i = 0; i < length; ++i) {
|
22159 | if (str[i] === char) {
|
22160 | ++count;
|
22161 | }
|
22162 | }
|
22163 |
|
22164 | return count;
|
22165 | };
|
22166 |
|
22167 | var destructEndLink = function destructEndLink(_str) {
|
22168 | var str = _str.trim();
|
22169 |
|
22170 | var line = str.slice(0, -1);
|
22171 | var type = 'arrow_open';
|
22172 |
|
22173 | switch (str.slice(-1)) {
|
22174 | case 'x':
|
22175 | type = 'arrow_cross';
|
22176 |
|
22177 | if (str[0] === 'x') {
|
22178 | type = 'double_' + type;
|
22179 | line = line.slice(1);
|
22180 | }
|
22181 |
|
22182 | break;
|
22183 |
|
22184 | case '>':
|
22185 | type = 'arrow_point';
|
22186 |
|
22187 | if (str[0] === '<') {
|
22188 | type = 'double_' + type;
|
22189 | line = line.slice(1);
|
22190 | }
|
22191 |
|
22192 | break;
|
22193 |
|
22194 | case 'o':
|
22195 | type = 'arrow_circle';
|
22196 |
|
22197 | if (str[0] === 'o') {
|
22198 | type = 'double_' + type;
|
22199 | line = line.slice(1);
|
22200 | }
|
22201 |
|
22202 | break;
|
22203 | }
|
22204 |
|
22205 | var stroke = 'normal';
|
22206 | var length = line.length - 1;
|
22207 |
|
22208 | if (line[0] === '=') {
|
22209 | stroke = 'thick';
|
22210 | }
|
22211 |
|
22212 | var dots = countChar('.', line);
|
22213 |
|
22214 | if (dots) {
|
22215 | stroke = 'dotted';
|
22216 | length = dots;
|
22217 | }
|
22218 |
|
22219 | return {
|
22220 | type: type,
|
22221 | stroke: stroke,
|
22222 | length: length
|
22223 | };
|
22224 | };
|
22225 |
|
22226 | var destructLink = function destructLink(_str, _startStr) {
|
22227 | var info = destructEndLink(_str);
|
22228 | var startInfo;
|
22229 |
|
22230 | if (_startStr) {
|
22231 | startInfo = destructStartLink(_startStr);
|
22232 |
|
22233 | if (startInfo.stroke !== info.stroke) {
|
22234 | return {
|
22235 | type: 'INVALID',
|
22236 | stroke: 'INVALID'
|
22237 | };
|
22238 | }
|
22239 |
|
22240 | if (startInfo.type === 'arrow_open') {
|
22241 | // -- xyz --> - take arrow type from ending
|
22242 | startInfo.type = info.type;
|
22243 | } else {
|
22244 | // x-- xyz --> - not supported
|
22245 | if (startInfo.type !== info.type) return {
|
22246 | type: 'INVALID',
|
22247 | stroke: 'INVALID'
|
22248 | };
|
22249 | startInfo.type = 'double_' + startInfo.type;
|
22250 | }
|
22251 |
|
22252 | if (startInfo.type === 'double_arrow') {
|
22253 | startInfo.type = 'double_arrow_point';
|
22254 | }
|
22255 |
|
22256 | startInfo.length = info.length;
|
22257 | return startInfo;
|
22258 | }
|
22259 |
|
22260 | return info;
|
22261 | }; // Todo optimizer this by caching existing nodes
|
22262 |
|
22263 |
|
22264 | var exists = function exists(allSgs, _id) {
|
22265 | var res = false;
|
22266 | allSgs.forEach(function (sg) {
|
22267 | var pos = sg.nodes.indexOf(_id);
|
22268 |
|
22269 | if (pos >= 0) {
|
22270 | res = true;
|
22271 | }
|
22272 | });
|
22273 | return res;
|
22274 | };
|
22275 | /**
|
22276 | * Deletes an id from all subgraphs
|
22277 | *
|
22278 | * @param sg
|
22279 | * @param allSubgraphs
|
22280 | */
|
22281 |
|
22282 |
|
22283 | var makeUniq = function makeUniq(sg, allSubgraphs) {
|
22284 | var res = [];
|
22285 | sg.nodes.forEach(function (_id, pos) {
|
22286 | if (!exists(allSubgraphs, _id)) {
|
22287 | res.push(sg.nodes[pos]);
|
22288 | }
|
22289 | });
|
22290 | return {
|
22291 | nodes: res
|
22292 | };
|
22293 | };
|
22294 |
|
22295 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
22296 | parseDirective: parseDirective,
|
22297 | defaultConfig: function defaultConfig() {
|
22298 | return _config__WEBPACK_IMPORTED_MODULE_1__.defaultConfig.flowchart;
|
22299 | },
|
22300 | setAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_5__.setAccTitle,
|
22301 | getAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_5__.getAccTitle,
|
22302 | getAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_5__.getAccDescription,
|
22303 | setAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_5__.setAccDescription,
|
22304 | addVertex: addVertex,
|
22305 | lookUpDomId: lookUpDomId,
|
22306 | addLink: addLink,
|
22307 | updateLinkInterpolate: updateLinkInterpolate,
|
22308 | updateLink: updateLink,
|
22309 | addClass: addClass,
|
22310 | setDirection: setDirection,
|
22311 | setClass: setClass,
|
22312 | setTooltip: setTooltip,
|
22313 | getTooltip: getTooltip,
|
22314 | setClickEvent: setClickEvent,
|
22315 | setLink: setLink,
|
22316 | bindFunctions: bindFunctions,
|
22317 | getDirection: getDirection,
|
22318 | getVertices: getVertices,
|
22319 | getEdges: getEdges,
|
22320 | getClasses: getClasses,
|
22321 | clear: clear,
|
22322 | setGen: setGen,
|
22323 | defaultStyle: defaultStyle,
|
22324 | addSubGraph: addSubGraph,
|
22325 | getDepthFirstPos: getDepthFirstPos,
|
22326 | indexNodes: indexNodes,
|
22327 | getSubGraphs: getSubGraphs,
|
22328 | destructLink: destructLink,
|
22329 | lex: {
|
22330 | firstGraph: firstGraph
|
22331 | },
|
22332 | exists: exists,
|
22333 | makeUniq: makeUniq
|
22334 | });
|
22335 |
|
22336 | /***/ }),
|
22337 |
|
22338 | /***/ "./src/diagrams/flowchart/flowRenderer-v2.js":
|
22339 | /*!***************************************************!*\
|
22340 | !*** ./src/diagrams/flowchart/flowRenderer-v2.js ***!
|
22341 | \***************************************************/
|
22342 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
22343 |
|
22344 | "use strict";
|
22345 | __webpack_require__.r(__webpack_exports__);
|
22346 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
22347 | /* harmony export */ "addEdges": () => (/* binding */ addEdges),
|
22348 | /* harmony export */ "addVertices": () => (/* binding */ addVertices),
|
22349 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
22350 | /* harmony export */ "draw": () => (/* binding */ draw),
|
22351 | /* harmony export */ "getClasses": () => (/* binding */ getClasses),
|
22352 | /* harmony export */ "setConf": () => (/* binding */ setConf)
|
22353 | /* harmony export */ });
|
22354 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
|
22355 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
|
22356 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
|
22357 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
|
22358 | /* harmony import */ var _flowDb__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./flowDb */ "./src/diagrams/flowchart/flowDb.js");
|
22359 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
22360 | /* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
|
22361 | /* harmony import */ var dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dagre-d3/lib/label/add-html-label.js */ "dagre-d3/lib/label/add-html-label.js");
|
22362 | /* harmony import */ var dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_2__);
|
22363 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
22364 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
22365 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
22366 | /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js");
|
22367 |
|
22368 |
|
22369 |
|
22370 |
|
22371 |
|
22372 |
|
22373 |
|
22374 |
|
22375 |
|
22376 |
|
22377 |
|
22378 | var conf = {};
|
22379 | var setConf = function setConf(cnf) {
|
22380 | var keys = Object.keys(cnf);
|
22381 |
|
22382 | for (var i = 0; i < keys.length; i++) {
|
22383 | conf[keys[i]] = cnf[keys[i]];
|
22384 | }
|
22385 | };
|
22386 | /**
|
22387 | * Function that adds the vertices found during parsing to the graph to be rendered.
|
22388 | *
|
22389 | * @param vert Object containing the vertices.
|
22390 | * @param g The graph that is to be drawn.
|
22391 | * @param svgId
|
22392 | * @param root
|
22393 | * @param doc
|
22394 | * @param diagObj
|
22395 | */
|
22396 |
|
22397 | var addVertices = function addVertices(vert, g, svgId, root, doc, diagObj) {
|
22398 | var svg = root.select("[id=\"".concat(svgId, "\"]"));
|
22399 | var keys = Object.keys(vert); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
|
22400 |
|
22401 | keys.forEach(function (id) {
|
22402 | var vertex = vert[id];
|
22403 | /**
|
22404 | * Variable for storing the classes for the vertex
|
22405 | *
|
22406 | * @type {string}
|
22407 | */
|
22408 |
|
22409 | var classStr = 'default';
|
22410 |
|
22411 | if (vertex.classes.length > 0) {
|
22412 | classStr = vertex.classes.join(' ');
|
22413 | }
|
22414 |
|
22415 | var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getStylesFromArray)(vertex.styles); // Use vertex id as text in the box if no text is provided by the graph definition
|
22416 |
|
22417 | var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
|
22418 |
|
22419 | var vertexNode;
|
22420 |
|
22421 | if ((0,_common_common__WEBPACK_IMPORTED_MODULE_4__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().flowchart.htmlLabels)) {
|
22422 | // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
|
22423 | var node = {
|
22424 | label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
|
22425 | return "<i class='".concat(s.replace(':', ' '), "'></i>");
|
22426 | })
|
22427 | };
|
22428 | vertexNode = dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_2___default()(svg, node).node();
|
22429 | vertexNode.parentNode.removeChild(vertexNode);
|
22430 | } else {
|
22431 | var svgLabel = doc.createElementNS('http://www.w3.org/2000/svg', 'text');
|
22432 | svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
|
22433 | var rows = vertexText.split(_common_common__WEBPACK_IMPORTED_MODULE_4__["default"].lineBreakRegex);
|
22434 |
|
22435 | for (var j = 0; j < rows.length; j++) {
|
22436 | var tspan = doc.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
22437 | tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
22438 | tspan.setAttribute('dy', '1em');
|
22439 | tspan.setAttribute('x', '1');
|
22440 | tspan.textContent = rows[j];
|
22441 | svgLabel.appendChild(tspan);
|
22442 | }
|
22443 |
|
22444 | vertexNode = svgLabel;
|
22445 | }
|
22446 |
|
22447 | var radious = 0;
|
22448 | var _shape = ''; // Set the shape based parameters
|
22449 |
|
22450 | switch (vertex.type) {
|
22451 | case 'round':
|
22452 | radious = 5;
|
22453 | _shape = 'rect';
|
22454 | break;
|
22455 |
|
22456 | case 'square':
|
22457 | _shape = 'rect';
|
22458 | break;
|
22459 |
|
22460 | case 'diamond':
|
22461 | _shape = 'question';
|
22462 | break;
|
22463 |
|
22464 | case 'hexagon':
|
22465 | _shape = 'hexagon';
|
22466 | break;
|
22467 |
|
22468 | case 'odd':
|
22469 | _shape = 'rect_left_inv_arrow';
|
22470 | break;
|
22471 |
|
22472 | case 'lean_right':
|
22473 | _shape = 'lean_right';
|
22474 | break;
|
22475 |
|
22476 | case 'lean_left':
|
22477 | _shape = 'lean_left';
|
22478 | break;
|
22479 |
|
22480 | case 'trapezoid':
|
22481 | _shape = 'trapezoid';
|
22482 | break;
|
22483 |
|
22484 | case 'inv_trapezoid':
|
22485 | _shape = 'inv_trapezoid';
|
22486 | break;
|
22487 |
|
22488 | case 'odd_right':
|
22489 | _shape = 'rect_left_inv_arrow';
|
22490 | break;
|
22491 |
|
22492 | case 'circle':
|
22493 | _shape = 'circle';
|
22494 | break;
|
22495 |
|
22496 | case 'ellipse':
|
22497 | _shape = 'ellipse';
|
22498 | break;
|
22499 |
|
22500 | case 'stadium':
|
22501 | _shape = 'stadium';
|
22502 | break;
|
22503 |
|
22504 | case 'subroutine':
|
22505 | _shape = 'subroutine';
|
22506 | break;
|
22507 |
|
22508 | case 'cylinder':
|
22509 | _shape = 'cylinder';
|
22510 | break;
|
22511 |
|
22512 | case 'group':
|
22513 | _shape = 'rect';
|
22514 | break;
|
22515 |
|
22516 | case 'doublecircle':
|
22517 | _shape = 'doublecircle';
|
22518 | break;
|
22519 |
|
22520 | default:
|
22521 | _shape = 'rect';
|
22522 | } // Add the node
|
22523 |
|
22524 |
|
22525 | g.setNode(vertex.id, {
|
22526 | labelStyle: styles.labelStyle,
|
22527 | shape: _shape,
|
22528 | labelText: vertexText,
|
22529 | rx: radious,
|
22530 | ry: radious,
|
22531 | class: classStr,
|
22532 | style: styles.style,
|
22533 | id: vertex.id,
|
22534 | link: vertex.link,
|
22535 | linkTarget: vertex.linkTarget,
|
22536 | tooltip: diagObj.db.getTooltip(vertex.id) || '',
|
22537 | domId: diagObj.db.lookUpDomId(vertex.id),
|
22538 | haveCallback: vertex.haveCallback,
|
22539 | width: vertex.type === 'group' ? 500 : undefined,
|
22540 | dir: vertex.dir,
|
22541 | type: vertex.type,
|
22542 | props: vertex.props,
|
22543 | padding: (0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().flowchart.padding
|
22544 | });
|
22545 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('setNode', {
|
22546 | labelStyle: styles.labelStyle,
|
22547 | shape: _shape,
|
22548 | labelText: vertexText,
|
22549 | rx: radious,
|
22550 | ry: radious,
|
22551 | class: classStr,
|
22552 | style: styles.style,
|
22553 | id: vertex.id,
|
22554 | domId: diagObj.db.lookUpDomId(vertex.id),
|
22555 | width: vertex.type === 'group' ? 500 : undefined,
|
22556 | type: vertex.type,
|
22557 | dir: vertex.dir,
|
22558 | props: vertex.props,
|
22559 | padding: (0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().flowchart.padding
|
22560 | });
|
22561 | });
|
22562 | };
|
22563 | /**
|
22564 | * Add edges to graph based on parsed graph definition
|
22565 | *
|
22566 | * @param {object} edges The edges to add to the graph
|
22567 | * @param {object} g The graph object
|
22568 | * @param diagObj
|
22569 | */
|
22570 |
|
22571 | var addEdges = function addEdges(edges, g, diagObj) {
|
22572 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('abc78 edges = ', edges);
|
22573 | var cnt = 0;
|
22574 | var linkIdCnt = {};
|
22575 | var defaultStyle;
|
22576 | var defaultLabelStyle;
|
22577 |
|
22578 | if (typeof edges.defaultStyle !== 'undefined') {
|
22579 | var defaultStyles = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getStylesFromArray)(edges.defaultStyle);
|
22580 | defaultStyle = defaultStyles.style;
|
22581 | defaultLabelStyle = defaultStyles.labelStyle;
|
22582 | }
|
22583 |
|
22584 | edges.forEach(function (edge) {
|
22585 | cnt++; // Identify Link
|
22586 |
|
22587 | var linkIdBase = 'L-' + edge.start + '-' + edge.end; // count the links from+to the same node to give unique id
|
22588 |
|
22589 | if (typeof linkIdCnt[linkIdBase] === 'undefined') {
|
22590 | linkIdCnt[linkIdBase] = 0;
|
22591 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('abc78 new entry', linkIdBase, linkIdCnt[linkIdBase]);
|
22592 | } else {
|
22593 | linkIdCnt[linkIdBase]++;
|
22594 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('abc78 new entry', linkIdBase, linkIdCnt[linkIdBase]);
|
22595 | }
|
22596 |
|
22597 | var linkId = linkIdBase + '-' + linkIdCnt[linkIdBase];
|
22598 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('abc78 new link id to be used is', linkIdBase, linkId, linkIdCnt[linkIdBase]);
|
22599 | var linkNameStart = 'LS-' + edge.start;
|
22600 | var linkNameEnd = 'LE-' + edge.end;
|
22601 | var edgeData = {
|
22602 | style: '',
|
22603 | labelStyle: ''
|
22604 | };
|
22605 | edgeData.minlen = edge.length || 1; //edgeData.id = 'id' + cnt;
|
22606 | // Set link type for rendering
|
22607 |
|
22608 | if (edge.type === 'arrow_open') {
|
22609 | edgeData.arrowhead = 'none';
|
22610 | } else {
|
22611 | edgeData.arrowhead = 'normal';
|
22612 | } // Check of arrow types, placed here in order not to break old rendering
|
22613 |
|
22614 |
|
22615 | edgeData.arrowTypeStart = 'arrow_open';
|
22616 | edgeData.arrowTypeEnd = 'arrow_open';
|
22617 | /* eslint-disable no-fallthrough */
|
22618 |
|
22619 | switch (edge.type) {
|
22620 | case 'double_arrow_cross':
|
22621 | edgeData.arrowTypeStart = 'arrow_cross';
|
22622 |
|
22623 | case 'arrow_cross':
|
22624 | edgeData.arrowTypeEnd = 'arrow_cross';
|
22625 | break;
|
22626 |
|
22627 | case 'double_arrow_point':
|
22628 | edgeData.arrowTypeStart = 'arrow_point';
|
22629 |
|
22630 | case 'arrow_point':
|
22631 | edgeData.arrowTypeEnd = 'arrow_point';
|
22632 | break;
|
22633 |
|
22634 | case 'double_arrow_circle':
|
22635 | edgeData.arrowTypeStart = 'arrow_circle';
|
22636 |
|
22637 | case 'arrow_circle':
|
22638 | edgeData.arrowTypeEnd = 'arrow_circle';
|
22639 | break;
|
22640 | }
|
22641 |
|
22642 | var style = '';
|
22643 | var labelStyle = '';
|
22644 |
|
22645 | switch (edge.stroke) {
|
22646 | case 'normal':
|
22647 | style = 'fill:none;';
|
22648 |
|
22649 | if (typeof defaultStyle !== 'undefined') {
|
22650 | style = defaultStyle;
|
22651 | }
|
22652 |
|
22653 | if (typeof defaultLabelStyle !== 'undefined') {
|
22654 | labelStyle = defaultLabelStyle;
|
22655 | }
|
22656 |
|
22657 | edgeData.thickness = 'normal';
|
22658 | edgeData.pattern = 'solid';
|
22659 | break;
|
22660 |
|
22661 | case 'dotted':
|
22662 | edgeData.thickness = 'normal';
|
22663 | edgeData.pattern = 'dotted';
|
22664 | edgeData.style = 'fill:none;stroke-width:2px;stroke-dasharray:3;';
|
22665 | break;
|
22666 |
|
22667 | case 'thick':
|
22668 | edgeData.thickness = 'thick';
|
22669 | edgeData.pattern = 'solid';
|
22670 | edgeData.style = 'stroke-width: 3.5px;fill:none;';
|
22671 | break;
|
22672 | }
|
22673 |
|
22674 | if (typeof edge.style !== 'undefined') {
|
22675 | var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getStylesFromArray)(edge.style);
|
22676 | style = styles.style;
|
22677 | labelStyle = styles.labelStyle;
|
22678 | }
|
22679 |
|
22680 | edgeData.style = edgeData.style += style;
|
22681 | edgeData.labelStyle = edgeData.labelStyle += labelStyle;
|
22682 |
|
22683 | if (typeof edge.interpolate !== 'undefined') {
|
22684 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.interpolateToCurve)(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
|
22685 | } else if (typeof edges.defaultInterpolate !== 'undefined') {
|
22686 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.interpolateToCurve)(edges.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
|
22687 | } else {
|
22688 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.interpolateToCurve)(conf.curve, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
|
22689 | }
|
22690 |
|
22691 | if (typeof edge.text === 'undefined') {
|
22692 | if (typeof edge.style !== 'undefined') {
|
22693 | edgeData.arrowheadStyle = 'fill: #333';
|
22694 | }
|
22695 | } else {
|
22696 | edgeData.arrowheadStyle = 'fill: #333';
|
22697 | edgeData.labelpos = 'c';
|
22698 | }
|
22699 |
|
22700 | edgeData.labelType = 'text';
|
22701 | edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_4__["default"].lineBreakRegex, '\n');
|
22702 |
|
22703 | if (typeof edge.style === 'undefined') {
|
22704 | edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none;';
|
22705 | }
|
22706 |
|
22707 | edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
|
22708 | edgeData.id = linkId;
|
22709 | edgeData.classes = 'flowchart-link ' + linkNameStart + ' ' + linkNameEnd; // Add the edge to the graph
|
22710 |
|
22711 | g.setEdge(edge.start, edge.end, edgeData, cnt);
|
22712 | });
|
22713 | };
|
22714 | /**
|
22715 | * Returns the all the styles from classDef statements in the graph definition.
|
22716 | *
|
22717 | * @param text
|
22718 | * @param diagObj
|
22719 | * @returns {object} ClassDef styles
|
22720 | */
|
22721 |
|
22722 | var getClasses = function getClasses(text, diagObj) {
|
22723 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('Extracting classes');
|
22724 | diagObj.db.clear();
|
22725 |
|
22726 | try {
|
22727 | // Parse the graph definition
|
22728 | diagObj.parse(text);
|
22729 | return diagObj.db.getClasses();
|
22730 | } catch (e) {
|
22731 | return;
|
22732 | }
|
22733 | };
|
22734 | /**
|
22735 | * Draws a flowchart in the tag with id: id based on the graph definition in text.
|
22736 | *
|
22737 | * @param text
|
22738 | * @param id
|
22739 | */
|
22740 |
|
22741 | var draw = function draw(text, id, _version, diagObj) {
|
22742 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('Drawing flowchart');
|
22743 | diagObj.db.clear();
|
22744 | _flowDb__WEBPACK_IMPORTED_MODULE_7__["default"].setGen('gen-2'); // Parse the graph definition
|
22745 |
|
22746 | diagObj.parser.parse(text); // Fetch the default direction, use TD if none was found
|
22747 |
|
22748 | var dir = diagObj.db.getDirection();
|
22749 |
|
22750 | if (typeof dir === 'undefined') {
|
22751 | dir = 'TD';
|
22752 | }
|
22753 |
|
22754 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().flowchart;
|
22755 | var nodeSpacing = conf.nodeSpacing || 50;
|
22756 | var rankSpacing = conf.rankSpacing || 50;
|
22757 | var securityLevel = (0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().securityLevel; // Handle root and document for when rendering in sandbox mode
|
22758 |
|
22759 | var sandboxElement;
|
22760 |
|
22761 | if (securityLevel === 'sandbox') {
|
22762 | sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#i' + id);
|
22763 | }
|
22764 |
|
22765 | var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('body');
|
22766 | var doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; // Create the input mermaid.graph
|
22767 |
|
22768 | var g = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
|
22769 | multigraph: true,
|
22770 | compound: true
|
22771 | }).setGraph({
|
22772 | rankdir: dir,
|
22773 | nodesep: nodeSpacing,
|
22774 | ranksep: rankSpacing,
|
22775 | marginx: 8,
|
22776 | marginy: 8
|
22777 | }).setDefaultEdgeLabel(function () {
|
22778 | return {};
|
22779 | });
|
22780 | var subG;
|
22781 | var subGraphs = diagObj.db.getSubGraphs();
|
22782 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('Subgraphs - ', subGraphs);
|
22783 |
|
22784 | for (var _i = subGraphs.length - 1; _i >= 0; _i--) {
|
22785 | subG = subGraphs[_i];
|
22786 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('Subgraph - ', subG);
|
22787 | diagObj.db.addVertex(subG.id, subG.title, 'group', undefined, subG.classes, subG.dir);
|
22788 | } // Fetch the vertices/nodes and edges/links from the parsed graph definition
|
22789 |
|
22790 |
|
22791 | var vert = diagObj.db.getVertices();
|
22792 | var edges = diagObj.db.getEdges();
|
22793 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info(edges);
|
22794 | var i = 0;
|
22795 |
|
22796 | for (i = subGraphs.length - 1; i >= 0; i--) {
|
22797 | // for (let i = 0; i < subGraphs.length; i++) {
|
22798 | subG = subGraphs[i];
|
22799 | (0,d3__WEBPACK_IMPORTED_MODULE_1__.selectAll)('cluster').append('text');
|
22800 |
|
22801 | for (var j = 0; j < subG.nodes.length; j++) {
|
22802 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('Setting up subgraphs', subG.nodes[j], subG.id);
|
22803 | g.setParent(subG.nodes[j], subG.id);
|
22804 | }
|
22805 | }
|
22806 |
|
22807 | addVertices(vert, g, id, root, doc, diagObj);
|
22808 | addEdges(edges, g, diagObj); // Add custom shapes
|
22809 | // flowChartShapes.addToRenderV2(addShape);
|
22810 | // Set up an SVG group so that we can translate the final graph.
|
22811 |
|
22812 | var svg = root.select("[id=\"".concat(id, "\"]")); // Adds title and description to the flow chart
|
22813 |
|
22814 | (0,_accessibility__WEBPACK_IMPORTED_MODULE_8__["default"])(diagObj.db, svg, id); // Run the renderer. This is what draws the final graph.
|
22815 |
|
22816 | var element = root.select('#' + id + ' g');
|
22817 | (0,_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_9__.render)(element, g, ['point', 'circle', 'cross'], 'flowchart', id);
|
22818 | (0,_utils__WEBPACK_IMPORTED_MODULE_3__.setupGraphViewbox)(g, svg, conf.diagramPadding, conf.useMaxWidth); // Index nodes
|
22819 |
|
22820 | diagObj.db.indexNodes('subGraph' + i); // Add label rects for non html labels
|
22821 |
|
22822 | if (!conf.htmlLabels) {
|
22823 | var labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
22824 |
|
22825 | for (var k = 0; k < labels.length; k++) {
|
22826 | var label = labels[k]; // Get dimensions of label
|
22827 |
|
22828 | var dim = label.getBBox();
|
22829 | var rect = doc.createElementNS('http://www.w3.org/2000/svg', 'rect');
|
22830 | rect.setAttribute('rx', 0);
|
22831 | rect.setAttribute('ry', 0);
|
22832 | rect.setAttribute('width', dim.width);
|
22833 | rect.setAttribute('height', dim.height);
|
22834 | label.insertBefore(rect, label.firstChild);
|
22835 | }
|
22836 | } // If node has a link, wrap it in an anchor SVG object.
|
22837 |
|
22838 |
|
22839 | var keys = Object.keys(vert);
|
22840 | keys.forEach(function (key) {
|
22841 | var vertex = vert[key];
|
22842 |
|
22843 | if (vertex.link) {
|
22844 | var node = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#' + id + ' [id="' + key + '"]');
|
22845 |
|
22846 | if (node) {
|
22847 | var link = doc.createElementNS('http://www.w3.org/2000/svg', 'a');
|
22848 | link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
|
22849 | link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
|
22850 | link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
|
22851 |
|
22852 | if (securityLevel === 'sandbox') {
|
22853 | link.setAttributeNS('http://www.w3.org/2000/svg', 'target', '_top');
|
22854 | } else if (vertex.linkTarget) {
|
22855 | link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);
|
22856 | }
|
22857 |
|
22858 | var linkNode = node.insert(function () {
|
22859 | return link;
|
22860 | }, ':first-child');
|
22861 | var shape = node.select('.label-container');
|
22862 |
|
22863 | if (shape) {
|
22864 | linkNode.append(function () {
|
22865 | return shape.node();
|
22866 | });
|
22867 | }
|
22868 |
|
22869 | var _label = node.select('.label');
|
22870 |
|
22871 | if (_label) {
|
22872 | linkNode.append(function () {
|
22873 | return _label.node();
|
22874 | });
|
22875 | }
|
22876 | }
|
22877 | }
|
22878 | });
|
22879 | };
|
22880 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
22881 | setConf: setConf,
|
22882 | addVertices: addVertices,
|
22883 | addEdges: addEdges,
|
22884 | getClasses: getClasses,
|
22885 | draw: draw
|
22886 | });
|
22887 |
|
22888 | /***/ }),
|
22889 |
|
22890 | /***/ "./src/diagrams/flowchart/flowRenderer.js":
|
22891 | /*!************************************************!*\
|
22892 | !*** ./src/diagrams/flowchart/flowRenderer.js ***!
|
22893 | \************************************************/
|
22894 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
22895 |
|
22896 | "use strict";
|
22897 | __webpack_require__.r(__webpack_exports__);
|
22898 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
22899 | /* harmony export */ "addEdges": () => (/* binding */ addEdges),
|
22900 | /* harmony export */ "addVertices": () => (/* binding */ addVertices),
|
22901 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
22902 | /* harmony export */ "draw": () => (/* binding */ draw),
|
22903 | /* harmony export */ "getClasses": () => (/* binding */ getClasses),
|
22904 | /* harmony export */ "setConf": () => (/* binding */ setConf)
|
22905 | /* harmony export */ });
|
22906 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
|
22907 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
|
22908 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
|
22909 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
|
22910 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
22911 | /* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dagre-d3 */ "dagre-d3");
|
22912 | /* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(dagre_d3__WEBPACK_IMPORTED_MODULE_2__);
|
22913 | /* harmony import */ var dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dagre-d3/lib/label/add-html-label.js */ "dagre-d3/lib/label/add-html-label.js");
|
22914 | /* harmony import */ var dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_3__);
|
22915 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
22916 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
22917 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
22918 | /* harmony import */ var _flowChartShapes__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./flowChartShapes */ "./src/diagrams/flowchart/flowChartShapes.js");
|
22919 | /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js");
|
22920 |
|
22921 |
|
22922 |
|
22923 |
|
22924 |
|
22925 |
|
22926 |
|
22927 |
|
22928 |
|
22929 |
|
22930 | var conf = {};
|
22931 | var setConf = function setConf(cnf) {
|
22932 | var keys = Object.keys(cnf);
|
22933 |
|
22934 | for (var i = 0; i < keys.length; i++) {
|
22935 | conf[keys[i]] = cnf[keys[i]];
|
22936 | }
|
22937 | };
|
22938 | /**
|
22939 | * Function that adds the vertices found in the graph definition to the graph to be rendered.
|
22940 | *
|
22941 | * @param vert Object containing the vertices.
|
22942 | * @param g The graph that is to be drawn.
|
22943 | * @param svgId
|
22944 | * @param root
|
22945 | * @param doc
|
22946 | * @param _doc
|
22947 | * @param diagObj
|
22948 | */
|
22949 |
|
22950 | var addVertices = function addVertices(vert, g, svgId, root, _doc, diagObj) {
|
22951 | var securityLevel = (0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().securityLevel;
|
22952 | var svg = !root ? (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)("[id=\"".concat(svgId, "\"]")) : root.select("[id=\"".concat(svgId, "\"]"));
|
22953 | var doc = !_doc ? document : _doc;
|
22954 | var keys = Object.keys(vert); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
|
22955 |
|
22956 | keys.forEach(function (id) {
|
22957 | var vertex = vert[id];
|
22958 | /**
|
22959 | * Variable for storing the classes for the vertex
|
22960 | *
|
22961 | * @type {string}
|
22962 | */
|
22963 |
|
22964 | var classStr = 'default';
|
22965 |
|
22966 | if (vertex.classes.length > 0) {
|
22967 | classStr = vertex.classes.join(' ');
|
22968 | }
|
22969 |
|
22970 | var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getStylesFromArray)(vertex.styles); // Use vertex id as text in the box if no text is provided by the graph definition
|
22971 |
|
22972 | var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
|
22973 |
|
22974 | var vertexNode;
|
22975 |
|
22976 | if ((0,_common_common__WEBPACK_IMPORTED_MODULE_6__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels)) {
|
22977 | // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
|
22978 | var node = {
|
22979 | label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
|
22980 | return "<i class='".concat(s.replace(':', ' '), "'></i>");
|
22981 | })
|
22982 | };
|
22983 | vertexNode = dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_3___default()(svg, node).node();
|
22984 | vertexNode.parentNode.removeChild(vertexNode);
|
22985 | } else {
|
22986 | var svgLabel = doc.createElementNS('http://www.w3.org/2000/svg', 'text');
|
22987 | svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
|
22988 | var rows = vertexText.split(_common_common__WEBPACK_IMPORTED_MODULE_6__["default"].lineBreakRegex);
|
22989 |
|
22990 | for (var j = 0; j < rows.length; j++) {
|
22991 | var tspan = doc.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
22992 | tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
22993 | tspan.setAttribute('dy', '1em');
|
22994 | tspan.setAttribute('x', '1');
|
22995 | tspan.textContent = rows[j];
|
22996 | svgLabel.appendChild(tspan);
|
22997 | }
|
22998 |
|
22999 | vertexNode = svgLabel;
|
23000 | }
|
23001 |
|
23002 | var radious = 0;
|
23003 | var _shape = ''; // Set the shape based parameters
|
23004 |
|
23005 | switch (vertex.type) {
|
23006 | case 'round':
|
23007 | radious = 5;
|
23008 | _shape = 'rect';
|
23009 | break;
|
23010 |
|
23011 | case 'square':
|
23012 | _shape = 'rect';
|
23013 | break;
|
23014 |
|
23015 | case 'diamond':
|
23016 | _shape = 'question';
|
23017 | break;
|
23018 |
|
23019 | case 'hexagon':
|
23020 | _shape = 'hexagon';
|
23021 | break;
|
23022 |
|
23023 | case 'odd':
|
23024 | _shape = 'rect_left_inv_arrow';
|
23025 | break;
|
23026 |
|
23027 | case 'lean_right':
|
23028 | _shape = 'lean_right';
|
23029 | break;
|
23030 |
|
23031 | case 'lean_left':
|
23032 | _shape = 'lean_left';
|
23033 | break;
|
23034 |
|
23035 | case 'trapezoid':
|
23036 | _shape = 'trapezoid';
|
23037 | break;
|
23038 |
|
23039 | case 'inv_trapezoid':
|
23040 | _shape = 'inv_trapezoid';
|
23041 | break;
|
23042 |
|
23043 | case 'odd_right':
|
23044 | _shape = 'rect_left_inv_arrow';
|
23045 | break;
|
23046 |
|
23047 | case 'circle':
|
23048 | _shape = 'circle';
|
23049 | break;
|
23050 |
|
23051 | case 'ellipse':
|
23052 | _shape = 'ellipse';
|
23053 | break;
|
23054 |
|
23055 | case 'stadium':
|
23056 | _shape = 'stadium';
|
23057 | break;
|
23058 |
|
23059 | case 'subroutine':
|
23060 | _shape = 'subroutine';
|
23061 | break;
|
23062 |
|
23063 | case 'cylinder':
|
23064 | _shape = 'cylinder';
|
23065 | break;
|
23066 |
|
23067 | case 'group':
|
23068 | _shape = 'rect';
|
23069 | break;
|
23070 |
|
23071 | default:
|
23072 | _shape = 'rect';
|
23073 | } // Add the node
|
23074 |
|
23075 |
|
23076 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.warn('Adding node', vertex.id, vertex.domId);
|
23077 | g.setNode(diagObj.db.lookUpDomId(vertex.id), {
|
23078 | labelType: 'svg',
|
23079 | labelStyle: styles.labelStyle,
|
23080 | shape: _shape,
|
23081 | label: vertexNode,
|
23082 | rx: radious,
|
23083 | ry: radious,
|
23084 | class: classStr,
|
23085 | style: styles.style,
|
23086 | id: diagObj.db.lookUpDomId(vertex.id)
|
23087 | });
|
23088 | });
|
23089 | };
|
23090 | /**
|
23091 | * Add edges to graph based on parsed graph definition
|
23092 | *
|
23093 | * @param {object} edges The edges to add to the graph
|
23094 | * @param {object} g The graph object
|
23095 | * @param diagObj
|
23096 | */
|
23097 |
|
23098 | var addEdges = function addEdges(edges, g, diagObj) {
|
23099 | var cnt = 0;
|
23100 | var defaultStyle;
|
23101 | var defaultLabelStyle;
|
23102 |
|
23103 | if (typeof edges.defaultStyle !== 'undefined') {
|
23104 | var defaultStyles = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getStylesFromArray)(edges.defaultStyle);
|
23105 | defaultStyle = defaultStyles.style;
|
23106 | defaultLabelStyle = defaultStyles.labelStyle;
|
23107 | }
|
23108 |
|
23109 | edges.forEach(function (edge) {
|
23110 | cnt++; // Identify Link
|
23111 |
|
23112 | var linkId = 'L-' + edge.start + '-' + edge.end;
|
23113 | var linkNameStart = 'LS-' + edge.start;
|
23114 | var linkNameEnd = 'LE-' + edge.end;
|
23115 | var edgeData = {}; // Set link type for rendering
|
23116 |
|
23117 | if (edge.type === 'arrow_open') {
|
23118 | edgeData.arrowhead = 'none';
|
23119 | } else {
|
23120 | edgeData.arrowhead = 'normal';
|
23121 | }
|
23122 |
|
23123 | var style = '';
|
23124 | var labelStyle = '';
|
23125 |
|
23126 | if (typeof edge.style !== 'undefined') {
|
23127 | var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getStylesFromArray)(edge.style);
|
23128 | style = styles.style;
|
23129 | labelStyle = styles.labelStyle;
|
23130 | } else {
|
23131 | switch (edge.stroke) {
|
23132 | case 'normal':
|
23133 | style = 'fill:none';
|
23134 |
|
23135 | if (typeof defaultStyle !== 'undefined') {
|
23136 | style = defaultStyle;
|
23137 | }
|
23138 |
|
23139 | if (typeof defaultLabelStyle !== 'undefined') {
|
23140 | labelStyle = defaultLabelStyle;
|
23141 | }
|
23142 |
|
23143 | break;
|
23144 |
|
23145 | case 'dotted':
|
23146 | style = 'fill:none;stroke-width:2px;stroke-dasharray:3;';
|
23147 | break;
|
23148 |
|
23149 | case 'thick':
|
23150 | style = ' stroke-width: 3.5px;fill:none';
|
23151 | break;
|
23152 | }
|
23153 | }
|
23154 |
|
23155 | edgeData.style = style;
|
23156 | edgeData.labelStyle = labelStyle;
|
23157 |
|
23158 | if (typeof edge.interpolate !== 'undefined') {
|
23159 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.interpolateToCurve)(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
|
23160 | } else if (typeof edges.defaultInterpolate !== 'undefined') {
|
23161 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.interpolateToCurve)(edges.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
|
23162 | } else {
|
23163 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.interpolateToCurve)(conf.curve, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
|
23164 | }
|
23165 |
|
23166 | if (typeof edge.text === 'undefined') {
|
23167 | if (typeof edge.style !== 'undefined') {
|
23168 | edgeData.arrowheadStyle = 'fill: #333';
|
23169 | }
|
23170 | } else {
|
23171 | edgeData.arrowheadStyle = 'fill: #333';
|
23172 | edgeData.labelpos = 'c';
|
23173 |
|
23174 | if ((0,_common_common__WEBPACK_IMPORTED_MODULE_6__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels)) {
|
23175 | edgeData.labelType = 'html';
|
23176 | edgeData.label = "<span id=\"L-".concat(linkId, "\" class=\"edgeLabel L-").concat(linkNameStart, "' L-").concat(linkNameEnd, "\" style=\"").concat(edgeData.labelStyle, "\">").concat(edge.text.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
|
23177 | return "<i class='".concat(s.replace(':', ' '), "'></i>");
|
23178 | }), "</span>");
|
23179 | } else {
|
23180 | edgeData.labelType = 'text';
|
23181 | edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_6__["default"].lineBreakRegex, '\n');
|
23182 |
|
23183 | if (typeof edge.style === 'undefined') {
|
23184 | edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
|
23185 | }
|
23186 |
|
23187 | edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
|
23188 | }
|
23189 | }
|
23190 |
|
23191 | edgeData.id = linkId;
|
23192 | edgeData.class = linkNameStart + ' ' + linkNameEnd;
|
23193 | edgeData.minlen = edge.length || 1; // Add the edge to the graph
|
23194 |
|
23195 | g.setEdge(diagObj.db.lookUpDomId(edge.start), diagObj.db.lookUpDomId(edge.end), edgeData, cnt);
|
23196 | });
|
23197 | };
|
23198 | /**
|
23199 | * Returns the all the styles from classDef statements in the graph definition.
|
23200 | *
|
23201 | * @param text
|
23202 | * @param diagObj
|
23203 | * @returns {object} ClassDef styles
|
23204 | */
|
23205 |
|
23206 | var getClasses = function getClasses(text, diagObj) {
|
23207 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Extracting classes');
|
23208 | diagObj.db.clear();
|
23209 |
|
23210 | try {
|
23211 | // Parse the graph definition
|
23212 | diagObj.parse(text);
|
23213 | return diagObj.db.getClasses();
|
23214 | } catch (e) {
|
23215 | return;
|
23216 | }
|
23217 | };
|
23218 | /**
|
23219 | * Draws a flowchart in the tag with id: id based on the graph definition in text.
|
23220 | *
|
23221 | * @param text
|
23222 | * @param id
|
23223 | * @param _version
|
23224 | * @param diagObj
|
23225 | */
|
23226 |
|
23227 | var draw = function draw(text, id, _version, diagObj) {
|
23228 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Drawing flowchart');
|
23229 | diagObj.db.clear();
|
23230 | var securityLevel = (0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().securityLevel;
|
23231 | var sandboxElement;
|
23232 |
|
23233 | if (securityLevel === 'sandbox') {
|
23234 | sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#i' + id);
|
23235 | }
|
23236 |
|
23237 | var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('body');
|
23238 | var doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; // Parse the graph definition
|
23239 |
|
23240 | try {
|
23241 | diagObj.parser.parse(text);
|
23242 | } catch (err) {
|
23243 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.debug('Parsing failed');
|
23244 | } // Fetch the default direction, use TD if none was found
|
23245 |
|
23246 |
|
23247 | var dir = diagObj.db.getDirection();
|
23248 |
|
23249 | if (typeof dir === 'undefined') {
|
23250 | dir = 'TD';
|
23251 | }
|
23252 |
|
23253 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart;
|
23254 | var nodeSpacing = conf.nodeSpacing || 50;
|
23255 | var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
|
23256 |
|
23257 | var g = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
|
23258 | multigraph: true,
|
23259 | compound: true
|
23260 | }).setGraph({
|
23261 | rankdir: dir,
|
23262 | nodesep: nodeSpacing,
|
23263 | ranksep: rankSpacing,
|
23264 | marginx: 8,
|
23265 | marginy: 8
|
23266 | }).setDefaultEdgeLabel(function () {
|
23267 | return {};
|
23268 | });
|
23269 | var subG;
|
23270 | var subGraphs = diagObj.db.getSubGraphs();
|
23271 |
|
23272 | for (var _i = subGraphs.length - 1; _i >= 0; _i--) {
|
23273 | subG = subGraphs[_i];
|
23274 | diagObj.db.addVertex(subG.id, subG.title, 'group', undefined, subG.classes);
|
23275 | } // Fetch the vertices/nodes and edges/links from the parsed graph definition
|
23276 |
|
23277 |
|
23278 | var vert = diagObj.db.getVertices();
|
23279 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.warn('Get vertices', vert);
|
23280 | var edges = diagObj.db.getEdges();
|
23281 | var i = 0;
|
23282 |
|
23283 | for (i = subGraphs.length - 1; i >= 0; i--) {
|
23284 | subG = subGraphs[i];
|
23285 | (0,d3__WEBPACK_IMPORTED_MODULE_1__.selectAll)('cluster').append('text');
|
23286 |
|
23287 | for (var j = 0; j < subG.nodes.length; j++) {
|
23288 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.warn('Setting subgraph', subG.nodes[j], diagObj.db.lookUpDomId(subG.nodes[j]), diagObj.db.lookUpDomId(subG.id));
|
23289 | g.setParent(diagObj.db.lookUpDomId(subG.nodes[j]), diagObj.db.lookUpDomId(subG.id));
|
23290 | }
|
23291 | }
|
23292 |
|
23293 | addVertices(vert, g, id, root, doc, diagObj);
|
23294 | addEdges(edges, g, diagObj); // Create the renderer
|
23295 |
|
23296 | var Render = (dagre_d3__WEBPACK_IMPORTED_MODULE_2___default().render);
|
23297 | var render = new Render(); // Add custom shapes
|
23298 |
|
23299 | _flowChartShapes__WEBPACK_IMPORTED_MODULE_8__["default"].addToRender(render); // Add our custom arrow - an empty arrowhead
|
23300 |
|
23301 | render.arrows().none = function normal(parent, id, edge, type) {
|
23302 | var marker = parent.append('marker').attr('id', id).attr('viewBox', '0 0 10 10').attr('refX', 9).attr('refY', 5).attr('markerUnits', 'strokeWidth').attr('markerWidth', 8).attr('markerHeight', 6).attr('orient', 'auto');
|
23303 | var path = marker.append('path').attr('d', 'M 0 0 L 0 0 L 0 0 z');
|
23304 | dagre_d3__WEBPACK_IMPORTED_MODULE_2___default().util.applyStyle(path, edge[type + 'Style']);
|
23305 | }; // Override normal arrowhead defined in d3. Remove style & add class to allow css styling.
|
23306 |
|
23307 |
|
23308 | render.arrows().normal = function normal(parent, id) {
|
23309 | var marker = parent.append('marker').attr('id', id).attr('viewBox', '0 0 10 10').attr('refX', 9).attr('refY', 5).attr('markerUnits', 'strokeWidth').attr('markerWidth', 8).attr('markerHeight', 6).attr('orient', 'auto');
|
23310 | marker.append('path').attr('d', 'M 0 0 L 10 5 L 0 10 z').attr('class', 'arrowheadPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
|
23311 | }; // Set up an SVG group so that we can translate the final graph.
|
23312 |
|
23313 |
|
23314 | var svg = root.select("[id=\"".concat(id, "\"]")); // Adds title and description to the flow chart
|
23315 |
|
23316 | (0,_accessibility__WEBPACK_IMPORTED_MODULE_9__["default"])(diagObj.db, svg, id); // Run the renderer. This is what draws the final graph.
|
23317 |
|
23318 | var element = root.select('#' + id + ' g');
|
23319 | render(element, g);
|
23320 | element.selectAll('g.node').attr('title', function () {
|
23321 | return diagObj.db.getTooltip(this.id);
|
23322 | }); // Index nodes
|
23323 |
|
23324 | diagObj.db.indexNodes('subGraph' + i); // reposition labels
|
23325 |
|
23326 | for (i = 0; i < subGraphs.length; i++) {
|
23327 | subG = subGraphs[i];
|
23328 |
|
23329 | if (subG.title !== 'undefined') {
|
23330 | var clusterRects = doc.querySelectorAll('#' + id + ' [id="' + diagObj.db.lookUpDomId(subG.id) + '"] rect');
|
23331 | var clusterEl = doc.querySelectorAll('#' + id + ' [id="' + diagObj.db.lookUpDomId(subG.id) + '"]');
|
23332 | var xPos = clusterRects[0].x.baseVal.value;
|
23333 | var yPos = clusterRects[0].y.baseVal.value;
|
23334 | var _width = clusterRects[0].width.baseVal.value;
|
23335 | var cluster = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)(clusterEl[0]);
|
23336 | var te = cluster.select('.label');
|
23337 | te.attr('transform', "translate(".concat(xPos + _width / 2, ", ").concat(yPos + 14, ")"));
|
23338 | te.attr('id', id + 'Text');
|
23339 |
|
23340 | for (var _j = 0; _j < subG.classes.length; _j++) {
|
23341 | clusterEl[0].classList.add(subG.classes[_j]);
|
23342 | }
|
23343 | }
|
23344 | } // Add label rects for non html labels
|
23345 |
|
23346 |
|
23347 | if (!(0,_common_common__WEBPACK_IMPORTED_MODULE_6__.evaluate)(conf.htmlLabels) || true) {
|
23348 | // eslint-disable-line
|
23349 | var labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
23350 |
|
23351 | for (var k = 0; k < labels.length; k++) {
|
23352 | var label = labels[k]; // Get dimensions of label
|
23353 |
|
23354 | var dim = label.getBBox();
|
23355 | var rect = doc.createElementNS('http://www.w3.org/2000/svg', 'rect');
|
23356 | rect.setAttribute('rx', 0);
|
23357 | rect.setAttribute('ry', 0);
|
23358 | rect.setAttribute('width', dim.width);
|
23359 | rect.setAttribute('height', dim.height); // rect.setAttribute('style', 'fill:#e8e8e8;');
|
23360 |
|
23361 | label.insertBefore(rect, label.firstChild);
|
23362 | }
|
23363 | }
|
23364 |
|
23365 | (0,_utils__WEBPACK_IMPORTED_MODULE_5__.setupGraphViewbox)(g, svg, conf.diagramPadding, conf.useMaxWidth); // If node has a link, wrap it in an anchor SVG object.
|
23366 |
|
23367 | var keys = Object.keys(vert);
|
23368 | keys.forEach(function (key) {
|
23369 | var vertex = vert[key];
|
23370 |
|
23371 | if (vertex.link) {
|
23372 | var node = root.select('#' + id + ' [id="' + diagObj.db.lookUpDomId(key) + '"]');
|
23373 |
|
23374 | if (node) {
|
23375 | var link = doc.createElementNS('http://www.w3.org/2000/svg', 'a');
|
23376 | link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
|
23377 | link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
|
23378 | link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
|
23379 |
|
23380 | if (securityLevel === 'sandbox') {
|
23381 | link.setAttributeNS('http://www.w3.org/2000/svg', 'target', '_top');
|
23382 | } else if (vertex.linkTarget) {
|
23383 | link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);
|
23384 | }
|
23385 |
|
23386 | var linkNode = node.insert(function () {
|
23387 | return link;
|
23388 | }, ':first-child');
|
23389 | var shape = node.select('.label-container');
|
23390 |
|
23391 | if (shape) {
|
23392 | linkNode.append(function () {
|
23393 | return shape.node();
|
23394 | });
|
23395 | }
|
23396 |
|
23397 | var _label = node.select('.label');
|
23398 |
|
23399 | if (_label) {
|
23400 | linkNode.append(function () {
|
23401 | return _label.node();
|
23402 | });
|
23403 | }
|
23404 | }
|
23405 | }
|
23406 | });
|
23407 | };
|
23408 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
23409 | setConf: setConf,
|
23410 | addVertices: addVertices,
|
23411 | addEdges: addEdges,
|
23412 | getClasses: getClasses,
|
23413 | draw: draw
|
23414 | });
|
23415 |
|
23416 | /***/ }),
|
23417 |
|
23418 | /***/ "./src/diagrams/flowchart/styles.js":
|
23419 | /*!******************************************!*\
|
23420 | !*** ./src/diagrams/flowchart/styles.js ***!
|
23421 | \******************************************/
|
23422 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
23423 |
|
23424 | "use strict";
|
23425 | __webpack_require__.r(__webpack_exports__);
|
23426 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
23427 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
23428 | /* harmony export */ });
|
23429 | /**
|
23430 | * Returns the styles given options
|
23431 | *
|
23432 | * @param {{
|
23433 | * fontFamily: string;
|
23434 | * nodeTextColor: string;
|
23435 | * textColor: string;
|
23436 | * titleColor: string;
|
23437 | * mainBkg: string;
|
23438 | * nodeBorder: string;
|
23439 | * arrowheadColor: string;
|
23440 | * lineColor: string;
|
23441 | * edgeLabelBackground: string;
|
23442 | * clusterBkg: string;
|
23443 | * clusterBorder: string;
|
23444 | * tertiaryColor: string;
|
23445 | * border2: string;
|
23446 | * }} options
|
23447 | * The options for the styles
|
23448 | * @returns {string} The resulting styles
|
23449 | */
|
23450 | var getStyles = function getStyles(options) {
|
23451 | return ".label {\n font-family: ".concat(options.fontFamily, ";\n color: ").concat(options.nodeTextColor || options.textColor, ";\n }\n .cluster-label text {\n fill: ").concat(options.titleColor, ";\n }\n .cluster-label span {\n color: ").concat(options.titleColor, ";\n }\n\n .label text,span {\n fill: ").concat(options.nodeTextColor || options.textColor, ";\n color: ").concat(options.nodeTextColor || options.textColor, ";\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ").concat(options.arrowheadColor, ";\n }\n\n .edgePath .path {\n stroke: ").concat(options.lineColor, ";\n stroke-width: 2.0px;\n }\n\n .flowchart-link {\n stroke: ").concat(options.lineColor, ";\n fill: none;\n }\n\n .edgeLabel {\n background-color: ").concat(options.edgeLabelBackground, ";\n rect {\n opacity: 0.5;\n background-color: ").concat(options.edgeLabelBackground, ";\n fill: ").concat(options.edgeLabelBackground, ";\n }\n text-align: center;\n }\n\n .cluster rect {\n fill: ").concat(options.clusterBkg, ";\n stroke: ").concat(options.clusterBorder, ";\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ").concat(options.titleColor, ";\n }\n\n .cluster span {\n color: ").concat(options.titleColor, ";\n }\n /* .cluster div {\n color: ").concat(options.titleColor, ";\n } */\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ").concat(options.fontFamily, ";\n font-size: 12px;\n background: ").concat(options.tertiaryColor, ";\n border: 1px solid ").concat(options.border2, ";\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n");
|
23452 | };
|
23453 |
|
23454 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
23455 |
|
23456 | /***/ }),
|
23457 |
|
23458 | /***/ "./src/diagrams/gantt/ganttDb.js":
|
23459 | /*!***************************************!*\
|
23460 | !*** ./src/diagrams/gantt/ganttDb.js ***!
|
23461 | \***************************************/
|
23462 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
23463 |
|
23464 | "use strict";
|
23465 | __webpack_require__.r(__webpack_exports__);
|
23466 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
23467 | /* harmony export */ "addSection": () => (/* binding */ addSection),
|
23468 | /* harmony export */ "addTask": () => (/* binding */ addTask),
|
23469 | /* harmony export */ "addTaskOrg": () => (/* binding */ addTaskOrg),
|
23470 | /* harmony export */ "bindFunctions": () => (/* binding */ bindFunctions),
|
23471 | /* harmony export */ "clear": () => (/* binding */ clear),
|
23472 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
23473 | /* harmony export */ "enableInclusiveEndDates": () => (/* binding */ enableInclusiveEndDates),
|
23474 | /* harmony export */ "enableTopAxis": () => (/* binding */ enableTopAxis),
|
23475 | /* harmony export */ "endDatesAreInclusive": () => (/* binding */ endDatesAreInclusive),
|
23476 | /* harmony export */ "findTaskById": () => (/* binding */ findTaskById),
|
23477 | /* harmony export */ "getAxisFormat": () => (/* binding */ getAxisFormat),
|
23478 | /* harmony export */ "getDateFormat": () => (/* binding */ getDateFormat),
|
23479 | /* harmony export */ "getExcludes": () => (/* binding */ getExcludes),
|
23480 | /* harmony export */ "getIncludes": () => (/* binding */ getIncludes),
|
23481 | /* harmony export */ "getLinks": () => (/* binding */ getLinks),
|
23482 | /* harmony export */ "getSections": () => (/* binding */ getSections),
|
23483 | /* harmony export */ "getTasks": () => (/* binding */ getTasks),
|
23484 | /* harmony export */ "getTodayMarker": () => (/* binding */ getTodayMarker),
|
23485 | /* harmony export */ "isInvalidDate": () => (/* binding */ isInvalidDate),
|
23486 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
23487 | /* harmony export */ "setAxisFormat": () => (/* binding */ setAxisFormat),
|
23488 | /* harmony export */ "setClass": () => (/* binding */ setClass),
|
23489 | /* harmony export */ "setClickEvent": () => (/* binding */ setClickEvent),
|
23490 | /* harmony export */ "setDateFormat": () => (/* binding */ setDateFormat),
|
23491 | /* harmony export */ "setExcludes": () => (/* binding */ setExcludes),
|
23492 | /* harmony export */ "setIncludes": () => (/* binding */ setIncludes),
|
23493 | /* harmony export */ "setLink": () => (/* binding */ setLink),
|
23494 | /* harmony export */ "setTodayMarker": () => (/* binding */ setTodayMarker),
|
23495 | /* harmony export */ "topAxisEnabled": () => (/* binding */ topAxisEnabled)
|
23496 | /* harmony export */ });
|
23497 | /* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment-mini */ "moment-mini");
|
23498 | /* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_mini__WEBPACK_IMPORTED_MODULE_0__);
|
23499 | /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @braintree/sanitize-url */ "@braintree/sanitize-url");
|
23500 | /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__);
|
23501 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
23502 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
23503 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
23504 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
23505 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
23506 | /* harmony import */ var _commonDb__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../commonDb */ "./src/commonDb.js");
|
23507 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
23508 |
|
23509 | function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
23510 |
|
23511 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
23512 |
|
23513 | function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
23514 |
|
23515 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
23516 |
|
23517 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
23518 |
|
23519 |
|
23520 |
|
23521 |
|
23522 |
|
23523 |
|
23524 |
|
23525 |
|
23526 |
|
23527 | var dateFormat = '';
|
23528 | var axisFormat = '';
|
23529 | var todayMarker = '';
|
23530 | var includes = [];
|
23531 | var excludes = [];
|
23532 | var links = {};
|
23533 | var title = '';
|
23534 | var accDescription = '';
|
23535 | var sections = [];
|
23536 | var tasks = [];
|
23537 | var currentSection = '';
|
23538 | var tags = ['active', 'done', 'crit', 'milestone'];
|
23539 | var funs = [];
|
23540 | var inclusiveEndDates = false;
|
23541 | var topAxis = false; // The serial order of the task in the script
|
23542 |
|
23543 | var lastOrder = 0;
|
23544 |
|
23545 | var sanitizeText = function sanitizeText(txt) {
|
23546 | return _common_common__WEBPACK_IMPORTED_MODULE_2__["default"].sanitizeText(txt, _config__WEBPACK_IMPORTED_MODULE_3__.getConfig());
|
23547 | };
|
23548 |
|
23549 | var parseDirective = function parseDirective(statement, context, type) {
|
23550 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_4__["default"].parseDirective(this, statement, context, type);
|
23551 | };
|
23552 | var clear = function clear() {
|
23553 | sections = [];
|
23554 | tasks = [];
|
23555 | currentSection = '';
|
23556 | funs = [];
|
23557 | title = '';
|
23558 | taskCnt = 0;
|
23559 | lastTask = undefined;
|
23560 | lastTaskID = undefined;
|
23561 | rawTasks = [];
|
23562 | dateFormat = '';
|
23563 | axisFormat = '';
|
23564 | todayMarker = '';
|
23565 | includes = [];
|
23566 | excludes = [];
|
23567 | inclusiveEndDates = false;
|
23568 | topAxis = false;
|
23569 | lastOrder = 0;
|
23570 | links = {};
|
23571 | (0,_commonDb__WEBPACK_IMPORTED_MODULE_5__.clear)();
|
23572 | };
|
23573 | var setAxisFormat = function setAxisFormat(txt) {
|
23574 | axisFormat = txt;
|
23575 | };
|
23576 | var getAxisFormat = function getAxisFormat() {
|
23577 | return axisFormat;
|
23578 | };
|
23579 | var setTodayMarker = function setTodayMarker(txt) {
|
23580 | todayMarker = txt;
|
23581 | };
|
23582 | var getTodayMarker = function getTodayMarker() {
|
23583 | return todayMarker;
|
23584 | };
|
23585 | var setDateFormat = function setDateFormat(txt) {
|
23586 | dateFormat = txt;
|
23587 | };
|
23588 | var enableInclusiveEndDates = function enableInclusiveEndDates() {
|
23589 | inclusiveEndDates = true;
|
23590 | };
|
23591 | var endDatesAreInclusive = function endDatesAreInclusive() {
|
23592 | return inclusiveEndDates;
|
23593 | };
|
23594 | var enableTopAxis = function enableTopAxis() {
|
23595 | topAxis = true;
|
23596 | };
|
23597 | var topAxisEnabled = function topAxisEnabled() {
|
23598 | return topAxis;
|
23599 | };
|
23600 | var getDateFormat = function getDateFormat() {
|
23601 | return dateFormat;
|
23602 | };
|
23603 | var setIncludes = function setIncludes(txt) {
|
23604 | includes = txt.toLowerCase().split(/[\s,]+/);
|
23605 | };
|
23606 | var getIncludes = function getIncludes() {
|
23607 | return includes;
|
23608 | };
|
23609 | var setExcludes = function setExcludes(txt) {
|
23610 | excludes = txt.toLowerCase().split(/[\s,]+/);
|
23611 | };
|
23612 | var getExcludes = function getExcludes() {
|
23613 | return excludes;
|
23614 | };
|
23615 | var getLinks = function getLinks() {
|
23616 | return links;
|
23617 | };
|
23618 | var addSection = function addSection(txt) {
|
23619 | currentSection = txt;
|
23620 | sections.push(txt);
|
23621 | };
|
23622 | var getSections = function getSections() {
|
23623 | return sections;
|
23624 | };
|
23625 | var getTasks = function getTasks() {
|
23626 | var allItemsPricessed = compileTasks();
|
23627 | var maxDepth = 10;
|
23628 | var iterationCount = 0;
|
23629 |
|
23630 | while (!allItemsPricessed && iterationCount < maxDepth) {
|
23631 | allItemsPricessed = compileTasks();
|
23632 | iterationCount++;
|
23633 | }
|
23634 |
|
23635 | tasks = rawTasks;
|
23636 | return tasks;
|
23637 | };
|
23638 | var isInvalidDate = function isInvalidDate(date, dateFormat, excludes, includes) {
|
23639 | if (includes.indexOf(date.format(dateFormat.trim())) >= 0) {
|
23640 | return false;
|
23641 | }
|
23642 |
|
23643 | if (date.isoWeekday() >= 6 && excludes.indexOf('weekends') >= 0) {
|
23644 | return true;
|
23645 | }
|
23646 |
|
23647 | if (excludes.indexOf(date.format('dddd').toLowerCase()) >= 0) {
|
23648 | return true;
|
23649 | }
|
23650 |
|
23651 | return excludes.indexOf(date.format(dateFormat.trim())) >= 0;
|
23652 | };
|
23653 |
|
23654 | var checkTaskDates = function checkTaskDates(task, dateFormat, excludes, includes) {
|
23655 | if (!excludes.length || task.manualEndTime) return;
|
23656 | var startTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(task.startTime, dateFormat, true);
|
23657 | startTime.add(1, 'd');
|
23658 | var endTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(task.endTime, dateFormat, true);
|
23659 | var renderEndTime = fixTaskDates(startTime, endTime, dateFormat, excludes, includes);
|
23660 | task.endTime = endTime.toDate();
|
23661 | task.renderEndTime = renderEndTime;
|
23662 | };
|
23663 |
|
23664 | var fixTaskDates = function fixTaskDates(startTime, endTime, dateFormat, excludes, includes) {
|
23665 | var invalid = false;
|
23666 | var renderEndTime = null;
|
23667 |
|
23668 | while (startTime <= endTime) {
|
23669 | if (!invalid) {
|
23670 | renderEndTime = endTime.toDate();
|
23671 | }
|
23672 |
|
23673 | invalid = isInvalidDate(startTime, dateFormat, excludes, includes);
|
23674 |
|
23675 | if (invalid) {
|
23676 | endTime.add(1, 'd');
|
23677 | }
|
23678 |
|
23679 | startTime.add(1, 'd');
|
23680 | }
|
23681 |
|
23682 | return renderEndTime;
|
23683 | };
|
23684 |
|
23685 | var getStartDate = function getStartDate(prevTime, dateFormat, str) {
|
23686 | str = str.trim(); // Test for after
|
23687 |
|
23688 | var re = /^after\s+([\d\w- ]+)/;
|
23689 | var afterStatement = re.exec(str.trim());
|
23690 |
|
23691 | if (afterStatement !== null) {
|
23692 | // check all after ids and take the latest
|
23693 | var latestEndingTask = null;
|
23694 | afterStatement[1].split(' ').forEach(function (id) {
|
23695 | var task = findTaskById(id);
|
23696 |
|
23697 | if (typeof task !== 'undefined') {
|
23698 | if (!latestEndingTask) {
|
23699 | latestEndingTask = task;
|
23700 | } else {
|
23701 | if (task.endTime > latestEndingTask.endTime) {
|
23702 | latestEndingTask = task;
|
23703 | }
|
23704 | }
|
23705 | }
|
23706 | });
|
23707 |
|
23708 | if (!latestEndingTask) {
|
23709 | var dt = new Date();
|
23710 | dt.setHours(0, 0, 0, 0);
|
23711 | return dt;
|
23712 | } else {
|
23713 | return latestEndingTask.endTime;
|
23714 | }
|
23715 | } // Check for actual date set
|
23716 |
|
23717 |
|
23718 | var mDate = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(str, dateFormat.trim(), true);
|
23719 |
|
23720 | if (mDate.isValid()) {
|
23721 | return mDate.toDate();
|
23722 | } else {
|
23723 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Invalid date:' + str);
|
23724 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('With date format:' + dateFormat.trim());
|
23725 | } // Default date - now
|
23726 |
|
23727 |
|
23728 | return new Date();
|
23729 | };
|
23730 |
|
23731 | var durationToDate = function durationToDate(durationStatement, relativeTime) {
|
23732 | if (durationStatement !== null) {
|
23733 | switch (durationStatement[2]) {
|
23734 | case 's':
|
23735 | relativeTime.add(durationStatement[1], 'seconds');
|
23736 | break;
|
23737 |
|
23738 | case 'm':
|
23739 | relativeTime.add(durationStatement[1], 'minutes');
|
23740 | break;
|
23741 |
|
23742 | case 'h':
|
23743 | relativeTime.add(durationStatement[1], 'hours');
|
23744 | break;
|
23745 |
|
23746 | case 'd':
|
23747 | relativeTime.add(durationStatement[1], 'days');
|
23748 | break;
|
23749 |
|
23750 | case 'w':
|
23751 | relativeTime.add(durationStatement[1], 'weeks');
|
23752 | break;
|
23753 | }
|
23754 | } // Default date - now
|
23755 |
|
23756 |
|
23757 | return relativeTime.toDate();
|
23758 | };
|
23759 |
|
23760 | var getEndDate = function getEndDate(prevTime, dateFormat, str, inclusive) {
|
23761 | inclusive = inclusive || false;
|
23762 | str = str.trim(); // Check for actual date
|
23763 |
|
23764 | var mDate = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(str, dateFormat.trim(), true);
|
23765 |
|
23766 | if (mDate.isValid()) {
|
23767 | if (inclusive) {
|
23768 | mDate.add(1, 'd');
|
23769 | }
|
23770 |
|
23771 | return mDate.toDate();
|
23772 | }
|
23773 |
|
23774 | return durationToDate(/^([\d]+)([wdhms])/.exec(str.trim()), moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(prevTime));
|
23775 | };
|
23776 |
|
23777 | var taskCnt = 0;
|
23778 |
|
23779 | var parseId = function parseId(idStr) {
|
23780 | if (typeof idStr === 'undefined') {
|
23781 | taskCnt = taskCnt + 1;
|
23782 | return 'task' + taskCnt;
|
23783 | }
|
23784 |
|
23785 | return idStr;
|
23786 | }; // id, startDate, endDate
|
23787 | // id, startDate, length
|
23788 | // id, after x, endDate
|
23789 | // id, after x, length
|
23790 | // startDate, endDate
|
23791 | // startDate, length
|
23792 | // after x, endDate
|
23793 | // after x, length
|
23794 | // endDate
|
23795 | // length
|
23796 |
|
23797 |
|
23798 | var compileData = function compileData(prevTask, dataStr) {
|
23799 | var ds;
|
23800 |
|
23801 | if (dataStr.substr(0, 1) === ':') {
|
23802 | ds = dataStr.substr(1, dataStr.length);
|
23803 | } else {
|
23804 | ds = dataStr;
|
23805 | }
|
23806 |
|
23807 | var data = ds.split(',');
|
23808 | var task = {}; // Get tags like active, done, crit and milestone
|
23809 |
|
23810 | getTaskTags(data, task, tags);
|
23811 |
|
23812 | for (var i = 0; i < data.length; i++) {
|
23813 | data[i] = data[i].trim();
|
23814 | }
|
23815 |
|
23816 | var endTimeData = '';
|
23817 |
|
23818 | switch (data.length) {
|
23819 | case 1:
|
23820 | task.id = parseId();
|
23821 | task.startTime = prevTask.endTime;
|
23822 | endTimeData = data[0];
|
23823 | break;
|
23824 |
|
23825 | case 2:
|
23826 | task.id = parseId();
|
23827 | task.startTime = getStartDate(undefined, dateFormat, data[0]);
|
23828 | endTimeData = data[1];
|
23829 | break;
|
23830 |
|
23831 | case 3:
|
23832 | task.id = parseId(data[0]);
|
23833 | task.startTime = getStartDate(undefined, dateFormat, data[1]);
|
23834 | endTimeData = data[2];
|
23835 | break;
|
23836 |
|
23837 | default:
|
23838 | }
|
23839 |
|
23840 | if (endTimeData) {
|
23841 | task.endTime = getEndDate(task.startTime, dateFormat, endTimeData, inclusiveEndDates);
|
23842 | task.manualEndTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(endTimeData, 'YYYY-MM-DD', true).isValid();
|
23843 | checkTaskDates(task, dateFormat, excludes, includes);
|
23844 | }
|
23845 |
|
23846 | return task;
|
23847 | };
|
23848 |
|
23849 | var parseData = function parseData(prevTaskId, dataStr) {
|
23850 | var ds;
|
23851 |
|
23852 | if (dataStr.substr(0, 1) === ':') {
|
23853 | ds = dataStr.substr(1, dataStr.length);
|
23854 | } else {
|
23855 | ds = dataStr;
|
23856 | }
|
23857 |
|
23858 | var data = ds.split(',');
|
23859 | var task = {}; // Get tags like active, done, crit and milestone
|
23860 |
|
23861 | getTaskTags(data, task, tags);
|
23862 |
|
23863 | for (var i = 0; i < data.length; i++) {
|
23864 | data[i] = data[i].trim();
|
23865 | }
|
23866 |
|
23867 | switch (data.length) {
|
23868 | case 1:
|
23869 | task.id = parseId();
|
23870 | task.startTime = {
|
23871 | type: 'prevTaskEnd',
|
23872 | id: prevTaskId
|
23873 | };
|
23874 | task.endTime = {
|
23875 | data: data[0]
|
23876 | };
|
23877 | break;
|
23878 |
|
23879 | case 2:
|
23880 | task.id = parseId();
|
23881 | task.startTime = {
|
23882 | type: 'getStartDate',
|
23883 | startData: data[0]
|
23884 | };
|
23885 | task.endTime = {
|
23886 | data: data[1]
|
23887 | };
|
23888 | break;
|
23889 |
|
23890 | case 3:
|
23891 | task.id = parseId(data[0]);
|
23892 | task.startTime = {
|
23893 | type: 'getStartDate',
|
23894 | startData: data[1]
|
23895 | };
|
23896 | task.endTime = {
|
23897 | data: data[2]
|
23898 | };
|
23899 | break;
|
23900 |
|
23901 | default:
|
23902 | }
|
23903 |
|
23904 | return task;
|
23905 | };
|
23906 |
|
23907 | var lastTask;
|
23908 | var lastTaskID;
|
23909 | var rawTasks = [];
|
23910 | var taskDb = {};
|
23911 | var addTask = function addTask(descr, data) {
|
23912 | var rawTask = {
|
23913 | section: currentSection,
|
23914 | type: currentSection,
|
23915 | processed: false,
|
23916 | manualEndTime: false,
|
23917 | renderEndTime: null,
|
23918 | raw: {
|
23919 | data: data
|
23920 | },
|
23921 | task: descr,
|
23922 | classes: []
|
23923 | };
|
23924 | var taskInfo = parseData(lastTaskID, data);
|
23925 | rawTask.raw.startTime = taskInfo.startTime;
|
23926 | rawTask.raw.endTime = taskInfo.endTime;
|
23927 | rawTask.id = taskInfo.id;
|
23928 | rawTask.prevTaskId = lastTaskID;
|
23929 | rawTask.active = taskInfo.active;
|
23930 | rawTask.done = taskInfo.done;
|
23931 | rawTask.crit = taskInfo.crit;
|
23932 | rawTask.milestone = taskInfo.milestone;
|
23933 | rawTask.order = lastOrder;
|
23934 | lastOrder++;
|
23935 | var pos = rawTasks.push(rawTask);
|
23936 | lastTaskID = rawTask.id; // Store cross ref
|
23937 |
|
23938 | taskDb[rawTask.id] = pos - 1;
|
23939 | };
|
23940 | var findTaskById = function findTaskById(id) {
|
23941 | var pos = taskDb[id];
|
23942 | return rawTasks[pos];
|
23943 | };
|
23944 | var addTaskOrg = function addTaskOrg(descr, data) {
|
23945 | var newTask = {
|
23946 | section: currentSection,
|
23947 | type: currentSection,
|
23948 | description: descr,
|
23949 | task: descr,
|
23950 | classes: []
|
23951 | };
|
23952 | var taskInfo = compileData(lastTask, data);
|
23953 | newTask.startTime = taskInfo.startTime;
|
23954 | newTask.endTime = taskInfo.endTime;
|
23955 | newTask.id = taskInfo.id;
|
23956 | newTask.active = taskInfo.active;
|
23957 | newTask.done = taskInfo.done;
|
23958 | newTask.crit = taskInfo.crit;
|
23959 | newTask.milestone = taskInfo.milestone;
|
23960 | lastTask = newTask;
|
23961 | tasks.push(newTask);
|
23962 | };
|
23963 |
|
23964 | var compileTasks = function compileTasks() {
|
23965 | var compileTask = function compileTask(pos) {
|
23966 | var task = rawTasks[pos];
|
23967 | var startTime = '';
|
23968 |
|
23969 | switch (rawTasks[pos].raw.startTime.type) {
|
23970 | case 'prevTaskEnd':
|
23971 | {
|
23972 | var prevTask = findTaskById(task.prevTaskId);
|
23973 | task.startTime = prevTask.endTime;
|
23974 | break;
|
23975 | }
|
23976 |
|
23977 | case 'getStartDate':
|
23978 | startTime = getStartDate(undefined, dateFormat, rawTasks[pos].raw.startTime.startData);
|
23979 |
|
23980 | if (startTime) {
|
23981 | rawTasks[pos].startTime = startTime;
|
23982 | }
|
23983 |
|
23984 | break;
|
23985 | }
|
23986 |
|
23987 | if (rawTasks[pos].startTime) {
|
23988 | rawTasks[pos].endTime = getEndDate(rawTasks[pos].startTime, dateFormat, rawTasks[pos].raw.endTime.data, inclusiveEndDates);
|
23989 |
|
23990 | if (rawTasks[pos].endTime) {
|
23991 | rawTasks[pos].processed = true;
|
23992 | rawTasks[pos].manualEndTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(rawTasks[pos].raw.endTime.data, 'YYYY-MM-DD', true).isValid();
|
23993 | checkTaskDates(rawTasks[pos], dateFormat, excludes, includes);
|
23994 | }
|
23995 | }
|
23996 |
|
23997 | return rawTasks[pos].processed;
|
23998 | };
|
23999 |
|
24000 | var allProcessed = true;
|
24001 |
|
24002 | for (var i = 0; i < rawTasks.length; i++) {
|
24003 | compileTask(i);
|
24004 | allProcessed = allProcessed && rawTasks[i].processed;
|
24005 | }
|
24006 |
|
24007 | return allProcessed;
|
24008 | };
|
24009 | /**
|
24010 | * Called by parser when a link is found. Adds the URL to the vertex data.
|
24011 | *
|
24012 | * @param ids Comma separated list of ids
|
24013 | * @param _linkStr URL to create a link for
|
24014 | */
|
24015 |
|
24016 |
|
24017 | var setLink = function setLink(ids, _linkStr) {
|
24018 | var linkStr = _linkStr;
|
24019 |
|
24020 | if (_config__WEBPACK_IMPORTED_MODULE_3__.getConfig().securityLevel !== 'loose') {
|
24021 | linkStr = (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__.sanitizeUrl)(_linkStr);
|
24022 | }
|
24023 |
|
24024 | ids.split(',').forEach(function (id) {
|
24025 | var rawTask = findTaskById(id);
|
24026 |
|
24027 | if (typeof rawTask !== 'undefined') {
|
24028 | pushFun(id, function () {
|
24029 | window.open(linkStr, '_self');
|
24030 | });
|
24031 | links[id] = linkStr;
|
24032 | }
|
24033 | });
|
24034 | setClass(ids, 'clickable');
|
24035 | };
|
24036 | /**
|
24037 | * Called by parser when a special node is found, e.g. a clickable element.
|
24038 | *
|
24039 | * @param ids Comma separated list of ids
|
24040 | * @param className Class to add
|
24041 | */
|
24042 |
|
24043 | var setClass = function setClass(ids, className) {
|
24044 | ids.split(',').forEach(function (id) {
|
24045 | var rawTask = findTaskById(id);
|
24046 |
|
24047 | if (typeof rawTask !== 'undefined') {
|
24048 | rawTask.classes.push(className);
|
24049 | }
|
24050 | });
|
24051 | };
|
24052 |
|
24053 | var setClickFun = function setClickFun(id, functionName, functionArgs) {
|
24054 | if (_config__WEBPACK_IMPORTED_MODULE_3__.getConfig().securityLevel !== 'loose') {
|
24055 | return;
|
24056 | }
|
24057 |
|
24058 | if (typeof functionName === 'undefined') {
|
24059 | return;
|
24060 | }
|
24061 |
|
24062 | var argList = [];
|
24063 |
|
24064 | if (typeof functionArgs === 'string') {
|
24065 | /* Splits functionArgs by ',', ignoring all ',' in double quoted strings */
|
24066 | argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
|
24067 |
|
24068 | for (var i = 0; i < argList.length; i++) {
|
24069 | var item = argList[i].trim();
|
24070 | /* Removes all double quotes at the start and end of an argument */
|
24071 |
|
24072 | /* This preserves all starting and ending whitespace inside */
|
24073 |
|
24074 | if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
|
24075 | item = item.substr(1, item.length - 2);
|
24076 | }
|
24077 |
|
24078 | argList[i] = item;
|
24079 | }
|
24080 | }
|
24081 | /* if no arguments passed into callback, default to passing in id */
|
24082 |
|
24083 |
|
24084 | if (argList.length === 0) {
|
24085 | argList.push(id);
|
24086 | }
|
24087 |
|
24088 | var rawTask = findTaskById(id);
|
24089 |
|
24090 | if (typeof rawTask !== 'undefined') {
|
24091 | pushFun(id, function () {
|
24092 | _utils__WEBPACK_IMPORTED_MODULE_7__["default"].runFunc.apply(_utils__WEBPACK_IMPORTED_MODULE_7__["default"], [functionName].concat(_toConsumableArray(argList)));
|
24093 | });
|
24094 | }
|
24095 | };
|
24096 | /**
|
24097 | * The callbackFunction is executed in a click event bound to the task with the specified id or the
|
24098 | * task's assigned text
|
24099 | *
|
24100 | * @param id The task's id
|
24101 | * @param callbackFunction A function to be executed when clicked on the task or the task's text
|
24102 | */
|
24103 |
|
24104 |
|
24105 | var pushFun = function pushFun(id, callbackFunction) {
|
24106 | funs.push(function () {
|
24107 | // const elem = d3.select(element).select(`[id="${id}"]`)
|
24108 | var elem = document.querySelector("[id=\"".concat(id, "\"]"));
|
24109 |
|
24110 | if (elem !== null) {
|
24111 | elem.addEventListener('click', function () {
|
24112 | callbackFunction();
|
24113 | });
|
24114 | }
|
24115 | });
|
24116 | funs.push(function () {
|
24117 | // const elem = d3.select(element).select(`[id="${id}-text"]`)
|
24118 | var elem = document.querySelector("[id=\"".concat(id, "-text\"]"));
|
24119 |
|
24120 | if (elem !== null) {
|
24121 | elem.addEventListener('click', function () {
|
24122 | callbackFunction();
|
24123 | });
|
24124 | }
|
24125 | });
|
24126 | };
|
24127 | /**
|
24128 | * Called by parser when a click definition is found. Registers an event handler.
|
24129 | *
|
24130 | * @param ids Comma separated list of ids
|
24131 | * @param functionName Function to be called on click
|
24132 | * @param functionArgs Function args the function should be called with
|
24133 | */
|
24134 |
|
24135 |
|
24136 | var setClickEvent = function setClickEvent(ids, functionName, functionArgs) {
|
24137 | ids.split(',').forEach(function (id) {
|
24138 | setClickFun(id, functionName, functionArgs);
|
24139 | });
|
24140 | setClass(ids, 'clickable');
|
24141 | };
|
24142 | /**
|
24143 | * Binds all functions previously added to fun (specified through click) to the element
|
24144 | *
|
24145 | * @param element
|
24146 | */
|
24147 |
|
24148 | var bindFunctions = function bindFunctions(element) {
|
24149 | funs.forEach(function (fun) {
|
24150 | fun(element);
|
24151 | });
|
24152 | };
|
24153 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
24154 | parseDirective: parseDirective,
|
24155 | getConfig: function getConfig() {
|
24156 | return _config__WEBPACK_IMPORTED_MODULE_3__.getConfig().gantt;
|
24157 | },
|
24158 | clear: clear,
|
24159 | setDateFormat: setDateFormat,
|
24160 | getDateFormat: getDateFormat,
|
24161 | enableInclusiveEndDates: enableInclusiveEndDates,
|
24162 | endDatesAreInclusive: endDatesAreInclusive,
|
24163 | enableTopAxis: enableTopAxis,
|
24164 | topAxisEnabled: topAxisEnabled,
|
24165 | setAxisFormat: setAxisFormat,
|
24166 | getAxisFormat: getAxisFormat,
|
24167 | setTodayMarker: setTodayMarker,
|
24168 | getTodayMarker: getTodayMarker,
|
24169 | setAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_5__.setAccTitle,
|
24170 | getAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_5__.getAccTitle,
|
24171 | setDiagramTitle: _commonDb__WEBPACK_IMPORTED_MODULE_5__.setDiagramTitle,
|
24172 | getDiagramTitle: _commonDb__WEBPACK_IMPORTED_MODULE_5__.getDiagramTitle,
|
24173 | setAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_5__.setAccDescription,
|
24174 | getAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_5__.getAccDescription,
|
24175 | addSection: addSection,
|
24176 | getSections: getSections,
|
24177 | getTasks: getTasks,
|
24178 | addTask: addTask,
|
24179 | findTaskById: findTaskById,
|
24180 | addTaskOrg: addTaskOrg,
|
24181 | setIncludes: setIncludes,
|
24182 | getIncludes: getIncludes,
|
24183 | setExcludes: setExcludes,
|
24184 | getExcludes: getExcludes,
|
24185 | setClickEvent: setClickEvent,
|
24186 | setLink: setLink,
|
24187 | getLinks: getLinks,
|
24188 | bindFunctions: bindFunctions,
|
24189 | durationToDate: durationToDate,
|
24190 | isInvalidDate: isInvalidDate
|
24191 | });
|
24192 | /**
|
24193 | * @param data
|
24194 | * @param task
|
24195 | * @param tags
|
24196 | */
|
24197 |
|
24198 | function getTaskTags(data, task, tags) {
|
24199 | var matchFound = true;
|
24200 |
|
24201 | while (matchFound) {
|
24202 | matchFound = false;
|
24203 | tags.forEach(function (t) {
|
24204 | var pattern = '^\\s*' + t + '\\s*$';
|
24205 | var regex = new RegExp(pattern);
|
24206 |
|
24207 | if (data[0].match(regex)) {
|
24208 | task[t] = true;
|
24209 | data.shift(1);
|
24210 | matchFound = true;
|
24211 | }
|
24212 | });
|
24213 | }
|
24214 | }
|
24215 |
|
24216 | /***/ }),
|
24217 |
|
24218 | /***/ "./src/diagrams/gantt/ganttRenderer.js":
|
24219 | /*!*********************************************!*\
|
24220 | !*** ./src/diagrams/gantt/ganttRenderer.js ***!
|
24221 | \*********************************************/
|
24222 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
24223 |
|
24224 | "use strict";
|
24225 | __webpack_require__.r(__webpack_exports__);
|
24226 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
24227 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
24228 | /* harmony export */ "draw": () => (/* binding */ draw),
|
24229 | /* harmony export */ "setConf": () => (/* binding */ setConf)
|
24230 | /* harmony export */ });
|
24231 | /* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment-mini */ "moment-mini");
|
24232 | /* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_mini__WEBPACK_IMPORTED_MODULE_0__);
|
24233 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
24234 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
|
24235 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
|
24236 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
24237 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
24238 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
24239 | /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js");
|
24240 |
|
24241 |
|
24242 |
|
24243 |
|
24244 |
|
24245 |
|
24246 |
|
24247 | var setConf = function setConf() {
|
24248 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('Something is calling, setConf, remove the call');
|
24249 | };
|
24250 | var w;
|
24251 | var draw = function draw(text, id, version, diagObj) {
|
24252 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().gantt; // diagObj.db.clear();
|
24253 | // parser.parse(text);
|
24254 |
|
24255 | var securityLevel = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().securityLevel; // Handle root and Document for when rendering in sanbox mode
|
24256 |
|
24257 | var sandboxElement;
|
24258 |
|
24259 | if (securityLevel === 'sandbox') {
|
24260 | sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#i' + id);
|
24261 | }
|
24262 |
|
24263 | var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('body');
|
24264 | var doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;
|
24265 | var elem = doc.getElementById(id);
|
24266 | w = elem.parentElement.offsetWidth;
|
24267 |
|
24268 | if (typeof w === 'undefined') {
|
24269 | w = 1200;
|
24270 | }
|
24271 |
|
24272 | if (typeof conf.useWidth !== 'undefined') {
|
24273 | w = conf.useWidth;
|
24274 | }
|
24275 |
|
24276 | var taskArray = diagObj.db.getTasks(); // Set height based on number of tasks
|
24277 |
|
24278 | var h = taskArray.length * (conf.barHeight + conf.barGap) + 2 * conf.topPadding; // Set viewBox
|
24279 |
|
24280 | elem.setAttribute('viewBox', '0 0 ' + w + ' ' + h);
|
24281 | var svg = root.select("[id=\"".concat(id, "\"]")); // Set timescale
|
24282 |
|
24283 | var timeScale = (0,d3__WEBPACK_IMPORTED_MODULE_1__.scaleTime)().domain([(0,d3__WEBPACK_IMPORTED_MODULE_1__.min)(taskArray, function (d) {
|
24284 | return d.startTime;
|
24285 | }), (0,d3__WEBPACK_IMPORTED_MODULE_1__.max)(taskArray, function (d) {
|
24286 | return d.endTime;
|
24287 | })]).rangeRound([0, w - conf.leftPadding - conf.rightPadding]);
|
24288 | var categories = [];
|
24289 |
|
24290 | for (var i = 0; i < taskArray.length; i++) {
|
24291 | categories.push(taskArray[i].type);
|
24292 | }
|
24293 |
|
24294 | var catsUnfiltered = categories; // for vert labels
|
24295 |
|
24296 | categories = checkUnique(categories);
|
24297 | /**
|
24298 | * @param a
|
24299 | * @param b
|
24300 | */
|
24301 |
|
24302 | function taskCompare(a, b) {
|
24303 | var taskA = a.startTime;
|
24304 | var taskB = b.startTime;
|
24305 | var result = 0;
|
24306 |
|
24307 | if (taskA > taskB) {
|
24308 | result = 1;
|
24309 | } else if (taskA < taskB) {
|
24310 | result = -1;
|
24311 | }
|
24312 |
|
24313 | return result;
|
24314 | } // Sort the task array using the above taskCompare() so that
|
24315 | // tasks are created based on their order of startTime
|
24316 |
|
24317 |
|
24318 | taskArray.sort(taskCompare);
|
24319 | makeGant(taskArray, w, h);
|
24320 | (0,_utils__WEBPACK_IMPORTED_MODULE_4__.configureSvgSize)(svg, h, w, conf.useMaxWidth);
|
24321 | svg.append('text').text(diagObj.db.getDiagramTitle()).attr('x', w / 2).attr('y', conf.titleTopMargin).attr('class', 'titleText');
|
24322 | (0,_accessibility__WEBPACK_IMPORTED_MODULE_5__["default"])(diagObj.db, svg, id);
|
24323 | /**
|
24324 | * @param tasks
|
24325 | * @param pageWidth
|
24326 | * @param pageHeight
|
24327 | */
|
24328 |
|
24329 | function makeGant(tasks, pageWidth, pageHeight) {
|
24330 | var barHeight = conf.barHeight;
|
24331 | var gap = barHeight + conf.barGap;
|
24332 | var topPadding = conf.topPadding;
|
24333 | var leftPadding = conf.leftPadding;
|
24334 | var colorScale = (0,d3__WEBPACK_IMPORTED_MODULE_1__.scaleLinear)().domain([0, categories.length]).range(['#00B9FA', '#F95002']).interpolate(d3__WEBPACK_IMPORTED_MODULE_1__.interpolateHcl);
|
24335 | drawExcludeDays(gap, topPadding, leftPadding, pageWidth, pageHeight, tasks, diagObj.db.getExcludes(), diagObj.db.getIncludes());
|
24336 | makeGrid(leftPadding, topPadding, pageWidth, pageHeight);
|
24337 | drawRects(tasks, gap, topPadding, leftPadding, barHeight, colorScale, pageWidth, pageHeight);
|
24338 | vertLabels(gap, topPadding, leftPadding, barHeight, colorScale);
|
24339 | drawToday(leftPadding, topPadding, pageWidth, pageHeight);
|
24340 | }
|
24341 | /**
|
24342 | * @param theArray
|
24343 | * @param theGap
|
24344 | * @param theTopPad
|
24345 | * @param theSidePad
|
24346 | * @param theBarHeight
|
24347 | * @param theColorScale
|
24348 | * @param w
|
24349 | */
|
24350 |
|
24351 |
|
24352 | function drawRects(theArray, theGap, theTopPad, theSidePad, theBarHeight, theColorScale, w) {
|
24353 | // Draw background rects covering the entire width of the graph, these form the section rows.
|
24354 | svg.append('g').selectAll('rect').data(theArray).enter().append('rect').attr('x', 0).attr('y', function (d, i) {
|
24355 | // Ignore the incoming i value and use our order instead
|
24356 | i = d.order;
|
24357 | return i * theGap + theTopPad - 2;
|
24358 | }).attr('width', function () {
|
24359 | return w - conf.rightPadding / 2;
|
24360 | }).attr('height', theGap).attr('class', function (d) {
|
24361 | for (var _i = 0; _i < categories.length; _i++) {
|
24362 | if (d.type === categories[_i]) {
|
24363 | return 'section section' + _i % conf.numberSectionStyles;
|
24364 | }
|
24365 | }
|
24366 |
|
24367 | return 'section section0';
|
24368 | }); // Draw the rects representing the tasks
|
24369 |
|
24370 | var rectangles = svg.append('g').selectAll('rect').data(theArray).enter();
|
24371 | var links = diagObj.db.getLinks(); // Render the tasks with links
|
24372 | // Render the other tasks
|
24373 |
|
24374 | rectangles.append('rect').attr('id', function (d) {
|
24375 | return d.id;
|
24376 | }).attr('rx', 3).attr('ry', 3).attr('x', function (d) {
|
24377 | if (d.milestone) {
|
24378 | return timeScale(d.startTime) + theSidePad + 0.5 * (timeScale(d.endTime) - timeScale(d.startTime)) - 0.5 * theBarHeight;
|
24379 | }
|
24380 |
|
24381 | return timeScale(d.startTime) + theSidePad;
|
24382 | }).attr('y', function (d, i) {
|
24383 | // Ignore the incoming i value and use our order instead
|
24384 | i = d.order;
|
24385 | return i * theGap + theTopPad;
|
24386 | }).attr('width', function (d) {
|
24387 | if (d.milestone) {
|
24388 | return theBarHeight;
|
24389 | }
|
24390 |
|
24391 | return timeScale(d.renderEndTime || d.endTime) - timeScale(d.startTime);
|
24392 | }).attr('height', theBarHeight).attr('transform-origin', function (d, i) {
|
24393 | // Ignore the incoming i value and use our order instead
|
24394 | i = d.order;
|
24395 | return (timeScale(d.startTime) + theSidePad + 0.5 * (timeScale(d.endTime) - timeScale(d.startTime))).toString() + 'px ' + (i * theGap + theTopPad + 0.5 * theBarHeight).toString() + 'px';
|
24396 | }).attr('class', function (d) {
|
24397 | var res = 'task';
|
24398 | var classStr = '';
|
24399 |
|
24400 | if (d.classes.length > 0) {
|
24401 | classStr = d.classes.join(' ');
|
24402 | }
|
24403 |
|
24404 | var secNum = 0;
|
24405 |
|
24406 | for (var _i2 = 0; _i2 < categories.length; _i2++) {
|
24407 | if (d.type === categories[_i2]) {
|
24408 | secNum = _i2 % conf.numberSectionStyles;
|
24409 | }
|
24410 | }
|
24411 |
|
24412 | var taskClass = '';
|
24413 |
|
24414 | if (d.active) {
|
24415 | if (d.crit) {
|
24416 | taskClass += ' activeCrit';
|
24417 | } else {
|
24418 | taskClass = ' active';
|
24419 | }
|
24420 | } else if (d.done) {
|
24421 | if (d.crit) {
|
24422 | taskClass = ' doneCrit';
|
24423 | } else {
|
24424 | taskClass = ' done';
|
24425 | }
|
24426 | } else {
|
24427 | if (d.crit) {
|
24428 | taskClass += ' crit';
|
24429 | }
|
24430 | }
|
24431 |
|
24432 | if (taskClass.length === 0) {
|
24433 | taskClass = ' task';
|
24434 | }
|
24435 |
|
24436 | if (d.milestone) {
|
24437 | taskClass = ' milestone ' + taskClass;
|
24438 | }
|
24439 |
|
24440 | taskClass += secNum;
|
24441 | taskClass += ' ' + classStr;
|
24442 | return res + taskClass;
|
24443 | }); // Append task labels
|
24444 |
|
24445 | rectangles.append('text').attr('id', function (d) {
|
24446 | return d.id + '-text';
|
24447 | }).text(function (d) {
|
24448 | return d.task;
|
24449 | }).attr('font-size', conf.fontSize).attr('x', function (d) {
|
24450 | var startX = timeScale(d.startTime);
|
24451 | var endX = timeScale(d.renderEndTime || d.endTime);
|
24452 |
|
24453 | if (d.milestone) {
|
24454 | startX += 0.5 * (timeScale(d.endTime) - timeScale(d.startTime)) - 0.5 * theBarHeight;
|
24455 | }
|
24456 |
|
24457 | if (d.milestone) {
|
24458 | endX = startX + theBarHeight;
|
24459 | }
|
24460 |
|
24461 | var textWidth = this.getBBox().width; // Check id text width > width of rectangle
|
24462 |
|
24463 | if (textWidth > endX - startX) {
|
24464 | if (endX + textWidth + 1.5 * conf.leftPadding > w) {
|
24465 | return startX + theSidePad - 5;
|
24466 | } else {
|
24467 | return endX + theSidePad + 5;
|
24468 | }
|
24469 | } else {
|
24470 | return (endX - startX) / 2 + startX + theSidePad;
|
24471 | }
|
24472 | }).attr('y', function (d, i) {
|
24473 | // Ignore the incoming i value and use our order instead
|
24474 | i = d.order;
|
24475 | return i * theGap + conf.barHeight / 2 + (conf.fontSize / 2 - 2) + theTopPad;
|
24476 | }).attr('text-height', theBarHeight).attr('class', function (d) {
|
24477 | var startX = timeScale(d.startTime);
|
24478 | var endX = timeScale(d.endTime);
|
24479 |
|
24480 | if (d.milestone) {
|
24481 | endX = startX + theBarHeight;
|
24482 | }
|
24483 |
|
24484 | var textWidth = this.getBBox().width;
|
24485 | var classStr = '';
|
24486 |
|
24487 | if (d.classes.length > 0) {
|
24488 | classStr = d.classes.join(' ');
|
24489 | }
|
24490 |
|
24491 | var secNum = 0;
|
24492 |
|
24493 | for (var _i3 = 0; _i3 < categories.length; _i3++) {
|
24494 | if (d.type === categories[_i3]) {
|
24495 | secNum = _i3 % conf.numberSectionStyles;
|
24496 | }
|
24497 | }
|
24498 |
|
24499 | var taskType = '';
|
24500 |
|
24501 | if (d.active) {
|
24502 | if (d.crit) {
|
24503 | taskType = 'activeCritText' + secNum;
|
24504 | } else {
|
24505 | taskType = 'activeText' + secNum;
|
24506 | }
|
24507 | }
|
24508 |
|
24509 | if (d.done) {
|
24510 | if (d.crit) {
|
24511 | taskType = taskType + ' doneCritText' + secNum;
|
24512 | } else {
|
24513 | taskType = taskType + ' doneText' + secNum;
|
24514 | }
|
24515 | } else {
|
24516 | if (d.crit) {
|
24517 | taskType = taskType + ' critText' + secNum;
|
24518 | }
|
24519 | }
|
24520 |
|
24521 | if (d.milestone) {
|
24522 | taskType += ' milestoneText';
|
24523 | } // Check id text width > width of rectangle
|
24524 |
|
24525 |
|
24526 | if (textWidth > endX - startX) {
|
24527 | if (endX + textWidth + 1.5 * conf.leftPadding > w) {
|
24528 | return classStr + ' taskTextOutsideLeft taskTextOutside' + secNum + ' ' + taskType;
|
24529 | } else {
|
24530 | return classStr + ' taskTextOutsideRight taskTextOutside' + secNum + ' ' + taskType + ' width-' + textWidth;
|
24531 | }
|
24532 | } else {
|
24533 | return classStr + ' taskText taskText' + secNum + ' ' + taskType + ' width-' + textWidth;
|
24534 | }
|
24535 | });
|
24536 | var securityLevel = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().securityLevel; // Wrap the tasks in an a tag for working links without javascript
|
24537 |
|
24538 | if (securityLevel === 'sandbox') {
|
24539 | var _sandboxElement;
|
24540 |
|
24541 | _sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#i' + id);
|
24542 |
|
24543 | var _root = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)(_sandboxElement.nodes()[0].contentDocument.body);
|
24544 |
|
24545 | var _doc = _sandboxElement.nodes()[0].contentDocument;
|
24546 |
|
24547 | rectangles.filter(function (d) {
|
24548 | return typeof links[d.id] !== 'undefined';
|
24549 | }).each(function (o) {
|
24550 | var taskRect = _doc.querySelector('#' + o.id);
|
24551 |
|
24552 | var taskText = _doc.querySelector('#' + o.id + '-text');
|
24553 |
|
24554 | var oldParent = taskRect.parentNode;
|
24555 |
|
24556 | var Link = _doc.createElement('a');
|
24557 |
|
24558 | Link.setAttribute('xlink:href', links[o.id]);
|
24559 | Link.setAttribute('target', '_top');
|
24560 | oldParent.appendChild(Link);
|
24561 | Link.appendChild(taskRect);
|
24562 | Link.appendChild(taskText);
|
24563 | });
|
24564 | }
|
24565 | }
|
24566 | /**
|
24567 | * @param theGap
|
24568 | * @param theTopPad
|
24569 | * @param theSidePad
|
24570 | * @param w
|
24571 | * @param h
|
24572 | * @param tasks
|
24573 | * @param excludes
|
24574 | * @param includes
|
24575 | */
|
24576 |
|
24577 |
|
24578 | function drawExcludeDays(theGap, theTopPad, theSidePad, w, h, tasks, excludes, includes) {
|
24579 | var minTime = tasks.reduce(function (min, _ref) {
|
24580 | var startTime = _ref.startTime;
|
24581 | return min ? Math.min(min, startTime) : startTime;
|
24582 | }, 0);
|
24583 | var maxTime = tasks.reduce(function (max, _ref2) {
|
24584 | var endTime = _ref2.endTime;
|
24585 | return max ? Math.max(max, endTime) : endTime;
|
24586 | }, 0);
|
24587 | var dateFormat = diagObj.db.getDateFormat();
|
24588 | if (!minTime || !maxTime) return;
|
24589 | var excludeRanges = [];
|
24590 | var range = null;
|
24591 | var d = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(minTime);
|
24592 |
|
24593 | while (d.valueOf() <= maxTime) {
|
24594 | if (diagObj.db.isInvalidDate(d, dateFormat, excludes, includes)) {
|
24595 | if (!range) {
|
24596 | range = {
|
24597 | start: d.clone(),
|
24598 | end: d.clone()
|
24599 | };
|
24600 | } else {
|
24601 | range.end = d.clone();
|
24602 | }
|
24603 | } else {
|
24604 | if (range) {
|
24605 | excludeRanges.push(range);
|
24606 | range = null;
|
24607 | }
|
24608 | }
|
24609 |
|
24610 | d.add(1, 'd');
|
24611 | }
|
24612 |
|
24613 | var rectangles = svg.append('g').selectAll('rect').data(excludeRanges).enter();
|
24614 | rectangles.append('rect').attr('id', function (d) {
|
24615 | return 'exclude-' + d.start.format('YYYY-MM-DD');
|
24616 | }).attr('x', function (d) {
|
24617 | return timeScale(d.start) + theSidePad;
|
24618 | }).attr('y', conf.gridLineStartPadding).attr('width', function (d) {
|
24619 | var renderEnd = d.end.clone().add(1, 'day');
|
24620 | return timeScale(renderEnd) - timeScale(d.start);
|
24621 | }).attr('height', h - theTopPad - conf.gridLineStartPadding).attr('transform-origin', function (d, i) {
|
24622 | return (timeScale(d.start) + theSidePad + 0.5 * (timeScale(d.end) - timeScale(d.start))).toString() + 'px ' + (i * theGap + 0.5 * h).toString() + 'px';
|
24623 | }).attr('class', 'exclude-range');
|
24624 | }
|
24625 | /**
|
24626 | * @param theSidePad
|
24627 | * @param theTopPad
|
24628 | * @param w
|
24629 | * @param h
|
24630 | */
|
24631 |
|
24632 |
|
24633 | function makeGrid(theSidePad, theTopPad, w, h) {
|
24634 | var bottomXAxis = (0,d3__WEBPACK_IMPORTED_MODULE_1__.axisBottom)(timeScale).tickSize(-h + theTopPad + conf.gridLineStartPadding).tickFormat((0,d3__WEBPACK_IMPORTED_MODULE_1__.timeFormat)(diagObj.db.getAxisFormat() || conf.axisFormat || '%Y-%m-%d'));
|
24635 | svg.append('g').attr('class', 'grid').attr('transform', 'translate(' + theSidePad + ', ' + (h - 50) + ')').call(bottomXAxis).selectAll('text').style('text-anchor', 'middle').attr('fill', '#000').attr('stroke', 'none').attr('font-size', 10).attr('dy', '1em');
|
24636 |
|
24637 | if (diagObj.db.topAxisEnabled() || conf.topAxis) {
|
24638 | var topXAxis = (0,d3__WEBPACK_IMPORTED_MODULE_1__.axisTop)(timeScale).tickSize(-h + theTopPad + conf.gridLineStartPadding).tickFormat((0,d3__WEBPACK_IMPORTED_MODULE_1__.timeFormat)(diagObj.db.getAxisFormat() || conf.axisFormat || '%Y-%m-%d'));
|
24639 | svg.append('g').attr('class', 'grid').attr('transform', 'translate(' + theSidePad + ', ' + theTopPad + ')').call(topXAxis).selectAll('text').style('text-anchor', 'middle').attr('fill', '#000').attr('stroke', 'none').attr('font-size', 10); // .attr('dy', '1em');
|
24640 | }
|
24641 | }
|
24642 | /**
|
24643 | * @param theGap
|
24644 | * @param theTopPad
|
24645 | */
|
24646 |
|
24647 |
|
24648 | function vertLabels(theGap, theTopPad) {
|
24649 | var numOccurances = [];
|
24650 | var prevGap = 0;
|
24651 |
|
24652 | for (var _i4 = 0; _i4 < categories.length; _i4++) {
|
24653 | numOccurances[_i4] = [categories[_i4], getCount(categories[_i4], catsUnfiltered)];
|
24654 | }
|
24655 |
|
24656 | svg.append('g') // without doing this, impossible to put grid lines behind text
|
24657 | .selectAll('text').data(numOccurances).enter().append(function (d) {
|
24658 | var rows = d[0].split(_common_common__WEBPACK_IMPORTED_MODULE_6__["default"].lineBreakRegex);
|
24659 | var dy = -(rows.length - 1) / 2;
|
24660 | var svgLabel = doc.createElementNS('http://www.w3.org/2000/svg', 'text');
|
24661 | svgLabel.setAttribute('dy', dy + 'em');
|
24662 |
|
24663 | for (var j = 0; j < rows.length; j++) {
|
24664 | var tspan = doc.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
24665 | tspan.setAttribute('alignment-baseline', 'central');
|
24666 | tspan.setAttribute('x', '10');
|
24667 | if (j > 0) tspan.setAttribute('dy', '1em');
|
24668 | tspan.textContent = rows[j];
|
24669 | svgLabel.appendChild(tspan);
|
24670 | }
|
24671 |
|
24672 | return svgLabel;
|
24673 | }).attr('x', 10).attr('y', function (d, i) {
|
24674 | if (i > 0) {
|
24675 | for (var j = 0; j < i; j++) {
|
24676 | prevGap += numOccurances[i - 1][1];
|
24677 | return d[1] * theGap / 2 + prevGap * theGap + theTopPad;
|
24678 | }
|
24679 | } else {
|
24680 | return d[1] * theGap / 2 + theTopPad;
|
24681 | }
|
24682 | }).attr('font-size', conf.sectionFontSize).attr('font-size', conf.sectionFontSize).attr('class', function (d) {
|
24683 | for (var _i5 = 0; _i5 < categories.length; _i5++) {
|
24684 | if (d[0] === categories[_i5]) {
|
24685 | return 'sectionTitle sectionTitle' + _i5 % conf.numberSectionStyles;
|
24686 | }
|
24687 | }
|
24688 |
|
24689 | return 'sectionTitle';
|
24690 | });
|
24691 | }
|
24692 | /**
|
24693 | * @param theSidePad
|
24694 | * @param theTopPad
|
24695 | * @param w
|
24696 | * @param h
|
24697 | */
|
24698 |
|
24699 |
|
24700 | function drawToday(theSidePad, theTopPad, w, h) {
|
24701 | var todayMarker = diagObj.db.getTodayMarker();
|
24702 |
|
24703 | if (todayMarker === 'off') {
|
24704 | return;
|
24705 | }
|
24706 |
|
24707 | var todayG = svg.append('g').attr('class', 'today');
|
24708 | var today = new Date();
|
24709 | var todayLine = todayG.append('line');
|
24710 | todayLine.attr('x1', timeScale(today) + theSidePad).attr('x2', timeScale(today) + theSidePad).attr('y1', conf.titleTopMargin).attr('y2', h - conf.titleTopMargin).attr('class', 'today');
|
24711 |
|
24712 | if (todayMarker !== '') {
|
24713 | todayLine.attr('style', todayMarker.replace(/,/g, ';'));
|
24714 | }
|
24715 | }
|
24716 | /**
|
24717 | * From this stackexchange question:
|
24718 | * http://stackoverflow.com/questions/1890203/unique-for-arrays-in-javascript
|
24719 | *
|
24720 | * @param arr
|
24721 | */
|
24722 |
|
24723 |
|
24724 | function checkUnique(arr) {
|
24725 | var hash = {};
|
24726 | var result = [];
|
24727 |
|
24728 | for (var _i6 = 0, l = arr.length; _i6 < l; ++_i6) {
|
24729 | if (!Object.prototype.hasOwnProperty.call(hash, arr[_i6])) {
|
24730 | // eslint-disable-line
|
24731 | // it works with objects! in FF, at least
|
24732 | hash[arr[_i6]] = true;
|
24733 | result.push(arr[_i6]);
|
24734 | }
|
24735 | }
|
24736 |
|
24737 | return result;
|
24738 | }
|
24739 | /**
|
24740 | * From this stackexchange question:
|
24741 | * http://stackoverflow.com/questions/14227981/count-how-many-strings-in-an-array-have-duplicates-in-the-same-array
|
24742 | *
|
24743 | * @param arr
|
24744 | */
|
24745 |
|
24746 |
|
24747 | function getCounts(arr) {
|
24748 | var i = arr.length; // const to loop over
|
24749 |
|
24750 | var obj = {}; // obj to store results
|
24751 |
|
24752 | while (i) {
|
24753 | obj[arr[--i]] = (obj[arr[i]] || 0) + 1; // count occurrences
|
24754 | }
|
24755 |
|
24756 | return obj;
|
24757 | }
|
24758 | /**
|
24759 | * Get specific from everything
|
24760 | *
|
24761 | * @param word
|
24762 | * @param arr
|
24763 | */
|
24764 |
|
24765 |
|
24766 | function getCount(word, arr) {
|
24767 | return getCounts(arr)[word] || 0;
|
24768 | }
|
24769 | };
|
24770 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
24771 | setConf: setConf,
|
24772 | draw: draw
|
24773 | });
|
24774 |
|
24775 | /***/ }),
|
24776 |
|
24777 | /***/ "./src/diagrams/gantt/styles.js":
|
24778 | /*!**************************************!*\
|
24779 | !*** ./src/diagrams/gantt/styles.js ***!
|
24780 | \**************************************/
|
24781 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
24782 |
|
24783 | "use strict";
|
24784 | __webpack_require__.r(__webpack_exports__);
|
24785 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
24786 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
24787 | /* harmony export */ });
|
24788 | var getStyles = function getStyles(options) {
|
24789 | return "\n .mermaid-main-font {\n font-family: \"trebuchet ms\", verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n .exclude-range {\n fill: ".concat(options.excludeBkgColor, ";\n }\n\n .section {\n stroke: none;\n opacity: 0.2;\n }\n\n .section0 {\n fill: ").concat(options.sectionBkgColor, ";\n }\n\n .section2 {\n fill: ").concat(options.sectionBkgColor2, ";\n }\n\n .section1,\n .section3 {\n fill: ").concat(options.altSectionBkgColor, ";\n opacity: 0.2;\n }\n\n .sectionTitle0 {\n fill: ").concat(options.titleColor, ";\n }\n\n .sectionTitle1 {\n fill: ").concat(options.titleColor, ";\n }\n\n .sectionTitle2 {\n fill: ").concat(options.titleColor, ";\n }\n\n .sectionTitle3 {\n fill: ").concat(options.titleColor, ";\n }\n\n .sectionTitle {\n text-anchor: start;\n // font-size: ").concat(options.ganttFontSize, ";\n // text-height: 14px;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n\n }\n\n\n /* Grid and axis */\n\n .grid .tick {\n stroke: ").concat(options.gridColor, ";\n opacity: 0.8;\n shape-rendering: crispEdges;\n text {\n font-family: ").concat(options.fontFamily, ";\n fill: ").concat(options.textColor, ";\n }\n }\n\n .grid path {\n stroke-width: 0;\n }\n\n\n /* Today line */\n\n .today {\n fill: none;\n stroke: ").concat(options.todayLineColor, ";\n stroke-width: 2px;\n }\n\n\n /* Task styling */\n\n /* Default task */\n\n .task {\n stroke-width: 2;\n }\n\n .taskText {\n text-anchor: middle;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n\n // .taskText:not([font-size]) {\n // font-size: ").concat(options.ganttFontSize, ";\n // }\n\n .taskTextOutsideRight {\n fill: ").concat(options.taskTextDarkColor, ";\n text-anchor: start;\n // font-size: ").concat(options.ganttFontSize, ";\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n\n }\n\n .taskTextOutsideLeft {\n fill: ").concat(options.taskTextDarkColor, ";\n text-anchor: end;\n // font-size: ").concat(options.ganttFontSize, ";\n }\n\n /* Special case clickable */\n .task.clickable {\n cursor: pointer;\n }\n .taskText.clickable {\n cursor: pointer;\n fill: ").concat(options.taskTextClickableColor, " !important;\n font-weight: bold;\n }\n\n .taskTextOutsideLeft.clickable {\n cursor: pointer;\n fill: ").concat(options.taskTextClickableColor, " !important;\n font-weight: bold;\n }\n\n .taskTextOutsideRight.clickable {\n cursor: pointer;\n fill: ").concat(options.taskTextClickableColor, " !important;\n font-weight: bold;\n }\n\n /* Specific task settings for the sections*/\n\n .taskText0,\n .taskText1,\n .taskText2,\n .taskText3 {\n fill: ").concat(options.taskTextColor, ";\n }\n\n .task0,\n .task1,\n .task2,\n .task3 {\n fill: ").concat(options.taskBkgColor, ";\n stroke: ").concat(options.taskBorderColor, ";\n }\n\n .taskTextOutside0,\n .taskTextOutside2\n {\n fill: ").concat(options.taskTextOutsideColor, ";\n }\n\n .taskTextOutside1,\n .taskTextOutside3 {\n fill: ").concat(options.taskTextOutsideColor, ";\n }\n\n\n /* Active task */\n\n .active0,\n .active1,\n .active2,\n .active3 {\n fill: ").concat(options.activeTaskBkgColor, ";\n stroke: ").concat(options.activeTaskBorderColor, ";\n }\n\n .activeText0,\n .activeText1,\n .activeText2,\n .activeText3 {\n fill: ").concat(options.taskTextDarkColor, " !important;\n }\n\n\n /* Completed task */\n\n .done0,\n .done1,\n .done2,\n .done3 {\n stroke: ").concat(options.doneTaskBorderColor, ";\n fill: ").concat(options.doneTaskBkgColor, ";\n stroke-width: 2;\n }\n\n .doneText0,\n .doneText1,\n .doneText2,\n .doneText3 {\n fill: ").concat(options.taskTextDarkColor, " !important;\n }\n\n\n /* Tasks on the critical line */\n\n .crit0,\n .crit1,\n .crit2,\n .crit3 {\n stroke: ").concat(options.critBorderColor, ";\n fill: ").concat(options.critBkgColor, ";\n stroke-width: 2;\n }\n\n .activeCrit0,\n .activeCrit1,\n .activeCrit2,\n .activeCrit3 {\n stroke: ").concat(options.critBorderColor, ";\n fill: ").concat(options.activeTaskBkgColor, ";\n stroke-width: 2;\n }\n\n .doneCrit0,\n .doneCrit1,\n .doneCrit2,\n .doneCrit3 {\n stroke: ").concat(options.critBorderColor, ";\n fill: ").concat(options.doneTaskBkgColor, ";\n stroke-width: 2;\n cursor: pointer;\n shape-rendering: crispEdges;\n }\n\n .milestone {\n transform: rotate(45deg) scale(0.8,0.8);\n }\n\n .milestoneText {\n font-style: italic;\n }\n .doneCritText0,\n .doneCritText1,\n .doneCritText2,\n .doneCritText3 {\n fill: ").concat(options.taskTextDarkColor, " !important;\n }\n\n .activeCritText0,\n .activeCritText1,\n .activeCritText2,\n .activeCritText3 {\n fill: ").concat(options.taskTextDarkColor, " !important;\n }\n\n .titleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ").concat(options.textColor, " ;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n");
|
24790 | };
|
24791 |
|
24792 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
24793 |
|
24794 | /***/ }),
|
24795 |
|
24796 | /***/ "./src/diagrams/git/gitGraphAst.js":
|
24797 | /*!*****************************************!*\
|
24798 | !*** ./src/diagrams/git/gitGraphAst.js ***!
|
24799 | \*****************************************/
|
24800 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
24801 |
|
24802 | "use strict";
|
24803 | __webpack_require__.r(__webpack_exports__);
|
24804 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
24805 | /* harmony export */ "branch": () => (/* binding */ branch),
|
24806 | /* harmony export */ "checkout": () => (/* binding */ checkout),
|
24807 | /* harmony export */ "cherryPick": () => (/* binding */ cherryPick),
|
24808 | /* harmony export */ "clear": () => (/* binding */ clear),
|
24809 | /* harmony export */ "commit": () => (/* binding */ commit),
|
24810 | /* harmony export */ "commitType": () => (/* binding */ commitType),
|
24811 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
24812 | /* harmony export */ "getBranches": () => (/* binding */ getBranches),
|
24813 | /* harmony export */ "getBranchesAsObjArray": () => (/* binding */ getBranchesAsObjArray),
|
24814 | /* harmony export */ "getCommits": () => (/* binding */ getCommits),
|
24815 | /* harmony export */ "getCommitsArray": () => (/* binding */ getCommitsArray),
|
24816 | /* harmony export */ "getCurrentBranch": () => (/* binding */ getCurrentBranch),
|
24817 | /* harmony export */ "getDirection": () => (/* binding */ getDirection),
|
24818 | /* harmony export */ "getHead": () => (/* binding */ getHead),
|
24819 | /* harmony export */ "getOptions": () => (/* binding */ getOptions),
|
24820 | /* harmony export */ "merge": () => (/* binding */ merge),
|
24821 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
24822 | /* harmony export */ "prettyPrint": () => (/* binding */ prettyPrint),
|
24823 | /* harmony export */ "setDirection": () => (/* binding */ setDirection),
|
24824 | /* harmony export */ "setOptions": () => (/* binding */ setOptions)
|
24825 | /* harmony export */ });
|
24826 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
24827 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
24828 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
24829 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
24830 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
24831 | /* harmony import */ var _commonDb__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../commonDb */ "./src/commonDb.js");
|
24832 | function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
24833 |
|
24834 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
24835 |
|
24836 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
24837 |
|
24838 |
|
24839 |
|
24840 |
|
24841 |
|
24842 |
|
24843 |
|
24844 |
|
24845 | var mainBranchName = (0,_config__WEBPACK_IMPORTED_MODULE_0__.getConfig)().gitGraph.mainBranchName;
|
24846 | var mainBranchOrder = (0,_config__WEBPACK_IMPORTED_MODULE_0__.getConfig)().gitGraph.mainBranchOrder;
|
24847 | var commits = {};
|
24848 | var head = null;
|
24849 | var branchesConfig = {};
|
24850 | branchesConfig[mainBranchName] = {
|
24851 | name: mainBranchName,
|
24852 | order: mainBranchOrder
|
24853 | };
|
24854 | var branches = {};
|
24855 | branches[mainBranchName] = head;
|
24856 | var curBranch = mainBranchName;
|
24857 | var direction = 'LR';
|
24858 | var seq = 0;
|
24859 |
|
24860 | function getId() {
|
24861 | // eslint-disable-line
|
24862 | return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.random)({
|
24863 | length: 7
|
24864 | });
|
24865 | }
|
24866 |
|
24867 | var parseDirective = function parseDirective(statement, context, type) {
|
24868 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__["default"].parseDirective(this, statement, context, type);
|
24869 | }; // /**
|
24870 | // * @param currentCommit
|
24871 | // * @param otherCommit
|
24872 | // */
|
24873 | // function isfastforwardable(currentCommit, otherCommit) {
|
24874 | // log.debug('Entering isfastforwardable:', currentCommit.id, otherCommit.id);
|
24875 | // let cnt = 0;
|
24876 | // while (currentCommit.seq <= otherCommit.seq && currentCommit !== otherCommit && cnt < 1000) {
|
24877 | // cnt++;
|
24878 | // // only if other branch has more commits
|
24879 | // if (otherCommit.parent == null) break;
|
24880 | // if (Array.isArray(otherCommit.parent)) {
|
24881 | // log.debug('In merge commit:', otherCommit.parent);
|
24882 | // return (
|
24883 | // isfastforwardable(currentCommit, commits[otherCommit.parent[0]]) ||
|
24884 | // isfastforwardable(currentCommit, commits[otherCommit.parent[1]])
|
24885 | // );
|
24886 | // } else {
|
24887 | // otherCommit = commits[otherCommit.parent];
|
24888 | // }
|
24889 | // }
|
24890 | // log.debug(currentCommit.id, otherCommit.id);
|
24891 | // return currentCommit.id === otherCommit.id;
|
24892 | // }
|
24893 |
|
24894 | /**
|
24895 | * @param currentCommit
|
24896 | * @param otherCommit
|
24897 | */
|
24898 | // function isReachableFrom(currentCommit, otherCommit) {
|
24899 | // const currentSeq = currentCommit.seq;
|
24900 | // const otherSeq = otherCommit.seq;
|
24901 | // if (currentSeq > otherSeq) return isfastforwardable(otherCommit, currentCommit);
|
24902 | // return false;
|
24903 | // }
|
24904 |
|
24905 | /**
|
24906 | * @param list
|
24907 | * @param fn
|
24908 | */
|
24909 |
|
24910 | function uniqBy(list, fn) {
|
24911 | var recordMap = Object.create(null);
|
24912 | return list.reduce(function (out, item) {
|
24913 | var key = fn(item);
|
24914 |
|
24915 | if (!recordMap[key]) {
|
24916 | recordMap[key] = true;
|
24917 | out.push(item);
|
24918 | }
|
24919 |
|
24920 | return out;
|
24921 | }, []);
|
24922 | }
|
24923 |
|
24924 | var setDirection = function setDirection(dir) {
|
24925 | direction = dir;
|
24926 | };
|
24927 | var options = {};
|
24928 | var setOptions = function setOptions(rawOptString) {
|
24929 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('options str', rawOptString);
|
24930 | rawOptString = rawOptString && rawOptString.trim();
|
24931 | rawOptString = rawOptString || '{}';
|
24932 |
|
24933 | try {
|
24934 | options = JSON.parse(rawOptString);
|
24935 | } catch (e) {
|
24936 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.error('error while parsing gitGraph options', e.message);
|
24937 | }
|
24938 | };
|
24939 | var getOptions = function getOptions() {
|
24940 | return options;
|
24941 | };
|
24942 | var commit = function commit(msg, id, type, tag) {
|
24943 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('Entering commit:', msg, id, type, tag);
|
24944 | id = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].sanitizeText(id, _config__WEBPACK_IMPORTED_MODULE_0__.getConfig());
|
24945 | msg = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].sanitizeText(msg, _config__WEBPACK_IMPORTED_MODULE_0__.getConfig());
|
24946 | tag = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].sanitizeText(tag, _config__WEBPACK_IMPORTED_MODULE_0__.getConfig());
|
24947 | var commit = {
|
24948 | id: id ? id : seq + '-' + getId(),
|
24949 | message: msg,
|
24950 | seq: seq++,
|
24951 | type: type ? type : commitType.NORMAL,
|
24952 | tag: tag ? tag : '',
|
24953 | parents: head == null ? [] : [head.id],
|
24954 | branch: curBranch
|
24955 | };
|
24956 | head = commit;
|
24957 | commits[commit.id] = commit;
|
24958 | branches[curBranch] = commit.id;
|
24959 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('in pushCommit ' + commit.id);
|
24960 | };
|
24961 | var branch = function branch(name, order) {
|
24962 | name = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].sanitizeText(name, _config__WEBPACK_IMPORTED_MODULE_0__.getConfig());
|
24963 |
|
24964 | if (typeof branches[name] === 'undefined') {
|
24965 | branches[name] = head != null ? head.id : null;
|
24966 | branchesConfig[name] = {
|
24967 | name: name,
|
24968 | order: order ? parseInt(order, 10) : null
|
24969 | };
|
24970 | checkout(name);
|
24971 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('in createBranch');
|
24972 | } else {
|
24973 | var error = new Error('Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ' + name + '")');
|
24974 | error.hash = {
|
24975 | text: 'branch ' + name,
|
24976 | token: 'branch ' + name,
|
24977 | line: '1',
|
24978 | loc: {
|
24979 | first_line: 1,
|
24980 | last_line: 1,
|
24981 | first_column: 1,
|
24982 | last_column: 1
|
24983 | },
|
24984 | expected: ['"checkout ' + name + '"']
|
24985 | };
|
24986 | throw error;
|
24987 | }
|
24988 | };
|
24989 | var merge = function merge(otherBranch, tag) {
|
24990 | otherBranch = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].sanitizeText(otherBranch, _config__WEBPACK_IMPORTED_MODULE_0__.getConfig());
|
24991 | var currentCommit = commits[branches[curBranch]];
|
24992 | var otherCommit = commits[branches[otherBranch]];
|
24993 |
|
24994 | if (curBranch === otherBranch) {
|
24995 | var error = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
|
24996 | error.hash = {
|
24997 | text: 'merge ' + otherBranch,
|
24998 | token: 'merge ' + otherBranch,
|
24999 | line: '1',
|
25000 | loc: {
|
25001 | first_line: 1,
|
25002 | last_line: 1,
|
25003 | first_column: 1,
|
25004 | last_column: 1
|
25005 | },
|
25006 | expected: ['branch abc']
|
25007 | };
|
25008 | throw error;
|
25009 | } else if (typeof currentCommit === 'undefined' || !currentCommit) {
|
25010 | var _error = new Error('Incorrect usage of "merge". Current branch (' + curBranch + ')has no commits');
|
25011 |
|
25012 | _error.hash = {
|
25013 | text: 'merge ' + otherBranch,
|
25014 | token: 'merge ' + otherBranch,
|
25015 | line: '1',
|
25016 | loc: {
|
25017 | first_line: 1,
|
25018 | last_line: 1,
|
25019 | first_column: 1,
|
25020 | last_column: 1
|
25021 | },
|
25022 | expected: ['commit']
|
25023 | };
|
25024 | throw _error;
|
25025 | } else if (typeof branches[otherBranch] === 'undefined') {
|
25026 | var _error2 = new Error('Incorrect usage of "merge". Branch to be merged (' + otherBranch + ') does not exist');
|
25027 |
|
25028 | _error2.hash = {
|
25029 | text: 'merge ' + otherBranch,
|
25030 | token: 'merge ' + otherBranch,
|
25031 | line: '1',
|
25032 | loc: {
|
25033 | first_line: 1,
|
25034 | last_line: 1,
|
25035 | first_column: 1,
|
25036 | last_column: 1
|
25037 | },
|
25038 | expected: ['branch ' + otherBranch]
|
25039 | };
|
25040 | throw _error2;
|
25041 | } else if (typeof otherCommit === 'undefined' || !otherCommit) {
|
25042 | var _error3 = new Error('Incorrect usage of "merge". Branch to be merged (' + otherBranch + ') has no commits');
|
25043 |
|
25044 | _error3.hash = {
|
25045 | text: 'merge ' + otherBranch,
|
25046 | token: 'merge ' + otherBranch,
|
25047 | line: '1',
|
25048 | loc: {
|
25049 | first_line: 1,
|
25050 | last_line: 1,
|
25051 | first_column: 1,
|
25052 | last_column: 1
|
25053 | },
|
25054 | expected: ['"commit"']
|
25055 | };
|
25056 | throw _error3;
|
25057 | } else if (currentCommit === otherCommit) {
|
25058 | var _error4 = new Error('Incorrect usage of "merge". Both branches have same head');
|
25059 |
|
25060 | _error4.hash = {
|
25061 | text: 'merge ' + otherBranch,
|
25062 | token: 'merge ' + otherBranch,
|
25063 | line: '1',
|
25064 | loc: {
|
25065 | first_line: 1,
|
25066 | last_line: 1,
|
25067 | first_column: 1,
|
25068 | last_column: 1
|
25069 | },
|
25070 | expected: ['branch abc']
|
25071 | };
|
25072 | throw _error4;
|
25073 | } // if (isReachableFrom(currentCommit, otherCommit)) {
|
25074 | // log.debug('Already merged');
|
25075 | // return;
|
25076 | // }
|
25077 | // if (isfastforwardable(currentCommit, otherCommit)) {
|
25078 | // branches[curBranch] = branches[otherBranch];
|
25079 | // head = commits[branches[curBranch]];
|
25080 | // } else {
|
25081 | // create merge commit
|
25082 |
|
25083 |
|
25084 | var commit = {
|
25085 | id: seq + '-' + getId(),
|
25086 | message: 'merged branch ' + otherBranch + ' into ' + curBranch,
|
25087 | seq: seq++,
|
25088 | parents: [head == null ? null : head.id, branches[otherBranch]],
|
25089 | branch: curBranch,
|
25090 | type: commitType.MERGE,
|
25091 | tag: tag ? tag : ''
|
25092 | };
|
25093 | head = commit;
|
25094 | commits[commit.id] = commit;
|
25095 | branches[curBranch] = commit.id; // }
|
25096 |
|
25097 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug(branches);
|
25098 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('in mergeBranch');
|
25099 | };
|
25100 | var cherryPick = function cherryPick(sourceId, targetId) {
|
25101 | sourceId = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].sanitizeText(sourceId, _config__WEBPACK_IMPORTED_MODULE_0__.getConfig());
|
25102 | targetId = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].sanitizeText(targetId, _config__WEBPACK_IMPORTED_MODULE_0__.getConfig());
|
25103 |
|
25104 | if (!sourceId || typeof commits[sourceId] === 'undefined') {
|
25105 | var error = new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
|
25106 | error.hash = {
|
25107 | text: 'cherryPick ' + sourceId + ' ' + targetId,
|
25108 | token: 'cherryPick ' + sourceId + ' ' + targetId,
|
25109 | line: '1',
|
25110 | loc: {
|
25111 | first_line: 1,
|
25112 | last_line: 1,
|
25113 | first_column: 1,
|
25114 | last_column: 1
|
25115 | },
|
25116 | expected: ['cherry-pick abc']
|
25117 | };
|
25118 | throw error;
|
25119 | }
|
25120 |
|
25121 | var sourceCommit = commits[sourceId];
|
25122 | var sourceCommitBranch = sourceCommit.branch;
|
25123 |
|
25124 | if (sourceCommit.type === commitType.MERGE) {
|
25125 | var _error5 = new Error('Incorrect usage of "cherryPick". Source commit should not be a merge commit');
|
25126 |
|
25127 | _error5.hash = {
|
25128 | text: 'cherryPick ' + sourceId + ' ' + targetId,
|
25129 | token: 'cherryPick ' + sourceId + ' ' + targetId,
|
25130 | line: '1',
|
25131 | loc: {
|
25132 | first_line: 1,
|
25133 | last_line: 1,
|
25134 | first_column: 1,
|
25135 | last_column: 1
|
25136 | },
|
25137 | expected: ['cherry-pick abc']
|
25138 | };
|
25139 | throw _error5;
|
25140 | }
|
25141 |
|
25142 | if (!targetId || typeof commits[targetId] === 'undefined') {
|
25143 | // cherry-pick source commit to current branch
|
25144 | if (sourceCommitBranch === curBranch) {
|
25145 | var _error6 = new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');
|
25146 |
|
25147 | _error6.hash = {
|
25148 | text: 'cherryPick ' + sourceId + ' ' + targetId,
|
25149 | token: 'cherryPick ' + sourceId + ' ' + targetId,
|
25150 | line: '1',
|
25151 | loc: {
|
25152 | first_line: 1,
|
25153 | last_line: 1,
|
25154 | first_column: 1,
|
25155 | last_column: 1
|
25156 | },
|
25157 | expected: ['cherry-pick abc']
|
25158 | };
|
25159 | throw _error6;
|
25160 | }
|
25161 |
|
25162 | var currentCommit = commits[branches[curBranch]];
|
25163 |
|
25164 | if (typeof currentCommit === 'undefined' || !currentCommit) {
|
25165 | var _error7 = new Error('Incorrect usage of "cherry-pick". Current branch (' + curBranch + ')has no commits');
|
25166 |
|
25167 | _error7.hash = {
|
25168 | text: 'cherryPick ' + sourceId + ' ' + targetId,
|
25169 | token: 'cherryPick ' + sourceId + ' ' + targetId,
|
25170 | line: '1',
|
25171 | loc: {
|
25172 | first_line: 1,
|
25173 | last_line: 1,
|
25174 | first_column: 1,
|
25175 | last_column: 1
|
25176 | },
|
25177 | expected: ['cherry-pick abc']
|
25178 | };
|
25179 | throw _error7;
|
25180 | }
|
25181 |
|
25182 | var _commit = {
|
25183 | id: seq + '-' + getId(),
|
25184 | message: 'cherry-picked ' + sourceCommit + ' into ' + curBranch,
|
25185 | seq: seq++,
|
25186 | parents: [head == null ? null : head.id, sourceCommit.id],
|
25187 | branch: curBranch,
|
25188 | type: commitType.CHERRY_PICK,
|
25189 | tag: 'cherry-pick:' + sourceCommit.id
|
25190 | };
|
25191 | head = _commit;
|
25192 | commits[_commit.id] = _commit;
|
25193 | branches[curBranch] = _commit.id;
|
25194 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug(branches);
|
25195 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('in cheeryPick');
|
25196 | }
|
25197 | };
|
25198 | var checkout = function checkout(branch) {
|
25199 | branch = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].sanitizeText(branch, _config__WEBPACK_IMPORTED_MODULE_0__.getConfig());
|
25200 |
|
25201 | if (typeof branches[branch] === 'undefined') {
|
25202 | var error = new Error('Trying to checkout branch which is not yet created. (Help try using "branch ' + branch + '")');
|
25203 | error.hash = {
|
25204 | text: 'checkout ' + branch,
|
25205 | token: 'checkout ' + branch,
|
25206 | line: '1',
|
25207 | loc: {
|
25208 | first_line: 1,
|
25209 | last_line: 1,
|
25210 | first_column: 1,
|
25211 | last_column: 1
|
25212 | },
|
25213 | expected: ['"branch ' + branch + '"']
|
25214 | };
|
25215 | throw error; //branches[branch] = head != null ? head.id : null;
|
25216 | //log.debug('in createBranch');
|
25217 | } else {
|
25218 | curBranch = branch;
|
25219 | var id = branches[curBranch];
|
25220 | head = commits[id];
|
25221 | }
|
25222 | }; // export const reset = function (commitRef) {
|
25223 | // log.debug('in reset', commitRef);
|
25224 | // const ref = commitRef.split(':')[0];
|
25225 | // let parentCount = parseInt(commitRef.split(':')[1]);
|
25226 | // let commit = ref === 'HEAD' ? head : commits[branches[ref]];
|
25227 | // log.debug(commit, parentCount);
|
25228 | // while (parentCount > 0) {
|
25229 | // commit = commits[commit.parent];
|
25230 | // parentCount--;
|
25231 | // if (!commit) {
|
25232 | // const err = 'Critical error - unique parent commit not found during reset';
|
25233 | // log.error(err);
|
25234 | // throw err;
|
25235 | // }
|
25236 | // }
|
25237 | // head = commit;
|
25238 | // branches[curBranch] = commit.id;
|
25239 | // };
|
25240 |
|
25241 | /**
|
25242 | * @param arr
|
25243 | * @param key
|
25244 | * @param newval
|
25245 | */
|
25246 |
|
25247 | function upsert(arr, key, newval) {
|
25248 | var index = arr.indexOf(key);
|
25249 |
|
25250 | if (index === -1) {
|
25251 | arr.push(newval);
|
25252 | } else {
|
25253 | arr.splice(index, 1, newval);
|
25254 | }
|
25255 | }
|
25256 | /** @param commitArr */
|
25257 |
|
25258 |
|
25259 | function prettyPrintCommitHistory(commitArr) {
|
25260 | var commit = commitArr.reduce(function (out, commit) {
|
25261 | if (out.seq > commit.seq) return out;
|
25262 | return commit;
|
25263 | }, commitArr[0]);
|
25264 | var line = '';
|
25265 | commitArr.forEach(function (c) {
|
25266 | if (c === commit) {
|
25267 | line += '\t*';
|
25268 | } else {
|
25269 | line += '\t|';
|
25270 | }
|
25271 | });
|
25272 | var label = [line, commit.id, commit.seq];
|
25273 |
|
25274 | for (var _branch in branches) {
|
25275 | if (branches[_branch] === commit.id) label.push(_branch);
|
25276 | }
|
25277 |
|
25278 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug(label.join(' '));
|
25279 |
|
25280 | if (commit.parents && commit.parents.length == 2) {
|
25281 | var newCommit = commits[commit.parents[0]];
|
25282 | upsert(commitArr, commit, newCommit);
|
25283 | commitArr.push(commits[commit.parents[1]]);
|
25284 | } else if (commit.parents.length == 0) {
|
25285 | return;
|
25286 | } else {
|
25287 | var nextCommit = commits[commit.parents];
|
25288 | upsert(commitArr, commit, nextCommit);
|
25289 | }
|
25290 |
|
25291 | commitArr = uniqBy(commitArr, function (c) {
|
25292 | return c.id;
|
25293 | });
|
25294 | prettyPrintCommitHistory(commitArr);
|
25295 | }
|
25296 |
|
25297 | var prettyPrint = function prettyPrint() {
|
25298 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug(commits);
|
25299 | var node = getCommitsArray()[0];
|
25300 | prettyPrintCommitHistory([node]);
|
25301 | };
|
25302 | var clear = function clear() {
|
25303 | commits = {};
|
25304 | head = null;
|
25305 | var mainBranch = (0,_config__WEBPACK_IMPORTED_MODULE_0__.getConfig)().gitGraph.mainBranchName;
|
25306 | var mainBranchOrder = (0,_config__WEBPACK_IMPORTED_MODULE_0__.getConfig)().gitGraph.mainBranchOrder;
|
25307 | branches = {};
|
25308 | branches[mainBranch] = null;
|
25309 | branchesConfig = {};
|
25310 | branchesConfig[mainBranch] = {
|
25311 | name: mainBranch,
|
25312 | order: mainBranchOrder
|
25313 | };
|
25314 | curBranch = mainBranch;
|
25315 | seq = 0;
|
25316 | (0,_commonDb__WEBPACK_IMPORTED_MODULE_5__.clear)();
|
25317 | };
|
25318 | var getBranchesAsObjArray = function getBranchesAsObjArray() {
|
25319 | var branchesArray = Object.values(branchesConfig).map(function (branchConfig, i) {
|
25320 | if (branchConfig.order !== null) return branchConfig;
|
25321 | return _objectSpread(_objectSpread({}, branchConfig), {}, {
|
25322 | order: parseFloat("0.".concat(i), 10)
|
25323 | });
|
25324 | }).sort(function (a, b) {
|
25325 | return a.order - b.order;
|
25326 | }).map(function (_ref) {
|
25327 | var name = _ref.name;
|
25328 | return {
|
25329 | name: name
|
25330 | };
|
25331 | });
|
25332 | return branchesArray;
|
25333 | };
|
25334 | var getBranches = function getBranches() {
|
25335 | return branches;
|
25336 | };
|
25337 | var getCommits = function getCommits() {
|
25338 | return commits;
|
25339 | };
|
25340 | var getCommitsArray = function getCommitsArray() {
|
25341 | var commitArr = Object.keys(commits).map(function (key) {
|
25342 | return commits[key];
|
25343 | });
|
25344 | commitArr.forEach(function (o) {
|
25345 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug(o.id);
|
25346 | });
|
25347 | commitArr.sort(function (a, b) {
|
25348 | return a.seq - b.seq;
|
25349 | });
|
25350 | return commitArr;
|
25351 | };
|
25352 | var getCurrentBranch = function getCurrentBranch() {
|
25353 | return curBranch;
|
25354 | };
|
25355 | var getDirection = function getDirection() {
|
25356 | return direction;
|
25357 | };
|
25358 | var getHead = function getHead() {
|
25359 | return head;
|
25360 | };
|
25361 | var commitType = {
|
25362 | NORMAL: 0,
|
25363 | REVERSE: 1,
|
25364 | HIGHLIGHT: 2,
|
25365 | MERGE: 3,
|
25366 | CHERRY_PICK: 4
|
25367 | };
|
25368 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
25369 | parseDirective: parseDirective,
|
25370 | getConfig: function getConfig() {
|
25371 | return _config__WEBPACK_IMPORTED_MODULE_0__.getConfig().gitGraph;
|
25372 | },
|
25373 | setDirection: setDirection,
|
25374 | setOptions: setOptions,
|
25375 | getOptions: getOptions,
|
25376 | commit: commit,
|
25377 | branch: branch,
|
25378 | merge: merge,
|
25379 | cherryPick: cherryPick,
|
25380 | checkout: checkout,
|
25381 | //reset,
|
25382 | prettyPrint: prettyPrint,
|
25383 | clear: clear,
|
25384 | getBranchesAsObjArray: getBranchesAsObjArray,
|
25385 | getBranches: getBranches,
|
25386 | getCommits: getCommits,
|
25387 | getCommitsArray: getCommitsArray,
|
25388 | getCurrentBranch: getCurrentBranch,
|
25389 | getDirection: getDirection,
|
25390 | getHead: getHead,
|
25391 | setAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_5__.setAccTitle,
|
25392 | getAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_5__.getAccTitle,
|
25393 | getAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_5__.getAccDescription,
|
25394 | setAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_5__.setAccDescription,
|
25395 | commitType: commitType
|
25396 | });
|
25397 |
|
25398 | /***/ }),
|
25399 |
|
25400 | /***/ "./src/diagrams/git/gitGraphDetector.js":
|
25401 | /*!**********************************************!*\
|
25402 | !*** ./src/diagrams/git/gitGraphDetector.js ***!
|
25403 | \**********************************************/
|
25404 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
25405 |
|
25406 | "use strict";
|
25407 | __webpack_require__.r(__webpack_exports__);
|
25408 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
25409 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
25410 | /* harmony export */ });
|
25411 | var detector = function detector(txt) {
|
25412 | if (txt.match(/^\s*gitGraph/)) {
|
25413 | return 'gitGraph';
|
25414 | }
|
25415 |
|
25416 | return null;
|
25417 | };
|
25418 |
|
25419 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (detector);
|
25420 |
|
25421 | /***/ }),
|
25422 |
|
25423 | /***/ "./src/diagrams/git/gitGraphRenderer.js":
|
25424 | /*!**********************************************!*\
|
25425 | !*** ./src/diagrams/git/gitGraphRenderer.js ***!
|
25426 | \**********************************************/
|
25427 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
25428 |
|
25429 | "use strict";
|
25430 | __webpack_require__.r(__webpack_exports__);
|
25431 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
25432 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
25433 | /* harmony export */ "draw": () => (/* binding */ draw)
|
25434 | /* harmony export */ });
|
25435 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
25436 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
25437 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
25438 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
25439 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
25440 | /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js");
|
25441 |
|
25442 |
|
25443 |
|
25444 |
|
25445 |
|
25446 | var allCommitsDict = {};
|
25447 | var branchNum;
|
25448 | var commitType = {
|
25449 | NORMAL: 0,
|
25450 | REVERSE: 1,
|
25451 | HIGHLIGHT: 2,
|
25452 | MERGE: 3,
|
25453 | CHERRY_PICK: 4
|
25454 | };
|
25455 | var THEME_COLOR_LIMIT = 8;
|
25456 | var branchPos = {};
|
25457 | var commitPos = {};
|
25458 | var lanes = [];
|
25459 | var maxPos = 0;
|
25460 |
|
25461 | var clear = function clear() {
|
25462 | branchPos = {};
|
25463 | commitPos = {};
|
25464 | allCommitsDict = {};
|
25465 | maxPos = 0;
|
25466 | lanes = [];
|
25467 | };
|
25468 | /**
|
25469 | * Draws a text, used for labels of the branches
|
25470 | *
|
25471 | * @param {string} txt The text
|
25472 | * @returns {SVGElement}
|
25473 | */
|
25474 |
|
25475 |
|
25476 | var drawText = function drawText(txt) {
|
25477 | var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
25478 | var rows = []; // Handling of new lines in the label
|
25479 |
|
25480 | if (typeof txt === 'string') {
|
25481 | rows = txt.split(/\\n|\n|<br\s*\/?>/gi);
|
25482 | } else if (Array.isArray(txt)) {
|
25483 | rows = txt;
|
25484 | } else {
|
25485 | rows = [];
|
25486 | }
|
25487 |
|
25488 | for (var j = 0; j < rows.length; j++) {
|
25489 | var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
25490 | tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
25491 | tspan.setAttribute('dy', '1em');
|
25492 | tspan.setAttribute('x', '0');
|
25493 | tspan.setAttribute('class', 'row');
|
25494 | tspan.textContent = rows[j].trim();
|
25495 | svgLabel.appendChild(tspan);
|
25496 | }
|
25497 | /**
|
25498 | * @param svg
|
25499 | * @param selector
|
25500 | */
|
25501 |
|
25502 |
|
25503 | return svgLabel;
|
25504 | };
|
25505 | /**
|
25506 | * Draws the commits with its symbol and labels. The function has two modes, one which only
|
25507 | * calculates the positions and one that does the actual drawing. This for a simple way getting the
|
25508 | * vertical layering correct in the graph.
|
25509 | *
|
25510 | * @param {any} svg
|
25511 | * @param {any} commits
|
25512 | * @param {any} modifyGraph
|
25513 | */
|
25514 |
|
25515 |
|
25516 | var drawCommits = function drawCommits(svg, commits, modifyGraph) {
|
25517 | var gitGraphConfig = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().gitGraph;
|
25518 | var gBullets = svg.append('g').attr('class', 'commit-bullets');
|
25519 | var gLabels = svg.append('g').attr('class', 'commit-labels');
|
25520 | var pos = 0;
|
25521 | var keys = Object.keys(commits);
|
25522 | var sortedKeys = keys.sort(function (a, b) {
|
25523 | return commits[a].seq - commits[b].seq;
|
25524 | });
|
25525 | sortedKeys.forEach(function (key, index) {
|
25526 | var commit = commits[key];
|
25527 | var y = branchPos[commit.branch].pos;
|
25528 | var x = pos + 10; // Don't draw the commits now but calculate the positioning which is used by the branch lines etc.
|
25529 |
|
25530 | if (modifyGraph) {
|
25531 | var typeClass;
|
25532 |
|
25533 | switch (commit.type) {
|
25534 | case commitType.NORMAL:
|
25535 | typeClass = 'commit-normal';
|
25536 | break;
|
25537 |
|
25538 | case commitType.REVERSE:
|
25539 | typeClass = 'commit-reverse';
|
25540 | break;
|
25541 |
|
25542 | case commitType.HIGHLIGHT:
|
25543 | typeClass = 'commit-highlight';
|
25544 | break;
|
25545 |
|
25546 | case commitType.MERGE:
|
25547 | typeClass = 'commit-merge';
|
25548 | break;
|
25549 |
|
25550 | case commitType.CHERRY_PICK:
|
25551 | typeClass = 'commit-cherry-pick';
|
25552 | break;
|
25553 |
|
25554 | default:
|
25555 | typeClass = 'commit-normal';
|
25556 | }
|
25557 |
|
25558 | if (commit.type === commitType.HIGHLIGHT) {
|
25559 | var circle = gBullets.append('rect');
|
25560 | circle.attr('x', x - 10);
|
25561 | circle.attr('y', y - 10);
|
25562 | circle.attr('height', 20);
|
25563 | circle.attr('width', 20);
|
25564 | circle.attr('class', "commit ".concat(commit.id, " commit-highlight").concat(branchPos[commit.branch].index % THEME_COLOR_LIMIT, " ").concat(typeClass, "-outer"));
|
25565 | gBullets.append('rect').attr('x', x - 6).attr('y', y - 6).attr('height', 12).attr('width', 12).attr('class', "commit ".concat(commit.id, " commit").concat(branchPos[commit.branch].index % THEME_COLOR_LIMIT, " ").concat(typeClass, "-inner"));
|
25566 | } else if (commit.type === commitType.CHERRY_PICK) {
|
25567 | gBullets.append('circle').attr('cx', x).attr('cy', y).attr('r', 10).attr('class', "commit ".concat(commit.id, " ").concat(typeClass));
|
25568 | gBullets.append('circle').attr('cx', x - 3).attr('cy', y + 2).attr('r', 2.75).attr('fill', '#fff').attr('class', "commit ".concat(commit.id, " ").concat(typeClass));
|
25569 | gBullets.append('circle').attr('cx', x + 3).attr('cy', y + 2).attr('r', 2.75).attr('fill', '#fff').attr('class', "commit ".concat(commit.id, " ").concat(typeClass));
|
25570 | gBullets.append('line').attr('x1', x + 3).attr('y1', y + 1).attr('x2', x).attr('y2', y - 5).attr('stroke', '#fff').attr('class', "commit ".concat(commit.id, " ").concat(typeClass));
|
25571 | gBullets.append('line').attr('x1', x - 3).attr('y1', y + 1).attr('x2', x).attr('y2', y - 5).attr('stroke', '#fff').attr('class', "commit ".concat(commit.id, " ").concat(typeClass));
|
25572 | } else {
|
25573 | var _circle = gBullets.append('circle');
|
25574 |
|
25575 | _circle.attr('cx', x);
|
25576 |
|
25577 | _circle.attr('cy', y);
|
25578 |
|
25579 | _circle.attr('r', commit.type === commitType.MERGE ? 9 : 10);
|
25580 |
|
25581 | _circle.attr('class', "commit ".concat(commit.id, " commit").concat(branchPos[commit.branch].index % THEME_COLOR_LIMIT));
|
25582 |
|
25583 | if (commit.type === commitType.MERGE) {
|
25584 | var circle2 = gBullets.append('circle');
|
25585 | circle2.attr('cx', x);
|
25586 | circle2.attr('cy', y);
|
25587 | circle2.attr('r', 6);
|
25588 | circle2.attr('class', "commit ".concat(typeClass, " ").concat(commit.id, " commit").concat(branchPos[commit.branch].index % THEME_COLOR_LIMIT));
|
25589 | }
|
25590 |
|
25591 | if (commit.type === commitType.REVERSE) {
|
25592 | var cross = gBullets.append('path');
|
25593 | cross.attr('d', "M ".concat(x - 5, ",").concat(y - 5, "L").concat(x + 5, ",").concat(y + 5, "M").concat(x - 5, ",").concat(y + 5, "L").concat(x + 5, ",").concat(y - 5)).attr('class', "commit ".concat(typeClass, " ").concat(commit.id, " commit").concat(branchPos[commit.branch].index % THEME_COLOR_LIMIT));
|
25594 | }
|
25595 | }
|
25596 | }
|
25597 |
|
25598 | commitPos[commit.id] = {
|
25599 | x: pos + 10,
|
25600 | y: y
|
25601 | }; // The first iteration over the commits are for positioning purposes, this
|
25602 | // is required for drawing the lines. The circles and labels is drawn after the labels
|
25603 | // placing them on top of the lines.
|
25604 |
|
25605 | if (modifyGraph) {
|
25606 | var px = 4;
|
25607 | var py = 2; // Draw the commit label
|
25608 |
|
25609 | if (commit.type !== commitType.CHERRY_PICK && commit.type !== commitType.MERGE && gitGraphConfig.showCommitLabel) {
|
25610 | var wrapper = gLabels.append('g');
|
25611 | var labelBkg = wrapper.insert('rect').attr('class', 'commit-label-bkg');
|
25612 | var text = wrapper.append('text').attr('x', pos).attr('y', y + 25).attr('class', 'commit-label').text(commit.id);
|
25613 | var bbox = text.node().getBBox(); // Now we have the label, lets position the background
|
25614 |
|
25615 | labelBkg.attr('x', pos + 10 - bbox.width / 2 - py).attr('y', y + 13.5).attr('width', bbox.width + 2 * py).attr('height', bbox.height + 2 * py);
|
25616 | text.attr('x', pos + 10 - bbox.width / 2);
|
25617 |
|
25618 | if (gitGraphConfig.rotateCommitLabel) {
|
25619 | var r_x = -7.5 - (bbox.width + 10) / 25 * 9.5;
|
25620 | var r_y = 10 + bbox.width / 25 * 8.5;
|
25621 | wrapper.attr('transform', 'translate(' + r_x + ', ' + r_y + ') rotate(' + -45 + ', ' + pos + ', ' + y + ')');
|
25622 | }
|
25623 | }
|
25624 |
|
25625 | if (commit.tag) {
|
25626 | var rect = gLabels.insert('polygon');
|
25627 | var hole = gLabels.append('circle');
|
25628 | var tag = gLabels.append('text') // Note that we are delaying setting the x position until we know the width of the text
|
25629 | .attr('y', y - 16).attr('class', 'tag-label').text(commit.tag);
|
25630 | var tagBbox = tag.node().getBBox();
|
25631 | tag.attr('x', pos + 10 - tagBbox.width / 2);
|
25632 | var h2 = tagBbox.height / 2;
|
25633 | var ly = y - 19.2;
|
25634 | rect.attr('class', 'tag-label-bkg').attr('points', "\n ".concat(pos - tagBbox.width / 2 - px / 2, ",").concat(ly + py, "\n ").concat(pos - tagBbox.width / 2 - px / 2, ",").concat(ly - py, "\n ").concat(pos + 10 - tagBbox.width / 2 - px, ",").concat(ly - h2 - py, "\n ").concat(pos + 10 + tagBbox.width / 2 + px, ",").concat(ly - h2 - py, "\n ").concat(pos + 10 + tagBbox.width / 2 + px, ",").concat(ly + h2 + py, "\n ").concat(pos + 10 - tagBbox.width / 2 - px, ",").concat(ly + h2 + py));
|
25635 | hole.attr('cx', pos - tagBbox.width / 2 + px / 2).attr('cy', ly).attr('r', 1.5).attr('class', 'tag-hole');
|
25636 | }
|
25637 | }
|
25638 |
|
25639 | pos += 50;
|
25640 |
|
25641 | if (pos > maxPos) {
|
25642 | maxPos = pos;
|
25643 | }
|
25644 | });
|
25645 | };
|
25646 | /**
|
25647 | * Detect if there are other commits between commit1s x-position and commit2s x-position on the same
|
25648 | * branch as commit2.
|
25649 | *
|
25650 | * @param {any} commit1
|
25651 | * @param {any} commit2
|
25652 | * @param allCommits
|
25653 | * @returns
|
25654 | */
|
25655 |
|
25656 |
|
25657 | var hasOverlappingCommits = function hasOverlappingCommits(commit1, commit2, allCommits) {
|
25658 | var commit1Pos = commitPos[commit2.id];
|
25659 | var commit2Pos = commitPos[commit1.id]; // Find commits on the same branch as commit2
|
25660 |
|
25661 | var keys = Object.keys(allCommits);
|
25662 | var overlappingComits = keys.filter(function (key) {
|
25663 | return allCommits[key].branch === commit2.branch && allCommits[key].seq > commit1.seq && allCommits[key].seq < commit2.seq;
|
25664 | });
|
25665 | return overlappingComits.length > 0;
|
25666 | };
|
25667 | /**
|
25668 | * This function find a lane in the y-axis that is not overlapping with any other lanes. This is
|
25669 | * used for drawing the lines between commits.
|
25670 | *
|
25671 | * @param {any} y1
|
25672 | * @param {any} y2
|
25673 | * @param {any} _depth
|
25674 | * @returns
|
25675 | */
|
25676 |
|
25677 |
|
25678 | var findLane = function findLane(y1, y2, _depth) {
|
25679 | var depth = _depth || 0;
|
25680 | var candidate = y1 + Math.abs(y1 - y2) / 2;
|
25681 |
|
25682 | if (depth > 5) {
|
25683 | return candidate;
|
25684 | }
|
25685 |
|
25686 | var ok = true;
|
25687 |
|
25688 | for (var i = 0; i < lanes.length; i++) {
|
25689 | if (Math.abs(lanes[i] - candidate) < 10) {
|
25690 | ok = false;
|
25691 | }
|
25692 | }
|
25693 |
|
25694 | if (ok) {
|
25695 | lanes.push(candidate);
|
25696 | return candidate;
|
25697 | }
|
25698 |
|
25699 | var diff = Math.abs(y1 - y2);
|
25700 | return findLane(y1, y2 - diff / 5, depth);
|
25701 | };
|
25702 | /**
|
25703 | * This function draw the lines between the commits. They were arrows initially.
|
25704 | *
|
25705 | * @param {any} svg
|
25706 | * @param {any} commit1
|
25707 | * @param {any} commit2
|
25708 | * @param {any} allCommits
|
25709 | */
|
25710 |
|
25711 |
|
25712 | var drawArrow = function drawArrow(svg, commit1, commit2, allCommits) {
|
25713 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)();
|
25714 | var p1 = commitPos[commit1.id];
|
25715 | var p2 = commitPos[commit2.id];
|
25716 | var overlappingCommits = hasOverlappingCommits(commit1, commit2, allCommits); // log.debug('drawArrow', p1, p2, overlappingCommits, commit1.id, commit2.id);
|
25717 |
|
25718 | var url = '';
|
25719 |
|
25720 | if (conf.arrowMarkerAbsolute) {
|
25721 | url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
|
25722 | url = url.replace(/\(/g, '\\(');
|
25723 | url = url.replace(/\)/g, '\\)');
|
25724 | }
|
25725 |
|
25726 | var arc = '';
|
25727 | var arc2 = '';
|
25728 | var radius = 0;
|
25729 | var offset = 0;
|
25730 | var colorClassNum = branchPos[commit2.branch].index;
|
25731 | var lineDef;
|
25732 |
|
25733 | if (overlappingCommits) {
|
25734 | arc = 'A 10 10, 0, 0, 0,';
|
25735 | arc2 = 'A 10 10, 0, 0, 1,';
|
25736 | radius = 10;
|
25737 | offset = 10; // Figure out the color of the arrow,arrows going down take the color from the destination branch
|
25738 |
|
25739 | colorClassNum = branchPos[commit2.branch].index;
|
25740 | var lineY = p1.y < p2.y ? findLane(p1.y, p2.y) : findLane(p2.y, p1.y);
|
25741 |
|
25742 | if (p1.y < p2.y) {
|
25743 | lineDef = "M ".concat(p1.x, " ").concat(p1.y, " L ").concat(p1.x, " ").concat(lineY - radius, " ").concat(arc, " ").concat(p1.x + offset, " ").concat(lineY, " L ").concat(p2.x - radius, " ").concat(lineY, " ").concat(arc2, " ").concat(p2.x, " ").concat(lineY + offset, " L ").concat(p2.x, " ").concat(p2.y);
|
25744 | } else {
|
25745 | lineDef = "M ".concat(p1.x, " ").concat(p1.y, " L ").concat(p1.x, " ").concat(lineY + radius, " ").concat(arc2, " ").concat(p1.x + offset, " ").concat(lineY, " L ").concat(p2.x - radius, " ").concat(lineY, " ").concat(arc, " ").concat(p2.x, " ").concat(lineY - offset, " L ").concat(p2.x, " ").concat(p2.y);
|
25746 | }
|
25747 | } else {
|
25748 | if (p1.y < p2.y) {
|
25749 | arc = 'A 20 20, 0, 0, 0,';
|
25750 | radius = 20;
|
25751 | offset = 20; // Figure out the color of the arrow,arrows going down take the color from the destination branch
|
25752 |
|
25753 | colorClassNum = branchPos[commit2.branch].index;
|
25754 | lineDef = "M ".concat(p1.x, " ").concat(p1.y, " L ").concat(p1.x, " ").concat(p2.y - radius, " ").concat(arc, " ").concat(p1.x + offset, " ").concat(p2.y, " L ").concat(p2.x, " ").concat(p2.y);
|
25755 | }
|
25756 |
|
25757 | if (p1.y > p2.y) {
|
25758 | arc = 'A 20 20, 0, 0, 0,';
|
25759 | radius = 20;
|
25760 | offset = 20; // Arrows going up take the color from the source branch
|
25761 |
|
25762 | colorClassNum = branchPos[commit1.branch].index;
|
25763 | lineDef = "M ".concat(p1.x, " ").concat(p1.y, " L ").concat(p2.x - radius, " ").concat(p1.y, " ").concat(arc, " ").concat(p2.x, " ").concat(p1.y - offset, " L ").concat(p2.x, " ").concat(p2.y);
|
25764 | }
|
25765 |
|
25766 | if (p1.y === p2.y) {
|
25767 | colorClassNum = branchPos[commit1.branch].index;
|
25768 | lineDef = "M ".concat(p1.x, " ").concat(p1.y, " L ").concat(p1.x, " ").concat(p2.y - radius, " ").concat(arc, " ").concat(p1.x + offset, " ").concat(p2.y, " L ").concat(p2.x, " ").concat(p2.y);
|
25769 | }
|
25770 | }
|
25771 |
|
25772 | var arrow = svg.append('path').attr('d', lineDef).attr('class', 'arrow arrow' + colorClassNum % THEME_COLOR_LIMIT);
|
25773 | };
|
25774 |
|
25775 | var drawArrows = function drawArrows(svg, commits) {
|
25776 | var gArrows = svg.append('g').attr('class', 'commit-arrows');
|
25777 | var pos = 0;
|
25778 | var k = Object.keys(commits);
|
25779 | k.forEach(function (key, index) {
|
25780 | var commit = commits[key];
|
25781 |
|
25782 | if (commit.parents && commit.parents.length > 0) {
|
25783 | commit.parents.forEach(function (parent) {
|
25784 | drawArrow(gArrows, commits[parent], commit, commits);
|
25785 | });
|
25786 | }
|
25787 | });
|
25788 | };
|
25789 | /**
|
25790 | * This function adds the branches and the branches' labels to the svg.
|
25791 | *
|
25792 | * @param svg
|
25793 | * @param commitid
|
25794 | * @param branches
|
25795 | * @param direction
|
25796 | */
|
25797 |
|
25798 |
|
25799 | var drawBranches = function drawBranches(svg, branches) {
|
25800 | var gitGraphConfig = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().gitGraph;
|
25801 | var g = svg.append('g');
|
25802 | branches.forEach(function (branch, index) {
|
25803 | var adjustIndexForTheme = index % THEME_COLOR_LIMIT;
|
25804 | var pos = branchPos[branch.name].pos;
|
25805 | var line = g.append('line');
|
25806 | line.attr('x1', 0);
|
25807 | line.attr('y1', pos);
|
25808 | line.attr('x2', maxPos);
|
25809 | line.attr('y2', pos);
|
25810 | line.attr('class', 'branch branch' + adjustIndexForTheme);
|
25811 | lanes.push(pos);
|
25812 | var name = branch.name; // Create the actual text element
|
25813 |
|
25814 | var labelElement = drawText(name); // Create outer g, edgeLabel, this will be positioned after graph layout
|
25815 |
|
25816 | var bkg = g.insert('rect');
|
25817 | var branchLabel = g.insert('g').attr('class', 'branchLabel'); // Create inner g, label, this will be positioned now for centering the text
|
25818 |
|
25819 | var label = branchLabel.insert('g').attr('class', 'label branch-label' + adjustIndexForTheme);
|
25820 | label.node().appendChild(labelElement);
|
25821 | var bbox = labelElement.getBBox();
|
25822 | bkg.attr('class', 'branchLabelBkg label' + adjustIndexForTheme).attr('rx', 4).attr('ry', 4).attr('x', -bbox.width - 4 - (gitGraphConfig.rotateCommitLabel === true ? 30 : 0)).attr('y', -bbox.height / 2 + 8).attr('width', bbox.width + 18).attr('height', bbox.height + 4);
|
25823 | label.attr('transform', 'translate(' + (-bbox.width - 14 - (gitGraphConfig.rotateCommitLabel === true ? 30 : 0)) + ', ' + (pos - bbox.height / 2 - 1) + ')');
|
25824 | bkg.attr('transform', 'translate(' + -19 + ', ' + (pos - bbox.height / 2) + ')');
|
25825 | });
|
25826 | };
|
25827 | /**
|
25828 | * @param svg
|
25829 | * @param commit
|
25830 | * @param direction
|
25831 | * @param branchColor
|
25832 | * @param txt
|
25833 | * @param id
|
25834 | * @param ver
|
25835 | * @param diagObj
|
25836 | */
|
25837 |
|
25838 |
|
25839 | var draw = function draw(txt, id, ver, diagObj) {
|
25840 | clear();
|
25841 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)();
|
25842 | var gitGraphConfig = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().gitGraph; // try {
|
25843 |
|
25844 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('in gitgraph renderer', txt + '\n', 'id:', id, ver);
|
25845 | allCommitsDict = diagObj.db.getCommits();
|
25846 | var branches = diagObj.db.getBranchesAsObjArray(); // Position branches vertically
|
25847 |
|
25848 | var pos = 0;
|
25849 | branches.forEach(function (branch, index) {
|
25850 | branchPos[branch.name] = {
|
25851 | pos: pos,
|
25852 | index: index
|
25853 | };
|
25854 | pos += 50 + (gitGraphConfig.rotateCommitLabel ? 40 : 0);
|
25855 | });
|
25856 | var diagram = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id=\"".concat(id, "\"]")); // Adds title and description to the flow chart
|
25857 |
|
25858 | (0,_accessibility__WEBPACK_IMPORTED_MODULE_3__["default"])(diagObj.db, diagram, id);
|
25859 | drawCommits(diagram, allCommitsDict, false);
|
25860 |
|
25861 | if (gitGraphConfig.showBranches) {
|
25862 | drawBranches(diagram, branches);
|
25863 | }
|
25864 |
|
25865 | drawArrows(diagram, allCommitsDict);
|
25866 | drawCommits(diagram, allCommitsDict, true);
|
25867 | var padding = gitGraphConfig.diagramPadding;
|
25868 | var svgBounds = diagram.node().getBBox();
|
25869 | var width = svgBounds.width + padding * 2;
|
25870 | var height = svgBounds.height + padding * 2;
|
25871 | (0,_utils__WEBPACK_IMPORTED_MODULE_4__.configureSvgSize)(diagram, height, width, conf.useMaxWidth);
|
25872 | var vBox = "".concat(svgBounds.x - padding - (gitGraphConfig.showBranches && gitGraphConfig.rotateCommitLabel === true ? 30 : 0), " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
|
25873 | diagram.attr('viewBox', vBox);
|
25874 | };
|
25875 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
25876 | draw: draw
|
25877 | });
|
25878 |
|
25879 | /***/ }),
|
25880 |
|
25881 | /***/ "./src/diagrams/git/styles.js":
|
25882 | /*!************************************!*\
|
25883 | !*** ./src/diagrams/git/styles.js ***!
|
25884 | \************************************/
|
25885 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
25886 |
|
25887 | "use strict";
|
25888 | __webpack_require__.r(__webpack_exports__);
|
25889 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
25890 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
25891 | /* harmony export */ });
|
25892 | var getStyles = function getStyles(options) {
|
25893 | return "\n .commit-id,\n .commit-msg,\n .branch-label {\n fill: lightgrey;\n color: lightgrey;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n ".concat([0, 1, 2, 3, 4, 5, 6, 7].map(function (i) {
|
25894 | return "\n .branch-label".concat(i, " { fill: ").concat(options['gitBranchLabel' + i], "; }\n .commit").concat(i, " { stroke: ").concat(options['git' + i], "; fill: ").concat(options['git' + i], "; }\n .commit-highlight").concat(i, " { stroke: ").concat(options['gitInv' + i], "; fill: ").concat(options['gitInv' + i], "; }\n .label").concat(i, " { fill: ").concat(options['git' + i], "; }\n .arrow").concat(i, " { stroke: ").concat(options['git' + i], "; }\n ");
|
25895 | }).join('\n'), "\n\n .branch {\n stroke-width: 1;\n stroke: ").concat(options.lineColor, ";\n stroke-dasharray: 2;\n }\n .commit-label { font-size: ").concat(options.commitLabelFontSize, "; fill: ").concat(options.commitLabelColor, ";}\n .commit-label-bkg { font-size: ").concat(options.commitLabelFontSize, "; fill: ").concat(options.commitLabelBackground, "; opacity: 0.5; }\n .tag-label { font-size: ").concat(options.tagLabelFontSize, "; fill: ").concat(options.tagLabelColor, ";}\n .tag-label-bkg { fill: ").concat(options.tagLabelBackground, "; stroke: ").concat(options.tagLabelBorder, "; }\n .tag-hole { fill: ").concat(options.textColor, "; }\n\n .commit-merge {\n stroke: ").concat(options.primaryColor, ";\n fill: ").concat(options.primaryColor, ";\n }\n .commit-reverse {\n stroke: ").concat(options.primaryColor, ";\n fill: ").concat(options.primaryColor, ";\n stroke-width: 3;\n }\n .commit-highlight-outer {\n }\n .commit-highlight-inner {\n stroke: ").concat(options.primaryColor, ";\n fill: ").concat(options.primaryColor, ";\n }\n\n .arrow { stroke-width: 8; stroke-linecap: round; fill: none}\n }\n");
|
25896 | };
|
25897 |
|
25898 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
25899 |
|
25900 | /***/ }),
|
25901 |
|
25902 | /***/ "./src/diagrams/info/infoDb.js":
|
25903 | /*!*************************************!*\
|
25904 | !*** ./src/diagrams/info/infoDb.js ***!
|
25905 | \*************************************/
|
25906 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
25907 |
|
25908 | "use strict";
|
25909 | __webpack_require__.r(__webpack_exports__);
|
25910 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
25911 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
25912 | /* harmony export */ "getInfo": () => (/* binding */ getInfo),
|
25913 | /* harmony export */ "getMessage": () => (/* binding */ getMessage),
|
25914 | /* harmony export */ "setInfo": () => (/* binding */ setInfo),
|
25915 | /* harmony export */ "setMessage": () => (/* binding */ setMessage)
|
25916 | /* harmony export */ });
|
25917 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
25918 | /** Created by knut on 15-01-14. */
|
25919 |
|
25920 | var message = '';
|
25921 | var info = false;
|
25922 | var setMessage = function setMessage(txt) {
|
25923 | _logger__WEBPACK_IMPORTED_MODULE_0__.log.debug('Setting message to: ' + txt);
|
25924 | message = txt;
|
25925 | };
|
25926 | var getMessage = function getMessage() {
|
25927 | return message;
|
25928 | };
|
25929 | var setInfo = function setInfo(inf) {
|
25930 | info = inf;
|
25931 | };
|
25932 | var getInfo = function getInfo() {
|
25933 | return info;
|
25934 | }; // export const parseError = (err, hash) => {
|
25935 | // global.mermaidAPI.parseError(err, hash)
|
25936 | // }
|
25937 |
|
25938 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
25939 | setMessage: setMessage,
|
25940 | getMessage: getMessage,
|
25941 | setInfo: setInfo,
|
25942 | getInfo: getInfo // parseError
|
25943 |
|
25944 | });
|
25945 |
|
25946 | /***/ }),
|
25947 |
|
25948 | /***/ "./src/diagrams/info/infoRenderer.js":
|
25949 | /*!*******************************************!*\
|
25950 | !*** ./src/diagrams/info/infoRenderer.js ***!
|
25951 | \*******************************************/
|
25952 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
25953 |
|
25954 | "use strict";
|
25955 | __webpack_require__.r(__webpack_exports__);
|
25956 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
25957 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
25958 | /* harmony export */ "draw": () => (/* binding */ draw)
|
25959 | /* harmony export */ });
|
25960 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
25961 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
25962 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
25963 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
25964 | /** Created by knut on 14-12-11. */
|
25965 |
|
25966 |
|
25967 |
|
25968 | /**
|
25969 | * Draws a an info picture in the tag with id: id based on the graph definition in text.
|
25970 | *
|
25971 | * @param {any} text
|
25972 | * @param {any} id
|
25973 | * @param {any} version
|
25974 | * @param diagObj
|
25975 | */
|
25976 |
|
25977 | var draw = function draw(text, id, version, diagObj) {
|
25978 | try {
|
25979 | // const parser = infoParser.parser;
|
25980 | // parser.yy = db;
|
25981 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Renering info diagram\n' + text);
|
25982 | var securityLevel = (0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().securityLevel; // Handle root and Document for when rendering in sanbox mode
|
25983 |
|
25984 | var sandboxElement;
|
25985 |
|
25986 | if (securityLevel === 'sandbox') {
|
25987 | sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#i' + id);
|
25988 | }
|
25989 |
|
25990 | var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body');
|
25991 | var doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; // Parse the graph definition
|
25992 | // parser.parse(text);
|
25993 | // log.debug('Parsed info diagram');
|
25994 | // Fetch the default direction, use TD if none was found
|
25995 |
|
25996 | var svg = root.select('#' + id);
|
25997 | var g = svg.append('g');
|
25998 | g.append('text') // text label for the x axis
|
25999 | .attr('x', 100).attr('y', 40).attr('class', 'version').attr('font-size', '32px').style('text-anchor', 'middle').text('v ' + version);
|
26000 | svg.attr('height', 100);
|
26001 | svg.attr('width', 400); // svg.attr('viewBox', '0 0 300 150');
|
26002 | } catch (e) {
|
26003 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('Error while rendering info diagram');
|
26004 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error(e.message);
|
26005 | }
|
26006 | };
|
26007 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
26008 | draw: draw
|
26009 | });
|
26010 |
|
26011 | /***/ }),
|
26012 |
|
26013 | /***/ "./src/diagrams/info/styles.js":
|
26014 | /*!*************************************!*\
|
26015 | !*** ./src/diagrams/info/styles.js ***!
|
26016 | \*************************************/
|
26017 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26018 |
|
26019 | "use strict";
|
26020 | __webpack_require__.r(__webpack_exports__);
|
26021 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26022 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
26023 | /* harmony export */ });
|
26024 | var getStyles = function getStyles() {
|
26025 | return "";
|
26026 | };
|
26027 |
|
26028 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
26029 |
|
26030 | /***/ }),
|
26031 |
|
26032 | /***/ "./src/diagrams/pie/pieDb.js":
|
26033 | /*!***********************************!*\
|
26034 | !*** ./src/diagrams/pie/pieDb.js ***!
|
26035 | \***********************************/
|
26036 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26037 |
|
26038 | "use strict";
|
26039 | __webpack_require__.r(__webpack_exports__);
|
26040 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26041 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
26042 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective)
|
26043 | /* harmony export */ });
|
26044 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
26045 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
26046 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
26047 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
26048 | /* harmony import */ var _commonDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../commonDb */ "./src/commonDb.js");
|
26049 |
|
26050 |
|
26051 |
|
26052 |
|
26053 |
|
26054 | var sections = {};
|
26055 | var title = '';
|
26056 | var description = '';
|
26057 | var showData = false;
|
26058 | var parseDirective = function parseDirective(statement, context, type) {
|
26059 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
|
26060 | };
|
26061 |
|
26062 | var addSection = function addSection(id, value) {
|
26063 | id = _common_common__WEBPACK_IMPORTED_MODULE_1__["default"].sanitizeText(id, _config__WEBPACK_IMPORTED_MODULE_2__.getConfig());
|
26064 |
|
26065 | if (typeof sections[id] === 'undefined') {
|
26066 | sections[id] = value;
|
26067 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('Added new section :', id);
|
26068 | }
|
26069 | };
|
26070 |
|
26071 | var getSections = function getSections() {
|
26072 | return sections;
|
26073 | };
|
26074 |
|
26075 | var setShowData = function setShowData(toggle) {
|
26076 | showData = toggle;
|
26077 | };
|
26078 |
|
26079 | var getShowData = function getShowData() {
|
26080 | return showData;
|
26081 | };
|
26082 |
|
26083 | var cleanupValue = function cleanupValue(value) {
|
26084 | if (value.substring(0, 1) === ':') {
|
26085 | value = value.substring(1).trim();
|
26086 | return Number(value.trim());
|
26087 | } else {
|
26088 | return Number(value.trim());
|
26089 | }
|
26090 | };
|
26091 |
|
26092 | var clear = function clear() {
|
26093 | sections = {};
|
26094 | title = '';
|
26095 | showData = false;
|
26096 | (0,_commonDb__WEBPACK_IMPORTED_MODULE_4__.clear)();
|
26097 | };
|
26098 |
|
26099 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
26100 | parseDirective: parseDirective,
|
26101 | getConfig: function getConfig() {
|
26102 | return _config__WEBPACK_IMPORTED_MODULE_2__.getConfig().pie;
|
26103 | },
|
26104 | addSection: addSection,
|
26105 | getSections: getSections,
|
26106 | cleanupValue: cleanupValue,
|
26107 | clear: clear,
|
26108 | setAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_4__.setAccTitle,
|
26109 | getAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_4__.getAccTitle,
|
26110 | setDiagramTitle: _commonDb__WEBPACK_IMPORTED_MODULE_4__.setDiagramTitle,
|
26111 | getDiagramTitle: _commonDb__WEBPACK_IMPORTED_MODULE_4__.getDiagramTitle,
|
26112 | setShowData: setShowData,
|
26113 | getShowData: getShowData,
|
26114 | getAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_4__.getAccDescription,
|
26115 | setAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_4__.setAccDescription
|
26116 | });
|
26117 |
|
26118 | /***/ }),
|
26119 |
|
26120 | /***/ "./src/diagrams/pie/pieRenderer.js":
|
26121 | /*!*****************************************!*\
|
26122 | !*** ./src/diagrams/pie/pieRenderer.js ***!
|
26123 | \*****************************************/
|
26124 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26125 |
|
26126 | "use strict";
|
26127 | __webpack_require__.r(__webpack_exports__);
|
26128 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26129 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
26130 | /* harmony export */ "draw": () => (/* binding */ draw)
|
26131 | /* harmony export */ });
|
26132 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
26133 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
26134 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
26135 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
26136 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
26137 | /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js");
|
26138 | /** Created by AshishJ on 11-09-2019. */
|
26139 |
|
26140 |
|
26141 |
|
26142 |
|
26143 |
|
26144 | var conf = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig();
|
26145 | /**
|
26146 | * Draws a Pie Chart with the data given in text.
|
26147 | *
|
26148 | * @param text
|
26149 | * @param id
|
26150 | */
|
26151 |
|
26152 | var width;
|
26153 | var height = 450;
|
26154 | var draw = function draw(txt, id, _version, diagObj) {
|
26155 | try {
|
26156 | conf = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig();
|
26157 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('Rendering info diagram\n' + txt);
|
26158 | var securityLevel = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig().securityLevel; // Handle root and Document for when rendering in sanbox mode
|
26159 |
|
26160 | var sandboxElement;
|
26161 |
|
26162 | if (securityLevel === 'sandbox') {
|
26163 | sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#i' + id);
|
26164 | }
|
26165 |
|
26166 | var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body');
|
26167 | var doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; // Parse the Pie Chart definition
|
26168 |
|
26169 | diagObj.db.clear();
|
26170 | diagObj.parser.parse(txt);
|
26171 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('Parsed info diagram');
|
26172 | var elem = doc.getElementById(id);
|
26173 | width = elem.parentElement.offsetWidth;
|
26174 |
|
26175 | if (typeof width === 'undefined') {
|
26176 | width = 1200;
|
26177 | }
|
26178 |
|
26179 | if (typeof conf.useWidth !== 'undefined') {
|
26180 | width = conf.useWidth;
|
26181 | }
|
26182 |
|
26183 | if (typeof conf.pie.useWidth !== 'undefined') {
|
26184 | width = conf.pie.useWidth;
|
26185 | }
|
26186 |
|
26187 | var diagram = root.select('#' + id);
|
26188 | (0,_utils__WEBPACK_IMPORTED_MODULE_3__.configureSvgSize)(diagram, height, width, conf.pie.useMaxWidth);
|
26189 | (0,_accessibility__WEBPACK_IMPORTED_MODULE_4__["default"])(diagObj.db, diagram, id); // Set viewBox
|
26190 |
|
26191 | elem.setAttribute('viewBox', '0 0 ' + width + ' ' + height); // Fetch the default direction, use TD if none was found
|
26192 |
|
26193 | var margin = 40;
|
26194 | var legendRectSize = 18;
|
26195 | var legendSpacing = 4;
|
26196 | var radius = Math.min(width, height) / 2 - margin;
|
26197 | var svg = diagram.append('g').attr('transform', 'translate(' + width / 2 + ',' + height / 2 + ')');
|
26198 | var data = diagObj.db.getSections();
|
26199 | var sum = 0;
|
26200 | Object.keys(data).forEach(function (key) {
|
26201 | sum += data[key];
|
26202 | });
|
26203 | var themeVariables = conf.themeVariables;
|
26204 | var myGeneratedColors = [themeVariables.pie1, themeVariables.pie2, themeVariables.pie3, themeVariables.pie4, themeVariables.pie5, themeVariables.pie6, themeVariables.pie7, themeVariables.pie8, themeVariables.pie9, themeVariables.pie10, themeVariables.pie11, themeVariables.pie12]; // Set the color scale
|
26205 |
|
26206 | var color = (0,d3__WEBPACK_IMPORTED_MODULE_0__.scaleOrdinal)().range(myGeneratedColors); // Compute the position of each group on the pie:
|
26207 |
|
26208 | var pie = (0,d3__WEBPACK_IMPORTED_MODULE_0__.pie)().value(function (d) {
|
26209 | return d[1];
|
26210 | });
|
26211 | var dataReady = pie(Object.entries(data)); // Shape helper to build arcs:
|
26212 |
|
26213 | var arcGenerator = (0,d3__WEBPACK_IMPORTED_MODULE_0__.arc)().innerRadius(0).outerRadius(radius); // Build the pie chart: each part of the pie is a path that we build using the arc function.
|
26214 |
|
26215 | svg.selectAll('mySlices').data(dataReady).enter().append('path').attr('d', arcGenerator).attr('fill', function (d) {
|
26216 | return color(d.data[0]);
|
26217 | }).attr('class', 'pieCircle'); // Now add the percentage.
|
26218 | // Use the centroid method to get the best coordinates.
|
26219 |
|
26220 | svg.selectAll('mySlices').data(dataReady).enter().append('text').text(function (d) {
|
26221 | return (d.data[1] / sum * 100).toFixed(0) + '%';
|
26222 | }).attr('transform', function (d) {
|
26223 | return 'translate(' + arcGenerator.centroid(d) + ')';
|
26224 | }).style('text-anchor', 'middle').attr('class', 'slice');
|
26225 | svg.append('text').text(diagObj.db.getDiagramTitle()).attr('x', 0).attr('y', -(height - 50) / 2).attr('class', 'pieTitleText'); // Add the legends/annotations for each section
|
26226 |
|
26227 | var legend = svg.selectAll('.legend').data(color.domain()).enter().append('g').attr('class', 'legend').attr('transform', function (d, i) {
|
26228 | var height = legendRectSize + legendSpacing;
|
26229 | var offset = height * color.domain().length / 2;
|
26230 | var horz = 12 * legendRectSize;
|
26231 | var vert = i * height - offset;
|
26232 | return 'translate(' + horz + ',' + vert + ')';
|
26233 | });
|
26234 | legend.append('rect').attr('width', legendRectSize).attr('height', legendRectSize).style('fill', color).style('stroke', color);
|
26235 | legend.data(dataReady).append('text').attr('x', legendRectSize + legendSpacing).attr('y', legendRectSize - legendSpacing).text(function (d) {
|
26236 | if (diagObj.db.getShowData() || conf.showData || conf.pie.showData) {
|
26237 | return d.data[0] + ' [' + d.data[1] + ']';
|
26238 | } else {
|
26239 | return d.data[0];
|
26240 | }
|
26241 | });
|
26242 | } catch (e) {
|
26243 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.error('Error while rendering info diagram');
|
26244 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.error(e);
|
26245 | }
|
26246 | };
|
26247 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
26248 | draw: draw
|
26249 | });
|
26250 |
|
26251 | /***/ }),
|
26252 |
|
26253 | /***/ "./src/diagrams/pie/styles.js":
|
26254 | /*!************************************!*\
|
26255 | !*** ./src/diagrams/pie/styles.js ***!
|
26256 | \************************************/
|
26257 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26258 |
|
26259 | "use strict";
|
26260 | __webpack_require__.r(__webpack_exports__);
|
26261 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26262 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
26263 | /* harmony export */ });
|
26264 | var getStyles = function getStyles(options) {
|
26265 | return "\n .pieCircle{\n stroke: ".concat(options.pieStrokeColor, ";\n stroke-width : ").concat(options.pieStrokeWidth, ";\n opacity : ").concat(options.pieOpacity, ";\n }\n .pieTitleText {\n text-anchor: middle;\n font-size: ").concat(options.pieTitleTextSize, ";\n fill: ").concat(options.pieTitleTextColor, ";\n font-family: ").concat(options.fontFamily, ";\n }\n .slice {\n font-family: ").concat(options.fontFamily, ";\n fill: ").concat(options.pieSectionTextColor, ";\n font-size:").concat(options.pieSectionTextSize, ";\n // fill: white;\n }\n .legend text {\n fill: ").concat(options.pieLegendTextColor, ";\n font-family: ").concat(options.fontFamily, ";\n font-size: ").concat(options.pieLegendTextSize, ";\n }\n");
|
26266 | };
|
26267 |
|
26268 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
26269 |
|
26270 | /***/ }),
|
26271 |
|
26272 | /***/ "./src/diagrams/requirement/requirementDb.js":
|
26273 | /*!***************************************************!*\
|
26274 | !*** ./src/diagrams/requirement/requirementDb.js ***!
|
26275 | \***************************************************/
|
26276 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26277 |
|
26278 | "use strict";
|
26279 | __webpack_require__.r(__webpack_exports__);
|
26280 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26281 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
26282 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective)
|
26283 | /* harmony export */ });
|
26284 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
26285 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
26286 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
26287 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
26288 | /* harmony import */ var _commonDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../commonDb */ "./src/commonDb.js");
|
26289 |
|
26290 |
|
26291 |
|
26292 |
|
26293 |
|
26294 | var relations = [];
|
26295 | var latestRequirement = {};
|
26296 | var requirements = {};
|
26297 | var latestElement = {};
|
26298 | var elements = {};
|
26299 | var title = '';
|
26300 | var accDescription = '';
|
26301 |
|
26302 | var sanitizeText = function sanitizeText(txt) {
|
26303 | return _common_common__WEBPACK_IMPORTED_MODULE_0__["default"].sanitizeText(txt, _config__WEBPACK_IMPORTED_MODULE_1__.getConfig());
|
26304 | };
|
26305 |
|
26306 | var RequirementType = {
|
26307 | REQUIREMENT: 'Requirement',
|
26308 | FUNCTIONAL_REQUIREMENT: 'Functional Requirement',
|
26309 | INTERFACE_REQUIREMENT: 'Interface Requirement',
|
26310 | PERFORMANCE_REQUIREMENT: 'Performance Requirement',
|
26311 | PHYSICAL_REQUIREMENT: 'Physical Requirement',
|
26312 | DESIGN_CONSTRAINT: 'Design Constraint'
|
26313 | };
|
26314 | var RiskLevel = {
|
26315 | LOW_RISK: 'Low',
|
26316 | MED_RISK: 'Medium',
|
26317 | HIGH_RISK: 'High'
|
26318 | };
|
26319 | var VerifyType = {
|
26320 | VERIFY_ANALYSIS: 'Analysis',
|
26321 | VERIFY_DEMONSTRATION: 'Demonstration',
|
26322 | VERIFY_INSPECTION: 'Inspection',
|
26323 | VERIFY_TEST: 'Test'
|
26324 | };
|
26325 | var Relationships = {
|
26326 | CONTAINS: 'contains',
|
26327 | COPIES: 'copies',
|
26328 | DERIVES: 'derives',
|
26329 | SATISFIES: 'satisfies',
|
26330 | VERIFIES: 'verifies',
|
26331 | REFINES: 'refines',
|
26332 | TRACES: 'traces'
|
26333 | };
|
26334 | var parseDirective = function parseDirective(statement, context, type) {
|
26335 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__["default"].parseDirective(this, statement, context, type);
|
26336 | };
|
26337 |
|
26338 | var addRequirement = function addRequirement(name, type) {
|
26339 | if (typeof requirements[name] === 'undefined') {
|
26340 | requirements[name] = {
|
26341 | name: name,
|
26342 | type: type,
|
26343 | id: latestRequirement.id,
|
26344 | text: latestRequirement.text,
|
26345 | risk: latestRequirement.risk,
|
26346 | verifyMethod: latestRequirement.verifyMethod
|
26347 | };
|
26348 | }
|
26349 |
|
26350 | latestRequirement = {};
|
26351 | return requirements[name];
|
26352 | };
|
26353 |
|
26354 | var getRequirements = function getRequirements() {
|
26355 | return requirements;
|
26356 | };
|
26357 |
|
26358 | var setNewReqId = function setNewReqId(id) {
|
26359 | if (typeof latestRequirement != 'undefined') {
|
26360 | latestRequirement.id = id;
|
26361 | }
|
26362 | };
|
26363 |
|
26364 | var setNewReqText = function setNewReqText(text) {
|
26365 | if (typeof latestRequirement != 'undefined') {
|
26366 | latestRequirement.text = text;
|
26367 | }
|
26368 | };
|
26369 |
|
26370 | var setNewReqRisk = function setNewReqRisk(risk) {
|
26371 | if (typeof latestRequirement != 'undefined') {
|
26372 | latestRequirement.risk = risk;
|
26373 | }
|
26374 | };
|
26375 |
|
26376 | var setNewReqVerifyMethod = function setNewReqVerifyMethod(verifyMethod) {
|
26377 | if (typeof latestRequirement != 'undefined') {
|
26378 | latestRequirement.verifyMethod = verifyMethod;
|
26379 | }
|
26380 | };
|
26381 |
|
26382 | var addElement = function addElement(name) {
|
26383 | if (typeof elements[name] === 'undefined') {
|
26384 | elements[name] = {
|
26385 | name: name,
|
26386 | type: latestElement.type,
|
26387 | docRef: latestElement.docRef
|
26388 | };
|
26389 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('Added new requirement: ', name);
|
26390 | }
|
26391 |
|
26392 | latestElement = {};
|
26393 | return elements[name];
|
26394 | };
|
26395 |
|
26396 | var getElements = function getElements() {
|
26397 | return elements;
|
26398 | };
|
26399 |
|
26400 | var setNewElementType = function setNewElementType(type) {
|
26401 | if (typeof latestElement != 'undefined') {
|
26402 | latestElement.type = type;
|
26403 | }
|
26404 | };
|
26405 |
|
26406 | var setNewElementDocRef = function setNewElementDocRef(docRef) {
|
26407 | if (typeof latestElement != 'undefined') {
|
26408 | latestElement.docRef = docRef;
|
26409 | }
|
26410 | };
|
26411 |
|
26412 | var addRelationship = function addRelationship(type, src, dst) {
|
26413 | relations.push({
|
26414 | type: type,
|
26415 | src: src,
|
26416 | dst: dst
|
26417 | });
|
26418 | };
|
26419 |
|
26420 | var getRelationships = function getRelationships() {
|
26421 | return relations;
|
26422 | };
|
26423 |
|
26424 | var clear = function clear() {
|
26425 | relations = [];
|
26426 | latestRequirement = {};
|
26427 | requirements = {};
|
26428 | latestElement = {};
|
26429 | elements = {};
|
26430 | (0,_commonDb__WEBPACK_IMPORTED_MODULE_4__.clear)();
|
26431 | };
|
26432 |
|
26433 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
26434 | RequirementType: RequirementType,
|
26435 | RiskLevel: RiskLevel,
|
26436 | VerifyType: VerifyType,
|
26437 | Relationships: Relationships,
|
26438 | parseDirective: parseDirective,
|
26439 | getConfig: function getConfig() {
|
26440 | return _config__WEBPACK_IMPORTED_MODULE_1__.getConfig().req;
|
26441 | },
|
26442 | addRequirement: addRequirement,
|
26443 | getRequirements: getRequirements,
|
26444 | setNewReqId: setNewReqId,
|
26445 | setNewReqText: setNewReqText,
|
26446 | setNewReqRisk: setNewReqRisk,
|
26447 | setNewReqVerifyMethod: setNewReqVerifyMethod,
|
26448 | setAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_4__.setAccTitle,
|
26449 | getAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_4__.getAccTitle,
|
26450 | setAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_4__.setAccDescription,
|
26451 | getAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_4__.getAccDescription,
|
26452 | addElement: addElement,
|
26453 | getElements: getElements,
|
26454 | setNewElementType: setNewElementType,
|
26455 | setNewElementDocRef: setNewElementDocRef,
|
26456 | addRelationship: addRelationship,
|
26457 | getRelationships: getRelationships,
|
26458 | clear: clear
|
26459 | });
|
26460 |
|
26461 | /***/ }),
|
26462 |
|
26463 | /***/ "./src/diagrams/requirement/requirementMarkers.js":
|
26464 | /*!********************************************************!*\
|
26465 | !*** ./src/diagrams/requirement/requirementMarkers.js ***!
|
26466 | \********************************************************/
|
26467 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26468 |
|
26469 | "use strict";
|
26470 | __webpack_require__.r(__webpack_exports__);
|
26471 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26472 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
26473 | /* harmony export */ });
|
26474 | var ReqMarkers = {
|
26475 | CONTAINS: 'contains',
|
26476 | ARROW: 'arrow'
|
26477 | };
|
26478 |
|
26479 | var insertLineEndings = function insertLineEndings(parentNode, conf) {
|
26480 | var containsNode = parentNode.append('defs').append('marker').attr('id', ReqMarkers.CONTAINS + '_line_ending').attr('refX', 0).attr('refY', conf.line_height / 2).attr('markerWidth', conf.line_height).attr('markerHeight', conf.line_height).attr('orient', 'auto').append('g');
|
26481 | containsNode.append('circle').attr('cx', conf.line_height / 2).attr('cy', conf.line_height / 2).attr('r', conf.line_height / 2) // .attr('stroke', conf.rect_border_color)
|
26482 | // .attr('stroke-width', 1)
|
26483 | .attr('fill', 'none');
|
26484 | containsNode.append('line').attr('x1', 0).attr('x2', conf.line_height).attr('y1', conf.line_height / 2).attr('y2', conf.line_height / 2) // .attr('stroke', conf.rect_border_color)
|
26485 | .attr('stroke-width', 1);
|
26486 | containsNode.append('line').attr('y1', 0).attr('y2', conf.line_height).attr('x1', conf.line_height / 2).attr('x2', conf.line_height / 2) // .attr('stroke', conf.rect_border_color)
|
26487 | .attr('stroke-width', 1);
|
26488 | parentNode.append('defs').append('marker').attr('id', ReqMarkers.ARROW + '_line_ending').attr('refX', conf.line_height).attr('refY', 0.5 * conf.line_height).attr('markerWidth', conf.line_height).attr('markerHeight', conf.line_height).attr('orient', 'auto').append('path').attr('d', "M0,0\n L".concat(conf.line_height, ",").concat(conf.line_height / 2, "\n M").concat(conf.line_height, ",").concat(conf.line_height / 2, "\n L0,").concat(conf.line_height)).attr('stroke-width', 1); // .attr('stroke', conf.rect_border_color);
|
26489 | };
|
26490 |
|
26491 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
26492 | ReqMarkers: ReqMarkers,
|
26493 | insertLineEndings: insertLineEndings
|
26494 | });
|
26495 |
|
26496 | /***/ }),
|
26497 |
|
26498 | /***/ "./src/diagrams/requirement/requirementRenderer.js":
|
26499 | /*!*********************************************************!*\
|
26500 | !*** ./src/diagrams/requirement/requirementRenderer.js ***!
|
26501 | \*********************************************************/
|
26502 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26503 |
|
26504 | "use strict";
|
26505 | __webpack_require__.r(__webpack_exports__);
|
26506 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26507 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
26508 | /* harmony export */ "draw": () => (/* binding */ draw),
|
26509 | /* harmony export */ "drawElements": () => (/* binding */ drawElements),
|
26510 | /* harmony export */ "drawReqs": () => (/* binding */ drawReqs)
|
26511 | /* harmony export */ });
|
26512 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
26513 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
26514 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
|
26515 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
|
26516 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
|
26517 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
|
26518 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
26519 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
26520 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
26521 | /* harmony import */ var _requirementMarkers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./requirementMarkers */ "./src/diagrams/requirement/requirementMarkers.js");
|
26522 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
26523 | /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js");
|
26524 |
|
26525 |
|
26526 |
|
26527 |
|
26528 |
|
26529 |
|
26530 |
|
26531 |
|
26532 |
|
26533 | var conf = {};
|
26534 | var relCnt = 0;
|
26535 |
|
26536 | var newRectNode = function newRectNode(parentNode, id) {
|
26537 | return parentNode.insert('rect', '#' + id).attr('class', 'req reqBox').attr('x', 0).attr('y', 0).attr('width', conf.rect_min_width + 'px').attr('height', conf.rect_min_height + 'px');
|
26538 | };
|
26539 |
|
26540 | var newTitleNode = function newTitleNode(parentNode, id, txts) {
|
26541 | var x = conf.rect_min_width / 2;
|
26542 | var title = parentNode.append('text').attr('class', 'req reqLabel reqTitle').attr('id', id).attr('x', x).attr('y', conf.rect_padding).attr('dominant-baseline', 'hanging'); // .attr(
|
26543 | // 'style',
|
26544 | // 'font-family: ' + configApi.getConfig().fontFamily + '; font-size: ' + conf.fontSize + 'px'
|
26545 | // )
|
26546 |
|
26547 | var i = 0;
|
26548 | txts.forEach(function (textStr) {
|
26549 | if (i == 0) {
|
26550 | title.append('tspan').attr('text-anchor', 'middle').attr('x', conf.rect_min_width / 2).attr('dy', 0).text(textStr);
|
26551 | } else {
|
26552 | title.append('tspan').attr('text-anchor', 'middle').attr('x', conf.rect_min_width / 2).attr('dy', conf.line_height * 0.75).text(textStr);
|
26553 | }
|
26554 |
|
26555 | i++;
|
26556 | });
|
26557 | var yPadding = 1.5 * conf.rect_padding;
|
26558 | var linePadding = i * conf.line_height * 0.75;
|
26559 | var totalY = yPadding + linePadding;
|
26560 | parentNode.append('line').attr('class', 'req-title-line').attr('x1', '0').attr('x2', conf.rect_min_width).attr('y1', totalY).attr('y2', totalY);
|
26561 | return {
|
26562 | titleNode: title,
|
26563 | y: totalY
|
26564 | };
|
26565 | };
|
26566 |
|
26567 | var newBodyNode = function newBodyNode(parentNode, id, txts, yStart) {
|
26568 | var body = parentNode.append('text').attr('class', 'req reqLabel').attr('id', id).attr('x', conf.rect_padding).attr('y', yStart).attr('dominant-baseline', 'hanging'); // .attr(
|
26569 | // 'style',
|
26570 | // 'font-family: ' + configApi.getConfig().fontFamily + '; font-size: ' + conf.fontSize + 'px'
|
26571 | // );
|
26572 |
|
26573 | var currentRow = 0;
|
26574 | var charLimit = 30;
|
26575 | var wrappedTxts = [];
|
26576 | txts.forEach(function (textStr) {
|
26577 | var currentTextLen = textStr.length;
|
26578 |
|
26579 | while (currentTextLen > charLimit && currentRow < 3) {
|
26580 | var firstPart = textStr.substring(0, charLimit);
|
26581 | textStr = textStr.substring(charLimit, textStr.length);
|
26582 | currentTextLen = textStr.length;
|
26583 | wrappedTxts[wrappedTxts.length] = firstPart;
|
26584 | currentRow++;
|
26585 | }
|
26586 |
|
26587 | if (currentRow == 3) {
|
26588 | var lastStr = wrappedTxts[wrappedTxts.length - 1];
|
26589 | wrappedTxts[wrappedTxts.length - 1] = lastStr.substring(0, lastStr.length - 4) + '...';
|
26590 | } else {
|
26591 | wrappedTxts[wrappedTxts.length] = textStr;
|
26592 | }
|
26593 |
|
26594 | currentRow = 0;
|
26595 | });
|
26596 | wrappedTxts.forEach(function (textStr) {
|
26597 | body.append('tspan').attr('x', conf.rect_padding).attr('dy', conf.line_height).text(textStr);
|
26598 | });
|
26599 | return body;
|
26600 | };
|
26601 |
|
26602 | var addEdgeLabel = function addEdgeLabel(parentNode, svgPath, conf, txt) {
|
26603 | // Find the half-way point
|
26604 | var len = svgPath.node().getTotalLength();
|
26605 | var labelPoint = svgPath.node().getPointAtLength(len * 0.5); // Append a text node containing the label
|
26606 |
|
26607 | var labelId = 'rel' + relCnt;
|
26608 | relCnt++;
|
26609 | var labelNode = parentNode.append('text').attr('class', 'req relationshipLabel').attr('id', labelId).attr('x', labelPoint.x).attr('y', labelPoint.y).attr('text-anchor', 'middle').attr('dominant-baseline', 'middle') // .attr('style', 'font-family: ' + conf.fontFamily + '; font-size: ' + conf.fontSize + 'px')
|
26610 | .text(txt); // Figure out how big the opaque 'container' rectangle needs to be
|
26611 |
|
26612 | var labelBBox = labelNode.node().getBBox(); // Insert the opaque rectangle before the text label
|
26613 |
|
26614 | parentNode.insert('rect', '#' + labelId).attr('class', 'req reqLabelBox').attr('x', labelPoint.x - labelBBox.width / 2).attr('y', labelPoint.y - labelBBox.height / 2).attr('width', labelBBox.width).attr('height', labelBBox.height).attr('fill', 'white').attr('fill-opacity', '85%');
|
26615 | };
|
26616 |
|
26617 | var drawRelationshipFromLayout = function drawRelationshipFromLayout(svg, rel, g, insert, diagObj) {
|
26618 | // Find the edge relating to this relationship
|
26619 | var edge = g.edge(elementString(rel.src), elementString(rel.dst)); // Get a function that will generate the line path
|
26620 |
|
26621 | var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) {
|
26622 | return d.x;
|
26623 | }).y(function (d) {
|
26624 | return d.y;
|
26625 | }); // Insert the line at the right place
|
26626 |
|
26627 | var svgPath = svg.insert('path', '#' + insert).attr('class', 'er relationshipLine').attr('d', lineFunction(edge.points)).attr('fill', 'none');
|
26628 |
|
26629 | if (rel.type == diagObj.db.Relationships.CONTAINS) {
|
26630 | svgPath.attr('marker-start', 'url(' + _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].getUrl(conf.arrowMarkerAbsolute) + '#' + rel.type + '_line_ending' + ')');
|
26631 | } else {
|
26632 | svgPath.attr('stroke-dasharray', '10,7');
|
26633 | svgPath.attr('marker-end', 'url(' + _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].getUrl(conf.arrowMarkerAbsolute) + '#' + _requirementMarkers__WEBPACK_IMPORTED_MODULE_4__["default"].ReqMarkers.ARROW + '_line_ending' + ')');
|
26634 | }
|
26635 |
|
26636 | addEdgeLabel(svg, svgPath, conf, "<<".concat(rel.type, ">>"));
|
26637 | return;
|
26638 | };
|
26639 |
|
26640 | var drawReqs = function drawReqs(reqs, graph, svgNode) {
|
26641 | Object.keys(reqs).forEach(function (reqName) {
|
26642 | var req = reqs[reqName];
|
26643 | reqName = elementString(reqName);
|
26644 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Added new requirement: ', reqName);
|
26645 | var groupNode = svgNode.append('g').attr('id', reqName);
|
26646 | var textId = 'req-' + reqName;
|
26647 | var rectNode = newRectNode(groupNode, textId);
|
26648 | var nodes = [];
|
26649 | var titleNodeInfo = newTitleNode(groupNode, reqName + '_title', ["<<".concat(req.type, ">>"), "".concat(req.name)]);
|
26650 | nodes.push(titleNodeInfo.titleNode);
|
26651 | var bodyNode = newBodyNode(groupNode, reqName + '_body', ["Id: ".concat(req.id), "Text: ".concat(req.text), "Risk: ".concat(req.risk), "Verification: ".concat(req.verifyMethod)], titleNodeInfo.y);
|
26652 | nodes.push(bodyNode);
|
26653 | var rectBBox = rectNode.node().getBBox(); // Add the entity to the graph
|
26654 |
|
26655 | graph.setNode(reqName, {
|
26656 | width: rectBBox.width,
|
26657 | height: rectBBox.height,
|
26658 | shape: 'rect',
|
26659 | id: reqName
|
26660 | });
|
26661 | });
|
26662 | };
|
26663 | var drawElements = function drawElements(els, graph, svgNode) {
|
26664 | Object.keys(els).forEach(function (elName) {
|
26665 | var el = els[elName];
|
26666 | var id = elementString(elName);
|
26667 | var groupNode = svgNode.append('g').attr('id', id);
|
26668 | var textId = 'element-' + id;
|
26669 | var rectNode = newRectNode(groupNode, textId);
|
26670 | var nodes = [];
|
26671 | var titleNodeInfo = newTitleNode(groupNode, textId + '_title', ["<<Element>>", "".concat(elName)]);
|
26672 | nodes.push(titleNodeInfo.titleNode);
|
26673 | var bodyNode = newBodyNode(groupNode, textId + '_body', ["Type: ".concat(el.type || 'Not Specified'), "Doc Ref: ".concat(el.docRef || 'None')], titleNodeInfo.y);
|
26674 | nodes.push(bodyNode);
|
26675 | var rectBBox = rectNode.node().getBBox(); // Add the entity to the graph
|
26676 |
|
26677 | graph.setNode(id, {
|
26678 | width: rectBBox.width,
|
26679 | height: rectBBox.height,
|
26680 | shape: 'rect',
|
26681 | id: id
|
26682 | });
|
26683 | });
|
26684 | };
|
26685 |
|
26686 | var addRelationships = function addRelationships(relationships, g) {
|
26687 | relationships.forEach(function (r) {
|
26688 | var src = elementString(r.src);
|
26689 | var dst = elementString(r.dst);
|
26690 | g.setEdge(src, dst, {
|
26691 | relationship: r
|
26692 | });
|
26693 | });
|
26694 | return relationships;
|
26695 | };
|
26696 |
|
26697 | var adjustEntities = function adjustEntities(svgNode, graph) {
|
26698 | graph.nodes().forEach(function (v) {
|
26699 | if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
|
26700 | svgNode.select('#' + v);
|
26701 | svgNode.select('#' + v).attr('transform', 'translate(' + (graph.node(v).x - graph.node(v).width / 2) + ',' + (graph.node(v).y - graph.node(v).height / 2) + ' )');
|
26702 | }
|
26703 | });
|
26704 | return;
|
26705 | };
|
26706 |
|
26707 | var elementString = function elementString(str) {
|
26708 | return str.replace(/\s/g, '').replace(/\./g, '_');
|
26709 | };
|
26710 |
|
26711 | var draw = function draw(text, id, _version, diagObj) {
|
26712 | conf = (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().requirement;
|
26713 | diagObj.db.clear();
|
26714 | diagObj.parser.parse(text);
|
26715 | var securityLevel = conf.securityLevel; // Handle root and Document for when rendering in sanbox mode
|
26716 |
|
26717 | var sandboxElement;
|
26718 |
|
26719 | if (securityLevel === 'sandbox') {
|
26720 | sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#i' + id);
|
26721 | }
|
26722 |
|
26723 | var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body');
|
26724 | var doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;
|
26725 | var svg = root.select("[id='".concat(id, "']"));
|
26726 | _requirementMarkers__WEBPACK_IMPORTED_MODULE_4__["default"].insertLineEndings(svg, conf);
|
26727 | var g = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
|
26728 | multigraph: false,
|
26729 | compound: false,
|
26730 | directed: true
|
26731 | }).setGraph({
|
26732 | rankdir: conf.layoutDirection,
|
26733 | marginx: 20,
|
26734 | marginy: 20,
|
26735 | nodesep: 100,
|
26736 | edgesep: 100,
|
26737 | ranksep: 100
|
26738 | }).setDefaultEdgeLabel(function () {
|
26739 | return {};
|
26740 | });
|
26741 | var requirements = diagObj.db.getRequirements();
|
26742 | var elements = diagObj.db.getElements();
|
26743 | var relationships = diagObj.db.getRelationships();
|
26744 | drawReqs(requirements, g, svg);
|
26745 | drawElements(elements, g, svg);
|
26746 | addRelationships(relationships, g);
|
26747 | dagre__WEBPACK_IMPORTED_MODULE_1___default().layout(g);
|
26748 | adjustEntities(svg, g);
|
26749 | relationships.forEach(function (rel) {
|
26750 | drawRelationshipFromLayout(svg, rel, g, id, diagObj);
|
26751 | });
|
26752 | var padding = conf.rect_padding;
|
26753 | var svgBounds = svg.node().getBBox();
|
26754 | var width = svgBounds.width + padding * 2;
|
26755 | var height = svgBounds.height + padding * 2;
|
26756 | (0,_utils__WEBPACK_IMPORTED_MODULE_7__.configureSvgSize)(svg, height, width, conf.useMaxWidth);
|
26757 | svg.attr('viewBox', "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height)); // Adds title and description to the requirements diagram
|
26758 |
|
26759 | (0,_accessibility__WEBPACK_IMPORTED_MODULE_8__["default"])(diagObj.db, svg, id);
|
26760 | };
|
26761 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
26762 | draw: draw
|
26763 | });
|
26764 |
|
26765 | /***/ }),
|
26766 |
|
26767 | /***/ "./src/diagrams/requirement/styles.js":
|
26768 | /*!********************************************!*\
|
26769 | !*** ./src/diagrams/requirement/styles.js ***!
|
26770 | \********************************************/
|
26771 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26772 |
|
26773 | "use strict";
|
26774 | __webpack_require__.r(__webpack_exports__);
|
26775 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26776 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
26777 | /* harmony export */ });
|
26778 | var getStyles = function getStyles(options) {
|
26779 | return "\n\n marker {\n fill: ".concat(options.relationColor, ";\n stroke: ").concat(options.relationColor, ";\n }\n\n marker.cross {\n stroke: ").concat(options.lineColor, ";\n }\n\n svg {\n font-family: ").concat(options.fontFamily, ";\n font-size: ").concat(options.fontSize, ";\n }\n\n .reqBox {\n fill: ").concat(options.requirementBackground, ";\n fill-opacity: 100%;\n stroke: ").concat(options.requirementBorderColor, ";\n stroke-width: ").concat(options.requirementBorderSize, ";\n }\n \n .reqTitle, .reqLabel{\n fill: ").concat(options.requirementTextColor, ";\n }\n .reqLabelBox {\n fill: ").concat(options.relationLabelBackground, ";\n fill-opacity: 100%;\n }\n\n .req-title-line {\n stroke: ").concat(options.requirementBorderColor, ";\n stroke-width: ").concat(options.requirementBorderSize, ";\n }\n .relationshipLine {\n stroke: ").concat(options.relationColor, ";\n stroke-width: 1;\n }\n .relationshipLabel {\n fill: ").concat(options.relationLabelColor, ";\n }\n\n");
|
26780 | }; // fill', conf.rect_fill)
|
26781 |
|
26782 |
|
26783 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
26784 |
|
26785 | /***/ }),
|
26786 |
|
26787 | /***/ "./src/diagrams/sequence/sequenceDb.js":
|
26788 | /*!*********************************************!*\
|
26789 | !*** ./src/diagrams/sequence/sequenceDb.js ***!
|
26790 | \*********************************************/
|
26791 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26792 |
|
26793 | "use strict";
|
26794 | __webpack_require__.r(__webpack_exports__);
|
26795 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26796 | /* harmony export */ "ARROWTYPE": () => (/* binding */ ARROWTYPE),
|
26797 | /* harmony export */ "LINETYPE": () => (/* binding */ LINETYPE),
|
26798 | /* harmony export */ "PLACEMENT": () => (/* binding */ PLACEMENT),
|
26799 | /* harmony export */ "addALink": () => (/* binding */ addALink),
|
26800 | /* harmony export */ "addActor": () => (/* binding */ addActor),
|
26801 | /* harmony export */ "addDetails": () => (/* binding */ addDetails),
|
26802 | /* harmony export */ "addLinks": () => (/* binding */ addLinks),
|
26803 | /* harmony export */ "addMessage": () => (/* binding */ addMessage),
|
26804 | /* harmony export */ "addNote": () => (/* binding */ addNote),
|
26805 | /* harmony export */ "addProperties": () => (/* binding */ addProperties),
|
26806 | /* harmony export */ "addSignal": () => (/* binding */ addSignal),
|
26807 | /* harmony export */ "apply": () => (/* binding */ apply),
|
26808 | /* harmony export */ "autoWrap": () => (/* binding */ autoWrap),
|
26809 | /* harmony export */ "clear": () => (/* binding */ clear),
|
26810 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
26811 | /* harmony export */ "disableSequenceNumbers": () => (/* binding */ disableSequenceNumbers),
|
26812 | /* harmony export */ "enableSequenceNumbers": () => (/* binding */ enableSequenceNumbers),
|
26813 | /* harmony export */ "getActor": () => (/* binding */ getActor),
|
26814 | /* harmony export */ "getActorKeys": () => (/* binding */ getActorKeys),
|
26815 | /* harmony export */ "getActorProperty": () => (/* binding */ getActorProperty),
|
26816 | /* harmony export */ "getActors": () => (/* binding */ getActors),
|
26817 | /* harmony export */ "getMessages": () => (/* binding */ getMessages),
|
26818 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
26819 | /* harmony export */ "parseMessage": () => (/* binding */ parseMessage),
|
26820 | /* harmony export */ "setWrap": () => (/* binding */ setWrap),
|
26821 | /* harmony export */ "showSequenceNumbers": () => (/* binding */ showSequenceNumbers)
|
26822 | /* harmony export */ });
|
26823 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
26824 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
26825 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
26826 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
26827 | /* harmony import */ var _commonDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../commonDb */ "./src/commonDb.js");
|
26828 |
|
26829 |
|
26830 |
|
26831 |
|
26832 |
|
26833 | var prevActor = undefined;
|
26834 | var actors = {};
|
26835 | var messages = [];
|
26836 | var notes = [];
|
26837 | var diagramTitle = '';
|
26838 | var description = '';
|
26839 | var sequenceNumbersEnabled = false;
|
26840 | var wrapEnabled;
|
26841 | var parseDirective = function parseDirective(statement, context, type) {
|
26842 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
|
26843 | };
|
26844 | var addActor = function addActor(id, name, description, type) {
|
26845 | // Don't allow description nulling
|
26846 | var old = actors[id];
|
26847 | if (old && name === old.name && description == null) return; // Don't allow null descriptions, either
|
26848 |
|
26849 | if (description == null || description.text == null) {
|
26850 | description = {
|
26851 | text: name,
|
26852 | wrap: null,
|
26853 | type: type
|
26854 | };
|
26855 | }
|
26856 |
|
26857 | if (type == null || description.text == null) {
|
26858 | description = {
|
26859 | text: name,
|
26860 | wrap: null,
|
26861 | type: type
|
26862 | };
|
26863 | }
|
26864 |
|
26865 | actors[id] = {
|
26866 | name: name,
|
26867 | description: description.text,
|
26868 | wrap: description.wrap === undefined && autoWrap() || !!description.wrap,
|
26869 | prevActor: prevActor,
|
26870 | links: {},
|
26871 | properties: {},
|
26872 | actorCnt: null,
|
26873 | rectData: null,
|
26874 | type: type || 'participant'
|
26875 | };
|
26876 |
|
26877 | if (prevActor && actors[prevActor]) {
|
26878 | actors[prevActor].nextActor = id;
|
26879 | }
|
26880 |
|
26881 | prevActor = id;
|
26882 | };
|
26883 |
|
26884 | var activationCount = function activationCount(part) {
|
26885 | var i;
|
26886 | var count = 0;
|
26887 |
|
26888 | for (i = 0; i < messages.length; i++) {
|
26889 | if (messages[i].type === LINETYPE.ACTIVE_START) {
|
26890 | if (messages[i].from.actor === part) {
|
26891 | count++;
|
26892 | }
|
26893 | }
|
26894 |
|
26895 | if (messages[i].type === LINETYPE.ACTIVE_END) {
|
26896 | if (messages[i].from.actor === part) {
|
26897 | count--;
|
26898 | }
|
26899 | }
|
26900 | }
|
26901 |
|
26902 | return count;
|
26903 | };
|
26904 |
|
26905 | var addMessage = function addMessage(idFrom, idTo, message, answer) {
|
26906 | messages.push({
|
26907 | from: idFrom,
|
26908 | to: idTo,
|
26909 | message: message.text,
|
26910 | wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
|
26911 | answer: answer
|
26912 | });
|
26913 | };
|
26914 | var addSignal = function addSignal(idFrom, idTo) {
|
26915 | var message = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
26916 | text: undefined,
|
26917 | wrap: undefined
|
26918 | };
|
26919 | var messageType = arguments.length > 3 ? arguments[3] : undefined;
|
26920 |
|
26921 | if (messageType === LINETYPE.ACTIVE_END) {
|
26922 | var cnt = activationCount(idFrom.actor);
|
26923 |
|
26924 | if (cnt < 1) {
|
26925 | // Bail out as there is an activation signal from an inactive participant
|
26926 | var error = new Error('Trying to inactivate an inactive participant (' + idFrom.actor + ')');
|
26927 | error.hash = {
|
26928 | text: '->>-',
|
26929 | token: '->>-',
|
26930 | line: '1',
|
26931 | loc: {
|
26932 | first_line: 1,
|
26933 | last_line: 1,
|
26934 | first_column: 1,
|
26935 | last_column: 1
|
26936 | },
|
26937 | expected: ["'ACTIVE_PARTICIPANT'"]
|
26938 | };
|
26939 | throw error;
|
26940 | }
|
26941 | }
|
26942 |
|
26943 | messages.push({
|
26944 | from: idFrom,
|
26945 | to: idTo,
|
26946 | message: message.text,
|
26947 | wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
|
26948 | type: messageType
|
26949 | });
|
26950 | return true;
|
26951 | };
|
26952 | var getMessages = function getMessages() {
|
26953 | return messages;
|
26954 | };
|
26955 | var getActors = function getActors() {
|
26956 | return actors;
|
26957 | };
|
26958 | var getActor = function getActor(id) {
|
26959 | return actors[id];
|
26960 | };
|
26961 | var getActorKeys = function getActorKeys() {
|
26962 | return Object.keys(actors);
|
26963 | };
|
26964 | var enableSequenceNumbers = function enableSequenceNumbers() {
|
26965 | sequenceNumbersEnabled = true;
|
26966 | };
|
26967 | var disableSequenceNumbers = function disableSequenceNumbers() {
|
26968 | sequenceNumbersEnabled = false;
|
26969 | };
|
26970 | var showSequenceNumbers = function showSequenceNumbers() {
|
26971 | return sequenceNumbersEnabled;
|
26972 | };
|
26973 | var setWrap = function setWrap(wrapSetting) {
|
26974 | wrapEnabled = wrapSetting;
|
26975 | };
|
26976 | var autoWrap = function autoWrap() {
|
26977 | // if setWrap has been called, use that value, otherwise use the value from the config
|
26978 | // TODO: refactor, always use the config value let setWrap update the config value
|
26979 | if (typeof wrapEnabled !== 'undefined') {
|
26980 | return wrapEnabled;
|
26981 | }
|
26982 |
|
26983 | return _config__WEBPACK_IMPORTED_MODULE_1__.getConfig().sequence.wrap;
|
26984 | };
|
26985 | var clear = function clear() {
|
26986 | actors = {};
|
26987 | messages = [];
|
26988 | sequenceNumbersEnabled = false;
|
26989 | diagramTitle = '';
|
26990 | (0,_commonDb__WEBPACK_IMPORTED_MODULE_2__.clear)();
|
26991 | };
|
26992 | var parseMessage = function parseMessage(str) {
|
26993 | var _str = str.trim();
|
26994 |
|
26995 | var message = {
|
26996 | text: _str.replace(/^[:]?(?:no)?wrap:/, '').trim(),
|
26997 | wrap: _str.match(/^[:]?wrap:/) !== null ? true : _str.match(/^[:]?nowrap:/) !== null ? false : undefined
|
26998 | };
|
26999 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('parseMessage:', message);
|
27000 | return message;
|
27001 | };
|
27002 | var LINETYPE = {
|
27003 | SOLID: 0,
|
27004 | DOTTED: 1,
|
27005 | NOTE: 2,
|
27006 | SOLID_CROSS: 3,
|
27007 | DOTTED_CROSS: 4,
|
27008 | SOLID_OPEN: 5,
|
27009 | DOTTED_OPEN: 6,
|
27010 | LOOP_START: 10,
|
27011 | LOOP_END: 11,
|
27012 | ALT_START: 12,
|
27013 | ALT_ELSE: 13,
|
27014 | ALT_END: 14,
|
27015 | OPT_START: 15,
|
27016 | OPT_END: 16,
|
27017 | ACTIVE_START: 17,
|
27018 | ACTIVE_END: 18,
|
27019 | PAR_START: 19,
|
27020 | PAR_AND: 20,
|
27021 | PAR_END: 21,
|
27022 | RECT_START: 22,
|
27023 | RECT_END: 23,
|
27024 | SOLID_POINT: 24,
|
27025 | DOTTED_POINT: 25,
|
27026 | AUTONUMBER: 26,
|
27027 | CRITICAL_START: 27,
|
27028 | CRITICAL_OPTION: 28,
|
27029 | CRITICAL_END: 29,
|
27030 | BREAK_START: 30,
|
27031 | BREAK_END: 31
|
27032 | };
|
27033 | var ARROWTYPE = {
|
27034 | FILLED: 0,
|
27035 | OPEN: 1
|
27036 | };
|
27037 | var PLACEMENT = {
|
27038 | LEFTOF: 0,
|
27039 | RIGHTOF: 1,
|
27040 | OVER: 2
|
27041 | };
|
27042 | var addNote = function addNote(actor, placement, message) {
|
27043 | var note = {
|
27044 | actor: actor,
|
27045 | placement: placement,
|
27046 | message: message.text,
|
27047 | wrap: message.wrap === undefined && autoWrap() || !!message.wrap
|
27048 | }; // Coerce actor into a [to, from, ...] array
|
27049 |
|
27050 | var actors = [].concat(actor, actor);
|
27051 | notes.push(note);
|
27052 | messages.push({
|
27053 | from: actors[0],
|
27054 | to: actors[1],
|
27055 | message: message.text,
|
27056 | wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
|
27057 | type: LINETYPE.NOTE,
|
27058 | placement: placement
|
27059 | });
|
27060 | };
|
27061 | var addLinks = function addLinks(actorId, text) {
|
27062 | // find the actor
|
27063 | var actor = getActor(actorId); // JSON.parse the text
|
27064 |
|
27065 | try {
|
27066 | var sanitizedText = (0,_common_common__WEBPACK_IMPORTED_MODULE_4__.sanitizeText)(text.text, _config__WEBPACK_IMPORTED_MODULE_1__.getConfig());
|
27067 | sanitizedText = sanitizedText.replace(/&/g, '&');
|
27068 | sanitizedText = sanitizedText.replace(/=/g, '=');
|
27069 | var links = JSON.parse(sanitizedText); // add the deserialized text to the actor's links field.
|
27070 |
|
27071 | insertLinks(actor, links);
|
27072 | } catch (e) {
|
27073 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.error('error while parsing actor link text', e);
|
27074 | }
|
27075 | };
|
27076 | var addALink = function addALink(actorId, text) {
|
27077 | // find the actor
|
27078 | var actor = getActor(actorId);
|
27079 |
|
27080 | try {
|
27081 | var links = {};
|
27082 | var sanitizedText = (0,_common_common__WEBPACK_IMPORTED_MODULE_4__.sanitizeText)(text.text, _config__WEBPACK_IMPORTED_MODULE_1__.getConfig());
|
27083 | var sep = sanitizedText.indexOf('@');
|
27084 | sanitizedText = sanitizedText.replace(/&/g, '&');
|
27085 | sanitizedText = sanitizedText.replace(/=/g, '=');
|
27086 | var label = sanitizedText.slice(0, sep - 1).trim();
|
27087 | var link = sanitizedText.slice(sep + 1).trim();
|
27088 | links[label] = link; // add the deserialized text to the actor's links field.
|
27089 |
|
27090 | insertLinks(actor, links);
|
27091 | } catch (e) {
|
27092 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.error('error while parsing actor link text', e);
|
27093 | }
|
27094 | };
|
27095 | /**
|
27096 | * @param {any} actor
|
27097 | * @param {any} links
|
27098 | */
|
27099 |
|
27100 | function insertLinks(actor, links) {
|
27101 | if (actor.links == null) {
|
27102 | actor.links = links;
|
27103 | } else {
|
27104 | for (var key in links) {
|
27105 | actor.links[key] = links[key];
|
27106 | }
|
27107 | }
|
27108 | }
|
27109 |
|
27110 | var addProperties = function addProperties(actorId, text) {
|
27111 | // find the actor
|
27112 | var actor = getActor(actorId); // JSON.parse the text
|
27113 |
|
27114 | try {
|
27115 | var sanitizedText = (0,_common_common__WEBPACK_IMPORTED_MODULE_4__.sanitizeText)(text.text, _config__WEBPACK_IMPORTED_MODULE_1__.getConfig());
|
27116 | var properties = JSON.parse(sanitizedText); // add the deserialized text to the actor's property field.
|
27117 |
|
27118 | insertProperties(actor, properties);
|
27119 | } catch (e) {
|
27120 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.error('error while parsing actor properties text', e);
|
27121 | }
|
27122 | };
|
27123 | /**
|
27124 | * @param {any} actor
|
27125 | * @param {any} properties
|
27126 | */
|
27127 |
|
27128 | function insertProperties(actor, properties) {
|
27129 | if (actor.properties == null) {
|
27130 | actor.properties = properties;
|
27131 | } else {
|
27132 | for (var key in properties) {
|
27133 | actor.properties[key] = properties[key];
|
27134 | }
|
27135 | }
|
27136 | }
|
27137 |
|
27138 | var addDetails = function addDetails(actorId, text) {
|
27139 | // find the actor
|
27140 | var actor = getActor(actorId);
|
27141 | var elem = document.getElementById(text.text); // JSON.parse the text
|
27142 |
|
27143 | try {
|
27144 | var _text = elem.innerHTML;
|
27145 | var details = JSON.parse(_text); // add the deserialized text to the actor's property field.
|
27146 |
|
27147 | if (details['properties']) {
|
27148 | insertProperties(actor, details['properties']);
|
27149 | }
|
27150 |
|
27151 | if (details['links']) {
|
27152 | insertLinks(actor, details['links']);
|
27153 | }
|
27154 | } catch (e) {
|
27155 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.error('error while parsing actor details text', e);
|
27156 | }
|
27157 | };
|
27158 | var getActorProperty = function getActorProperty(actor, key) {
|
27159 | if (typeof actor !== 'undefined' && typeof actor.properties !== 'undefined') {
|
27160 | return actor.properties[key];
|
27161 | }
|
27162 |
|
27163 | return undefined;
|
27164 | };
|
27165 | var apply = function apply(param) {
|
27166 | if (param instanceof Array) {
|
27167 | param.forEach(function (item) {
|
27168 | apply(item);
|
27169 | });
|
27170 | } else {
|
27171 | switch (param.type) {
|
27172 | case 'sequenceIndex':
|
27173 | messages.push({
|
27174 | from: undefined,
|
27175 | to: undefined,
|
27176 | message: {
|
27177 | start: param.sequenceIndex,
|
27178 | step: param.sequenceIndexStep,
|
27179 | visible: param.sequenceVisible
|
27180 | },
|
27181 | wrap: false,
|
27182 | type: param.signalType
|
27183 | });
|
27184 | break;
|
27185 |
|
27186 | case 'addParticipant':
|
27187 | addActor(param.actor, param.actor, param.description, 'participant');
|
27188 | break;
|
27189 |
|
27190 | case 'addActor':
|
27191 | addActor(param.actor, param.actor, param.description, 'actor');
|
27192 | break;
|
27193 |
|
27194 | case 'activeStart':
|
27195 | addSignal(param.actor, undefined, undefined, param.signalType);
|
27196 | break;
|
27197 |
|
27198 | case 'activeEnd':
|
27199 | addSignal(param.actor, undefined, undefined, param.signalType);
|
27200 | break;
|
27201 |
|
27202 | case 'addNote':
|
27203 | addNote(param.actor, param.placement, param.text);
|
27204 | break;
|
27205 |
|
27206 | case 'addLinks':
|
27207 | addLinks(param.actor, param.text);
|
27208 | break;
|
27209 |
|
27210 | case 'addALink':
|
27211 | addALink(param.actor, param.text);
|
27212 | break;
|
27213 |
|
27214 | case 'addProperties':
|
27215 | addProperties(param.actor, param.text);
|
27216 | break;
|
27217 |
|
27218 | case 'addDetails':
|
27219 | addDetails(param.actor, param.text);
|
27220 | break;
|
27221 |
|
27222 | case 'addMessage':
|
27223 | addSignal(param.from, param.to, param.msg, param.signalType);
|
27224 | break;
|
27225 |
|
27226 | case 'loopStart':
|
27227 | addSignal(undefined, undefined, param.loopText, param.signalType);
|
27228 | break;
|
27229 |
|
27230 | case 'loopEnd':
|
27231 | addSignal(undefined, undefined, undefined, param.signalType);
|
27232 | break;
|
27233 |
|
27234 | case 'rectStart':
|
27235 | addSignal(undefined, undefined, param.color, param.signalType);
|
27236 | break;
|
27237 |
|
27238 | case 'rectEnd':
|
27239 | addSignal(undefined, undefined, undefined, param.signalType);
|
27240 | break;
|
27241 |
|
27242 | case 'optStart':
|
27243 | addSignal(undefined, undefined, param.optText, param.signalType);
|
27244 | break;
|
27245 |
|
27246 | case 'optEnd':
|
27247 | addSignal(undefined, undefined, undefined, param.signalType);
|
27248 | break;
|
27249 |
|
27250 | case 'altStart':
|
27251 | addSignal(undefined, undefined, param.altText, param.signalType);
|
27252 | break;
|
27253 |
|
27254 | case 'else':
|
27255 | addSignal(undefined, undefined, param.altText, param.signalType);
|
27256 | break;
|
27257 |
|
27258 | case 'altEnd':
|
27259 | addSignal(undefined, undefined, undefined, param.signalType);
|
27260 | break;
|
27261 |
|
27262 | case 'setAccTitle':
|
27263 | (0,_commonDb__WEBPACK_IMPORTED_MODULE_2__.setAccTitle)(param.text);
|
27264 | break;
|
27265 |
|
27266 | case 'parStart':
|
27267 | addSignal(undefined, undefined, param.parText, param.signalType);
|
27268 | break;
|
27269 |
|
27270 | case 'and':
|
27271 | addSignal(undefined, undefined, param.parText, param.signalType);
|
27272 | break;
|
27273 |
|
27274 | case 'parEnd':
|
27275 | addSignal(undefined, undefined, undefined, param.signalType);
|
27276 | break;
|
27277 |
|
27278 | case 'criticalStart':
|
27279 | addSignal(undefined, undefined, param.criticalText, param.signalType);
|
27280 | break;
|
27281 |
|
27282 | case 'option':
|
27283 | addSignal(undefined, undefined, param.optionText, param.signalType);
|
27284 | break;
|
27285 |
|
27286 | case 'criticalEnd':
|
27287 | addSignal(undefined, undefined, undefined, param.signalType);
|
27288 | break;
|
27289 |
|
27290 | case 'breakStart':
|
27291 | addSignal(undefined, undefined, param.breakText, param.signalType);
|
27292 | break;
|
27293 |
|
27294 | case 'breakEnd':
|
27295 | addSignal(undefined, undefined, undefined, param.signalType);
|
27296 | break;
|
27297 | }
|
27298 | }
|
27299 | };
|
27300 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
27301 | addActor: addActor,
|
27302 | addMessage: addMessage,
|
27303 | addSignal: addSignal,
|
27304 | addLinks: addLinks,
|
27305 | addDetails: addDetails,
|
27306 | addProperties: addProperties,
|
27307 | autoWrap: autoWrap,
|
27308 | setWrap: setWrap,
|
27309 | enableSequenceNumbers: enableSequenceNumbers,
|
27310 | disableSequenceNumbers: disableSequenceNumbers,
|
27311 | showSequenceNumbers: showSequenceNumbers,
|
27312 | getMessages: getMessages,
|
27313 | getActors: getActors,
|
27314 | getActor: getActor,
|
27315 | getActorKeys: getActorKeys,
|
27316 | getActorProperty: getActorProperty,
|
27317 | getAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_2__.getAccTitle,
|
27318 | getDiagramTitle: _commonDb__WEBPACK_IMPORTED_MODULE_2__.getDiagramTitle,
|
27319 | setDiagramTitle: _commonDb__WEBPACK_IMPORTED_MODULE_2__.setDiagramTitle,
|
27320 | parseDirective: parseDirective,
|
27321 | getConfig: function getConfig() {
|
27322 | return _config__WEBPACK_IMPORTED_MODULE_1__.getConfig().sequence;
|
27323 | },
|
27324 | clear: clear,
|
27325 | parseMessage: parseMessage,
|
27326 | LINETYPE: LINETYPE,
|
27327 | ARROWTYPE: ARROWTYPE,
|
27328 | PLACEMENT: PLACEMENT,
|
27329 | addNote: addNote,
|
27330 | setAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_2__.setAccTitle,
|
27331 | apply: apply,
|
27332 | setAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_2__.setAccDescription,
|
27333 | getAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_2__.getAccDescription
|
27334 | });
|
27335 |
|
27336 | /***/ }),
|
27337 |
|
27338 | /***/ "./src/diagrams/sequence/sequenceRenderer.js":
|
27339 | /*!***************************************************!*\
|
27340 | !*** ./src/diagrams/sequence/sequenceRenderer.js ***!
|
27341 | \***************************************************/
|
27342 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
27343 |
|
27344 | "use strict";
|
27345 | __webpack_require__.r(__webpack_exports__);
|
27346 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
27347 | /* harmony export */ "bounds": () => (/* binding */ bounds),
|
27348 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
27349 | /* harmony export */ "draw": () => (/* binding */ draw),
|
27350 | /* harmony export */ "drawActors": () => (/* binding */ drawActors),
|
27351 | /* harmony export */ "drawActorsPopup": () => (/* binding */ drawActorsPopup),
|
27352 | /* harmony export */ "setConf": () => (/* binding */ setConf)
|
27353 | /* harmony export */ });
|
27354 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
27355 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
27356 | /* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/sequence/svgDraw.js");
|
27357 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
27358 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
27359 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
27360 | /* harmony import */ var _assignWithDepth__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../assignWithDepth */ "./src/assignWithDepth.js");
|
27361 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
27362 | /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js");
|
27363 |
|
27364 |
|
27365 | // import { parser } from './parser/sequenceDiagram';
|
27366 |
|
27367 | // import sequenceDb from './sequenceDb';
|
27368 |
|
27369 |
|
27370 |
|
27371 |
|
27372 |
|
27373 | var conf = {};
|
27374 | var bounds = {
|
27375 | data: {
|
27376 | startx: undefined,
|
27377 | stopx: undefined,
|
27378 | starty: undefined,
|
27379 | stopy: undefined
|
27380 | },
|
27381 | verticalPos: 0,
|
27382 | sequenceItems: [],
|
27383 | activations: [],
|
27384 | models: {
|
27385 | getHeight: function getHeight() {
|
27386 | return Math.max.apply(null, this.actors.length === 0 ? [0] : this.actors.map(function (actor) {
|
27387 | return actor.height || 0;
|
27388 | })) + (this.loops.length === 0 ? 0 : this.loops.map(function (it) {
|
27389 | return it.height || 0;
|
27390 | }).reduce(function (acc, h) {
|
27391 | return acc + h;
|
27392 | })) + (this.messages.length === 0 ? 0 : this.messages.map(function (it) {
|
27393 | return it.height || 0;
|
27394 | }).reduce(function (acc, h) {
|
27395 | return acc + h;
|
27396 | })) + (this.notes.length === 0 ? 0 : this.notes.map(function (it) {
|
27397 | return it.height || 0;
|
27398 | }).reduce(function (acc, h) {
|
27399 | return acc + h;
|
27400 | }));
|
27401 | },
|
27402 | clear: function clear() {
|
27403 | this.actors = [];
|
27404 | this.loops = [];
|
27405 | this.messages = [];
|
27406 | this.notes = [];
|
27407 | },
|
27408 | addActor: function addActor(actorModel) {
|
27409 | this.actors.push(actorModel);
|
27410 | },
|
27411 | addLoop: function addLoop(loopModel) {
|
27412 | this.loops.push(loopModel);
|
27413 | },
|
27414 | addMessage: function addMessage(msgModel) {
|
27415 | this.messages.push(msgModel);
|
27416 | },
|
27417 | addNote: function addNote(noteModel) {
|
27418 | this.notes.push(noteModel);
|
27419 | },
|
27420 | lastActor: function lastActor() {
|
27421 | return this.actors[this.actors.length - 1];
|
27422 | },
|
27423 | lastLoop: function lastLoop() {
|
27424 | return this.loops[this.loops.length - 1];
|
27425 | },
|
27426 | lastMessage: function lastMessage() {
|
27427 | return this.messages[this.messages.length - 1];
|
27428 | },
|
27429 | lastNote: function lastNote() {
|
27430 | return this.notes[this.notes.length - 1];
|
27431 | },
|
27432 | actors: [],
|
27433 | loops: [],
|
27434 | messages: [],
|
27435 | notes: []
|
27436 | },
|
27437 | init: function init() {
|
27438 | this.sequenceItems = [];
|
27439 | this.activations = [];
|
27440 | this.models.clear();
|
27441 | this.data = {
|
27442 | startx: undefined,
|
27443 | stopx: undefined,
|
27444 | starty: undefined,
|
27445 | stopy: undefined
|
27446 | };
|
27447 | this.verticalPos = 0;
|
27448 | setConf(_config__WEBPACK_IMPORTED_MODULE_1__.getConfig());
|
27449 | },
|
27450 | updateVal: function updateVal(obj, key, val, fun) {
|
27451 | if (typeof obj[key] === 'undefined') {
|
27452 | obj[key] = val;
|
27453 | } else {
|
27454 | obj[key] = fun(val, obj[key]);
|
27455 | }
|
27456 | },
|
27457 | updateBounds: function updateBounds(startx, starty, stopx, stopy) {
|
27458 | var _self = this;
|
27459 |
|
27460 | var cnt = 0;
|
27461 | /** @param {any} type */
|
27462 |
|
27463 | function updateFn(type) {
|
27464 | return function updateItemBounds(item) {
|
27465 | cnt++; // The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
|
27466 |
|
27467 | var n = _self.sequenceItems.length - cnt + 1;
|
27468 |
|
27469 | _self.updateVal(item, 'starty', starty - n * conf.boxMargin, Math.min);
|
27470 |
|
27471 | _self.updateVal(item, 'stopy', stopy + n * conf.boxMargin, Math.max);
|
27472 |
|
27473 | _self.updateVal(bounds.data, 'startx', startx - n * conf.boxMargin, Math.min);
|
27474 |
|
27475 | _self.updateVal(bounds.data, 'stopx', stopx + n * conf.boxMargin, Math.max);
|
27476 |
|
27477 | if (!(type === 'activation')) {
|
27478 | _self.updateVal(item, 'startx', startx - n * conf.boxMargin, Math.min);
|
27479 |
|
27480 | _self.updateVal(item, 'stopx', stopx + n * conf.boxMargin, Math.max);
|
27481 |
|
27482 | _self.updateVal(bounds.data, 'starty', starty - n * conf.boxMargin, Math.min);
|
27483 |
|
27484 | _self.updateVal(bounds.data, 'stopy', stopy + n * conf.boxMargin, Math.max);
|
27485 | }
|
27486 | };
|
27487 | }
|
27488 |
|
27489 | this.sequenceItems.forEach(updateFn());
|
27490 | this.activations.forEach(updateFn('activation'));
|
27491 | },
|
27492 | insert: function insert(startx, starty, stopx, stopy) {
|
27493 | var _startx = Math.min(startx, stopx);
|
27494 |
|
27495 | var _stopx = Math.max(startx, stopx);
|
27496 |
|
27497 | var _starty = Math.min(starty, stopy);
|
27498 |
|
27499 | var _stopy = Math.max(starty, stopy);
|
27500 |
|
27501 | this.updateVal(bounds.data, 'startx', _startx, Math.min);
|
27502 | this.updateVal(bounds.data, 'starty', _starty, Math.min);
|
27503 | this.updateVal(bounds.data, 'stopx', _stopx, Math.max);
|
27504 | this.updateVal(bounds.data, 'stopy', _stopy, Math.max);
|
27505 | this.updateBounds(_startx, _starty, _stopx, _stopy);
|
27506 | },
|
27507 | newActivation: function newActivation(message, diagram, actors) {
|
27508 | var actorRect = actors[message.from.actor];
|
27509 | var stackedSize = actorActivations(message.from.actor).length || 0;
|
27510 | var x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
|
27511 | this.activations.push({
|
27512 | startx: x,
|
27513 | starty: this.verticalPos + 2,
|
27514 | stopx: x + conf.activationWidth,
|
27515 | stopy: undefined,
|
27516 | actor: message.from.actor,
|
27517 | anchored: _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].anchorElement(diagram)
|
27518 | });
|
27519 | },
|
27520 | endActivation: function endActivation(message) {
|
27521 | // find most recent activation for given actor
|
27522 | var lastActorActivationIdx = this.activations.map(function (activation) {
|
27523 | return activation.actor;
|
27524 | }).lastIndexOf(message.from.actor);
|
27525 | return this.activations.splice(lastActorActivationIdx, 1)[0];
|
27526 | },
|
27527 | createLoop: function createLoop() {
|
27528 | var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
27529 | message: undefined,
|
27530 | wrap: false,
|
27531 | width: undefined
|
27532 | };
|
27533 | var fill = arguments.length > 1 ? arguments[1] : undefined;
|
27534 | return {
|
27535 | startx: undefined,
|
27536 | starty: this.verticalPos,
|
27537 | stopx: undefined,
|
27538 | stopy: undefined,
|
27539 | title: title.message,
|
27540 | wrap: title.wrap,
|
27541 | width: title.width,
|
27542 | height: 0,
|
27543 | fill: fill
|
27544 | };
|
27545 | },
|
27546 | newLoop: function newLoop() {
|
27547 | var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
27548 | message: undefined,
|
27549 | wrap: false,
|
27550 | width: undefined
|
27551 | };
|
27552 | var fill = arguments.length > 1 ? arguments[1] : undefined;
|
27553 | this.sequenceItems.push(this.createLoop(title, fill));
|
27554 | },
|
27555 | endLoop: function endLoop() {
|
27556 | return this.sequenceItems.pop();
|
27557 | },
|
27558 | addSectionToLoop: function addSectionToLoop(message) {
|
27559 | var loop = this.sequenceItems.pop();
|
27560 | loop.sections = loop.sections || [];
|
27561 | loop.sectionTitles = loop.sectionTitles || [];
|
27562 | loop.sections.push({
|
27563 | y: bounds.getVerticalPos(),
|
27564 | height: 0
|
27565 | });
|
27566 | loop.sectionTitles.push(message);
|
27567 | this.sequenceItems.push(loop);
|
27568 | },
|
27569 | bumpVerticalPos: function bumpVerticalPos(bump) {
|
27570 | this.verticalPos = this.verticalPos + bump;
|
27571 | this.data.stopy = this.verticalPos;
|
27572 | },
|
27573 | getVerticalPos: function getVerticalPos() {
|
27574 | return this.verticalPos;
|
27575 | },
|
27576 | getBounds: function getBounds() {
|
27577 | return {
|
27578 | bounds: this.data,
|
27579 | models: this.models
|
27580 | };
|
27581 | }
|
27582 | };
|
27583 | /**
|
27584 | * Draws an note in the diagram with the attached line
|
27585 | *
|
27586 | * @param {any} elem - The diagram to draw to.
|
27587 | * @param {{ x: number; y: number; message: string; width: number }} noteModel - Startx: x axis
|
27588 | * start position, verticalPos: y axis position, messsage: the message to be shown, width: Set
|
27589 | * this with a custom width to override the default configured width.
|
27590 | */
|
27591 |
|
27592 | var drawNote = function drawNote(elem, noteModel) {
|
27593 | bounds.bumpVerticalPos(conf.boxMargin);
|
27594 | noteModel.height = conf.boxMargin;
|
27595 | noteModel.starty = bounds.getVerticalPos();
|
27596 | var rect = _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].getNoteRect();
|
27597 | rect.x = noteModel.startx;
|
27598 | rect.y = noteModel.starty;
|
27599 | rect.width = noteModel.width || conf.width;
|
27600 | rect.class = 'note';
|
27601 | var g = elem.append('g');
|
27602 | var rectElem = _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawRect(g, rect);
|
27603 | var textObj = _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].getTextObj();
|
27604 | textObj.x = noteModel.startx;
|
27605 | textObj.y = noteModel.starty;
|
27606 | textObj.width = rect.width;
|
27607 | textObj.dy = '1em';
|
27608 | textObj.text = noteModel.message;
|
27609 | textObj.class = 'noteText';
|
27610 | textObj.fontFamily = conf.noteFontFamily;
|
27611 | textObj.fontSize = conf.noteFontSize;
|
27612 | textObj.fontWeight = conf.noteFontWeight;
|
27613 | textObj.anchor = conf.noteAlign;
|
27614 | textObj.textMargin = conf.noteMargin;
|
27615 | textObj.valign = 'center';
|
27616 | var textElem = (0,_svgDraw__WEBPACK_IMPORTED_MODULE_2__.drawText)(g, textObj);
|
27617 | var textHeight = Math.round(textElem.map(function (te) {
|
27618 | return (te._groups || te)[0][0].getBBox().height;
|
27619 | }).reduce(function (acc, curr) {
|
27620 | return acc + curr;
|
27621 | }));
|
27622 | rectElem.attr('height', textHeight + 2 * conf.noteMargin);
|
27623 | noteModel.height += textHeight + 2 * conf.noteMargin;
|
27624 | bounds.bumpVerticalPos(textHeight + 2 * conf.noteMargin);
|
27625 | noteModel.stopy = noteModel.starty + textHeight + 2 * conf.noteMargin;
|
27626 | noteModel.stopx = noteModel.startx + rect.width;
|
27627 | bounds.insert(noteModel.startx, noteModel.starty, noteModel.stopx, noteModel.stopy);
|
27628 | bounds.models.addNote(noteModel);
|
27629 | };
|
27630 |
|
27631 | var messageFont = function messageFont(cnf) {
|
27632 | return {
|
27633 | fontFamily: cnf.messageFontFamily,
|
27634 | fontSize: cnf.messageFontSize,
|
27635 | fontWeight: cnf.messageFontWeight
|
27636 | };
|
27637 | };
|
27638 |
|
27639 | var noteFont = function noteFont(cnf) {
|
27640 | return {
|
27641 | fontFamily: cnf.noteFontFamily,
|
27642 | fontSize: cnf.noteFontSize,
|
27643 | fontWeight: cnf.noteFontWeight
|
27644 | };
|
27645 | };
|
27646 |
|
27647 | var actorFont = function actorFont(cnf) {
|
27648 | return {
|
27649 | fontFamily: cnf.actorFontFamily,
|
27650 | fontSize: cnf.actorFontSize,
|
27651 | fontWeight: cnf.actorFontWeight
|
27652 | };
|
27653 | };
|
27654 | /**
|
27655 | * Process a message by adding its dimensions to the bound. It returns the Y coordinate of the
|
27656 | * message so it can be drawn later. We do not draw the message at this point so the arrowhead can
|
27657 | * be on top of the activation box.
|
27658 | *
|
27659 | * @param {any} diagram - The parent of the message element
|
27660 | * @param {any} msgModel - The model containing fields describing a message
|
27661 | * @returns {number} LineStarty - The Y coordinate at which the message line starts
|
27662 | */
|
27663 |
|
27664 |
|
27665 | var boundMessage = function boundMessage(diagram, msgModel) {
|
27666 | bounds.bumpVerticalPos(10);
|
27667 | var startx = msgModel.startx,
|
27668 | stopx = msgModel.stopx,
|
27669 | message = msgModel.message;
|
27670 | var lines = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].splitBreaks(message).length;
|
27671 | var textDims = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calculateTextDimensions(message, messageFont(conf));
|
27672 | var lineHeight = textDims.height / lines;
|
27673 | msgModel.height += lineHeight;
|
27674 | bounds.bumpVerticalPos(lineHeight);
|
27675 | var lineStarty;
|
27676 | var totalOffset = textDims.height - 10;
|
27677 | var textWidth = textDims.width;
|
27678 |
|
27679 | if (startx === stopx) {
|
27680 | lineStarty = bounds.getVerticalPos() + totalOffset;
|
27681 |
|
27682 | if (!conf.rightAngles) {
|
27683 | totalOffset += conf.boxMargin;
|
27684 | lineStarty = bounds.getVerticalPos() + totalOffset;
|
27685 | }
|
27686 |
|
27687 | totalOffset += 30;
|
27688 | var dx = Math.max(textWidth / 2, conf.width / 2);
|
27689 | bounds.insert(startx - dx, bounds.getVerticalPos() - 10 + totalOffset, stopx + dx, bounds.getVerticalPos() + 30 + totalOffset);
|
27690 | } else {
|
27691 | totalOffset += conf.boxMargin;
|
27692 | lineStarty = bounds.getVerticalPos() + totalOffset;
|
27693 | bounds.insert(startx, lineStarty - 10, stopx, lineStarty);
|
27694 | }
|
27695 |
|
27696 | bounds.bumpVerticalPos(totalOffset);
|
27697 | msgModel.height += totalOffset;
|
27698 | msgModel.stopy = msgModel.starty + msgModel.height;
|
27699 | bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
|
27700 | return lineStarty;
|
27701 | };
|
27702 | /**
|
27703 | * Draws a message. Note that the bounds have previously been updated by boundMessage.
|
27704 | *
|
27705 | * @param {any} diagram - The parent of the message element
|
27706 | * @param {any} msgModel - The model containing fields describing a message
|
27707 | * @param {float} lineStarty - The Y coordinate at which the message line starts
|
27708 | * @param diagObj
|
27709 | */
|
27710 |
|
27711 |
|
27712 | var drawMessage = function drawMessage(diagram, msgModel, lineStarty, diagObj) {
|
27713 | var startx = msgModel.startx,
|
27714 | stopx = msgModel.stopx,
|
27715 | starty = msgModel.starty,
|
27716 | message = msgModel.message,
|
27717 | type = msgModel.type,
|
27718 | sequenceIndex = msgModel.sequenceIndex,
|
27719 | sequenceVisible = msgModel.sequenceVisible;
|
27720 | var textDims = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calculateTextDimensions(message, messageFont(conf));
|
27721 | var textObj = _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].getTextObj();
|
27722 | textObj.x = startx;
|
27723 | textObj.y = starty + 10;
|
27724 | textObj.width = stopx - startx;
|
27725 | textObj.class = 'messageText';
|
27726 | textObj.dy = '1em';
|
27727 | textObj.text = message;
|
27728 | textObj.fontFamily = conf.messageFontFamily;
|
27729 | textObj.fontSize = conf.messageFontSize;
|
27730 | textObj.fontWeight = conf.messageFontWeight;
|
27731 | textObj.anchor = conf.messageAlign;
|
27732 | textObj.valign = 'center';
|
27733 | textObj.textMargin = conf.wrapPadding;
|
27734 | textObj.tspan = false;
|
27735 | (0,_svgDraw__WEBPACK_IMPORTED_MODULE_2__.drawText)(diagram, textObj);
|
27736 | var textWidth = textDims.width;
|
27737 | var line;
|
27738 |
|
27739 | if (startx === stopx) {
|
27740 | if (conf.rightAngles) {
|
27741 | line = diagram.append('path').attr('d', "M ".concat(startx, ",").concat(lineStarty, " H ").concat(startx + Math.max(conf.width / 2, textWidth / 2), " V ").concat(lineStarty + 25, " H ").concat(startx));
|
27742 | } else {
|
27743 | line = diagram.append('path').attr('d', 'M ' + startx + ',' + lineStarty + ' C ' + (startx + 60) + ',' + (lineStarty - 10) + ' ' + (startx + 60) + ',' + (lineStarty + 30) + ' ' + startx + ',' + (lineStarty + 20));
|
27744 | }
|
27745 | } else {
|
27746 | line = diagram.append('line');
|
27747 | line.attr('x1', startx);
|
27748 | line.attr('y1', lineStarty);
|
27749 | line.attr('x2', stopx);
|
27750 | line.attr('y2', lineStarty);
|
27751 | } // Make an SVG Container
|
27752 | // Draw the line
|
27753 |
|
27754 |
|
27755 | if (type === diagObj.db.LINETYPE.DOTTED || type === diagObj.db.LINETYPE.DOTTED_CROSS || type === diagObj.db.LINETYPE.DOTTED_POINT || type === diagObj.db.LINETYPE.DOTTED_OPEN) {
|
27756 | line.style('stroke-dasharray', '3, 3');
|
27757 | line.attr('class', 'messageLine1');
|
27758 | } else {
|
27759 | line.attr('class', 'messageLine0');
|
27760 | }
|
27761 |
|
27762 | var url = '';
|
27763 |
|
27764 | if (conf.arrowMarkerAbsolute) {
|
27765 | url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
|
27766 | url = url.replace(/\(/g, '\\(');
|
27767 | url = url.replace(/\)/g, '\\)');
|
27768 | }
|
27769 |
|
27770 | line.attr('stroke-width', 2);
|
27771 | line.attr('stroke', 'none'); // handled by theme/css anyway
|
27772 |
|
27773 | line.style('fill', 'none'); // remove any fill colour
|
27774 |
|
27775 | if (type === diagObj.db.LINETYPE.SOLID || type === diagObj.db.LINETYPE.DOTTED) {
|
27776 | line.attr('marker-end', 'url(' + url + '#arrowhead)');
|
27777 | }
|
27778 |
|
27779 | if (type === diagObj.db.LINETYPE.SOLID_POINT || type === diagObj.db.LINETYPE.DOTTED_POINT) {
|
27780 | line.attr('marker-end', 'url(' + url + '#filled-head)');
|
27781 | }
|
27782 |
|
27783 | if (type === diagObj.db.LINETYPE.SOLID_CROSS || type === diagObj.db.LINETYPE.DOTTED_CROSS) {
|
27784 | line.attr('marker-end', 'url(' + url + '#crosshead)');
|
27785 | } // add node number
|
27786 |
|
27787 |
|
27788 | if (sequenceVisible || conf.showSequenceNumbers) {
|
27789 | line.attr('marker-start', 'url(' + url + '#sequencenumber)');
|
27790 | diagram.append('text').attr('x', startx).attr('y', lineStarty + 4).attr('font-family', 'sans-serif').attr('font-size', '12px').attr('text-anchor', 'middle').attr('class', 'sequenceNumber').text(sequenceIndex);
|
27791 | }
|
27792 | };
|
27793 |
|
27794 | var drawActors = function drawActors(diagram, actors, actorKeys, verticalPos, configuration, messages) {
|
27795 | if (configuration.hideUnusedParticipants === true) {
|
27796 | var newActors = new Set();
|
27797 | messages.forEach(function (message) {
|
27798 | newActors.add(message.from);
|
27799 | newActors.add(message.to);
|
27800 | });
|
27801 | actorKeys = actorKeys.filter(function (actorKey) {
|
27802 | return newActors.has(actorKey);
|
27803 | });
|
27804 | } // Draw the actors
|
27805 |
|
27806 |
|
27807 | var prevWidth = 0;
|
27808 | var prevMargin = 0;
|
27809 | var maxHeight = 0;
|
27810 |
|
27811 | for (var i = 0; i < actorKeys.length; i++) {
|
27812 | var actor = actors[actorKeys[i]]; // Add some rendering data to the object
|
27813 |
|
27814 | actor.width = actor.width || conf.width;
|
27815 | actor.height = Math.max(actor.height || conf.height, conf.height);
|
27816 | actor.margin = actor.margin || conf.actorMargin;
|
27817 | actor.x = prevWidth + prevMargin;
|
27818 | actor.y = verticalPos; // Draw the box with the attached line
|
27819 |
|
27820 | var height = _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawActor(diagram, actor, conf);
|
27821 | maxHeight = Math.max(maxHeight, height);
|
27822 | bounds.insert(actor.x, verticalPos, actor.x + actor.width, actor.height);
|
27823 | prevWidth += actor.width;
|
27824 | prevMargin += actor.margin;
|
27825 | bounds.models.addActor(actor);
|
27826 | } // Add a margin between the actor boxes and the first arrow
|
27827 |
|
27828 |
|
27829 | bounds.bumpVerticalPos(maxHeight);
|
27830 | };
|
27831 | var drawActorsPopup = function drawActorsPopup(diagram, actors, actorKeys, doc) {
|
27832 | var maxHeight = 0;
|
27833 | var maxWidth = 0;
|
27834 |
|
27835 | for (var i = 0; i < actorKeys.length; i++) {
|
27836 | var actor = actors[actorKeys[i]];
|
27837 | var minMenuWidth = getRequiredPopupWidth(actor);
|
27838 | var menuDimensions = _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawPopup(diagram, actor, minMenuWidth, conf, conf.forceMenus, doc);
|
27839 |
|
27840 | if (menuDimensions.height > maxHeight) {
|
27841 | maxHeight = menuDimensions.height;
|
27842 | }
|
27843 |
|
27844 | if (menuDimensions.width + actor.x > maxWidth) {
|
27845 | maxWidth = menuDimensions.width + actor.x;
|
27846 | }
|
27847 | }
|
27848 |
|
27849 | return {
|
27850 | maxHeight: maxHeight,
|
27851 | maxWidth: maxWidth
|
27852 | };
|
27853 | };
|
27854 | var setConf = function setConf(cnf) {
|
27855 | (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_5__["default"])(conf, cnf);
|
27856 |
|
27857 | if (cnf.fontFamily) {
|
27858 | conf.actorFontFamily = conf.noteFontFamily = conf.messageFontFamily = cnf.fontFamily;
|
27859 | }
|
27860 |
|
27861 | if (cnf.fontSize) {
|
27862 | conf.actorFontSize = conf.noteFontSize = conf.messageFontSize = cnf.fontSize;
|
27863 | }
|
27864 |
|
27865 | if (cnf.fontWeight) {
|
27866 | conf.actorFontWeight = conf.noteFontWeight = conf.messageFontWeight = cnf.fontWeight;
|
27867 | }
|
27868 | };
|
27869 |
|
27870 | var actorActivations = function actorActivations(actor) {
|
27871 | return bounds.activations.filter(function (activation) {
|
27872 | return activation.actor === actor;
|
27873 | });
|
27874 | };
|
27875 |
|
27876 | var activationBounds = function activationBounds(actor, actors) {
|
27877 | // handle multiple stacked activations for same actor
|
27878 | var actorObj = actors[actor];
|
27879 | var activations = actorActivations(actor);
|
27880 | var left = activations.reduce(function (acc, activation) {
|
27881 | return Math.min(acc, activation.startx);
|
27882 | }, actorObj.x + actorObj.width / 2);
|
27883 | var right = activations.reduce(function (acc, activation) {
|
27884 | return Math.max(acc, activation.stopx);
|
27885 | }, actorObj.x + actorObj.width / 2);
|
27886 | return [left, right];
|
27887 | };
|
27888 | /**
|
27889 | * @param {any} loopWidths
|
27890 | * @param {any} msg
|
27891 | * @param {any} preMargin
|
27892 | * @param {any} postMargin
|
27893 | * @param {any} addLoopFn
|
27894 | */
|
27895 |
|
27896 |
|
27897 | function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoopFn) {
|
27898 | bounds.bumpVerticalPos(preMargin);
|
27899 | var heightAdjust = postMargin;
|
27900 |
|
27901 | if (msg.id && msg.message && loopWidths[msg.id]) {
|
27902 | var loopWidth = loopWidths[msg.id].width;
|
27903 | var textConf = messageFont(conf);
|
27904 | msg.message = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].wrapLabel("[".concat(msg.message, "]"), loopWidth - 2 * conf.wrapPadding, textConf);
|
27905 | msg.width = loopWidth;
|
27906 | msg.wrap = true; // const lines = common.splitBreaks(msg.message).length;
|
27907 |
|
27908 | var textDims = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calculateTextDimensions(msg.message, textConf);
|
27909 | var totalOffset = Math.max(textDims.height, conf.labelBoxHeight);
|
27910 | heightAdjust = postMargin + totalOffset;
|
27911 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug("".concat(totalOffset, " - ").concat(msg.message));
|
27912 | }
|
27913 |
|
27914 | addLoopFn(msg);
|
27915 | bounds.bumpVerticalPos(heightAdjust);
|
27916 | }
|
27917 | /**
|
27918 | * Draws a sequenceDiagram in the tag with id: id based on the graph definition in text.
|
27919 | *
|
27920 | * @param {any} text The text of the diagram
|
27921 | * @param _text
|
27922 | * @param {any} id The id of the diagram which will be used as a DOM element id¨
|
27923 | * @param {any} _version Mermaid version from package.json
|
27924 | * @param {any} diagObj A stanard diagram containing the db and the text and type etc of the diagram
|
27925 | */
|
27926 |
|
27927 |
|
27928 | var draw = function draw(_text, id, _version, diagObj) {
|
27929 | conf = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig().sequence;
|
27930 | var securityLevel = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig().securityLevel; // Handle root and Document for when rendering in sanbox mode
|
27931 |
|
27932 | var sandboxElement;
|
27933 |
|
27934 | if (securityLevel === 'sandbox') {
|
27935 | sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#i' + id);
|
27936 | }
|
27937 |
|
27938 | var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body');
|
27939 | var doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;
|
27940 | bounds.init();
|
27941 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug(diagObj.db);
|
27942 | var diagram = securityLevel === 'sandbox' ? root.select("[id=\"".concat(id, "\"]")) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id=\"".concat(id, "\"]")); // Fetch data from the parsing
|
27943 |
|
27944 | var actors = diagObj.db.getActors();
|
27945 | var actorKeys = diagObj.db.getActorKeys();
|
27946 | var messages = diagObj.db.getMessages();
|
27947 | var title = diagObj.db.getDiagramTitle();
|
27948 | var maxMessageWidthPerActor = getMaxMessageWidthPerActor(actors, messages, diagObj);
|
27949 | conf.height = calculateActorMargins(actors, maxMessageWidthPerActor);
|
27950 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].insertComputerIcon(diagram);
|
27951 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].insertDatabaseIcon(diagram);
|
27952 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].insertClockIcon(diagram);
|
27953 | drawActors(diagram, actors, actorKeys, 0, conf, messages);
|
27954 | var loopWidths = calculateLoopBounds(messages, actors, maxMessageWidthPerActor, diagObj); // The arrow head definition is attached to the svg once
|
27955 |
|
27956 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].insertArrowHead(diagram);
|
27957 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].insertArrowCrossHead(diagram);
|
27958 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].insertArrowFilledHead(diagram);
|
27959 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].insertSequenceNumber(diagram);
|
27960 | /**
|
27961 | * @param {any} msg
|
27962 | * @param {any} verticalPos
|
27963 | */
|
27964 |
|
27965 | function activeEnd(msg, verticalPos) {
|
27966 | var activationData = bounds.endActivation(msg);
|
27967 |
|
27968 | if (activationData.starty + 18 > verticalPos) {
|
27969 | activationData.starty = verticalPos - 6;
|
27970 | verticalPos += 12;
|
27971 | }
|
27972 |
|
27973 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawActivation(diagram, activationData, verticalPos, conf, actorActivations(msg.from.actor).length);
|
27974 | bounds.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos);
|
27975 | } // Draw the messages/signals
|
27976 |
|
27977 |
|
27978 | var sequenceIndex = 1;
|
27979 | var sequenceIndexStep = 1;
|
27980 | var messagesToDraw = Array();
|
27981 | messages.forEach(function (msg) {
|
27982 | var loopModel, noteModel, msgModel;
|
27983 |
|
27984 | switch (msg.type) {
|
27985 | case diagObj.db.LINETYPE.NOTE:
|
27986 | noteModel = msg.noteModel;
|
27987 | drawNote(diagram, noteModel);
|
27988 | break;
|
27989 |
|
27990 | case diagObj.db.LINETYPE.ACTIVE_START:
|
27991 | bounds.newActivation(msg, diagram, actors);
|
27992 | break;
|
27993 |
|
27994 | case diagObj.db.LINETYPE.ACTIVE_END:
|
27995 | activeEnd(msg, bounds.getVerticalPos());
|
27996 | break;
|
27997 |
|
27998 | case diagObj.db.LINETYPE.LOOP_START:
|
27999 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
|
28000 | return bounds.newLoop(message);
|
28001 | });
|
28002 | break;
|
28003 |
|
28004 | case diagObj.db.LINETYPE.LOOP_END:
|
28005 | loopModel = bounds.endLoop();
|
28006 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawLoop(diagram, loopModel, 'loop', conf);
|
28007 | bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
|
28008 | bounds.models.addLoop(loopModel);
|
28009 | break;
|
28010 |
|
28011 | case diagObj.db.LINETYPE.RECT_START:
|
28012 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin, function (message) {
|
28013 | return bounds.newLoop(undefined, message.message);
|
28014 | });
|
28015 | break;
|
28016 |
|
28017 | case diagObj.db.LINETYPE.RECT_END:
|
28018 | loopModel = bounds.endLoop();
|
28019 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawBackgroundRect(diagram, loopModel);
|
28020 | bounds.models.addLoop(loopModel);
|
28021 | bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
|
28022 | break;
|
28023 |
|
28024 | case diagObj.db.LINETYPE.OPT_START:
|
28025 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
|
28026 | return bounds.newLoop(message);
|
28027 | });
|
28028 | break;
|
28029 |
|
28030 | case diagObj.db.LINETYPE.OPT_END:
|
28031 | loopModel = bounds.endLoop();
|
28032 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawLoop(diagram, loopModel, 'opt', conf);
|
28033 | bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
|
28034 | bounds.models.addLoop(loopModel);
|
28035 | break;
|
28036 |
|
28037 | case diagObj.db.LINETYPE.ALT_START:
|
28038 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
|
28039 | return bounds.newLoop(message);
|
28040 | });
|
28041 | break;
|
28042 |
|
28043 | case diagObj.db.LINETYPE.ALT_ELSE:
|
28044 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin + conf.boxTextMargin, conf.boxMargin, function (message) {
|
28045 | return bounds.addSectionToLoop(message);
|
28046 | });
|
28047 | break;
|
28048 |
|
28049 | case diagObj.db.LINETYPE.ALT_END:
|
28050 | loopModel = bounds.endLoop();
|
28051 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawLoop(diagram, loopModel, 'alt', conf);
|
28052 | bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
|
28053 | bounds.models.addLoop(loopModel);
|
28054 | break;
|
28055 |
|
28056 | case diagObj.db.LINETYPE.PAR_START:
|
28057 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
|
28058 | return bounds.newLoop(message);
|
28059 | });
|
28060 | break;
|
28061 |
|
28062 | case diagObj.db.LINETYPE.PAR_AND:
|
28063 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin + conf.boxTextMargin, conf.boxMargin, function (message) {
|
28064 | return bounds.addSectionToLoop(message);
|
28065 | });
|
28066 | break;
|
28067 |
|
28068 | case diagObj.db.LINETYPE.PAR_END:
|
28069 | loopModel = bounds.endLoop();
|
28070 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawLoop(diagram, loopModel, 'par', conf);
|
28071 | bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
|
28072 | bounds.models.addLoop(loopModel);
|
28073 | break;
|
28074 |
|
28075 | case diagObj.db.LINETYPE.AUTONUMBER:
|
28076 | sequenceIndex = msg.message.start || sequenceIndex;
|
28077 | sequenceIndexStep = msg.message.step || sequenceIndexStep;
|
28078 | if (msg.message.visible) diagObj.db.enableSequenceNumbers();else diagObj.db.disableSequenceNumbers();
|
28079 | break;
|
28080 |
|
28081 | case diagObj.db.LINETYPE.CRITICAL_START:
|
28082 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
|
28083 | return bounds.newLoop(message);
|
28084 | });
|
28085 | break;
|
28086 |
|
28087 | case diagObj.db.LINETYPE.CRITICAL_OPTION:
|
28088 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin + conf.boxTextMargin, conf.boxMargin, function (message) {
|
28089 | return bounds.addSectionToLoop(message);
|
28090 | });
|
28091 | break;
|
28092 |
|
28093 | case diagObj.db.LINETYPE.CRITICAL_END:
|
28094 | loopModel = bounds.endLoop();
|
28095 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawLoop(diagram, loopModel, 'critical', conf);
|
28096 | bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
|
28097 | bounds.models.addLoop(loopModel);
|
28098 | break;
|
28099 |
|
28100 | case diagObj.db.LINETYPE.BREAK_START:
|
28101 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
|
28102 | return bounds.newLoop(message);
|
28103 | });
|
28104 | break;
|
28105 |
|
28106 | case diagObj.db.LINETYPE.BREAK_END:
|
28107 | loopModel = bounds.endLoop();
|
28108 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawLoop(diagram, loopModel, 'break', conf);
|
28109 | bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
|
28110 | bounds.models.addLoop(loopModel);
|
28111 | break;
|
28112 |
|
28113 | default:
|
28114 | try {
|
28115 | // lastMsg = msg
|
28116 | msgModel = msg.msgModel;
|
28117 | msgModel.starty = bounds.getVerticalPos();
|
28118 | msgModel.sequenceIndex = sequenceIndex;
|
28119 | msgModel.sequenceVisible = diagObj.db.showSequenceNumbers();
|
28120 | var lineStarty = boundMessage(diagram, msgModel);
|
28121 | messagesToDraw.push({
|
28122 | messageModel: msgModel,
|
28123 | lineStarty: lineStarty
|
28124 | });
|
28125 | bounds.models.addMessage(msgModel);
|
28126 | } catch (e) {
|
28127 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.error('error while drawing message', e);
|
28128 | }
|
28129 |
|
28130 | } // Increment sequence counter if msg.type is a line (and not another event like activation or note, etc)
|
28131 |
|
28132 |
|
28133 | if ([diagObj.db.LINETYPE.SOLID_OPEN, diagObj.db.LINETYPE.DOTTED_OPEN, diagObj.db.LINETYPE.SOLID, diagObj.db.LINETYPE.DOTTED, diagObj.db.LINETYPE.SOLID_CROSS, diagObj.db.LINETYPE.DOTTED_CROSS, diagObj.db.LINETYPE.SOLID_POINT, diagObj.db.LINETYPE.DOTTED_POINT].includes(msg.type)) {
|
28134 | sequenceIndex = sequenceIndex + sequenceIndexStep;
|
28135 | }
|
28136 | });
|
28137 | messagesToDraw.forEach(function (e) {
|
28138 | return drawMessage(diagram, e.messageModel, e.lineStarty, diagObj);
|
28139 | });
|
28140 |
|
28141 | if (conf.mirrorActors) {
|
28142 | // Draw actors below diagram
|
28143 | bounds.bumpVerticalPos(conf.boxMargin * 2);
|
28144 | drawActors(diagram, actors, actorKeys, bounds.getVerticalPos(), conf, messages);
|
28145 | bounds.bumpVerticalPos(conf.boxMargin);
|
28146 | (0,_svgDraw__WEBPACK_IMPORTED_MODULE_2__.fixLifeLineHeights)(diagram, bounds.getVerticalPos());
|
28147 | } // only draw popups for the top row of actors.
|
28148 |
|
28149 |
|
28150 | var requiredBoxSize = drawActorsPopup(diagram, actors, actorKeys, doc);
|
28151 |
|
28152 | var _bounds$getBounds = bounds.getBounds(),
|
28153 | box = _bounds$getBounds.bounds; // Adjust line height of actor lines now that the height of the diagram is known
|
28154 |
|
28155 |
|
28156 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('For line height fix Querying: #' + id + ' .actor-line');
|
28157 | var actorLines = (0,d3__WEBPACK_IMPORTED_MODULE_0__.selectAll)('#' + id + ' .actor-line');
|
28158 | actorLines.attr('y2', box.stopy); // Make sure the height of the diagram supports long menus.
|
28159 |
|
28160 | var boxHeight = box.stopy - box.starty;
|
28161 |
|
28162 | if (boxHeight < requiredBoxSize.maxHeight) {
|
28163 | boxHeight = requiredBoxSize.maxHeight;
|
28164 | }
|
28165 |
|
28166 | var height = boxHeight + 2 * conf.diagramMarginY;
|
28167 |
|
28168 | if (conf.mirrorActors) {
|
28169 | height = height - conf.boxMargin + conf.bottomMarginAdj;
|
28170 | } // Make sure the width of the diagram supports wide menus.
|
28171 |
|
28172 |
|
28173 | var boxWidth = box.stopx - box.startx;
|
28174 |
|
28175 | if (boxWidth < requiredBoxSize.maxWidth) {
|
28176 | boxWidth = requiredBoxSize.maxWidth;
|
28177 | }
|
28178 |
|
28179 | var width = boxWidth + 2 * conf.diagramMarginX;
|
28180 |
|
28181 | if (title) {
|
28182 | diagram.append('text').text(title).attr('x', (box.stopx - box.startx) / 2 - 2 * conf.diagramMarginX).attr('y', -25);
|
28183 | }
|
28184 |
|
28185 | (0,_utils__WEBPACK_IMPORTED_MODULE_4__.configureSvgSize)(diagram, height, width, conf.useMaxWidth);
|
28186 | var extraVertForTitle = title ? 40 : 0;
|
28187 | diagram.attr('viewBox', box.startx - conf.diagramMarginX + ' -' + (conf.diagramMarginY + extraVertForTitle) + ' ' + width + ' ' + (height + extraVertForTitle));
|
28188 | (0,_accessibility__WEBPACK_IMPORTED_MODULE_7__["default"])(diagObj.db, diagram, id);
|
28189 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug("models:", bounds.models);
|
28190 | };
|
28191 | /**
|
28192 | * Retrieves the max message width of each actor, supports signals (messages, loops) and notes.
|
28193 | *
|
28194 | * It will enumerate each given message, and will determine its text width, in relation to the actor
|
28195 | * it originates from, and destined to.
|
28196 | *
|
28197 | * @param {any} actors - The actors map
|
28198 | * @param {Array} messages - A list of message objects to iterate
|
28199 | * @param diagObj
|
28200 | * @returns {any}
|
28201 | */
|
28202 |
|
28203 | var getMaxMessageWidthPerActor = function getMaxMessageWidthPerActor(actors, messages, diagObj) {
|
28204 | var maxMessageWidthPerActor = {};
|
28205 | messages.forEach(function (msg) {
|
28206 | if (actors[msg.to] && actors[msg.from]) {
|
28207 | var actor = actors[msg.to]; // If this is the first actor, and the message is left of it, no need to calculate the margin
|
28208 |
|
28209 | if (msg.placement === diagObj.db.PLACEMENT.LEFTOF && !actor.prevActor) {
|
28210 | return;
|
28211 | } // If this is the last actor, and the message is right of it, no need to calculate the margin
|
28212 |
|
28213 |
|
28214 | if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF && !actor.nextActor) {
|
28215 | return;
|
28216 | }
|
28217 |
|
28218 | var isNote = msg.placement !== undefined;
|
28219 | var isMessage = !isNote;
|
28220 | var textFont = isNote ? noteFont(conf) : messageFont(conf);
|
28221 | var wrappedMessage = msg.wrap ? _utils__WEBPACK_IMPORTED_MODULE_4__["default"].wrapLabel(msg.message, conf.width - 2 * conf.wrapPadding, textFont) : msg.message;
|
28222 | var messageDimensions = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calculateTextDimensions(wrappedMessage, textFont);
|
28223 | var messageWidth = messageDimensions.width + 2 * conf.wrapPadding;
|
28224 | /*
|
28225 | * The following scenarios should be supported:
|
28226 | *
|
28227 | * - There's a message (non-note) between fromActor and toActor
|
28228 | * - If fromActor is on the right and toActor is on the left, we should
|
28229 | * define the toActor's margin
|
28230 | * - If fromActor is on the left and toActor is on the right, we should
|
28231 | * define the fromActor's margin
|
28232 | * - There's a note, in which case fromActor == toActor
|
28233 | * - If the note is to the left of the actor, we should define the previous actor
|
28234 | * margin
|
28235 | * - If the note is on the actor, we should define both the previous and next actor
|
28236 | * margins, each being the half of the note size
|
28237 | * - If the note is on the right of the actor, we should define the current actor
|
28238 | * margin
|
28239 | */
|
28240 |
|
28241 | if (isMessage && msg.from === actor.nextActor) {
|
28242 | maxMessageWidthPerActor[msg.to] = Math.max(maxMessageWidthPerActor[msg.to] || 0, messageWidth);
|
28243 | } else if (isMessage && msg.from === actor.prevActor) {
|
28244 | maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth);
|
28245 | } else if (isMessage && msg.from === msg.to) {
|
28246 | maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth / 2);
|
28247 | maxMessageWidthPerActor[msg.to] = Math.max(maxMessageWidthPerActor[msg.to] || 0, messageWidth / 2);
|
28248 | } else if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
|
28249 | maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth);
|
28250 | } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
|
28251 | maxMessageWidthPerActor[actor.prevActor] = Math.max(maxMessageWidthPerActor[actor.prevActor] || 0, messageWidth);
|
28252 | } else if (msg.placement === diagObj.db.PLACEMENT.OVER) {
|
28253 | if (actor.prevActor) {
|
28254 | maxMessageWidthPerActor[actor.prevActor] = Math.max(maxMessageWidthPerActor[actor.prevActor] || 0, messageWidth / 2);
|
28255 | }
|
28256 |
|
28257 | if (actor.nextActor) {
|
28258 | maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth / 2);
|
28259 | }
|
28260 | }
|
28261 | }
|
28262 | });
|
28263 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('maxMessageWidthPerActor:', maxMessageWidthPerActor);
|
28264 | return maxMessageWidthPerActor;
|
28265 | };
|
28266 |
|
28267 | var getRequiredPopupWidth = function getRequiredPopupWidth(actor) {
|
28268 | var requiredPopupWidth = 0;
|
28269 | var textFont = actorFont(conf);
|
28270 |
|
28271 | for (var key in actor.links) {
|
28272 | var labelDimensions = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calculateTextDimensions(key, textFont);
|
28273 | var labelWidth = labelDimensions.width + 2 * conf.wrapPadding + 2 * conf.boxMargin;
|
28274 |
|
28275 | if (requiredPopupWidth < labelWidth) {
|
28276 | requiredPopupWidth = labelWidth;
|
28277 | }
|
28278 | }
|
28279 |
|
28280 | return requiredPopupWidth;
|
28281 | };
|
28282 | /**
|
28283 | * This will calculate the optimal margin for each given actor, for a given actor->messageWidth map.
|
28284 | *
|
28285 | * An actor's margin is determined by the width of the actor, the width of the largest message that
|
28286 | * originates from it, and the configured conf.actorMargin.
|
28287 | *
|
28288 | * @param {any} actors - The actors map to calculate margins for
|
28289 | * @param {any} actorToMessageWidth - A map of actor key -> max message width it holds
|
28290 | */
|
28291 |
|
28292 |
|
28293 | var calculateActorMargins = function calculateActorMargins(actors, actorToMessageWidth) {
|
28294 | var maxHeight = 0;
|
28295 | Object.keys(actors).forEach(function (prop) {
|
28296 | var actor = actors[prop];
|
28297 |
|
28298 | if (actor.wrap) {
|
28299 | actor.description = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].wrapLabel(actor.description, conf.width - 2 * conf.wrapPadding, actorFont(conf));
|
28300 | }
|
28301 |
|
28302 | var actDims = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calculateTextDimensions(actor.description, actorFont(conf));
|
28303 | actor.width = actor.wrap ? conf.width : Math.max(conf.width, actDims.width + 2 * conf.wrapPadding);
|
28304 | actor.height = actor.wrap ? Math.max(actDims.height, conf.height) : conf.height;
|
28305 | maxHeight = Math.max(maxHeight, actor.height);
|
28306 | });
|
28307 |
|
28308 | for (var actorKey in actorToMessageWidth) {
|
28309 | var actor = actors[actorKey];
|
28310 |
|
28311 | if (!actor) {
|
28312 | continue;
|
28313 | }
|
28314 |
|
28315 | var nextActor = actors[actor.nextActor]; // No need to space out an actor that doesn't have a next link
|
28316 |
|
28317 | if (!nextActor) {
|
28318 | continue;
|
28319 | }
|
28320 |
|
28321 | var messageWidth = actorToMessageWidth[actorKey];
|
28322 | var actorWidth = messageWidth + conf.actorMargin - actor.width / 2 - nextActor.width / 2;
|
28323 | actor.margin = Math.max(actorWidth, conf.actorMargin);
|
28324 | }
|
28325 |
|
28326 | return Math.max(maxHeight, conf.height);
|
28327 | };
|
28328 |
|
28329 | var buildNoteModel = function buildNoteModel(msg, actors, diagObj) {
|
28330 | var startx = actors[msg.from].x;
|
28331 | var stopx = actors[msg.to].x;
|
28332 | var shouldWrap = msg.wrap && msg.message;
|
28333 | var textDimensions = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calculateTextDimensions(shouldWrap ? _utils__WEBPACK_IMPORTED_MODULE_4__["default"].wrapLabel(msg.message, conf.width, noteFont(conf)) : msg.message, noteFont(conf));
|
28334 | var noteModel = {
|
28335 | width: shouldWrap ? conf.width : Math.max(conf.width, textDimensions.width + 2 * conf.noteMargin),
|
28336 | height: 0,
|
28337 | startx: actors[msg.from].x,
|
28338 | stopx: 0,
|
28339 | starty: 0,
|
28340 | stopy: 0,
|
28341 | message: msg.message
|
28342 | };
|
28343 |
|
28344 | if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) {
|
28345 | noteModel.width = shouldWrap ? Math.max(conf.width, textDimensions.width) : Math.max(actors[msg.from].width / 2 + actors[msg.to].width / 2, textDimensions.width + 2 * conf.noteMargin);
|
28346 | noteModel.startx = startx + (actors[msg.from].width + conf.actorMargin) / 2;
|
28347 | } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) {
|
28348 | noteModel.width = shouldWrap ? Math.max(conf.width, textDimensions.width + 2 * conf.noteMargin) : Math.max(actors[msg.from].width / 2 + actors[msg.to].width / 2, textDimensions.width + 2 * conf.noteMargin);
|
28349 | noteModel.startx = startx - noteModel.width + (actors[msg.from].width - conf.actorMargin) / 2;
|
28350 | } else if (msg.to === msg.from) {
|
28351 | textDimensions = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calculateTextDimensions(shouldWrap ? _utils__WEBPACK_IMPORTED_MODULE_4__["default"].wrapLabel(msg.message, Math.max(conf.width, actors[msg.from].width), noteFont(conf)) : msg.message, noteFont(conf));
|
28352 | noteModel.width = shouldWrap ? Math.max(conf.width, actors[msg.from].width) : Math.max(actors[msg.from].width, conf.width, textDimensions.width + 2 * conf.noteMargin);
|
28353 | noteModel.startx = startx + (actors[msg.from].width - noteModel.width) / 2;
|
28354 | } else {
|
28355 | noteModel.width = Math.abs(startx + actors[msg.from].width / 2 - (stopx + actors[msg.to].width / 2)) + conf.actorMargin;
|
28356 | noteModel.startx = startx < stopx ? startx + actors[msg.from].width / 2 - conf.actorMargin / 2 : stopx + actors[msg.to].width / 2 - conf.actorMargin / 2;
|
28357 | }
|
28358 |
|
28359 | if (shouldWrap) {
|
28360 | noteModel.message = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].wrapLabel(msg.message, noteModel.width - 2 * conf.wrapPadding, noteFont(conf));
|
28361 | }
|
28362 |
|
28363 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug("NM:[".concat(noteModel.startx, ",").concat(noteModel.stopx, ",").concat(noteModel.starty, ",").concat(noteModel.stopy, ":").concat(noteModel.width, ",").concat(noteModel.height, "=").concat(msg.message, "]"));
|
28364 | return noteModel;
|
28365 | };
|
28366 |
|
28367 | var buildMessageModel = function buildMessageModel(msg, actors, diagObj) {
|
28368 | var process = false;
|
28369 |
|
28370 | if ([diagObj.db.LINETYPE.SOLID_OPEN, diagObj.db.LINETYPE.DOTTED_OPEN, diagObj.db.LINETYPE.SOLID, diagObj.db.LINETYPE.DOTTED, diagObj.db.LINETYPE.SOLID_CROSS, diagObj.db.LINETYPE.DOTTED_CROSS, diagObj.db.LINETYPE.SOLID_POINT, diagObj.db.LINETYPE.DOTTED_POINT].includes(msg.type)) {
|
28371 | process = true;
|
28372 | }
|
28373 |
|
28374 | if (!process) {
|
28375 | return {};
|
28376 | }
|
28377 |
|
28378 | var fromBounds = activationBounds(msg.from, actors);
|
28379 | var toBounds = activationBounds(msg.to, actors);
|
28380 | var fromIdx = fromBounds[0] <= toBounds[0] ? 1 : 0;
|
28381 | var toIdx = fromBounds[0] < toBounds[0] ? 0 : 1;
|
28382 | var allBounds = fromBounds.concat(toBounds);
|
28383 | var boundedWidth = Math.abs(toBounds[toIdx] - fromBounds[fromIdx]);
|
28384 |
|
28385 | if (msg.wrap && msg.message) {
|
28386 | msg.message = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].wrapLabel(msg.message, Math.max(boundedWidth + 2 * conf.wrapPadding, conf.width), messageFont(conf));
|
28387 | }
|
28388 |
|
28389 | var msgDims = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].calculateTextDimensions(msg.message, messageFont(conf));
|
28390 | return {
|
28391 | width: Math.max(msg.wrap ? 0 : msgDims.width + 2 * conf.wrapPadding, boundedWidth + 2 * conf.wrapPadding, conf.width),
|
28392 | height: 0,
|
28393 | startx: fromBounds[fromIdx],
|
28394 | stopx: toBounds[toIdx],
|
28395 | starty: 0,
|
28396 | stopy: 0,
|
28397 | message: msg.message,
|
28398 | type: msg.type,
|
28399 | wrap: msg.wrap,
|
28400 | fromBounds: Math.min.apply(null, allBounds),
|
28401 | toBounds: Math.max.apply(null, allBounds)
|
28402 | };
|
28403 | };
|
28404 |
|
28405 | var calculateLoopBounds = function calculateLoopBounds(messages, actors, _maxWidthPerActor, diagObj) {
|
28406 | var loops = {};
|
28407 | var stack = [];
|
28408 | var current, noteModel, msgModel;
|
28409 | messages.forEach(function (msg) {
|
28410 | msg.id = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].random({
|
28411 | length: 10
|
28412 | });
|
28413 |
|
28414 | switch (msg.type) {
|
28415 | case diagObj.db.LINETYPE.LOOP_START:
|
28416 | case diagObj.db.LINETYPE.ALT_START:
|
28417 | case diagObj.db.LINETYPE.OPT_START:
|
28418 | case diagObj.db.LINETYPE.PAR_START:
|
28419 | case diagObj.db.LINETYPE.CRITICAL_START:
|
28420 | case diagObj.db.LINETYPE.BREAK_START:
|
28421 | stack.push({
|
28422 | id: msg.id,
|
28423 | msg: msg.message,
|
28424 | from: Number.MAX_SAFE_INTEGER,
|
28425 | to: Number.MIN_SAFE_INTEGER,
|
28426 | width: 0
|
28427 | });
|
28428 | break;
|
28429 |
|
28430 | case diagObj.db.LINETYPE.ALT_ELSE:
|
28431 | case diagObj.db.LINETYPE.PAR_AND:
|
28432 | case diagObj.db.LINETYPE.CRITICAL_OPTION:
|
28433 | if (msg.message) {
|
28434 | current = stack.pop();
|
28435 | loops[current.id] = current;
|
28436 | loops[msg.id] = current;
|
28437 | stack.push(current);
|
28438 | }
|
28439 |
|
28440 | break;
|
28441 |
|
28442 | case diagObj.db.LINETYPE.LOOP_END:
|
28443 | case diagObj.db.LINETYPE.ALT_END:
|
28444 | case diagObj.db.LINETYPE.OPT_END:
|
28445 | case diagObj.db.LINETYPE.PAR_END:
|
28446 | case diagObj.db.LINETYPE.CRITICAL_END:
|
28447 | case diagObj.db.LINETYPE.BREAK_END:
|
28448 | current = stack.pop();
|
28449 | loops[current.id] = current;
|
28450 | break;
|
28451 |
|
28452 | case diagObj.db.LINETYPE.ACTIVE_START:
|
28453 | {
|
28454 | var actorRect = actors[msg.from ? msg.from.actor : msg.to.actor];
|
28455 | var stackedSize = actorActivations(msg.from ? msg.from.actor : msg.to.actor).length;
|
28456 | var x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
|
28457 | var toAdd = {
|
28458 | startx: x,
|
28459 | stopx: x + conf.activationWidth,
|
28460 | actor: msg.from.actor,
|
28461 | enabled: true
|
28462 | };
|
28463 | bounds.activations.push(toAdd);
|
28464 | }
|
28465 | break;
|
28466 |
|
28467 | case diagObj.db.LINETYPE.ACTIVE_END:
|
28468 | {
|
28469 | var lastActorActivationIdx = bounds.activations.map(function (a) {
|
28470 | return a.actor;
|
28471 | }).lastIndexOf(msg.from.actor);
|
28472 | delete bounds.activations.splice(lastActorActivationIdx, 1)[0];
|
28473 | }
|
28474 | break;
|
28475 | }
|
28476 |
|
28477 | var isNote = msg.placement !== undefined;
|
28478 |
|
28479 | if (isNote) {
|
28480 | noteModel = buildNoteModel(msg, actors, diagObj);
|
28481 | msg.noteModel = noteModel;
|
28482 | stack.forEach(function (stk) {
|
28483 | current = stk;
|
28484 | current.from = Math.min(current.from, noteModel.startx);
|
28485 | current.to = Math.max(current.to, noteModel.startx + noteModel.width);
|
28486 | current.width = Math.max(current.width, Math.abs(current.from - current.to)) - conf.labelBoxWidth;
|
28487 | });
|
28488 | } else {
|
28489 | msgModel = buildMessageModel(msg, actors, diagObj);
|
28490 | msg.msgModel = msgModel;
|
28491 |
|
28492 | if (msgModel.startx && msgModel.stopx && stack.length > 0) {
|
28493 | stack.forEach(function (stk) {
|
28494 | current = stk;
|
28495 |
|
28496 | if (msgModel.startx === msgModel.stopx) {
|
28497 | var from = actors[msg.from];
|
28498 | var to = actors[msg.to];
|
28499 | current.from = Math.min(from.x - msgModel.width / 2, from.x - from.width / 2, current.from);
|
28500 | current.to = Math.max(to.x + msgModel.width / 2, to.x + from.width / 2, current.to);
|
28501 | current.width = Math.max(current.width, Math.abs(current.to - current.from)) - conf.labelBoxWidth;
|
28502 | } else {
|
28503 | current.from = Math.min(msgModel.startx, current.from);
|
28504 | current.to = Math.max(msgModel.stopx, current.to);
|
28505 | current.width = Math.max(current.width, msgModel.width) - conf.labelBoxWidth;
|
28506 | }
|
28507 | });
|
28508 | }
|
28509 | }
|
28510 | });
|
28511 | bounds.activations = [];
|
28512 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Loop type widths:', loops);
|
28513 | return loops;
|
28514 | };
|
28515 |
|
28516 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
28517 | bounds: bounds,
|
28518 | drawActors: drawActors,
|
28519 | drawActorsPopup: drawActorsPopup,
|
28520 | setConf: setConf,
|
28521 | draw: draw
|
28522 | });
|
28523 |
|
28524 | /***/ }),
|
28525 |
|
28526 | /***/ "./src/diagrams/sequence/styles.js":
|
28527 | /*!*****************************************!*\
|
28528 | !*** ./src/diagrams/sequence/styles.js ***!
|
28529 | \*****************************************/
|
28530 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
28531 |
|
28532 | "use strict";
|
28533 | __webpack_require__.r(__webpack_exports__);
|
28534 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
28535 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
28536 | /* harmony export */ });
|
28537 | var getStyles = function getStyles(options) {
|
28538 | return ".actor {\n stroke: ".concat(options.actorBorder, ";\n fill: ").concat(options.actorBkg, ";\n }\n\n text.actor > tspan {\n fill: ").concat(options.actorTextColor, ";\n stroke: none;\n }\n\n .actor-line {\n stroke: ").concat(options.actorLineColor, ";\n }\n\n .messageLine0 {\n stroke-width: 1.5;\n stroke-dasharray: none;\n stroke: ").concat(options.signalColor, ";\n }\n\n .messageLine1 {\n stroke-width: 1.5;\n stroke-dasharray: 2, 2;\n stroke: ").concat(options.signalColor, ";\n }\n\n #arrowhead path {\n fill: ").concat(options.signalColor, ";\n stroke: ").concat(options.signalColor, ";\n }\n\n .sequenceNumber {\n fill: ").concat(options.sequenceNumberColor, ";\n }\n\n #sequencenumber {\n fill: ").concat(options.signalColor, ";\n }\n\n #crosshead path {\n fill: ").concat(options.signalColor, ";\n stroke: ").concat(options.signalColor, ";\n }\n\n .messageText {\n fill: ").concat(options.signalTextColor, ";\n stroke: ").concat(options.signalTextColor, ";\n }\n\n .labelBox {\n stroke: ").concat(options.labelBoxBorderColor, ";\n fill: ").concat(options.labelBoxBkgColor, ";\n }\n\n .labelText, .labelText > tspan {\n fill: ").concat(options.labelTextColor, ";\n stroke: none;\n }\n\n .loopText, .loopText > tspan {\n fill: ").concat(options.loopTextColor, ";\n stroke: none;\n }\n\n .loopLine {\n stroke-width: 2px;\n stroke-dasharray: 2, 2;\n stroke: ").concat(options.labelBoxBorderColor, ";\n fill: ").concat(options.labelBoxBorderColor, ";\n }\n\n .note {\n //stroke: #decc93;\n stroke: ").concat(options.noteBorderColor, ";\n fill: ").concat(options.noteBkgColor, ";\n }\n\n .noteText, .noteText > tspan {\n fill: ").concat(options.noteTextColor, ";\n stroke: none;\n }\n\n .activation0 {\n fill: ").concat(options.activationBkgColor, ";\n stroke: ").concat(options.activationBorderColor, ";\n }\n\n .activation1 {\n fill: ").concat(options.activationBkgColor, ";\n stroke: ").concat(options.activationBorderColor, ";\n }\n\n .activation2 {\n fill: ").concat(options.activationBkgColor, ";\n stroke: ").concat(options.activationBorderColor, ";\n }\n\n .actorPopupMenu {\n position: absolute;\n }\n\n .actorPopupMenuPanel {\n position: absolute;\n fill: ").concat(options.actorBkg, ";\n box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);\n filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));\n}\n .actor-man line {\n stroke: ").concat(options.actorBorder, ";\n fill: ").concat(options.actorBkg, ";\n }\n .actor-man circle, line {\n stroke: ").concat(options.actorBorder, ";\n fill: ").concat(options.actorBkg, ";\n stroke-width: 2px;\n }\n");
|
28539 | };
|
28540 |
|
28541 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
28542 |
|
28543 | /***/ }),
|
28544 |
|
28545 | /***/ "./src/diagrams/sequence/svgDraw.js":
|
28546 | /*!******************************************!*\
|
28547 | !*** ./src/diagrams/sequence/svgDraw.js ***!
|
28548 | \******************************************/
|
28549 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
28550 |
|
28551 | "use strict";
|
28552 | __webpack_require__.r(__webpack_exports__);
|
28553 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
28554 | /* harmony export */ "anchorElement": () => (/* binding */ anchorElement),
|
28555 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
28556 | /* harmony export */ "drawActivation": () => (/* binding */ drawActivation),
|
28557 | /* harmony export */ "drawActor": () => (/* binding */ drawActor),
|
28558 | /* harmony export */ "drawBackgroundRect": () => (/* binding */ drawBackgroundRect),
|
28559 | /* harmony export */ "drawEmbeddedImage": () => (/* binding */ drawEmbeddedImage),
|
28560 | /* harmony export */ "drawImage": () => (/* binding */ drawImage),
|
28561 | /* harmony export */ "drawLabel": () => (/* binding */ drawLabel),
|
28562 | /* harmony export */ "drawLoop": () => (/* binding */ drawLoop),
|
28563 | /* harmony export */ "drawPopup": () => (/* binding */ drawPopup),
|
28564 | /* harmony export */ "drawRect": () => (/* binding */ drawRect),
|
28565 | /* harmony export */ "drawText": () => (/* binding */ drawText),
|
28566 | /* harmony export */ "fixLifeLineHeights": () => (/* binding */ fixLifeLineHeights),
|
28567 | /* harmony export */ "getNoteRect": () => (/* binding */ getNoteRect),
|
28568 | /* harmony export */ "getTextObj": () => (/* binding */ getTextObj),
|
28569 | /* harmony export */ "insertArrowCrossHead": () => (/* binding */ insertArrowCrossHead),
|
28570 | /* harmony export */ "insertArrowFilledHead": () => (/* binding */ insertArrowFilledHead),
|
28571 | /* harmony export */ "insertArrowHead": () => (/* binding */ insertArrowHead),
|
28572 | /* harmony export */ "insertClockIcon": () => (/* binding */ insertClockIcon),
|
28573 | /* harmony export */ "insertComputerIcon": () => (/* binding */ insertComputerIcon),
|
28574 | /* harmony export */ "insertDatabaseIcon": () => (/* binding */ insertDatabaseIcon),
|
28575 | /* harmony export */ "insertSequenceNumber": () => (/* binding */ insertSequenceNumber),
|
28576 | /* harmony export */ "popdownMenu": () => (/* binding */ popdownMenu),
|
28577 | /* harmony export */ "popupMenu": () => (/* binding */ popupMenu)
|
28578 | /* harmony export */ });
|
28579 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
28580 | /* harmony import */ var _interactionDb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../interactionDb */ "./src/interactionDb.js");
|
28581 | /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @braintree/sanitize-url */ "@braintree/sanitize-url");
|
28582 | /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__);
|
28583 |
|
28584 |
|
28585 |
|
28586 | var drawRect = function drawRect(elem, rectData) {
|
28587 | var rectElem = elem.append('rect');
|
28588 | rectElem.attr('x', rectData.x);
|
28589 | rectElem.attr('y', rectData.y);
|
28590 | rectElem.attr('fill', rectData.fill);
|
28591 | rectElem.attr('stroke', rectData.stroke);
|
28592 | rectElem.attr('width', rectData.width);
|
28593 | rectElem.attr('height', rectData.height);
|
28594 | rectElem.attr('rx', rectData.rx);
|
28595 | rectElem.attr('ry', rectData.ry);
|
28596 |
|
28597 | if (typeof rectData.class !== 'undefined') {
|
28598 | rectElem.attr('class', rectData.class);
|
28599 | }
|
28600 |
|
28601 | return rectElem;
|
28602 | }; // const sanitizeUrl = function (s) {
|
28603 | // return s
|
28604 | // .replace(/&/g, '&')
|
28605 | // .replace(/</g, '<')
|
28606 | // .replace(/javascript:/g, '');
|
28607 | // };
|
28608 |
|
28609 | var addPopupInteraction = function addPopupInteraction(id, actorCnt) {
|
28610 | (0,_interactionDb__WEBPACK_IMPORTED_MODULE_1__.addFunction)(function () {
|
28611 | var arr = document.querySelectorAll(id); // This will be the case when running in sandboxed mode
|
28612 |
|
28613 | if (arr.length === 0) return;
|
28614 | arr[0].addEventListener('mouseover', function () {
|
28615 | popupMenuUpFunc('actor' + actorCnt + '_popup');
|
28616 | });
|
28617 | arr[0].addEventListener('mouseout', function () {
|
28618 | popupMenuDownFunc('actor' + actorCnt + '_popup');
|
28619 | });
|
28620 | });
|
28621 | };
|
28622 |
|
28623 | var drawPopup = function drawPopup(elem, actor, minMenuWidth, textAttrs, forceMenus) {
|
28624 | if (actor.links === undefined || actor.links === null || Object.keys(actor.links).length === 0) {
|
28625 | return {
|
28626 | height: 0,
|
28627 | width: 0
|
28628 | };
|
28629 | }
|
28630 |
|
28631 | var links = actor.links;
|
28632 | var actorCnt = actor.actorCnt;
|
28633 | var rectData = actor.rectData;
|
28634 | var displayValue = 'none';
|
28635 |
|
28636 | if (forceMenus) {
|
28637 | displayValue = 'block !important';
|
28638 | }
|
28639 |
|
28640 | var g = elem.append('g');
|
28641 | g.attr('id', 'actor' + actorCnt + '_popup');
|
28642 | g.attr('class', 'actorPopupMenu');
|
28643 | g.attr('display', displayValue);
|
28644 | addPopupInteraction('#actor' + actorCnt + '_popup', actorCnt);
|
28645 | var actorClass = '';
|
28646 |
|
28647 | if (typeof rectData.class !== 'undefined') {
|
28648 | actorClass = ' ' + rectData.class;
|
28649 | }
|
28650 |
|
28651 | var menuWidth = rectData.width > minMenuWidth ? rectData.width : minMenuWidth;
|
28652 | var rectElem = g.append('rect');
|
28653 | rectElem.attr('class', 'actorPopupMenuPanel' + actorClass);
|
28654 | rectElem.attr('x', rectData.x);
|
28655 | rectElem.attr('y', rectData.height);
|
28656 | rectElem.attr('fill', rectData.fill);
|
28657 | rectElem.attr('stroke', rectData.stroke);
|
28658 | rectElem.attr('width', menuWidth);
|
28659 | rectElem.attr('height', rectData.height);
|
28660 | rectElem.attr('rx', rectData.rx);
|
28661 | rectElem.attr('ry', rectData.ry);
|
28662 |
|
28663 | if (links != null) {
|
28664 | var linkY = 20;
|
28665 |
|
28666 | for (var key in links) {
|
28667 | var linkElem = g.append('a');
|
28668 | var sanitizedLink = (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__.sanitizeUrl)(links[key]);
|
28669 | linkElem.attr('xlink:href', sanitizedLink);
|
28670 | linkElem.attr('target', '_blank');
|
28671 |
|
28672 | _drawMenuItemTextCandidateFunc(textAttrs)(key, linkElem, rectData.x + 10, rectData.height + linkY, menuWidth, 20, {
|
28673 | class: 'actor'
|
28674 | }, textAttrs);
|
28675 |
|
28676 | linkY += 30;
|
28677 | }
|
28678 | }
|
28679 |
|
28680 | rectElem.attr('height', linkY);
|
28681 | return {
|
28682 | height: rectData.height + linkY,
|
28683 | width: menuWidth
|
28684 | };
|
28685 | };
|
28686 | var drawImage = function drawImage(elem, x, y, link) {
|
28687 | var imageElem = elem.append('image');
|
28688 | imageElem.attr('x', x);
|
28689 | imageElem.attr('y', y);
|
28690 | var sanitizedLink = (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__.sanitizeUrl)(link);
|
28691 | imageElem.attr('xlink:href', sanitizedLink);
|
28692 | };
|
28693 | var drawEmbeddedImage = function drawEmbeddedImage(elem, x, y, link) {
|
28694 | var imageElem = elem.append('use');
|
28695 | imageElem.attr('x', x);
|
28696 | imageElem.attr('y', y);
|
28697 | var sanitizedLink = (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__.sanitizeUrl)(link);
|
28698 | imageElem.attr('xlink:href', '#' + sanitizedLink);
|
28699 | };
|
28700 | var popupMenu = function popupMenu(popid) {
|
28701 | return "var pu = document.getElementById('" + popid + "'); if (pu != null) { pu.style.display = 'block'; }";
|
28702 | };
|
28703 | var popdownMenu = function popdownMenu(popid) {
|
28704 | return "var pu = document.getElementById('" + popid + "'); if (pu != null) { pu.style.display = 'none'; }";
|
28705 | };
|
28706 |
|
28707 | var popupMenuUpFunc = function popupMenuUpFunc(popupId) {
|
28708 | var pu = document.getElementById(popupId);
|
28709 |
|
28710 | if (pu != null) {
|
28711 | pu.style.display = 'block';
|
28712 | }
|
28713 | };
|
28714 |
|
28715 | var popupMenuDownFunc = function popupMenuDownFunc(popupId) {
|
28716 | var pu = document.getElementById(popupId);
|
28717 |
|
28718 | if (pu != null) {
|
28719 | pu.style.display = 'none';
|
28720 | }
|
28721 | };
|
28722 |
|
28723 | var drawText = function drawText(elem, textData) {
|
28724 | var prevTextHeight = 0,
|
28725 | textHeight = 0;
|
28726 | var lines = textData.text.split(_common_common__WEBPACK_IMPORTED_MODULE_2__["default"].lineBreakRegex);
|
28727 | var textElems = [];
|
28728 | var dy = 0;
|
28729 |
|
28730 | var yfunc = function yfunc() {
|
28731 | return textData.y;
|
28732 | };
|
28733 |
|
28734 | if (typeof textData.valign !== 'undefined' && typeof textData.textMargin !== 'undefined' && textData.textMargin > 0) {
|
28735 | switch (textData.valign) {
|
28736 | case 'top':
|
28737 | case 'start':
|
28738 | yfunc = function yfunc() {
|
28739 | return Math.round(textData.y + textData.textMargin);
|
28740 | };
|
28741 |
|
28742 | break;
|
28743 |
|
28744 | case 'middle':
|
28745 | case 'center':
|
28746 | yfunc = function yfunc() {
|
28747 | return Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2);
|
28748 | };
|
28749 |
|
28750 | break;
|
28751 |
|
28752 | case 'bottom':
|
28753 | case 'end':
|
28754 | yfunc = function yfunc() {
|
28755 | return Math.round(textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin);
|
28756 | };
|
28757 |
|
28758 | break;
|
28759 | }
|
28760 | }
|
28761 |
|
28762 | if (typeof textData.anchor !== 'undefined' && typeof textData.textMargin !== 'undefined' && typeof textData.width !== 'undefined') {
|
28763 | switch (textData.anchor) {
|
28764 | case 'left':
|
28765 | case 'start':
|
28766 | textData.x = Math.round(textData.x + textData.textMargin);
|
28767 | textData.anchor = 'start';
|
28768 | textData.dominantBaseline = 'middle';
|
28769 | textData.alignmentBaseline = 'middle';
|
28770 | break;
|
28771 |
|
28772 | case 'middle':
|
28773 | case 'center':
|
28774 | textData.x = Math.round(textData.x + textData.width / 2);
|
28775 | textData.anchor = 'middle';
|
28776 | textData.dominantBaseline = 'middle';
|
28777 | textData.alignmentBaseline = 'middle';
|
28778 | break;
|
28779 |
|
28780 | case 'right':
|
28781 | case 'end':
|
28782 | textData.x = Math.round(textData.x + textData.width - textData.textMargin);
|
28783 | textData.anchor = 'end';
|
28784 | textData.dominantBaseline = 'middle';
|
28785 | textData.alignmentBaseline = 'middle';
|
28786 | break;
|
28787 | }
|
28788 | }
|
28789 |
|
28790 | for (var i = 0; i < lines.length; i++) {
|
28791 | var line = lines[i];
|
28792 |
|
28793 | if (typeof textData.textMargin !== 'undefined' && textData.textMargin === 0 && typeof textData.fontSize !== 'undefined') {
|
28794 | dy = i * textData.fontSize;
|
28795 | }
|
28796 |
|
28797 | var textElem = elem.append('text');
|
28798 | textElem.attr('x', textData.x);
|
28799 | textElem.attr('y', yfunc());
|
28800 |
|
28801 | if (typeof textData.anchor !== 'undefined') {
|
28802 | textElem.attr('text-anchor', textData.anchor).attr('dominant-baseline', textData.dominantBaseline).attr('alignment-baseline', textData.alignmentBaseline);
|
28803 | }
|
28804 |
|
28805 | if (typeof textData.fontFamily !== 'undefined') {
|
28806 | textElem.style('font-family', textData.fontFamily);
|
28807 | }
|
28808 |
|
28809 | if (typeof textData.fontSize !== 'undefined') {
|
28810 | textElem.style('font-size', textData.fontSize);
|
28811 | }
|
28812 |
|
28813 | if (typeof textData.fontWeight !== 'undefined') {
|
28814 | textElem.style('font-weight', textData.fontWeight);
|
28815 | }
|
28816 |
|
28817 | if (typeof textData.fill !== 'undefined') {
|
28818 | textElem.attr('fill', textData.fill);
|
28819 | }
|
28820 |
|
28821 | if (typeof textData.class !== 'undefined') {
|
28822 | textElem.attr('class', textData.class);
|
28823 | }
|
28824 |
|
28825 | if (typeof textData.dy !== 'undefined') {
|
28826 | textElem.attr('dy', textData.dy);
|
28827 | } else if (dy !== 0) {
|
28828 | textElem.attr('dy', dy);
|
28829 | }
|
28830 |
|
28831 | if (textData.tspan) {
|
28832 | var span = textElem.append('tspan');
|
28833 | span.attr('x', textData.x);
|
28834 |
|
28835 | if (typeof textData.fill !== 'undefined') {
|
28836 | span.attr('fill', textData.fill);
|
28837 | }
|
28838 |
|
28839 | span.text(line);
|
28840 | } else {
|
28841 | textElem.text(line);
|
28842 | }
|
28843 |
|
28844 | if (typeof textData.valign !== 'undefined' && typeof textData.textMargin !== 'undefined' && textData.textMargin > 0) {
|
28845 | textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
|
28846 | prevTextHeight = textHeight;
|
28847 | }
|
28848 |
|
28849 | textElems.push(textElem);
|
28850 | }
|
28851 |
|
28852 | return textElems;
|
28853 | };
|
28854 | var drawLabel = function drawLabel(elem, txtObject) {
|
28855 | /**
|
28856 | * @param {any} x
|
28857 | * @param {any} y
|
28858 | * @param {any} width
|
28859 | * @param {any} height
|
28860 | * @param {any} cut
|
28861 | * @returns {any}
|
28862 | */
|
28863 | function genPoints(x, y, width, height, cut) {
|
28864 | return x + ',' + y + ' ' + (x + width) + ',' + y + ' ' + (x + width) + ',' + (y + height - cut) + ' ' + (x + width - cut * 1.2) + ',' + (y + height) + ' ' + x + ',' + (y + height);
|
28865 | }
|
28866 |
|
28867 | var polygon = elem.append('polygon');
|
28868 | polygon.attr('points', genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7));
|
28869 | polygon.attr('class', 'labelBox');
|
28870 | txtObject.y = txtObject.y + txtObject.height / 2;
|
28871 | drawText(elem, txtObject);
|
28872 | return polygon;
|
28873 | };
|
28874 | var actorCnt = -1;
|
28875 | var fixLifeLineHeights = function fixLifeLineHeights(diagram, bounds) {
|
28876 | if (!diagram.selectAll) return;
|
28877 | diagram.selectAll('.actor-line').attr('class', '200').attr('y2', bounds - 55);
|
28878 | };
|
28879 | /**
|
28880 | * Draws an actor in the diagram with the attached line
|
28881 | *
|
28882 | * @param {any} elem - The diagram we'll draw to.
|
28883 | * @param {any} actor - The actor to draw.
|
28884 | * @param {any} conf - DrawText implementation discriminator object
|
28885 | */
|
28886 |
|
28887 | var drawActorTypeParticipant = function drawActorTypeParticipant(elem, actor, conf) {
|
28888 | var center = actor.x + actor.width / 2;
|
28889 | var boxpluslineGroup = elem.append('g');
|
28890 | var g = boxpluslineGroup;
|
28891 |
|
28892 | if (actor.y === 0) {
|
28893 | actorCnt++;
|
28894 | g.append('line').attr('id', 'actor' + actorCnt).attr('x1', center).attr('y1', 5).attr('x2', center).attr('y2', 2000).attr('class', 'actor-line').attr('stroke-width', '0.5px').attr('stroke', '#999');
|
28895 | g = boxpluslineGroup.append('g');
|
28896 | actor.actorCnt = actorCnt;
|
28897 |
|
28898 | if (actor.links != null) {
|
28899 | g.attr('id', 'root-' + actorCnt);
|
28900 | addPopupInteraction('#root-' + actorCnt, actorCnt);
|
28901 | }
|
28902 | }
|
28903 |
|
28904 | var rect = getNoteRect();
|
28905 | var cssclass = 'actor';
|
28906 |
|
28907 | if (actor.properties != null && actor.properties['class']) {
|
28908 | cssclass = actor.properties['class'];
|
28909 | } else {
|
28910 | rect.fill = '#eaeaea';
|
28911 | }
|
28912 |
|
28913 | rect.x = actor.x;
|
28914 | rect.y = actor.y;
|
28915 | rect.width = actor.width;
|
28916 | rect.height = actor.height;
|
28917 | rect.class = cssclass;
|
28918 | rect.rx = 3;
|
28919 | rect.ry = 3;
|
28920 | var rectElem = drawRect(g, rect);
|
28921 | actor.rectData = rect;
|
28922 |
|
28923 | if (actor.properties != null && actor.properties['icon']) {
|
28924 | var iconSrc = actor.properties['icon'].trim();
|
28925 |
|
28926 | if (iconSrc.charAt(0) === '@') {
|
28927 | drawEmbeddedImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc.substr(1));
|
28928 | } else {
|
28929 | drawImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc);
|
28930 | }
|
28931 | }
|
28932 |
|
28933 | _drawTextCandidateFunc(conf)(actor.description, g, rect.x, rect.y, rect.width, rect.height, {
|
28934 | class: 'actor'
|
28935 | }, conf);
|
28936 |
|
28937 | var height = actor.height;
|
28938 |
|
28939 | if (rectElem.node) {
|
28940 | var bounds = rectElem.node().getBBox();
|
28941 | actor.height = bounds.height;
|
28942 | height = bounds.height;
|
28943 | }
|
28944 |
|
28945 | return height;
|
28946 | };
|
28947 |
|
28948 | var drawActorTypeActor = function drawActorTypeActor(elem, actor, conf) {
|
28949 | var center = actor.x + actor.width / 2;
|
28950 |
|
28951 | if (actor.y === 0) {
|
28952 | actorCnt++;
|
28953 | elem.append('line').attr('id', 'actor' + actorCnt).attr('x1', center).attr('y1', 80).attr('x2', center).attr('y2', 2000).attr('class', 'actor-line').attr('stroke-width', '0.5px').attr('stroke', '#999');
|
28954 | }
|
28955 |
|
28956 | var actElem = elem.append('g');
|
28957 | actElem.attr('class', 'actor-man');
|
28958 | var rect = getNoteRect();
|
28959 | rect.x = actor.x;
|
28960 | rect.y = actor.y;
|
28961 | rect.fill = '#eaeaea';
|
28962 | rect.width = actor.width;
|
28963 | rect.height = actor.height;
|
28964 | rect.class = 'actor';
|
28965 | rect.rx = 3;
|
28966 | rect.ry = 3; // drawRect(actElem, rect);
|
28967 |
|
28968 | actElem.append('line').attr('id', 'actor-man-torso' + actorCnt).attr('x1', center).attr('y1', actor.y + 25).attr('x2', center).attr('y2', actor.y + 45);
|
28969 | actElem.append('line').attr('id', 'actor-man-arms' + actorCnt).attr('x1', center - 18).attr('y1', actor.y + 33).attr('x2', center + 18).attr('y2', actor.y + 33);
|
28970 | actElem.append('line').attr('x1', center - 18).attr('y1', actor.y + 60).attr('x2', center).attr('y2', actor.y + 45);
|
28971 | actElem.append('line').attr('x1', center).attr('y1', actor.y + 45).attr('x2', center + 16).attr('y2', actor.y + 60);
|
28972 | var circle = actElem.append('circle');
|
28973 | circle.attr('cx', actor.x + actor.width / 2);
|
28974 | circle.attr('cy', actor.y + 10);
|
28975 | circle.attr('r', 15);
|
28976 | circle.attr('width', actor.width);
|
28977 | circle.attr('height', actor.height);
|
28978 | var bounds = actElem.node().getBBox();
|
28979 | actor.height = bounds.height;
|
28980 |
|
28981 | _drawTextCandidateFunc(conf)(actor.description, actElem, rect.x, rect.y + 35, rect.width, rect.height, {
|
28982 | class: 'actor'
|
28983 | }, conf);
|
28984 |
|
28985 | return actor.height;
|
28986 | };
|
28987 |
|
28988 | var drawActor = function drawActor(elem, actor, conf) {
|
28989 | switch (actor.type) {
|
28990 | case 'actor':
|
28991 | return drawActorTypeActor(elem, actor, conf);
|
28992 |
|
28993 | case 'participant':
|
28994 | return drawActorTypeParticipant(elem, actor, conf);
|
28995 | }
|
28996 | };
|
28997 | var anchorElement = function anchorElement(elem) {
|
28998 | return elem.append('g');
|
28999 | };
|
29000 | /**
|
29001 | * Draws an activation in the diagram
|
29002 | *
|
29003 | * @param {any} elem - Element to append activation rect.
|
29004 | * @param {any} bounds - Activation box bounds.
|
29005 | * @param {any} verticalPos - Precise y cooridnate of bottom activation box edge.
|
29006 | * @param {any} conf - Sequence diagram config object.
|
29007 | * @param {any} actorActivations - Number of activations on the actor.
|
29008 | */
|
29009 |
|
29010 | var drawActivation = function drawActivation(elem, bounds, verticalPos, conf, actorActivations) {
|
29011 | var rect = getNoteRect();
|
29012 | var g = bounds.anchored;
|
29013 | rect.x = bounds.startx;
|
29014 | rect.y = bounds.starty;
|
29015 | rect.class = 'activation' + actorActivations % 3; // Will evaluate to 0, 1 or 2
|
29016 |
|
29017 | rect.width = bounds.stopx - bounds.startx;
|
29018 | rect.height = verticalPos - bounds.starty;
|
29019 | drawRect(g, rect);
|
29020 | };
|
29021 | /**
|
29022 | * Draws a loop in the diagram
|
29023 | *
|
29024 | * @param {any} elem - Elemenet to append the loop to.
|
29025 | * @param {any} loopModel - LoopModel of the given loop.
|
29026 | * @param {any} labelText - Text within the loop.
|
29027 | * @param {any} conf - Diagrom configuration
|
29028 | * @returns {any}
|
29029 | */
|
29030 |
|
29031 | var drawLoop = function drawLoop(elem, loopModel, labelText, conf) {
|
29032 | var boxMargin = conf.boxMargin,
|
29033 | boxTextMargin = conf.boxTextMargin,
|
29034 | labelBoxHeight = conf.labelBoxHeight,
|
29035 | labelBoxWidth = conf.labelBoxWidth,
|
29036 | fontFamily = conf.messageFontFamily,
|
29037 | fontSize = conf.messageFontSize,
|
29038 | fontWeight = conf.messageFontWeight;
|
29039 | var g = elem.append('g');
|
29040 |
|
29041 | var drawLoopLine = function drawLoopLine(startx, starty, stopx, stopy) {
|
29042 | return g.append('line').attr('x1', startx).attr('y1', starty).attr('x2', stopx).attr('y2', stopy).attr('class', 'loopLine');
|
29043 | };
|
29044 |
|
29045 | drawLoopLine(loopModel.startx, loopModel.starty, loopModel.stopx, loopModel.starty);
|
29046 | drawLoopLine(loopModel.stopx, loopModel.starty, loopModel.stopx, loopModel.stopy);
|
29047 | drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy);
|
29048 | drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy);
|
29049 |
|
29050 | if (typeof loopModel.sections !== 'undefined') {
|
29051 | loopModel.sections.forEach(function (item) {
|
29052 | drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style('stroke-dasharray', '3, 3');
|
29053 | });
|
29054 | }
|
29055 |
|
29056 | var txt = getTextObj();
|
29057 | txt.text = labelText;
|
29058 | txt.x = loopModel.startx;
|
29059 | txt.y = loopModel.starty;
|
29060 | txt.fontFamily = fontFamily;
|
29061 | txt.fontSize = fontSize;
|
29062 | txt.fontWeight = fontWeight;
|
29063 | txt.anchor = 'middle';
|
29064 | txt.valign = 'middle';
|
29065 | txt.tspan = false;
|
29066 | txt.width = labelBoxWidth || 50;
|
29067 | txt.height = labelBoxHeight || 20;
|
29068 | txt.textMargin = boxTextMargin;
|
29069 | txt.class = 'labelText';
|
29070 | drawLabel(g, txt);
|
29071 | txt = getTextObj();
|
29072 | txt.text = loopModel.title;
|
29073 | txt.x = loopModel.startx + labelBoxWidth / 2 + (loopModel.stopx - loopModel.startx) / 2;
|
29074 | txt.y = loopModel.starty + boxMargin + boxTextMargin;
|
29075 | txt.anchor = 'middle';
|
29076 | txt.valign = 'middle';
|
29077 | txt.textMargin = boxTextMargin;
|
29078 | txt.class = 'loopText';
|
29079 | txt.fontFamily = fontFamily;
|
29080 | txt.fontSize = fontSize;
|
29081 | txt.fontWeight = fontWeight;
|
29082 | txt.wrap = true;
|
29083 | var textElem = drawText(g, txt);
|
29084 |
|
29085 | if (typeof loopModel.sectionTitles !== 'undefined') {
|
29086 | loopModel.sectionTitles.forEach(function (item, idx) {
|
29087 | if (item.message) {
|
29088 | txt.text = item.message;
|
29089 | txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2;
|
29090 | txt.y = loopModel.sections[idx].y + boxMargin + boxTextMargin;
|
29091 | txt.class = 'loopText';
|
29092 | txt.anchor = 'middle';
|
29093 | txt.valign = 'middle';
|
29094 | txt.tspan = false;
|
29095 | txt.fontFamily = fontFamily;
|
29096 | txt.fontSize = fontSize;
|
29097 | txt.fontWeight = fontWeight;
|
29098 | txt.wrap = loopModel.wrap;
|
29099 | textElem = drawText(g, txt);
|
29100 | var sectionHeight = Math.round(textElem.map(function (te) {
|
29101 | return (te._groups || te)[0][0].getBBox().height;
|
29102 | }).reduce(function (acc, curr) {
|
29103 | return acc + curr;
|
29104 | }));
|
29105 | loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin);
|
29106 | }
|
29107 | });
|
29108 | }
|
29109 |
|
29110 | loopModel.height = Math.round(loopModel.stopy - loopModel.starty);
|
29111 | return g;
|
29112 | };
|
29113 | /**
|
29114 | * Draws a background rectangle
|
29115 | *
|
29116 | * @param {any} elem Diagram (reference for bounds)
|
29117 | * @param {any} bounds Shape of the rectangle
|
29118 | */
|
29119 |
|
29120 | var drawBackgroundRect = function drawBackgroundRect(elem, bounds) {
|
29121 | var rectElem = drawRect(elem, {
|
29122 | x: bounds.startx,
|
29123 | y: bounds.starty,
|
29124 | width: bounds.stopx - bounds.startx,
|
29125 | height: bounds.stopy - bounds.starty,
|
29126 | fill: bounds.fill,
|
29127 | class: 'rect'
|
29128 | });
|
29129 | rectElem.lower();
|
29130 | };
|
29131 | var insertDatabaseIcon = function insertDatabaseIcon(elem) {
|
29132 | elem.append('defs').append('symbol').attr('id', 'database').attr('fill-rule', 'evenodd').attr('clip-rule', 'evenodd').append('path').attr('transform', 'scale(.5)').attr('d', 'M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z');
|
29133 | };
|
29134 | var insertComputerIcon = function insertComputerIcon(elem) {
|
29135 | elem.append('defs').append('symbol').attr('id', 'computer').attr('width', '24').attr('height', '24').append('path').attr('transform', 'scale(.5)').attr('d', 'M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z');
|
29136 | };
|
29137 | var insertClockIcon = function insertClockIcon(elem) {
|
29138 | elem.append('defs').append('symbol').attr('id', 'clock').attr('width', '24').attr('height', '24').append('path').attr('transform', 'scale(.5)').attr('d', 'M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z');
|
29139 | };
|
29140 | /**
|
29141 | * Setup arrow head and define the marker. The result is appended to the svg.
|
29142 | *
|
29143 | * @param elem
|
29144 | */
|
29145 |
|
29146 | var insertArrowHead = function insertArrowHead(elem) {
|
29147 | elem.append('defs').append('marker').attr('id', 'arrowhead').attr('refX', 9).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 12).attr('markerHeight', 12).attr('orient', 'auto').append('path').attr('d', 'M 0 0 L 10 5 L 0 10 z'); // this is actual shape for arrowhead
|
29148 | };
|
29149 | /**
|
29150 | * Setup arrow head and define the marker. The result is appended to the svg.
|
29151 | *
|
29152 | * @param {any} elem
|
29153 | */
|
29154 |
|
29155 | var insertArrowFilledHead = function insertArrowFilledHead(elem) {
|
29156 | elem.append('defs').append('marker').attr('id', 'filled-head').attr('refX', 18).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');
|
29157 | };
|
29158 | /**
|
29159 | * Setup node number. The result is appended to the svg.
|
29160 | *
|
29161 | * @param {any} elem
|
29162 | */
|
29163 |
|
29164 | var insertSequenceNumber = function insertSequenceNumber(elem) {
|
29165 | elem.append('defs').append('marker').attr('id', 'sequencenumber').attr('refX', 15).attr('refY', 15).attr('markerWidth', 60).attr('markerHeight', 40).attr('orient', 'auto').append('circle').attr('cx', 15).attr('cy', 15).attr('r', 6); // .style("fill", '#f00');
|
29166 | };
|
29167 | /**
|
29168 | * Setup arrow head and define the marker. The result is appended to the svg.
|
29169 | *
|
29170 | * @param {any} elem
|
29171 | */
|
29172 |
|
29173 | var insertArrowCrossHead = function insertArrowCrossHead(elem) {
|
29174 | var defs = elem.append('defs');
|
29175 | var marker = defs.append('marker').attr('id', 'crosshead').attr('markerWidth', 15).attr('markerHeight', 8).attr('orient', 'auto').attr('refX', 16).attr('refY', 4); // The arrow
|
29176 |
|
29177 | marker.append('path').attr('fill', 'black').attr('stroke', '#000000').style('stroke-dasharray', '0, 0').attr('stroke-width', '1px').attr('d', 'M 9,2 V 6 L16,4 Z'); // The cross
|
29178 |
|
29179 | marker.append('path').attr('fill', 'none').attr('stroke', '#000000').style('stroke-dasharray', '0, 0').attr('stroke-width', '1px').attr('d', 'M 0,1 L 6,7 M 6,1 L 0,7'); // this is actual shape for arrowhead
|
29180 | };
|
29181 | var getTextObj = function getTextObj() {
|
29182 | return {
|
29183 | x: 0,
|
29184 | y: 0,
|
29185 | fill: undefined,
|
29186 | anchor: undefined,
|
29187 | style: '#666',
|
29188 | width: undefined,
|
29189 | height: undefined,
|
29190 | textMargin: 0,
|
29191 | rx: 0,
|
29192 | ry: 0,
|
29193 | tspan: true,
|
29194 | valign: undefined
|
29195 | };
|
29196 | };
|
29197 | var getNoteRect = function getNoteRect() {
|
29198 | return {
|
29199 | x: 0,
|
29200 | y: 0,
|
29201 | fill: '#EDF2AE',
|
29202 | stroke: '#666',
|
29203 | width: 100,
|
29204 | anchor: 'start',
|
29205 | height: 100,
|
29206 | rx: 0,
|
29207 | ry: 0
|
29208 | };
|
29209 | };
|
29210 |
|
29211 | var _drawTextCandidateFunc = function () {
|
29212 | /**
|
29213 | * @param {any} content
|
29214 | * @param {any} g
|
29215 | * @param {any} x
|
29216 | * @param {any} y
|
29217 | * @param {any} width
|
29218 | * @param {any} height
|
29219 | * @param {any} textAttrs
|
29220 | */
|
29221 | function byText(content, g, x, y, width, height, textAttrs) {
|
29222 | var text = g.append('text').attr('x', x + width / 2).attr('y', y + height / 2 + 5).style('text-anchor', 'middle').text(content);
|
29223 |
|
29224 | _setTextAttrs(text, textAttrs);
|
29225 | }
|
29226 | /**
|
29227 | * @param {any} content
|
29228 | * @param {any} g
|
29229 | * @param {any} x
|
29230 | * @param {any} y
|
29231 | * @param {any} width
|
29232 | * @param {any} height
|
29233 | * @param {any} textAttrs
|
29234 | * @param {any} conf
|
29235 | */
|
29236 |
|
29237 |
|
29238 | function byTspan(content, g, x, y, width, height, textAttrs, conf) {
|
29239 | var actorFontSize = conf.actorFontSize,
|
29240 | actorFontFamily = conf.actorFontFamily,
|
29241 | actorFontWeight = conf.actorFontWeight;
|
29242 |
|
29243 | var _actorFontSize = actorFontSize && actorFontSize.replace ? actorFontSize.replace('px', '') : actorFontSize;
|
29244 |
|
29245 | var lines = content.split(_common_common__WEBPACK_IMPORTED_MODULE_2__["default"].lineBreakRegex);
|
29246 |
|
29247 | for (var i = 0; i < lines.length; i++) {
|
29248 | var dy = i * _actorFontSize - _actorFontSize * (lines.length - 1) / 2;
|
29249 | var text = g.append('text').attr('x', x + width / 2).attr('y', y).style('text-anchor', 'middle').style('font-size', actorFontSize).style('font-weight', actorFontWeight).style('font-family', actorFontFamily);
|
29250 | text.append('tspan').attr('x', x + width / 2).attr('dy', dy).text(lines[i]);
|
29251 | text.attr('y', y + height / 2.0).attr('dominant-baseline', 'central').attr('alignment-baseline', 'central');
|
29252 |
|
29253 | _setTextAttrs(text, textAttrs);
|
29254 | }
|
29255 | }
|
29256 | /**
|
29257 | * @param {any} content
|
29258 | * @param {any} g
|
29259 | * @param {any} x
|
29260 | * @param {any} y
|
29261 | * @param {any} width
|
29262 | * @param {any} height
|
29263 | * @param {any} textAttrs
|
29264 | * @param {any} conf
|
29265 | */
|
29266 |
|
29267 |
|
29268 | function byFo(content, g, x, y, width, height, textAttrs, conf) {
|
29269 | var s = g.append('switch');
|
29270 | var f = s.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height);
|
29271 | var text = f.append('xhtml:div').style('display', 'table').style('height', '100%').style('width', '100%');
|
29272 | text.append('div').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle').text(content);
|
29273 | byTspan(content, s, x, y, width, height, textAttrs, conf);
|
29274 |
|
29275 | _setTextAttrs(text, textAttrs);
|
29276 | }
|
29277 | /**
|
29278 | * @param {any} toText
|
29279 | * @param {any} fromTextAttrsDict
|
29280 | */
|
29281 |
|
29282 |
|
29283 | function _setTextAttrs(toText, fromTextAttrsDict) {
|
29284 | for (var key in fromTextAttrsDict) {
|
29285 | if (fromTextAttrsDict.hasOwnProperty(key)) {
|
29286 | // eslint-disable-line
|
29287 | toText.attr(key, fromTextAttrsDict[key]);
|
29288 | }
|
29289 | }
|
29290 | }
|
29291 |
|
29292 | return function (conf) {
|
29293 | return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
|
29294 | };
|
29295 | }();
|
29296 |
|
29297 | var _drawMenuItemTextCandidateFunc = function () {
|
29298 | /**
|
29299 | * @param {any} content
|
29300 | * @param {any} g
|
29301 | * @param {any} x
|
29302 | * @param {any} y
|
29303 | * @param {any} width
|
29304 | * @param {any} height
|
29305 | * @param {any} textAttrs
|
29306 | */
|
29307 | function byText(content, g, x, y, width, height, textAttrs) {
|
29308 | var text = g.append('text').attr('x', x).attr('y', y).style('text-anchor', 'start').text(content);
|
29309 |
|
29310 | _setTextAttrs(text, textAttrs);
|
29311 | }
|
29312 | /**
|
29313 | * @param {any} content
|
29314 | * @param {any} g
|
29315 | * @param {any} x
|
29316 | * @param {any} y
|
29317 | * @param {any} width
|
29318 | * @param {any} height
|
29319 | * @param {any} textAttrs
|
29320 | * @param {any} conf
|
29321 | */
|
29322 |
|
29323 |
|
29324 | function byTspan(content, g, x, y, width, height, textAttrs, conf) {
|
29325 | var actorFontSize = conf.actorFontSize,
|
29326 | actorFontFamily = conf.actorFontFamily,
|
29327 | actorFontWeight = conf.actorFontWeight;
|
29328 | var lines = content.split(_common_common__WEBPACK_IMPORTED_MODULE_2__["default"].lineBreakRegex);
|
29329 |
|
29330 | for (var i = 0; i < lines.length; i++) {
|
29331 | var dy = i * actorFontSize - actorFontSize * (lines.length - 1) / 2;
|
29332 | var text = g.append('text').attr('x', x).attr('y', y).style('text-anchor', 'start').style('font-size', actorFontSize).style('font-weight', actorFontWeight).style('font-family', actorFontFamily);
|
29333 | text.append('tspan').attr('x', x).attr('dy', dy).text(lines[i]);
|
29334 | text.attr('y', y + height / 2.0).attr('dominant-baseline', 'central').attr('alignment-baseline', 'central');
|
29335 |
|
29336 | _setTextAttrs(text, textAttrs);
|
29337 | }
|
29338 | }
|
29339 | /**
|
29340 | * @param {any} content
|
29341 | * @param {any} g
|
29342 | * @param {any} x
|
29343 | * @param {any} y
|
29344 | * @param {any} width
|
29345 | * @param {any} height
|
29346 | * @param {any} textAttrs
|
29347 | * @param {any} conf
|
29348 | */
|
29349 |
|
29350 |
|
29351 | function byFo(content, g, x, y, width, height, textAttrs, conf) {
|
29352 | var s = g.append('switch');
|
29353 | var f = s.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height);
|
29354 | var text = f.append('xhtml:div').style('display', 'table').style('height', '100%').style('width', '100%');
|
29355 | text.append('div').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle').text(content);
|
29356 | byTspan(content, s, x, y, width, height, textAttrs, conf);
|
29357 |
|
29358 | _setTextAttrs(text, textAttrs);
|
29359 | }
|
29360 | /**
|
29361 | * @param {any} toText
|
29362 | * @param {any} fromTextAttrsDict
|
29363 | */
|
29364 |
|
29365 |
|
29366 | function _setTextAttrs(toText, fromTextAttrsDict) {
|
29367 | for (var key in fromTextAttrsDict) {
|
29368 | if (fromTextAttrsDict.hasOwnProperty(key)) {
|
29369 | // eslint-disable-line
|
29370 | toText.attr(key, fromTextAttrsDict[key]);
|
29371 | }
|
29372 | }
|
29373 | }
|
29374 |
|
29375 | return function (conf) {
|
29376 | return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
|
29377 | };
|
29378 | }();
|
29379 |
|
29380 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
29381 | drawRect: drawRect,
|
29382 | drawText: drawText,
|
29383 | drawLabel: drawLabel,
|
29384 | drawActor: drawActor,
|
29385 | drawPopup: drawPopup,
|
29386 | drawImage: drawImage,
|
29387 | drawEmbeddedImage: drawEmbeddedImage,
|
29388 | anchorElement: anchorElement,
|
29389 | drawActivation: drawActivation,
|
29390 | drawLoop: drawLoop,
|
29391 | drawBackgroundRect: drawBackgroundRect,
|
29392 | insertArrowHead: insertArrowHead,
|
29393 | insertArrowFilledHead: insertArrowFilledHead,
|
29394 | insertSequenceNumber: insertSequenceNumber,
|
29395 | insertArrowCrossHead: insertArrowCrossHead,
|
29396 | insertDatabaseIcon: insertDatabaseIcon,
|
29397 | insertComputerIcon: insertComputerIcon,
|
29398 | insertClockIcon: insertClockIcon,
|
29399 | getTextObj: getTextObj,
|
29400 | getNoteRect: getNoteRect,
|
29401 | popupMenu: popupMenu,
|
29402 | popdownMenu: popdownMenu,
|
29403 | fixLifeLineHeights: fixLifeLineHeights,
|
29404 | sanitizeUrl: _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__.sanitizeUrl
|
29405 | });
|
29406 |
|
29407 | /***/ }),
|
29408 |
|
29409 | /***/ "./src/diagrams/state/id-cache.js":
|
29410 | /*!****************************************!*\
|
29411 | !*** ./src/diagrams/state/id-cache.js ***!
|
29412 | \****************************************/
|
29413 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
29414 |
|
29415 | "use strict";
|
29416 | __webpack_require__.r(__webpack_exports__);
|
29417 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
29418 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
29419 | /* harmony export */ "get": () => (/* binding */ get),
|
29420 | /* harmony export */ "keys": () => (/* binding */ keys),
|
29421 | /* harmony export */ "set": () => (/* binding */ set),
|
29422 | /* harmony export */ "size": () => (/* binding */ size)
|
29423 | /* harmony export */ });
|
29424 | var idCache = {};
|
29425 | var set = function set(key, val) {
|
29426 | idCache[key] = val;
|
29427 | };
|
29428 | var get = function get(k) {
|
29429 | return idCache[k];
|
29430 | };
|
29431 | var keys = function keys() {
|
29432 | return Object.keys(idCache);
|
29433 | };
|
29434 | var size = function size() {
|
29435 | return keys().length;
|
29436 | };
|
29437 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
29438 | get: get,
|
29439 | set: set,
|
29440 | keys: keys,
|
29441 | size: size
|
29442 | });
|
29443 |
|
29444 | /***/ }),
|
29445 |
|
29446 | /***/ "./src/diagrams/state/shapes.js":
|
29447 | /*!**************************************!*\
|
29448 | !*** ./src/diagrams/state/shapes.js ***!
|
29449 | \**************************************/
|
29450 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
29451 |
|
29452 | "use strict";
|
29453 | __webpack_require__.r(__webpack_exports__);
|
29454 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
29455 | /* harmony export */ "addTitleAndBox": () => (/* binding */ addTitleAndBox),
|
29456 | /* harmony export */ "drawDescrState": () => (/* binding */ drawDescrState),
|
29457 | /* harmony export */ "drawDivider": () => (/* binding */ drawDivider),
|
29458 | /* harmony export */ "drawEdge": () => (/* binding */ drawEdge),
|
29459 | /* harmony export */ "drawNote": () => (/* binding */ drawNote),
|
29460 | /* harmony export */ "drawSimpleState": () => (/* binding */ drawSimpleState),
|
29461 | /* harmony export */ "drawStartState": () => (/* binding */ drawStartState),
|
29462 | /* harmony export */ "drawState": () => (/* binding */ drawState),
|
29463 | /* harmony export */ "drawText": () => (/* binding */ drawText)
|
29464 | /* harmony export */ });
|
29465 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
29466 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
29467 | /* harmony import */ var _id_cache_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./id-cache.js */ "./src/diagrams/state/id-cache.js");
|
29468 | /* harmony import */ var _stateDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateDb */ "./src/diagrams/state/stateDb.js");
|
29469 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
29470 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
29471 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
29472 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
29473 | function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
29474 |
|
29475 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
29476 |
|
29477 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
29478 |
|
29479 |
|
29480 |
|
29481 |
|
29482 |
|
29483 |
|
29484 |
|
29485 |
|
29486 | /**
|
29487 | * Draws a start state as a black circle
|
29488 | *
|
29489 | * @param {any} g
|
29490 | */
|
29491 |
|
29492 | var drawStartState = function drawStartState(g) {
|
29493 | return g.append('circle') // .style('stroke', 'black')
|
29494 | // .style('fill', 'black')
|
29495 | .attr('class', 'start-state').attr('r', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit).attr('cx', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit).attr('cy', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit);
|
29496 | };
|
29497 | /**
|
29498 | * Draws a start state as a black circle
|
29499 | *
|
29500 | * @param {any} g
|
29501 | */
|
29502 |
|
29503 | var drawDivider = function drawDivider(g) {
|
29504 | return g.append('line').style('stroke', 'grey').style('stroke-dasharray', '3').attr('x1', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight).attr('class', 'divider').attr('x2', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight * 2).attr('y1', 0).attr('y2', 0);
|
29505 | };
|
29506 | /**
|
29507 | * Draws a an end state as a black circle
|
29508 | *
|
29509 | * @param {any} g
|
29510 | * @param {any} stateDef
|
29511 | */
|
29512 |
|
29513 | var drawSimpleState = function drawSimpleState(g, stateDef) {
|
29514 | var state = g.append('text').attr('x', 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('font-size', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.fontSize).attr('class', 'state-title').text(stateDef.id);
|
29515 | var classBox = state.node().getBBox();
|
29516 | g.insert('rect', ':first-child').attr('x', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('width', classBox.width + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('height', classBox.height + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('rx', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.radius);
|
29517 | return state;
|
29518 | };
|
29519 | /**
|
29520 | * Draws a state with descriptions
|
29521 | *
|
29522 | * @param {any} g
|
29523 | * @param {any} stateDef
|
29524 | * @returns
|
29525 | */
|
29526 |
|
29527 | var drawDescrState = function drawDescrState(g, stateDef) {
|
29528 | var addTspan = function addTspan(textEl, txt, isFirst) {
|
29529 | var tSpan = textEl.append('tspan').attr('x', 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).text(txt);
|
29530 |
|
29531 | if (!isFirst) {
|
29532 | tSpan.attr('dy', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight);
|
29533 | }
|
29534 | };
|
29535 |
|
29536 | var title = g.append('text').attr('x', 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight + 1.3 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('font-size', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.fontSize).attr('class', 'state-title').text(stateDef.descriptions[0]);
|
29537 | var titleBox = title.node().getBBox();
|
29538 | var titleHeight = titleBox.height;
|
29539 | var description = g.append('text') // text label for the x axis
|
29540 | .attr('x', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('y', titleHeight + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding * 0.4 + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.dividerMargin + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight).attr('class', 'state-description');
|
29541 | var isFirst = true;
|
29542 | var isSecond = true;
|
29543 | stateDef.descriptions.forEach(function (descr) {
|
29544 | if (!isFirst) {
|
29545 | addTspan(description, descr, isSecond);
|
29546 | isSecond = false;
|
29547 | }
|
29548 |
|
29549 | isFirst = false;
|
29550 | });
|
29551 | var descrLine = g.append('line') // text label for the x axis
|
29552 | .attr('x1', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('y1', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + titleHeight + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.dividerMargin / 2).attr('y2', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + titleHeight + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.dividerMargin / 2).attr('class', 'descr-divider');
|
29553 | var descrBox = description.node().getBBox();
|
29554 | var width = Math.max(descrBox.width, titleBox.width);
|
29555 | descrLine.attr('x2', width + 3 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding); // const classBox = title.node().getBBox();
|
29556 |
|
29557 | g.insert('rect', ':first-child').attr('x', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('width', width + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('height', descrBox.height + titleHeight + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('rx', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.radius);
|
29558 | return g;
|
29559 | };
|
29560 | /** Adds the creates a box around the existing content and adds a panel for the id on top of the content. */
|
29561 |
|
29562 | /**
|
29563 | * Function that creates an title row and a frame around a substate for a composit state diagram.
|
29564 | * The function returns a new d3 svg object with updated width and height properties;
|
29565 | *
|
29566 | * @param {any} g The d3 svg object for the substate to framed
|
29567 | * @param {any} stateDef The info about the
|
29568 | * @param {any} altBkg
|
29569 | */
|
29570 |
|
29571 | var addTitleAndBox = function addTitleAndBox(g, stateDef, altBkg) {
|
29572 | var pad = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding;
|
29573 | var dblPad = 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding;
|
29574 | var orgBox = g.node().getBBox();
|
29575 | var orgWidth = orgBox.width;
|
29576 | var orgX = orgBox.x;
|
29577 | var title = g.append('text').attr('x', 0).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.titleShift).attr('font-size', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.fontSize).attr('class', 'state-title').text(stateDef.id);
|
29578 | var titleBox = title.node().getBBox();
|
29579 | var titleWidth = titleBox.width + dblPad;
|
29580 | var width = Math.max(titleWidth, orgWidth); // + dblPad;
|
29581 |
|
29582 | if (width === orgWidth) {
|
29583 | width = width + dblPad;
|
29584 | }
|
29585 |
|
29586 | var startX; // const lineY = 1 - getConfig().state.textHeight;
|
29587 | // const descrLine = g
|
29588 | // .append('line') // text label for the x axis
|
29589 | // .attr('x1', 0)
|
29590 | // .attr('y1', lineY)
|
29591 | // .attr('y2', lineY)
|
29592 | // .attr('class', 'descr-divider');
|
29593 |
|
29594 | var graphBox = g.node().getBBox(); // descrLine.attr('x2', graphBox.width + getConfig().state.padding);
|
29595 |
|
29596 | if (stateDef.doc) {// cnsole.warn(
|
29597 | // stateDef.id,
|
29598 | // 'orgX: ',
|
29599 | // orgX,
|
29600 | // 'width: ',
|
29601 | // width,
|
29602 | // 'titleWidth: ',
|
29603 | // titleWidth,
|
29604 | // 'orgWidth: ',
|
29605 | // orgWidth,
|
29606 | // 'width',
|
29607 | // width
|
29608 | // );
|
29609 | }
|
29610 |
|
29611 | startX = orgX - pad;
|
29612 |
|
29613 | if (titleWidth > orgWidth) {
|
29614 | startX = (orgWidth - width) / 2 + pad;
|
29615 | }
|
29616 |
|
29617 | if (Math.abs(orgX - graphBox.x) < pad) {
|
29618 | if (titleWidth > orgWidth) {
|
29619 | startX = orgX - (titleWidth - orgWidth) / 2;
|
29620 | }
|
29621 | }
|
29622 |
|
29623 | var lineY = 1 - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight; // White color
|
29624 |
|
29625 | g.insert('rect', ':first-child').attr('x', startX).attr('y', lineY).attr('class', altBkg ? 'alt-composit' : 'composit').attr('width', width).attr('height', graphBox.height + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.titleShift + 1).attr('rx', '0');
|
29626 | title.attr('x', startX + pad);
|
29627 | if (titleWidth <= orgWidth) title.attr('x', orgX + (width - dblPad) / 2 - titleWidth / 2 + pad); // Title background
|
29628 |
|
29629 | g.insert('rect', ':first-child').attr('x', startX).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.titleShift - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('width', width) // Just needs to be higher then the descr line, will be clipped by the white color box
|
29630 | .attr('height', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight * 3).attr('rx', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.radius); // Full background
|
29631 |
|
29632 | g.insert('rect', ':first-child').attr('x', startX).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.titleShift - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('width', width).attr('height', graphBox.height + 3 + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight).attr('rx', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.radius);
|
29633 | return g;
|
29634 | };
|
29635 |
|
29636 | var drawEndState = function drawEndState(g) {
|
29637 | g.append('circle') // .style('stroke', 'black')
|
29638 | // .style('fill', 'white')
|
29639 | .attr('class', 'end-state-outer').attr('r', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.miniPadding).attr('cx', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.miniPadding).attr('cy', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.miniPadding);
|
29640 | return g.append('circle') // .style('stroke', 'black')
|
29641 | // .style('fill', 'black')
|
29642 | .attr('class', 'end-state-inner').attr('r', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit).attr('cx', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit + 2).attr('cy', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit + 2);
|
29643 | };
|
29644 |
|
29645 | var drawForkJoinState = function drawForkJoinState(g, stateDef) {
|
29646 | var width = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.forkWidth;
|
29647 | var height = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.forkHeight;
|
29648 |
|
29649 | if (stateDef.parentId) {
|
29650 | var tmp = width;
|
29651 | width = height;
|
29652 | height = tmp;
|
29653 | }
|
29654 |
|
29655 | return g.append('rect').style('stroke', 'black').style('fill', 'black').attr('width', width).attr('height', height).attr('x', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding);
|
29656 | };
|
29657 |
|
29658 | var drawText = function drawText(elem, textData) {
|
29659 | // Remove and ignore br:s
|
29660 | var nText = textData.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_2__["default"].lineBreakRegex, ' ');
|
29661 | var textElem = elem.append('text');
|
29662 | textElem.attr('x', textData.x);
|
29663 | textElem.attr('y', textData.y);
|
29664 | textElem.style('text-anchor', textData.anchor);
|
29665 | textElem.attr('fill', textData.fill);
|
29666 |
|
29667 | if (typeof textData.class !== 'undefined') {
|
29668 | textElem.attr('class', textData.class);
|
29669 | }
|
29670 |
|
29671 | var span = textElem.append('tspan');
|
29672 | span.attr('x', textData.x + textData.textMargin * 2);
|
29673 | span.attr('fill', textData.fill);
|
29674 | span.text(nText);
|
29675 | return textElem;
|
29676 | };
|
29677 |
|
29678 | var _drawLongText = function _drawLongText(_text, x, y, g) {
|
29679 | var textHeight = 0;
|
29680 | var textElem = g.append('text');
|
29681 | textElem.style('text-anchor', 'start');
|
29682 | textElem.attr('class', 'noteText');
|
29683 |
|
29684 | var text = _text.replace(/\r\n/g, '<br/>');
|
29685 |
|
29686 | text = text.replace(/\n/g, '<br/>');
|
29687 | var lines = text.split(_common_common__WEBPACK_IMPORTED_MODULE_2__["default"].lineBreakRegex);
|
29688 | var tHeight = 1.25 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin;
|
29689 |
|
29690 | var _iterator = _createForOfIteratorHelper(lines),
|
29691 | _step;
|
29692 |
|
29693 | try {
|
29694 | for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
29695 | var _line = _step.value;
|
29696 |
|
29697 | var txt = _line.trim();
|
29698 |
|
29699 | if (txt.length > 0) {
|
29700 | var span = textElem.append('tspan');
|
29701 | span.text(txt);
|
29702 |
|
29703 | if (tHeight === 0) {
|
29704 | var textBounds = span.node().getBBox();
|
29705 | tHeight += textBounds.height;
|
29706 | }
|
29707 |
|
29708 | textHeight += tHeight;
|
29709 | span.attr('x', x + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin);
|
29710 | span.attr('y', y + textHeight + 1.25 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin);
|
29711 | }
|
29712 | }
|
29713 | } catch (err) {
|
29714 | _iterator.e(err);
|
29715 | } finally {
|
29716 | _iterator.f();
|
29717 | }
|
29718 |
|
29719 | return {
|
29720 | textWidth: textElem.node().getBBox().width,
|
29721 | textHeight: textHeight
|
29722 | };
|
29723 | };
|
29724 | /**
|
29725 | * Draws a note to the diagram
|
29726 | *
|
29727 | * @param text - The text of the given note.
|
29728 | * @param g - The element the note is attached to.
|
29729 | */
|
29730 |
|
29731 |
|
29732 | var drawNote = function drawNote(text, g) {
|
29733 | g.attr('class', 'state-note');
|
29734 | var note = g.append('rect').attr('x', 0).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding);
|
29735 | var rectElem = g.append('g');
|
29736 |
|
29737 | var _drawLongText2 = _drawLongText(text, 0, 0, rectElem),
|
29738 | textWidth = _drawLongText2.textWidth,
|
29739 | textHeight = _drawLongText2.textHeight;
|
29740 |
|
29741 | note.attr('height', textHeight + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin);
|
29742 | note.attr('width', textWidth + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin * 2);
|
29743 | return note;
|
29744 | };
|
29745 | /**
|
29746 | * Starting point for drawing a state. The function finds out the specifics about the state and
|
29747 | * renders with appropriate function.
|
29748 | *
|
29749 | * @param {any} elem
|
29750 | * @param {any} stateDef
|
29751 | */
|
29752 |
|
29753 | var drawState = function drawState(elem, stateDef) {
|
29754 | var id = stateDef.id;
|
29755 | var stateInfo = {
|
29756 | id: id,
|
29757 | label: stateDef.id,
|
29758 | width: 0,
|
29759 | height: 0
|
29760 | };
|
29761 | var g = elem.append('g').attr('id', id).attr('class', 'stateGroup');
|
29762 | if (stateDef.type === 'start') drawStartState(g);
|
29763 | if (stateDef.type === 'end') drawEndState(g);
|
29764 | if (stateDef.type === 'fork' || stateDef.type === 'join') drawForkJoinState(g, stateDef);
|
29765 | if (stateDef.type === 'note') drawNote(stateDef.note.text, g);
|
29766 | if (stateDef.type === 'divider') drawDivider(g);
|
29767 | if (stateDef.type === 'default' && stateDef.descriptions.length === 0) drawSimpleState(g, stateDef);
|
29768 | if (stateDef.type === 'default' && stateDef.descriptions.length > 0) drawDescrState(g, stateDef);
|
29769 | var stateBox = g.node().getBBox();
|
29770 | stateInfo.width = stateBox.width + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding;
|
29771 | stateInfo.height = stateBox.height + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding;
|
29772 | _id_cache_js__WEBPACK_IMPORTED_MODULE_3__["default"].set(id, stateInfo); // stateCnt++;
|
29773 |
|
29774 | return stateInfo;
|
29775 | };
|
29776 | var edgeCount = 0;
|
29777 | var drawEdge = function drawEdge(elem, path, relation) {
|
29778 | var getRelationType = function getRelationType(type) {
|
29779 | switch (type) {
|
29780 | case _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.AGGREGATION:
|
29781 | return 'aggregation';
|
29782 |
|
29783 | case _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.EXTENSION:
|
29784 | return 'extension';
|
29785 |
|
29786 | case _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.COMPOSITION:
|
29787 | return 'composition';
|
29788 |
|
29789 | case _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.DEPENDENCY:
|
29790 | return 'dependency';
|
29791 | }
|
29792 | };
|
29793 |
|
29794 | path.points = path.points.filter(function (p) {
|
29795 | return !Number.isNaN(p.y);
|
29796 | }); // The data for our line
|
29797 |
|
29798 | var lineData = path.points; // This is the accessor function we talked about above
|
29799 |
|
29800 | var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) {
|
29801 | return d.x;
|
29802 | }).y(function (d) {
|
29803 | return d.y;
|
29804 | }).curve(d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis);
|
29805 | var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', 'edge' + edgeCount).attr('class', 'transition');
|
29806 | var url = '';
|
29807 |
|
29808 | if ((0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.arrowMarkerAbsolute) {
|
29809 | url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
|
29810 | url = url.replace(/\(/g, '\\(');
|
29811 | url = url.replace(/\)/g, '\\)');
|
29812 | }
|
29813 |
|
29814 | svgPath.attr('marker-end', 'url(' + url + '#' + getRelationType(_stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.DEPENDENCY) + 'End' + ')');
|
29815 |
|
29816 | if (typeof relation.title !== 'undefined') {
|
29817 | var label = elem.append('g').attr('class', 'stateLabel');
|
29818 |
|
29819 | var _utils$calcLabelPosit = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcLabelPosition(path.points),
|
29820 | x = _utils$calcLabelPosit.x,
|
29821 | y = _utils$calcLabelPosit.y;
|
29822 |
|
29823 | var rows = _common_common__WEBPACK_IMPORTED_MODULE_2__["default"].getRows(relation.title);
|
29824 | var titleHeight = 0;
|
29825 | var titleRows = [];
|
29826 | var maxWidth = 0;
|
29827 | var minX = 0;
|
29828 |
|
29829 | for (var i = 0; i <= rows.length; i++) {
|
29830 | var title = label.append('text').attr('text-anchor', 'middle').text(rows[i]).attr('x', x).attr('y', y + titleHeight);
|
29831 | var boundstmp = title.node().getBBox();
|
29832 | maxWidth = Math.max(maxWidth, boundstmp.width);
|
29833 | minX = Math.min(minX, boundstmp.x);
|
29834 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info(boundstmp.x, x, y + titleHeight);
|
29835 |
|
29836 | if (titleHeight === 0) {
|
29837 | var titleBox = title.node().getBBox();
|
29838 | titleHeight = titleBox.height;
|
29839 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('Title height', titleHeight, y);
|
29840 | }
|
29841 |
|
29842 | titleRows.push(title);
|
29843 | }
|
29844 |
|
29845 | var boxHeight = titleHeight * rows.length;
|
29846 |
|
29847 | if (rows.length > 1) {
|
29848 | var heightAdj = (rows.length - 1) * titleHeight * 0.5;
|
29849 | titleRows.forEach(function (title, i) {
|
29850 | return title.attr('y', y + i * titleHeight - heightAdj);
|
29851 | });
|
29852 | boxHeight = titleHeight * rows.length;
|
29853 | }
|
29854 |
|
29855 | var bounds = label.node().getBBox();
|
29856 | label.insert('rect', ':first-child').attr('class', 'box').attr('x', x - maxWidth / 2 - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding / 2).attr('y', y - boxHeight / 2 - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding / 2 - 3.5).attr('width', maxWidth + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('height', boxHeight + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding);
|
29857 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info(bounds); //label.attr('transform', '0 -' + (bounds.y / 2));
|
29858 | // Debug points
|
29859 | // path.points.forEach(point => {
|
29860 | // g.append('circle')
|
29861 | // .style('stroke', 'red')
|
29862 | // .style('fill', 'red')
|
29863 | // .attr('r', 1)
|
29864 | // .attr('cx', point.x)
|
29865 | // .attr('cy', point.y);
|
29866 | // });
|
29867 | // g.append('circle')
|
29868 | // .style('stroke', 'blue')
|
29869 | // .style('fill', 'blue')
|
29870 | // .attr('r', 1)
|
29871 | // .attr('cx', x)
|
29872 | // .attr('cy', y);
|
29873 | }
|
29874 |
|
29875 | edgeCount++;
|
29876 | };
|
29877 |
|
29878 | /***/ }),
|
29879 |
|
29880 | /***/ "./src/diagrams/state/stateDb.js":
|
29881 | /*!***************************************!*\
|
29882 | !*** ./src/diagrams/state/stateDb.js ***!
|
29883 | \***************************************/
|
29884 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
29885 |
|
29886 | "use strict";
|
29887 | __webpack_require__.r(__webpack_exports__);
|
29888 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
29889 | /* harmony export */ "addRelation": () => (/* binding */ addRelation),
|
29890 | /* harmony export */ "addState": () => (/* binding */ addState),
|
29891 | /* harmony export */ "cleanupLabel": () => (/* binding */ cleanupLabel),
|
29892 | /* harmony export */ "clear": () => (/* binding */ clear),
|
29893 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
29894 | /* harmony export */ "getRelations": () => (/* binding */ getRelations),
|
29895 | /* harmony export */ "getState": () => (/* binding */ getState),
|
29896 | /* harmony export */ "getStates": () => (/* binding */ getStates),
|
29897 | /* harmony export */ "lineType": () => (/* binding */ lineType),
|
29898 | /* harmony export */ "logDocuments": () => (/* binding */ logDocuments),
|
29899 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
29900 | /* harmony export */ "relationType": () => (/* binding */ relationType)
|
29901 | /* harmony export */ });
|
29902 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
29903 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
29904 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
29905 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
29906 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
29907 | /* harmony import */ var _commonDb__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../commonDb */ "./src/commonDb.js");
|
29908 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
29909 |
|
29910 |
|
29911 |
|
29912 |
|
29913 |
|
29914 |
|
29915 |
|
29916 |
|
29917 | var sanitizeText = function sanitizeText(txt) {
|
29918 | return _common_common__WEBPACK_IMPORTED_MODULE_0__["default"].sanitizeText(txt, _config__WEBPACK_IMPORTED_MODULE_1__.getConfig());
|
29919 | };
|
29920 |
|
29921 | var clone = function clone(o) {
|
29922 | return JSON.parse(JSON.stringify(o));
|
29923 | };
|
29924 |
|
29925 | var rootDoc = [];
|
29926 | var parseDirective = function parseDirective(statement, context, type) {
|
29927 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__["default"].parseDirective(this, statement, context, type);
|
29928 | };
|
29929 |
|
29930 | var setRootDoc = function setRootDoc(o) {
|
29931 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('Setting root doc', o); // rootDoc = { id: 'root', doc: o };
|
29932 |
|
29933 | rootDoc = o;
|
29934 | };
|
29935 |
|
29936 | var getRootDoc = function getRootDoc() {
|
29937 | return rootDoc;
|
29938 | };
|
29939 |
|
29940 | var docTranslator = function docTranslator(parent, node, first) {
|
29941 | if (node.stmt === 'relation') {
|
29942 | docTranslator(parent, node.state1, true);
|
29943 | docTranslator(parent, node.state2, false);
|
29944 | } else {
|
29945 | if (node.stmt === 'state') {
|
29946 | if (node.id === '[*]') {
|
29947 | node.id = first ? parent.id + '_start' : parent.id + '_end';
|
29948 | node.start = first;
|
29949 | }
|
29950 | }
|
29951 |
|
29952 | if (node.doc) {
|
29953 | var doc = []; // Check for concurrency
|
29954 |
|
29955 | var i = 0;
|
29956 | var currentDoc = [];
|
29957 |
|
29958 | for (i = 0; i < node.doc.length; i++) {
|
29959 | if (node.doc[i].type === 'divider') {
|
29960 | // debugger;
|
29961 | var newNode = clone(node.doc[i]);
|
29962 | newNode.doc = clone(currentDoc);
|
29963 | doc.push(newNode);
|
29964 | currentDoc = [];
|
29965 | } else {
|
29966 | currentDoc.push(node.doc[i]);
|
29967 | }
|
29968 | } // If any divider was encountered
|
29969 |
|
29970 |
|
29971 | if (doc.length > 0 && currentDoc.length > 0) {
|
29972 | var _newNode = {
|
29973 | stmt: 'state',
|
29974 | id: (0,_utils__WEBPACK_IMPORTED_MODULE_4__.generateId)(),
|
29975 | type: 'divider',
|
29976 | doc: clone(currentDoc)
|
29977 | };
|
29978 | doc.push(clone(_newNode));
|
29979 | node.doc = doc;
|
29980 | }
|
29981 |
|
29982 | node.doc.forEach(function (docNode) {
|
29983 | return docTranslator(node, docNode, true);
|
29984 | });
|
29985 | }
|
29986 | }
|
29987 | };
|
29988 |
|
29989 | var getRootDocV2 = function getRootDocV2() {
|
29990 | docTranslator({
|
29991 | id: 'root'
|
29992 | }, {
|
29993 | id: 'root',
|
29994 | doc: rootDoc
|
29995 | }, true);
|
29996 | return {
|
29997 | id: 'root',
|
29998 | doc: rootDoc
|
29999 | }; // Here
|
30000 | };
|
30001 |
|
30002 | var extract = function extract(_doc) {
|
30003 | // const res = { states: [], relations: [] };
|
30004 | var doc;
|
30005 |
|
30006 | if (_doc.doc) {
|
30007 | doc = _doc.doc;
|
30008 | } else {
|
30009 | doc = _doc;
|
30010 | } // let doc = root.doc;
|
30011 | // if (!doc) {
|
30012 | // doc = root;
|
30013 | // }
|
30014 |
|
30015 |
|
30016 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.info(doc);
|
30017 | clear(true);
|
30018 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('Extract', doc);
|
30019 | doc.forEach(function (item) {
|
30020 | if (item.stmt === 'state') {
|
30021 | addState(item.id, item.type, item.doc, item.description, item.note);
|
30022 | }
|
30023 |
|
30024 | if (item.stmt === 'relation') {
|
30025 | addRelation(item.state1.id, item.state2.id, item.description);
|
30026 | }
|
30027 | });
|
30028 | };
|
30029 |
|
30030 | var newDoc = function newDoc() {
|
30031 | return {
|
30032 | relations: [],
|
30033 | states: {},
|
30034 | documents: {}
|
30035 | };
|
30036 | };
|
30037 |
|
30038 | var documents = {
|
30039 | root: newDoc()
|
30040 | };
|
30041 | var currentDocument = documents.root;
|
30042 | var startCnt = 0;
|
30043 | var endCnt = 0; // eslint-disable-line
|
30044 | // let stateCnt = 0;
|
30045 |
|
30046 | var title = 'State diagram';
|
30047 | var description = '';
|
30048 | /**
|
30049 | * Function called by parser when a node definition has been found.
|
30050 | *
|
30051 | * @param {any} id
|
30052 | * @param {any} type
|
30053 | * @param {any} doc
|
30054 | * @param {any} descr
|
30055 | * @param {any} note
|
30056 | */
|
30057 |
|
30058 | var addState = function addState(id, type, doc, descr, note) {
|
30059 | if (typeof currentDocument.states[id] === 'undefined') {
|
30060 | currentDocument.states[id] = {
|
30061 | id: id,
|
30062 | descriptions: [],
|
30063 | type: type,
|
30064 | doc: doc,
|
30065 | note: note
|
30066 | };
|
30067 | } else {
|
30068 | if (!currentDocument.states[id].doc) {
|
30069 | currentDocument.states[id].doc = doc;
|
30070 | }
|
30071 |
|
30072 | if (!currentDocument.states[id].type) {
|
30073 | currentDocument.states[id].type = type;
|
30074 | }
|
30075 | }
|
30076 |
|
30077 | if (descr) {
|
30078 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('Adding state ', id, descr);
|
30079 | if (typeof descr === 'string') addDescription(id, descr.trim());
|
30080 |
|
30081 | if (_typeof(descr) === 'object') {
|
30082 | descr.forEach(function (des) {
|
30083 | return addDescription(id, des.trim());
|
30084 | });
|
30085 | }
|
30086 | }
|
30087 |
|
30088 | if (note) {
|
30089 | currentDocument.states[id].note = note;
|
30090 | currentDocument.states[id].note.text = _common_common__WEBPACK_IMPORTED_MODULE_0__["default"].sanitizeText(currentDocument.states[id].note.text, _config__WEBPACK_IMPORTED_MODULE_1__.getConfig());
|
30091 | }
|
30092 | };
|
30093 | var clear = function clear(saveCommon) {
|
30094 | documents = {
|
30095 | root: newDoc()
|
30096 | };
|
30097 | currentDocument = documents.root;
|
30098 | currentDocument = documents.root;
|
30099 | startCnt = 0;
|
30100 | endCnt = 0; // eslint-disable-line
|
30101 |
|
30102 | classes = [];
|
30103 |
|
30104 | if (!saveCommon) {
|
30105 | (0,_commonDb__WEBPACK_IMPORTED_MODULE_5__.clear)();
|
30106 | }
|
30107 | };
|
30108 | var getState = function getState(id) {
|
30109 | return currentDocument.states[id];
|
30110 | };
|
30111 | var getStates = function getStates() {
|
30112 | return currentDocument.states;
|
30113 | };
|
30114 | var logDocuments = function logDocuments() {
|
30115 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('Documents = ', documents);
|
30116 | };
|
30117 | var getRelations = function getRelations() {
|
30118 | return currentDocument.relations;
|
30119 | };
|
30120 | var addRelation = function addRelation(_id1, _id2, title) {
|
30121 | var id1 = _id1;
|
30122 | var id2 = _id2;
|
30123 | var type1 = 'default';
|
30124 | var type2 = 'default';
|
30125 |
|
30126 | if (_id1 === '[*]') {
|
30127 | startCnt++;
|
30128 | id1 = 'start' + startCnt;
|
30129 | type1 = 'start';
|
30130 | }
|
30131 |
|
30132 | if (_id2 === '[*]') {
|
30133 | endCnt++;
|
30134 | id2 = 'end' + startCnt;
|
30135 | type2 = 'end';
|
30136 | }
|
30137 |
|
30138 | addState(id1, type1);
|
30139 | addState(id2, type2);
|
30140 | currentDocument.relations.push({
|
30141 | id1: id1,
|
30142 | id2: id2,
|
30143 | title: _common_common__WEBPACK_IMPORTED_MODULE_0__["default"].sanitizeText(title, _config__WEBPACK_IMPORTED_MODULE_1__.getConfig())
|
30144 | });
|
30145 | };
|
30146 |
|
30147 | var addDescription = function addDescription(id, _descr) {
|
30148 | var theState = currentDocument.states[id];
|
30149 | var descr = _descr;
|
30150 |
|
30151 | if (descr[0] === ':') {
|
30152 | descr = descr.substr(1).trim();
|
30153 | }
|
30154 |
|
30155 | theState.descriptions.push(_common_common__WEBPACK_IMPORTED_MODULE_0__["default"].sanitizeText(descr, _config__WEBPACK_IMPORTED_MODULE_1__.getConfig()));
|
30156 | };
|
30157 |
|
30158 | var cleanupLabel = function cleanupLabel(label) {
|
30159 | if (label.substring(0, 1) === ':') {
|
30160 | return label.substr(2).trim();
|
30161 | } else {
|
30162 | return label.trim();
|
30163 | }
|
30164 | };
|
30165 | var lineType = {
|
30166 | LINE: 0,
|
30167 | DOTTED_LINE: 1
|
30168 | };
|
30169 | var dividerCnt = 0;
|
30170 |
|
30171 | var getDividerId = function getDividerId() {
|
30172 | dividerCnt++;
|
30173 | return 'divider-id-' + dividerCnt;
|
30174 | };
|
30175 |
|
30176 | var classes = [];
|
30177 |
|
30178 | var getClasses = function getClasses() {
|
30179 | return classes;
|
30180 | };
|
30181 |
|
30182 | var direction = 'TB';
|
30183 |
|
30184 | var getDirection = function getDirection() {
|
30185 | return direction;
|
30186 | };
|
30187 |
|
30188 | var setDirection = function setDirection(dir) {
|
30189 | direction = dir;
|
30190 | };
|
30191 |
|
30192 | var relationType = {
|
30193 | AGGREGATION: 0,
|
30194 | EXTENSION: 1,
|
30195 | COMPOSITION: 2,
|
30196 | DEPENDENCY: 3
|
30197 | };
|
30198 |
|
30199 | var trimColon = function trimColon(str) {
|
30200 | return str && str[0] === ':' ? str.substr(1).trim() : str.trim();
|
30201 | };
|
30202 |
|
30203 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
30204 | parseDirective: parseDirective,
|
30205 | getConfig: function getConfig() {
|
30206 | return _config__WEBPACK_IMPORTED_MODULE_1__.getConfig().state;
|
30207 | },
|
30208 | addState: addState,
|
30209 | clear: clear,
|
30210 | getState: getState,
|
30211 | getStates: getStates,
|
30212 | getRelations: getRelations,
|
30213 | getClasses: getClasses,
|
30214 | getDirection: getDirection,
|
30215 | addRelation: addRelation,
|
30216 | getDividerId: getDividerId,
|
30217 | setDirection: setDirection,
|
30218 | cleanupLabel: cleanupLabel,
|
30219 | lineType: lineType,
|
30220 | relationType: relationType,
|
30221 | logDocuments: logDocuments,
|
30222 | getRootDoc: getRootDoc,
|
30223 | setRootDoc: setRootDoc,
|
30224 | getRootDocV2: getRootDocV2,
|
30225 | extract: extract,
|
30226 | trimColon: trimColon,
|
30227 | getAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_5__.getAccTitle,
|
30228 | setAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_5__.setAccTitle,
|
30229 | getAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_5__.getAccDescription,
|
30230 | setAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_5__.setAccDescription
|
30231 | });
|
30232 |
|
30233 | /***/ }),
|
30234 |
|
30235 | /***/ "./src/diagrams/state/stateRenderer-v2.js":
|
30236 | /*!************************************************!*\
|
30237 | !*** ./src/diagrams/state/stateRenderer-v2.js ***!
|
30238 | \************************************************/
|
30239 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
30240 |
|
30241 | "use strict";
|
30242 | __webpack_require__.r(__webpack_exports__);
|
30243 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
30244 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
30245 | /* harmony export */ "draw": () => (/* binding */ draw),
|
30246 | /* harmony export */ "getClasses": () => (/* binding */ getClasses),
|
30247 | /* harmony export */ "setConf": () => (/* binding */ setConf)
|
30248 | /* harmony export */ });
|
30249 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
|
30250 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
|
30251 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
|
30252 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
|
30253 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
30254 | /* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
|
30255 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
30256 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
30257 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
30258 | /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js");
|
30259 |
|
30260 |
|
30261 |
|
30262 |
|
30263 |
|
30264 |
|
30265 |
|
30266 |
|
30267 | var conf = {};
|
30268 | var setConf = function setConf(cnf) {
|
30269 | var keys = Object.keys(cnf);
|
30270 |
|
30271 | for (var i = 0; i < keys.length; i++) {
|
30272 | conf[keys[i]] = cnf[keys[i]];
|
30273 | }
|
30274 | };
|
30275 | var nodeDb = {};
|
30276 | /**
|
30277 | * Returns the all the styles from classDef statements in the graph definition.
|
30278 | *
|
30279 | * @param {any} text
|
30280 | * @param diag
|
30281 | * @returns {object} ClassDef styles
|
30282 | */
|
30283 |
|
30284 | var getClasses = function getClasses(text, diag) {
|
30285 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Extracting classes');
|
30286 | diag.sb.clear(); // Parse the graph definition
|
30287 |
|
30288 | diag.parser.parse(text);
|
30289 | return diag.sb.getClasses();
|
30290 | };
|
30291 |
|
30292 | var setupNode = function setupNode(g, parent, node, altFlag) {
|
30293 | // Add the node
|
30294 | if (node.id !== 'root') {
|
30295 | var shape = 'rect';
|
30296 |
|
30297 | if (node.start === true) {
|
30298 | shape = 'start';
|
30299 | }
|
30300 |
|
30301 | if (node.start === false) {
|
30302 | shape = 'end';
|
30303 | }
|
30304 |
|
30305 | if (node.type !== 'default') {
|
30306 | shape = node.type;
|
30307 | }
|
30308 |
|
30309 | if (!nodeDb[node.id]) {
|
30310 | nodeDb[node.id] = {
|
30311 | id: node.id,
|
30312 | shape: shape,
|
30313 | description: _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(node.id, (0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)()),
|
30314 | classes: 'statediagram-state'
|
30315 | };
|
30316 | } // Build of the array of description strings accordinging
|
30317 |
|
30318 |
|
30319 | if (node.description) {
|
30320 | if (Array.isArray(nodeDb[node.id].description)) {
|
30321 | // There already is an array of strings,add to it
|
30322 | nodeDb[node.id].shape = 'rectWithTitle';
|
30323 | nodeDb[node.id].description.push(node.description);
|
30324 | } else {
|
30325 | if (nodeDb[node.id].description.length > 0) {
|
30326 | // if there is a description already transformit to an array
|
30327 | nodeDb[node.id].shape = 'rectWithTitle';
|
30328 |
|
30329 | if (nodeDb[node.id].description === node.id) {
|
30330 | // If the previous description was the is, remove it
|
30331 | nodeDb[node.id].description = [node.description];
|
30332 | } else {
|
30333 | nodeDb[node.id].description = [nodeDb[node.id].description, node.description];
|
30334 | }
|
30335 | } else {
|
30336 | nodeDb[node.id].shape = 'rect';
|
30337 | nodeDb[node.id].description = node.description;
|
30338 | }
|
30339 | }
|
30340 |
|
30341 | nodeDb[node.id].description = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeTextOrArray(nodeDb[node.id].description, (0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)());
|
30342 | } //
|
30343 |
|
30344 |
|
30345 | if (nodeDb[node.id].description.length === 1 && nodeDb[node.id].shape === 'rectWithTitle') {
|
30346 | nodeDb[node.id].shape = 'rect';
|
30347 | } // Save data for description and group so that for instance a statement without description overwrites
|
30348 | // one with description
|
30349 | // group
|
30350 |
|
30351 |
|
30352 | if (!nodeDb[node.id].type && node.doc) {
|
30353 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Setting cluster for ', node.id, getDir(node));
|
30354 | nodeDb[node.id].type = 'group';
|
30355 | nodeDb[node.id].dir = getDir(node);
|
30356 | nodeDb[node.id].shape = node.type === 'divider' ? 'divider' : 'roundedWithTitle';
|
30357 | nodeDb[node.id].classes = nodeDb[node.id].classes + ' ' + (altFlag ? 'statediagram-cluster statediagram-cluster-alt' : 'statediagram-cluster');
|
30358 | }
|
30359 |
|
30360 | var nodeData = {
|
30361 | labelStyle: '',
|
30362 | shape: nodeDb[node.id].shape,
|
30363 | labelText: nodeDb[node.id].description,
|
30364 | // typeof nodeDb[node.id].description === 'object'
|
30365 | // ? nodeDb[node.id].description[0]
|
30366 | // : nodeDb[node.id].description,
|
30367 | classes: nodeDb[node.id].classes,
|
30368 | //classStr,
|
30369 | style: '',
|
30370 | //styles.style,
|
30371 | id: node.id,
|
30372 | dir: nodeDb[node.id].dir,
|
30373 | domId: 'state-' + node.id + '-' + cnt,
|
30374 | type: nodeDb[node.id].type,
|
30375 | padding: 15 //getConfig().flowchart.padding
|
30376 |
|
30377 | };
|
30378 |
|
30379 | if (node.note) {
|
30380 | // Todo: set random id
|
30381 | var noteData = {
|
30382 | labelStyle: '',
|
30383 | shape: 'note',
|
30384 | labelText: node.note.text,
|
30385 | classes: 'statediagram-note',
|
30386 | //classStr,
|
30387 | style: '',
|
30388 | //styles.style,
|
30389 | id: node.id + '----note-' + cnt,
|
30390 | domId: 'state-' + node.id + '----note-' + cnt,
|
30391 | type: nodeDb[node.id].type,
|
30392 | padding: 15 //getConfig().flowchart.padding
|
30393 |
|
30394 | };
|
30395 | var groupData = {
|
30396 | labelStyle: '',
|
30397 | shape: 'noteGroup',
|
30398 | labelText: node.note.text,
|
30399 | classes: nodeDb[node.id].classes,
|
30400 | //classStr,
|
30401 | style: '',
|
30402 | //styles.style,
|
30403 | id: node.id + '----parent',
|
30404 | domId: 'state-' + node.id + '----parent-' + cnt,
|
30405 | type: 'group',
|
30406 | padding: 0 //getConfig().flowchart.padding
|
30407 |
|
30408 | };
|
30409 | cnt++;
|
30410 | g.setNode(node.id + '----parent', groupData);
|
30411 | g.setNode(noteData.id, noteData);
|
30412 | g.setNode(node.id, nodeData);
|
30413 | g.setParent(node.id, node.id + '----parent');
|
30414 | g.setParent(noteData.id, node.id + '----parent');
|
30415 | var from = node.id;
|
30416 | var to = noteData.id;
|
30417 |
|
30418 | if (node.note.position === 'left of') {
|
30419 | from = noteData.id;
|
30420 | to = node.id;
|
30421 | }
|
30422 |
|
30423 | g.setEdge(from, to, {
|
30424 | arrowhead: 'none',
|
30425 | arrowType: '',
|
30426 | style: 'fill:none',
|
30427 | labelStyle: '',
|
30428 | classes: 'transition note-edge',
|
30429 | arrowheadStyle: 'fill: #333',
|
30430 | labelpos: 'c',
|
30431 | labelType: 'text',
|
30432 | thickness: 'normal'
|
30433 | });
|
30434 | } else {
|
30435 | g.setNode(node.id, nodeData);
|
30436 | }
|
30437 | }
|
30438 |
|
30439 | if (parent) {
|
30440 | if (parent.id !== 'root') {
|
30441 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Setting node ', node.id, ' to be child of its parent ', parent.id);
|
30442 | g.setParent(node.id, parent.id);
|
30443 | }
|
30444 | }
|
30445 |
|
30446 | if (node.doc) {
|
30447 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Adding nodes children ');
|
30448 | setupDoc(g, node, node.doc, !altFlag);
|
30449 | }
|
30450 | };
|
30451 |
|
30452 | var cnt = 0;
|
30453 |
|
30454 | var setupDoc = function setupDoc(g, parent, doc, altFlag) {
|
30455 | // cnt = 0;
|
30456 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('items', doc);
|
30457 | doc.forEach(function (item) {
|
30458 | if (item.stmt === 'state' || item.stmt === 'default') {
|
30459 | setupNode(g, parent, item, altFlag);
|
30460 | } else if (item.stmt === 'relation') {
|
30461 | setupNode(g, parent, item.state1, altFlag);
|
30462 | setupNode(g, parent, item.state2, altFlag);
|
30463 | var edgeData = {
|
30464 | id: 'edge' + cnt,
|
30465 | arrowhead: 'normal',
|
30466 | arrowTypeEnd: 'arrow_barb',
|
30467 | style: 'fill:none',
|
30468 | labelStyle: '',
|
30469 | label: _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(item.description, (0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)()),
|
30470 | arrowheadStyle: 'fill: #333',
|
30471 | labelpos: 'c',
|
30472 | labelType: 'text',
|
30473 | thickness: 'normal',
|
30474 | classes: 'transition'
|
30475 | };
|
30476 | var startId = item.state1.id;
|
30477 | var endId = item.state2.id;
|
30478 | g.setEdge(startId, endId, edgeData, cnt);
|
30479 | cnt++;
|
30480 | }
|
30481 | });
|
30482 | };
|
30483 |
|
30484 | var getDir = function getDir(nodes, defaultDir) {
|
30485 | var dir = defaultDir || 'TB';
|
30486 |
|
30487 | if (nodes.doc) {
|
30488 | for (var i = 0; i < nodes.doc.length; i++) {
|
30489 | var node = nodes.doc[i];
|
30490 |
|
30491 | if (node.stmt === 'dir') {
|
30492 | dir = node.value;
|
30493 | }
|
30494 | }
|
30495 | }
|
30496 |
|
30497 | return dir;
|
30498 | };
|
30499 | /**
|
30500 | * Draws a flowchart in the tag with id: id based on the graph definition in text.
|
30501 | *
|
30502 | * @param {any} text
|
30503 | * @param {any} id
|
30504 | * @param _version
|
30505 | * @param diag
|
30506 | */
|
30507 |
|
30508 |
|
30509 | var draw = function draw(text, id, _version, diag) {
|
30510 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Drawing state diagram (v2)', id); // diag.sb.clear();
|
30511 |
|
30512 | nodeDb = {}; // Fetch the default direction, use TD if none was found
|
30513 |
|
30514 | var dir = diag.db.getDirection();
|
30515 |
|
30516 | if (typeof dir === 'undefined') {
|
30517 | dir = 'LR';
|
30518 | }
|
30519 |
|
30520 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().state;
|
30521 | var nodeSpacing = conf.nodeSpacing || 50;
|
30522 | var rankSpacing = conf.rankSpacing || 50;
|
30523 | var securityLevel = (0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().securityLevel;
|
30524 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info(diag.db.getRootDocV2());
|
30525 | diag.db.extract(diag.db.getRootDocV2());
|
30526 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info(diag.db.getRootDocV2()); // Create the input mermaid.graph
|
30527 |
|
30528 | var g = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
|
30529 | multigraph: true,
|
30530 | compound: true
|
30531 | }).setGraph({
|
30532 | rankdir: getDir(diag.db.getRootDocV2()),
|
30533 | nodesep: nodeSpacing,
|
30534 | ranksep: rankSpacing,
|
30535 | marginx: 8,
|
30536 | marginy: 8
|
30537 | }).setDefaultEdgeLabel(function () {
|
30538 | return {};
|
30539 | });
|
30540 | setupNode(g, undefined, diag.db.getRootDocV2(), true); // Set up an SVG group so that we can translate the final graph.
|
30541 |
|
30542 | var sandboxElement;
|
30543 |
|
30544 | if (securityLevel === 'sandbox') {
|
30545 | sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#i' + id);
|
30546 | }
|
30547 |
|
30548 | var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('body');
|
30549 | var doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;
|
30550 | var svg = root.select("[id=\"".concat(id, "\"]")); // Run the renderer. This is what draws the final graph.
|
30551 |
|
30552 | var element = root.select('#' + id + ' g');
|
30553 | (0,_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_5__.render)(element, g, ['barb'], 'statediagram', id);
|
30554 | var padding = 8;
|
30555 | var bounds = svg.node().getBBox();
|
30556 | var width = bounds.width + padding * 2;
|
30557 | var height = bounds.height + padding * 2; // Zoom in a bit
|
30558 |
|
30559 | svg.attr('class', 'statediagram');
|
30560 | var svgBounds = svg.node().getBBox();
|
30561 | (0,_utils__WEBPACK_IMPORTED_MODULE_6__.configureSvgSize)(svg, height, width * 1.75, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
|
30562 |
|
30563 | var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
|
30564 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug("viewBox ".concat(vBox));
|
30565 | svg.attr('viewBox', vBox); // Add label rects for non html labels
|
30566 | // if (!evaluate(conf.htmlLabels) || true) {
|
30567 |
|
30568 | var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
30569 |
|
30570 | for (var k = 0; k < labels.length; k++) {
|
30571 | var label = labels[k]; // Get dimensions of label
|
30572 |
|
30573 | var dim = label.getBBox();
|
30574 | var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
|
30575 | rect.setAttribute('rx', 0);
|
30576 | rect.setAttribute('ry', 0);
|
30577 | rect.setAttribute('width', dim.width);
|
30578 | rect.setAttribute('height', dim.height);
|
30579 | label.insertBefore(rect, label.firstChild); // }
|
30580 | }
|
30581 |
|
30582 | (0,_accessibility__WEBPACK_IMPORTED_MODULE_7__["default"])(diag.db, svg, id);
|
30583 | };
|
30584 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
30585 | setConf: setConf,
|
30586 | getClasses: getClasses,
|
30587 | draw: draw
|
30588 | });
|
30589 |
|
30590 | /***/ }),
|
30591 |
|
30592 | /***/ "./src/diagrams/state/stateRenderer.js":
|
30593 | /*!*********************************************!*\
|
30594 | !*** ./src/diagrams/state/stateRenderer.js ***!
|
30595 | \*********************************************/
|
30596 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
30597 |
|
30598 | "use strict";
|
30599 | __webpack_require__.r(__webpack_exports__);
|
30600 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
30601 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
30602 | /* harmony export */ "draw": () => (/* binding */ draw),
|
30603 | /* harmony export */ "setConf": () => (/* binding */ setConf)
|
30604 | /* harmony export */ });
|
30605 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
30606 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
30607 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
|
30608 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
|
30609 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
|
30610 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
|
30611 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
30612 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
30613 | /* harmony import */ var _shapes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./shapes */ "./src/diagrams/state/shapes.js");
|
30614 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
30615 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
30616 | /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js");
|
30617 |
|
30618 |
|
30619 |
|
30620 |
|
30621 |
|
30622 |
|
30623 |
|
30624 |
|
30625 | // TODO Move conf object to main conf in mermaidAPI
|
30626 |
|
30627 | var conf;
|
30628 | var transformationLog = {};
|
30629 | var setConf = function setConf() {};
|
30630 | /**
|
30631 | * Setup arrow head and define the marker. The result is appended to the svg.
|
30632 | *
|
30633 | * @param {any} elem
|
30634 | */
|
30635 |
|
30636 | var insertMarkers = function insertMarkers(elem) {
|
30637 | elem.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 19,7 L9,13 L14,7 L9,1 Z');
|
30638 | };
|
30639 | /**
|
30640 | * Draws a flowchart in the tag with id: id based on the graph definition in text.
|
30641 | *
|
30642 | * @param {any} text
|
30643 | * @param {any} id
|
30644 | * @param _version
|
30645 | * @param diagObj
|
30646 | */
|
30647 |
|
30648 |
|
30649 | var draw = function draw(text, id, _version, diagObj) {
|
30650 | conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().state;
|
30651 | var securityLevel = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().securityLevel; // Handle root and Document for when rendering in sanbox mode
|
30652 |
|
30653 | var sandboxElement;
|
30654 |
|
30655 | if (securityLevel === 'sandbox') {
|
30656 | sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#i' + id);
|
30657 | }
|
30658 |
|
30659 | var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body');
|
30660 | var doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document; // diagObj.db.clear();
|
30661 | // parser.parse(text);
|
30662 |
|
30663 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Rendering diagram ' + text); // Fetch the default direction, use TD if none was found
|
30664 |
|
30665 | var diagram = root.select("[id='".concat(id, "']"));
|
30666 | insertMarkers(diagram); // Layout graph, Create a new directed graph
|
30667 |
|
30668 | var graph = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
|
30669 | multigraph: true,
|
30670 | compound: true,
|
30671 | // acyclicer: 'greedy',
|
30672 | rankdir: 'RL' // ranksep: '20'
|
30673 |
|
30674 | }); // Default to assigning a new object as a label for each new edge.
|
30675 |
|
30676 | graph.setDefaultEdgeLabel(function () {
|
30677 | return {};
|
30678 | });
|
30679 | var rootDoc = diagObj.db.getRootDoc();
|
30680 | renderDoc(rootDoc, diagram, undefined, false, root, doc, diagObj);
|
30681 | var padding = conf.padding;
|
30682 | var bounds = diagram.node().getBBox();
|
30683 | var width = bounds.width + padding * 2;
|
30684 | var height = bounds.height + padding * 2; // zoom in a bit
|
30685 |
|
30686 | var svgWidth = width * 1.75;
|
30687 | (0,_utils__WEBPACK_IMPORTED_MODULE_5__.configureSvgSize)(diagram, height, svgWidth, conf.useMaxWidth);
|
30688 | diagram.attr('viewBox', "".concat(bounds.x - conf.padding, " ").concat(bounds.y - conf.padding, " ") + width + ' ' + height);
|
30689 | (0,_accessibility__WEBPACK_IMPORTED_MODULE_6__["default"])(diagObj.db, diagram, id);
|
30690 | };
|
30691 |
|
30692 | var getLabelWidth = function getLabelWidth(text) {
|
30693 | return text ? text.length * conf.fontSizeFactor : 1;
|
30694 | };
|
30695 |
|
30696 | var renderDoc = function renderDoc(doc, diagram, parentId, altBkg, root, domDocument, diagObj) {
|
30697 | // Layout graph, Create a new directed graph
|
30698 | var graph = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
|
30699 | compound: true,
|
30700 | multigraph: true
|
30701 | });
|
30702 | var i;
|
30703 | var edgeFreeDoc = true;
|
30704 |
|
30705 | for (i = 0; i < doc.length; i++) {
|
30706 | if (doc[i].stmt === 'relation') {
|
30707 | edgeFreeDoc = false;
|
30708 | break;
|
30709 | }
|
30710 | } // Set an object for the graph label
|
30711 |
|
30712 |
|
30713 | if (parentId) graph.setGraph({
|
30714 | rankdir: 'LR',
|
30715 | multigraph: true,
|
30716 | compound: true,
|
30717 | // acyclicer: 'greedy',
|
30718 | ranker: 'tight-tree',
|
30719 | ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
|
30720 | nodeSep: edgeFreeDoc ? 1 : 50,
|
30721 | isMultiGraph: true // ranksep: 5,
|
30722 | // nodesep: 1
|
30723 |
|
30724 | });else {
|
30725 | graph.setGraph({
|
30726 | rankdir: 'TB',
|
30727 | multigraph: true,
|
30728 | compound: true,
|
30729 | // isCompound: true,
|
30730 | // acyclicer: 'greedy',
|
30731 | // ranker: 'longest-path'
|
30732 | ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
|
30733 | nodeSep: edgeFreeDoc ? 1 : 50,
|
30734 | ranker: 'tight-tree',
|
30735 | // ranker: 'network-simplex'
|
30736 | isMultiGraph: true
|
30737 | });
|
30738 | } // Default to assigning a new object as a label for each new edge.
|
30739 |
|
30740 | graph.setDefaultEdgeLabel(function () {
|
30741 | return {};
|
30742 | });
|
30743 | diagObj.db.extract(doc);
|
30744 | var states = diagObj.db.getStates();
|
30745 | var relations = diagObj.db.getRelations();
|
30746 | var keys = Object.keys(states);
|
30747 | var first = true;
|
30748 |
|
30749 | for (var _i = 0; _i < keys.length; _i++) {
|
30750 | var stateDef = states[keys[_i]];
|
30751 |
|
30752 | if (parentId) {
|
30753 | stateDef.parentId = parentId;
|
30754 | }
|
30755 |
|
30756 | var node = void 0;
|
30757 |
|
30758 | if (stateDef.doc) {
|
30759 | var sub = diagram.append('g').attr('id', stateDef.id).attr('class', 'stateGroup');
|
30760 | node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg, root, domDocument, diagObj);
|
30761 |
|
30762 | if (first) {
|
30763 | // first = false;
|
30764 | sub = (0,_shapes__WEBPACK_IMPORTED_MODULE_7__.addTitleAndBox)(sub, stateDef, altBkg);
|
30765 | var boxBounds = sub.node().getBBox();
|
30766 | node.width = boxBounds.width;
|
30767 | node.height = boxBounds.height + conf.padding / 2;
|
30768 | transformationLog[stateDef.id] = {
|
30769 | y: conf.compositTitleSize
|
30770 | };
|
30771 | } else {
|
30772 | // sub = addIdAndBox(sub, stateDef);
|
30773 | var _boxBounds = sub.node().getBBox();
|
30774 |
|
30775 | node.width = _boxBounds.width;
|
30776 | node.height = _boxBounds.height; // transformationLog[stateDef.id] = { y: conf.compositTitleSize };
|
30777 | }
|
30778 | } else {
|
30779 | node = (0,_shapes__WEBPACK_IMPORTED_MODULE_7__.drawState)(diagram, stateDef, graph);
|
30780 | }
|
30781 |
|
30782 | if (stateDef.note) {
|
30783 | // Draw note note
|
30784 | var noteDef = {
|
30785 | descriptions: [],
|
30786 | id: stateDef.id + '-note',
|
30787 | note: stateDef.note,
|
30788 | type: 'note'
|
30789 | };
|
30790 | var note = (0,_shapes__WEBPACK_IMPORTED_MODULE_7__.drawState)(diagram, noteDef, graph); // graph.setNode(node.id, node);
|
30791 |
|
30792 | if (stateDef.note.position === 'left of') {
|
30793 | graph.setNode(node.id + '-note', note);
|
30794 | graph.setNode(node.id, node);
|
30795 | } else {
|
30796 | graph.setNode(node.id, node);
|
30797 | graph.setNode(node.id + '-note', note);
|
30798 | } // graph.setNode(node.id);
|
30799 |
|
30800 |
|
30801 | graph.setParent(node.id, node.id + '-group');
|
30802 | graph.setParent(node.id + '-note', node.id + '-group');
|
30803 | } else {
|
30804 | // Add nodes to the graph. The first argument is the node id. The second is
|
30805 | // metadata about the node. In this case we're going to add labels to each of
|
30806 | // our nodes.
|
30807 | graph.setNode(node.id, node);
|
30808 | }
|
30809 | }
|
30810 |
|
30811 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Count=', graph.nodeCount(), graph);
|
30812 | var cnt = 0;
|
30813 | relations.forEach(function (relation) {
|
30814 | cnt++;
|
30815 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Setting edge', relation);
|
30816 | graph.setEdge(relation.id1, relation.id2, {
|
30817 | relation: relation,
|
30818 | width: getLabelWidth(relation.title),
|
30819 | height: conf.labelHeight * _common_common__WEBPACK_IMPORTED_MODULE_8__["default"].getRows(relation.title).length,
|
30820 | labelpos: 'c'
|
30821 | }, 'id' + cnt);
|
30822 | });
|
30823 | dagre__WEBPACK_IMPORTED_MODULE_1___default().layout(graph);
|
30824 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Graph after layout', graph.nodes());
|
30825 | var svgElem = diagram.node();
|
30826 | graph.nodes().forEach(function (v) {
|
30827 | if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
|
30828 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('Node ' + v + ': ' + JSON.stringify(graph.node(v)));
|
30829 | root.select('#' + svgElem.id + ' #' + v).attr('transform', 'translate(' + (graph.node(v).x - graph.node(v).width / 2) + ',' + (graph.node(v).y + (transformationLog[v] ? transformationLog[v].y : 0) - graph.node(v).height / 2) + ' )');
|
30830 | root.select('#' + svgElem.id + ' #' + v).attr('data-x-shift', graph.node(v).x - graph.node(v).width / 2);
|
30831 | var dividers = domDocument.querySelectorAll('#' + svgElem.id + ' #' + v + ' .divider');
|
30832 | dividers.forEach(function (divider) {
|
30833 | var parent = divider.parentElement;
|
30834 | var pWidth = 0;
|
30835 | var pShift = 0;
|
30836 |
|
30837 | if (parent) {
|
30838 | if (parent.parentElement) pWidth = parent.parentElement.getBBox().width;
|
30839 | pShift = parseInt(parent.getAttribute('data-x-shift'), 10);
|
30840 |
|
30841 | if (Number.isNaN(pShift)) {
|
30842 | pShift = 0;
|
30843 | }
|
30844 | }
|
30845 |
|
30846 | divider.setAttribute('x1', 0 - pShift + 8);
|
30847 | divider.setAttribute('x2', pWidth - pShift - 8);
|
30848 | });
|
30849 | } else {
|
30850 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('No Node ' + v + ': ' + JSON.stringify(graph.node(v)));
|
30851 | }
|
30852 | });
|
30853 | var stateBox = svgElem.getBBox();
|
30854 | graph.edges().forEach(function (e) {
|
30855 | if (typeof e !== 'undefined' && typeof graph.edge(e) !== 'undefined') {
|
30856 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));
|
30857 | (0,_shapes__WEBPACK_IMPORTED_MODULE_7__.drawEdge)(diagram, graph.edge(e), graph.edge(e).relation);
|
30858 | }
|
30859 | });
|
30860 | stateBox = svgElem.getBBox();
|
30861 | var stateInfo = {
|
30862 | id: parentId ? parentId : 'root',
|
30863 | label: parentId ? parentId : 'root',
|
30864 | width: 0,
|
30865 | height: 0
|
30866 | };
|
30867 | stateInfo.width = stateBox.width + 2 * conf.padding;
|
30868 | stateInfo.height = stateBox.height + 2 * conf.padding;
|
30869 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Doc rendered', stateInfo, graph);
|
30870 | return stateInfo;
|
30871 | };
|
30872 |
|
30873 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
30874 | setConf: setConf,
|
30875 | draw: draw
|
30876 | });
|
30877 |
|
30878 | /***/ }),
|
30879 |
|
30880 | /***/ "./src/diagrams/state/styles.js":
|
30881 | /*!**************************************!*\
|
30882 | !*** ./src/diagrams/state/styles.js ***!
|
30883 | \**************************************/
|
30884 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
30885 |
|
30886 | "use strict";
|
30887 | __webpack_require__.r(__webpack_exports__);
|
30888 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
30889 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
30890 | /* harmony export */ });
|
30891 | var getStyles = function getStyles(options) {
|
30892 | return "\ndefs #statediagram-barbEnd {\n fill: ".concat(options.transitionColor, ";\n stroke: ").concat(options.transitionColor, ";\n }\ng.stateGroup text {\n fill: ").concat(options.nodeBorder, ";\n stroke: none;\n font-size: 10px;\n}\ng.stateGroup text {\n fill: ").concat(options.textColor, ";\n stroke: none;\n font-size: 10px;\n\n}\ng.stateGroup .state-title {\n font-weight: bolder;\n fill: ").concat(options.stateLabelColor, ";\n}\n\ng.stateGroup rect {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n}\n\ng.stateGroup line {\n stroke: ").concat(options.lineColor, ";\n stroke-width: 1;\n}\n\n.transition {\n stroke: ").concat(options.transitionColor, ";\n stroke-width: 1;\n fill: none;\n}\n\n.stateGroup .composit {\n fill: ").concat(options.background, ";\n border-bottom: 1px\n}\n\n.stateGroup .alt-composit {\n fill: #e0e0e0;\n border-bottom: 1px\n}\n\n.state-note {\n stroke: ").concat(options.noteBorderColor, ";\n fill: ").concat(options.noteBkgColor, ";\n\n text {\n fill: ").concat(options.noteTextColor, ";\n stroke: none;\n font-size: 10px;\n }\n}\n\n.stateLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ").concat(options.mainBkg, ";\n opacity: 0.5;\n}\n\n.edgeLabel .label rect {\n fill: ").concat(options.labelBackgroundColor, ";\n opacity: 0.5;\n}\n.edgeLabel .label text {\n fill: ").concat(options.transitionLabelColor || options.tertiaryTextColor, ";\n}\n.label div .edgeLabel {\n color: ").concat(options.transitionLabelColor || options.tertiaryTextColor, ";\n}\n\n.stateLabel text {\n fill: ").concat(options.stateLabelColor, ";\n font-size: 10px;\n font-weight: bold;\n}\n\n.node circle.state-start {\n fill: ").concat(options.specialStateColor, ";\n stroke: ").concat(options.specialStateColor, ";\n}\n\n.node .fork-join {\n fill: ").concat(options.specialStateColor, ";\n stroke: ").concat(options.specialStateColor, ";\n}\n\n.node circle.state-end {\n fill: ").concat(options.innerEndBackground, ";\n stroke: ").concat(options.background, ";\n stroke-width: 1.5\n}\n.end-state-inner {\n fill: ").concat(options.compositeBackground || options.background, ";\n // stroke: ").concat(options.background, ";\n stroke-width: 1.5\n}\n\n.node rect {\n fill: ").concat(options.stateBkg || options.mainBkg, ";\n stroke: ").concat(options.stateBorder || options.nodeBorder, ";\n stroke-width: 1px;\n}\n.node polygon {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.stateBorder || options.nodeBorder, ";;\n stroke-width: 1px;\n}\n#statediagram-barbEnd {\n fill: ").concat(options.lineColor, ";\n}\n\n.statediagram-cluster rect {\n fill: ").concat(options.compositeTitleBackground, ";\n stroke: ").concat(options.stateBorder || options.nodeBorder, ";\n stroke-width: 1px;\n}\n\n.cluster-label, .nodeLabel {\n color: ").concat(options.stateLabelColor, ";\n}\n\n.statediagram-cluster rect.outer {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state .divider {\n stroke: ").concat(options.stateBorder || options.nodeBorder, ";\n}\n\n.statediagram-state .title-state {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-cluster.statediagram-cluster .inner {\n fill: ").concat(options.compositeBackground || options.background, ";\n}\n.statediagram-cluster.statediagram-cluster-alt .inner {\n fill: ").concat(options.altBackground ? options.altBackground : '#efefef', ";\n}\n\n.statediagram-cluster .inner {\n rx:0;\n ry:0;\n}\n\n.statediagram-state rect.basic {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state rect.divider {\n stroke-dasharray: 10,10;\n fill: ").concat(options.altBackground ? options.altBackground : '#efefef', ";\n}\n\n.note-edge {\n stroke-dasharray: 5;\n}\n\n.statediagram-note rect {\n fill: ").concat(options.noteBkgColor, ";\n stroke: ").concat(options.noteBorderColor, ";\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n.statediagram-note rect {\n fill: ").concat(options.noteBkgColor, ";\n stroke: ").concat(options.noteBorderColor, ";\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n\n.statediagram-note text {\n fill: ").concat(options.noteTextColor, ";\n}\n\n.statediagram-note .nodeLabel {\n color: ").concat(options.noteTextColor, ";\n}\n.statediagram .edgeLabel {\n color: red; // ").concat(options.noteTextColor, ";\n}\n\n#dependencyStart, #dependencyEnd {\n fill: ").concat(options.lineColor, ";\n stroke: ").concat(options.lineColor, ";\n stroke-width: 1;\n}\n");
|
30893 | };
|
30894 |
|
30895 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
30896 |
|
30897 | /***/ }),
|
30898 |
|
30899 | /***/ "./src/diagrams/user-journey/journeyDb.js":
|
30900 | /*!************************************************!*\
|
30901 | !*** ./src/diagrams/user-journey/journeyDb.js ***!
|
30902 | \************************************************/
|
30903 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
30904 |
|
30905 | "use strict";
|
30906 | __webpack_require__.r(__webpack_exports__);
|
30907 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
30908 | /* harmony export */ "addSection": () => (/* binding */ addSection),
|
30909 | /* harmony export */ "addTask": () => (/* binding */ addTask),
|
30910 | /* harmony export */ "addTaskOrg": () => (/* binding */ addTaskOrg),
|
30911 | /* harmony export */ "clear": () => (/* binding */ clear),
|
30912 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
30913 | /* harmony export */ "getSections": () => (/* binding */ getSections),
|
30914 | /* harmony export */ "getTasks": () => (/* binding */ getTasks),
|
30915 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective)
|
30916 | /* harmony export */ });
|
30917 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
30918 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
30919 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
30920 | /* harmony import */ var _commonDb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../commonDb */ "./src/commonDb.js");
|
30921 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
30922 |
|
30923 | function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
30924 |
|
30925 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
30926 |
|
30927 | function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
30928 |
|
30929 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
30930 |
|
30931 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
30932 |
|
30933 |
|
30934 |
|
30935 |
|
30936 |
|
30937 |
|
30938 | var sanitizeText = function sanitizeText(txt) {
|
30939 | return _common_common__WEBPACK_IMPORTED_MODULE_0__["default"].sanitizeText(txt, _config__WEBPACK_IMPORTED_MODULE_1__.getConfig());
|
30940 | };
|
30941 |
|
30942 | var title = '';
|
30943 | var description = '';
|
30944 | var currentSection = '';
|
30945 | var sections = [];
|
30946 | var tasks = [];
|
30947 | var rawTasks = [];
|
30948 | var parseDirective = function parseDirective(statement, context, type) {
|
30949 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__["default"].parseDirective(this, statement, context, type);
|
30950 | };
|
30951 | var clear = function clear() {
|
30952 | sections.length = 0;
|
30953 | tasks.length = 0;
|
30954 | currentSection = '';
|
30955 | title = '';
|
30956 | description = '';
|
30957 | rawTasks.length = 0;
|
30958 | (0,_commonDb__WEBPACK_IMPORTED_MODULE_3__.clear)();
|
30959 | };
|
30960 | var addSection = function addSection(txt) {
|
30961 | currentSection = txt;
|
30962 | sections.push(txt);
|
30963 | };
|
30964 | var getSections = function getSections() {
|
30965 | return sections;
|
30966 | };
|
30967 | var getTasks = function getTasks() {
|
30968 | var allItemsProcessed = compileTasks();
|
30969 | var maxDepth = 100;
|
30970 | var iterationCount = 0;
|
30971 |
|
30972 | while (!allItemsProcessed && iterationCount < maxDepth) {
|
30973 | allItemsProcessed = compileTasks();
|
30974 | iterationCount++;
|
30975 | }
|
30976 |
|
30977 | tasks.push.apply(tasks, rawTasks);
|
30978 | return tasks;
|
30979 | };
|
30980 |
|
30981 | var updateActors = function updateActors() {
|
30982 | var tempActors = [];
|
30983 | tasks.forEach(function (task) {
|
30984 | if (task.people) {
|
30985 | tempActors.push.apply(tempActors, _toConsumableArray(task.people));
|
30986 | }
|
30987 | });
|
30988 | var unique = new Set(tempActors);
|
30989 | return _toConsumableArray(unique).sort();
|
30990 | };
|
30991 |
|
30992 | var addTask = function addTask(descr, taskData) {
|
30993 | var pieces = taskData.substr(1).split(':');
|
30994 | var score = 0;
|
30995 | var peeps = [];
|
30996 |
|
30997 | if (pieces.length === 1) {
|
30998 | score = Number(pieces[0]);
|
30999 | peeps = [];
|
31000 | } else {
|
31001 | score = Number(pieces[0]);
|
31002 | peeps = pieces[1].split(',');
|
31003 | }
|
31004 |
|
31005 | var peopleList = peeps.map(function (s) {
|
31006 | return s.trim();
|
31007 | });
|
31008 | var rawTask = {
|
31009 | section: currentSection,
|
31010 | type: currentSection,
|
31011 | people: peopleList,
|
31012 | task: descr,
|
31013 | score: score
|
31014 | };
|
31015 | rawTasks.push(rawTask);
|
31016 | };
|
31017 | var addTaskOrg = function addTaskOrg(descr) {
|
31018 | var newTask = {
|
31019 | section: currentSection,
|
31020 | type: currentSection,
|
31021 | description: descr,
|
31022 | task: descr,
|
31023 | classes: []
|
31024 | };
|
31025 | tasks.push(newTask);
|
31026 | };
|
31027 |
|
31028 | var compileTasks = function compileTasks() {
|
31029 | var compileTask = function compileTask(pos) {
|
31030 | return rawTasks[pos].processed;
|
31031 | };
|
31032 |
|
31033 | var allProcessed = true;
|
31034 |
|
31035 | for (var i = 0; i < rawTasks.length; i++) {
|
31036 | compileTask(i);
|
31037 | allProcessed = allProcessed && rawTasks[i].processed;
|
31038 | }
|
31039 |
|
31040 | return allProcessed;
|
31041 | };
|
31042 |
|
31043 | var getActors = function getActors() {
|
31044 | return updateActors();
|
31045 | };
|
31046 |
|
31047 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
31048 | parseDirective: parseDirective,
|
31049 | getConfig: function getConfig() {
|
31050 | return _config__WEBPACK_IMPORTED_MODULE_1__.getConfig().journey;
|
31051 | },
|
31052 | clear: clear,
|
31053 | setDiagramTitle: _commonDb__WEBPACK_IMPORTED_MODULE_3__.setDiagramTitle,
|
31054 | getDiagramTitle: _commonDb__WEBPACK_IMPORTED_MODULE_3__.getDiagramTitle,
|
31055 | setAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_3__.setAccTitle,
|
31056 | getAccTitle: _commonDb__WEBPACK_IMPORTED_MODULE_3__.getAccTitle,
|
31057 | setAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_3__.setAccDescription,
|
31058 | getAccDescription: _commonDb__WEBPACK_IMPORTED_MODULE_3__.getAccDescription,
|
31059 | addSection: addSection,
|
31060 | getSections: getSections,
|
31061 | getTasks: getTasks,
|
31062 | addTask: addTask,
|
31063 | addTaskOrg: addTaskOrg,
|
31064 | getActors: getActors
|
31065 | });
|
31066 |
|
31067 | /***/ }),
|
31068 |
|
31069 | /***/ "./src/diagrams/user-journey/journeyRenderer.js":
|
31070 | /*!******************************************************!*\
|
31071 | !*** ./src/diagrams/user-journey/journeyRenderer.js ***!
|
31072 | \******************************************************/
|
31073 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
31074 |
|
31075 | "use strict";
|
31076 | __webpack_require__.r(__webpack_exports__);
|
31077 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
31078 | /* harmony export */ "bounds": () => (/* binding */ bounds),
|
31079 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
31080 | /* harmony export */ "draw": () => (/* binding */ draw),
|
31081 | /* harmony export */ "drawTasks": () => (/* binding */ drawTasks),
|
31082 | /* harmony export */ "setConf": () => (/* binding */ setConf)
|
31083 | /* harmony export */ });
|
31084 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
31085 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
31086 | /* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/user-journey/svgDraw.js");
|
31087 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
31088 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
31089 | /* harmony import */ var _accessibility__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../accessibility */ "./src/accessibility.js");
|
31090 |
|
31091 |
|
31092 |
|
31093 |
|
31094 |
|
31095 | var setConf = function setConf(cnf) {
|
31096 | var keys = Object.keys(cnf);
|
31097 | keys.forEach(function (key) {
|
31098 | conf[key] = cnf[key];
|
31099 | });
|
31100 | };
|
31101 | var actors = {};
|
31102 | /** @param {any} diagram */
|
31103 |
|
31104 | function drawActorLegend(diagram) {
|
31105 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().journey; // Draw the actors
|
31106 |
|
31107 | var yPos = 60;
|
31108 | Object.keys(actors).forEach(function (person) {
|
31109 | var colour = actors[person].color;
|
31110 | var circleData = {
|
31111 | cx: 20,
|
31112 | cy: yPos,
|
31113 | r: 7,
|
31114 | fill: colour,
|
31115 | stroke: '#000',
|
31116 | pos: actors[person].position
|
31117 | };
|
31118 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawCircle(diagram, circleData);
|
31119 | var labelData = {
|
31120 | x: 40,
|
31121 | y: yPos + 7,
|
31122 | fill: '#666',
|
31123 | text: person,
|
31124 | textMargin: conf.boxTextMargin | 5
|
31125 | };
|
31126 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawText(diagram, labelData);
|
31127 | yPos += 20;
|
31128 | });
|
31129 | }
|
31130 |
|
31131 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().journey;
|
31132 | var LEFT_MARGIN = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().journey.leftMargin;
|
31133 | var draw = function draw(text, id, version, diagObj) {
|
31134 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().journey;
|
31135 | diagObj.db.clear();
|
31136 | diagObj.parser.parse(text + '\n');
|
31137 | var securityLevel = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().securityLevel; // Handle root and Document for when rendering in sanbox mode
|
31138 |
|
31139 | var sandboxElement;
|
31140 |
|
31141 | if (securityLevel === 'sandbox') {
|
31142 | sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#i' + id);
|
31143 | }
|
31144 |
|
31145 | var root = securityLevel === 'sandbox' ? (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body'); // const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;
|
31146 |
|
31147 | bounds.init();
|
31148 | var diagram = root.select('#' + id);
|
31149 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].initGraphics(diagram);
|
31150 | var tasks = diagObj.db.getTasks();
|
31151 | var title = diagObj.db.getDiagramTitle();
|
31152 | var actorNames = diagObj.db.getActors();
|
31153 |
|
31154 | for (var member in actors) {
|
31155 | delete actors[member];
|
31156 | }
|
31157 |
|
31158 | var actorPos = 0;
|
31159 | actorNames.forEach(function (actorName) {
|
31160 | actors[actorName] = {
|
31161 | color: conf.actorColours[actorPos % conf.actorColours.length],
|
31162 | position: actorPos
|
31163 | };
|
31164 | actorPos++;
|
31165 | });
|
31166 | drawActorLegend(diagram);
|
31167 | bounds.insert(0, 0, LEFT_MARGIN, Object.keys(actors).length * 50);
|
31168 | drawTasks(diagram, tasks, 0);
|
31169 | var box = bounds.getBounds();
|
31170 |
|
31171 | if (title) {
|
31172 | diagram.append('text').text(title).attr('x', LEFT_MARGIN).attr('font-size', '4ex').attr('font-weight', 'bold').attr('y', 25);
|
31173 | }
|
31174 |
|
31175 | var height = box.stopy - box.starty + 2 * conf.diagramMarginY;
|
31176 | var width = LEFT_MARGIN + box.stopx + 2 * conf.diagramMarginX;
|
31177 | (0,_utils__WEBPACK_IMPORTED_MODULE_3__.configureSvgSize)(diagram, height, width, conf.useMaxWidth); // Draw activity line
|
31178 |
|
31179 | diagram.append('line').attr('x1', LEFT_MARGIN).attr('y1', conf.height * 4) // One section head + one task + margins
|
31180 | .attr('x2', width - LEFT_MARGIN - 4) // Subtract stroke width so arrow point is retained
|
31181 | .attr('y2', conf.height * 4).attr('stroke-width', 4).attr('stroke', 'black').attr('marker-end', 'url(#arrowhead)');
|
31182 | var extraVertForTitle = title ? 70 : 0;
|
31183 | diagram.attr('viewBox', "".concat(box.startx, " -25 ").concat(width, " ").concat(height + extraVertForTitle));
|
31184 | diagram.attr('preserveAspectRatio', 'xMinYMin meet');
|
31185 | diagram.attr('height', height + extraVertForTitle + 25);
|
31186 | (0,_accessibility__WEBPACK_IMPORTED_MODULE_4__["default"])(diagObj.db, diagram, id);
|
31187 | };
|
31188 | var bounds = {
|
31189 | data: {
|
31190 | startx: undefined,
|
31191 | stopx: undefined,
|
31192 | starty: undefined,
|
31193 | stopy: undefined
|
31194 | },
|
31195 | verticalPos: 0,
|
31196 | sequenceItems: [],
|
31197 | init: function init() {
|
31198 | this.sequenceItems = [];
|
31199 | this.data = {
|
31200 | startx: undefined,
|
31201 | stopx: undefined,
|
31202 | starty: undefined,
|
31203 | stopy: undefined
|
31204 | };
|
31205 | this.verticalPos = 0;
|
31206 | },
|
31207 | updateVal: function updateVal(obj, key, val, fun) {
|
31208 | if (typeof obj[key] === 'undefined') {
|
31209 | obj[key] = val;
|
31210 | } else {
|
31211 | obj[key] = fun(val, obj[key]);
|
31212 | }
|
31213 | },
|
31214 | updateBounds: function updateBounds(startx, starty, stopx, stopy) {
|
31215 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().journey;
|
31216 |
|
31217 | var _self = this;
|
31218 |
|
31219 | var cnt = 0;
|
31220 | /** @param {any} type */
|
31221 |
|
31222 | function updateFn(type) {
|
31223 | return function updateItemBounds(item) {
|
31224 | cnt++; // The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
|
31225 |
|
31226 | var n = _self.sequenceItems.length - cnt + 1;
|
31227 |
|
31228 | _self.updateVal(item, 'starty', starty - n * conf.boxMargin, Math.min);
|
31229 |
|
31230 | _self.updateVal(item, 'stopy', stopy + n * conf.boxMargin, Math.max);
|
31231 |
|
31232 | _self.updateVal(bounds.data, 'startx', startx - n * conf.boxMargin, Math.min);
|
31233 |
|
31234 | _self.updateVal(bounds.data, 'stopx', stopx + n * conf.boxMargin, Math.max);
|
31235 |
|
31236 | if (!(type === 'activation')) {
|
31237 | _self.updateVal(item, 'startx', startx - n * conf.boxMargin, Math.min);
|
31238 |
|
31239 | _self.updateVal(item, 'stopx', stopx + n * conf.boxMargin, Math.max);
|
31240 |
|
31241 | _self.updateVal(bounds.data, 'starty', starty - n * conf.boxMargin, Math.min);
|
31242 |
|
31243 | _self.updateVal(bounds.data, 'stopy', stopy + n * conf.boxMargin, Math.max);
|
31244 | }
|
31245 | };
|
31246 | }
|
31247 |
|
31248 | this.sequenceItems.forEach(updateFn());
|
31249 | },
|
31250 | insert: function insert(startx, starty, stopx, stopy) {
|
31251 | var _startx = Math.min(startx, stopx);
|
31252 |
|
31253 | var _stopx = Math.max(startx, stopx);
|
31254 |
|
31255 | var _starty = Math.min(starty, stopy);
|
31256 |
|
31257 | var _stopy = Math.max(starty, stopy);
|
31258 |
|
31259 | this.updateVal(bounds.data, 'startx', _startx, Math.min);
|
31260 | this.updateVal(bounds.data, 'starty', _starty, Math.min);
|
31261 | this.updateVal(bounds.data, 'stopx', _stopx, Math.max);
|
31262 | this.updateVal(bounds.data, 'stopy', _stopy, Math.max);
|
31263 | this.updateBounds(_startx, _starty, _stopx, _stopy);
|
31264 | },
|
31265 | bumpVerticalPos: function bumpVerticalPos(bump) {
|
31266 | this.verticalPos = this.verticalPos + bump;
|
31267 | this.data.stopy = this.verticalPos;
|
31268 | },
|
31269 | getVerticalPos: function getVerticalPos() {
|
31270 | return this.verticalPos;
|
31271 | },
|
31272 | getBounds: function getBounds() {
|
31273 | return this.data;
|
31274 | }
|
31275 | };
|
31276 | var fills = conf.sectionFills;
|
31277 | var textColours = conf.sectionColours;
|
31278 | var drawTasks = function drawTasks(diagram, tasks, verticalPos) {
|
31279 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().journey;
|
31280 | var lastSection = '';
|
31281 | var sectionVHeight = conf.height * 2 + conf.diagramMarginY;
|
31282 | var taskPos = verticalPos + sectionVHeight;
|
31283 | var sectionNumber = 0;
|
31284 | var fill = '#CCC';
|
31285 | var colour = 'black';
|
31286 | var num = 0; // Draw the tasks
|
31287 |
|
31288 | for (var i = 0; i < tasks.length; i++) {
|
31289 | var task = tasks[i];
|
31290 |
|
31291 | if (lastSection !== task.section) {
|
31292 | fill = fills[sectionNumber % fills.length];
|
31293 | num = sectionNumber % fills.length;
|
31294 | colour = textColours[sectionNumber % textColours.length];
|
31295 | var section = {
|
31296 | x: i * conf.taskMargin + i * conf.width + LEFT_MARGIN,
|
31297 | y: 50,
|
31298 | text: task.section,
|
31299 | fill: fill,
|
31300 | num: num,
|
31301 | colour: colour
|
31302 | };
|
31303 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawSection(diagram, section, conf);
|
31304 | lastSection = task.section;
|
31305 | sectionNumber++;
|
31306 | } // Collect the actors involved in the task
|
31307 |
|
31308 |
|
31309 | var taskActors = task.people.reduce(function (acc, actorName) {
|
31310 | if (actors[actorName]) {
|
31311 | acc[actorName] = actors[actorName];
|
31312 | }
|
31313 |
|
31314 | return acc;
|
31315 | }, {}); // Add some rendering data to the object
|
31316 |
|
31317 | task.x = i * conf.taskMargin + i * conf.width + LEFT_MARGIN;
|
31318 | task.y = taskPos;
|
31319 | task.width = conf.diagramMarginX;
|
31320 | task.height = conf.diagramMarginY;
|
31321 | task.colour = colour;
|
31322 | task.fill = fill;
|
31323 | task.num = num;
|
31324 | task.actors = taskActors; // Draw the box with the attached line
|
31325 |
|
31326 | _svgDraw__WEBPACK_IMPORTED_MODULE_2__["default"].drawTask(diagram, task, conf);
|
31327 | bounds.insert(task.x, task.y, task.x + task.width + conf.taskMargin, 300 + 5 * 30); // stopy is the length of the descenders.
|
31328 | }
|
31329 | };
|
31330 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
31331 | setConf: setConf,
|
31332 | draw: draw
|
31333 | });
|
31334 |
|
31335 | /***/ }),
|
31336 |
|
31337 | /***/ "./src/diagrams/user-journey/styles.js":
|
31338 | /*!*********************************************!*\
|
31339 | !*** ./src/diagrams/user-journey/styles.js ***!
|
31340 | \*********************************************/
|
31341 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
31342 |
|
31343 | "use strict";
|
31344 | __webpack_require__.r(__webpack_exports__);
|
31345 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
31346 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
31347 | /* harmony export */ });
|
31348 | var getStyles = function getStyles(options) {
|
31349 | return ".label {\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n color: ".concat(options.textColor, ";\n }\n .mouth {\n stroke: #666;\n }\n\n line {\n stroke: ").concat(options.textColor, "\n }\n\n .legend {\n fill: ").concat(options.textColor, ";\n }\n\n .label text {\n fill: #333;\n }\n .label {\n color: ").concat(options.textColor, "\n }\n\n .face {\n ").concat(options.faceColor ? "fill: ".concat(options.faceColor) : 'fill: #FFF8DC', ";\n stroke: #999;\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ").concat(options.arrowheadColor, ";\n }\n\n .edgePath .path {\n stroke: ").concat(options.lineColor, ";\n stroke-width: 1.5px;\n }\n\n .flowchart-link {\n stroke: ").concat(options.lineColor, ";\n fill: none;\n }\n\n .edgeLabel {\n background-color: ").concat(options.edgeLabelBackground, ";\n rect {\n opacity: 0.5;\n }\n text-align: center;\n }\n\n .cluster rect {\n }\n\n .cluster text {\n fill: ").concat(options.titleColor, ";\n }\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n font-size: 12px;\n background: ").concat(options.tertiaryColor, ";\n border: 1px solid ").concat(options.border2, ";\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .task-type-0, .section-type-0 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType0) : '', ";\n }\n .task-type-1, .section-type-1 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType1) : '', ";\n }\n .task-type-2, .section-type-2 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType2) : '', ";\n }\n .task-type-3, .section-type-3 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType3) : '', ";\n }\n .task-type-4, .section-type-4 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType4) : '', ";\n }\n .task-type-5, .section-type-5 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType5) : '', ";\n }\n .task-type-6, .section-type-6 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType6) : '', ";\n }\n .task-type-7, .section-type-7 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType7) : '', ";\n }\n\n .actor-0 {\n ").concat(options.actor0 ? "fill: ".concat(options.actor0) : '', ";\n }\n .actor-1 {\n ").concat(options.actor1 ? "fill: ".concat(options.actor1) : '', ";\n }\n .actor-2 {\n ").concat(options.actor2 ? "fill: ".concat(options.actor2) : '', ";\n }\n .actor-3 {\n ").concat(options.actor3 ? "fill: ".concat(options.actor3) : '', ";\n }\n .actor-4 {\n ").concat(options.actor4 ? "fill: ".concat(options.actor4) : '', ";\n }\n .actor-5 {\n ").concat(options.actor5 ? "fill: ".concat(options.actor5) : '', ";\n }\n\n }\n");
|
31350 | };
|
31351 |
|
31352 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
31353 |
|
31354 | /***/ }),
|
31355 |
|
31356 | /***/ "./src/diagrams/user-journey/svgDraw.js":
|
31357 | /*!**********************************************!*\
|
31358 | !*** ./src/diagrams/user-journey/svgDraw.js ***!
|
31359 | \**********************************************/
|
31360 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
31361 |
|
31362 | "use strict";
|
31363 | __webpack_require__.r(__webpack_exports__);
|
31364 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
31365 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
31366 | /* harmony export */ "drawBackgroundRect": () => (/* binding */ drawBackgroundRect),
|
31367 | /* harmony export */ "drawCircle": () => (/* binding */ drawCircle),
|
31368 | /* harmony export */ "drawFace": () => (/* binding */ drawFace),
|
31369 | /* harmony export */ "drawLabel": () => (/* binding */ drawLabel),
|
31370 | /* harmony export */ "drawRect": () => (/* binding */ drawRect),
|
31371 | /* harmony export */ "drawSection": () => (/* binding */ drawSection),
|
31372 | /* harmony export */ "drawTask": () => (/* binding */ drawTask),
|
31373 | /* harmony export */ "drawText": () => (/* binding */ drawText),
|
31374 | /* harmony export */ "getNoteRect": () => (/* binding */ getNoteRect),
|
31375 | /* harmony export */ "getTextObj": () => (/* binding */ getTextObj)
|
31376 | /* harmony export */ });
|
31377 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
31378 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
31379 |
|
31380 | var drawRect = function drawRect(elem, rectData) {
|
31381 | var rectElem = elem.append('rect');
|
31382 | rectElem.attr('x', rectData.x);
|
31383 | rectElem.attr('y', rectData.y);
|
31384 | rectElem.attr('fill', rectData.fill);
|
31385 | rectElem.attr('stroke', rectData.stroke);
|
31386 | rectElem.attr('width', rectData.width);
|
31387 | rectElem.attr('height', rectData.height);
|
31388 | rectElem.attr('rx', rectData.rx);
|
31389 | rectElem.attr('ry', rectData.ry);
|
31390 |
|
31391 | if (typeof rectData.class !== 'undefined') {
|
31392 | rectElem.attr('class', rectData.class);
|
31393 | }
|
31394 |
|
31395 | return rectElem;
|
31396 | };
|
31397 | var drawFace = function drawFace(element, faceData) {
|
31398 | var radius = 15;
|
31399 | var circleElement = element.append('circle').attr('cx', faceData.cx).attr('cy', faceData.cy).attr('class', 'face').attr('r', radius).attr('stroke-width', 2).attr('overflow', 'visible');
|
31400 | var face = element.append('g'); //left eye
|
31401 |
|
31402 | face.append('circle').attr('cx', faceData.cx - radius / 3).attr('cy', faceData.cy - radius / 3).attr('r', 1.5).attr('stroke-width', 2).attr('fill', '#666').attr('stroke', '#666'); //right eye
|
31403 |
|
31404 | face.append('circle').attr('cx', faceData.cx + radius / 3).attr('cy', faceData.cy - radius / 3).attr('r', 1.5).attr('stroke-width', 2).attr('fill', '#666').attr('stroke', '#666');
|
31405 | /** @param {any} face */
|
31406 |
|
31407 | function smile(face) {
|
31408 | var arc = (0,d3__WEBPACK_IMPORTED_MODULE_0__.arc)().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2); //mouth
|
31409 |
|
31410 | face.append('path').attr('class', 'mouth').attr('d', arc).attr('transform', 'translate(' + faceData.cx + ',' + (faceData.cy + 2) + ')');
|
31411 | }
|
31412 | /** @param {any} face */
|
31413 |
|
31414 |
|
31415 | function sad(face) {
|
31416 | var arc = (0,d3__WEBPACK_IMPORTED_MODULE_0__.arc)().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2); //mouth
|
31417 |
|
31418 | face.append('path').attr('class', 'mouth').attr('d', arc).attr('transform', 'translate(' + faceData.cx + ',' + (faceData.cy + 7) + ')');
|
31419 | }
|
31420 | /** @param {any} face */
|
31421 |
|
31422 |
|
31423 | function ambivalent(face) {
|
31424 | face.append('line').attr('class', 'mouth').attr('stroke', 2).attr('x1', faceData.cx - 5).attr('y1', faceData.cy + 7).attr('x2', faceData.cx + 5).attr('y2', faceData.cy + 7).attr('class', 'mouth').attr('stroke-width', '1px').attr('stroke', '#666');
|
31425 | }
|
31426 |
|
31427 | if (faceData.score > 3) {
|
31428 | smile(face);
|
31429 | } else if (faceData.score < 3) {
|
31430 | sad(face);
|
31431 | } else {
|
31432 | ambivalent(face);
|
31433 | }
|
31434 |
|
31435 | return circleElement;
|
31436 | };
|
31437 | var drawCircle = function drawCircle(element, circleData) {
|
31438 | var circleElement = element.append('circle');
|
31439 | circleElement.attr('cx', circleData.cx);
|
31440 | circleElement.attr('cy', circleData.cy);
|
31441 | circleElement.attr('class', 'actor-' + circleData.pos);
|
31442 | circleElement.attr('fill', circleData.fill);
|
31443 | circleElement.attr('stroke', circleData.stroke);
|
31444 | circleElement.attr('r', circleData.r);
|
31445 |
|
31446 | if (typeof circleElement.class !== 'undefined') {
|
31447 | circleElement.attr('class', circleElement.class);
|
31448 | }
|
31449 |
|
31450 | if (typeof circleData.title !== 'undefined') {
|
31451 | circleElement.append('title').text(circleData.title);
|
31452 | }
|
31453 |
|
31454 | return circleElement;
|
31455 | };
|
31456 | var drawText = function drawText(elem, textData) {
|
31457 | // Remove and ignore br:s
|
31458 | var nText = textData.text.replace(/<br\s*\/?>/gi, ' ');
|
31459 | var textElem = elem.append('text');
|
31460 | textElem.attr('x', textData.x);
|
31461 | textElem.attr('y', textData.y);
|
31462 | textElem.attr('class', 'legend');
|
31463 | textElem.style('text-anchor', textData.anchor);
|
31464 |
|
31465 | if (typeof textData.class !== 'undefined') {
|
31466 | textElem.attr('class', textData.class);
|
31467 | }
|
31468 |
|
31469 | var span = textElem.append('tspan');
|
31470 | span.attr('x', textData.x + textData.textMargin * 2);
|
31471 | span.text(nText);
|
31472 | return textElem;
|
31473 | };
|
31474 | var drawLabel = function drawLabel(elem, txtObject) {
|
31475 | /**
|
31476 | * @param {any} x
|
31477 | * @param {any} y
|
31478 | * @param {any} width
|
31479 | * @param {any} height
|
31480 | * @param {any} cut
|
31481 | */
|
31482 | function genPoints(x, y, width, height, cut) {
|
31483 | return x + ',' + y + ' ' + (x + width) + ',' + y + ' ' + (x + width) + ',' + (y + height - cut) + ' ' + (x + width - cut * 1.2) + ',' + (y + height) + ' ' + x + ',' + (y + height);
|
31484 | }
|
31485 |
|
31486 | var polygon = elem.append('polygon');
|
31487 | polygon.attr('points', genPoints(txtObject.x, txtObject.y, 50, 20, 7));
|
31488 | polygon.attr('class', 'labelBox');
|
31489 | txtObject.y = txtObject.y + txtObject.labelMargin;
|
31490 | txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
|
31491 | drawText(elem, txtObject);
|
31492 | };
|
31493 | var drawSection = function drawSection(elem, section, conf) {
|
31494 | var g = elem.append('g');
|
31495 | var rect = getNoteRect();
|
31496 | rect.x = section.x;
|
31497 | rect.y = section.y;
|
31498 | rect.fill = section.fill;
|
31499 | rect.width = conf.width;
|
31500 | rect.height = conf.height;
|
31501 | rect.class = 'journey-section section-type-' + section.num;
|
31502 | rect.rx = 3;
|
31503 | rect.ry = 3;
|
31504 | drawRect(g, rect);
|
31505 |
|
31506 | _drawTextCandidateFunc(conf)(section.text, g, rect.x, rect.y, rect.width, rect.height, {
|
31507 | class: 'journey-section section-type-' + section.num
|
31508 | }, conf, section.colour);
|
31509 | };
|
31510 | var taskCount = -1;
|
31511 | /**
|
31512 | * Draws an actor in the diagram with the attaced line
|
31513 | *
|
31514 | * @param {any} elem The HTML element
|
31515 | * @param {any} task The task to render
|
31516 | * @param {any} conf The global configuration
|
31517 | */
|
31518 |
|
31519 | var drawTask = function drawTask(elem, task, conf) {
|
31520 | var center = task.x + conf.width / 2;
|
31521 | var g = elem.append('g');
|
31522 | taskCount++;
|
31523 | var maxHeight = 300 + 5 * 30;
|
31524 | g.append('line').attr('id', 'task' + taskCount).attr('x1', center).attr('y1', task.y).attr('x2', center).attr('y2', maxHeight).attr('class', 'task-line').attr('stroke-width', '1px').attr('stroke-dasharray', '4 2').attr('stroke', '#666');
|
31525 | drawFace(g, {
|
31526 | cx: center,
|
31527 | cy: 300 + (5 - task.score) * 30,
|
31528 | score: task.score
|
31529 | });
|
31530 | var rect = getNoteRect();
|
31531 | rect.x = task.x;
|
31532 | rect.y = task.y;
|
31533 | rect.fill = task.fill;
|
31534 | rect.width = conf.width;
|
31535 | rect.height = conf.height;
|
31536 | rect.class = 'task task-type-' + task.num;
|
31537 | rect.rx = 3;
|
31538 | rect.ry = 3;
|
31539 | drawRect(g, rect);
|
31540 | var xPos = task.x + 14;
|
31541 | task.people.forEach(function (person) {
|
31542 | var colour = task.actors[person].color;
|
31543 | var circle = {
|
31544 | cx: xPos,
|
31545 | cy: task.y,
|
31546 | r: 7,
|
31547 | fill: colour,
|
31548 | stroke: '#000',
|
31549 | title: person,
|
31550 | pos: task.actors[person].position
|
31551 | };
|
31552 | drawCircle(g, circle);
|
31553 | xPos += 10;
|
31554 | });
|
31555 |
|
31556 | _drawTextCandidateFunc(conf)(task.task, g, rect.x, rect.y, rect.width, rect.height, {
|
31557 | class: 'task'
|
31558 | }, conf, task.colour);
|
31559 | };
|
31560 | /**
|
31561 | * Draws a background rectangle
|
31562 | *
|
31563 | * @param {any} elem The html element
|
31564 | * @param {any} bounds The bounds of the drawing
|
31565 | */
|
31566 |
|
31567 | var drawBackgroundRect = function drawBackgroundRect(elem, bounds) {
|
31568 | var rectElem = drawRect(elem, {
|
31569 | x: bounds.startx,
|
31570 | y: bounds.starty,
|
31571 | width: bounds.stopx - bounds.startx,
|
31572 | height: bounds.stopy - bounds.starty,
|
31573 | fill: bounds.fill,
|
31574 | class: 'rect'
|
31575 | });
|
31576 | rectElem.lower();
|
31577 | };
|
31578 | var getTextObj = function getTextObj() {
|
31579 | return {
|
31580 | x: 0,
|
31581 | y: 0,
|
31582 | fill: undefined,
|
31583 | 'text-anchor': 'start',
|
31584 | width: 100,
|
31585 | height: 100,
|
31586 | textMargin: 0,
|
31587 | rx: 0,
|
31588 | ry: 0
|
31589 | };
|
31590 | };
|
31591 | var getNoteRect = function getNoteRect() {
|
31592 | return {
|
31593 | x: 0,
|
31594 | y: 0,
|
31595 | width: 100,
|
31596 | anchor: 'start',
|
31597 | height: 100,
|
31598 | rx: 0,
|
31599 | ry: 0
|
31600 | };
|
31601 | };
|
31602 |
|
31603 | var _drawTextCandidateFunc = function () {
|
31604 | /**
|
31605 | * @param {any} content
|
31606 | * @param {any} g
|
31607 | * @param {any} x
|
31608 | * @param {any} y
|
31609 | * @param {any} width
|
31610 | * @param {any} height
|
31611 | * @param {any} textAttrs
|
31612 | * @param {any} colour
|
31613 | */
|
31614 | function byText(content, g, x, y, width, height, textAttrs, colour) {
|
31615 | var text = g.append('text').attr('x', x + width / 2).attr('y', y + height / 2 + 5).style('font-color', colour).style('text-anchor', 'middle').text(content);
|
31616 |
|
31617 | _setTextAttrs(text, textAttrs);
|
31618 | }
|
31619 | /**
|
31620 | * @param {any} content
|
31621 | * @param {any} g
|
31622 | * @param {any} x
|
31623 | * @param {any} y
|
31624 | * @param {any} width
|
31625 | * @param {any} height
|
31626 | * @param {any} textAttrs
|
31627 | * @param {any} conf
|
31628 | * @param {any} colour
|
31629 | */
|
31630 |
|
31631 |
|
31632 | function byTspan(content, g, x, y, width, height, textAttrs, conf, colour) {
|
31633 | var taskFontSize = conf.taskFontSize,
|
31634 | taskFontFamily = conf.taskFontFamily;
|
31635 | var lines = content.split(/<br\s*\/?>/gi);
|
31636 |
|
31637 | for (var i = 0; i < lines.length; i++) {
|
31638 | var dy = i * taskFontSize - taskFontSize * (lines.length - 1) / 2;
|
31639 | var text = g.append('text').attr('x', x + width / 2).attr('y', y).attr('fill', colour).style('text-anchor', 'middle').style('font-size', taskFontSize).style('font-family', taskFontFamily);
|
31640 | text.append('tspan').attr('x', x + width / 2).attr('dy', dy).text(lines[i]);
|
31641 | text.attr('y', y + height / 2.0).attr('dominant-baseline', 'central').attr('alignment-baseline', 'central');
|
31642 |
|
31643 | _setTextAttrs(text, textAttrs);
|
31644 | }
|
31645 | }
|
31646 | /**
|
31647 | * @param {any} content
|
31648 | * @param {any} g
|
31649 | * @param {any} x
|
31650 | * @param {any} y
|
31651 | * @param {any} width
|
31652 | * @param {any} height
|
31653 | * @param {any} textAttrs
|
31654 | * @param {any} conf
|
31655 | */
|
31656 |
|
31657 |
|
31658 | function byFo(content, g, x, y, width, height, textAttrs, conf) {
|
31659 | var body = g.append('switch');
|
31660 | var f = body.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height).attr('position', 'fixed');
|
31661 | var text = f.append('xhtml:div').style('display', 'table').style('height', '100%').style('width', '100%');
|
31662 | text.append('div').attr('class', 'label').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle').text(content);
|
31663 | byTspan(content, body, x, y, width, height, textAttrs, conf);
|
31664 |
|
31665 | _setTextAttrs(text, textAttrs);
|
31666 | }
|
31667 | /**
|
31668 | * @param {any} toText
|
31669 | * @param {any} fromTextAttrsDict
|
31670 | */
|
31671 |
|
31672 |
|
31673 | function _setTextAttrs(toText, fromTextAttrsDict) {
|
31674 | for (var key in fromTextAttrsDict) {
|
31675 | if (key in fromTextAttrsDict) {
|
31676 | // eslint-disable-line
|
31677 | // noinspection JSUnfilteredForInLoop
|
31678 | toText.attr(key, fromTextAttrsDict[key]);
|
31679 | }
|
31680 | }
|
31681 | }
|
31682 |
|
31683 | return function (conf) {
|
31684 | return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
|
31685 | };
|
31686 | }();
|
31687 |
|
31688 | var initGraphics = function initGraphics(graphics) {
|
31689 | graphics.append('defs').append('marker').attr('id', 'arrowhead').attr('refX', 5).attr('refY', 2).attr('markerWidth', 6).attr('markerHeight', 4).attr('orient', 'auto').append('path').attr('d', 'M 0,0 V 4 L6,2 Z'); // this is actual shape for arrowhead
|
31690 | };
|
31691 |
|
31692 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
31693 | drawRect: drawRect,
|
31694 | drawCircle: drawCircle,
|
31695 | drawSection: drawSection,
|
31696 | drawText: drawText,
|
31697 | drawLabel: drawLabel,
|
31698 | drawTask: drawTask,
|
31699 | drawBackgroundRect: drawBackgroundRect,
|
31700 | getTextObj: getTextObj,
|
31701 | getNoteRect: getNoteRect,
|
31702 | initGraphics: initGraphics
|
31703 | });
|
31704 |
|
31705 | /***/ }),
|
31706 |
|
31707 | /***/ "./src/errorRenderer.js":
|
31708 | /*!******************************!*\
|
31709 | !*** ./src/errorRenderer.js ***!
|
31710 | \******************************/
|
31711 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
31712 |
|
31713 | "use strict";
|
31714 | __webpack_require__.r(__webpack_exports__);
|
31715 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
31716 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
31717 | /* harmony export */ "draw": () => (/* binding */ draw),
|
31718 | /* harmony export */ "setConf": () => (/* binding */ setConf)
|
31719 | /* harmony export */ });
|
31720 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
31721 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
31722 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
|
31723 | /** Created by knut on 14-12-11. */
|
31724 |
|
31725 |
|
31726 | var conf = {};
|
31727 | /**
|
31728 | * Merges the value of `conf` with the passed `cnf`
|
31729 | *
|
31730 | * @param {object} cnf Config to merge
|
31731 | */
|
31732 |
|
31733 | var setConf = function setConf(cnf) {
|
31734 | var keys = Object.keys(cnf);
|
31735 | keys.forEach(function (key) {
|
31736 | conf[key] = cnf[key];
|
31737 | });
|
31738 | };
|
31739 | /**
|
31740 | * Draws a an info picture in the tag with id: id based on the graph definition in text.
|
31741 | *
|
31742 | * @param {string} id The text for the error
|
31743 | * @param {string} ver The version
|
31744 | */
|
31745 |
|
31746 | var draw = function draw(id, ver) {
|
31747 | try {
|
31748 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Renering svg for syntax error\n');
|
31749 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + id);
|
31750 | var g = svg.append('g');
|
31751 | g.append('path').attr('class', 'error-icon').attr('d', 'm411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z');
|
31752 | g.append('path').attr('class', 'error-icon').attr('d', 'm459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z');
|
31753 | g.append('path').attr('class', 'error-icon').attr('d', 'm340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z');
|
31754 | g.append('path').attr('class', 'error-icon').attr('d', 'm400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z');
|
31755 | g.append('path').attr('class', 'error-icon').attr('d', 'm496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z');
|
31756 | g.append('path').attr('class', 'error-icon').attr('d', 'm436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z');
|
31757 | g.append('text') // text label for the x axis
|
31758 | .attr('class', 'error-text').attr('x', 1240).attr('y', 250).attr('font-size', '150px').style('text-anchor', 'middle').text('Syntax error in graph');
|
31759 | g.append('text') // text label for the x axis
|
31760 | .attr('class', 'error-text').attr('x', 1050).attr('y', 400).attr('font-size', '100px').style('text-anchor', 'middle').text('mermaid version ' + ver);
|
31761 | svg.attr('height', 100);
|
31762 | svg.attr('width', 400);
|
31763 | svg.attr('viewBox', '768 0 512 512');
|
31764 | } catch (e) {
|
31765 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('Error while rendering info diagram');
|
31766 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error(e.message);
|
31767 | }
|
31768 | };
|
31769 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
31770 | setConf: setConf,
|
31771 | draw: draw
|
31772 | });
|
31773 |
|
31774 | /***/ }),
|
31775 |
|
31776 | /***/ "./src/interactionDb.js":
|
31777 | /*!******************************!*\
|
31778 | !*** ./src/interactionDb.js ***!
|
31779 | \******************************/
|
31780 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
31781 |
|
31782 | "use strict";
|
31783 | __webpack_require__.r(__webpack_exports__);
|
31784 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
31785 | /* harmony export */ "addFunction": () => (/* binding */ addFunction),
|
31786 | /* harmony export */ "attachFunctions": () => (/* binding */ attachFunctions)
|
31787 | /* harmony export */ });
|
31788 | var interactionFunctions = [];
|
31789 | var addFunction = function addFunction(func) {
|
31790 | interactionFunctions.push(func);
|
31791 | };
|
31792 | var attachFunctions = function attachFunctions() {
|
31793 | interactionFunctions.forEach(function (f) {
|
31794 | f();
|
31795 | });
|
31796 | interactionFunctions = [];
|
31797 | };
|
31798 |
|
31799 | /***/ }),
|
31800 |
|
31801 | /***/ "./src/logger.js":
|
31802 | /*!***********************!*\
|
31803 | !*** ./src/logger.js ***!
|
31804 | \***********************/
|
31805 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
31806 |
|
31807 | "use strict";
|
31808 | __webpack_require__.r(__webpack_exports__);
|
31809 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
31810 | /* harmony export */ "LEVELS": () => (/* binding */ LEVELS),
|
31811 | /* harmony export */ "log": () => (/* binding */ log),
|
31812 | /* harmony export */ "setLogLevel": () => (/* binding */ setLogLevel)
|
31813 | /* harmony export */ });
|
31814 | /* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment-mini */ "moment-mini");
|
31815 | /* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_mini__WEBPACK_IMPORTED_MODULE_0__);
|
31816 |
|
31817 | /** @typedef {'debug' | 'info' | 'warn' | 'error' | 'fatal'} LogLevel A log level */
|
31818 |
|
31819 | /** @type {Object<LogLevel, number>} */
|
31820 |
|
31821 | var LEVELS = {
|
31822 | debug: 1,
|
31823 | info: 2,
|
31824 | warn: 3,
|
31825 | error: 4,
|
31826 | fatal: 5
|
31827 | };
|
31828 | var log = {
|
31829 | debug: function debug() {},
|
31830 | info: function info() {},
|
31831 | warn: function warn() {},
|
31832 | error: function error() {},
|
31833 | fatal: function fatal() {}
|
31834 | };
|
31835 | /**
|
31836 | * Sets a log level
|
31837 | *
|
31838 | * @param {LogLevel} [level="fatal"] The level to set the logging to. Default is `"fatal"`
|
31839 | */
|
31840 |
|
31841 | var setLogLevel = function setLogLevel() {
|
31842 | var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'fatal';
|
31843 |
|
31844 | if (isNaN(level)) {
|
31845 | level = level.toLowerCase();
|
31846 |
|
31847 | if (LEVELS[level] !== undefined) {
|
31848 | level = LEVELS[level];
|
31849 | }
|
31850 | }
|
31851 |
|
31852 | log.trace = function () {};
|
31853 |
|
31854 | log.debug = function () {};
|
31855 |
|
31856 | log.info = function () {};
|
31857 |
|
31858 | log.warn = function () {};
|
31859 |
|
31860 | log.error = function () {};
|
31861 |
|
31862 | log.fatal = function () {};
|
31863 |
|
31864 | if (level <= LEVELS.fatal) {
|
31865 | log.fatal = console.error ? console.error.bind(console, format('FATAL'), 'color: orange') : console.log.bind(console, '\x1b[35m', format('FATAL'));
|
31866 | }
|
31867 |
|
31868 | if (level <= LEVELS.error) {
|
31869 | log.error = console.error ? console.error.bind(console, format('ERROR'), 'color: orange') : console.log.bind(console, '\x1b[31m', format('ERROR'));
|
31870 | }
|
31871 |
|
31872 | if (level <= LEVELS.warn) {
|
31873 | log.warn = console.warn ? console.warn.bind(console, format('WARN'), 'color: orange') : console.log.bind(console, "\x1B[33m", format('WARN'));
|
31874 | }
|
31875 |
|
31876 | if (level <= LEVELS.info) {
|
31877 | log.info = console.info // ? console.info.bind(console, '\x1b[34m', format('INFO'), 'color: blue')
|
31878 | ? console.info.bind(console, format('INFO'), 'color: lightblue') : console.log.bind(console, '\x1b[34m', format('INFO'));
|
31879 | }
|
31880 |
|
31881 | if (level <= LEVELS.debug) {
|
31882 | log.debug = console.debug ? console.debug.bind(console, format('DEBUG'), 'color: lightgreen') : console.log.bind(console, '\x1b[32m', format('DEBUG'));
|
31883 | }
|
31884 | };
|
31885 | /**
|
31886 | * Returns a format with the timestamp and the log level
|
31887 | *
|
31888 | * @param {LogLevel} level The level for the log format
|
31889 | * @returns {string} The format with the timestamp and log level
|
31890 | */
|
31891 |
|
31892 | var format = function format(level) {
|
31893 | var time = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()().format('ss.SSS');
|
31894 | return "%c".concat(time, " : ").concat(level, " : ");
|
31895 | };
|
31896 |
|
31897 | /***/ }),
|
31898 |
|
31899 | /***/ "./src/mermaid.js":
|
31900 | /*!************************!*\
|
31901 | !*** ./src/mermaid.js ***!
|
31902 | \************************/
|
31903 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
31904 |
|
31905 | "use strict";
|
31906 | __webpack_require__.r(__webpack_exports__);
|
31907 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
31908 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
31909 | /* harmony export */ });
|
31910 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
|
31911 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mermaidAPI */ "./src/mermaidAPI.js");
|
31912 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
|
31913 | /**
|
31914 | * Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid
|
31915 | * functionality and to render the diagrams to svg code.
|
31916 | */
|
31917 |
|
31918 |
|
31919 |
|
31920 | /**
|
31921 | * ## init
|
31922 | *
|
31923 | * Function that goes through the document to find the chart definitions in there and render them.
|
31924 | *
|
31925 | * The function tags the processed attributes with the attribute data-processed and ignores found
|
31926 | * elements with the attribute already set. This way the init function can be triggered several times.
|
31927 | *
|
31928 | * Optionally, `init` can accept in the second argument one of the following:
|
31929 | *
|
31930 | * - A DOM Node
|
31931 | * - An array of DOM nodes (as would come from a jQuery selector)
|
31932 | * - A W3C selector, a la `.mermaid`
|
31933 | *
|
31934 | * ```mermaid
|
31935 | * graph LR;
|
31936 | * a(Find elements)-->b{Processed}
|
31937 | * b-->|Yes|c(Leave element)
|
31938 | * b-->|No |d(Transform)
|
31939 | * ```
|
31940 | *
|
31941 | * Renders the mermaid diagrams
|
31942 | */
|
31943 |
|
31944 | var init = function init() {
|
31945 | try {
|
31946 | initThrowsErrors.apply(void 0, arguments);
|
31947 | } catch (e) {
|
31948 | _logger__WEBPACK_IMPORTED_MODULE_0__.log.warn('Syntax Error rendering');
|
31949 | _logger__WEBPACK_IMPORTED_MODULE_0__.log.warn(e.str);
|
31950 |
|
31951 | if (this.parseError) {
|
31952 | this.parseError(e);
|
31953 | }
|
31954 | }
|
31955 | };
|
31956 |
|
31957 | var initThrowsErrors = function initThrowsErrors() {
|
31958 | var conf = _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].getConfig(); // console.log('Starting rendering diagrams (init) - mermaid.init', conf);
|
31959 |
|
31960 | var nodes;
|
31961 |
|
31962 | if (arguments.length >= 2) {
|
31963 | /*! sequence config was passed as #1 */
|
31964 | if (typeof arguments[0] !== 'undefined') {
|
31965 | mermaid.sequenceConfig = arguments[0];
|
31966 | }
|
31967 |
|
31968 | nodes = arguments[1];
|
31969 | } else {
|
31970 | nodes = arguments[0];
|
31971 | } // if last argument is a function this is the callback function
|
31972 |
|
31973 |
|
31974 | var callback;
|
31975 |
|
31976 | if (typeof arguments[arguments.length - 1] === 'function') {
|
31977 | callback = arguments[arguments.length - 1];
|
31978 | _logger__WEBPACK_IMPORTED_MODULE_0__.log.debug('Callback function found');
|
31979 | } else {
|
31980 | if (typeof conf.mermaid !== 'undefined') {
|
31981 | if (typeof conf.mermaid.callback === 'function') {
|
31982 | callback = conf.mermaid.callback;
|
31983 | _logger__WEBPACK_IMPORTED_MODULE_0__.log.debug('Callback function found');
|
31984 | } else {
|
31985 | _logger__WEBPACK_IMPORTED_MODULE_0__.log.debug('No Callback function found');
|
31986 | }
|
31987 | }
|
31988 | }
|
31989 |
|
31990 | nodes = nodes === undefined ? document.querySelectorAll('.mermaid') : typeof nodes === 'string' ? document.querySelectorAll(nodes) : nodes instanceof window.Node ? [nodes] : nodes; // Last case - sequence config was passed pick next
|
31991 |
|
31992 | _logger__WEBPACK_IMPORTED_MODULE_0__.log.debug('Start On Load before: ' + mermaid.startOnLoad);
|
31993 |
|
31994 | if (typeof mermaid.startOnLoad !== 'undefined') {
|
31995 | _logger__WEBPACK_IMPORTED_MODULE_0__.log.debug('Start On Load inner: ' + mermaid.startOnLoad);
|
31996 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].updateSiteConfig({
|
31997 | startOnLoad: mermaid.startOnLoad
|
31998 | });
|
31999 | }
|
32000 |
|
32001 | if (typeof mermaid.ganttConfig !== 'undefined') {
|
32002 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].updateSiteConfig({
|
32003 | gantt: mermaid.ganttConfig
|
32004 | });
|
32005 | }
|
32006 |
|
32007 | var idGenerator = new _utils__WEBPACK_IMPORTED_MODULE_2__["default"].initIdGenerator(conf.deterministicIds, conf.deterministicIDSeed);
|
32008 | var txt;
|
32009 |
|
32010 | var _loop = function _loop(i) {
|
32011 | // element is the current div with mermaid class
|
32012 | var element = nodes[i];
|
32013 | /*! Check if previously processed */
|
32014 |
|
32015 | if (!element.getAttribute('data-processed')) {
|
32016 | element.setAttribute('data-processed', true);
|
32017 | } else {
|
32018 | return "continue";
|
32019 | }
|
32020 |
|
32021 | var id = "mermaid-".concat(idGenerator.next()); // Fetch the graph definition including tags
|
32022 |
|
32023 | txt = element.innerHTML; // transforms the html to pure text
|
32024 |
|
32025 | txt = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].entityDecode(txt).trim().replace(/<br\s*\/?>/gi, '<br/>');
|
32026 | var init = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].detectInit(txt);
|
32027 |
|
32028 | if (init) {
|
32029 | _logger__WEBPACK_IMPORTED_MODULE_0__.log.debug('Detected early reinit: ', init);
|
32030 | }
|
32031 |
|
32032 | try {
|
32033 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].render(id, txt, function (svgCode, bindFunctions) {
|
32034 | element.innerHTML = svgCode;
|
32035 |
|
32036 | if (typeof callback !== 'undefined') {
|
32037 | callback(id);
|
32038 | }
|
32039 |
|
32040 | if (bindFunctions) bindFunctions(element);
|
32041 | }, element);
|
32042 | } catch (error) {
|
32043 | _logger__WEBPACK_IMPORTED_MODULE_0__.log.warn('Catching Error (bootstrap)');
|
32044 | throw {
|
32045 | error: error,
|
32046 | message: error.str
|
32047 | };
|
32048 | }
|
32049 | };
|
32050 |
|
32051 | for (var i = 0; i < nodes.length; i++) {
|
32052 | var _ret = _loop(i);
|
32053 |
|
32054 | if (_ret === "continue") continue;
|
32055 | }
|
32056 | };
|
32057 |
|
32058 | var initialize = function initialize(config) {
|
32059 | // mermaidAPI.reset();
|
32060 | if (typeof config.mermaid !== 'undefined') {
|
32061 | if (typeof config.mermaid.startOnLoad !== 'undefined') {
|
32062 | mermaid.startOnLoad = config.mermaid.startOnLoad;
|
32063 | }
|
32064 |
|
32065 | if (typeof config.mermaid.htmlLabels !== 'undefined') {
|
32066 | mermaid.htmlLabels = config.mermaid.htmlLabels === 'false' || config.mermaid.htmlLabels === false ? false : true;
|
32067 | }
|
32068 | }
|
32069 |
|
32070 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].initialize(config); // mermaidAPI.reset();
|
32071 | };
|
32072 | /**
|
32073 | * ##contentLoaded Callback function that is called when page is loaded. This functions fetches
|
32074 | * configuration for mermaid rendering and calls init for rendering the mermaid diagrams on the page.
|
32075 | */
|
32076 |
|
32077 |
|
32078 | var contentLoaded = function contentLoaded() {
|
32079 | var config;
|
32080 |
|
32081 | if (mermaid.startOnLoad) {
|
32082 | // No config found, do check API config
|
32083 | config = _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].getConfig();
|
32084 |
|
32085 | if (config.startOnLoad) {
|
32086 | mermaid.init();
|
32087 | }
|
32088 | } else {
|
32089 | if (typeof mermaid.startOnLoad === 'undefined') {
|
32090 | _logger__WEBPACK_IMPORTED_MODULE_0__.log.debug('In start, no config');
|
32091 | config = _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].getConfig();
|
32092 |
|
32093 | if (config.startOnLoad) {
|
32094 | mermaid.init();
|
32095 | }
|
32096 | }
|
32097 | }
|
32098 | };
|
32099 |
|
32100 | if (typeof document !== 'undefined') {
|
32101 | /*!
|
32102 | * Wait for document loaded before starting the execution
|
32103 | */
|
32104 | window.addEventListener('load', function () {
|
32105 | contentLoaded();
|
32106 | }, false);
|
32107 | }
|
32108 | /**
|
32109 | * ## setParseErrorHandler Alternative to directly setting parseError using:
|
32110 | *
|
32111 | * ```js
|
32112 | * mermaid.parseError = function(err,hash){=
|
32113 | * forExampleDisplayErrorInGui(err); // do something with the error
|
32114 | * };
|
32115 | * ```
|
32116 | *
|
32117 | * This is provided for environments where the mermaid object can't directly have a new member added
|
32118 | * to it (eg. dart interop wrapper). (Initially there is no parseError member of mermaid).
|
32119 | *
|
32120 | * @param {function (err, hash)} newParseErrorHandler New parseError() callback.
|
32121 | */
|
32122 |
|
32123 |
|
32124 | var setParseErrorHandler = function setParseErrorHandler(newParseErrorHandler) {
|
32125 | mermaid.parseError = newParseErrorHandler;
|
32126 | };
|
32127 |
|
32128 | var mermaid = {
|
32129 | startOnLoad: true,
|
32130 | htmlLabels: true,
|
32131 | diagrams: {},
|
32132 | mermaidAPI: _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"],
|
32133 | parse: _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"] != undefined ? _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].parse : null,
|
32134 | render: _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"] != undefined ? _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].render : null,
|
32135 | init: init,
|
32136 | initThrowsErrors: initThrowsErrors,
|
32137 | initialize: initialize,
|
32138 | contentLoaded: contentLoaded,
|
32139 | setParseErrorHandler: setParseErrorHandler
|
32140 | };
|
32141 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (mermaid);
|
32142 |
|
32143 | /***/ }),
|
32144 |
|
32145 | /***/ "./src/mermaidAPI.js":
|
32146 | /*!***************************!*\
|
32147 | !*** ./src/mermaidAPI.js ***!
|
32148 | \***************************/
|
32149 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
32150 |
|
32151 | "use strict";
|
32152 | __webpack_require__.r(__webpack_exports__);
|
32153 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
32154 | /* harmony export */ "decodeEntities": () => (/* binding */ decodeEntities),
|
32155 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
32156 | /* harmony export */ "encodeEntities": () => (/* binding */ encodeEntities)
|
32157 | /* harmony export */ });
|
32158 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
32159 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
32160 | /* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! stylis */ "stylis");
|
32161 | /* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(stylis__WEBPACK_IMPORTED_MODULE_1__);
|
32162 | /* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../package.json */ "./package.json");
|
32163 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./config */ "./src/config.js");
|
32164 | /* harmony import */ var _diagram_api_diagram_orchestration__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./diagram-api/diagram-orchestration */ "./src/diagram-api/diagram-orchestration.js");
|
32165 | /* harmony import */ var _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./diagrams/class/classDb */ "./src/diagrams/class/classDb.js");
|
32166 | /* harmony import */ var _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./diagrams/flowchart/flowDb */ "./src/diagrams/flowchart/flowDb.js");
|
32167 | /* harmony import */ var _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./diagrams/flowchart/flowRenderer */ "./src/diagrams/flowchart/flowRenderer.js");
|
32168 | /* harmony import */ var _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./diagrams/flowchart/flowRenderer-v2 */ "./src/diagrams/flowchart/flowRenderer-v2.js");
|
32169 | /* harmony import */ var _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./diagrams/gantt/ganttDb */ "./src/diagrams/gantt/ganttDb.js");
|
32170 | /* harmony import */ var _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./diagrams/gantt/ganttRenderer */ "./src/diagrams/gantt/ganttRenderer.js");
|
32171 | /* harmony import */ var _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./diagrams/sequence/sequenceRenderer */ "./src/diagrams/sequence/sequenceRenderer.js");
|
32172 | /* harmony import */ var _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./diagrams/state/stateRenderer */ "./src/diagrams/state/stateRenderer.js");
|
32173 | /* harmony import */ var _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./diagrams/state/stateRenderer-v2 */ "./src/diagrams/state/stateRenderer-v2.js");
|
32174 | /* harmony import */ var _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./diagrams/user-journey/journeyRenderer */ "./src/diagrams/user-journey/journeyRenderer.js");
|
32175 | /* harmony import */ var _Diagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Diagram */ "./src/Diagram.js");
|
32176 | /* harmony import */ var _errorRenderer__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./errorRenderer */ "./src/errorRenderer.js");
|
32177 | /* harmony import */ var _interactionDb__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./interactionDb */ "./src/interactionDb.js");
|
32178 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
|
32179 | /* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./styles */ "./src/styles.js");
|
32180 | /* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
|
32181 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
|
32182 | /* harmony import */ var _assignWithDepth__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./assignWithDepth */ "./src/assignWithDepth.js");
|
32183 | /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dompurify */ "dompurify");
|
32184 | /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(dompurify__WEBPACK_IMPORTED_MODULE_2__);
|
32185 | /* harmony import */ var _mermaid__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./mermaid */ "./src/mermaid.js");
|
32186 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
32187 |
|
32188 | /**
|
32189 | * Edit this
|
32190 | * Page[[N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/src/mermaidAPI.js)
|
32191 | *
|
32192 | * This is the API to be used when optionally handling the integration with the web page, instead of
|
32193 | * using the default integration provided by mermaid.js.
|
32194 | *
|
32195 | * The core of this api is the [**render**](Setup.md?id=render) function which, given a graph
|
32196 | * definition as text, renders the graph/diagram and returns an svg element for the graph.
|
32197 | *
|
32198 | * It is is then up to the user of the API to make use of the svg, either insert it somewhere in the
|
32199 | * page or do something completely different.
|
32200 | *
|
32201 | * In addition to the render function, a number of behavioral configuration options are available.
|
32202 | *
|
32203 | * @name mermaidAPI
|
32204 | */
|
32205 |
|
32206 |
|
32207 |
|
32208 |
|
32209 |
|
32210 |
|
32211 |
|
32212 |
|
32213 |
|
32214 |
|
32215 |
|
32216 |
|
32217 |
|
32218 |
|
32219 |
|
32220 |
|
32221 |
|
32222 |
|
32223 |
|
32224 |
|
32225 |
|
32226 |
|
32227 |
|
32228 |
|
32229 |
|
32230 | /**
|
32231 | * @param text
|
32232 | * @param dia
|
32233 | * @returns {any}
|
32234 | */
|
32235 |
|
32236 | function parse(text, dia) {
|
32237 | var parseEncounteredException = false;
|
32238 |
|
32239 | try {
|
32240 | var diag = dia ? dia : new _Diagram__WEBPACK_IMPORTED_MODULE_3__["default"](text);
|
32241 | diag.db.clear();
|
32242 | return diag.parse(text);
|
32243 | } catch (error) {
|
32244 | parseEncounteredException = true; // Is this the correct way to access mermiad's parseError()
|
32245 | // method ? (or global.mermaid.parseError()) ?
|
32246 |
|
32247 | if (_mermaid__WEBPACK_IMPORTED_MODULE_4__["default"].parseError) {
|
32248 | if (error.str != undefined) {
|
32249 | // handle case where error string and hash were
|
32250 | // wrapped in object like`const error = { str, hash };`
|
32251 | _mermaid__WEBPACK_IMPORTED_MODULE_4__["default"].parseError(error.str, error.hash);
|
32252 | } else {
|
32253 | // assume it is just error string and pass it on
|
32254 | _mermaid__WEBPACK_IMPORTED_MODULE_4__["default"].parseError(error);
|
32255 | }
|
32256 | } else {
|
32257 | // No mermaid.parseError() handler defined, so re-throw it
|
32258 | throw error;
|
32259 | }
|
32260 | }
|
32261 |
|
32262 | return !parseEncounteredException;
|
32263 | }
|
32264 |
|
32265 | var encodeEntities = function encodeEntities(text) {
|
32266 | var txt = text;
|
32267 | txt = txt.replace(/style.*:\S*#.*;/g, function (s) {
|
32268 | var innerTxt = s.substring(0, s.length - 1);
|
32269 | return innerTxt;
|
32270 | });
|
32271 | txt = txt.replace(/classDef.*:\S*#.*;/g, function (s) {
|
32272 | var innerTxt = s.substring(0, s.length - 1);
|
32273 | return innerTxt;
|
32274 | });
|
32275 | txt = txt.replace(/#\w+;/g, function (s) {
|
32276 | var innerTxt = s.substring(1, s.length - 1);
|
32277 | var isInt = /^\+?\d+$/.test(innerTxt);
|
32278 |
|
32279 | if (isInt) {
|
32280 | return 'fl°°' + innerTxt + '¶ß';
|
32281 | } else {
|
32282 | return 'fl°' + innerTxt + '¶ß';
|
32283 | }
|
32284 | });
|
32285 | return txt;
|
32286 | };
|
32287 | var decodeEntities = function decodeEntities(text) {
|
32288 | var txt = text;
|
32289 | txt = txt.replace(/fl°°/g, function () {
|
32290 | return '&#';
|
32291 | });
|
32292 | txt = txt.replace(/fl°/g, function () {
|
32293 | return '&';
|
32294 | });
|
32295 | txt = txt.replace(/¶ß/g, function () {
|
32296 | return ';';
|
32297 | });
|
32298 | return txt;
|
32299 | };
|
32300 | /**
|
32301 | * Function that renders an svg with a graph from a chart definition. Usage example below.
|
32302 | *
|
32303 | * ```javascript
|
32304 | * mermaidAPI.initialize({
|
32305 | * startOnLoad: true,
|
32306 | * });
|
32307 | * $(function () {
|
32308 | * const graphDefinition = 'graph TB\na-->b';
|
32309 | * const cb = function (svgGraph) {
|
32310 | * console.log(svgGraph);
|
32311 | * };
|
32312 | * mermaidAPI.render('id1', graphDefinition, cb);
|
32313 | * });
|
32314 | * ```
|
32315 | *
|
32316 | * @param {any} id The id of the element to be rendered
|
32317 | * @param {any} _txt The graph definition
|
32318 | * @param {any} cb Callback which is called after rendering is finished with the svg code as inparam.
|
32319 | * @param {any} container Selector to element in which a div with the graph temporarily will be
|
32320 | * inserted. In one is provided a hidden div will be inserted in the body of the page instead. The
|
32321 | * element will be removed when rendering is completed.
|
32322 | * @returns {any}
|
32323 | */
|
32324 |
|
32325 | var render = function render(id, _txt, cb, container) {
|
32326 | _config__WEBPACK_IMPORTED_MODULE_5__.reset();
|
32327 |
|
32328 | var txt = _txt.replace(/\r\n?/g, '\n'); // parser problems on CRLF ignore all CR and leave LF;;
|
32329 |
|
32330 |
|
32331 | var graphInit = _utils__WEBPACK_IMPORTED_MODULE_6__["default"].detectInit(txt);
|
32332 |
|
32333 | if (graphInit) {
|
32334 | (0,_utils__WEBPACK_IMPORTED_MODULE_6__.directiveSanitizer)(graphInit);
|
32335 | _config__WEBPACK_IMPORTED_MODULE_5__.addDirective(graphInit);
|
32336 | }
|
32337 |
|
32338 | var cnf = _config__WEBPACK_IMPORTED_MODULE_5__.getConfig();
|
32339 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.debug(cnf); // Check the maximum allowed text size
|
32340 |
|
32341 | if (_txt.length > cnf.maxTextSize) {
|
32342 | txt = 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';
|
32343 | }
|
32344 |
|
32345 | var root = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body'); // In regular execution the container will be the div with a mermaid class
|
32346 |
|
32347 | if (typeof container !== 'undefined') {
|
32348 | if (cnf.securityLevel === 'sandbox') {
|
32349 | // IF we are in sandboxed mode, we do everyting mermaid related
|
32350 | // in a sandboxed div
|
32351 | var iframe = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body').append('iframe').attr('id', 'i' + id).attr('style', 'width: 100%; height: 100%;').attr('sandbox', '');
|
32352 | root = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(iframe.nodes()[0].contentDocument.body);
|
32353 | root.node().style.margin = 0;
|
32354 | } // A container was provided by the caller
|
32355 |
|
32356 |
|
32357 | container.innerHTML = '';
|
32358 |
|
32359 | if (cnf.securityLevel === 'sandbox') {
|
32360 | // IF we are in sandboxed mode, we do everyting mermaid related
|
32361 | // in a sandboxed div
|
32362 | var _iframe = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(container).append('iframe').attr('id', 'i' + id).attr('style', 'width: 100%; height: 100%;').attr('sandbox', ''); // const iframeBody = ;
|
32363 |
|
32364 |
|
32365 | root = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(_iframe.nodes()[0].contentDocument.body);
|
32366 | root.node().style.margin = 0;
|
32367 | } else {
|
32368 | root = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(container);
|
32369 | }
|
32370 |
|
32371 | root.append('div').attr('id', 'd' + id).attr('style', 'font-family: ' + cnf.fontFamily).append('svg').attr('id', id).attr('width', '100%').attr('xmlns', 'http://www.w3.org/2000/svg').attr('xmlns:xlink', 'http://www.w3.org/1999/xlink').append('g');
|
32372 | } else {
|
32373 | // No container was provided
|
32374 | // If there is an existsing element with the id, we remove it
|
32375 | // this likely a previously rendered diagram
|
32376 | var existingSvg = document.getElementById(id);
|
32377 |
|
32378 | if (existingSvg) {
|
32379 | existingSvg.remove();
|
32380 | } // Remove previous tpm element if it exists
|
32381 |
|
32382 |
|
32383 | var _element;
|
32384 |
|
32385 | if (cnf.securityLevel !== 'sandbox') {
|
32386 | _element = document.querySelector('#' + 'd' + id);
|
32387 | } else {
|
32388 | _element = document.querySelector('#' + 'i' + id);
|
32389 | }
|
32390 |
|
32391 | if (_element) {
|
32392 | _element.remove();
|
32393 | } // Add the tmp div used for rendering with the id `d${id}`
|
32394 | // d+id it will contain a svg with the id "id"
|
32395 |
|
32396 |
|
32397 | if (cnf.securityLevel === 'sandbox') {
|
32398 | // IF we are in sandboxed mode, we do everyting mermaid related
|
32399 | // in a sandboxed div
|
32400 | var _iframe2 = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body').append('iframe').attr('id', 'i' + id).attr('style', 'width: 100%; height: 100%;').attr('sandbox', '');
|
32401 |
|
32402 | root = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(_iframe2.nodes()[0].contentDocument.body);
|
32403 | root.node().style.margin = 0;
|
32404 | } else {
|
32405 | root = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body');
|
32406 | } // This is the temporary div
|
32407 |
|
32408 |
|
32409 | root.append('div').attr('id', 'd' + id) // this is the seed of the svg to be rendered
|
32410 | .append('svg').attr('id', id).attr('width', '100%').attr('xmlns', 'http://www.w3.org/2000/svg').append('g');
|
32411 | }
|
32412 |
|
32413 | txt = encodeEntities(txt); // Important that we do not create the diagram until after the directives have been included
|
32414 |
|
32415 | var diag = new _Diagram__WEBPACK_IMPORTED_MODULE_3__["default"](txt); // Get the tmp element containing the the svg
|
32416 |
|
32417 | var element = root.select('#d' + id).node();
|
32418 | var graphType = diag.type; // insert inline style into svg
|
32419 |
|
32420 | var svg = element.firstChild;
|
32421 | var firstChild = svg.firstChild;
|
32422 | var userStyles = ''; // user provided theme CSS
|
32423 | // If you add more configuration driven data into the user styles make sure that the value is
|
32424 | // sanitized bye the santiizeCSS function
|
32425 |
|
32426 | if (cnf.themeCSS !== undefined) {
|
32427 | userStyles += "\n".concat(cnf.themeCSS);
|
32428 | } // user provided theme CSS
|
32429 |
|
32430 |
|
32431 | if (cnf.fontFamily !== undefined) {
|
32432 | userStyles += "\n:root { --mermaid-font-family: ".concat(cnf.fontFamily, "}");
|
32433 | } // user provided theme CSS
|
32434 |
|
32435 |
|
32436 | if (cnf.altFontFamily !== undefined) {
|
32437 | userStyles += "\n:root { --mermaid-alt-font-family: ".concat(cnf.altFontFamily, "}");
|
32438 | } // classDef
|
32439 |
|
32440 |
|
32441 | if (graphType === 'flowchart' || graphType === 'flowchart-v2' || graphType === 'graph') {
|
32442 | var classes = _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_8__["default"].getClasses(txt, diag);
|
32443 | var htmlLabels = cnf.htmlLabels || cnf.flowchart.htmlLabels;
|
32444 |
|
32445 | for (var className in classes) {
|
32446 | if (htmlLabels) {
|
32447 | userStyles += "\n.".concat(className, " > * { ").concat(classes[className].styles.join(' !important; '), " !important; }");
|
32448 | userStyles += "\n.".concat(className, " span { ").concat(classes[className].styles.join(' !important; '), " !important; }");
|
32449 | } else {
|
32450 | userStyles += "\n.".concat(className, " path { ").concat(classes[className].styles.join(' !important; '), " !important; }");
|
32451 | userStyles += "\n.".concat(className, " rect { ").concat(classes[className].styles.join(' !important; '), " !important; }");
|
32452 | userStyles += "\n.".concat(className, " polygon { ").concat(classes[className].styles.join(' !important; '), " !important; }");
|
32453 | userStyles += "\n.".concat(className, " ellipse { ").concat(classes[className].styles.join(' !important; '), " !important; }");
|
32454 | userStyles += "\n.".concat(className, " circle { ").concat(classes[className].styles.join(' !important; '), " !important; }");
|
32455 |
|
32456 | if (classes[className].textStyles) {
|
32457 | userStyles += "\n.".concat(className, " tspan { ").concat(classes[className].textStyles.join(' !important; '), " !important; }");
|
32458 | }
|
32459 | }
|
32460 | }
|
32461 | }
|
32462 |
|
32463 | var stylis = function stylis(selector, styles) {
|
32464 | return (0,stylis__WEBPACK_IMPORTED_MODULE_1__.serialize)((0,stylis__WEBPACK_IMPORTED_MODULE_1__.compile)("".concat(selector, "{").concat(styles, "}")), stylis__WEBPACK_IMPORTED_MODULE_1__.stringify);
|
32465 | };
|
32466 |
|
32467 | var rules = stylis("#".concat(id), (0,_styles__WEBPACK_IMPORTED_MODULE_9__["default"])(graphType, userStyles, cnf.themeVariables));
|
32468 | var style1 = document.createElement('style');
|
32469 | style1.innerHTML = "#".concat(id, " ") + rules;
|
32470 | svg.insertBefore(style1, firstChild);
|
32471 |
|
32472 | try {
|
32473 | diag.renderer.draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_10__.version, diag);
|
32474 | } catch (e) {
|
32475 | _errorRenderer__WEBPACK_IMPORTED_MODULE_11__["default"].draw(id, _package_json__WEBPACK_IMPORTED_MODULE_10__.version);
|
32476 | throw e;
|
32477 | }
|
32478 |
|
32479 | root.select("[id=\"".concat(id, "\"]")).selectAll('foreignobject > *').attr('xmlns', 'http://www.w3.org/1999/xhtml'); // Fix for when the base tag is used
|
32480 |
|
32481 | var svgCode = root.select('#d' + id).node().innerHTML;
|
32482 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.debug('cnf.arrowMarkerAbsolute', cnf.arrowMarkerAbsolute);
|
32483 |
|
32484 | if ((!cnf.arrowMarkerAbsolute || cnf.arrowMarkerAbsolute === 'false') && cnf.arrowMarkerAbsolute !== 'sandbox') {
|
32485 | svgCode = svgCode.replace(/marker-end="url\(.*?#/g, 'marker-end="url(#', 'g');
|
32486 | }
|
32487 |
|
32488 | svgCode = decodeEntities(svgCode); // Fix for when the br tag is used
|
32489 |
|
32490 | svgCode = svgCode.replace(/<br>/g, '<br/>');
|
32491 |
|
32492 | if (cnf.securityLevel === 'sandbox') {
|
32493 | var svgEl = root.select('#d' + id + ' svg').node();
|
32494 | var width = '100%';
|
32495 | var height = '100%';
|
32496 |
|
32497 | if (svgEl) {
|
32498 | height = svgEl.viewBox.baseVal.height + 'px';
|
32499 | }
|
32500 |
|
32501 | svgCode = "<iframe style=\"width:".concat(width, ";height:").concat(height, ";border:0;margin:0;\" src=\"data:text/html;base64,").concat(btoa('<body style="margin:0">' + svgCode + '</body>'), "\" sandbox=\"allow-top-navigation-by-user-activation allow-popups\">\n The \u201Ciframe\u201D tag is not supported by your browser.\n</iframe>");
|
32502 | } else {
|
32503 | if (cnf.securityLevel !== 'loose') {
|
32504 | svgCode = dompurify__WEBPACK_IMPORTED_MODULE_2___default().sanitize(svgCode, {
|
32505 | ADD_TAGS: ['foreignobject'],
|
32506 | ADD_ATTR: ['dominant-baseline']
|
32507 | });
|
32508 | }
|
32509 | }
|
32510 |
|
32511 | if (typeof cb !== 'undefined') {
|
32512 | switch (graphType) {
|
32513 | case 'flowchart':
|
32514 | case 'flowchart-v2':
|
32515 | cb(svgCode, _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_12__["default"].bindFunctions);
|
32516 | break;
|
32517 |
|
32518 | case 'gantt':
|
32519 | cb(svgCode, _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_13__["default"].bindFunctions);
|
32520 | break;
|
32521 |
|
32522 | case 'class':
|
32523 | case 'classDiagram':
|
32524 | cb(svgCode, _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_14__["default"].bindFunctions);
|
32525 | break;
|
32526 |
|
32527 | default:
|
32528 | cb(svgCode);
|
32529 | }
|
32530 | } else {
|
32531 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.debug('CB = undefined!');
|
32532 | }
|
32533 |
|
32534 | (0,_interactionDb__WEBPACK_IMPORTED_MODULE_15__.attachFunctions)();
|
32535 | var tmpElementSelector = cnf.securityLevel === 'sandbox' ? '#i' + id : '#d' + id;
|
32536 | var node = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(tmpElementSelector).node();
|
32537 |
|
32538 | if (node !== null && typeof node.remove === 'function') {
|
32539 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(tmpElementSelector).node().remove();
|
32540 | }
|
32541 |
|
32542 | return svgCode;
|
32543 | };
|
32544 |
|
32545 | var currentDirective = {};
|
32546 |
|
32547 | var parseDirective = function parseDirective(p, statement, context, type) {
|
32548 | try {
|
32549 | if (statement !== undefined) {
|
32550 | statement = statement.trim();
|
32551 |
|
32552 | switch (context) {
|
32553 | case 'open_directive':
|
32554 | currentDirective = {};
|
32555 | break;
|
32556 |
|
32557 | case 'type_directive':
|
32558 | currentDirective.type = statement.toLowerCase();
|
32559 | break;
|
32560 |
|
32561 | case 'arg_directive':
|
32562 | currentDirective.args = JSON.parse(statement);
|
32563 | break;
|
32564 |
|
32565 | case 'close_directive':
|
32566 | handleDirective(p, currentDirective, type);
|
32567 | currentDirective = null;
|
32568 | break;
|
32569 | }
|
32570 | }
|
32571 | } catch (error) {
|
32572 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.error("Error while rendering sequenceDiagram directive: ".concat(statement, " jison context: ").concat(context));
|
32573 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.error(error.message);
|
32574 | }
|
32575 | };
|
32576 |
|
32577 | var handleDirective = function handleDirective(p, directive, type) {
|
32578 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.debug("Directive type=".concat(directive.type, " with args:"), directive.args);
|
32579 |
|
32580 | switch (directive.type) {
|
32581 | case 'init':
|
32582 | case 'initialize':
|
32583 | {
|
32584 | ['config'].forEach(function (prop) {
|
32585 | if (typeof directive.args[prop] !== 'undefined') {
|
32586 | if (type === 'flowchart-v2') {
|
32587 | type = 'flowchart';
|
32588 | }
|
32589 |
|
32590 | directive.args[type] = directive.args[prop];
|
32591 | delete directive.args[prop];
|
32592 | }
|
32593 | });
|
32594 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.debug('sanitize in handleDirective', directive.args);
|
32595 | (0,_utils__WEBPACK_IMPORTED_MODULE_6__.directiveSanitizer)(directive.args);
|
32596 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.debug('sanitize in handleDirective (done)', directive.args);
|
32597 | _config__WEBPACK_IMPORTED_MODULE_5__.addDirective(directive.args);
|
32598 | break;
|
32599 | }
|
32600 |
|
32601 | case 'wrap':
|
32602 | case 'nowrap':
|
32603 | if (p && p['setWrap']) {
|
32604 | p.setWrap(directive.type === 'wrap');
|
32605 | }
|
32606 |
|
32607 | break;
|
32608 |
|
32609 | case 'themeCss':
|
32610 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.warn('themeCss encountered');
|
32611 | break;
|
32612 |
|
32613 | default:
|
32614 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.warn("Unhandled directive: source: '%%{".concat(directive.type, ": ").concat(JSON.stringify(directive.args ? directive.args : {}), "}%%"), directive);
|
32615 | break;
|
32616 | }
|
32617 | };
|
32618 | /** @param {any} conf */
|
32619 |
|
32620 |
|
32621 | function updateRendererConfigs(conf) {
|
32622 | // Todo remove, all diagrams should get config on demand from the config object, no need for this
|
32623 | _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_8__["default"].setConf(conf.flowchart);
|
32624 | _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_16__["default"].setConf(conf.flowchart);
|
32625 |
|
32626 | if (typeof conf['sequenceDiagram'] !== 'undefined') {
|
32627 | _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_17__["default"].setConf((0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_18__["default"])(conf.sequence, conf['sequenceDiagram']));
|
32628 | }
|
32629 |
|
32630 | _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_17__["default"].setConf(conf.sequence);
|
32631 | _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_19__["default"].setConf(conf.gantt); // classRenderer.setConf(conf.class);
|
32632 |
|
32633 | _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_20__["default"].setConf(conf.state);
|
32634 | _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_21__["default"].setConf(conf.state); // infoRenderer.setConf(conf.class);
|
32635 |
|
32636 | _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_22__["default"].setConf(conf.journey);
|
32637 | _errorRenderer__WEBPACK_IMPORTED_MODULE_11__["default"].setConf(conf.class);
|
32638 | }
|
32639 | /** @param {any} options */
|
32640 |
|
32641 |
|
32642 | function initialize(options) {
|
32643 | // Handle legacy location of font-family configuration
|
32644 | if (options && options.fontFamily) {
|
32645 | if (!options.themeVariables) {
|
32646 | options.themeVariables = {
|
32647 | fontFamily: options.fontFamily
|
32648 | };
|
32649 | } else {
|
32650 | if (!options.themeVariables.fontFamily) {
|
32651 | options.themeVariables = {
|
32652 | fontFamily: options.fontFamily
|
32653 | };
|
32654 | }
|
32655 | }
|
32656 | } // Set default options
|
32657 |
|
32658 |
|
32659 | _config__WEBPACK_IMPORTED_MODULE_5__.saveConfigFromInitialize(options);
|
32660 |
|
32661 | if (options && options.theme && _themes__WEBPACK_IMPORTED_MODULE_23__["default"][options.theme]) {
|
32662 | // Todo merge with user options
|
32663 | options.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_23__["default"][options.theme].getThemeVariables(options.themeVariables);
|
32664 | } else {
|
32665 | if (options) options.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_23__["default"]["default"].getThemeVariables(options.themeVariables);
|
32666 | }
|
32667 |
|
32668 | var config = _typeof(options) === 'object' ? _config__WEBPACK_IMPORTED_MODULE_5__.setSiteConfig(options) : _config__WEBPACK_IMPORTED_MODULE_5__.getSiteConfig();
|
32669 | updateRendererConfigs(config);
|
32670 | (0,_logger__WEBPACK_IMPORTED_MODULE_7__.setLogLevel)(config.logLevel);
|
32671 | (0,_diagram_api_diagram_orchestration__WEBPACK_IMPORTED_MODULE_24__["default"])();
|
32672 | }
|
32673 |
|
32674 | var mermaidAPI = Object.freeze({
|
32675 | render: render,
|
32676 | parse: parse,
|
32677 | parseDirective: parseDirective,
|
32678 | initialize: initialize,
|
32679 | getConfig: _config__WEBPACK_IMPORTED_MODULE_5__.getConfig,
|
32680 | setConfig: _config__WEBPACK_IMPORTED_MODULE_5__.setConfig,
|
32681 | getSiteConfig: _config__WEBPACK_IMPORTED_MODULE_5__.getSiteConfig,
|
32682 | updateSiteConfig: _config__WEBPACK_IMPORTED_MODULE_5__.updateSiteConfig,
|
32683 | reset: function reset() {
|
32684 | _config__WEBPACK_IMPORTED_MODULE_5__.reset();
|
32685 | },
|
32686 | globalReset: function globalReset() {
|
32687 | _config__WEBPACK_IMPORTED_MODULE_5__.reset(_config__WEBPACK_IMPORTED_MODULE_5__.defaultConfig);
|
32688 | updateRendererConfigs(_config__WEBPACK_IMPORTED_MODULE_5__.getConfig());
|
32689 | },
|
32690 | defaultConfig: _config__WEBPACK_IMPORTED_MODULE_5__.defaultConfig
|
32691 | });
|
32692 | (0,_logger__WEBPACK_IMPORTED_MODULE_7__.setLogLevel)(_config__WEBPACK_IMPORTED_MODULE_5__.getConfig().logLevel);
|
32693 | _config__WEBPACK_IMPORTED_MODULE_5__.reset(_config__WEBPACK_IMPORTED_MODULE_5__.getConfig());
|
32694 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (mermaidAPI);
|
32695 | /**
|
32696 | * ## mermaidAPI configuration defaults
|
32697 | *
|
32698 | * ```html
|
32699 | * <script>
|
32700 | * var config = {
|
32701 | * theme: 'default',
|
32702 | * logLevel: 'fatal',
|
32703 | * securityLevel: 'strict',
|
32704 | * startOnLoad: true,
|
32705 | * arrowMarkerAbsolute: false,
|
32706 | *
|
32707 | * er: {
|
32708 | * diagramPadding: 20,
|
32709 | * layoutDirection: 'TB',
|
32710 | * minEntityWidth: 100,
|
32711 | * minEntityHeight: 75,
|
32712 | * entityPadding: 15,
|
32713 | * stroke: 'gray',
|
32714 | * fill: 'honeydew',
|
32715 | * fontSize: 12,
|
32716 | * useMaxWidth: true,
|
32717 | * },
|
32718 | * flowchart: {
|
32719 | * diagramPadding: 8,
|
32720 | * htmlLabels: true,
|
32721 | * curve: 'basis',
|
32722 | * },
|
32723 | * sequence: {
|
32724 | * diagramMarginX: 50,
|
32725 | * diagramMarginY: 10,
|
32726 | * actorMargin: 50,
|
32727 | * width: 150,
|
32728 | * height: 65,
|
32729 | * boxMargin: 10,
|
32730 | * boxTextMargin: 5,
|
32731 | * noteMargin: 10,
|
32732 | * messageMargin: 35,
|
32733 | * messageAlign: 'center',
|
32734 | * mirrorActors: true,
|
32735 | * bottomMarginAdj: 1,
|
32736 | * useMaxWidth: true,
|
32737 | * rightAngles: false,
|
32738 | * showSequenceNumbers: false,
|
32739 | * },
|
32740 | * gantt: {
|
32741 | * titleTopMargin: 25,
|
32742 | * barHeight: 20,
|
32743 | * barGap: 4,
|
32744 | * topPadding: 50,
|
32745 | * leftPadding: 75,
|
32746 | * gridLineStartPadding: 35,
|
32747 | * fontSize: 11,
|
32748 | * fontFamily: '"Open Sans", sans-serif',
|
32749 | * numberSectionStyles: 4,
|
32750 | * axisFormat: '%Y-%m-%d',
|
32751 | * topAxis: false,
|
32752 | * },
|
32753 | * };
|
32754 | * mermaid.initialize(config);
|
32755 | * </script>
|
32756 | * ```
|
32757 | */
|
32758 |
|
32759 | /***/ }),
|
32760 |
|
32761 | /***/ "./src/styles.js":
|
32762 | /*!***********************!*\
|
32763 | !*** ./src/styles.js ***!
|
32764 | \***********************/
|
32765 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
32766 |
|
32767 | "use strict";
|
32768 | __webpack_require__.r(__webpack_exports__);
|
32769 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
32770 | /* harmony export */ "calcThemeVariables": () => (/* binding */ calcThemeVariables),
|
32771 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
32772 | /* harmony export */ });
|
32773 | /* harmony import */ var _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./diagrams/class/styles */ "./src/diagrams/class/styles.js");
|
32774 | /* harmony import */ var _diagrams_er_styles__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./diagrams/er/styles */ "./src/diagrams/er/styles.js");
|
32775 | /* harmony import */ var _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./diagrams/flowchart/styles */ "./src/diagrams/flowchart/styles.js");
|
32776 | /* harmony import */ var _diagrams_gantt_styles__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./diagrams/gantt/styles */ "./src/diagrams/gantt/styles.js");
|
32777 | /* harmony import */ var _diagrams_git_styles__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./diagrams/git/styles */ "./src/diagrams/git/styles.js");
|
32778 | /* harmony import */ var _diagrams_info_styles__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./diagrams/info/styles */ "./src/diagrams/info/styles.js");
|
32779 | /* harmony import */ var _diagrams_pie_styles__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./diagrams/pie/styles */ "./src/diagrams/pie/styles.js");
|
32780 | /* harmony import */ var _diagrams_requirement_styles__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./diagrams/requirement/styles */ "./src/diagrams/requirement/styles.js");
|
32781 | /* harmony import */ var _diagrams_sequence_styles__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./diagrams/sequence/styles */ "./src/diagrams/sequence/styles.js");
|
32782 | /* harmony import */ var _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./diagrams/state/styles */ "./src/diagrams/state/styles.js");
|
32783 | /* harmony import */ var _diagrams_user_journey_styles__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./diagrams/user-journey/styles */ "./src/diagrams/user-journey/styles.js");
|
32784 | /* harmony import */ var _diagrams_c4_styles__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./diagrams/c4/styles */ "./src/diagrams/c4/styles.js");
|
32785 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
|
32786 |
|
32787 |
|
32788 |
|
32789 |
|
32790 |
|
32791 |
|
32792 |
|
32793 |
|
32794 |
|
32795 |
|
32796 |
|
32797 |
|
32798 |
|
32799 | var themes = {
|
32800 | flowchart: _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_0__["default"],
|
32801 | 'flowchart-v2': _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_0__["default"],
|
32802 | sequence: _diagrams_sequence_styles__WEBPACK_IMPORTED_MODULE_1__["default"],
|
32803 | gantt: _diagrams_gantt_styles__WEBPACK_IMPORTED_MODULE_2__["default"],
|
32804 | classDiagram: _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__["default"],
|
32805 | 'classDiagram-v2': _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__["default"],
|
32806 | class: _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__["default"],
|
32807 | stateDiagram: _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_4__["default"],
|
32808 | state: _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_4__["default"],
|
32809 | gitGraph: _diagrams_git_styles__WEBPACK_IMPORTED_MODULE_5__["default"],
|
32810 | info: _diagrams_info_styles__WEBPACK_IMPORTED_MODULE_6__["default"],
|
32811 | pie: _diagrams_pie_styles__WEBPACK_IMPORTED_MODULE_7__["default"],
|
32812 | er: _diagrams_er_styles__WEBPACK_IMPORTED_MODULE_8__["default"],
|
32813 | journey: _diagrams_user_journey_styles__WEBPACK_IMPORTED_MODULE_9__["default"],
|
32814 | requirement: _diagrams_requirement_styles__WEBPACK_IMPORTED_MODULE_10__["default"],
|
32815 | c4: _diagrams_c4_styles__WEBPACK_IMPORTED_MODULE_11__["default"]
|
32816 | };
|
32817 | var calcThemeVariables = function calcThemeVariables(theme, userOverRides) {
|
32818 | _logger__WEBPACK_IMPORTED_MODULE_12__.log.info('userOverides', userOverRides);
|
32819 | return theme.calcColors(userOverRides);
|
32820 | };
|
32821 |
|
32822 | var getStyles = function getStyles(type, userStyles, options) {
|
32823 | return " {\n font-family: ".concat(options.fontFamily, ";\n font-size: ").concat(options.fontSize, ";\n fill: ").concat(options.textColor, "\n }\n\n /* Classes common for multiple diagrams */\n\n .error-icon {\n fill: ").concat(options.errorBkgColor, ";\n }\n .error-text {\n fill: ").concat(options.errorTextColor, ";\n stroke: ").concat(options.errorTextColor, ";\n }\n\n .edge-thickness-normal {\n stroke-width: 2px;\n }\n .edge-thickness-thick {\n stroke-width: 3.5px\n }\n .edge-pattern-solid {\n stroke-dasharray: 0;\n }\n\n .edge-pattern-dashed{\n stroke-dasharray: 3;\n }\n .edge-pattern-dotted {\n stroke-dasharray: 2;\n }\n\n .marker {\n fill: ").concat(options.lineColor, ";\n stroke: ").concat(options.lineColor, ";\n }\n .marker.cross {\n stroke: ").concat(options.lineColor, ";\n }\n\n svg {\n font-family: ").concat(options.fontFamily, ";\n font-size: ").concat(options.fontSize, ";\n }\n\n ").concat(themes[type](options), "\n\n ").concat(userStyles, "\n");
|
32824 | };
|
32825 |
|
32826 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
32827 |
|
32828 | /***/ }),
|
32829 |
|
32830 | /***/ "./src/themes/index.js":
|
32831 | /*!*****************************!*\
|
32832 | !*** ./src/themes/index.js ***!
|
32833 | \*****************************/
|
32834 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
32835 |
|
32836 | "use strict";
|
32837 | __webpack_require__.r(__webpack_exports__);
|
32838 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
32839 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
32840 | /* harmony export */ });
|
32841 | /* harmony import */ var _theme_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./theme-base */ "./src/themes/theme-base.js");
|
32842 | /* harmony import */ var _theme_dark__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-dark */ "./src/themes/theme-dark.js");
|
32843 | /* harmony import */ var _theme_default__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./theme-default */ "./src/themes/theme-default.js");
|
32844 | /* harmony import */ var _theme_forest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./theme-forest */ "./src/themes/theme-forest.js");
|
32845 | /* harmony import */ var _theme_neutral__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./theme-neutral */ "./src/themes/theme-neutral.js");
|
32846 |
|
32847 |
|
32848 |
|
32849 |
|
32850 |
|
32851 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
32852 | base: {
|
32853 | getThemeVariables: _theme_base__WEBPACK_IMPORTED_MODULE_0__.getThemeVariables
|
32854 | },
|
32855 | dark: {
|
32856 | getThemeVariables: _theme_dark__WEBPACK_IMPORTED_MODULE_1__.getThemeVariables
|
32857 | },
|
32858 | default: {
|
32859 | getThemeVariables: _theme_default__WEBPACK_IMPORTED_MODULE_2__.getThemeVariables
|
32860 | },
|
32861 | forest: {
|
32862 | getThemeVariables: _theme_forest__WEBPACK_IMPORTED_MODULE_3__.getThemeVariables
|
32863 | },
|
32864 | neutral: {
|
32865 | getThemeVariables: _theme_neutral__WEBPACK_IMPORTED_MODULE_4__.getThemeVariables
|
32866 | }
|
32867 | });
|
32868 |
|
32869 | /***/ }),
|
32870 |
|
32871 | /***/ "./src/themes/theme-base.js":
|
32872 | /*!**********************************!*\
|
32873 | !*** ./src/themes/theme-base.js ***!
|
32874 | \**********************************/
|
32875 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
32876 |
|
32877 | "use strict";
|
32878 | __webpack_require__.r(__webpack_exports__);
|
32879 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
32880 | /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
|
32881 | /* harmony export */ });
|
32882 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
|
32883 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
|
32884 | /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
|
32885 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
32886 |
|
32887 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
32888 |
|
32889 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
32890 |
|
32891 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
32892 |
|
32893 |
|
32894 |
|
32895 |
|
32896 | var Theme = /*#__PURE__*/function () {
|
32897 | function Theme() {
|
32898 | _classCallCheck(this, Theme);
|
32899 |
|
32900 | /** # Base variables */
|
32901 |
|
32902 | /**
|
32903 | * - Background - used to know what the background color is of the diagram. This is used for
|
32904 | * deducing colors for instance line color. Default value is #f4f4f4.
|
32905 | */
|
32906 | this.background = '#f4f4f4';
|
32907 | this.darkMode = false;
|
32908 | this.primaryColor = '#fff4dd';
|
32909 | this.noteBkgColor = '#fff5ad';
|
32910 | this.noteTextColor = '#333'; // dark
|
32911 |
|
32912 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
32913 | this.fontSize = '16px';
|
32914 | }
|
32915 |
|
32916 | _createClass(Theme, [{
|
32917 | key: "updateColors",
|
32918 | value: function updateColors() {
|
32919 | // The || is to make sure that if the variable has been defined by a user override that value is to be used
|
32920 |
|
32921 | /* Main */
|
32922 | this.primaryTextColor = this.primaryTextColor || (this.darkMode ? '#eee' : '#333'); // invert(this.primaryColor);
|
32923 |
|
32924 | this.secondaryColor = this.secondaryColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
32925 | h: -120
|
32926 | });
|
32927 | this.tertiaryColor = this.tertiaryColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
32928 | h: 180,
|
32929 | l: 5
|
32930 | });
|
32931 | this.primaryBorderColor = this.primaryBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode);
|
32932 | this.secondaryBorderColor = this.secondaryBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
|
32933 | this.tertiaryBorderColor = this.tertiaryBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode);
|
32934 | this.noteBorderColor = this.noteBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.noteBkgColor, this.darkMode);
|
32935 | this.noteBkgColor = this.noteBkgColor || '#fff5ad';
|
32936 | this.noteTextColor = this.noteTextColor || '#333';
|
32937 | this.secondaryTextColor = this.secondaryTextColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
|
32938 | this.tertiaryTextColor = this.tertiaryTextColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.tertiaryColor);
|
32939 | this.lineColor = this.lineColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
32940 | this.textColor = this.textColor || this.primaryTextColor;
|
32941 | /* Flowchart variables */
|
32942 |
|
32943 | this.nodeBkg = this.nodeBkg || this.primaryColor;
|
32944 | this.mainBkg = this.mainBkg || this.primaryColor;
|
32945 | this.nodeBorder = this.nodeBorder || this.primaryBorderColor;
|
32946 | this.clusterBkg = this.clusterBkg || this.tertiaryColor;
|
32947 | this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
|
32948 | this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
|
32949 | this.titleColor = this.titleColor || this.tertiaryTextColor;
|
32950 | this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.secondaryColor, 30) : this.secondaryColor);
|
32951 | this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
|
32952 | /* Sequence Diagram variables */
|
32953 | // this.actorBorder = lighten(this.border1, 0.5);
|
32954 |
|
32955 | this.actorBorder = this.actorBorder || this.primaryBorderColor;
|
32956 | this.actorBkg = this.actorBkg || this.mainBkg;
|
32957 | this.actorTextColor = this.actorTextColor || this.primaryTextColor;
|
32958 | this.actorLineColor = this.actorLineColor || 'grey';
|
32959 | this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
|
32960 | this.signalColor = this.signalColor || this.textColor;
|
32961 | this.signalTextColor = this.signalTextColor || this.textColor;
|
32962 | this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
|
32963 | this.labelTextColor = this.labelTextColor || this.actorTextColor;
|
32964 | this.loopTextColor = this.loopTextColor || this.actorTextColor;
|
32965 | this.activationBorderColor = this.activationBorderColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.secondaryColor, 10);
|
32966 | this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
|
32967 | this.sequenceNumberColor = this.sequenceNumberColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.lineColor);
|
32968 | /* Gantt chart variables */
|
32969 |
|
32970 | this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;
|
32971 | this.altSectionBkgColor = this.altSectionBkgColor || 'white';
|
32972 | this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;
|
32973 | this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;
|
32974 | this.excludeBkgColor = this.excludeBkgColor || '#eeeeee';
|
32975 | this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
|
32976 | this.taskBkgColor = this.taskBkgColor || this.primaryColor;
|
32977 | this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;
|
32978 | this.activeTaskBkgColor = this.activeTaskBkgColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.primaryColor, 23);
|
32979 | this.gridColor = this.gridColor || 'lightgrey';
|
32980 | this.doneTaskBkgColor = this.doneTaskBkgColor || 'lightgrey';
|
32981 | this.doneTaskBorderColor = this.doneTaskBorderColor || 'grey';
|
32982 | this.critBorderColor = this.critBorderColor || '#ff8888';
|
32983 | this.critBkgColor = this.critBkgColor || 'red';
|
32984 | this.todayLineColor = this.todayLineColor || 'red';
|
32985 | this.taskTextColor = this.taskTextColor || this.textColor;
|
32986 | this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
|
32987 | this.taskTextLightColor = this.taskTextLightColor || this.textColor;
|
32988 | this.taskTextColor = this.taskTextColor || this.primaryTextColor;
|
32989 | this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
|
32990 | this.taskTextClickableColor = this.taskTextClickableColor || '#003163';
|
32991 | /* Sequence Diagram variables */
|
32992 |
|
32993 | this.personBorder = this.personBorder || this.primaryBorderColor;
|
32994 | this.personBkg = this.personBkg || this.mainBkg;
|
32995 | /* state colors */
|
32996 |
|
32997 | this.transitionColor = this.transitionColor || this.lineColor;
|
32998 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
32999 | /* The color of the text tables of the states*/
|
33000 |
|
33001 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
33002 | this.stateBkg = this.stateBkg || this.mainBkg;
|
33003 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
33004 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
33005 | this.altBackground = this.altBackground || this.tertiaryColor;
|
33006 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
33007 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
33008 | this.innerEndBackground = this.nodeBorder;
|
33009 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
33010 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
33011 | this.transitionColor = this.transitionColor || this.lineColor;
|
33012 | this.specialStateColor = this.lineColor;
|
33013 | /* class */
|
33014 |
|
33015 | this.classText = this.classText || this.textColor;
|
33016 | /* user-journey */
|
33017 |
|
33018 | this.fillType0 = this.fillType0 || this.primaryColor;
|
33019 | this.fillType1 = this.fillType1 || this.secondaryColor;
|
33020 | this.fillType2 = this.fillType2 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33021 | h: 64
|
33022 | });
|
33023 | this.fillType3 = this.fillType3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
33024 | h: 64
|
33025 | });
|
33026 | this.fillType4 = this.fillType4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33027 | h: -64
|
33028 | });
|
33029 | this.fillType5 = this.fillType5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
33030 | h: -64
|
33031 | });
|
33032 | this.fillType6 = this.fillType6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33033 | h: 128
|
33034 | });
|
33035 | this.fillType7 = this.fillType7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
33036 | h: 128
|
33037 | });
|
33038 | /* pie */
|
33039 |
|
33040 | this.pie1 = this.pie1 || this.primaryColor;
|
33041 | this.pie2 = this.pie2 || this.secondaryColor;
|
33042 | this.pie3 = this.pie3 || this.tertiaryColor;
|
33043 | this.pie4 = this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33044 | l: -10
|
33045 | });
|
33046 | this.pie5 = this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
33047 | l: -10
|
33048 | });
|
33049 | this.pie6 = this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.tertiaryColor, {
|
33050 | l: -10
|
33051 | });
|
33052 | this.pie7 = this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33053 | h: +60,
|
33054 | l: -10
|
33055 | });
|
33056 | this.pie8 = this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33057 | h: -60,
|
33058 | l: -10
|
33059 | });
|
33060 | this.pie9 = this.pie9 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33061 | h: 120,
|
33062 | l: 0
|
33063 | });
|
33064 | this.pie10 = this.pie10 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33065 | h: +60,
|
33066 | l: -20
|
33067 | });
|
33068 | this.pie11 = this.pie11 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33069 | h: -60,
|
33070 | l: -20
|
33071 | });
|
33072 | this.pie12 = this.pie12 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33073 | h: 120,
|
33074 | l: -10
|
33075 | });
|
33076 | this.pieTitleTextSize = this.pieTitleTextSize || '25px';
|
33077 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
33078 | this.pieSectionTextSize = this.pieSectionTextSize || '17px';
|
33079 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
33080 | this.pieLegendTextSize = this.pieLegendTextSize || '17px';
|
33081 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
33082 | this.pieStrokeColor = this.pieStrokeColor || 'black';
|
33083 | this.pieStrokeWidth = this.pieStrokeWidth || '2px';
|
33084 | this.pieOpacity = this.pieOpacity || '0.7';
|
33085 | /* requirement-diagram */
|
33086 |
|
33087 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
33088 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
33089 | this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
|
33090 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
33091 | this.relationColor = this.relationColor || this.lineColor;
|
33092 | this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.secondaryColor, 30) : this.secondaryColor);
|
33093 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
33094 | /* git */
|
33095 |
|
33096 | this.git0 = this.git0 || this.primaryColor;
|
33097 | this.git1 = this.git1 || this.secondaryColor;
|
33098 | this.git2 = this.git2 || this.tertiaryColor;
|
33099 | this.git3 = this.git3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33100 | h: -30
|
33101 | });
|
33102 | this.git4 = this.git4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33103 | h: -60
|
33104 | });
|
33105 | this.git5 = this.git5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33106 | h: -90
|
33107 | });
|
33108 | this.git6 = this.git6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33109 | h: +60
|
33110 | });
|
33111 | this.git7 = this.git7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33112 | h: +120
|
33113 | });
|
33114 |
|
33115 | if (this.darkMode) {
|
33116 | this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git0, 25);
|
33117 | this.git1 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git1, 25);
|
33118 | this.git2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git2, 25);
|
33119 | this.git3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git3, 25);
|
33120 | this.git4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git4, 25);
|
33121 | this.git5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git5, 25);
|
33122 | this.git6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git6, 25);
|
33123 | this.git7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git7, 25);
|
33124 | } else {
|
33125 | this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git0, 25);
|
33126 | this.git1 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git1, 25);
|
33127 | this.git2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git2, 25);
|
33128 | this.git3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git3, 25);
|
33129 | this.git4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git4, 25);
|
33130 | this.git5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git5, 25);
|
33131 | this.git6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git6, 25);
|
33132 | this.git7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git7, 25);
|
33133 | }
|
33134 |
|
33135 | this.gitInv0 = this.gitInv0 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git0);
|
33136 | this.gitInv1 = this.gitInv1 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git1);
|
33137 | this.gitInv2 = this.gitInv2 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git2);
|
33138 | this.gitInv3 = this.gitInv3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git3);
|
33139 | this.gitInv4 = this.gitInv4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git4);
|
33140 | this.gitInv5 = this.gitInv5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git5);
|
33141 | this.gitInv6 = this.gitInv6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git6);
|
33142 | this.gitInv7 = this.gitInv7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git7);
|
33143 | this.branchLabelColor = this.branchLabelColor || (this.darkMode ? 'black' : this.labelTextColor);
|
33144 | this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor;
|
33145 | this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor;
|
33146 | this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor;
|
33147 | this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor;
|
33148 | this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor;
|
33149 | this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor;
|
33150 | this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor;
|
33151 | this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor;
|
33152 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
33153 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
33154 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
33155 | this.tagLabelFontSize = this.tagLabelFontSize || '10px';
|
33156 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
33157 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
33158 | this.commitLabelFontSize = this.commitLabelFontSize || '10px';
|
33159 | }
|
33160 | }, {
|
33161 | key: "calculate",
|
33162 | value: function calculate(overrides) {
|
33163 | var _this = this;
|
33164 |
|
33165 | if (_typeof(overrides) !== 'object') {
|
33166 | // Calculate colors form base colors
|
33167 | this.updateColors();
|
33168 | return;
|
33169 | }
|
33170 |
|
33171 | var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
|
33172 |
|
33173 | keys.forEach(function (k) {
|
33174 | _this[k] = overrides[k];
|
33175 | }); // Calculate colors form base colors
|
33176 |
|
33177 | this.updateColors(); // Copy values from overrides again in case of an override of derived value
|
33178 |
|
33179 | keys.forEach(function (k) {
|
33180 | _this[k] = overrides[k];
|
33181 | });
|
33182 | }
|
33183 | }]);
|
33184 |
|
33185 | return Theme;
|
33186 | }();
|
33187 |
|
33188 | var getThemeVariables = function getThemeVariables(userOverrides) {
|
33189 | var theme = new Theme();
|
33190 | theme.calculate(userOverrides);
|
33191 | return theme;
|
33192 | };
|
33193 |
|
33194 | /***/ }),
|
33195 |
|
33196 | /***/ "./src/themes/theme-dark.js":
|
33197 | /*!**********************************!*\
|
33198 | !*** ./src/themes/theme-dark.js ***!
|
33199 | \**********************************/
|
33200 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
33201 |
|
33202 | "use strict";
|
33203 | __webpack_require__.r(__webpack_exports__);
|
33204 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
33205 | /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
|
33206 | /* harmony export */ });
|
33207 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
|
33208 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
|
33209 | /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
|
33210 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
33211 |
|
33212 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
33213 |
|
33214 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
33215 |
|
33216 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
33217 |
|
33218 |
|
33219 |
|
33220 |
|
33221 | var Theme = /*#__PURE__*/function () {
|
33222 | function Theme() {
|
33223 | _classCallCheck(this, Theme);
|
33224 |
|
33225 | this.background = '#333';
|
33226 | this.primaryColor = '#1f2020';
|
33227 | this.secondaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.primaryColor, 16);
|
33228 | this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33229 | h: -160
|
33230 | });
|
33231 | this.primaryBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
33232 | this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
|
33233 | this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode);
|
33234 | this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
|
33235 | this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
|
33236 | this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.tertiaryColor);
|
33237 | this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
33238 | this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
33239 | this.mainBkg = '#1f2020';
|
33240 | this.secondBkg = 'calculated';
|
33241 | this.mainContrastColor = 'lightgrey';
|
33242 | this.darkTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)((0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)('#323D47'), 10);
|
33243 | this.lineColor = 'calculated';
|
33244 | this.border1 = '#81B1DB';
|
33245 | this.border2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.rgba)(255, 255, 255, 0.25);
|
33246 | this.arrowheadColor = 'calculated';
|
33247 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
33248 | this.fontSize = '16px';
|
33249 | this.labelBackground = '#181818';
|
33250 | this.textColor = '#ccc';
|
33251 | /* Flowchart variables */
|
33252 |
|
33253 | this.nodeBkg = 'calculated';
|
33254 | this.nodeBorder = 'calculated';
|
33255 | this.clusterBkg = 'calculated';
|
33256 | this.clusterBorder = 'calculated';
|
33257 | this.defaultLinkColor = 'calculated';
|
33258 | this.titleColor = '#F9FFFE';
|
33259 | this.edgeLabelBackground = 'calculated';
|
33260 | /* Sequence Diagram variables */
|
33261 |
|
33262 | this.actorBorder = 'calculated';
|
33263 | this.actorBkg = 'calculated';
|
33264 | this.actorTextColor = 'calculated';
|
33265 | this.actorLineColor = 'calculated';
|
33266 | this.signalColor = 'calculated';
|
33267 | this.signalTextColor = 'calculated';
|
33268 | this.labelBoxBkgColor = 'calculated';
|
33269 | this.labelBoxBorderColor = 'calculated';
|
33270 | this.labelTextColor = 'calculated';
|
33271 | this.loopTextColor = 'calculated';
|
33272 | this.noteBorderColor = 'calculated';
|
33273 | this.noteBkgColor = '#fff5ad';
|
33274 | this.noteTextColor = 'calculated';
|
33275 | this.activationBorderColor = 'calculated';
|
33276 | this.activationBkgColor = 'calculated';
|
33277 | this.sequenceNumberColor = 'black';
|
33278 | /* Gantt chart variables */
|
33279 |
|
33280 | this.sectionBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)('#EAE8D9', 30);
|
33281 | this.altSectionBkgColor = 'calculated';
|
33282 | this.sectionBkgColor2 = '#EAE8D9';
|
33283 | this.taskBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.rgba)(255, 255, 255, 70);
|
33284 | this.taskBkgColor = 'calculated';
|
33285 | this.taskTextColor = 'calculated';
|
33286 | this.taskTextLightColor = 'calculated';
|
33287 | this.taskTextOutsideColor = 'calculated';
|
33288 | this.taskTextClickableColor = '#003163';
|
33289 | this.activeTaskBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.rgba)(255, 255, 255, 50);
|
33290 | this.activeTaskBkgColor = '#81B1DB';
|
33291 | this.gridColor = 'calculated';
|
33292 | this.doneTaskBkgColor = 'calculated';
|
33293 | this.doneTaskBorderColor = 'grey';
|
33294 | this.critBorderColor = '#E83737';
|
33295 | this.critBkgColor = '#E83737';
|
33296 | this.taskTextDarkColor = 'calculated';
|
33297 | this.todayLineColor = '#DB5757';
|
33298 | /* C4 Context Diagram variables */
|
33299 |
|
33300 | this.personBorder = 'calculated';
|
33301 | this.personBkg = 'calculated';
|
33302 | /* state colors */
|
33303 |
|
33304 | this.labelColor = 'calculated';
|
33305 | this.errorBkgColor = '#a44141';
|
33306 | this.errorTextColor = '#ddd';
|
33307 | }
|
33308 |
|
33309 | _createClass(Theme, [{
|
33310 | key: "updateColors",
|
33311 | value: function updateColors() {
|
33312 | this.secondBkg = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.mainBkg, 16);
|
33313 | this.lineColor = this.mainContrastColor;
|
33314 | this.arrowheadColor = this.mainContrastColor;
|
33315 | /* Flowchart variables */
|
33316 |
|
33317 | this.nodeBkg = this.mainBkg;
|
33318 | this.nodeBorder = this.border1;
|
33319 | this.clusterBkg = this.secondBkg;
|
33320 | this.clusterBorder = this.border2;
|
33321 | this.defaultLinkColor = this.lineColor;
|
33322 | this.edgeLabelBackground = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.labelBackground, 25);
|
33323 | /* Sequence Diagram variables */
|
33324 |
|
33325 | this.actorBorder = this.border1;
|
33326 | this.actorBkg = this.mainBkg;
|
33327 | this.actorTextColor = this.mainContrastColor;
|
33328 | this.actorLineColor = this.mainContrastColor;
|
33329 | this.signalColor = this.mainContrastColor;
|
33330 | this.signalTextColor = this.mainContrastColor;
|
33331 | this.labelBoxBkgColor = this.actorBkg;
|
33332 | this.labelBoxBorderColor = this.actorBorder;
|
33333 | this.labelTextColor = this.mainContrastColor;
|
33334 | this.loopTextColor = this.mainContrastColor;
|
33335 | this.noteBorderColor = this.secondaryBorderColor;
|
33336 | this.noteBkgColor = this.secondBkg;
|
33337 | this.noteTextColor = this.secondaryTextColor;
|
33338 | this.activationBorderColor = this.border1;
|
33339 | this.activationBkgColor = this.secondBkg;
|
33340 | /* Gantt chart variables */
|
33341 |
|
33342 | this.altSectionBkgColor = this.background;
|
33343 | this.taskBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.mainBkg, 23);
|
33344 | this.taskTextColor = this.darkTextColor;
|
33345 | this.taskTextLightColor = this.mainContrastColor;
|
33346 | this.taskTextOutsideColor = this.taskTextLightColor;
|
33347 | this.gridColor = this.mainContrastColor;
|
33348 | this.doneTaskBkgColor = this.mainContrastColor;
|
33349 | this.taskTextDarkColor = this.darkTextColor;
|
33350 | /* state colors */
|
33351 |
|
33352 | this.transitionColor = this.transitionColor || this.lineColor;
|
33353 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
33354 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
33355 | this.stateBkg = this.stateBkg || this.mainBkg;
|
33356 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
33357 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
33358 | this.altBackground = this.altBackground || '#555';
|
33359 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
33360 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
33361 | this.innerEndBackground = this.primaryBorderColor;
|
33362 | this.specialStateColor = '#f4f4f4'; // this.lineColor;
|
33363 |
|
33364 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
33365 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
33366 | this.fillType0 = this.primaryColor;
|
33367 | this.fillType1 = this.secondaryColor;
|
33368 | this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33369 | h: 64
|
33370 | });
|
33371 | this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
33372 | h: 64
|
33373 | });
|
33374 | this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33375 | h: -64
|
33376 | });
|
33377 | this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
33378 | h: -64
|
33379 | });
|
33380 | this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33381 | h: 128
|
33382 | });
|
33383 | this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
33384 | h: 128
|
33385 | });
|
33386 | /* pie */
|
33387 |
|
33388 | this.pie1 = this.pie1 || '#0b0000';
|
33389 | this.pie2 = this.pie2 || '#4d1037';
|
33390 | this.pie3 = this.pie3 || '#3f5258';
|
33391 | this.pie4 = this.pie4 || '#4f2f1b';
|
33392 | this.pie5 = this.pie5 || '#6e0a0a';
|
33393 | this.pie6 = this.pie6 || '#3b0048';
|
33394 | this.pie7 = this.pie7 || '#995a01';
|
33395 | this.pie8 = this.pie8 || '#154706';
|
33396 | this.pie9 = this.pie9 || '#161722';
|
33397 | this.pie10 = this.pie10 || '#00296f';
|
33398 | this.pie11 = this.pie11 || '#01629c';
|
33399 | this.pie12 = this.pie12 || '#010029';
|
33400 | this.pieTitleTextSize = this.pieTitleTextSize || '25px';
|
33401 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
33402 | this.pieSectionTextSize = this.pieSectionTextSize || '17px';
|
33403 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
33404 | this.pieLegendTextSize = this.pieLegendTextSize || '17px';
|
33405 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
33406 | this.pieStrokeColor = this.pieStrokeColor || 'black';
|
33407 | this.pieStrokeWidth = this.pieStrokeWidth || '2px';
|
33408 | this.pieOpacity = this.pieOpacity || '0.7';
|
33409 | /* class */
|
33410 |
|
33411 | this.classText = this.primaryTextColor;
|
33412 | /* requirement-diagram */
|
33413 |
|
33414 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
33415 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
33416 | this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
|
33417 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
33418 | this.relationColor = this.relationColor || this.lineColor;
|
33419 | this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.secondaryColor, 30) : this.secondaryColor);
|
33420 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
33421 | /* git */
|
33422 |
|
33423 | this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.secondaryColor, 20);
|
33424 | this.git1 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.pie2 || this.secondaryColor, 20);
|
33425 | this.git2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.pie3 || this.tertiaryColor, 20);
|
33426 | this.git3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33427 | h: -30
|
33428 | }), 20);
|
33429 | this.git4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33430 | h: -60
|
33431 | }), 20);
|
33432 | this.git5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33433 | h: -90
|
33434 | }), 10);
|
33435 | this.git6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33436 | h: +60
|
33437 | }), 10);
|
33438 | this.git7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33439 | h: +120
|
33440 | }), 20);
|
33441 | this.gitInv0 = this.gitInv0 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git0);
|
33442 | this.gitInv1 = this.gitInv1 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git1);
|
33443 | this.gitInv2 = this.gitInv2 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git2);
|
33444 | this.gitInv3 = this.gitInv3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git3);
|
33445 | this.gitInv4 = this.gitInv4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git4);
|
33446 | this.gitInv5 = this.gitInv5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git5);
|
33447 | this.gitInv6 = this.gitInv6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git6);
|
33448 | this.gitInv7 = this.gitInv7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git7);
|
33449 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
33450 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
33451 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
33452 | this.tagLabelFontSize = this.tagLabelFontSize || '10px';
|
33453 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
33454 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
33455 | this.commitLabelFontSize = this.commitLabelFontSize || '10px';
|
33456 | }
|
33457 | }, {
|
33458 | key: "calculate",
|
33459 | value: function calculate(overrides) {
|
33460 | var _this = this;
|
33461 |
|
33462 | if (_typeof(overrides) !== 'object') {
|
33463 | // Calculate colors form base colors
|
33464 | this.updateColors();
|
33465 | return;
|
33466 | }
|
33467 |
|
33468 | var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
|
33469 |
|
33470 | keys.forEach(function (k) {
|
33471 | _this[k] = overrides[k];
|
33472 | }); // Calculate colors form base colors
|
33473 |
|
33474 | this.updateColors(); // Copy values from overrides again in case of an override of derived value
|
33475 |
|
33476 | keys.forEach(function (k) {
|
33477 | _this[k] = overrides[k];
|
33478 | });
|
33479 | }
|
33480 | }]);
|
33481 |
|
33482 | return Theme;
|
33483 | }();
|
33484 |
|
33485 | var getThemeVariables = function getThemeVariables(userOverrides) {
|
33486 | var theme = new Theme();
|
33487 | theme.calculate(userOverrides);
|
33488 | return theme;
|
33489 | };
|
33490 |
|
33491 | /***/ }),
|
33492 |
|
33493 | /***/ "./src/themes/theme-default.js":
|
33494 | /*!*************************************!*\
|
33495 | !*** ./src/themes/theme-default.js ***!
|
33496 | \*************************************/
|
33497 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
33498 |
|
33499 | "use strict";
|
33500 | __webpack_require__.r(__webpack_exports__);
|
33501 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
33502 | /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
|
33503 | /* harmony export */ });
|
33504 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
|
33505 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
|
33506 | /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
|
33507 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
33508 |
|
33509 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
33510 |
|
33511 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
33512 |
|
33513 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
33514 |
|
33515 |
|
33516 |
|
33517 |
|
33518 | var Theme = /*#__PURE__*/function () {
|
33519 | function Theme() {
|
33520 | _classCallCheck(this, Theme);
|
33521 |
|
33522 | /* Base variables */
|
33523 | this.background = '#f4f4f4';
|
33524 | this.primaryColor = '#ECECFF';
|
33525 | this.secondaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33526 | h: 120
|
33527 | });
|
33528 | this.secondaryColor = '#ffffde';
|
33529 | this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33530 | h: -160
|
33531 | });
|
33532 | this.primaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode);
|
33533 | this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
|
33534 | this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode); // this.noteBorderColor = mkBorder(this.noteBkgColor, this.darkMode);
|
33535 |
|
33536 | this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
|
33537 | this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
|
33538 | this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.tertiaryColor);
|
33539 | this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
33540 | this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
33541 | this.background = 'white';
|
33542 | this.mainBkg = '#ECECFF';
|
33543 | this.secondBkg = '#ffffde';
|
33544 | this.lineColor = '#333333';
|
33545 | this.border1 = '#9370DB';
|
33546 | this.border2 = '#aaaa33';
|
33547 | this.arrowheadColor = '#333333';
|
33548 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
33549 | this.fontSize = '16px';
|
33550 | this.labelBackground = '#e8e8e8';
|
33551 | this.textColor = '#333';
|
33552 | /* Flowchart variables */
|
33553 |
|
33554 | this.nodeBkg = 'calculated';
|
33555 | this.nodeBorder = 'calculated';
|
33556 | this.clusterBkg = 'calculated';
|
33557 | this.clusterBorder = 'calculated';
|
33558 | this.defaultLinkColor = 'calculated';
|
33559 | this.titleColor = 'calculated';
|
33560 | this.edgeLabelBackground = 'calculated';
|
33561 | /* Sequence Diagram variables */
|
33562 |
|
33563 | this.actorBorder = 'calculated';
|
33564 | this.actorBkg = 'calculated';
|
33565 | this.actorTextColor = 'black';
|
33566 | this.actorLineColor = 'grey';
|
33567 | this.signalColor = 'calculated';
|
33568 | this.signalTextColor = 'calculated';
|
33569 | this.labelBoxBkgColor = 'calculated';
|
33570 | this.labelBoxBorderColor = 'calculated';
|
33571 | this.labelTextColor = 'calculated';
|
33572 | this.loopTextColor = 'calculated';
|
33573 | this.noteBorderColor = 'calculated';
|
33574 | this.noteBkgColor = '#fff5ad';
|
33575 | this.noteTextColor = 'calculated';
|
33576 | this.activationBorderColor = '#666';
|
33577 | this.activationBkgColor = '#f4f4f4';
|
33578 | this.sequenceNumberColor = 'white';
|
33579 | /* Gantt chart variables */
|
33580 |
|
33581 | this.sectionBkgColor = 'calculated';
|
33582 | this.altSectionBkgColor = 'calculated';
|
33583 | this.sectionBkgColor2 = 'calculated';
|
33584 | this.excludeBkgColor = '#eeeeee';
|
33585 | this.taskBorderColor = 'calculated';
|
33586 | this.taskBkgColor = 'calculated';
|
33587 | this.taskTextLightColor = 'calculated';
|
33588 | this.taskTextColor = this.taskTextLightColor;
|
33589 | this.taskTextDarkColor = 'calculated';
|
33590 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
33591 | this.taskTextClickableColor = 'calculated';
|
33592 | this.activeTaskBorderColor = 'calculated';
|
33593 | this.activeTaskBkgColor = 'calculated';
|
33594 | this.gridColor = 'calculated';
|
33595 | this.doneTaskBkgColor = 'calculated';
|
33596 | this.doneTaskBorderColor = 'calculated';
|
33597 | this.critBorderColor = 'calculated';
|
33598 | this.critBkgColor = 'calculated';
|
33599 | this.todayLineColor = 'calculated';
|
33600 | this.sectionBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.rgba)(102, 102, 255, 0.49);
|
33601 | this.altSectionBkgColor = 'white';
|
33602 | this.sectionBkgColor2 = '#fff400';
|
33603 | this.taskBorderColor = '#534fbc';
|
33604 | this.taskBkgColor = '#8a90dd';
|
33605 | this.taskTextLightColor = 'white';
|
33606 | this.taskTextColor = 'calculated';
|
33607 | this.taskTextDarkColor = 'black';
|
33608 | this.taskTextOutsideColor = 'calculated';
|
33609 | this.taskTextClickableColor = '#003163';
|
33610 | this.activeTaskBorderColor = '#534fbc';
|
33611 | this.activeTaskBkgColor = '#bfc7ff';
|
33612 | this.gridColor = 'lightgrey';
|
33613 | this.doneTaskBkgColor = 'lightgrey';
|
33614 | this.doneTaskBorderColor = 'grey';
|
33615 | this.critBorderColor = '#ff8888';
|
33616 | this.critBkgColor = 'red';
|
33617 | this.todayLineColor = 'red';
|
33618 | /* C4 Context Diagram variables */
|
33619 |
|
33620 | this.personBorder = 'calculated';
|
33621 | this.personBkg = 'calculated';
|
33622 | /* state colors */
|
33623 |
|
33624 | this.labelColor = 'black';
|
33625 | this.errorBkgColor = '#552222';
|
33626 | this.errorTextColor = '#552222';
|
33627 | this.updateColors();
|
33628 | }
|
33629 |
|
33630 | _createClass(Theme, [{
|
33631 | key: "updateColors",
|
33632 | value: function updateColors() {
|
33633 | /* Flowchart variables */
|
33634 | this.nodeBkg = this.mainBkg;
|
33635 | this.nodeBorder = this.border1; // border 1
|
33636 |
|
33637 | this.clusterBkg = this.secondBkg;
|
33638 | this.clusterBorder = this.border2;
|
33639 | this.defaultLinkColor = this.lineColor;
|
33640 | this.titleColor = this.textColor;
|
33641 | this.edgeLabelBackground = this.labelBackground;
|
33642 | /* Sequence Diagram variables */
|
33643 | // this.actorBorder = lighten(this.border1, 0.5);
|
33644 |
|
33645 | this.actorBorder = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.border1, 23);
|
33646 | this.actorBkg = this.mainBkg;
|
33647 | this.labelBoxBkgColor = this.actorBkg;
|
33648 | this.signalColor = this.textColor;
|
33649 | this.signalTextColor = this.textColor;
|
33650 | this.labelBoxBorderColor = this.actorBorder;
|
33651 | this.labelTextColor = this.actorTextColor;
|
33652 | this.loopTextColor = this.actorTextColor;
|
33653 | this.noteBorderColor = this.border2;
|
33654 | this.noteTextColor = this.actorTextColor;
|
33655 | /* Gantt chart variables */
|
33656 |
|
33657 | this.taskTextColor = this.taskTextLightColor;
|
33658 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
33659 | /* state colors */
|
33660 |
|
33661 | this.transitionColor = this.transitionColor || this.lineColor;
|
33662 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
33663 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
33664 | this.stateBkg = this.stateBkg || this.mainBkg;
|
33665 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
33666 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
33667 | this.altBackground = this.altBackground || '#f0f0f0';
|
33668 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
33669 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
33670 | this.innerEndBackground = this.nodeBorder;
|
33671 | this.specialStateColor = this.lineColor;
|
33672 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
33673 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
33674 | this.transitionColor = this.transitionColor || this.lineColor;
|
33675 | /* class */
|
33676 |
|
33677 | this.classText = this.primaryTextColor;
|
33678 | /* journey */
|
33679 |
|
33680 | this.fillType0 = this.primaryColor;
|
33681 | this.fillType1 = this.secondaryColor;
|
33682 | this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33683 | h: 64
|
33684 | });
|
33685 | this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
33686 | h: 64
|
33687 | });
|
33688 | this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33689 | h: -64
|
33690 | });
|
33691 | this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
33692 | h: -64
|
33693 | });
|
33694 | this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33695 | h: 128
|
33696 | });
|
33697 | this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
33698 | h: 128
|
33699 | });
|
33700 | /* pie */
|
33701 |
|
33702 | this.pie1 = this.pie1 || this.primaryColor;
|
33703 | this.pie2 = this.pie2 || this.secondaryColor;
|
33704 | this.pie3 = this.pie3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.tertiaryColor, {
|
33705 | l: -40
|
33706 | });
|
33707 | this.pie4 = this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33708 | l: -10
|
33709 | });
|
33710 | this.pie5 = this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
33711 | l: -30
|
33712 | });
|
33713 | this.pie6 = this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.tertiaryColor, {
|
33714 | l: -20
|
33715 | });
|
33716 | this.pie7 = this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33717 | h: +60,
|
33718 | l: -20
|
33719 | });
|
33720 | this.pie8 = this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33721 | h: -60,
|
33722 | l: -40
|
33723 | });
|
33724 | this.pie9 = this.pie9 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33725 | h: 120,
|
33726 | l: -40
|
33727 | });
|
33728 | this.pie10 = this.pie10 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33729 | h: +60,
|
33730 | l: -40
|
33731 | });
|
33732 | this.pie11 = this.pie11 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33733 | h: -90,
|
33734 | l: -40
|
33735 | });
|
33736 | this.pie12 = this.pie12 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33737 | h: 120,
|
33738 | l: -30
|
33739 | });
|
33740 | this.pieTitleTextSize = this.pieTitleTextSize || '25px';
|
33741 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
33742 | this.pieSectionTextSize = this.pieSectionTextSize || '17px';
|
33743 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
33744 | this.pieLegendTextSize = this.pieLegendTextSize || '17px';
|
33745 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
33746 | this.pieStrokeColor = this.pieStrokeColor || 'black';
|
33747 | this.pieStrokeWidth = this.pieStrokeWidth || '2px';
|
33748 | this.pieOpacity = this.pieOpacity || '0.7';
|
33749 | /* requirement-diagram */
|
33750 |
|
33751 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
33752 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
33753 | this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
|
33754 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
33755 | this.relationColor = this.relationColor || this.lineColor;
|
33756 | this.relationLabelBackground = this.relationLabelBackground || this.labelBackground;
|
33757 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
33758 | /* git */
|
33759 |
|
33760 | this.git0 = this.git0 || this.primaryColor;
|
33761 | this.git1 = this.git1 || this.secondaryColor;
|
33762 | this.git2 = this.git2 || this.tertiaryColor;
|
33763 | this.git3 = this.git3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33764 | h: -30
|
33765 | });
|
33766 | this.git4 = this.git4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33767 | h: -60
|
33768 | });
|
33769 | this.git5 = this.git5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33770 | h: -90
|
33771 | });
|
33772 | this.git6 = this.git6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33773 | h: +60
|
33774 | });
|
33775 | this.git7 = this.git7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
33776 | h: +120
|
33777 | });
|
33778 |
|
33779 | if (this.darkMode) {
|
33780 | this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git0, 25);
|
33781 | this.git1 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git1, 25);
|
33782 | this.git2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git2, 25);
|
33783 | this.git3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git3, 25);
|
33784 | this.git4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git4, 25);
|
33785 | this.git5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git5, 25);
|
33786 | this.git6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git6, 25);
|
33787 | this.git7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git7, 25);
|
33788 | } else {
|
33789 | this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git0, 25);
|
33790 | this.git1 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git1, 25);
|
33791 | this.git2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git2, 25);
|
33792 | this.git3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git3, 25);
|
33793 | this.git4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git4, 25);
|
33794 | this.git5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git5, 25);
|
33795 | this.git6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git6, 25);
|
33796 | this.git7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git7, 25);
|
33797 | }
|
33798 |
|
33799 | this.gitInv0 = this.gitInv0 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)((0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git0), 25);
|
33800 | this.gitInv1 = this.gitInv1 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git1);
|
33801 | this.gitInv2 = this.gitInv2 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git2);
|
33802 | this.gitInv3 = this.gitInv3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git3);
|
33803 | this.gitInv4 = this.gitInv4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git4);
|
33804 | this.gitInv5 = this.gitInv5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git5);
|
33805 | this.gitInv6 = this.gitInv6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git6);
|
33806 | this.gitInv7 = this.gitInv7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git7);
|
33807 | this.gitBranchLabel0 = this.gitBranchLabel0 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.labelTextColor);
|
33808 | this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
|
33809 | this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
|
33810 | this.gitBranchLabel3 = this.gitBranchLabel3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.labelTextColor);
|
33811 | this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
|
33812 | this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
|
33813 | this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
|
33814 | this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
|
33815 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
33816 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
33817 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
33818 | this.tagLabelFontSize = this.tagLabelFontSize || '10px';
|
33819 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
33820 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
33821 | this.commitLabelFontSize = this.commitLabelFontSize || '10px';
|
33822 | }
|
33823 | }, {
|
33824 | key: "calculate",
|
33825 | value: function calculate(overrides) {
|
33826 | var _this = this;
|
33827 |
|
33828 | if (_typeof(overrides) !== 'object') {
|
33829 | // Calculate colors form base colors
|
33830 | this.updateColors();
|
33831 | return;
|
33832 | }
|
33833 |
|
33834 | var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
|
33835 |
|
33836 | keys.forEach(function (k) {
|
33837 | _this[k] = overrides[k];
|
33838 | }); // Calculate colors form base colors
|
33839 |
|
33840 | this.updateColors(); // Copy values from overrides again in case of an override of derived value
|
33841 |
|
33842 | keys.forEach(function (k) {
|
33843 | _this[k] = overrides[k];
|
33844 | });
|
33845 | }
|
33846 | }]);
|
33847 |
|
33848 | return Theme;
|
33849 | }();
|
33850 |
|
33851 | var getThemeVariables = function getThemeVariables(userOverrides) {
|
33852 | var theme = new Theme();
|
33853 | theme.calculate(userOverrides);
|
33854 | return theme;
|
33855 | };
|
33856 |
|
33857 | /***/ }),
|
33858 |
|
33859 | /***/ "./src/themes/theme-forest.js":
|
33860 | /*!************************************!*\
|
33861 | !*** ./src/themes/theme-forest.js ***!
|
33862 | \************************************/
|
33863 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
33864 |
|
33865 | "use strict";
|
33866 | __webpack_require__.r(__webpack_exports__);
|
33867 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
33868 | /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
|
33869 | /* harmony export */ });
|
33870 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
|
33871 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
|
33872 | /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
|
33873 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
33874 |
|
33875 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
33876 |
|
33877 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
33878 |
|
33879 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
33880 |
|
33881 |
|
33882 |
|
33883 |
|
33884 | var Theme = /*#__PURE__*/function () {
|
33885 | function Theme() {
|
33886 | _classCallCheck(this, Theme);
|
33887 |
|
33888 | /* Base vales */
|
33889 | this.background = '#f4f4f4';
|
33890 | this.primaryColor = '#cde498';
|
33891 | this.secondaryColor = '#cdffb2';
|
33892 | this.background = 'white';
|
33893 | this.mainBkg = '#cde498';
|
33894 | this.secondBkg = '#cdffb2';
|
33895 | this.lineColor = 'green';
|
33896 | this.border1 = '#13540c';
|
33897 | this.border2 = '#6eaa49';
|
33898 | this.arrowheadColor = 'green';
|
33899 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
33900 | this.fontSize = '16px';
|
33901 | this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)('#cde498', 10);
|
33902 | this.primaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode);
|
33903 | this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
|
33904 | this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode);
|
33905 | this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
|
33906 | this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
|
33907 | this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
|
33908 | this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
33909 | this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
33910 | /* Flowchart variables */
|
33911 |
|
33912 | this.nodeBkg = 'calculated';
|
33913 | this.nodeBorder = 'calculated';
|
33914 | this.clusterBkg = 'calculated';
|
33915 | this.clusterBorder = 'calculated';
|
33916 | this.defaultLinkColor = 'calculated';
|
33917 | this.titleColor = '#333';
|
33918 | this.edgeLabelBackground = '#e8e8e8';
|
33919 | /* Sequence Diagram variables */
|
33920 |
|
33921 | this.actorBorder = 'calculated';
|
33922 | this.actorBkg = 'calculated';
|
33923 | this.actorTextColor = 'black';
|
33924 | this.actorLineColor = 'grey';
|
33925 | this.signalColor = '#333';
|
33926 | this.signalTextColor = '#333';
|
33927 | this.labelBoxBkgColor = 'calculated';
|
33928 | this.labelBoxBorderColor = '#326932';
|
33929 | this.labelTextColor = 'calculated';
|
33930 | this.loopTextColor = 'calculated';
|
33931 | this.noteBorderColor = 'calculated';
|
33932 | this.noteBkgColor = '#fff5ad';
|
33933 | this.noteTextColor = 'calculated';
|
33934 | this.activationBorderColor = '#666';
|
33935 | this.activationBkgColor = '#f4f4f4';
|
33936 | this.sequenceNumberColor = 'white';
|
33937 | /* Gantt chart variables */
|
33938 |
|
33939 | this.sectionBkgColor = '#6eaa49';
|
33940 | this.altSectionBkgColor = 'white';
|
33941 | this.sectionBkgColor2 = '#6eaa49';
|
33942 | this.excludeBkgColor = '#eeeeee';
|
33943 | this.taskBorderColor = 'calculated';
|
33944 | this.taskBkgColor = '#487e3a';
|
33945 | this.taskTextLightColor = 'white';
|
33946 | this.taskTextColor = 'calculated';
|
33947 | this.taskTextDarkColor = 'black';
|
33948 | this.taskTextOutsideColor = 'calculated';
|
33949 | this.taskTextClickableColor = '#003163';
|
33950 | this.activeTaskBorderColor = 'calculated';
|
33951 | this.activeTaskBkgColor = 'calculated';
|
33952 | this.gridColor = 'lightgrey';
|
33953 | this.doneTaskBkgColor = 'lightgrey';
|
33954 | this.doneTaskBorderColor = 'grey';
|
33955 | this.critBorderColor = '#ff8888';
|
33956 | this.critBkgColor = 'red';
|
33957 | this.todayLineColor = 'red';
|
33958 | /* C4 Context Diagram variables */
|
33959 |
|
33960 | this.personBorder = 'calculated';
|
33961 | this.personBkg = 'calculated';
|
33962 | /* state colors */
|
33963 |
|
33964 | this.labelColor = 'black';
|
33965 | this.errorBkgColor = '#552222';
|
33966 | this.errorTextColor = '#552222';
|
33967 | }
|
33968 |
|
33969 | _createClass(Theme, [{
|
33970 | key: "updateColors",
|
33971 | value: function updateColors() {
|
33972 | /* Flowchart variables */
|
33973 | this.nodeBkg = this.mainBkg;
|
33974 | this.nodeBorder = this.border1;
|
33975 | this.clusterBkg = this.secondBkg;
|
33976 | this.clusterBorder = this.border2;
|
33977 | this.defaultLinkColor = this.lineColor;
|
33978 | /* Sequence Diagram variables */
|
33979 |
|
33980 | this.actorBorder = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.mainBkg, 20);
|
33981 | this.actorBkg = this.mainBkg;
|
33982 | this.labelBoxBkgColor = this.actorBkg;
|
33983 | this.labelTextColor = this.actorTextColor;
|
33984 | this.loopTextColor = this.actorTextColor;
|
33985 | this.noteBorderColor = this.border2;
|
33986 | this.noteTextColor = this.actorTextColor;
|
33987 | /* Gantt chart variables */
|
33988 |
|
33989 | this.taskBorderColor = this.border1;
|
33990 | this.taskTextColor = this.taskTextLightColor;
|
33991 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
33992 | this.activeTaskBorderColor = this.taskBorderColor;
|
33993 | this.activeTaskBkgColor = this.mainBkg;
|
33994 | /* state colors */
|
33995 |
|
33996 | this.transitionColor = this.transitionColor || this.lineColor;
|
33997 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
33998 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
33999 | this.stateBkg = this.stateBkg || this.mainBkg;
|
34000 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
34001 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
34002 | this.altBackground = this.altBackground || '#f0f0f0';
|
34003 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
34004 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
34005 | this.innerEndBackground = this.primaryBorderColor;
|
34006 | this.specialStateColor = this.lineColor;
|
34007 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
34008 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
34009 | this.transitionColor = this.transitionColor || this.lineColor;
|
34010 | /* class */
|
34011 |
|
34012 | this.classText = this.primaryTextColor;
|
34013 | /* journey */
|
34014 |
|
34015 | this.fillType0 = this.primaryColor;
|
34016 | this.fillType1 = this.secondaryColor;
|
34017 | this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34018 | h: 64
|
34019 | });
|
34020 | this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
34021 | h: 64
|
34022 | });
|
34023 | this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34024 | h: -64
|
34025 | });
|
34026 | this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
34027 | h: -64
|
34028 | });
|
34029 | this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34030 | h: 128
|
34031 | });
|
34032 | this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
34033 | h: 128
|
34034 | });
|
34035 | /* pie */
|
34036 |
|
34037 | this.pie1 = this.pie1 || this.primaryColor;
|
34038 | this.pie2 = this.pie2 || this.secondaryColor;
|
34039 | this.pie3 = this.pie3 || this.tertiaryColor;
|
34040 | this.pie4 = this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34041 | l: -30
|
34042 | });
|
34043 | this.pie5 = this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
34044 | l: -30
|
34045 | });
|
34046 | this.pie6 = this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.tertiaryColor, {
|
34047 | h: +40,
|
34048 | l: -40
|
34049 | });
|
34050 | this.pie7 = this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34051 | h: +60,
|
34052 | l: -10
|
34053 | });
|
34054 | this.pie8 = this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34055 | h: -60,
|
34056 | l: -10
|
34057 | });
|
34058 | this.pie9 = this.pie9 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34059 | h: 120,
|
34060 | l: 0
|
34061 | });
|
34062 | this.pie10 = this.pie10 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34063 | h: +60,
|
34064 | l: -50
|
34065 | });
|
34066 | this.pie11 = this.pie11 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34067 | h: -60,
|
34068 | l: -50
|
34069 | });
|
34070 | this.pie12 = this.pie12 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34071 | h: 120,
|
34072 | l: -50
|
34073 | });
|
34074 | this.pieTitleTextSize = this.pieTitleTextSize || '25px';
|
34075 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
34076 | this.pieSectionTextSize = this.pieSectionTextSize || '17px';
|
34077 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
34078 | this.pieLegendTextSize = this.pieLegendTextSize || '17px';
|
34079 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
34080 | this.pieStrokeColor = this.pieStrokeColor || 'black';
|
34081 | this.pieStrokeWidth = this.pieStrokeWidth || '2px';
|
34082 | this.pieOpacity = this.pieOpacity || '0.7';
|
34083 | /* requirement-diagram */
|
34084 |
|
34085 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
34086 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
34087 | this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
|
34088 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
34089 | this.relationColor = this.relationColor || this.lineColor;
|
34090 | this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
|
34091 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
34092 | /* git */
|
34093 |
|
34094 | this.git0 = this.git0 || this.primaryColor;
|
34095 | this.git1 = this.git1 || this.secondaryColor;
|
34096 | this.git2 = this.git2 || this.tertiaryColor;
|
34097 | this.git3 = this.git3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34098 | h: -30
|
34099 | });
|
34100 | this.git4 = this.git4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34101 | h: -60
|
34102 | });
|
34103 | this.git5 = this.git5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34104 | h: -90
|
34105 | });
|
34106 | this.git6 = this.git6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34107 | h: +60
|
34108 | });
|
34109 | this.git7 = this.git7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34110 | h: +120
|
34111 | });
|
34112 |
|
34113 | if (this.darkMode) {
|
34114 | this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git0, 25);
|
34115 | this.git1 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git1, 25);
|
34116 | this.git2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git2, 25);
|
34117 | this.git3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git3, 25);
|
34118 | this.git4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git4, 25);
|
34119 | this.git5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git5, 25);
|
34120 | this.git6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git6, 25);
|
34121 | this.git7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.git7, 25);
|
34122 | } else {
|
34123 | this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git0, 25);
|
34124 | this.git1 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git1, 25);
|
34125 | this.git2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git2, 25);
|
34126 | this.git3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git3, 25);
|
34127 | this.git4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git4, 25);
|
34128 | this.git5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git5, 25);
|
34129 | this.git6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git6, 25);
|
34130 | this.git7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.git7, 25);
|
34131 | }
|
34132 |
|
34133 | this.gitInv0 = this.gitInv0 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git0);
|
34134 | this.gitInv1 = this.gitInv1 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git1);
|
34135 | this.gitInv2 = this.gitInv2 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git2);
|
34136 | this.gitInv3 = this.gitInv3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git3);
|
34137 | this.gitInv4 = this.gitInv4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git4);
|
34138 | this.gitInv5 = this.gitInv5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git5);
|
34139 | this.gitInv6 = this.gitInv6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git6);
|
34140 | this.gitInv7 = this.gitInv7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git7);
|
34141 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
34142 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
34143 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
34144 | this.tagLabelFontSize = this.tagLabelFontSize || '10px';
|
34145 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
34146 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
34147 | this.commitLabelFontSize = this.commitLabelFontSize || '10px';
|
34148 | }
|
34149 | }, {
|
34150 | key: "calculate",
|
34151 | value: function calculate(overrides) {
|
34152 | var _this = this;
|
34153 |
|
34154 | if (_typeof(overrides) !== 'object') {
|
34155 | // Calculate colors form base colors
|
34156 | this.updateColors();
|
34157 | return;
|
34158 | }
|
34159 |
|
34160 | var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
|
34161 |
|
34162 | keys.forEach(function (k) {
|
34163 | _this[k] = overrides[k];
|
34164 | }); // Calculate colors form base colors
|
34165 |
|
34166 | this.updateColors(); // Copy values from overrides again in case of an override of derived value
|
34167 |
|
34168 | keys.forEach(function (k) {
|
34169 | _this[k] = overrides[k];
|
34170 | });
|
34171 | }
|
34172 | }]);
|
34173 |
|
34174 | return Theme;
|
34175 | }();
|
34176 |
|
34177 | var getThemeVariables = function getThemeVariables(userOverrides) {
|
34178 | var theme = new Theme();
|
34179 | theme.calculate(userOverrides);
|
34180 | return theme;
|
34181 | };
|
34182 |
|
34183 | /***/ }),
|
34184 |
|
34185 | /***/ "./src/themes/theme-helpers.js":
|
34186 | /*!*************************************!*\
|
34187 | !*** ./src/themes/theme-helpers.js ***!
|
34188 | \*************************************/
|
34189 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
34190 |
|
34191 | "use strict";
|
34192 | __webpack_require__.r(__webpack_exports__);
|
34193 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
34194 | /* harmony export */ "mkBorder": () => (/* binding */ mkBorder)
|
34195 | /* harmony export */ });
|
34196 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
|
34197 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
|
34198 |
|
34199 | var mkBorder = function mkBorder(col, darkMode) {
|
34200 | return darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(col, {
|
34201 | s: -40,
|
34202 | l: 10
|
34203 | }) : (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(col, {
|
34204 | s: -40,
|
34205 | l: -10
|
34206 | });
|
34207 | };
|
34208 |
|
34209 | /***/ }),
|
34210 |
|
34211 | /***/ "./src/themes/theme-neutral.js":
|
34212 | /*!*************************************!*\
|
34213 | !*** ./src/themes/theme-neutral.js ***!
|
34214 | \*************************************/
|
34215 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
34216 |
|
34217 | "use strict";
|
34218 | __webpack_require__.r(__webpack_exports__);
|
34219 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
34220 | /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
|
34221 | /* harmony export */ });
|
34222 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
|
34223 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
|
34224 | /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
|
34225 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
34226 |
|
34227 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
34228 |
|
34229 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
34230 |
|
34231 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
34232 |
|
34233 |
|
34234 | // const Color = require ( 'khroma/dist/color' ).default
|
34235 | // Color.format.hex.stringify(Color.parse('hsl(210, 66.6666666667%, 95%)')); // => "#EAF2FB"
|
34236 |
|
34237 | var Theme = /*#__PURE__*/function () {
|
34238 | function Theme() {
|
34239 | _classCallCheck(this, Theme);
|
34240 |
|
34241 | this.primaryColor = '#eee';
|
34242 | this.contrast = '#707070';
|
34243 | this.secondaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.contrast, 55);
|
34244 | this.background = '#ffffff'; // this.secondaryColor = adjust(this.primaryColor, { h: 120 });
|
34245 |
|
34246 | this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34247 | h: -160
|
34248 | });
|
34249 | this.primaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode);
|
34250 | this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
|
34251 | this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode); // this.noteBorderColor = mkBorder(this.noteBkgColor, this.darkMode);
|
34252 |
|
34253 | this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
|
34254 | this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
|
34255 | this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.tertiaryColor);
|
34256 | this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
34257 | this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background); // this.altBackground = lighten(this.contrast, 55);
|
34258 |
|
34259 | this.mainBkg = '#eee';
|
34260 | this.secondBkg = 'calculated';
|
34261 | this.lineColor = '#666';
|
34262 | this.border1 = '#999';
|
34263 | this.border2 = 'calculated';
|
34264 | this.note = '#ffa';
|
34265 | this.text = '#333';
|
34266 | this.critical = '#d42';
|
34267 | this.done = '#bbb';
|
34268 | this.arrowheadColor = '#333333';
|
34269 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
34270 | this.fontSize = '16px';
|
34271 | /* Flowchart variables */
|
34272 |
|
34273 | this.nodeBkg = 'calculated';
|
34274 | this.nodeBorder = 'calculated';
|
34275 | this.clusterBkg = 'calculated';
|
34276 | this.clusterBorder = 'calculated';
|
34277 | this.defaultLinkColor = 'calculated';
|
34278 | this.titleColor = 'calculated';
|
34279 | this.edgeLabelBackground = 'white';
|
34280 | /* Sequence Diagram variables */
|
34281 |
|
34282 | this.actorBorder = 'calculated';
|
34283 | this.actorBkg = 'calculated';
|
34284 | this.actorTextColor = 'calculated';
|
34285 | this.actorLineColor = 'calculated';
|
34286 | this.signalColor = 'calculated';
|
34287 | this.signalTextColor = 'calculated';
|
34288 | this.labelBoxBkgColor = 'calculated';
|
34289 | this.labelBoxBorderColor = 'calculated';
|
34290 | this.labelTextColor = 'calculated';
|
34291 | this.loopTextColor = 'calculated';
|
34292 | this.noteBorderColor = 'calculated';
|
34293 | this.noteBkgColor = 'calculated';
|
34294 | this.noteTextColor = 'calculated';
|
34295 | this.activationBorderColor = '#666';
|
34296 | this.activationBkgColor = '#f4f4f4';
|
34297 | this.sequenceNumberColor = 'white';
|
34298 | /* Gantt chart variables */
|
34299 |
|
34300 | this.sectionBkgColor = 'calculated';
|
34301 | this.altSectionBkgColor = 'white';
|
34302 | this.sectionBkgColor2 = 'calculated';
|
34303 | this.excludeBkgColor = '#eeeeee';
|
34304 | this.taskBorderColor = 'calculated';
|
34305 | this.taskBkgColor = 'calculated';
|
34306 | this.taskTextLightColor = 'white';
|
34307 | this.taskTextColor = 'calculated';
|
34308 | this.taskTextDarkColor = 'calculated';
|
34309 | this.taskTextOutsideColor = 'calculated';
|
34310 | this.taskTextClickableColor = '#003163';
|
34311 | this.activeTaskBorderColor = 'calculated';
|
34312 | this.activeTaskBkgColor = 'calculated';
|
34313 | this.gridColor = 'calculated';
|
34314 | this.doneTaskBkgColor = 'calculated';
|
34315 | this.doneTaskBorderColor = 'calculated';
|
34316 | this.critBkgColor = 'calculated';
|
34317 | this.critBorderColor = 'calculated';
|
34318 | this.todayLineColor = 'calculated';
|
34319 | /* C4 Context Diagram variables */
|
34320 |
|
34321 | this.personBorder = 'calculated';
|
34322 | this.personBkg = 'calculated';
|
34323 | /* state colors */
|
34324 |
|
34325 | this.labelColor = 'black';
|
34326 | this.errorBkgColor = '#552222';
|
34327 | this.errorTextColor = '#552222';
|
34328 | }
|
34329 |
|
34330 | _createClass(Theme, [{
|
34331 | key: "updateColors",
|
34332 | value: function updateColors() {
|
34333 | this.secondBkg = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.contrast, 55);
|
34334 | this.border2 = this.contrast;
|
34335 | /* Flowchart variables */
|
34336 |
|
34337 | this.nodeBkg = this.mainBkg;
|
34338 | this.nodeBorder = this.border1;
|
34339 | this.clusterBkg = this.secondBkg;
|
34340 | this.clusterBorder = this.border2;
|
34341 | this.defaultLinkColor = this.lineColor;
|
34342 | this.titleColor = this.text;
|
34343 | /* Sequence Diagram variables */
|
34344 |
|
34345 | this.actorBorder = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.border1, 23);
|
34346 | this.actorBkg = this.mainBkg;
|
34347 | this.actorTextColor = this.text;
|
34348 | this.actorLineColor = this.lineColor;
|
34349 | this.signalColor = this.text;
|
34350 | this.signalTextColor = this.text;
|
34351 | this.labelBoxBkgColor = this.actorBkg;
|
34352 | this.labelBoxBorderColor = this.actorBorder;
|
34353 | this.labelTextColor = this.text;
|
34354 | this.loopTextColor = this.text;
|
34355 | this.noteBorderColor = '#999';
|
34356 | this.noteBkgColor = '#666';
|
34357 | this.noteTextColor = '#fff';
|
34358 | /* Gantt chart variables */
|
34359 |
|
34360 | this.sectionBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.contrast, 30);
|
34361 | this.sectionBkgColor2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.contrast, 30);
|
34362 | this.taskBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.contrast, 10);
|
34363 | this.taskBkgColor = this.contrast;
|
34364 | this.taskTextColor = this.taskTextLightColor;
|
34365 | this.taskTextDarkColor = this.text;
|
34366 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
34367 | this.activeTaskBorderColor = this.taskBorderColor;
|
34368 | this.activeTaskBkgColor = this.mainBkg;
|
34369 | this.gridColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.border1, 30);
|
34370 | this.doneTaskBkgColor = this.done;
|
34371 | this.doneTaskBorderColor = this.lineColor;
|
34372 | this.critBkgColor = this.critical;
|
34373 | this.critBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.critBkgColor, 10);
|
34374 | this.todayLineColor = this.critBkgColor;
|
34375 | /* state colors */
|
34376 |
|
34377 | this.transitionColor = this.transitionColor || '#000';
|
34378 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
34379 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
34380 | this.stateBkg = this.stateBkg || this.mainBkg;
|
34381 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
34382 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
34383 | this.altBackground = this.altBackground || '#f4f4f4';
|
34384 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
34385 | this.stateBorder = this.stateBorder || '#000';
|
34386 | this.innerEndBackground = this.primaryBorderColor;
|
34387 | this.specialStateColor = '#222';
|
34388 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
34389 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
34390 | /* class */
|
34391 |
|
34392 | this.classText = this.primaryTextColor;
|
34393 | /* journey */
|
34394 |
|
34395 | this.fillType0 = this.primaryColor;
|
34396 | this.fillType1 = this.secondaryColor;
|
34397 | this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34398 | h: 64
|
34399 | });
|
34400 | this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
34401 | h: 64
|
34402 | });
|
34403 | this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34404 | h: -64
|
34405 | });
|
34406 | this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
34407 | h: -64
|
34408 | });
|
34409 | this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34410 | h: 128
|
34411 | });
|
34412 | this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
34413 | h: 128
|
34414 | }); // /* pie */
|
34415 |
|
34416 | this.pie1 = this.pie1 || '#F4F4F4';
|
34417 | this.pie2 = this.pie2 || '#555';
|
34418 | this.pie3 = this.pie3 || '#BBB';
|
34419 | this.pie4 = this.pie4 || '#777';
|
34420 | this.pie5 = this.pie5 || '#999';
|
34421 | this.pie6 = this.pie6 || '#DDD';
|
34422 | this.pie7 = this.pie7 || '#FFF';
|
34423 | this.pie8 = this.pie8 || '#DDD';
|
34424 | this.pie9 = this.pie9 || '#BBB';
|
34425 | this.pie10 = this.pie10 || '#999';
|
34426 | this.pie11 = this.pie11 || '#777';
|
34427 | this.pie12 = this.pie12 || '#555';
|
34428 | this.pieTitleTextSize = this.pieTitleTextSize || '25px';
|
34429 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
34430 | this.pieSectionTextSize = this.pieSectionTextSize || '17px';
|
34431 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
34432 | this.pieLegendTextSize = this.pieLegendTextSize || '17px';
|
34433 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
34434 | this.pieStrokeColor = this.pieStrokeColor || 'black';
|
34435 | this.pieStrokeWidth = this.pieStrokeWidth || '2px';
|
34436 | this.pieOpacity = this.pieOpacity || '0.7'; // this.pie1 = this.pie1 || '#212529';
|
34437 | // this.pie2 = this.pie2 || '#343A40';
|
34438 | // this.pie3 = this.pie3 || '#495057';
|
34439 | // this.pie4 = this.pie4 || '#6C757D';
|
34440 | // this.pie5 = this.pie5 || adjust(this.secondaryColor, { l: -10 });
|
34441 | // this.pie6 = this.pie6 || adjust(this.tertiaryColor, { l: -10 });
|
34442 | // this.pie7 = this.pie7 || adjust(this.primaryColor, { h: +60, l: -10 });
|
34443 | // this.pie8 = this.pie8 || adjust(this.primaryColor, { h: -60, l: -10 });
|
34444 | // this.pie9 = this.pie9 || adjust(this.primaryColor, { h: 120, l: 0 });
|
34445 | // this.pie10 = this.pie10 || adjust(this.primaryColor, { h: +60, l: -20 });
|
34446 | // this.pie11 = this.pie11 || adjust(this.primaryColor, { h: -60, l: -20 });
|
34447 | // this.pie12 = this.pie12 || adjust(this.primaryColor, { h: 120, l: -10 });
|
34448 |
|
34449 | /* requirement-diagram */
|
34450 |
|
34451 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
34452 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
34453 | this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
|
34454 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
34455 | this.relationColor = this.relationColor || this.lineColor;
|
34456 | this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
|
34457 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
34458 | /* git */
|
34459 |
|
34460 | this.git0 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.pie1, 25) || this.primaryColor;
|
34461 | this.git1 = this.pie2 || this.secondaryColor;
|
34462 | this.git2 = this.pie3 || this.tertiaryColor;
|
34463 | this.git3 = this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34464 | h: -30
|
34465 | });
|
34466 | this.git4 = this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34467 | h: -60
|
34468 | });
|
34469 | this.git5 = this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34470 | h: -90
|
34471 | });
|
34472 | this.git6 = this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34473 | h: +60
|
34474 | });
|
34475 | this.git7 = this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
34476 | h: +120
|
34477 | });
|
34478 | this.gitInv0 = this.gitInv0 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git0);
|
34479 | this.gitInv1 = this.gitInv1 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git1);
|
34480 | this.gitInv2 = this.gitInv2 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git2);
|
34481 | this.gitInv3 = this.gitInv3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git3);
|
34482 | this.gitInv4 = this.gitInv4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git4);
|
34483 | this.gitInv5 = this.gitInv5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git5);
|
34484 | this.gitInv6 = this.gitInv6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git6);
|
34485 | this.gitInv7 = this.gitInv7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.git7);
|
34486 | this.branchLabelColor = this.branchLabelColor || this.labelTextColor;
|
34487 | this.gitBranchLabel0 = this.branchLabelColor;
|
34488 | this.gitBranchLabel1 = 'white';
|
34489 | this.gitBranchLabel2 = this.branchLabelColor;
|
34490 | this.gitBranchLabel3 = 'white';
|
34491 | this.gitBranchLabel4 = this.branchLabelColor;
|
34492 | this.gitBranchLabel5 = this.branchLabelColor;
|
34493 | this.gitBranchLabel6 = this.branchLabelColor;
|
34494 | this.gitBranchLabel7 = this.branchLabelColor;
|
34495 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
34496 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
34497 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
34498 | this.tagLabelFontSize = this.tagLabelFontSize || '10px';
|
34499 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
34500 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
34501 | this.commitLabelFontSize = this.commitLabelFontSize || '10px';
|
34502 | }
|
34503 | }, {
|
34504 | key: "calculate",
|
34505 | value: function calculate(overrides) {
|
34506 | var _this = this;
|
34507 |
|
34508 | if (_typeof(overrides) !== 'object') {
|
34509 | // Calculate colors form base colors
|
34510 | this.updateColors();
|
34511 | return;
|
34512 | }
|
34513 |
|
34514 | var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
|
34515 |
|
34516 | keys.forEach(function (k) {
|
34517 | _this[k] = overrides[k];
|
34518 | }); // Calculate colors form base colors
|
34519 |
|
34520 | this.updateColors(); // Copy values from overrides again in case of an override of derived value
|
34521 |
|
34522 | keys.forEach(function (k) {
|
34523 | _this[k] = overrides[k];
|
34524 | });
|
34525 | }
|
34526 | }]);
|
34527 |
|
34528 | return Theme;
|
34529 | }();
|
34530 |
|
34531 | var getThemeVariables = function getThemeVariables(userOverrides) {
|
34532 | var theme = new Theme();
|
34533 | theme.calculate(userOverrides);
|
34534 | return theme;
|
34535 | };
|
34536 |
|
34537 | /***/ }),
|
34538 |
|
34539 | /***/ "./src/utils.js":
|
34540 | /*!**********************!*\
|
34541 | !*** ./src/utils.js ***!
|
34542 | \**********************/
|
34543 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
34544 |
|
34545 | "use strict";
|
34546 | __webpack_require__.r(__webpack_exports__);
|
34547 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
34548 | /* harmony export */ "calculateSvgSizeAttrs": () => (/* binding */ calculateSvgSizeAttrs),
|
34549 | /* harmony export */ "calculateTextDimensions": () => (/* binding */ calculateTextDimensions),
|
34550 | /* harmony export */ "calculateTextHeight": () => (/* binding */ calculateTextHeight),
|
34551 | /* harmony export */ "calculateTextWidth": () => (/* binding */ calculateTextWidth),
|
34552 | /* harmony export */ "configureSvgSize": () => (/* binding */ configureSvgSize),
|
34553 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
34554 | /* harmony export */ "detectDirective": () => (/* binding */ detectDirective),
|
34555 | /* harmony export */ "detectInit": () => (/* binding */ detectInit),
|
34556 | /* harmony export */ "directiveSanitizer": () => (/* binding */ directiveSanitizer),
|
34557 | /* harmony export */ "drawSimpleText": () => (/* binding */ drawSimpleText),
|
34558 | /* harmony export */ "entityDecode": () => (/* binding */ entityDecode),
|
34559 | /* harmony export */ "formatUrl": () => (/* binding */ formatUrl),
|
34560 | /* harmony export */ "generateId": () => (/* binding */ generateId),
|
34561 | /* harmony export */ "getStylesFromArray": () => (/* binding */ getStylesFromArray),
|
34562 | /* harmony export */ "getTextObj": () => (/* binding */ getTextObj),
|
34563 | /* harmony export */ "initIdGenerator": () => (/* binding */ initIdGenerator),
|
34564 | /* harmony export */ "interpolateToCurve": () => (/* binding */ interpolateToCurve),
|
34565 | /* harmony export */ "isSubstringInArray": () => (/* binding */ isSubstringInArray),
|
34566 | /* harmony export */ "random": () => (/* binding */ random),
|
34567 | /* harmony export */ "runFunc": () => (/* binding */ runFunc),
|
34568 | /* harmony export */ "sanitizeCss": () => (/* binding */ sanitizeCss),
|
34569 | /* harmony export */ "setupGraphViewbox": () => (/* binding */ setupGraphViewbox),
|
34570 | /* harmony export */ "wrapLabel": () => (/* binding */ wrapLabel)
|
34571 | /* harmony export */ });
|
34572 | /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @braintree/sanitize-url */ "@braintree/sanitize-url");
|
34573 | /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__);
|
34574 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
|
34575 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
|
34576 | /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./diagrams/common/common */ "./src/diagrams/common/common.js");
|
34577 | /* harmony import */ var _defaultConfig__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./defaultConfig */ "./src/defaultConfig.js");
|
34578 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
|
34579 | /* harmony import */ var _diagram_api_detectType__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./diagram-api/detectType */ "./src/diagram-api/detectType.js");
|
34580 | /* harmony import */ var _assignWithDepth__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./assignWithDepth */ "./src/assignWithDepth.js");
|
34581 | var _this = undefined;
|
34582 |
|
34583 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
34584 |
|
34585 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
34586 |
|
34587 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
34588 |
|
34589 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
34590 |
|
34591 | function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
34592 |
|
34593 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
34594 |
|
34595 | function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
34596 |
|
34597 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
34598 |
|
34599 | function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
34600 |
|
34601 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
34602 |
|
34603 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
34604 |
|
34605 |
|
34606 |
|
34607 |
|
34608 |
|
34609 |
|
34610 |
|
34611 | // Effectively an enum of the supported curve types, accessible by name
|
34612 |
|
34613 | var d3CurveTypes = {
|
34614 | curveBasis: d3__WEBPACK_IMPORTED_MODULE_1__.curveBasis,
|
34615 | curveBasisClosed: d3__WEBPACK_IMPORTED_MODULE_1__.curveBasisClosed,
|
34616 | curveBasisOpen: d3__WEBPACK_IMPORTED_MODULE_1__.curveBasisOpen,
|
34617 | curveLinear: d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear,
|
34618 | curveLinearClosed: d3__WEBPACK_IMPORTED_MODULE_1__.curveLinearClosed,
|
34619 | curveMonotoneX: d3__WEBPACK_IMPORTED_MODULE_1__.curveMonotoneX,
|
34620 | curveMonotoneY: d3__WEBPACK_IMPORTED_MODULE_1__.curveMonotoneY,
|
34621 | curveNatural: d3__WEBPACK_IMPORTED_MODULE_1__.curveNatural,
|
34622 | curveStep: d3__WEBPACK_IMPORTED_MODULE_1__.curveStep,
|
34623 | curveStepAfter: d3__WEBPACK_IMPORTED_MODULE_1__.curveStepAfter,
|
34624 | curveStepBefore: d3__WEBPACK_IMPORTED_MODULE_1__.curveStepBefore
|
34625 | };
|
34626 | var directive = /[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
|
34627 | var directiveWithoutOpen = /\s*(?:(?:(\w+)(?=:):|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
|
34628 | var anyComment = /\s*%%.*\n/gm;
|
34629 | /**
|
34630 | * @function detectInit Detects the init config object from the text
|
34631 | *
|
34632 | * ```mermaid
|
34633 | * %%{init: {"theme": "debug", "logLevel": 1 }}%%
|
34634 | * graph LR
|
34635 | * a-->b
|
34636 | * b-->c
|
34637 | * c-->d
|
34638 | * d-->e
|
34639 | * e-->f
|
34640 | * f-->g
|
34641 | * g-->h
|
34642 | * ```
|
34643 | *
|
34644 | * Or
|
34645 | *
|
34646 | * ```mermaid
|
34647 | * %%{initialize: {"theme": "dark", logLevel: "debug" }}%%
|
34648 | * graph LR
|
34649 | * a-->b
|
34650 | * b-->c
|
34651 | * c-->d
|
34652 | * d-->e
|
34653 | * e-->f
|
34654 | * f-->g
|
34655 | * g-->h
|
34656 | * ```
|
34657 | * @param {string} text The text defining the graph
|
34658 | * @param {any} cnf
|
34659 | * @returns {object} The json object representing the init passed to mermaid.initialize()
|
34660 | */
|
34661 |
|
34662 | var detectInit = function detectInit(text, cnf) {
|
34663 | var inits = detectDirective(text, /(?:init\b)|(?:initialize\b)/);
|
34664 | var results = {};
|
34665 |
|
34666 | if (Array.isArray(inits)) {
|
34667 | var args = inits.map(function (init) {
|
34668 | return init.args;
|
34669 | });
|
34670 | directiveSanitizer(args);
|
34671 | results = (0,_assignWithDepth__WEBPACK_IMPORTED_MODULE_2__["default"])(results, _toConsumableArray(args));
|
34672 | } else {
|
34673 | results = inits.args;
|
34674 | }
|
34675 |
|
34676 | if (results) {
|
34677 | var type = (0,_diagram_api_detectType__WEBPACK_IMPORTED_MODULE_3__["default"])(text, cnf);
|
34678 | ['config'].forEach(function (prop) {
|
34679 | if (typeof results[prop] !== 'undefined') {
|
34680 | if (type === 'flowchart-v2') {
|
34681 | type = 'flowchart';
|
34682 | }
|
34683 |
|
34684 | results[type] = results[prop];
|
34685 | delete results[prop];
|
34686 | }
|
34687 | });
|
34688 | } // Todo: refactor this, these results are never used
|
34689 |
|
34690 |
|
34691 | return results;
|
34692 | };
|
34693 | /**
|
34694 | * @function detectDirective Detects the directive from the text. Text can be single line or
|
34695 | * multiline. If type is null or omitted the first directive encountered in text will be returned
|
34696 | *
|
34697 | * ```mermaid
|
34698 | * graph LR
|
34699 | * %%{somedirective}%%
|
34700 | * a-->b
|
34701 | * b-->c
|
34702 | * c-->d
|
34703 | * d-->e
|
34704 | * e-->f
|
34705 | * f-->g
|
34706 | * g-->h
|
34707 | * ```
|
34708 | * @param {string} text The text defining the graph
|
34709 | * @param {string | RegExp} type The directive to return (default: null)
|
34710 | * @returns {object | Array} An object or Array representing the directive(s): { type: string, args:
|
34711 | * object|null } matched by the input type if a single directive was found, that directive object
|
34712 | * will be returned.
|
34713 | */
|
34714 |
|
34715 | var detectDirective = function detectDirective(text) {
|
34716 | var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
34717 |
|
34718 | try {
|
34719 | var commentWithoutDirectives = new RegExp("[%]{2}(?![{]".concat(directiveWithoutOpen.source, ")(?=[}][%]{2}).*\n"), 'ig');
|
34720 | text = text.trim().replace(commentWithoutDirectives, '').replace(/'/gm, '"');
|
34721 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug("Detecting diagram directive".concat(type !== null ? ' type:' + type : '', " based on the text:").concat(text));
|
34722 | var match,
|
34723 | result = [];
|
34724 |
|
34725 | while ((match = directive.exec(text)) !== null) {
|
34726 | // This is necessary to avoid infinite loops with zero-width matches
|
34727 | if (match.index === directive.lastIndex) {
|
34728 | directive.lastIndex++;
|
34729 | }
|
34730 |
|
34731 | if (match && !type || type && match[1] && match[1].match(type) || type && match[2] && match[2].match(type)) {
|
34732 | var _type = match[1] ? match[1] : match[2];
|
34733 |
|
34734 | var args = match[3] ? match[3].trim() : match[4] ? JSON.parse(match[4].trim()) : null;
|
34735 | result.push({
|
34736 | type: _type,
|
34737 | args: args
|
34738 | });
|
34739 | }
|
34740 | }
|
34741 |
|
34742 | if (result.length === 0) {
|
34743 | result.push({
|
34744 | type: text,
|
34745 | args: null
|
34746 | });
|
34747 | }
|
34748 |
|
34749 | return result.length === 1 ? result[0] : result;
|
34750 | } catch (error) {
|
34751 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.error("ERROR: ".concat(error.message, " - Unable to parse directive\n ").concat(type !== null ? ' type:' + type : '', " based on the text:").concat(text));
|
34752 | return {
|
34753 | type: null,
|
34754 | args: null
|
34755 | };
|
34756 | }
|
34757 | };
|
34758 | /**
|
34759 | * Caches results of functions based on input
|
34760 | *
|
34761 | * @param {Function} fn Function to run
|
34762 | * @param {Function} resolver Function that resolves to an ID given arguments the `fn` takes
|
34763 | * @returns {Function} An optimized caching function
|
34764 | */
|
34765 |
|
34766 | var memoize = function memoize(fn, resolver) {
|
34767 | var cache = {};
|
34768 | return function () {
|
34769 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
34770 | args[_key] = arguments[_key];
|
34771 | }
|
34772 |
|
34773 | var n = resolver ? resolver.apply(_this, args) : args[0];
|
34774 |
|
34775 | if (n in cache) {
|
34776 | return cache[n];
|
34777 | } else {
|
34778 | var result = fn.apply(void 0, args);
|
34779 | cache[n] = result;
|
34780 | return result;
|
34781 | }
|
34782 | };
|
34783 | };
|
34784 | /**
|
34785 | * @function isSubstringInArray Detects whether a substring in present in a given array
|
34786 | * @param {string} str The substring to detect
|
34787 | * @param {Array} arr The array to search
|
34788 | * @returns {number} The array index containing the substring or -1 if not present
|
34789 | */
|
34790 |
|
34791 |
|
34792 | var isSubstringInArray = function isSubstringInArray(str, arr) {
|
34793 | for (var i = 0; i < arr.length; i++) {
|
34794 | if (arr[i].match(str)) return i;
|
34795 | }
|
34796 |
|
34797 | return -1;
|
34798 | };
|
34799 | /**
|
34800 | * Returns a d3 curve given a curve name
|
34801 | *
|
34802 | * @param {string | undefined} interpolate The interpolation name
|
34803 | * @param {any} defaultCurve The default curve to return
|
34804 | * @returns {import('d3-shape').CurveFactory} The curve factory to use
|
34805 | */
|
34806 |
|
34807 | var interpolateToCurve = function interpolateToCurve(interpolate, defaultCurve) {
|
34808 | if (!interpolate) {
|
34809 | return defaultCurve;
|
34810 | }
|
34811 |
|
34812 | var curveName = "curve".concat(interpolate.charAt(0).toUpperCase() + interpolate.slice(1));
|
34813 | return d3CurveTypes[curveName] || defaultCurve;
|
34814 | };
|
34815 | /**
|
34816 | * Formats a URL string
|
34817 | *
|
34818 | * @param {string} linkStr String of the URL
|
34819 | * @param {{ securityLevel: string }} config Configuration passed to MermaidJS
|
34820 | * @returns {string | undefined} The formatted URL
|
34821 | */
|
34822 |
|
34823 | var formatUrl = function formatUrl(linkStr, config) {
|
34824 | var url = linkStr.trim();
|
34825 |
|
34826 | if (url) {
|
34827 | if (config.securityLevel !== 'loose') {
|
34828 | return (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__.sanitizeUrl)(url);
|
34829 | }
|
34830 |
|
34831 | return url;
|
34832 | }
|
34833 | };
|
34834 | /**
|
34835 | * Runs a function
|
34836 | *
|
34837 | * @param {string} functionName A dot seperated path to the function relative to the `window`
|
34838 | * @param {...any} params Parameters to pass to the function
|
34839 | */
|
34840 |
|
34841 | var runFunc = function runFunc(functionName) {
|
34842 | var _obj;
|
34843 |
|
34844 | var arrPaths = functionName.split('.');
|
34845 | var len = arrPaths.length - 1;
|
34846 | var fnName = arrPaths[len];
|
34847 | var obj = window;
|
34848 |
|
34849 | for (var i = 0; i < len; i++) {
|
34850 | obj = obj[arrPaths[i]];
|
34851 | if (!obj) return;
|
34852 | }
|
34853 |
|
34854 | for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
34855 | params[_key2 - 1] = arguments[_key2];
|
34856 | }
|
34857 |
|
34858 | (_obj = obj)[fnName].apply(_obj, params);
|
34859 | };
|
34860 | /**
|
34861 | * @typedef {object} Point A (x, y) point
|
34862 | * @property {number} x The x value
|
34863 | * @property {number} y The y value
|
34864 | */
|
34865 |
|
34866 | /**
|
34867 | * Finds the distance between two points using the Distance Formula
|
34868 | *
|
34869 | * @param {Point} p1 The first point
|
34870 | * @param {Point} p2 The second point
|
34871 | * @returns {number} The distance
|
34872 | */
|
34873 |
|
34874 | var distance = function distance(p1, p2) {
|
34875 | return p1 && p2 ? Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)) : 0;
|
34876 | };
|
34877 | /**
|
34878 | * @param {Point[]} points List of points
|
34879 | * @returns {Point}
|
34880 | * @todo Give this a description
|
34881 | */
|
34882 |
|
34883 |
|
34884 | var traverseEdge = function traverseEdge(points) {
|
34885 | var prevPoint;
|
34886 | var totalDistance = 0;
|
34887 | points.forEach(function (point) {
|
34888 | totalDistance += distance(point, prevPoint);
|
34889 | prevPoint = point;
|
34890 | }); // Traverse half of total distance along points
|
34891 |
|
34892 | var remainingDistance = totalDistance / 2;
|
34893 | var center = undefined;
|
34894 | prevPoint = undefined;
|
34895 | points.forEach(function (point) {
|
34896 | if (prevPoint && !center) {
|
34897 | var vectorDistance = distance(point, prevPoint);
|
34898 |
|
34899 | if (vectorDistance < remainingDistance) {
|
34900 | remainingDistance -= vectorDistance;
|
34901 | } else {
|
34902 | // The point is remainingDistance from prevPoint in the vector between prevPoint and point
|
34903 | // Calculate the coordinates
|
34904 | var distanceRatio = remainingDistance / vectorDistance;
|
34905 | if (distanceRatio <= 0) center = prevPoint;
|
34906 | if (distanceRatio >= 1) center = {
|
34907 | x: point.x,
|
34908 | y: point.y
|
34909 | };
|
34910 |
|
34911 | if (distanceRatio > 0 && distanceRatio < 1) {
|
34912 | center = {
|
34913 | x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
|
34914 | y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y
|
34915 | };
|
34916 | }
|
34917 | }
|
34918 | }
|
34919 |
|
34920 | prevPoint = point;
|
34921 | });
|
34922 | return center;
|
34923 | };
|
34924 | /**
|
34925 | * Alias for `traverseEdge`
|
34926 | *
|
34927 | * @param {Point[]} points List of points
|
34928 | * @returns {Point} Return result of `transverseEdge`
|
34929 | */
|
34930 |
|
34931 |
|
34932 | var calcLabelPosition = function calcLabelPosition(points) {
|
34933 | if (points.length === 1) {
|
34934 | return points[0];
|
34935 | }
|
34936 |
|
34937 | return traverseEdge(points);
|
34938 | };
|
34939 |
|
34940 | var calcCardinalityPosition = function calcCardinalityPosition(isRelationTypePresent, points, initialPosition) {
|
34941 | var prevPoint;
|
34942 | var totalDistance = 0; // eslint-disable-line
|
34943 |
|
34944 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('our points', points);
|
34945 |
|
34946 | if (points[0] !== initialPosition) {
|
34947 | points = points.reverse();
|
34948 | }
|
34949 |
|
34950 | points.forEach(function (point) {
|
34951 | totalDistance += distance(point, prevPoint);
|
34952 | prevPoint = point;
|
34953 | }); // Traverse only 25 total distance along points to find cardinality point
|
34954 |
|
34955 | var distanceToCardinalityPoint = 25;
|
34956 | var remainingDistance = distanceToCardinalityPoint;
|
34957 | var center;
|
34958 | prevPoint = undefined;
|
34959 | points.forEach(function (point) {
|
34960 | if (prevPoint && !center) {
|
34961 | var vectorDistance = distance(point, prevPoint);
|
34962 |
|
34963 | if (vectorDistance < remainingDistance) {
|
34964 | remainingDistance -= vectorDistance;
|
34965 | } else {
|
34966 | // The point is remainingDistance from prevPoint in the vector between prevPoint and point
|
34967 | // Calculate the coordinates
|
34968 | var distanceRatio = remainingDistance / vectorDistance;
|
34969 | if (distanceRatio <= 0) center = prevPoint;
|
34970 | if (distanceRatio >= 1) center = {
|
34971 | x: point.x,
|
34972 | y: point.y
|
34973 | };
|
34974 |
|
34975 | if (distanceRatio > 0 && distanceRatio < 1) {
|
34976 | center = {
|
34977 | x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
|
34978 | y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y
|
34979 | };
|
34980 | }
|
34981 | }
|
34982 | }
|
34983 |
|
34984 | prevPoint = point;
|
34985 | }); // if relation is present (Arrows will be added), change cardinality point off-set distance (d)
|
34986 |
|
34987 | var d = isRelationTypePresent ? 10 : 5; //Calculate Angle for x and y axis
|
34988 |
|
34989 | var angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
|
34990 | var cardinalityPosition = {
|
34991 | x: 0,
|
34992 | y: 0
|
34993 | }; //Calculation cardinality position using angle, center point on the line/curve but pendicular and with offset-distance
|
34994 |
|
34995 | cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
|
34996 | cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
|
34997 | return cardinalityPosition;
|
34998 | };
|
34999 | /**
|
35000 | * Position ['start_left', 'start_right', 'end_left', 'end_right']
|
35001 | *
|
35002 | * @param {any} terminalMarkerSize
|
35003 | * @param {any} position
|
35004 | * @param {any} _points
|
35005 | * @returns {any}
|
35006 | */
|
35007 |
|
35008 |
|
35009 | var calcTerminalLabelPosition = function calcTerminalLabelPosition(terminalMarkerSize, position, _points) {
|
35010 | // Todo looking to faster cloning method
|
35011 | var points = JSON.parse(JSON.stringify(_points));
|
35012 | var prevPoint;
|
35013 | var totalDistance = 0; // eslint-disable-line
|
35014 |
|
35015 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('our points', points);
|
35016 |
|
35017 | if (position !== 'start_left' && position !== 'start_right') {
|
35018 | points = points.reverse();
|
35019 | }
|
35020 |
|
35021 | points.forEach(function (point) {
|
35022 | totalDistance += distance(point, prevPoint);
|
35023 | prevPoint = point;
|
35024 | }); // Traverse only 25 total distance along points to find cardinality point
|
35025 |
|
35026 | var distanceToCardinalityPoint = 25 + terminalMarkerSize;
|
35027 | var remainingDistance = distanceToCardinalityPoint;
|
35028 | var center;
|
35029 | prevPoint = undefined;
|
35030 | points.forEach(function (point) {
|
35031 | if (prevPoint && !center) {
|
35032 | var vectorDistance = distance(point, prevPoint);
|
35033 |
|
35034 | if (vectorDistance < remainingDistance) {
|
35035 | remainingDistance -= vectorDistance;
|
35036 | } else {
|
35037 | // The point is remainingDistance from prevPoint in the vector between prevPoint and point
|
35038 | // Calculate the coordinates
|
35039 | var distanceRatio = remainingDistance / vectorDistance;
|
35040 | if (distanceRatio <= 0) center = prevPoint;
|
35041 | if (distanceRatio >= 1) center = {
|
35042 | x: point.x,
|
35043 | y: point.y
|
35044 | };
|
35045 |
|
35046 | if (distanceRatio > 0 && distanceRatio < 1) {
|
35047 | center = {
|
35048 | x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
|
35049 | y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y
|
35050 | };
|
35051 | }
|
35052 | }
|
35053 | }
|
35054 |
|
35055 | prevPoint = point;
|
35056 | }); // if relation is present (Arrows will be added), change cardinality point off-set distance (d)
|
35057 |
|
35058 | var d = 10 + terminalMarkerSize * 0.5; //Calculate Angle for x and y axis
|
35059 |
|
35060 | var angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
|
35061 | var cardinalityPosition = {
|
35062 | x: 0,
|
35063 | y: 0
|
35064 | }; //Calculation cardinality position using angle, center point on the line/curve but pendicular and with offset-distance
|
35065 |
|
35066 | cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
|
35067 | cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
|
35068 |
|
35069 | if (position === 'start_left') {
|
35070 | cardinalityPosition.x = Math.sin(angle + Math.PI) * d + (points[0].x + center.x) / 2;
|
35071 | cardinalityPosition.y = -Math.cos(angle + Math.PI) * d + (points[0].y + center.y) / 2;
|
35072 | }
|
35073 |
|
35074 | if (position === 'end_right') {
|
35075 | cardinalityPosition.x = Math.sin(angle - Math.PI) * d + (points[0].x + center.x) / 2 - 5;
|
35076 | cardinalityPosition.y = -Math.cos(angle - Math.PI) * d + (points[0].y + center.y) / 2 - 5;
|
35077 | }
|
35078 |
|
35079 | if (position === 'end_left') {
|
35080 | cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2 - 5;
|
35081 | cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2 - 5;
|
35082 | }
|
35083 |
|
35084 | return cardinalityPosition;
|
35085 | };
|
35086 | /**
|
35087 | * Gets styles from an array of declarations
|
35088 | *
|
35089 | * @param {string[]} arr Declarations
|
35090 | * @returns {{ style: string; labelStyle: string }} The styles grouped as strings
|
35091 | */
|
35092 |
|
35093 |
|
35094 | var getStylesFromArray = function getStylesFromArray(arr) {
|
35095 | var style = '';
|
35096 | var labelStyle = '';
|
35097 |
|
35098 | for (var i = 0; i < arr.length; i++) {
|
35099 | if (typeof arr[i] !== 'undefined') {
|
35100 | // add text properties to label style definition
|
35101 | if (arr[i].startsWith('color:') || arr[i].startsWith('text-align:')) {
|
35102 | labelStyle = labelStyle + arr[i] + ';';
|
35103 | } else {
|
35104 | style = style + arr[i] + ';';
|
35105 | }
|
35106 | }
|
35107 | }
|
35108 |
|
35109 | return {
|
35110 | style: style,
|
35111 | labelStyle: labelStyle
|
35112 | };
|
35113 | };
|
35114 | var cnt = 0;
|
35115 | var generateId = function generateId() {
|
35116 | cnt++;
|
35117 | return 'id-' + Math.random().toString(36).substr(2, 12) + '-' + cnt;
|
35118 | };
|
35119 | /**
|
35120 | * @param {any} length
|
35121 | * @returns {any}
|
35122 | */
|
35123 |
|
35124 | function makeid(length) {
|
35125 | var result = '';
|
35126 | var characters = '0123456789abcdef';
|
35127 | var charactersLength = characters.length;
|
35128 |
|
35129 | for (var i = 0; i < length; i++) {
|
35130 | result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
35131 | }
|
35132 |
|
35133 | return result;
|
35134 | }
|
35135 |
|
35136 | var random = function random(options) {
|
35137 | return makeid(options.length);
|
35138 | };
|
35139 | var getTextObj = function getTextObj() {
|
35140 | return {
|
35141 | x: 0,
|
35142 | y: 0,
|
35143 | fill: undefined,
|
35144 | anchor: 'start',
|
35145 | style: '#666',
|
35146 | width: 100,
|
35147 | height: 100,
|
35148 | textMargin: 0,
|
35149 | rx: 0,
|
35150 | ry: 0,
|
35151 | valign: undefined
|
35152 | };
|
35153 | };
|
35154 | /**
|
35155 | * Adds text to an element
|
35156 | *
|
35157 | * @param {SVGElement} elem Element to add text to
|
35158 | * @param {{
|
35159 | * text: string;
|
35160 | * x: number;
|
35161 | * y: number;
|
35162 | * anchor: 'start' | 'middle' | 'end';
|
35163 | * fontFamily: string;
|
35164 | * fontSize: string | number;
|
35165 | * fontWeight: string | number;
|
35166 | * fill: string;
|
35167 | * class: string | undefined;
|
35168 | * textMargin: number;
|
35169 | * }} textData
|
35170 | * @returns {SVGTextElement} Text element with given styling and content
|
35171 | */
|
35172 |
|
35173 | var drawSimpleText = function drawSimpleText(elem, textData) {
|
35174 | // Remove and ignore br:s
|
35175 | var nText = textData.text.replace(_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__["default"].lineBreakRegex, ' ');
|
35176 | var textElem = elem.append('text');
|
35177 | textElem.attr('x', textData.x);
|
35178 | textElem.attr('y', textData.y);
|
35179 | textElem.style('text-anchor', textData.anchor);
|
35180 | textElem.style('font-family', textData.fontFamily);
|
35181 | textElem.style('font-size', textData.fontSize);
|
35182 | textElem.style('font-weight', textData.fontWeight);
|
35183 | textElem.attr('fill', textData.fill);
|
35184 |
|
35185 | if (typeof textData.class !== 'undefined') {
|
35186 | textElem.attr('class', textData.class);
|
35187 | }
|
35188 |
|
35189 | var span = textElem.append('tspan');
|
35190 | span.attr('x', textData.x + textData.textMargin * 2);
|
35191 | span.attr('fill', textData.fill);
|
35192 | span.text(nText);
|
35193 | return textElem;
|
35194 | };
|
35195 | var wrapLabel = memoize(function (label, maxWidth, config) {
|
35196 | if (!label) {
|
35197 | return label;
|
35198 | }
|
35199 |
|
35200 | config = Object.assign({
|
35201 | fontSize: 12,
|
35202 | fontWeight: 400,
|
35203 | fontFamily: 'Arial',
|
35204 | joinWith: '<br/>'
|
35205 | }, config);
|
35206 |
|
35207 | if (_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__["default"].lineBreakRegex.test(label)) {
|
35208 | return label;
|
35209 | }
|
35210 |
|
35211 | var words = label.split(' ');
|
35212 | var completedLines = [];
|
35213 | var nextLine = '';
|
35214 | words.forEach(function (word, index) {
|
35215 | var wordLength = calculateTextWidth("".concat(word, " "), config);
|
35216 | var nextLineLength = calculateTextWidth(nextLine, config);
|
35217 |
|
35218 | if (wordLength > maxWidth) {
|
35219 | var _breakString = breakString(word, maxWidth, '-', config),
|
35220 | hyphenatedStrings = _breakString.hyphenatedStrings,
|
35221 | remainingWord = _breakString.remainingWord;
|
35222 |
|
35223 | completedLines.push.apply(completedLines, [nextLine].concat(_toConsumableArray(hyphenatedStrings)));
|
35224 | nextLine = remainingWord;
|
35225 | } else if (nextLineLength + wordLength >= maxWidth) {
|
35226 | completedLines.push(nextLine);
|
35227 | nextLine = word;
|
35228 | } else {
|
35229 | nextLine = [nextLine, word].filter(Boolean).join(' ');
|
35230 | }
|
35231 |
|
35232 | var currentWord = index + 1;
|
35233 | var isLastWord = currentWord === words.length;
|
35234 |
|
35235 | if (isLastWord) {
|
35236 | completedLines.push(nextLine);
|
35237 | }
|
35238 | });
|
35239 | return completedLines.filter(function (line) {
|
35240 | return line !== '';
|
35241 | }).join(config.joinWith);
|
35242 | }, function (label, maxWidth, config) {
|
35243 | return "".concat(label, "-").concat(maxWidth, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily, "-").concat(config.joinWith);
|
35244 | });
|
35245 | var breakString = memoize(function (word, maxWidth) {
|
35246 | var hyphenCharacter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '-';
|
35247 | var config = arguments.length > 3 ? arguments[3] : undefined;
|
35248 | config = Object.assign({
|
35249 | fontSize: 12,
|
35250 | fontWeight: 400,
|
35251 | fontFamily: 'Arial',
|
35252 | margin: 0
|
35253 | }, config);
|
35254 | var characters = word.split('');
|
35255 | var lines = [];
|
35256 | var currentLine = '';
|
35257 | characters.forEach(function (character, index) {
|
35258 | var nextLine = "".concat(currentLine).concat(character);
|
35259 | var lineWidth = calculateTextWidth(nextLine, config);
|
35260 |
|
35261 | if (lineWidth >= maxWidth) {
|
35262 | var currentCharacter = index + 1;
|
35263 | var isLastLine = characters.length === currentCharacter;
|
35264 | var hyphenatedNextLine = "".concat(nextLine).concat(hyphenCharacter);
|
35265 | lines.push(isLastLine ? nextLine : hyphenatedNextLine);
|
35266 | currentLine = '';
|
35267 | } else {
|
35268 | currentLine = nextLine;
|
35269 | }
|
35270 | });
|
35271 | return {
|
35272 | hyphenatedStrings: lines,
|
35273 | remainingWord: currentLine
|
35274 | };
|
35275 | }, function (word, maxWidth) {
|
35276 | var hyphenCharacter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '-';
|
35277 | var config = arguments.length > 3 ? arguments[3] : undefined;
|
35278 | return "".concat(word, "-").concat(maxWidth, "-").concat(hyphenCharacter, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily);
|
35279 | });
|
35280 | /**
|
35281 | * This calculates the text's height, taking into account the wrap breaks and both the statically
|
35282 | * configured height, width, and the length of the text (in pixels).
|
35283 | *
|
35284 | * If the wrapped text text has greater height, we extend the height, so it's value won't overflow.
|
35285 | *
|
35286 | * @param {any} text The text to measure
|
35287 | * @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the resulting size
|
35288 | * @returns {any} - The height for the given text
|
35289 | */
|
35290 |
|
35291 | var calculateTextHeight = function calculateTextHeight(text, config) {
|
35292 | config = Object.assign({
|
35293 | fontSize: 12,
|
35294 | fontWeight: 400,
|
35295 | fontFamily: 'Arial',
|
35296 | margin: 15
|
35297 | }, config);
|
35298 | return calculateTextDimensions(text, config).height;
|
35299 | };
|
35300 | /**
|
35301 | * This calculates the width of the given text, font size and family.
|
35302 | *
|
35303 | * @param {any} text - The text to calculate the width of
|
35304 | * @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the resulting size
|
35305 | * @returns {any} - The width for the given text
|
35306 | */
|
35307 |
|
35308 | var calculateTextWidth = function calculateTextWidth(text, config) {
|
35309 | config = Object.assign({
|
35310 | fontSize: 12,
|
35311 | fontWeight: 400,
|
35312 | fontFamily: 'Arial'
|
35313 | }, config);
|
35314 | return calculateTextDimensions(text, config).width;
|
35315 | };
|
35316 | /**
|
35317 | * This calculates the dimensions of the given text, font size, font family, font weight, and margins.
|
35318 | *
|
35319 | * @param {any} text - The text to calculate the width of
|
35320 | * @param {any} config - The config for fontSize, fontFamily, fontWeight, and margin all impacting
|
35321 | * the resulting size
|
35322 | * @returns - The width for the given text
|
35323 | */
|
35324 |
|
35325 | var calculateTextDimensions = memoize(function (text, config) {
|
35326 | config = Object.assign({
|
35327 | fontSize: 12,
|
35328 | fontWeight: 400,
|
35329 | fontFamily: 'Arial'
|
35330 | }, config);
|
35331 | var _config = config,
|
35332 | fontSize = _config.fontSize,
|
35333 | fontFamily = _config.fontFamily,
|
35334 | fontWeight = _config.fontWeight;
|
35335 |
|
35336 | if (!text) {
|
35337 | return {
|
35338 | width: 0,
|
35339 | height: 0
|
35340 | };
|
35341 | } // We can't really know if the user supplied font family will render on the user agent;
|
35342 | // thus, we'll take the max width between the user supplied font family, and a default
|
35343 | // of sans-serif.
|
35344 |
|
35345 |
|
35346 | var fontFamilies = ['sans-serif', fontFamily];
|
35347 | var lines = text.split(_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__["default"].lineBreakRegex);
|
35348 | var dims = [];
|
35349 | var body = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('body'); // We don't want to leak DOM elements - if a removal operation isn't available
|
35350 | // for any reason, do not continue.
|
35351 |
|
35352 | if (!body.remove) {
|
35353 | return {
|
35354 | width: 0,
|
35355 | height: 0,
|
35356 | lineHeight: 0
|
35357 | };
|
35358 | }
|
35359 |
|
35360 | var g = body.append('svg');
|
35361 |
|
35362 | for (var _i = 0, _fontFamilies = fontFamilies; _i < _fontFamilies.length; _i++) {
|
35363 | var _fontFamily = _fontFamilies[_i];
|
35364 | var cheight = 0;
|
35365 | var dim = {
|
35366 | width: 0,
|
35367 | height: 0,
|
35368 | lineHeight: 0
|
35369 | };
|
35370 |
|
35371 | var _iterator = _createForOfIteratorHelper(lines),
|
35372 | _step;
|
35373 |
|
35374 | try {
|
35375 | for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
35376 | var line = _step.value;
|
35377 | var textObj = getTextObj();
|
35378 | textObj.text = line;
|
35379 | var textElem = drawSimpleText(g, textObj).style('font-size', fontSize).style('font-weight', fontWeight).style('font-family', _fontFamily);
|
35380 | var bBox = (textElem._groups || textElem)[0][0].getBBox();
|
35381 | dim.width = Math.round(Math.max(dim.width, bBox.width));
|
35382 | cheight = Math.round(bBox.height);
|
35383 | dim.height += cheight;
|
35384 | dim.lineHeight = Math.round(Math.max(dim.lineHeight, cheight));
|
35385 | }
|
35386 | } catch (err) {
|
35387 | _iterator.e(err);
|
35388 | } finally {
|
35389 | _iterator.f();
|
35390 | }
|
35391 |
|
35392 | dims.push(dim);
|
35393 | }
|
35394 |
|
35395 | g.remove();
|
35396 | var index = isNaN(dims[1].height) || isNaN(dims[1].width) || isNaN(dims[1].lineHeight) || dims[0].height > dims[1].height && dims[0].width > dims[1].width && dims[0].lineHeight > dims[1].lineHeight ? 0 : 1;
|
35397 | return dims[index];
|
35398 | }, function (text, config) {
|
35399 | return "".concat(text, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily);
|
35400 | });
|
35401 | /**
|
35402 | * Applys d3 attributes
|
35403 | *
|
35404 | * @param {any} d3Elem D3 Element to apply the attributes onto
|
35405 | * @param {[string, string][]} attrs Object.keys equivalent format of key to value mapping of attributes
|
35406 | */
|
35407 |
|
35408 | var d3Attrs = function d3Attrs(d3Elem, attrs) {
|
35409 | var _iterator2 = _createForOfIteratorHelper(attrs),
|
35410 | _step2;
|
35411 |
|
35412 | try {
|
35413 | for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
35414 | var attr = _step2.value;
|
35415 | d3Elem.attr(attr[0], attr[1]);
|
35416 | }
|
35417 | } catch (err) {
|
35418 | _iterator2.e(err);
|
35419 | } finally {
|
35420 | _iterator2.f();
|
35421 | }
|
35422 | };
|
35423 | /**
|
35424 | * Gives attributes for an SVG's size given arguments
|
35425 | *
|
35426 | * @param {number} height The height of the SVG
|
35427 | * @param {number} width The width of the SVG
|
35428 | * @param {boolean} useMaxWidth Whether or not to use max-width and set width to 100%
|
35429 | * @returns {Map<'height' | 'width' | 'style', string>} Attributes for the SVG
|
35430 | */
|
35431 |
|
35432 |
|
35433 | var calculateSvgSizeAttrs = function calculateSvgSizeAttrs(height, width, useMaxWidth) {
|
35434 | var attrs = new Map();
|
35435 | attrs.set('height', height);
|
35436 |
|
35437 | if (useMaxWidth) {
|
35438 | attrs.set('width', '100%');
|
35439 | attrs.set('style', "max-width: ".concat(width, "px;"));
|
35440 | } else {
|
35441 | attrs.set('width', width);
|
35442 | }
|
35443 |
|
35444 | return attrs;
|
35445 | };
|
35446 | /**
|
35447 | * Applies attributes from `calculateSvgSizeAttrs`
|
35448 | *
|
35449 | * @param {SVGSVGElement} svgElem The SVG Element to configure
|
35450 | * @param {number} height The height of the SVG
|
35451 | * @param {number} width The width of the SVG
|
35452 | * @param {boolean} useMaxWidth Whether or not to use max-width and set width to 100%
|
35453 | */
|
35454 |
|
35455 | var configureSvgSize = function configureSvgSize(svgElem, height, width, useMaxWidth) {
|
35456 | var attrs = calculateSvgSizeAttrs(height, width, useMaxWidth);
|
35457 | d3Attrs(svgElem, attrs);
|
35458 | };
|
35459 | var setupGraphViewbox = function setupGraphViewbox(graph, svgElem, padding, useMaxWidth) {
|
35460 | var svgBounds = svgElem.node().getBBox();
|
35461 | var sWidth = svgBounds.width;
|
35462 | var sHeight = svgBounds.height;
|
35463 | var width = graph._label.width;
|
35464 | var height = graph._label.height;
|
35465 | var tx = 0;
|
35466 | var ty = 0;
|
35467 |
|
35468 | if (sWidth > width) {
|
35469 | tx = (sWidth - width) / 2 + padding;
|
35470 | width = sWidth + padding * 2;
|
35471 | } else {
|
35472 | if (Math.abs(sWidth - width) >= 2 * padding + 1) {
|
35473 | width = width - padding;
|
35474 | }
|
35475 | }
|
35476 |
|
35477 | if (sHeight > height) {
|
35478 | ty = (sHeight - height) / 2 + padding;
|
35479 | height = sHeight + padding * 2;
|
35480 | }
|
35481 |
|
35482 | configureSvgSize(svgElem, height, width, useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
|
35483 |
|
35484 | var vBox = "0 0 ".concat(width, " ").concat(height);
|
35485 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Graph.label', graph._label, 'swidth', sWidth, 'sheight', sHeight, 'width', width, 'height', height, 'tx', tx, 'ty', ty, 'vBox', vBox);
|
35486 | svgElem.attr('viewBox', vBox);
|
35487 | svgElem.select('g').attr('transform', "translate(".concat(tx, ", ").concat(ty, ")"));
|
35488 | };
|
35489 | var initIdGenerator = /*#__PURE__*/function () {
|
35490 | function iterator(deterministic, seed) {
|
35491 | _classCallCheck(this, iterator);
|
35492 |
|
35493 | this.deterministic = deterministic;
|
35494 | this.seed = seed;
|
35495 | this.count = seed ? seed.length : 0;
|
35496 | }
|
35497 |
|
35498 | _createClass(iterator, [{
|
35499 | key: "next",
|
35500 | value: function next() {
|
35501 | if (!this.deterministic) return Date.now();
|
35502 | return this.count++;
|
35503 | }
|
35504 | }]);
|
35505 |
|
35506 | return iterator;
|
35507 | }();
|
35508 | var decoder;
|
35509 | /**
|
35510 | * Decodes HTML, source: {@link https://github.com/shrpne/entity-decode/blob/v2.0.1/browser.js}
|
35511 | *
|
35512 | * @param {string} html HTML as a string
|
35513 | * @returns Unescaped HTML
|
35514 | */
|
35515 |
|
35516 | var entityDecode = function entityDecode(html) {
|
35517 | decoder = decoder || document.createElement('div'); // Escape HTML before decoding for HTML Entities
|
35518 |
|
35519 | html = escape(html).replace(/%26/g, '&').replace(/%23/g, '#').replace(/%3B/g, ';'); // decoding
|
35520 |
|
35521 | decoder.innerHTML = html;
|
35522 | return unescape(decoder.textContent);
|
35523 | };
|
35524 | /**
|
35525 | * Sanitizes directive objects
|
35526 | *
|
35527 | * @param {object} args Directive's JSON
|
35528 | */
|
35529 |
|
35530 | var directiveSanitizer = function directiveSanitizer(args) {
|
35531 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('directiveSanitizer called with', args);
|
35532 |
|
35533 | if (_typeof(args) === 'object') {
|
35534 | // check for array
|
35535 | if (args.length) {
|
35536 | args.forEach(function (arg) {
|
35537 | return directiveSanitizer(arg);
|
35538 | });
|
35539 | } else {
|
35540 | // This is an object
|
35541 | Object.keys(args).forEach(function (key) {
|
35542 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Checking key', key);
|
35543 |
|
35544 | if (key.indexOf('__') === 0) {
|
35545 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('sanitize deleting __ option', key);
|
35546 | delete args[key];
|
35547 | }
|
35548 |
|
35549 | if (key.indexOf('proto') >= 0) {
|
35550 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('sanitize deleting proto option', key);
|
35551 | delete args[key];
|
35552 | }
|
35553 |
|
35554 | if (key.indexOf('constr') >= 0) {
|
35555 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('sanitize deleting constr option', key);
|
35556 | delete args[key];
|
35557 | }
|
35558 |
|
35559 | if (key.indexOf('themeCSS') >= 0) {
|
35560 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('sanitizing themeCss option');
|
35561 | args[key] = sanitizeCss(args[key]);
|
35562 | }
|
35563 |
|
35564 | if (key.indexOf('fontFamily') >= 0) {
|
35565 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('sanitizing fontFamily option');
|
35566 | args[key] = sanitizeCss(args[key]);
|
35567 | }
|
35568 |
|
35569 | if (key.indexOf('altFontFamily') >= 0) {
|
35570 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('sanitizing altFontFamily option');
|
35571 | args[key] = sanitizeCss(args[key]);
|
35572 | }
|
35573 |
|
35574 | if (_defaultConfig__WEBPACK_IMPORTED_MODULE_6__.configKeys.indexOf(key) < 0) {
|
35575 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('sanitize deleting option', key);
|
35576 | delete args[key];
|
35577 | } else {
|
35578 | if (_typeof(args[key]) === 'object') {
|
35579 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('sanitize deleting object', key);
|
35580 | directiveSanitizer(args[key]);
|
35581 | }
|
35582 | }
|
35583 | });
|
35584 | }
|
35585 | }
|
35586 |
|
35587 | if (args.themeVariables) {
|
35588 | var kArr = Object.keys(args.themeVariables);
|
35589 |
|
35590 | for (var i = 0; i < kArr.length; i++) {
|
35591 | var k = kArr[i];
|
35592 | var val = args.themeVariables[k];
|
35593 |
|
35594 | if (val && val.match && !val.match(/^[a-zA-Z0-9#,";()%. ]+$/)) {
|
35595 | args.themeVariables[k] = '';
|
35596 | }
|
35597 | }
|
35598 | }
|
35599 |
|
35600 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('After sanitization', args);
|
35601 | };
|
35602 | var sanitizeCss = function sanitizeCss(str) {
|
35603 | var startCnt = 0;
|
35604 | var endCnt = 0;
|
35605 |
|
35606 | for (var i = 0; i < str.length; i++) {
|
35607 | if (startCnt < endCnt) {
|
35608 | return '{ /* ERROR: Unbalanced CSS */ }';
|
35609 | }
|
35610 |
|
35611 | if (str[i] === '{') {
|
35612 | startCnt++;
|
35613 | } else if (str[i] === '}') {
|
35614 | endCnt++;
|
35615 | }
|
35616 | }
|
35617 |
|
35618 | if (startCnt !== endCnt) {
|
35619 | return '{ /* ERROR: Unbalanced CSS */ }';
|
35620 | } // Todo add more checks here
|
35621 |
|
35622 |
|
35623 | return str;
|
35624 | };
|
35625 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
35626 | assignWithDepth: _assignWithDepth__WEBPACK_IMPORTED_MODULE_2__["default"],
|
35627 | wrapLabel: wrapLabel,
|
35628 | calculateTextHeight: calculateTextHeight,
|
35629 | calculateTextWidth: calculateTextWidth,
|
35630 | calculateTextDimensions: calculateTextDimensions,
|
35631 | calculateSvgSizeAttrs: calculateSvgSizeAttrs,
|
35632 | configureSvgSize: configureSvgSize,
|
35633 | setupGraphViewbox: setupGraphViewbox,
|
35634 | detectInit: detectInit,
|
35635 | detectDirective: detectDirective,
|
35636 | isSubstringInArray: isSubstringInArray,
|
35637 | interpolateToCurve: interpolateToCurve,
|
35638 | calcLabelPosition: calcLabelPosition,
|
35639 | calcCardinalityPosition: calcCardinalityPosition,
|
35640 | calcTerminalLabelPosition: calcTerminalLabelPosition,
|
35641 | formatUrl: formatUrl,
|
35642 | getStylesFromArray: getStylesFromArray,
|
35643 | generateId: generateId,
|
35644 | random: random,
|
35645 | memoize: memoize,
|
35646 | runFunc: runFunc,
|
35647 | entityDecode: entityDecode,
|
35648 | initIdGenerator: initIdGenerator,
|
35649 | directiveSanitizer: directiveSanitizer,
|
35650 | sanitizeCss: sanitizeCss
|
35651 | });
|
35652 |
|
35653 | /***/ }),
|
35654 |
|
35655 | /***/ "./node_modules/path-browserify/index.js":
|
35656 | /*!***********************************************!*\
|
35657 | !*** ./node_modules/path-browserify/index.js ***!
|
35658 | \***********************************************/
|
35659 | /***/ ((module) => {
|
35660 |
|
35661 | "use strict";
|
35662 | // 'path' module extracted from Node.js v8.11.1 (only the posix part)
|
35663 | // transplited with Babel
|
35664 |
|
35665 | // Copyright Joyent, Inc. and other Node contributors.
|
35666 | //
|
35667 | // Permission is hereby granted, free of charge, to any person obtaining a
|
35668 | // copy of this software and associated documentation files (the
|
35669 | // "Software"), to deal in the Software without restriction, including
|
35670 | // without limitation the rights to use, copy, modify, merge, publish,
|
35671 | // distribute, sublicense, and/or sell copies of the Software, and to permit
|
35672 | // persons to whom the Software is furnished to do so, subject to the
|
35673 | // following conditions:
|
35674 | //
|
35675 | // The above copyright notice and this permission notice shall be included
|
35676 | // in all copies or substantial portions of the Software.
|
35677 | //
|
35678 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
35679 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
35680 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
35681 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
35682 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
35683 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
35684 | // USE OR OTHER DEALINGS IN THE SOFTWARE.
|
35685 |
|
35686 |
|
35687 |
|
35688 | function assertPath(path) {
|
35689 | if (typeof path !== 'string') {
|
35690 | throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));
|
35691 | }
|
35692 | }
|
35693 |
|
35694 | // Resolves . and .. elements in a path with directory names
|
35695 | function normalizeStringPosix(path, allowAboveRoot) {
|
35696 | var res = '';
|
35697 | var lastSegmentLength = 0;
|
35698 | var lastSlash = -1;
|
35699 | var dots = 0;
|
35700 | var code;
|
35701 | for (var i = 0; i <= path.length; ++i) {
|
35702 | if (i < path.length)
|
35703 | code = path.charCodeAt(i);
|
35704 | else if (code === 47 /*/*/)
|
35705 | break;
|
35706 | else
|
35707 | code = 47 /*/*/;
|
35708 | if (code === 47 /*/*/) {
|
35709 | if (lastSlash === i - 1 || dots === 1) {
|
35710 | // NOOP
|
35711 | } else if (lastSlash !== i - 1 && dots === 2) {
|
35712 | if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {
|
35713 | if (res.length > 2) {
|
35714 | var lastSlashIndex = res.lastIndexOf('/');
|
35715 | if (lastSlashIndex !== res.length - 1) {
|
35716 | if (lastSlashIndex === -1) {
|
35717 | res = '';
|
35718 | lastSegmentLength = 0;
|
35719 | } else {
|
35720 | res = res.slice(0, lastSlashIndex);
|
35721 | lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
|
35722 | }
|
35723 | lastSlash = i;
|
35724 | dots = 0;
|
35725 | continue;
|
35726 | }
|
35727 | } else if (res.length === 2 || res.length === 1) {
|
35728 | res = '';
|
35729 | lastSegmentLength = 0;
|
35730 | lastSlash = i;
|
35731 | dots = 0;
|
35732 | continue;
|
35733 | }
|
35734 | }
|
35735 | if (allowAboveRoot) {
|
35736 | if (res.length > 0)
|
35737 | res += '/..';
|
35738 | else
|
35739 | res = '..';
|
35740 | lastSegmentLength = 2;
|
35741 | }
|
35742 | } else {
|
35743 | if (res.length > 0)
|
35744 | res += '/' + path.slice(lastSlash + 1, i);
|
35745 | else
|
35746 | res = path.slice(lastSlash + 1, i);
|
35747 | lastSegmentLength = i - lastSlash - 1;
|
35748 | }
|
35749 | lastSlash = i;
|
35750 | dots = 0;
|
35751 | } else if (code === 46 /*.*/ && dots !== -1) {
|
35752 | ++dots;
|
35753 | } else {
|
35754 | dots = -1;
|
35755 | }
|
35756 | }
|
35757 | return res;
|
35758 | }
|
35759 |
|
35760 | function _format(sep, pathObject) {
|
35761 | var dir = pathObject.dir || pathObject.root;
|
35762 | var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');
|
35763 | if (!dir) {
|
35764 | return base;
|
35765 | }
|
35766 | if (dir === pathObject.root) {
|
35767 | return dir + base;
|
35768 | }
|
35769 | return dir + sep + base;
|
35770 | }
|
35771 |
|
35772 | var posix = {
|
35773 | // path.resolve([from ...], to)
|
35774 | resolve: function resolve() {
|
35775 | var resolvedPath = '';
|
35776 | var resolvedAbsolute = false;
|
35777 | var cwd;
|
35778 |
|
35779 | for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
35780 | var path;
|
35781 | if (i >= 0)
|
35782 | path = arguments[i];
|
35783 | else {
|
35784 | if (cwd === undefined)
|
35785 | cwd = process.cwd();
|
35786 | path = cwd;
|
35787 | }
|
35788 |
|
35789 | assertPath(path);
|
35790 |
|
35791 | // Skip empty entries
|
35792 | if (path.length === 0) {
|
35793 | continue;
|
35794 | }
|
35795 |
|
35796 | resolvedPath = path + '/' + resolvedPath;
|
35797 | resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;
|
35798 | }
|
35799 |
|
35800 | // At this point the path should be resolved to a full absolute path, but
|
35801 | // handle relative paths to be safe (might happen when process.cwd() fails)
|
35802 |
|
35803 | // Normalize the path
|
35804 | resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
|
35805 |
|
35806 | if (resolvedAbsolute) {
|
35807 | if (resolvedPath.length > 0)
|
35808 | return '/' + resolvedPath;
|
35809 | else
|
35810 | return '/';
|
35811 | } else if (resolvedPath.length > 0) {
|
35812 | return resolvedPath;
|
35813 | } else {
|
35814 | return '.';
|
35815 | }
|
35816 | },
|
35817 |
|
35818 | normalize: function normalize(path) {
|
35819 | assertPath(path);
|
35820 |
|
35821 | if (path.length === 0) return '.';
|
35822 |
|
35823 | var isAbsolute = path.charCodeAt(0) === 47 /*/*/;
|
35824 | var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;
|
35825 |
|
35826 | // Normalize the path
|
35827 | path = normalizeStringPosix(path, !isAbsolute);
|
35828 |
|
35829 | if (path.length === 0 && !isAbsolute) path = '.';
|
35830 | if (path.length > 0 && trailingSeparator) path += '/';
|
35831 |
|
35832 | if (isAbsolute) return '/' + path;
|
35833 | return path;
|
35834 | },
|
35835 |
|
35836 | isAbsolute: function isAbsolute(path) {
|
35837 | assertPath(path);
|
35838 | return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;
|
35839 | },
|
35840 |
|
35841 | join: function join() {
|
35842 | if (arguments.length === 0)
|
35843 | return '.';
|
35844 | var joined;
|
35845 | for (var i = 0; i < arguments.length; ++i) {
|
35846 | var arg = arguments[i];
|
35847 | assertPath(arg);
|
35848 | if (arg.length > 0) {
|
35849 | if (joined === undefined)
|
35850 | joined = arg;
|
35851 | else
|
35852 | joined += '/' + arg;
|
35853 | }
|
35854 | }
|
35855 | if (joined === undefined)
|
35856 | return '.';
|
35857 | return posix.normalize(joined);
|
35858 | },
|
35859 |
|
35860 | relative: function relative(from, to) {
|
35861 | assertPath(from);
|
35862 | assertPath(to);
|
35863 |
|
35864 | if (from === to) return '';
|
35865 |
|
35866 | from = posix.resolve(from);
|
35867 | to = posix.resolve(to);
|
35868 |
|
35869 | if (from === to) return '';
|
35870 |
|
35871 | // Trim any leading backslashes
|
35872 | var fromStart = 1;
|
35873 | for (; fromStart < from.length; ++fromStart) {
|
35874 | if (from.charCodeAt(fromStart) !== 47 /*/*/)
|
35875 | break;
|
35876 | }
|
35877 | var fromEnd = from.length;
|
35878 | var fromLen = fromEnd - fromStart;
|
35879 |
|
35880 | // Trim any leading backslashes
|
35881 | var toStart = 1;
|
35882 | for (; toStart < to.length; ++toStart) {
|
35883 | if (to.charCodeAt(toStart) !== 47 /*/*/)
|
35884 | break;
|
35885 | }
|
35886 | var toEnd = to.length;
|
35887 | var toLen = toEnd - toStart;
|
35888 |
|
35889 | // Compare paths to find the longest common path from root
|
35890 | var length = fromLen < toLen ? fromLen : toLen;
|
35891 | var lastCommonSep = -1;
|
35892 | var i = 0;
|
35893 | for (; i <= length; ++i) {
|
35894 | if (i === length) {
|
35895 | if (toLen > length) {
|
35896 | if (to.charCodeAt(toStart + i) === 47 /*/*/) {
|
35897 | // We get here if `from` is the exact base path for `to`.
|
35898 | // For example: from='/foo/bar'; to='/foo/bar/baz'
|
35899 | return to.slice(toStart + i + 1);
|
35900 | } else if (i === 0) {
|
35901 | // We get here if `from` is the root
|
35902 | // For example: from='/'; to='/foo'
|
35903 | return to.slice(toStart + i);
|
35904 | }
|
35905 | } else if (fromLen > length) {
|
35906 | if (from.charCodeAt(fromStart + i) === 47 /*/*/) {
|
35907 | // We get here if `to` is the exact base path for `from`.
|
35908 | // For example: from='/foo/bar/baz'; to='/foo/bar'
|
35909 | lastCommonSep = i;
|
35910 | } else if (i === 0) {
|
35911 | // We get here if `to` is the root.
|
35912 | // For example: from='/foo'; to='/'
|
35913 | lastCommonSep = 0;
|
35914 | }
|
35915 | }
|
35916 | break;
|
35917 | }
|
35918 | var fromCode = from.charCodeAt(fromStart + i);
|
35919 | var toCode = to.charCodeAt(toStart + i);
|
35920 | if (fromCode !== toCode)
|
35921 | break;
|
35922 | else if (fromCode === 47 /*/*/)
|
35923 | lastCommonSep = i;
|
35924 | }
|
35925 |
|
35926 | var out = '';
|
35927 | // Generate the relative path based on the path difference between `to`
|
35928 | // and `from`
|
35929 | for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
35930 | if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {
|
35931 | if (out.length === 0)
|
35932 | out += '..';
|
35933 | else
|
35934 | out += '/..';
|
35935 | }
|
35936 | }
|
35937 |
|
35938 | // Lastly, append the rest of the destination (`to`) path that comes after
|
35939 | // the common path parts
|
35940 | if (out.length > 0)
|
35941 | return out + to.slice(toStart + lastCommonSep);
|
35942 | else {
|
35943 | toStart += lastCommonSep;
|
35944 | if (to.charCodeAt(toStart) === 47 /*/*/)
|
35945 | ++toStart;
|
35946 | return to.slice(toStart);
|
35947 | }
|
35948 | },
|
35949 |
|
35950 | _makeLong: function _makeLong(path) {
|
35951 | return path;
|
35952 | },
|
35953 |
|
35954 | dirname: function dirname(path) {
|
35955 | assertPath(path);
|
35956 | if (path.length === 0) return '.';
|
35957 | var code = path.charCodeAt(0);
|
35958 | var hasRoot = code === 47 /*/*/;
|
35959 | var end = -1;
|
35960 | var matchedSlash = true;
|
35961 | for (var i = path.length - 1; i >= 1; --i) {
|
35962 | code = path.charCodeAt(i);
|
35963 | if (code === 47 /*/*/) {
|
35964 | if (!matchedSlash) {
|
35965 | end = i;
|
35966 | break;
|
35967 | }
|
35968 | } else {
|
35969 | // We saw the first non-path separator
|
35970 | matchedSlash = false;
|
35971 | }
|
35972 | }
|
35973 |
|
35974 | if (end === -1) return hasRoot ? '/' : '.';
|
35975 | if (hasRoot && end === 1) return '//';
|
35976 | return path.slice(0, end);
|
35977 | },
|
35978 |
|
35979 | basename: function basename(path, ext) {
|
35980 | if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string');
|
35981 | assertPath(path);
|
35982 |
|
35983 | var start = 0;
|
35984 | var end = -1;
|
35985 | var matchedSlash = true;
|
35986 | var i;
|
35987 |
|
35988 | if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
|
35989 | if (ext.length === path.length && ext === path) return '';
|
35990 | var extIdx = ext.length - 1;
|
35991 | var firstNonSlashEnd = -1;
|
35992 | for (i = path.length - 1; i >= 0; --i) {
|
35993 | var code = path.charCodeAt(i);
|
35994 | if (code === 47 /*/*/) {
|
35995 | // If we reached a path separator that was not part of a set of path
|
35996 | // separators at the end of the string, stop now
|
35997 | if (!matchedSlash) {
|
35998 | start = i + 1;
|
35999 | break;
|
36000 | }
|
36001 | } else {
|
36002 | if (firstNonSlashEnd === -1) {
|
36003 | // We saw the first non-path separator, remember this index in case
|
36004 | // we need it if the extension ends up not matching
|
36005 | matchedSlash = false;
|
36006 | firstNonSlashEnd = i + 1;
|
36007 | }
|
36008 | if (extIdx >= 0) {
|
36009 | // Try to match the explicit extension
|
36010 | if (code === ext.charCodeAt(extIdx)) {
|
36011 | if (--extIdx === -1) {
|
36012 | // We matched the extension, so mark this as the end of our path
|
36013 | // component
|
36014 | end = i;
|
36015 | }
|
36016 | } else {
|
36017 | // Extension does not match, so our result is the entire path
|
36018 | // component
|
36019 | extIdx = -1;
|
36020 | end = firstNonSlashEnd;
|
36021 | }
|
36022 | }
|
36023 | }
|
36024 | }
|
36025 |
|
36026 | if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;
|
36027 | return path.slice(start, end);
|
36028 | } else {
|
36029 | for (i = path.length - 1; i >= 0; --i) {
|
36030 | if (path.charCodeAt(i) === 47 /*/*/) {
|
36031 | // If we reached a path separator that was not part of a set of path
|
36032 | // separators at the end of the string, stop now
|
36033 | if (!matchedSlash) {
|
36034 | start = i + 1;
|
36035 | break;
|
36036 | }
|
36037 | } else if (end === -1) {
|
36038 | // We saw the first non-path separator, mark this as the end of our
|
36039 | // path component
|
36040 | matchedSlash = false;
|
36041 | end = i + 1;
|
36042 | }
|
36043 | }
|
36044 |
|
36045 | if (end === -1) return '';
|
36046 | return path.slice(start, end);
|
36047 | }
|
36048 | },
|
36049 |
|
36050 | extname: function extname(path) {
|
36051 | assertPath(path);
|
36052 | var startDot = -1;
|
36053 | var startPart = 0;
|
36054 | var end = -1;
|
36055 | var matchedSlash = true;
|
36056 | // Track the state of characters (if any) we see before our first dot and
|
36057 | // after any path separator we find
|
36058 | var preDotState = 0;
|
36059 | for (var i = path.length - 1; i >= 0; --i) {
|
36060 | var code = path.charCodeAt(i);
|
36061 | if (code === 47 /*/*/) {
|
36062 | // If we reached a path separator that was not part of a set of path
|
36063 | // separators at the end of the string, stop now
|
36064 | if (!matchedSlash) {
|
36065 | startPart = i + 1;
|
36066 | break;
|
36067 | }
|
36068 | continue;
|
36069 | }
|
36070 | if (end === -1) {
|
36071 | // We saw the first non-path separator, mark this as the end of our
|
36072 | // extension
|
36073 | matchedSlash = false;
|
36074 | end = i + 1;
|
36075 | }
|
36076 | if (code === 46 /*.*/) {
|
36077 | // If this is our first dot, mark it as the start of our extension
|
36078 | if (startDot === -1)
|
36079 | startDot = i;
|
36080 | else if (preDotState !== 1)
|
36081 | preDotState = 1;
|
36082 | } else if (startDot !== -1) {
|
36083 | // We saw a non-dot and non-path separator before our dot, so we should
|
36084 | // have a good chance at having a non-empty extension
|
36085 | preDotState = -1;
|
36086 | }
|
36087 | }
|
36088 |
|
36089 | if (startDot === -1 || end === -1 ||
|
36090 | // We saw a non-dot character immediately before the dot
|
36091 | preDotState === 0 ||
|
36092 | // The (right-most) trimmed path component is exactly '..'
|
36093 | preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
36094 | return '';
|
36095 | }
|
36096 | return path.slice(startDot, end);
|
36097 | },
|
36098 |
|
36099 | format: function format(pathObject) {
|
36100 | if (pathObject === null || typeof pathObject !== 'object') {
|
36101 | throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
36102 | }
|
36103 | return _format('/', pathObject);
|
36104 | },
|
36105 |
|
36106 | parse: function parse(path) {
|
36107 | assertPath(path);
|
36108 |
|
36109 | var ret = { root: '', dir: '', base: '', ext: '', name: '' };
|
36110 | if (path.length === 0) return ret;
|
36111 | var code = path.charCodeAt(0);
|
36112 | var isAbsolute = code === 47 /*/*/;
|
36113 | var start;
|
36114 | if (isAbsolute) {
|
36115 | ret.root = '/';
|
36116 | start = 1;
|
36117 | } else {
|
36118 | start = 0;
|
36119 | }
|
36120 | var startDot = -1;
|
36121 | var startPart = 0;
|
36122 | var end = -1;
|
36123 | var matchedSlash = true;
|
36124 | var i = path.length - 1;
|
36125 |
|
36126 | // Track the state of characters (if any) we see before our first dot and
|
36127 | // after any path separator we find
|
36128 | var preDotState = 0;
|
36129 |
|
36130 | // Get non-dir info
|
36131 | for (; i >= start; --i) {
|
36132 | code = path.charCodeAt(i);
|
36133 | if (code === 47 /*/*/) {
|
36134 | // If we reached a path separator that was not part of a set of path
|
36135 | // separators at the end of the string, stop now
|
36136 | if (!matchedSlash) {
|
36137 | startPart = i + 1;
|
36138 | break;
|
36139 | }
|
36140 | continue;
|
36141 | }
|
36142 | if (end === -1) {
|
36143 | // We saw the first non-path separator, mark this as the end of our
|
36144 | // extension
|
36145 | matchedSlash = false;
|
36146 | end = i + 1;
|
36147 | }
|
36148 | if (code === 46 /*.*/) {
|
36149 | // If this is our first dot, mark it as the start of our extension
|
36150 | if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;
|
36151 | } else if (startDot !== -1) {
|
36152 | // We saw a non-dot and non-path separator before our dot, so we should
|
36153 | // have a good chance at having a non-empty extension
|
36154 | preDotState = -1;
|
36155 | }
|
36156 | }
|
36157 |
|
36158 | if (startDot === -1 || end === -1 ||
|
36159 | // We saw a non-dot character immediately before the dot
|
36160 | preDotState === 0 ||
|
36161 | // The (right-most) trimmed path component is exactly '..'
|
36162 | preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
36163 | if (end !== -1) {
|
36164 | if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);
|
36165 | }
|
36166 | } else {
|
36167 | if (startPart === 0 && isAbsolute) {
|
36168 | ret.name = path.slice(1, startDot);
|
36169 | ret.base = path.slice(1, end);
|
36170 | } else {
|
36171 | ret.name = path.slice(startPart, startDot);
|
36172 | ret.base = path.slice(startPart, end);
|
36173 | }
|
36174 | ret.ext = path.slice(startDot, end);
|
36175 | }
|
36176 |
|
36177 | if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';
|
36178 |
|
36179 | return ret;
|
36180 | },
|
36181 |
|
36182 | sep: '/',
|
36183 | delimiter: ':',
|
36184 | win32: null,
|
36185 | posix: null
|
36186 | };
|
36187 |
|
36188 | posix.posix = posix;
|
36189 |
|
36190 | module.exports = posix;
|
36191 |
|
36192 |
|
36193 | /***/ }),
|
36194 |
|
36195 | /***/ "@braintree/sanitize-url":
|
36196 | /*!******************************************!*\
|
36197 | !*** external "@braintree/sanitize-url" ***!
|
36198 | \******************************************/
|
36199 | /***/ ((module) => {
|
36200 |
|
36201 | "use strict";
|
36202 | module.exports = require("@braintree/sanitize-url");
|
36203 |
|
36204 | /***/ }),
|
36205 |
|
36206 | /***/ "d3":
|
36207 | /*!*********************!*\
|
36208 | !*** external "d3" ***!
|
36209 | \*********************/
|
36210 | /***/ ((module) => {
|
36211 |
|
36212 | "use strict";
|
36213 | module.exports = require("d3");
|
36214 |
|
36215 | /***/ }),
|
36216 |
|
36217 | /***/ "dagre":
|
36218 | /*!************************!*\
|
36219 | !*** external "dagre" ***!
|
36220 | \************************/
|
36221 | /***/ ((module) => {
|
36222 |
|
36223 | "use strict";
|
36224 | module.exports = require("dagre");
|
36225 |
|
36226 | /***/ }),
|
36227 |
|
36228 | /***/ "dagre-d3":
|
36229 | /*!***************************!*\
|
36230 | !*** external "dagre-d3" ***!
|
36231 | \***************************/
|
36232 | /***/ ((module) => {
|
36233 |
|
36234 | "use strict";
|
36235 | module.exports = require("dagre-d3");
|
36236 |
|
36237 | /***/ }),
|
36238 |
|
36239 | /***/ "dagre-d3/lib/label/add-html-label.js":
|
36240 | /*!*******************************************************!*\
|
36241 | !*** external "dagre-d3/lib/label/add-html-label.js" ***!
|
36242 | \*******************************************************/
|
36243 | /***/ ((module) => {
|
36244 |
|
36245 | "use strict";
|
36246 | module.exports = require("dagre-d3/lib/label/add-html-label.js");
|
36247 |
|
36248 | /***/ }),
|
36249 |
|
36250 | /***/ "dompurify":
|
36251 | /*!****************************!*\
|
36252 | !*** external "dompurify" ***!
|
36253 | \****************************/
|
36254 | /***/ ((module) => {
|
36255 |
|
36256 | "use strict";
|
36257 | module.exports = require("dompurify");
|
36258 |
|
36259 | /***/ }),
|
36260 |
|
36261 | /***/ "graphlib":
|
36262 | /*!***************************!*\
|
36263 | !*** external "graphlib" ***!
|
36264 | \***************************/
|
36265 | /***/ ((module) => {
|
36266 |
|
36267 | "use strict";
|
36268 | module.exports = require("graphlib");
|
36269 |
|
36270 | /***/ }),
|
36271 |
|
36272 | /***/ "khroma":
|
36273 | /*!*************************!*\
|
36274 | !*** external "khroma" ***!
|
36275 | \*************************/
|
36276 | /***/ ((module) => {
|
36277 |
|
36278 | "use strict";
|
36279 | module.exports = require("khroma");
|
36280 |
|
36281 | /***/ }),
|
36282 |
|
36283 | /***/ "moment-mini":
|
36284 | /*!******************************!*\
|
36285 | !*** external "moment-mini" ***!
|
36286 | \******************************/
|
36287 | /***/ ((module) => {
|
36288 |
|
36289 | "use strict";
|
36290 | module.exports = require("moment-mini");
|
36291 |
|
36292 | /***/ }),
|
36293 |
|
36294 | /***/ "stylis":
|
36295 | /*!*************************!*\
|
36296 | !*** external "stylis" ***!
|
36297 | \*************************/
|
36298 | /***/ ((module) => {
|
36299 |
|
36300 | "use strict";
|
36301 | module.exports = require("stylis");
|
36302 |
|
36303 | /***/ }),
|
36304 |
|
36305 | /***/ "?1da1":
|
36306 | /*!********************!*\
|
36307 | !*** fs (ignored) ***!
|
36308 | \********************/
|
36309 | /***/ (() => {
|
36310 |
|
36311 | /* (ignored) */
|
36312 |
|
36313 | /***/ }),
|
36314 |
|
36315 | /***/ "?35ed":
|
36316 | /*!********************!*\
|
36317 | !*** fs (ignored) ***!
|
36318 | \********************/
|
36319 | /***/ (() => {
|
36320 |
|
36321 | /* (ignored) */
|
36322 |
|
36323 | /***/ }),
|
36324 |
|
36325 | /***/ "?3c87":
|
36326 | /*!********************!*\
|
36327 | !*** fs (ignored) ***!
|
36328 | \********************/
|
36329 | /***/ (() => {
|
36330 |
|
36331 | /* (ignored) */
|
36332 |
|
36333 | /***/ }),
|
36334 |
|
36335 | /***/ "?dbae":
|
36336 | /*!********************!*\
|
36337 | !*** fs (ignored) ***!
|
36338 | \********************/
|
36339 | /***/ (() => {
|
36340 |
|
36341 | /* (ignored) */
|
36342 |
|
36343 | /***/ }),
|
36344 |
|
36345 | /***/ "?8ed1":
|
36346 | /*!********************!*\
|
36347 | !*** fs (ignored) ***!
|
36348 | \********************/
|
36349 | /***/ (() => {
|
36350 |
|
36351 | /* (ignored) */
|
36352 |
|
36353 | /***/ }),
|
36354 |
|
36355 | /***/ "?2b40":
|
36356 | /*!********************!*\
|
36357 | !*** fs (ignored) ***!
|
36358 | \********************/
|
36359 | /***/ (() => {
|
36360 |
|
36361 | /* (ignored) */
|
36362 |
|
36363 | /***/ }),
|
36364 |
|
36365 | /***/ "?c5f1":
|
36366 | /*!********************!*\
|
36367 | !*** fs (ignored) ***!
|
36368 | \********************/
|
36369 | /***/ (() => {
|
36370 |
|
36371 | /* (ignored) */
|
36372 |
|
36373 | /***/ }),
|
36374 |
|
36375 | /***/ "?a3fa":
|
36376 | /*!********************!*\
|
36377 | !*** fs (ignored) ***!
|
36378 | \********************/
|
36379 | /***/ (() => {
|
36380 |
|
36381 | /* (ignored) */
|
36382 |
|
36383 | /***/ }),
|
36384 |
|
36385 | /***/ "?ebf4":
|
36386 | /*!********************!*\
|
36387 | !*** fs (ignored) ***!
|
36388 | \********************/
|
36389 | /***/ (() => {
|
36390 |
|
36391 | /* (ignored) */
|
36392 |
|
36393 | /***/ }),
|
36394 |
|
36395 | /***/ "?e940":
|
36396 | /*!********************!*\
|
36397 | !*** fs (ignored) ***!
|
36398 | \********************/
|
36399 | /***/ (() => {
|
36400 |
|
36401 | /* (ignored) */
|
36402 |
|
36403 | /***/ }),
|
36404 |
|
36405 | /***/ "?a3b8":
|
36406 | /*!********************!*\
|
36407 | !*** fs (ignored) ***!
|
36408 | \********************/
|
36409 | /***/ (() => {
|
36410 |
|
36411 | /* (ignored) */
|
36412 |
|
36413 | /***/ }),
|
36414 |
|
36415 | /***/ "?0f62":
|
36416 | /*!********************!*\
|
36417 | !*** fs (ignored) ***!
|
36418 | \********************/
|
36419 | /***/ (() => {
|
36420 |
|
36421 | /* (ignored) */
|
36422 |
|
36423 | /***/ }),
|
36424 |
|
36425 | /***/ "./package.json":
|
36426 | /*!**********************!*\
|
36427 | !*** ./package.json ***!
|
36428 | \**********************/
|
36429 | /***/ ((module) => {
|
36430 |
|
36431 | "use strict";
|
36432 | module.exports = JSON.parse('{"name":"mermaid","version":"9.1.5","description":"Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.","main":"dist/mermaid.core.js","module":"dist/mermaid.esm.min.mjs","exports":{".":{"require":"./dist/mermaid.core.js","import":"./dist/mermaid.esm.min.mjs"},"./*":"./*"},"keywords":["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph"],"scripts":{"build:development":"webpack --mode development --progress --color","build:production":"webpack --mode production --progress --color","build":"concurrently \\"yarn build:development\\" \\"yarn build:production\\"","postbuild":"documentation build src/mermaidAPI.js src/config.js src/defaultConfig.js --shallow -f md --markdown-toc false > docs/Setup.md","build:watch":"yarn build:development --watch","release":"yarn build","lint":"eslint ./ --ext .js,.json,.html","lint:fix":"yarn lint --fix","e2e:depr":"yarn lint && jest e2e --config e2e/jest.config.js","cypress":"cypress run","e2e":"start-server-and-test dev http://localhost:9000/ cypress","e2e-upd":"yarn lint && jest e2e -u --config e2e/jest.config.js","dev":"webpack serve --config ./.webpack/webpack.config.e2e.babel.js","ci":"jest src/.*","test":"yarn lint && jest src/.*","test:watch":"jest --watch src","prepublishOnly":"yarn build && yarn test","prepare":"husky install && yarn build","pre-commit":"lint-staged"},"repository":{"type":"git","url":"https://github.com/knsv/mermaid"},"author":"Knut Sveidqvist","license":"MIT","standard":{"ignore":["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],"globals":["page"]},"dependencies":{"@braintree/sanitize-url":"^6.0.0","d3":"^7.0.0","dagre":"^0.8.5","dagre-d3":"^0.6.4","dompurify":"2.3.10","graphlib":"^2.1.8","khroma":"^2.0.0","moment-mini":"2.24.0","stylis":"^4.0.10"},"devDependencies":{"@applitools/eyes-cypress":"^3.25.7","@babel/core":"^7.14.6","@babel/eslint-parser":"^7.14.7","@babel/preset-env":"^7.14.7","@babel/register":"^7.14.5","@commitlint/cli":"^17.0.0","@commitlint/config-conventional":"^17.0.0","babel-jest":"^28.0.3","babel-loader":"^8.2.2","concurrently":"^7.0.0","coveralls":"^3.0.2","css-to-string-loader":"^0.1.3","cypress":"9.7.0","cypress-image-snapshot":"^4.0.1","documentation":"13.2.0","eslint":"^8.4.1","eslint-config-prettier":"^8.3.0","eslint-plugin-cypress":"^2.12.1","eslint-plugin-html":"^7.1.0","eslint-plugin-jest":"^26.0.0","eslint-plugin-jsdoc":"^39.1.0","eslint-plugin-json":"^3.1.0","eslint-plugin-markdown":"^3.0.0","eslint-plugin-prettier":"^4.0.0","husky":"^8.0.0","identity-obj-proxy":"^3.0.0","jest":"^28.0.3","jest-environment-jsdom":"^28.0.2","jison":"^0.4.18","js-base64":"3.7.2","lint-staged":"^13.0.0","moment":"^2.23.0","path-browserify":"^1.0.1","prettier":"^2.3.2","prettier-plugin-jsdoc":"^0.3.30","start-server-and-test":"^1.12.6","terser-webpack-plugin":"^5.2.4","webpack":"^5.53.0","webpack-cli":"^4.7.2","webpack-dev-server":"^4.3.0","webpack-merge":"^5.8.0","webpack-node-externals":"^3.0.0"},"resolutions":{"d3":"^7.0.0"},"files":["dist"],"sideEffects":["**/*.css","**/*.scss"]}');
|
36433 |
|
36434 | /***/ })
|
36435 |
|
36436 | /******/ });
|
36437 | /************************************************************************/
|
36438 | /******/ // The module cache
|
36439 | /******/ var __webpack_module_cache__ = {};
|
36440 | /******/
|
36441 | /******/ // The require function
|
36442 | /******/ function __webpack_require__(moduleId) {
|
36443 | /******/ // Check if module is in cache
|
36444 | /******/ var cachedModule = __webpack_module_cache__[moduleId];
|
36445 | /******/ if (cachedModule !== undefined) {
|
36446 | /******/ return cachedModule.exports;
|
36447 | /******/ }
|
36448 | /******/ // Create a new module (and put it into the cache)
|
36449 | /******/ var module = __webpack_module_cache__[moduleId] = {
|
36450 | /******/ id: moduleId,
|
36451 | /******/ loaded: false,
|
36452 | /******/ exports: {}
|
36453 | /******/ };
|
36454 | /******/
|
36455 | /******/ // Execute the module function
|
36456 | /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
36457 | /******/
|
36458 | /******/ // Flag the module as loaded
|
36459 | /******/ module.loaded = true;
|
36460 | /******/
|
36461 | /******/ // Return the exports of the module
|
36462 | /******/ return module.exports;
|
36463 | /******/ }
|
36464 | /******/
|
36465 | /******/ // expose the module cache
|
36466 | /******/ __webpack_require__.c = __webpack_module_cache__;
|
36467 | /******/
|
36468 | /************************************************************************/
|
36469 | /******/ /* webpack/runtime/compat get default export */
|
36470 | /******/ (() => {
|
36471 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
36472 | /******/ __webpack_require__.n = (module) => {
|
36473 | /******/ var getter = module && module.__esModule ?
|
36474 | /******/ () => (module['default']) :
|
36475 | /******/ () => (module);
|
36476 | /******/ __webpack_require__.d(getter, { a: getter });
|
36477 | /******/ return getter;
|
36478 | /******/ };
|
36479 | /******/ })();
|
36480 | /******/
|
36481 | /******/ /* webpack/runtime/define property getters */
|
36482 | /******/ (() => {
|
36483 | /******/ // define getter functions for harmony exports
|
36484 | /******/ __webpack_require__.d = (exports, definition) => {
|
36485 | /******/ for(var key in definition) {
|
36486 | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
36487 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
36488 | /******/ }
|
36489 | /******/ }
|
36490 | /******/ };
|
36491 | /******/ })();
|
36492 | /******/
|
36493 | /******/ /* webpack/runtime/global */
|
36494 | /******/ (() => {
|
36495 | /******/ __webpack_require__.g = (function() {
|
36496 | /******/ if (typeof globalThis === 'object') return globalThis;
|
36497 | /******/ try {
|
36498 | /******/ return this || new Function('return this')();
|
36499 | /******/ } catch (e) {
|
36500 | /******/ if (typeof window === 'object') return window;
|
36501 | /******/ }
|
36502 | /******/ })();
|
36503 | /******/ })();
|
36504 | /******/
|
36505 | /******/ /* webpack/runtime/hasOwnProperty shorthand */
|
36506 | /******/ (() => {
|
36507 | /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
36508 | /******/ })();
|
36509 | /******/
|
36510 | /******/ /* webpack/runtime/make namespace object */
|
36511 | /******/ (() => {
|
36512 | /******/ // define __esModule on exports
|
36513 | /******/ __webpack_require__.r = (exports) => {
|
36514 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
36515 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
36516 | /******/ }
|
36517 | /******/ Object.defineProperty(exports, '__esModule', { value: true });
|
36518 | /******/ };
|
36519 | /******/ })();
|
36520 | /******/
|
36521 | /******/ /* webpack/runtime/node module decorator */
|
36522 | /******/ (() => {
|
36523 | /******/ __webpack_require__.nmd = (module) => {
|
36524 | /******/ module.paths = [];
|
36525 | /******/ if (!module.children) module.children = [];
|
36526 | /******/ return module;
|
36527 | /******/ };
|
36528 | /******/ })();
|
36529 | /******/
|
36530 | /************************************************************************/
|
36531 | /******/
|
36532 | /******/ // module cache are used so entry inlining is disabled
|
36533 | /******/ // startup
|
36534 | /******/ // Load entry module and return exports
|
36535 | /******/ var __webpack_exports__ = __webpack_require__(__webpack_require__.s = "./src/mermaid.js");
|
36536 | /******/ __webpack_exports__ = __webpack_exports__["default"];
|
36537 | /******/
|
36538 | /******/ return __webpack_exports__;
|
36539 | /******/ })()
|
36540 | ;
|
36541 | });
|
36542 | //# sourceMappingURL=mermaid.core.js.map |
\ | No newline at end of file |