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, function() {
|
11 | return (() => {
|
12 | var __webpack_modules__ = ({
|
13 |
|
14 | "./src/diagrams/class/parser/classDiagram.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,12],$V5=[1,11],$V6=[1,15,24],$V7=[1,19],$V8=[1,31],$V9=[1,34],$Va=[1,32],$Vb=[1,33],$Vc=[1,35],$Vd=[1,36],$Ve=[1,37],$Vf=[1,38],$Vg=[1,41],$Vh=[1,42],$Vi=[1,43],$Vj=[1,44],$Vk=[15,24],$Vl=[1,56],$Vm=[1,57],$Vn=[1,58],$Vo=[1,59],$Vp=[1,60],$Vq=[1,61],$Vr=[15,24,31,38,39,47,50,51,52,53,54,55,60,62],$Vs=[15,24,29,31,38,39,43,47,50,51,52,53,54,55,60,62,77,78,79,80],$Vt=[7,8,9,10,15,18,22,24],$Vu=[47,77,78,79,80],$Vv=[47,54,55,77,78,79,80],$Vw=[47,50,51,52,53,77,78,79,80],$Vx=[15,24,31],$Vy=[1,93];
|
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,"CLASS_DIAGRAM":22,"statements":23,"EOF":24,"statement":25,"className":26,"alphaNumToken":27,"classLiteralName":28,"GENERICTYPE":29,"relationStatement":30,"LABEL":31,"classStatement":32,"methodStatement":33,"annotationStatement":34,"clickStatement":35,"cssClassStatement":36,"CLASS":37,"STYLE_SEPARATOR":38,"STRUCT_START":39,"members":40,"STRUCT_STOP":41,"ANNOTATION_START":42,"ANNOTATION_END":43,"MEMBER":44,"SEPARATOR":45,"relation":46,"STR":47,"relationType":48,"lineType":49,"AGGREGATION":50,"EXTENSION":51,"COMPOSITION":52,"DEPENDENCY":53,"LINE":54,"DOTTED_LINE":55,"CALLBACK":56,"LINK":57,"LINK_TARGET":58,"CLICK":59,"CALLBACK_NAME":60,"CALLBACK_ARGS":61,"HREF":62,"CSSCLASS":63,"commentToken":64,"textToken":65,"graphCodeTokens":66,"textNoTagsToken":67,"TAGSTART":68,"TAGEND":69,"==":70,"--":71,"PCT":72,"DEFAULT":73,"SPACE":74,"MINUS":75,"keywords":76,"UNICODE_TEXT":77,"NUM":78,"ALPHA":79,"BQUOTE_STR":80,"$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:"CLASS_DIAGRAM",24:"EOF",29:"GENERICTYPE",31:"LABEL",37:"CLASS",38:"STYLE_SEPARATOR",39:"STRUCT_START",41:"STRUCT_STOP",42:"ANNOTATION_START",43:"ANNOTATION_END",44:"MEMBER",45:"SEPARATOR",47:"STR",50:"AGGREGATION",51:"EXTENSION",52:"COMPOSITION",53:"DEPENDENCY",54:"LINE",55:"DOTTED_LINE",56:"CALLBACK",57:"LINK",58:"LINK_TARGET",59:"CLICK",60:"CALLBACK_NAME",61:"CALLBACK_ARGS",62:"HREF",63:"CSSCLASS",66:"graphCodeTokens",68:"TAGSTART",69:"TAGEND",70:"==",71:"--",72:"PCT",73:"DEFAULT",74:"SPACE",75:"MINUS",76:"keywords",77:"UNICODE_TEXT",78:"NUM",79:"ALPHA",80:"BQUOTE_STR"},
|
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],[23,1],[23,2],[23,3],[26,1],[26,1],[26,2],[26,2],[26,2],[25,1],[25,2],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[32,2],[32,4],[32,5],[32,7],[34,4],[40,1],[40,2],[33,1],[33,2],[33,1],[33,1],[30,3],[30,4],[30,4],[30,5],[46,3],[46,2],[46,2],[46,1],[48,1],[48,1],[48,1],[48,1],[49,1],[49,1],[35,3],[35,4],[35,3],[35,4],[35,4],[35,5],[35,3],[35,4],[35,4],[35,5],[35,3],[35,4],[35,4],[35,5],[36,3],[64,1],[64,1],[65,1],[65,1],[65,1],[65,1],[65,1],[65,1],[65,1],[67,1],[67,1],[67,1],[67,1],[27,1],[27,1],[27,1],[28,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 | yy.parseDirective('%%{', 'open_directive');
|
120 | break;
|
121 | case 12:
|
122 | yy.parseDirective($$[$0], 'type_directive');
|
123 | break;
|
124 | case 13:
|
125 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
126 | break;
|
127 | case 14:
|
128 | yy.parseDirective('}%%', 'close_directive', 'class');
|
129 | break;
|
130 | case 19: case 20:
|
131 | this.$=$$[$0];
|
132 | break;
|
133 | case 21:
|
134 | this.$=$$[$0-1]+$$[$0];
|
135 | break;
|
136 | case 22: case 23:
|
137 | this.$=$$[$0-1]+'~'+$$[$0];
|
138 | break;
|
139 | case 24:
|
140 | yy.addRelation($$[$0]);
|
141 | break;
|
142 | case 25:
|
143 | $$[$0-1].title = yy.cleanupLabel($$[$0]); yy.addRelation($$[$0-1]);
|
144 | break;
|
145 | case 33:
|
146 | yy.addClass($$[$0]);
|
147 | break;
|
148 | case 34:
|
149 | yy.addClass($$[$0-2]);yy.setCssClass($$[$0-2], $$[$0]);
|
150 | break;
|
151 | case 35:
|
152 | yy.addClass($$[$0-3]);yy.addMembers($$[$0-3],$$[$0-1]);
|
153 | break;
|
154 | case 36:
|
155 | yy.addClass($$[$0-5]);yy.setCssClass($$[$0-5], $$[$0-3]);yy.addMembers($$[$0-5],$$[$0-1]);
|
156 | break;
|
157 | case 37:
|
158 | yy.addAnnotation($$[$0],$$[$0-2]);
|
159 | break;
|
160 | case 38:
|
161 | this.$ = [$$[$0]];
|
162 | break;
|
163 | case 39:
|
164 | $$[$0].push($$[$0-1]);this.$=$$[$0];
|
165 | break;
|
166 | case 40:
|
167 |
|
168 | break;
|
169 | case 41:
|
170 | yy.addMember($$[$0-1],yy.cleanupLabel($$[$0]));
|
171 | break;
|
172 | case 42:
|
173 |
|
174 | break;
|
175 | case 43:
|
176 |
|
177 | break;
|
178 | case 44:
|
179 | this.$ = {'id1':$$[$0-2],'id2':$$[$0], relation:$$[$0-1], relationTitle1:'none', relationTitle2:'none'};
|
180 | break;
|
181 | case 45:
|
182 | this.$ = {id1:$$[$0-3], id2:$$[$0], relation:$$[$0-1], relationTitle1:$$[$0-2], relationTitle2:'none'}
|
183 | break;
|
184 | case 46:
|
185 | this.$ = {id1:$$[$0-3], id2:$$[$0], relation:$$[$0-2], relationTitle1:'none', relationTitle2:$$[$0-1]};
|
186 | break;
|
187 | case 47:
|
188 | this.$ = {id1:$$[$0-4], id2:$$[$0], relation:$$[$0-2], relationTitle1:$$[$0-3], relationTitle2:$$[$0-1]}
|
189 | break;
|
190 | case 48:
|
191 | this.$={type1:$$[$0-2],type2:$$[$0],lineType:$$[$0-1]};
|
192 | break;
|
193 | case 49:
|
194 | this.$={type1:'none',type2:$$[$0],lineType:$$[$0-1]};
|
195 | break;
|
196 | case 50:
|
197 | this.$={type1:$$[$0-1],type2:'none',lineType:$$[$0]};
|
198 | break;
|
199 | case 51:
|
200 | this.$={type1:'none',type2:'none',lineType:$$[$0]};
|
201 | break;
|
202 | case 52:
|
203 | this.$=yy.relationType.AGGREGATION;
|
204 | break;
|
205 | case 53:
|
206 | this.$=yy.relationType.EXTENSION;
|
207 | break;
|
208 | case 54:
|
209 | this.$=yy.relationType.COMPOSITION;
|
210 | break;
|
211 | case 55:
|
212 | this.$=yy.relationType.DEPENDENCY;
|
213 | break;
|
214 | case 56:
|
215 | this.$=yy.lineType.LINE;
|
216 | break;
|
217 | case 57:
|
218 | this.$=yy.lineType.DOTTED_LINE;
|
219 | break;
|
220 | case 58: case 64:
|
221 | this.$ = $$[$0-2];yy.setClickEvent($$[$0-1], $$[$0]);
|
222 | break;
|
223 | case 59: case 65:
|
224 | this.$ = $$[$0-3];yy.setClickEvent($$[$0-2], $$[$0-1]);yy.setTooltip($$[$0-2], $$[$0]);
|
225 | break;
|
226 | case 60: case 68:
|
227 | this.$ = $$[$0-2];yy.setLink($$[$0-1], $$[$0]);
|
228 | break;
|
229 | case 61:
|
230 | this.$ = $$[$0-3];yy.setLink($$[$0-2], $$[$0-1],$$[$0]);
|
231 | break;
|
232 | case 62: case 70:
|
233 | this.$ = $$[$0-3];yy.setLink($$[$0-2], $$[$0-1]);yy.setTooltip($$[$0-2], $$[$0]);
|
234 | break;
|
235 | case 63: case 71:
|
236 | this.$ = $$[$0-4];yy.setLink($$[$0-3], $$[$0-2], $$[$0]);yy.setTooltip($$[$0-3], $$[$0-1]);
|
237 | break;
|
238 | case 66:
|
239 | this.$ = $$[$0-3];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]);
|
240 | break;
|
241 | case 67:
|
242 | this.$ = $$[$0-4];yy.setClickEvent($$[$0-3], $$[$0-2], $$[$0-1]);yy.setTooltip($$[$0-3], $$[$0]);
|
243 | break;
|
244 | case 69:
|
245 | this.$ = $$[$0-3];yy.setLink($$[$0-2], $$[$0-1], $$[$0]);
|
246 | break;
|
247 | case 72:
|
248 | yy.setCssClass($$[$0-1], $$[$0]);
|
249 | break;
|
250 | }
|
251 | },
|
252 | 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},{1:[3]},{1:[2,1]},{1:[2,2]},{3:13,4:2,5:3,6:4,7:$V0,8:$V1,9:$V2,10:$V3,11:5,12:10,18:$V4,22:$V5},{1:[2,8]},o($V6,[2,4]),o($V6,[2,5]),o($V6,[2,6]),o($V6,[2,7]),{13:14,19:[1,15]},{15:[1,16]},{19:[2,11]},{1:[2,3]},{14:17,16:[1,18],21:$V7},o([16,21],[2,12]),{5:29,6:28,7:$V0,8:$V1,9:$V2,10:$V3,12:10,18:$V4,23:20,25:21,26:30,27:39,28:40,30:22,32:23,33:24,34:25,35:26,36:27,37:$V8,42:$V9,44:$Va,45:$Vb,56:$Vc,57:$Vd,59:$Ve,63:$Vf,77:$Vg,78:$Vh,79:$Vi,80:$Vj},{15:[1,45]},{17:46,20:[1,47]},{15:[2,14]},{24:[1,48]},{15:[1,49],24:[2,16]},o($Vk,[2,24],{31:[1,50]}),o($Vk,[2,26]),o($Vk,[2,27]),o($Vk,[2,28]),o($Vk,[2,29]),o($Vk,[2,30]),o($Vk,[2,31]),o($Vk,[2,32]),o($Vk,[2,40],{46:51,48:54,49:55,31:[1,53],47:[1,52],50:$Vl,51:$Vm,52:$Vn,53:$Vo,54:$Vp,55:$Vq}),{26:62,27:39,28:40,77:$Vg,78:$Vh,79:$Vi,80:$Vj},o($Vk,[2,42]),o($Vk,[2,43]),{27:63,77:$Vg,78:$Vh,79:$Vi},{26:64,27:39,28:40,77:$Vg,78:$Vh,79:$Vi,80:$Vj},{26:65,27:39,28:40,77:$Vg,78:$Vh,79:$Vi,80:$Vj},{26:66,27:39,28:40,77:$Vg,78:$Vh,79:$Vi,80:$Vj},{47:[1,67]},o($Vr,[2,19],{27:39,28:40,26:68,29:[1,69],77:$Vg,78:$Vh,79:$Vi,80:$Vj}),o($Vr,[2,20],{29:[1,70]}),o($Vs,[2,86]),o($Vs,[2,87]),o($Vs,[2,88]),o([15,24,29,31,38,39,47,50,51,52,53,54,55,60,62],[2,89]),o($Vt,[2,9]),{14:71,21:$V7},{21:[2,13]},{1:[2,15]},{5:29,6:28,7:$V0,8:$V1,9:$V2,10:$V3,12:10,18:$V4,23:72,24:[2,17],25:21,26:30,27:39,28:40,30:22,32:23,33:24,34:25,35:26,36:27,37:$V8,42:$V9,44:$Va,45:$Vb,56:$Vc,57:$Vd,59:$Ve,63:$Vf,77:$Vg,78:$Vh,79:$Vi,80:$Vj},o($Vk,[2,25]),{26:73,27:39,28:40,47:[1,74],77:$Vg,78:$Vh,79:$Vi,80:$Vj},{46:75,48:54,49:55,50:$Vl,51:$Vm,52:$Vn,53:$Vo,54:$Vp,55:$Vq},o($Vk,[2,41]),{49:76,54:$Vp,55:$Vq},o($Vu,[2,51],{48:77,50:$Vl,51:$Vm,52:$Vn,53:$Vo}),o($Vv,[2,52]),o($Vv,[2,53]),o($Vv,[2,54]),o($Vv,[2,55]),o($Vw,[2,56]),o($Vw,[2,57]),o($Vk,[2,33],{38:[1,78],39:[1,79]}),{43:[1,80]},{47:[1,81]},{47:[1,82]},{60:[1,83],62:[1,84]},{27:85,77:$Vg,78:$Vh,79:$Vi},o($Vr,[2,21]),o($Vr,[2,22]),o($Vr,[2,23]),{15:[1,86]},{24:[2,18]},o($Vx,[2,44]),{26:87,27:39,28:40,77:$Vg,78:$Vh,79:$Vi,80:$Vj},{26:88,27:39,28:40,47:[1,89],77:$Vg,78:$Vh,79:$Vi,80:$Vj},o($Vu,[2,50],{48:90,50:$Vl,51:$Vm,52:$Vn,53:$Vo}),o($Vu,[2,49]),{27:91,77:$Vg,78:$Vh,79:$Vi},{40:92,44:$Vy},{26:94,27:39,28:40,77:$Vg,78:$Vh,79:$Vi,80:$Vj},o($Vk,[2,58],{47:[1,95]}),o($Vk,[2,60],{47:[1,97],58:[1,96]}),o($Vk,[2,64],{47:[1,98],61:[1,99]}),o($Vk,[2,68],{47:[1,101],58:[1,100]}),o($Vk,[2,72]),o($Vt,[2,10]),o($Vx,[2,46]),o($Vx,[2,45]),{26:102,27:39,28:40,77:$Vg,78:$Vh,79:$Vi,80:$Vj},o($Vu,[2,48]),o($Vk,[2,34],{39:[1,103]}),{41:[1,104]},{40:105,41:[2,38],44:$Vy},o($Vk,[2,37]),o($Vk,[2,59]),o($Vk,[2,61]),o($Vk,[2,62],{58:[1,106]}),o($Vk,[2,65]),o($Vk,[2,66],{47:[1,107]}),o($Vk,[2,69]),o($Vk,[2,70],{58:[1,108]}),o($Vx,[2,47]),{40:109,44:$Vy},o($Vk,[2,35]),{41:[2,39]},o($Vk,[2,63]),o($Vk,[2,67]),o($Vk,[2,71]),{41:[1,110]},o($Vk,[2,36])],
|
253 | defaultActions: {2:[2,1],3:[2,2],5:[2,8],12:[2,11],13:[2,3],19:[2,14],47:[2,13],48:[2,15],72:[2,18],105:[2,39]},
|
254 | parseError: function parseError (str, hash) {
|
255 | if (hash.recoverable) {
|
256 | this.trace(str);
|
257 | } else {
|
258 | var error = new Error(str);
|
259 | error.hash = hash;
|
260 | throw error;
|
261 | }
|
262 | },
|
263 | parse: function parse(input) {
|
264 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
265 | var args = lstack.slice.call(arguments, 1);
|
266 | var lexer = Object.create(this.lexer);
|
267 | var sharedState = { yy: {} };
|
268 | for (var k in this.yy) {
|
269 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
270 | sharedState.yy[k] = this.yy[k];
|
271 | }
|
272 | }
|
273 | lexer.setInput(input, sharedState.yy);
|
274 | sharedState.yy.lexer = lexer;
|
275 | sharedState.yy.parser = this;
|
276 | if (typeof lexer.yylloc == 'undefined') {
|
277 | lexer.yylloc = {};
|
278 | }
|
279 | var yyloc = lexer.yylloc;
|
280 | lstack.push(yyloc);
|
281 | var ranges = lexer.options && lexer.options.ranges;
|
282 | if (typeof sharedState.yy.parseError === 'function') {
|
283 | this.parseError = sharedState.yy.parseError;
|
284 | } else {
|
285 | this.parseError = Object.getPrototypeOf(this).parseError;
|
286 | }
|
287 | function popStack(n) {
|
288 | stack.length = stack.length - 2 * n;
|
289 | vstack.length = vstack.length - n;
|
290 | lstack.length = lstack.length - n;
|
291 | }
|
292 | function lex() {
|
293 | var token;
|
294 | token = tstack.pop() || lexer.lex() || EOF;
|
295 | if (typeof token !== 'number') {
|
296 | if (token instanceof Array) {
|
297 | tstack = token;
|
298 | token = tstack.pop();
|
299 | }
|
300 | token = self.symbols_[token] || token;
|
301 | }
|
302 | return token;
|
303 | }
|
304 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
305 | while (true) {
|
306 | state = stack[stack.length - 1];
|
307 | if (this.defaultActions[state]) {
|
308 | action = this.defaultActions[state];
|
309 | } else {
|
310 | if (symbol === null || typeof symbol == 'undefined') {
|
311 | symbol = lex();
|
312 | }
|
313 | action = table[state] && table[state][symbol];
|
314 | }
|
315 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
316 | var errStr = '';
|
317 | expected = [];
|
318 | for (p in table[state]) {
|
319 | if (this.terminals_[p] && p > TERROR) {
|
320 | expected.push('\'' + this.terminals_[p] + '\'');
|
321 | }
|
322 | }
|
323 | if (lexer.showPosition) {
|
324 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
325 | } else {
|
326 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
327 | }
|
328 | this.parseError(errStr, {
|
329 | text: lexer.match,
|
330 | token: this.terminals_[symbol] || symbol,
|
331 | line: lexer.yylineno,
|
332 | loc: yyloc,
|
333 | expected: expected
|
334 | });
|
335 | }
|
336 | if (action[0] instanceof Array && action.length > 1) {
|
337 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
338 | }
|
339 | switch (action[0]) {
|
340 | case 1:
|
341 | stack.push(symbol);
|
342 | vstack.push(lexer.yytext);
|
343 | lstack.push(lexer.yylloc);
|
344 | stack.push(action[1]);
|
345 | symbol = null;
|
346 | if (!preErrorSymbol) {
|
347 | yyleng = lexer.yyleng;
|
348 | yytext = lexer.yytext;
|
349 | yylineno = lexer.yylineno;
|
350 | yyloc = lexer.yylloc;
|
351 | if (recovering > 0) {
|
352 | recovering--;
|
353 | }
|
354 | } else {
|
355 | symbol = preErrorSymbol;
|
356 | preErrorSymbol = null;
|
357 | }
|
358 | break;
|
359 | case 2:
|
360 | len = this.productions_[action[1]][1];
|
361 | yyval.$ = vstack[vstack.length - len];
|
362 | yyval._$ = {
|
363 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
364 | last_line: lstack[lstack.length - 1].last_line,
|
365 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
366 | last_column: lstack[lstack.length - 1].last_column
|
367 | };
|
368 | if (ranges) {
|
369 | yyval._$.range = [
|
370 | lstack[lstack.length - (len || 1)].range[0],
|
371 | lstack[lstack.length - 1].range[1]
|
372 | ];
|
373 | }
|
374 | r = this.performAction.apply(yyval, [
|
375 | yytext,
|
376 | yyleng,
|
377 | yylineno,
|
378 | sharedState.yy,
|
379 | action[1],
|
380 | vstack,
|
381 | lstack
|
382 | ].concat(args));
|
383 | if (typeof r !== 'undefined') {
|
384 | return r;
|
385 | }
|
386 | if (len) {
|
387 | stack = stack.slice(0, -1 * len * 2);
|
388 | vstack = vstack.slice(0, -1 * len);
|
389 | lstack = lstack.slice(0, -1 * len);
|
390 | }
|
391 | stack.push(this.productions_[action[1]][0]);
|
392 | vstack.push(yyval.$);
|
393 | lstack.push(yyval._$);
|
394 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
395 | stack.push(newState);
|
396 | break;
|
397 | case 3:
|
398 | return true;
|
399 | }
|
400 | }
|
401 | return true;
|
402 | }};
|
403 |
|
404 |
|
405 | var lexer = (function(){
|
406 | var lexer = ({
|
407 |
|
408 | EOF:1,
|
409 |
|
410 | parseError:function parseError(str, hash) {
|
411 | if (this.yy.parser) {
|
412 | this.yy.parser.parseError(str, hash);
|
413 | } else {
|
414 | throw new Error(str);
|
415 | }
|
416 | },
|
417 |
|
418 |
|
419 | setInput:function (input, yy) {
|
420 | this.yy = yy || this.yy || {};
|
421 | this._input = input;
|
422 | this._more = this._backtrack = this.done = false;
|
423 | this.yylineno = this.yyleng = 0;
|
424 | this.yytext = this.matched = this.match = '';
|
425 | this.conditionStack = ['INITIAL'];
|
426 | this.yylloc = {
|
427 | first_line: 1,
|
428 | first_column: 0,
|
429 | last_line: 1,
|
430 | last_column: 0
|
431 | };
|
432 | if (this.options.ranges) {
|
433 | this.yylloc.range = [0,0];
|
434 | }
|
435 | this.offset = 0;
|
436 | return this;
|
437 | },
|
438 |
|
439 |
|
440 | input:function () {
|
441 | var ch = this._input[0];
|
442 | this.yytext += ch;
|
443 | this.yyleng++;
|
444 | this.offset++;
|
445 | this.match += ch;
|
446 | this.matched += ch;
|
447 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
448 | if (lines) {
|
449 | this.yylineno++;
|
450 | this.yylloc.last_line++;
|
451 | } else {
|
452 | this.yylloc.last_column++;
|
453 | }
|
454 | if (this.options.ranges) {
|
455 | this.yylloc.range[1]++;
|
456 | }
|
457 |
|
458 | this._input = this._input.slice(1);
|
459 | return ch;
|
460 | },
|
461 |
|
462 |
|
463 | unput:function (ch) {
|
464 | var len = ch.length;
|
465 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
466 |
|
467 | this._input = ch + this._input;
|
468 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
469 |
|
470 | this.offset -= len;
|
471 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
472 | this.match = this.match.substr(0, this.match.length - 1);
|
473 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
474 |
|
475 | if (lines.length - 1) {
|
476 | this.yylineno -= lines.length - 1;
|
477 | }
|
478 | var r = this.yylloc.range;
|
479 |
|
480 | this.yylloc = {
|
481 | first_line: this.yylloc.first_line,
|
482 | last_line: this.yylineno + 1,
|
483 | first_column: this.yylloc.first_column,
|
484 | last_column: lines ?
|
485 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
486 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
487 | this.yylloc.first_column - len
|
488 | };
|
489 |
|
490 | if (this.options.ranges) {
|
491 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
492 | }
|
493 | this.yyleng = this.yytext.length;
|
494 | return this;
|
495 | },
|
496 |
|
497 |
|
498 | more:function () {
|
499 | this._more = true;
|
500 | return this;
|
501 | },
|
502 |
|
503 |
|
504 | reject:function () {
|
505 | if (this.options.backtrack_lexer) {
|
506 | this._backtrack = true;
|
507 | } else {
|
508 | 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(), {
|
509 | text: "",
|
510 | token: null,
|
511 | line: this.yylineno
|
512 | });
|
513 |
|
514 | }
|
515 | return this;
|
516 | },
|
517 |
|
518 |
|
519 | less:function (n) {
|
520 | this.unput(this.match.slice(n));
|
521 | },
|
522 |
|
523 |
|
524 | pastInput:function () {
|
525 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
526 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
527 | },
|
528 |
|
529 |
|
530 | upcomingInput:function () {
|
531 | var next = this.match;
|
532 | if (next.length < 20) {
|
533 | next += this._input.substr(0, 20-next.length);
|
534 | }
|
535 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
536 | },
|
537 |
|
538 |
|
539 | showPosition:function () {
|
540 | var pre = this.pastInput();
|
541 | var c = new Array(pre.length + 1).join("-");
|
542 | return pre + this.upcomingInput() + "\n" + c + "^";
|
543 | },
|
544 |
|
545 |
|
546 | test_match:function(match, indexed_rule) {
|
547 | var token,
|
548 | lines,
|
549 | backup;
|
550 |
|
551 | if (this.options.backtrack_lexer) {
|
552 |
|
553 | backup = {
|
554 | yylineno: this.yylineno,
|
555 | yylloc: {
|
556 | first_line: this.yylloc.first_line,
|
557 | last_line: this.last_line,
|
558 | first_column: this.yylloc.first_column,
|
559 | last_column: this.yylloc.last_column
|
560 | },
|
561 | yytext: this.yytext,
|
562 | match: this.match,
|
563 | matches: this.matches,
|
564 | matched: this.matched,
|
565 | yyleng: this.yyleng,
|
566 | offset: this.offset,
|
567 | _more: this._more,
|
568 | _input: this._input,
|
569 | yy: this.yy,
|
570 | conditionStack: this.conditionStack.slice(0),
|
571 | done: this.done
|
572 | };
|
573 | if (this.options.ranges) {
|
574 | backup.yylloc.range = this.yylloc.range.slice(0);
|
575 | }
|
576 | }
|
577 |
|
578 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
579 | if (lines) {
|
580 | this.yylineno += lines.length;
|
581 | }
|
582 | this.yylloc = {
|
583 | first_line: this.yylloc.last_line,
|
584 | last_line: this.yylineno + 1,
|
585 | first_column: this.yylloc.last_column,
|
586 | last_column: lines ?
|
587 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
588 | this.yylloc.last_column + match[0].length
|
589 | };
|
590 | this.yytext += match[0];
|
591 | this.match += match[0];
|
592 | this.matches = match;
|
593 | this.yyleng = this.yytext.length;
|
594 | if (this.options.ranges) {
|
595 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
596 | }
|
597 | this._more = false;
|
598 | this._backtrack = false;
|
599 | this._input = this._input.slice(match[0].length);
|
600 | this.matched += match[0];
|
601 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
602 | if (this.done && this._input) {
|
603 | this.done = false;
|
604 | }
|
605 | if (token) {
|
606 | return token;
|
607 | } else if (this._backtrack) {
|
608 |
|
609 | for (var k in backup) {
|
610 | this[k] = backup[k];
|
611 | }
|
612 | return false;
|
613 | }
|
614 | return false;
|
615 | },
|
616 |
|
617 |
|
618 | next:function () {
|
619 | if (this.done) {
|
620 | return this.EOF;
|
621 | }
|
622 | if (!this._input) {
|
623 | this.done = true;
|
624 | }
|
625 |
|
626 | var token,
|
627 | match,
|
628 | tempMatch,
|
629 | index;
|
630 | if (!this._more) {
|
631 | this.yytext = '';
|
632 | this.match = '';
|
633 | }
|
634 | var rules = this._currentRules();
|
635 | for (var i = 0; i < rules.length; i++) {
|
636 | tempMatch = this._input.match(this.rules[rules[i]]);
|
637 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
638 | match = tempMatch;
|
639 | index = i;
|
640 | if (this.options.backtrack_lexer) {
|
641 | token = this.test_match(tempMatch, rules[i]);
|
642 | if (token !== false) {
|
643 | return token;
|
644 | } else if (this._backtrack) {
|
645 | match = false;
|
646 | continue;
|
647 | } else {
|
648 |
|
649 | return false;
|
650 | }
|
651 | } else if (!this.options.flex) {
|
652 | break;
|
653 | }
|
654 | }
|
655 | }
|
656 | if (match) {
|
657 | token = this.test_match(match, rules[index]);
|
658 | if (token !== false) {
|
659 | return token;
|
660 | }
|
661 |
|
662 | return false;
|
663 | }
|
664 | if (this._input === "") {
|
665 | return this.EOF;
|
666 | } else {
|
667 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
668 | text: "",
|
669 | token: null,
|
670 | line: this.yylineno
|
671 | });
|
672 | }
|
673 | },
|
674 |
|
675 |
|
676 | lex:function lex () {
|
677 | var r = this.next();
|
678 | if (r) {
|
679 | return r;
|
680 | } else {
|
681 | return this.lex();
|
682 | }
|
683 | },
|
684 |
|
685 |
|
686 | begin:function begin (condition) {
|
687 | this.conditionStack.push(condition);
|
688 | },
|
689 |
|
690 |
|
691 | popState:function popState () {
|
692 | var n = this.conditionStack.length - 1;
|
693 | if (n > 0) {
|
694 | return this.conditionStack.pop();
|
695 | } else {
|
696 | return this.conditionStack[0];
|
697 | }
|
698 | },
|
699 |
|
700 |
|
701 | _currentRules:function _currentRules () {
|
702 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
703 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
704 | } else {
|
705 | return this.conditions["INITIAL"].rules;
|
706 | }
|
707 | },
|
708 |
|
709 |
|
710 | topState:function topState (n) {
|
711 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
712 | if (n >= 0) {
|
713 | return this.conditionStack[n];
|
714 | } else {
|
715 | return "INITIAL";
|
716 | }
|
717 | },
|
718 |
|
719 |
|
720 | pushState:function pushState (condition) {
|
721 | this.begin(condition);
|
722 | },
|
723 |
|
724 |
|
725 | stateStackSize:function stateStackSize() {
|
726 | return this.conditionStack.length;
|
727 | },
|
728 | options: {},
|
729 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
730 | var YYSTATE=YY_START;
|
731 | switch($avoiding_name_collisions) {
|
732 | case 0: this.begin('open_directive'); return 18;
|
733 | break;
|
734 | case 1:return 7;
|
735 | break;
|
736 | case 2:return 8;
|
737 | break;
|
738 | case 3:return 9;
|
739 | break;
|
740 | case 4:return 10;
|
741 | break;
|
742 | case 5: this.begin('type_directive'); return 19;
|
743 | break;
|
744 | case 6: this.popState(); this.begin('arg_directive'); return 16;
|
745 | break;
|
746 | case 7: this.popState(); this.popState(); return 21;
|
747 | break;
|
748 | case 8:return 20;
|
749 | break;
|
750 | case 9:
|
751 | break;
|
752 | case 10:
|
753 | break;
|
754 | case 11:return 15;
|
755 | break;
|
756 | case 12:
|
757 | break;
|
758 | case 13:return 22;
|
759 | break;
|
760 | case 14:return 22;
|
761 | break;
|
762 | case 15: this.begin("struct"); return 39;
|
763 | break;
|
764 | case 16:return "EOF_IN_STRUCT";
|
765 | break;
|
766 | case 17:return "OPEN_IN_STRUCT";
|
767 | break;
|
768 | case 18: this.popState(); return 41;
|
769 | break;
|
770 | case 19:
|
771 | break;
|
772 | case 20: return "MEMBER";
|
773 | break;
|
774 | case 21:return 37;
|
775 | break;
|
776 | case 22:return 63;
|
777 | break;
|
778 | case 23:return 56;
|
779 | break;
|
780 | case 24:return 57;
|
781 | break;
|
782 | case 25:return 59;
|
783 | break;
|
784 | case 26:return 42;
|
785 | break;
|
786 | case 27:return 43;
|
787 | break;
|
788 | case 28:this.begin("generic");
|
789 | break;
|
790 | case 29:this.popState();
|
791 | break;
|
792 | case 30:return "GENERICTYPE";
|
793 | break;
|
794 | case 31:this.begin("string");
|
795 | break;
|
796 | case 32:this.popState();
|
797 | break;
|
798 | case 33:return "STR";
|
799 | break;
|
800 | case 34:this.begin("bqstring");
|
801 | break;
|
802 | case 35:this.popState();
|
803 | break;
|
804 | case 36:return "BQUOTE_STR";
|
805 | break;
|
806 | case 37:this.begin("href");
|
807 | break;
|
808 | case 38:this.popState();
|
809 | break;
|
810 | case 39:return 62;
|
811 | break;
|
812 | case 40:this.begin("callback_name");
|
813 | break;
|
814 | case 41:this.popState();
|
815 | break;
|
816 | case 42:this.popState(); this.begin("callback_args");
|
817 | break;
|
818 | case 43:return 60;
|
819 | break;
|
820 | case 44:this.popState();
|
821 | break;
|
822 | case 45:return 61;
|
823 | break;
|
824 | case 46:return 58;
|
825 | break;
|
826 | case 47:return 58;
|
827 | break;
|
828 | case 48:return 58;
|
829 | break;
|
830 | case 49:return 58;
|
831 | break;
|
832 | case 50:return 51;
|
833 | break;
|
834 | case 51:return 51;
|
835 | break;
|
836 | case 52:return 53;
|
837 | break;
|
838 | case 53:return 53;
|
839 | break;
|
840 | case 54:return 52;
|
841 | break;
|
842 | case 55:return 50;
|
843 | break;
|
844 | case 56:return 54;
|
845 | break;
|
846 | case 57:return 55;
|
847 | break;
|
848 | case 58:return 31;
|
849 | break;
|
850 | case 59:return 38;
|
851 | break;
|
852 | case 60:return 75;
|
853 | break;
|
854 | case 61:return 'DOT';
|
855 | break;
|
856 | case 62:return 'PLUS';
|
857 | break;
|
858 | case 63:return 72;
|
859 | break;
|
860 | case 64:return 'EQUALS';
|
861 | break;
|
862 | case 65:return 'EQUALS';
|
863 | break;
|
864 | case 66:return 79;
|
865 | break;
|
866 | case 67:return 'PUNCTUATION';
|
867 | break;
|
868 | case 68:return 78;
|
869 | break;
|
870 | case 69:return 77;
|
871 | break;
|
872 | case 70:return 74;
|
873 | break;
|
874 | case 71:return 24;
|
875 | break;
|
876 | }
|
877 | },
|
878 | rules: [/^(?:%%\{)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\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)/,/^(?:$)/],
|
879 | conditions: {"arg_directive":{"rules":[7,8],"inclusive":false},"type_directive":{"rules":[6,7],"inclusive":false},"open_directive":{"rules":[5],"inclusive":false},"callback_args":{"rules":[44,45],"inclusive":false},"callback_name":{"rules":[41,42,43],"inclusive":false},"href":{"rules":[38,39],"inclusive":false},"struct":{"rules":[16,17,18,19,20],"inclusive":false},"generic":{"rules":[29,30],"inclusive":false},"bqstring":{"rules":[35,36],"inclusive":false},"string":{"rules":[32,33],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,9,10,11,12,13,14,15,21,22,23,24,25,26,27,28,31,34,37,40,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],"inclusive":true}}
|
880 | });
|
881 | return lexer;
|
882 | })();
|
883 | parser.lexer = lexer;
|
884 | function Parser () {
|
885 | this.yy = {};
|
886 | }
|
887 | Parser.prototype = parser;parser.Parser = Parser;
|
888 | return new Parser;
|
889 | })();
|
890 |
|
891 |
|
892 | if (true) {
|
893 | exports.parser = parser;
|
894 | exports.Parser = parser.Parser;
|
895 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
896 | exports.main = function commonjsMain (args) {
|
897 | if (!args[1]) {
|
898 | console.log('Usage: '+args[0]+' FILE');
|
899 | process.exit(1);
|
900 | }
|
901 | var source = __webpack_require__( "?35ed").readFileSync(__webpack_require__( "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
|
902 | return exports.parser.parse(source);
|
903 | };
|
904 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
905 | exports.main(process.argv.slice(1));
|
906 | }
|
907 | }
|
908 |
|
909 | }),
|
910 |
|
911 | "./src/diagrams/er/parser/erDiagram.jison":
|
912 |
|
913 |
|
914 |
|
915 | ((module, exports, __webpack_require__) => {
|
916 |
|
917 | module = __webpack_require__.nmd(module);
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 | var parser = (function(){
|
992 | 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,40],$V3=[1,17],$V4=[1,20],$V5=[1,25],$V6=[1,26],$V7=[1,27],$V8=[1,28],$V9=[1,37],$Va=[23,37,38],$Vb=[4,6,9,11,23,40],$Vc=[33,34,35,36],$Vd=[22,29];
|
993 | var parser = {trace: function trace () { },
|
994 | yy: {},
|
995 | 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,"ALPHANUM":23,"attribute":24,"attributeType":25,"attributeName":26,"attributeKeyType":27,"COMMENT":28,"ATTRIBUTE_WORD":29,"ATTRIBUTE_KEY":30,"cardinality":31,"relType":32,"ZERO_OR_ONE":33,"ZERO_OR_MORE":34,"ONE_OR_MORE":35,"ONLY_ONE":36,"NON_IDENTIFYING":37,"IDENTIFYING":38,"WORD":39,"open_directive":40,"type_directive":41,"arg_directive":42,"close_directive":43,"$accept":0,"$end":1},
|
996 | terminals_: {2:"error",4:"ER_DIAGRAM",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",20:"BLOCK_START",22:"BLOCK_STOP",23:"ALPHANUM",28:"COMMENT",29:"ATTRIBUTE_WORD",30:"ATTRIBUTE_KEY",33:"ZERO_OR_ONE",34:"ZERO_OR_MORE",35:"ONE_OR_MORE",36:"ONLY_ONE",37:"NON_IDENTIFYING",38:"IDENTIFYING",39:"WORD",40:"open_directive",41:"type_directive",42:"arg_directive",43:"close_directive"},
|
997 | 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],[17,1],[21,1],[21,2],[24,2],[24,3],[24,3],[24,4],[25,1],[26,1],[27,1],[18,3],[31,1],[31,1],[31,1],[31,1],[32,1],[32,1],[19,1],[19,1],[12,1],[13,1],[16,1],[14,1]],
|
998 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
999 |
|
1000 |
|
1001 | var $0 = $$.length - 1;
|
1002 | switch (yystate) {
|
1003 | case 1:
|
1004 |
|
1005 | break;
|
1006 | case 3:
|
1007 | this.$ = []
|
1008 | break;
|
1009 | case 4:
|
1010 | $$[$0-1].push($$[$0]);this.$ = $$[$0-1]
|
1011 | break;
|
1012 | case 5: case 6:
|
1013 | this.$ = $$[$0]
|
1014 | break;
|
1015 | case 7: case 8:
|
1016 | this.$=[];
|
1017 | break;
|
1018 | case 12:
|
1019 |
|
1020 | yy.addEntity($$[$0-4]);
|
1021 | yy.addEntity($$[$0-2]);
|
1022 | yy.addRelationship($$[$0-4], $$[$0], $$[$0-2], $$[$0-3]);
|
1023 |
|
1024 |
|
1025 | break;
|
1026 | case 13:
|
1027 |
|
1028 |
|
1029 | yy.addEntity($$[$0-3]);
|
1030 | yy.addAttributes($$[$0-3], $$[$0-1]);
|
1031 |
|
1032 |
|
1033 | break;
|
1034 | case 14:
|
1035 | yy.addEntity($$[$0-2]);
|
1036 | break;
|
1037 | case 15:
|
1038 | yy.addEntity($$[$0]);
|
1039 | break;
|
1040 | case 16:
|
1041 | this.$ = $$[$0];
|
1042 | break;
|
1043 | case 17:
|
1044 | this.$ = [$$[$0]];
|
1045 | break;
|
1046 | case 18:
|
1047 | $$[$0].push($$[$0-1]); this.$=$$[$0];
|
1048 | break;
|
1049 | case 19:
|
1050 | this.$ = { attributeType: $$[$0-1], attributeName: $$[$0] };
|
1051 | break;
|
1052 | case 20:
|
1053 | this.$ = { attributeType: $$[$0-2], attributeName: $$[$0-1], attributeKeyType: $$[$0] };
|
1054 | break;
|
1055 | case 21:
|
1056 | this.$ = { attributeType: $$[$0-2], attributeName: $$[$0-1], attributeComment: $$[$0] };
|
1057 | break;
|
1058 | case 22:
|
1059 | this.$ = { attributeType: $$[$0-3], attributeName: $$[$0-2], attributeKeyType: $$[$0-1], attributeComment: $$[$0] };
|
1060 | break;
|
1061 | case 23: case 24: case 25:
|
1062 | this.$=$$[$0];
|
1063 | break;
|
1064 | case 26:
|
1065 |
|
1066 | this.$ = { cardA: $$[$0], relType: $$[$0-1], cardB: $$[$0-2] };
|
1067 |
|
1068 |
|
1069 | break;
|
1070 | case 27:
|
1071 | this.$ = yy.Cardinality.ZERO_OR_ONE;
|
1072 | break;
|
1073 | case 28:
|
1074 | this.$ = yy.Cardinality.ZERO_OR_MORE;
|
1075 | break;
|
1076 | case 29:
|
1077 | this.$ = yy.Cardinality.ONE_OR_MORE;
|
1078 | break;
|
1079 | case 30:
|
1080 | this.$ = yy.Cardinality.ONLY_ONE;
|
1081 | break;
|
1082 | case 31:
|
1083 | this.$ = yy.Identification.NON_IDENTIFYING;
|
1084 | break;
|
1085 | case 32:
|
1086 | this.$ = yy.Identification.IDENTIFYING;
|
1087 | break;
|
1088 | case 33:
|
1089 | this.$ = $$[$0].replace(/"/g, '');
|
1090 | break;
|
1091 | case 34:
|
1092 | this.$ = $$[$0];
|
1093 | break;
|
1094 | case 35:
|
1095 | yy.parseDirective('%%{', 'open_directive');
|
1096 | break;
|
1097 | case 36:
|
1098 | yy.parseDirective($$[$0], 'type_directive');
|
1099 | break;
|
1100 | case 37:
|
1101 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
1102 | break;
|
1103 | case 38:
|
1104 | yy.parseDirective('}%%', 'close_directive', 'er');
|
1105 | break;
|
1106 | }
|
1107 | },
|
1108 | table: [{3:1,4:$V0,7:3,12:4,40:$V1},{1:[3]},o($V2,[2,3],{5:6}),{3:7,4:$V0,7:3,12:4,40:$V1},{13:8,41:[1,9]},{41:[2,35]},{6:[1,10],7:15,8:11,9:[1,12],10:13,11:[1,14],12:4,17:16,23:$V3,40:$V1},{1:[2,2]},{14:18,15:[1,19],43:$V4},o([15,43],[2,36]),o($V2,[2,8],{1:[2,1]}),o($V2,[2,4]),{7:15,10:21,12:4,17:16,23:$V3,40:$V1},o($V2,[2,6]),o($V2,[2,7]),o($V2,[2,11]),o($V2,[2,15],{18:22,31:24,20:[1,23],33:$V5,34:$V6,35:$V7,36:$V8}),o([6,9,11,15,20,23,33,34,35,36,40],[2,16]),{11:[1,29]},{16:30,42:[1,31]},{11:[2,38]},o($V2,[2,5]),{17:32,23:$V3},{21:33,22:[1,34],24:35,25:36,29:$V9},{32:38,37:[1,39],38:[1,40]},o($Va,[2,27]),o($Va,[2,28]),o($Va,[2,29]),o($Va,[2,30]),o($Vb,[2,9]),{14:41,43:$V4},{43:[2,37]},{15:[1,42]},{22:[1,43]},o($V2,[2,14]),{21:44,22:[2,17],24:35,25:36,29:$V9},{26:45,29:[1,46]},{29:[2,23]},{31:47,33:$V5,34:$V6,35:$V7,36:$V8},o($Vc,[2,31]),o($Vc,[2,32]),{11:[1,48]},{19:49,23:[1,51],39:[1,50]},o($V2,[2,13]),{22:[2,18]},o($Vd,[2,19],{27:52,28:[1,53],30:[1,54]}),o([22,28,29,30],[2,24]),{23:[2,26]},o($Vb,[2,10]),o($V2,[2,12]),o($V2,[2,33]),o($V2,[2,34]),o($Vd,[2,20],{28:[1,55]}),o($Vd,[2,21]),o([22,28,29],[2,25]),o($Vd,[2,22])],
|
1109 | defaultActions: {5:[2,35],7:[2,2],20:[2,38],31:[2,37],37:[2,23],44:[2,18],47:[2,26]},
|
1110 | parseError: function parseError (str, hash) {
|
1111 | if (hash.recoverable) {
|
1112 | this.trace(str);
|
1113 | } else {
|
1114 | var error = new Error(str);
|
1115 | error.hash = hash;
|
1116 | throw error;
|
1117 | }
|
1118 | },
|
1119 | parse: function parse(input) {
|
1120 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
1121 | var args = lstack.slice.call(arguments, 1);
|
1122 | var lexer = Object.create(this.lexer);
|
1123 | var sharedState = { yy: {} };
|
1124 | for (var k in this.yy) {
|
1125 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
1126 | sharedState.yy[k] = this.yy[k];
|
1127 | }
|
1128 | }
|
1129 | lexer.setInput(input, sharedState.yy);
|
1130 | sharedState.yy.lexer = lexer;
|
1131 | sharedState.yy.parser = this;
|
1132 | if (typeof lexer.yylloc == 'undefined') {
|
1133 | lexer.yylloc = {};
|
1134 | }
|
1135 | var yyloc = lexer.yylloc;
|
1136 | lstack.push(yyloc);
|
1137 | var ranges = lexer.options && lexer.options.ranges;
|
1138 | if (typeof sharedState.yy.parseError === 'function') {
|
1139 | this.parseError = sharedState.yy.parseError;
|
1140 | } else {
|
1141 | this.parseError = Object.getPrototypeOf(this).parseError;
|
1142 | }
|
1143 | function popStack(n) {
|
1144 | stack.length = stack.length - 2 * n;
|
1145 | vstack.length = vstack.length - n;
|
1146 | lstack.length = lstack.length - n;
|
1147 | }
|
1148 | function lex() {
|
1149 | var token;
|
1150 | token = tstack.pop() || lexer.lex() || EOF;
|
1151 | if (typeof token !== 'number') {
|
1152 | if (token instanceof Array) {
|
1153 | tstack = token;
|
1154 | token = tstack.pop();
|
1155 | }
|
1156 | token = self.symbols_[token] || token;
|
1157 | }
|
1158 | return token;
|
1159 | }
|
1160 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
1161 | while (true) {
|
1162 | state = stack[stack.length - 1];
|
1163 | if (this.defaultActions[state]) {
|
1164 | action = this.defaultActions[state];
|
1165 | } else {
|
1166 | if (symbol === null || typeof symbol == 'undefined') {
|
1167 | symbol = lex();
|
1168 | }
|
1169 | action = table[state] && table[state][symbol];
|
1170 | }
|
1171 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
1172 | var errStr = '';
|
1173 | expected = [];
|
1174 | for (p in table[state]) {
|
1175 | if (this.terminals_[p] && p > TERROR) {
|
1176 | expected.push('\'' + this.terminals_[p] + '\'');
|
1177 | }
|
1178 | }
|
1179 | if (lexer.showPosition) {
|
1180 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
1181 | } else {
|
1182 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
1183 | }
|
1184 | this.parseError(errStr, {
|
1185 | text: lexer.match,
|
1186 | token: this.terminals_[symbol] || symbol,
|
1187 | line: lexer.yylineno,
|
1188 | loc: yyloc,
|
1189 | expected: expected
|
1190 | });
|
1191 | }
|
1192 | if (action[0] instanceof Array && action.length > 1) {
|
1193 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
1194 | }
|
1195 | switch (action[0]) {
|
1196 | case 1:
|
1197 | stack.push(symbol);
|
1198 | vstack.push(lexer.yytext);
|
1199 | lstack.push(lexer.yylloc);
|
1200 | stack.push(action[1]);
|
1201 | symbol = null;
|
1202 | if (!preErrorSymbol) {
|
1203 | yyleng = lexer.yyleng;
|
1204 | yytext = lexer.yytext;
|
1205 | yylineno = lexer.yylineno;
|
1206 | yyloc = lexer.yylloc;
|
1207 | if (recovering > 0) {
|
1208 | recovering--;
|
1209 | }
|
1210 | } else {
|
1211 | symbol = preErrorSymbol;
|
1212 | preErrorSymbol = null;
|
1213 | }
|
1214 | break;
|
1215 | case 2:
|
1216 | len = this.productions_[action[1]][1];
|
1217 | yyval.$ = vstack[vstack.length - len];
|
1218 | yyval._$ = {
|
1219 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
1220 | last_line: lstack[lstack.length - 1].last_line,
|
1221 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
1222 | last_column: lstack[lstack.length - 1].last_column
|
1223 | };
|
1224 | if (ranges) {
|
1225 | yyval._$.range = [
|
1226 | lstack[lstack.length - (len || 1)].range[0],
|
1227 | lstack[lstack.length - 1].range[1]
|
1228 | ];
|
1229 | }
|
1230 | r = this.performAction.apply(yyval, [
|
1231 | yytext,
|
1232 | yyleng,
|
1233 | yylineno,
|
1234 | sharedState.yy,
|
1235 | action[1],
|
1236 | vstack,
|
1237 | lstack
|
1238 | ].concat(args));
|
1239 | if (typeof r !== 'undefined') {
|
1240 | return r;
|
1241 | }
|
1242 | if (len) {
|
1243 | stack = stack.slice(0, -1 * len * 2);
|
1244 | vstack = vstack.slice(0, -1 * len);
|
1245 | lstack = lstack.slice(0, -1 * len);
|
1246 | }
|
1247 | stack.push(this.productions_[action[1]][0]);
|
1248 | vstack.push(yyval.$);
|
1249 | lstack.push(yyval._$);
|
1250 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
1251 | stack.push(newState);
|
1252 | break;
|
1253 | case 3:
|
1254 | return true;
|
1255 | }
|
1256 | }
|
1257 | return true;
|
1258 | }};
|
1259 |
|
1260 |
|
1261 | var lexer = (function(){
|
1262 | var lexer = ({
|
1263 |
|
1264 | EOF:1,
|
1265 |
|
1266 | parseError:function parseError(str, hash) {
|
1267 | if (this.yy.parser) {
|
1268 | this.yy.parser.parseError(str, hash);
|
1269 | } else {
|
1270 | throw new Error(str);
|
1271 | }
|
1272 | },
|
1273 |
|
1274 |
|
1275 | setInput:function (input, yy) {
|
1276 | this.yy = yy || this.yy || {};
|
1277 | this._input = input;
|
1278 | this._more = this._backtrack = this.done = false;
|
1279 | this.yylineno = this.yyleng = 0;
|
1280 | this.yytext = this.matched = this.match = '';
|
1281 | this.conditionStack = ['INITIAL'];
|
1282 | this.yylloc = {
|
1283 | first_line: 1,
|
1284 | first_column: 0,
|
1285 | last_line: 1,
|
1286 | last_column: 0
|
1287 | };
|
1288 | if (this.options.ranges) {
|
1289 | this.yylloc.range = [0,0];
|
1290 | }
|
1291 | this.offset = 0;
|
1292 | return this;
|
1293 | },
|
1294 |
|
1295 |
|
1296 | input:function () {
|
1297 | var ch = this._input[0];
|
1298 | this.yytext += ch;
|
1299 | this.yyleng++;
|
1300 | this.offset++;
|
1301 | this.match += ch;
|
1302 | this.matched += ch;
|
1303 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
1304 | if (lines) {
|
1305 | this.yylineno++;
|
1306 | this.yylloc.last_line++;
|
1307 | } else {
|
1308 | this.yylloc.last_column++;
|
1309 | }
|
1310 | if (this.options.ranges) {
|
1311 | this.yylloc.range[1]++;
|
1312 | }
|
1313 |
|
1314 | this._input = this._input.slice(1);
|
1315 | return ch;
|
1316 | },
|
1317 |
|
1318 |
|
1319 | unput:function (ch) {
|
1320 | var len = ch.length;
|
1321 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
1322 |
|
1323 | this._input = ch + this._input;
|
1324 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
1325 |
|
1326 | this.offset -= len;
|
1327 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
1328 | this.match = this.match.substr(0, this.match.length - 1);
|
1329 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
1330 |
|
1331 | if (lines.length - 1) {
|
1332 | this.yylineno -= lines.length - 1;
|
1333 | }
|
1334 | var r = this.yylloc.range;
|
1335 |
|
1336 | this.yylloc = {
|
1337 | first_line: this.yylloc.first_line,
|
1338 | last_line: this.yylineno + 1,
|
1339 | first_column: this.yylloc.first_column,
|
1340 | last_column: lines ?
|
1341 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
1342 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
1343 | this.yylloc.first_column - len
|
1344 | };
|
1345 |
|
1346 | if (this.options.ranges) {
|
1347 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
1348 | }
|
1349 | this.yyleng = this.yytext.length;
|
1350 | return this;
|
1351 | },
|
1352 |
|
1353 |
|
1354 | more:function () {
|
1355 | this._more = true;
|
1356 | return this;
|
1357 | },
|
1358 |
|
1359 |
|
1360 | reject:function () {
|
1361 | if (this.options.backtrack_lexer) {
|
1362 | this._backtrack = true;
|
1363 | } else {
|
1364 | 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(), {
|
1365 | text: "",
|
1366 | token: null,
|
1367 | line: this.yylineno
|
1368 | });
|
1369 |
|
1370 | }
|
1371 | return this;
|
1372 | },
|
1373 |
|
1374 |
|
1375 | less:function (n) {
|
1376 | this.unput(this.match.slice(n));
|
1377 | },
|
1378 |
|
1379 |
|
1380 | pastInput:function () {
|
1381 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
1382 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
1383 | },
|
1384 |
|
1385 |
|
1386 | upcomingInput:function () {
|
1387 | var next = this.match;
|
1388 | if (next.length < 20) {
|
1389 | next += this._input.substr(0, 20-next.length);
|
1390 | }
|
1391 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
1392 | },
|
1393 |
|
1394 |
|
1395 | showPosition:function () {
|
1396 | var pre = this.pastInput();
|
1397 | var c = new Array(pre.length + 1).join("-");
|
1398 | return pre + this.upcomingInput() + "\n" + c + "^";
|
1399 | },
|
1400 |
|
1401 |
|
1402 | test_match:function(match, indexed_rule) {
|
1403 | var token,
|
1404 | lines,
|
1405 | backup;
|
1406 |
|
1407 | if (this.options.backtrack_lexer) {
|
1408 |
|
1409 | backup = {
|
1410 | yylineno: this.yylineno,
|
1411 | yylloc: {
|
1412 | first_line: this.yylloc.first_line,
|
1413 | last_line: this.last_line,
|
1414 | first_column: this.yylloc.first_column,
|
1415 | last_column: this.yylloc.last_column
|
1416 | },
|
1417 | yytext: this.yytext,
|
1418 | match: this.match,
|
1419 | matches: this.matches,
|
1420 | matched: this.matched,
|
1421 | yyleng: this.yyleng,
|
1422 | offset: this.offset,
|
1423 | _more: this._more,
|
1424 | _input: this._input,
|
1425 | yy: this.yy,
|
1426 | conditionStack: this.conditionStack.slice(0),
|
1427 | done: this.done
|
1428 | };
|
1429 | if (this.options.ranges) {
|
1430 | backup.yylloc.range = this.yylloc.range.slice(0);
|
1431 | }
|
1432 | }
|
1433 |
|
1434 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
1435 | if (lines) {
|
1436 | this.yylineno += lines.length;
|
1437 | }
|
1438 | this.yylloc = {
|
1439 | first_line: this.yylloc.last_line,
|
1440 | last_line: this.yylineno + 1,
|
1441 | first_column: this.yylloc.last_column,
|
1442 | last_column: lines ?
|
1443 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
1444 | this.yylloc.last_column + match[0].length
|
1445 | };
|
1446 | this.yytext += match[0];
|
1447 | this.match += match[0];
|
1448 | this.matches = match;
|
1449 | this.yyleng = this.yytext.length;
|
1450 | if (this.options.ranges) {
|
1451 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
1452 | }
|
1453 | this._more = false;
|
1454 | this._backtrack = false;
|
1455 | this._input = this._input.slice(match[0].length);
|
1456 | this.matched += match[0];
|
1457 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
1458 | if (this.done && this._input) {
|
1459 | this.done = false;
|
1460 | }
|
1461 | if (token) {
|
1462 | return token;
|
1463 | } else if (this._backtrack) {
|
1464 |
|
1465 | for (var k in backup) {
|
1466 | this[k] = backup[k];
|
1467 | }
|
1468 | return false;
|
1469 | }
|
1470 | return false;
|
1471 | },
|
1472 |
|
1473 |
|
1474 | next:function () {
|
1475 | if (this.done) {
|
1476 | return this.EOF;
|
1477 | }
|
1478 | if (!this._input) {
|
1479 | this.done = true;
|
1480 | }
|
1481 |
|
1482 | var token,
|
1483 | match,
|
1484 | tempMatch,
|
1485 | index;
|
1486 | if (!this._more) {
|
1487 | this.yytext = '';
|
1488 | this.match = '';
|
1489 | }
|
1490 | var rules = this._currentRules();
|
1491 | for (var i = 0; i < rules.length; i++) {
|
1492 | tempMatch = this._input.match(this.rules[rules[i]]);
|
1493 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
1494 | match = tempMatch;
|
1495 | index = i;
|
1496 | if (this.options.backtrack_lexer) {
|
1497 | token = this.test_match(tempMatch, rules[i]);
|
1498 | if (token !== false) {
|
1499 | return token;
|
1500 | } else if (this._backtrack) {
|
1501 | match = false;
|
1502 | continue;
|
1503 | } else {
|
1504 |
|
1505 | return false;
|
1506 | }
|
1507 | } else if (!this.options.flex) {
|
1508 | break;
|
1509 | }
|
1510 | }
|
1511 | }
|
1512 | if (match) {
|
1513 | token = this.test_match(match, rules[index]);
|
1514 | if (token !== false) {
|
1515 | return token;
|
1516 | }
|
1517 |
|
1518 | return false;
|
1519 | }
|
1520 | if (this._input === "") {
|
1521 | return this.EOF;
|
1522 | } else {
|
1523 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
1524 | text: "",
|
1525 | token: null,
|
1526 | line: this.yylineno
|
1527 | });
|
1528 | }
|
1529 | },
|
1530 |
|
1531 |
|
1532 | lex:function lex () {
|
1533 | var r = this.next();
|
1534 | if (r) {
|
1535 | return r;
|
1536 | } else {
|
1537 | return this.lex();
|
1538 | }
|
1539 | },
|
1540 |
|
1541 |
|
1542 | begin:function begin (condition) {
|
1543 | this.conditionStack.push(condition);
|
1544 | },
|
1545 |
|
1546 |
|
1547 | popState:function popState () {
|
1548 | var n = this.conditionStack.length - 1;
|
1549 | if (n > 0) {
|
1550 | return this.conditionStack.pop();
|
1551 | } else {
|
1552 | return this.conditionStack[0];
|
1553 | }
|
1554 | },
|
1555 |
|
1556 |
|
1557 | _currentRules:function _currentRules () {
|
1558 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
1559 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
1560 | } else {
|
1561 | return this.conditions["INITIAL"].rules;
|
1562 | }
|
1563 | },
|
1564 |
|
1565 |
|
1566 | topState:function topState (n) {
|
1567 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
1568 | if (n >= 0) {
|
1569 | return this.conditionStack[n];
|
1570 | } else {
|
1571 | return "INITIAL";
|
1572 | }
|
1573 | },
|
1574 |
|
1575 |
|
1576 | pushState:function pushState (condition) {
|
1577 | this.begin(condition);
|
1578 | },
|
1579 |
|
1580 |
|
1581 | stateStackSize:function stateStackSize() {
|
1582 | return this.conditionStack.length;
|
1583 | },
|
1584 | options: {"case-insensitive":true},
|
1585 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
1586 | var YYSTATE=YY_START;
|
1587 | switch($avoiding_name_collisions) {
|
1588 | case 0: this.begin('open_directive'); return 40;
|
1589 | break;
|
1590 | case 1: this.begin('type_directive'); return 41;
|
1591 | break;
|
1592 | case 2: this.popState(); this.begin('arg_directive'); return 15;
|
1593 | break;
|
1594 | case 3: this.popState(); this.popState(); return 43;
|
1595 | break;
|
1596 | case 4:return 42;
|
1597 | break;
|
1598 | case 5:
|
1599 | break;
|
1600 | case 6:
|
1601 | break;
|
1602 | case 7:return 11;
|
1603 | break;
|
1604 | case 8:
|
1605 | break;
|
1606 | case 9:return 9;
|
1607 | break;
|
1608 | case 10:return 39;
|
1609 | break;
|
1610 | case 11:return 4;
|
1611 | break;
|
1612 | case 12: this.begin("block"); return 20;
|
1613 | break;
|
1614 | case 13:
|
1615 | break;
|
1616 | case 14:return 30
|
1617 | break;
|
1618 | case 15:return 29
|
1619 | break;
|
1620 | case 16:return 28;
|
1621 | break;
|
1622 | case 17:
|
1623 | break;
|
1624 | case 18: this.popState(); return 22;
|
1625 | break;
|
1626 | case 19:return yy_.yytext[0];
|
1627 | break;
|
1628 | case 20:return 33;
|
1629 | break;
|
1630 | case 21:return 34;
|
1631 | break;
|
1632 | case 22:return 35;
|
1633 | break;
|
1634 | case 23:return 36;
|
1635 | break;
|
1636 | case 24:return 33;
|
1637 | break;
|
1638 | case 25:return 34;
|
1639 | break;
|
1640 | case 26:return 35;
|
1641 | break;
|
1642 | case 27:return 37;
|
1643 | break;
|
1644 | case 28:return 38;
|
1645 | break;
|
1646 | case 29:return 37;
|
1647 | break;
|
1648 | case 30:return 37;
|
1649 | break;
|
1650 | case 31:return 23;
|
1651 | break;
|
1652 | case 32:return yy_.yytext[0];
|
1653 | break;
|
1654 | case 33:return 6;
|
1655 | break;
|
1656 | }
|
1657 | },
|
1658 | rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:\s+)/i,/^(?:(?:PK)|(?:FK))/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],
|
1659 | conditions: {"open_directive":{"rules":[1],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"block":{"rules":[13,14,15,16,17,18,19],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,11,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33],"inclusive":true}}
|
1660 | });
|
1661 | return lexer;
|
1662 | })();
|
1663 | parser.lexer = lexer;
|
1664 | function Parser () {
|
1665 | this.yy = {};
|
1666 | }
|
1667 | Parser.prototype = parser;parser.Parser = Parser;
|
1668 | return new Parser;
|
1669 | })();
|
1670 |
|
1671 |
|
1672 | if (true) {
|
1673 | exports.parser = parser;
|
1674 | exports.Parser = parser.Parser;
|
1675 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
1676 | exports.main = function commonjsMain (args) {
|
1677 | if (!args[1]) {
|
1678 | console.log('Usage: '+args[0]+' FILE');
|
1679 | process.exit(1);
|
1680 | }
|
1681 | var source = __webpack_require__( "?3c87").readFileSync(__webpack_require__( "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
|
1682 | return exports.parser.parse(source);
|
1683 | };
|
1684 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
1685 | exports.main(process.argv.slice(1));
|
1686 | }
|
1687 | }
|
1688 |
|
1689 | }),
|
1690 |
|
1691 | "./src/diagrams/flowchart/parser/flow.jison":
|
1692 |
|
1693 |
|
1694 |
|
1695 | ((module, exports, __webpack_require__) => {
|
1696 |
|
1697 | module = __webpack_require__.nmd(module);
|
1698 |
|
1699 |
|
1700 |
|
1701 |
|
1702 |
|
1703 |
|
1704 |
|
1705 |
|
1706 |
|
1707 |
|
1708 |
|
1709 |
|
1710 |
|
1711 |
|
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 |
|
1717 |
|
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 |
|
1727 |
|
1728 |
|
1729 |
|
1730 |
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 |
|
1740 |
|
1741 |
|
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 | var parser = (function(){
|
1772 | 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,47,76,77,78,79,80,81,95,96,99,100,101,103,104,110,111,112,113,114,115,116,117,118,119],$V5=[2,10],$V6=[1,20],$V7=[1,21],$V8=[1,22],$V9=[1,23],$Va=[1,30],$Vb=[1,59],$Vc=[1,33],$Vd=[1,34],$Ve=[1,35],$Vf=[1,36],$Vg=[1,37],$Vh=[1,53],$Vi=[1,48],$Vj=[1,50],$Vk=[1,45],$Vl=[1,49],$Vm=[1,52],$Vn=[1,56],$Vo=[1,57],$Vp=[1,38],$Vq=[1,39],$Vr=[1,40],$Vs=[1,41],$Vt=[1,58],$Vu=[1,47],$Vv=[1,51],$Vw=[1,54],$Vx=[1,55],$Vy=[1,46],$Vz=[1,62],$VA=[1,67],$VB=[1,20,21,22,23,38,42,47,76,77,78,79,80,81,95,96,99,100,101,103,104,110,111,112,113,114,115,116,117,118,119],$VC=[1,71],$VD=[1,70],$VE=[1,72],$VF=[20,21,23,70,71],$VG=[1,93],$VH=[1,98],$VI=[1,95],$VJ=[1,100],$VK=[1,103],$VL=[1,101],$VM=[1,102],$VN=[1,96],$VO=[1,108],$VP=[1,107],$VQ=[1,97],$VR=[1,99],$VS=[1,104],$VT=[1,105],$VU=[1,106],$VV=[1,109],$VW=[20,21,22,23,70,71],$VX=[20,21,22,23,48,70,71],$VY=[20,21,22,23,40,47,48,50,52,54,56,58,60,62,63,65,70,71,81,95,96,99,100,101,103,104,114,115,116,117,118,119],$VZ=[20,21,23],$V_=[20,21,23,47,70,71,81,95,96,99,100,101,103,104,114,115,116,117,118,119],$V$=[1,12,20,21,22,23,24,38,42,47,76,77,78,79,80,81,95,96,99,100,101,103,104,110,111,112,113,114,115,116,117,118,119],$V01=[47,81,95,96,99,100,101,103,104,114,115,116,117,118,119],$V11=[1,141],$V21=[1,149],$V31=[1,150],$V41=[1,151],$V51=[1,152],$V61=[1,136],$V71=[1,137],$V81=[1,133],$V91=[1,144],$Va1=[1,145],$Vb1=[1,146],$Vc1=[1,147],$Vd1=[1,148],$Ve1=[1,153],$Vf1=[1,154],$Vg1=[1,139],$Vh1=[1,142],$Vi1=[1,138],$Vj1=[1,135],$Vk1=[20,21,22,23,38,42,47,76,77,78,79,80,81,95,96,99,100,101,103,104,110,111,112,113,114,115,116,117,118,119],$Vl1=[1,157],$Vm1=[20,21,22,23,26,47,81,95,96,99,100,101,103,104,114,115,116,117,118,119],$Vn1=[20,21,22,23,24,26,38,40,41,42,47,51,53,55,57,59,61,62,64,66,70,71,72,76,77,78,79,80,81,82,85,95,96,99,100,101,103,104,105,106,114,115,116,117,118,119],$Vo1=[12,21,22,24],$Vp1=[22,96],$Vq1=[1,238],$Vr1=[1,242],$Vs1=[1,239],$Vt1=[1,236],$Vu1=[1,233],$Vv1=[1,234],$Vw1=[1,235],$Vx1=[1,237],$Vy1=[1,240],$Vz1=[1,241],$VA1=[1,243],$VB1=[1,260],$VC1=[20,21,23,96],$VD1=[20,21,22,23,76,92,95,96,99,100,101,102,103,104,105];
|
1773 | var parser = {trace: function trace () { },
|
1774 | yy: {},
|
1775 | 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,"link":44,"node":45,"vertex":46,"AMP":47,"STYLE_SEPARATOR":48,"idString":49,"PS":50,"PE":51,"(-":52,"-)":53,"STADIUMSTART":54,"STADIUMEND":55,"SUBROUTINESTART":56,"SUBROUTINEEND":57,"CYLINDERSTART":58,"CYLINDEREND":59,"DIAMOND_START":60,"DIAMOND_STOP":61,"TAGEND":62,"TRAPSTART":63,"TRAPEND":64,"INVTRAPSTART":65,"INVTRAPEND":66,"linkStatement":67,"arrowText":68,"TESTSTR":69,"START_LINK":70,"LINK":71,"PIPE":72,"textToken":73,"STR":74,"keywords":75,"STYLE":76,"LINKSTYLE":77,"CLASSDEF":78,"CLASS":79,"CLICK":80,"DOWN":81,"UP":82,"textNoTags":83,"textNoTagsToken":84,"DEFAULT":85,"stylesOpt":86,"alphaNum":87,"CALLBACKNAME":88,"CALLBACKARGS":89,"HREF":90,"LINK_TARGET":91,"HEX":92,"numList":93,"INTERPOLATE":94,"NUM":95,"COMMA":96,"style":97,"styleComponent":98,"ALPHA":99,"COLON":100,"MINUS":101,"UNIT":102,"BRKT":103,"DOT":104,"PCT":105,"TAGSTART":106,"alphaNumToken":107,"idStringToken":108,"alphaNumStatement":109,"direction_tb":110,"direction_bt":111,"direction_rl":112,"direction_lr":113,"PUNCTUATION":114,"UNICODE_TEXT":115,"PLUS":116,"EQUALS":117,"MULT":118,"UNDERSCORE":119,"graphCodeTokens":120,"ARROW_CROSS":121,"ARROW_POINT":122,"ARROW_CIRCLE":123,"ARROW_OPEN":124,"QUOTE":125,"$accept":0,"$end":1},
|
1776 | 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",47:"AMP",48:"STYLE_SEPARATOR",50:"PS",51:"PE",52:"(-",53:"-)",54:"STADIUMSTART",55:"STADIUMEND",56:"SUBROUTINESTART",57:"SUBROUTINEEND",58:"CYLINDERSTART",59:"CYLINDEREND",60:"DIAMOND_START",61:"DIAMOND_STOP",62:"TAGEND",63:"TRAPSTART",64:"TRAPEND",65:"INVTRAPSTART",66:"INVTRAPEND",69:"TESTSTR",70:"START_LINK",71:"LINK",72:"PIPE",74:"STR",76:"STYLE",77:"LINKSTYLE",78:"CLASSDEF",79:"CLASS",80:"CLICK",81:"DOWN",82:"UP",85:"DEFAULT",88:"CALLBACKNAME",89:"CALLBACKARGS",90:"HREF",91:"LINK_TARGET",92:"HEX",94:"INTERPOLATE",95:"NUM",96:"COMMA",99:"ALPHA",100:"COLON",101:"MINUS",102:"UNIT",103:"BRKT",104:"DOT",105:"PCT",106:"TAGSTART",110:"direction_tb",111:"direction_bt",112:"direction_rl",113:"direction_lr",114:"PUNCTUATION",115:"UNICODE_TEXT",116:"PLUS",117:"EQUALS",118:"MULT",119:"UNDERSCORE",121:"ARROW_CROSS",122:"ARROW_POINT",123:"ARROW_CIRCLE",124:"ARROW_OPEN",125:"QUOTE"},
|
1777 | 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],[9,1],[9,1],[9,1],[32,3],[32,4],[32,2],[32,1],[45,1],[45,5],[45,3],[46,4],[46,6],[46,4],[46,4],[46,4],[46,4],[46,4],[46,4],[46,6],[46,4],[46,4],[46,4],[46,4],[46,4],[46,1],[44,2],[44,3],[44,3],[44,1],[44,3],[67,1],[68,3],[39,1],[39,2],[39,1],[75,1],[75,1],[75,1],[75,1],[75,1],[75,1],[75,1],[75,1],[75,1],[75,1],[75,1],[83,1],[83,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],[93,1],[93,3],[86,1],[86,3],[97,1],[97,2],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[73,1],[73,1],[73,1],[73,1],[73,1],[73,1],[84,1],[84,1],[84,1],[84,1],[49,1],[49,2],[87,1],[87,2],[109,1],[109,1],[109,1],[109,1],[43,1],[43,1],[43,1],[43,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1]],
|
1778 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
1779 |
|
1780 |
|
1781 | var $0 = $$.length - 1;
|
1782 | switch (yystate) {
|
1783 | case 5:
|
1784 | yy.parseDirective('%%{', 'open_directive');
|
1785 | break;
|
1786 | case 6:
|
1787 | yy.parseDirective($$[$0], 'type_directive');
|
1788 | break;
|
1789 | case 7:
|
1790 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
1791 | break;
|
1792 | case 8:
|
1793 | yy.parseDirective('}%%', 'close_directive', 'flowchart');
|
1794 | break;
|
1795 | case 10:
|
1796 | this.$ = [];
|
1797 | break;
|
1798 | case 11:
|
1799 |
|
1800 | if($$[$0] !== []){
|
1801 | $$[$0-1].push($$[$0]);
|
1802 | }
|
1803 | this.$=$$[$0-1];
|
1804 | break;
|
1805 | case 12: case 77: case 79: case 91: case 147: case 149: case 150:
|
1806 | this.$=$$[$0];
|
1807 | break;
|
1808 | case 19:
|
1809 | yy.setDirection('TB');this.$ = 'TB';
|
1810 | break;
|
1811 | case 20:
|
1812 | yy.setDirection($$[$0-1]);this.$ = $$[$0-1];
|
1813 | break;
|
1814 | case 35:
|
1815 | this.$=$$[$0-1].nodes
|
1816 | break;
|
1817 | case 36: case 37: case 38: case 39: case 40:
|
1818 | this.$=[];
|
1819 | break;
|
1820 | case 41:
|
1821 | this.$=yy.addSubGraph($$[$0-6],$$[$0-1],$$[$0-4]);
|
1822 | break;
|
1823 | case 42:
|
1824 | this.$=yy.addSubGraph($$[$0-3],$$[$0-1],$$[$0-3]);
|
1825 | break;
|
1826 | case 43:
|
1827 | this.$=yy.addSubGraph(undefined,$$[$0-1],undefined);
|
1828 | break;
|
1829 | case 48:
|
1830 | yy.addLink($$[$0-2].stmt,$$[$0],$$[$0-1]); this.$ = { stmt: $$[$0], nodes: $$[$0].concat($$[$0-2].nodes) }
|
1831 | break;
|
1832 | case 49:
|
1833 | yy.addLink($$[$0-3].stmt,$$[$0-1],$$[$0-2]); this.$ = { stmt: $$[$0-1], nodes: $$[$0-1].concat($$[$0-3].nodes) }
|
1834 | break;
|
1835 | case 50:
|
1836 | this.$ = {stmt: $$[$0-1], nodes:$$[$0-1] }
|
1837 | break;
|
1838 | case 51:
|
1839 | this.$ = {stmt: $$[$0], nodes:$$[$0] }
|
1840 | break;
|
1841 | case 52:
|
1842 | this.$ = [$$[$0]];
|
1843 | break;
|
1844 | case 53:
|
1845 | this.$ = $$[$0-4].concat($$[$0]);
|
1846 | break;
|
1847 | case 54:
|
1848 | this.$ = [$$[$0-2]];yy.setClass($$[$0-2],$$[$0])
|
1849 | break;
|
1850 | case 55:
|
1851 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'square');
|
1852 | break;
|
1853 | case 56:
|
1854 | this.$ = $$[$0-5];yy.addVertex($$[$0-5],$$[$0-2],'circle');
|
1855 | break;
|
1856 | case 57:
|
1857 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'ellipse');
|
1858 | break;
|
1859 | case 58:
|
1860 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'stadium');
|
1861 | break;
|
1862 | case 59:
|
1863 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'subroutine');
|
1864 | break;
|
1865 | case 60:
|
1866 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'cylinder');
|
1867 | break;
|
1868 | case 61:
|
1869 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'round');
|
1870 | break;
|
1871 | case 62:
|
1872 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'diamond');
|
1873 | break;
|
1874 | case 63:
|
1875 | this.$ = $$[$0-5];yy.addVertex($$[$0-5],$$[$0-2],'hexagon');
|
1876 | break;
|
1877 | case 64:
|
1878 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'odd');
|
1879 | break;
|
1880 | case 65:
|
1881 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'trapezoid');
|
1882 | break;
|
1883 | case 66:
|
1884 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'inv_trapezoid');
|
1885 | break;
|
1886 | case 67:
|
1887 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'lean_right');
|
1888 | break;
|
1889 | case 68:
|
1890 | this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'lean_left');
|
1891 | break;
|
1892 | case 69:
|
1893 | this.$ = $$[$0];yy.addVertex($$[$0]);
|
1894 | break;
|
1895 | case 70:
|
1896 | $$[$0-1].text = $$[$0];this.$ = $$[$0-1];
|
1897 | break;
|
1898 | case 71: case 72:
|
1899 | $$[$0-2].text = $$[$0-1];this.$ = $$[$0-2];
|
1900 | break;
|
1901 | case 73:
|
1902 | this.$ = $$[$0];
|
1903 | break;
|
1904 | case 74:
|
1905 | var inf = yy.destructLink($$[$0], $$[$0-2]); this.$ = {"type":inf.type,"stroke":inf.stroke,"length":inf.length,"text":$$[$0-1]};
|
1906 | break;
|
1907 | case 75:
|
1908 | var inf = yy.destructLink($$[$0]);this.$ = {"type":inf.type,"stroke":inf.stroke,"length":inf.length};
|
1909 | break;
|
1910 | case 76:
|
1911 | this.$ = $$[$0-1];
|
1912 | break;
|
1913 | case 78: case 92: case 148:
|
1914 | this.$=$$[$0-1]+''+$$[$0];
|
1915 | break;
|
1916 | case 93: case 94:
|
1917 | this.$ = $$[$0-4];yy.addClass($$[$0-2],$$[$0]);
|
1918 | break;
|
1919 | case 95:
|
1920 | this.$ = $$[$0-4];yy.setClass($$[$0-2], $$[$0]);
|
1921 | break;
|
1922 | case 96: case 104:
|
1923 | this.$ = $$[$0-1];yy.setClickEvent($$[$0-1], $$[$0]);
|
1924 | break;
|
1925 | case 97: case 105:
|
1926 | this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-3], $$[$0]);
|
1927 | break;
|
1928 | case 98:
|
1929 | this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]);
|
1930 | break;
|
1931 | case 99:
|
1932 | this.$ = $$[$0-4];yy.setClickEvent($$[$0-4], $$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-4], $$[$0]);
|
1933 | break;
|
1934 | case 100: case 106:
|
1935 | this.$ = $$[$0-1];yy.setLink($$[$0-1], $$[$0]);
|
1936 | break;
|
1937 | case 101: case 107:
|
1938 | this.$ = $$[$0-3];yy.setLink($$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-3], $$[$0]);
|
1939 | break;
|
1940 | case 102: case 108:
|
1941 | this.$ = $$[$0-3];yy.setLink($$[$0-3], $$[$0-2], $$[$0]);
|
1942 | break;
|
1943 | case 103: case 109:
|
1944 | this.$ = $$[$0-5];yy.setLink($$[$0-5], $$[$0-4], $$[$0]);yy.setTooltip($$[$0-5], $$[$0-2]);
|
1945 | break;
|
1946 | case 110:
|
1947 | this.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]);
|
1948 | break;
|
1949 | case 111: case 113:
|
1950 | this.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]);
|
1951 | break;
|
1952 | case 112:
|
1953 | this.$ = $$[$0-4];yy.updateLink([$$[$0-2]],$$[$0]);
|
1954 | break;
|
1955 | case 114:
|
1956 | this.$ = $$[$0-8];yy.updateLinkInterpolate([$$[$0-6]],$$[$0-2]);yy.updateLink([$$[$0-6]],$$[$0]);
|
1957 | break;
|
1958 | case 115:
|
1959 | this.$ = $$[$0-8];yy.updateLinkInterpolate($$[$0-6],$$[$0-2]);yy.updateLink($$[$0-6],$$[$0]);
|
1960 | break;
|
1961 | case 116:
|
1962 | this.$ = $$[$0-6];yy.updateLinkInterpolate([$$[$0-4]],$$[$0]);
|
1963 | break;
|
1964 | case 117:
|
1965 | this.$ = $$[$0-6];yy.updateLinkInterpolate($$[$0-4],$$[$0]);
|
1966 | break;
|
1967 | case 118: case 120:
|
1968 | this.$ = [$$[$0]]
|
1969 | break;
|
1970 | case 119: case 121:
|
1971 | $$[$0-2].push($$[$0]);this.$ = $$[$0-2];
|
1972 | break;
|
1973 | case 123:
|
1974 | this.$ = $$[$0-1] + $$[$0];
|
1975 | break;
|
1976 | case 145:
|
1977 | this.$=$$[$0]
|
1978 | break;
|
1979 | case 146:
|
1980 | this.$=$$[$0-1]+''+$$[$0]
|
1981 | break;
|
1982 | case 151:
|
1983 | this.$='v';
|
1984 | break;
|
1985 | case 152:
|
1986 | this.$='-';
|
1987 | break;
|
1988 | case 153:
|
1989 | this.$={stmt:'dir', value:'TB'};
|
1990 | break;
|
1991 | case 154:
|
1992 | this.$={stmt:'dir', value:'BT'};
|
1993 | break;
|
1994 | case 155:
|
1995 | this.$={stmt:'dir', value:'RL'};
|
1996 | break;
|
1997 | case 156:
|
1998 | this.$={stmt:'dir', value:'LR'};
|
1999 | break;
|
2000 | }
|
2001 | },
|
2002 | 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,45:32,46:42,47:$Vb,49:43,76:$Vc,77:$Vd,78:$Ve,79:$Vf,80:$Vg,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,108:44,110:$Vp,111:$Vq,112:$Vr,113:$Vs,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy},{8:60,10:[1,61],15:$Vz},o([10,15],[2,6]),o($V4,[2,17]),o($V4,[2,18]),o($V4,[2,19]),{20:[1,64],21:[1,65],22:$VA,27:63,30:66},o($VB,[2,11]),o($VB,[2,12]),o($VB,[2,13]),o($VB,[2,14]),o($VB,[2,15]),o($VB,[2,16]),{9:68,20:$VC,21:$VD,23:$VE,44:69,67:73,70:[1,74],71:[1,75]},{9:76,20:$VC,21:$VD,23:$VE},{9:77,20:$VC,21:$VD,23:$VE},{9:78,20:$VC,21:$VD,23:$VE},{9:79,20:$VC,21:$VD,23:$VE},{9:80,20:$VC,21:$VD,23:$VE},{9:82,20:$VC,21:$VD,22:[1,81],23:$VE},o($VB,[2,44]),o($VF,[2,51],{30:83,22:$VA}),{22:[1,84]},{22:[1,85]},{22:[1,86]},{22:[1,87]},{26:$VG,47:$VH,74:[1,91],81:$VI,87:90,88:[1,88],90:[1,89],95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:92,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($VB,[2,153]),o($VB,[2,154]),o($VB,[2,155]),o($VB,[2,156]),o($VW,[2,52],{48:[1,110]}),o($VX,[2,69],{108:121,40:[1,111],47:$Vb,50:[1,112],52:[1,113],54:[1,114],56:[1,115],58:[1,116],60:[1,117],62:[1,118],63:[1,119],65:[1,120],81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy}),o($VY,[2,145]),o($VY,[2,170]),o($VY,[2,171]),o($VY,[2,172]),o($VY,[2,173]),o($VY,[2,174]),o($VY,[2,175]),o($VY,[2,176]),o($VY,[2,177]),o($VY,[2,178]),o($VY,[2,179]),o($VY,[2,180]),o($VY,[2,181]),o($VY,[2,182]),o($VY,[2,183]),o($VY,[2,184]),{9:122,20:$VC,21:$VD,23:$VE},{11:123,14:[1,124]},o($VZ,[2,8]),o($V4,[2,20]),o($V4,[2,26]),o($V4,[2,27]),{21:[1,125]},o($V_,[2,34],{30:126,22:$VA}),o($VB,[2,35]),{45:127,46:42,47:$Vb,49:43,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,108:44,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy},o($V$,[2,45]),o($V$,[2,46]),o($V$,[2,47]),o($V01,[2,73],{68:128,69:[1,129],72:[1,130]}),{22:$V11,24:$V21,26:$V31,38:$V41,39:131,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o([47,69,72,81,95,96,99,100,101,103,104,114,115,116,117,118,119],[2,75]),o($VB,[2,36]),o($VB,[2,37]),o($VB,[2,38]),o($VB,[2,39]),o($VB,[2,40]),{22:$V11,24:$V21,26:$V31,38:$V41,39:155,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($Vk1,$V5,{17:156}),o($VF,[2,50],{47:$Vl1}),{26:$VG,47:$VH,81:$VI,87:158,92:[1,159],95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:92,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{85:[1,160],93:161,95:[1,162]},{26:$VG,47:$VH,81:$VI,85:[1,163],87:164,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:92,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{26:$VG,47:$VH,81:$VI,87:165,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:92,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($VZ,[2,96],{22:[1,166],89:[1,167]}),o($VZ,[2,100],{22:[1,168]}),o($VZ,[2,104],{107:94,109:170,22:[1,169],26:$VG,47:$VH,81:$VI,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV}),o($VZ,[2,106],{22:[1,171]}),o($Vm1,[2,147]),o($Vm1,[2,149]),o($Vm1,[2,150]),o($Vm1,[2,151]),o($Vm1,[2,152]),o($Vn1,[2,157]),o($Vn1,[2,158]),o($Vn1,[2,159]),o($Vn1,[2,160]),o($Vn1,[2,161]),o($Vn1,[2,162]),o($Vn1,[2,163]),o($Vn1,[2,164]),o($Vn1,[2,165]),o($Vn1,[2,166]),o($Vn1,[2,167]),o($Vn1,[2,168]),o($Vn1,[2,169]),{47:$Vb,49:172,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,108:44,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy},{22:$V11,24:$V21,26:$V31,38:$V41,39:173,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:175,42:$V51,47:$VH,50:[1,174],62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:176,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:177,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:178,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:179,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:180,42:$V51,47:$VH,60:[1,181],62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:182,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:183,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:184,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($VY,[2,146]),o($Vo1,[2,3]),{8:185,15:$Vz},{15:[2,7]},o($V4,[2,28]),o($V_,[2,33]),o($VF,[2,48],{30:186,22:$VA}),o($V01,[2,70],{22:[1,187]}),{22:[1,188]},{22:$V11,24:$V21,26:$V31,38:$V41,39:189,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,62:$V61,70:$V71,71:[1,190],73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($Vn1,[2,77]),o($Vn1,[2,79]),o($Vn1,[2,135]),o($Vn1,[2,136]),o($Vn1,[2,137]),o($Vn1,[2,138]),o($Vn1,[2,139]),o($Vn1,[2,140]),o($Vn1,[2,141]),o($Vn1,[2,142]),o($Vn1,[2,143]),o($Vn1,[2,144]),o($Vn1,[2,80]),o($Vn1,[2,81]),o($Vn1,[2,82]),o($Vn1,[2,83]),o($Vn1,[2,84]),o($Vn1,[2,85]),o($Vn1,[2,86]),o($Vn1,[2,87]),o($Vn1,[2,88]),o($Vn1,[2,89]),o($Vn1,[2,90]),{9:193,20:$VC,21:$VD,22:$V11,23:$VE,24:$V21,26:$V31,38:$V41,40:[1,192],42:$V51,47:$VH,62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{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,194],43:31,45:32,46:42,47:$Vb,49:43,76:$Vc,77:$Vd,78:$Ve,79:$Vf,80:$Vg,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,108:44,110:$Vp,111:$Vq,112:$Vr,113:$Vs,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy},{22:$VA,30:195},{22:[1,196],26:$VG,47:$VH,81:$VI,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:170,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:[1,197]},{22:[1,198]},{22:[1,199],96:[1,200]},o($Vp1,[2,118]),{22:[1,201]},{22:[1,202],26:$VG,47:$VH,81:$VI,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:170,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:[1,203],26:$VG,47:$VH,81:$VI,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:170,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{74:[1,204]},o($VZ,[2,98],{22:[1,205]}),{74:[1,206],91:[1,207]},{74:[1,208]},o($Vm1,[2,148]),{74:[1,209],91:[1,210]},o($VW,[2,54],{108:121,47:$Vb,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy}),{22:$V11,24:$V21,26:$V31,38:$V41,41:[1,211],42:$V51,47:$VH,62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:212,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,51:[1,213],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,53:[1,214],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,55:[1,215],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,57:[1,216],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,59:[1,217],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,61:[1,218],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:219,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,41:[1,220],42:$V51,47:$VH,62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,62:$V61,64:[1,221],66:[1,222],70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,62:$V61,64:[1,224],66:[1,223],70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{9:225,20:$VC,21:$VD,23:$VE},o($VF,[2,49],{47:$Vl1}),o($V01,[2,72]),o($V01,[2,71]),{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,62:$V61,70:$V71,72:[1,226],73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($V01,[2,74]),o($Vn1,[2,78]),{22:$V11,24:$V21,26:$V31,38:$V41,39:227,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($Vk1,$V5,{17:228}),o($VB,[2,43]),{46:229,47:$Vb,49:43,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,108:44,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy},{22:$Vq1,76:$Vr1,86:230,92:$Vs1,95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},{22:$Vq1,76:$Vr1,86:244,92:$Vs1,95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},{22:$Vq1,76:$Vr1,86:245,92:$Vs1,94:[1,246],95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},{22:$Vq1,76:$Vr1,86:247,92:$Vs1,94:[1,248],95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},{95:[1,249]},{22:$Vq1,76:$Vr1,86:250,92:$Vs1,95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},{22:$Vq1,76:$Vr1,86:251,92:$Vs1,95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},{26:$VG,47:$VH,81:$VI,87:252,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:92,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($VZ,[2,97]),{74:[1,253]},o($VZ,[2,101],{22:[1,254]}),o($VZ,[2,102]),o($VZ,[2,105]),o($VZ,[2,107],{22:[1,255]}),o($VZ,[2,108]),o($VX,[2,55]),{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,51:[1,256],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($VX,[2,61]),o($VX,[2,57]),o($VX,[2,58]),o($VX,[2,59]),o($VX,[2,60]),o($VX,[2,62]),{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,61:[1,257],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($VX,[2,64]),o($VX,[2,65]),o($VX,[2,67]),o($VX,[2,66]),o($VX,[2,68]),o($Vo1,[2,4]),o([22,47,81,95,96,99,100,101,103,104,114,115,116,117,118,119],[2,76]),{22:$V11,24:$V21,26:$V31,38:$V41,41:[1,258],42:$V51,47:$VH,62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{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,259],43:31,45:32,46:42,47:$Vb,49:43,76:$Vc,77:$Vd,78:$Ve,79:$Vf,80:$Vg,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,108:44,110:$Vp,111:$Vq,112:$Vr,113:$Vs,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy},o($VW,[2,53]),o($VZ,[2,110],{96:$VB1}),o($VC1,[2,120],{98:261,22:$Vq1,76:$Vr1,92:$Vs1,95:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1}),o($VD1,[2,122]),o($VD1,[2,124]),o($VD1,[2,125]),o($VD1,[2,126]),o($VD1,[2,127]),o($VD1,[2,128]),o($VD1,[2,129]),o($VD1,[2,130]),o($VD1,[2,131]),o($VD1,[2,132]),o($VD1,[2,133]),o($VD1,[2,134]),o($VZ,[2,111],{96:$VB1}),o($VZ,[2,112],{96:$VB1}),{22:[1,262]},o($VZ,[2,113],{96:$VB1}),{22:[1,263]},o($Vp1,[2,119]),o($VZ,[2,93],{96:$VB1}),o($VZ,[2,94],{96:$VB1}),o($VZ,[2,95],{107:94,109:170,26:$VG,47:$VH,81:$VI,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV}),o($VZ,[2,99]),{91:[1,264]},{91:[1,265]},{51:[1,266]},{61:[1,267]},{9:268,20:$VC,21:$VD,23:$VE},o($VB,[2,42]),{22:$Vq1,76:$Vr1,92:$Vs1,95:$Vt1,97:269,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},o($VD1,[2,123]),{26:$VG,47:$VH,81:$VI,87:270,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:92,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{26:$VG,47:$VH,81:$VI,87:271,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:92,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($VZ,[2,103]),o($VZ,[2,109]),o($VX,[2,56]),o($VX,[2,63]),o($Vk1,$V5,{17:272}),o($VC1,[2,121],{98:261,22:$Vq1,76:$Vr1,92:$Vs1,95:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1}),o($VZ,[2,116],{107:94,109:170,22:[1,273],26:$VG,47:$VH,81:$VI,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV}),o($VZ,[2,117],{107:94,109:170,22:[1,274],26:$VG,47:$VH,81:$VI,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV}),{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,275],43:31,45:32,46:42,47:$Vb,49:43,76:$Vc,77:$Vd,78:$Ve,79:$Vf,80:$Vg,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,108:44,110:$Vp,111:$Vq,112:$Vr,113:$Vs,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy},{22:$Vq1,76:$Vr1,86:276,92:$Vs1,95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},{22:$Vq1,76:$Vr1,86:277,92:$Vs1,95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},o($VB,[2,41]),o($VZ,[2,114],{96:$VB1}),o($VZ,[2,115],{96:$VB1})],
|
2003 | defaultActions: {2:[2,1],9:[2,5],10:[2,2],124:[2,7]},
|
2004 | parseError: function parseError (str, hash) {
|
2005 | if (hash.recoverable) {
|
2006 | this.trace(str);
|
2007 | } else {
|
2008 | var error = new Error(str);
|
2009 | error.hash = hash;
|
2010 | throw error;
|
2011 | }
|
2012 | },
|
2013 | parse: function parse(input) {
|
2014 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
2015 | var args = lstack.slice.call(arguments, 1);
|
2016 | var lexer = Object.create(this.lexer);
|
2017 | var sharedState = { yy: {} };
|
2018 | for (var k in this.yy) {
|
2019 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
2020 | sharedState.yy[k] = this.yy[k];
|
2021 | }
|
2022 | }
|
2023 | lexer.setInput(input, sharedState.yy);
|
2024 | sharedState.yy.lexer = lexer;
|
2025 | sharedState.yy.parser = this;
|
2026 | if (typeof lexer.yylloc == 'undefined') {
|
2027 | lexer.yylloc = {};
|
2028 | }
|
2029 | var yyloc = lexer.yylloc;
|
2030 | lstack.push(yyloc);
|
2031 | var ranges = lexer.options && lexer.options.ranges;
|
2032 | if (typeof sharedState.yy.parseError === 'function') {
|
2033 | this.parseError = sharedState.yy.parseError;
|
2034 | } else {
|
2035 | this.parseError = Object.getPrototypeOf(this).parseError;
|
2036 | }
|
2037 | function popStack(n) {
|
2038 | stack.length = stack.length - 2 * n;
|
2039 | vstack.length = vstack.length - n;
|
2040 | lstack.length = lstack.length - n;
|
2041 | }
|
2042 | function lex() {
|
2043 | var token;
|
2044 | token = tstack.pop() || lexer.lex() || EOF;
|
2045 | if (typeof token !== 'number') {
|
2046 | if (token instanceof Array) {
|
2047 | tstack = token;
|
2048 | token = tstack.pop();
|
2049 | }
|
2050 | token = self.symbols_[token] || token;
|
2051 | }
|
2052 | return token;
|
2053 | }
|
2054 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
2055 | while (true) {
|
2056 | state = stack[stack.length - 1];
|
2057 | if (this.defaultActions[state]) {
|
2058 | action = this.defaultActions[state];
|
2059 | } else {
|
2060 | if (symbol === null || typeof symbol == 'undefined') {
|
2061 | symbol = lex();
|
2062 | }
|
2063 | action = table[state] && table[state][symbol];
|
2064 | }
|
2065 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
2066 | var errStr = '';
|
2067 | expected = [];
|
2068 | for (p in table[state]) {
|
2069 | if (this.terminals_[p] && p > TERROR) {
|
2070 | expected.push('\'' + this.terminals_[p] + '\'');
|
2071 | }
|
2072 | }
|
2073 | if (lexer.showPosition) {
|
2074 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
2075 | } else {
|
2076 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
2077 | }
|
2078 | this.parseError(errStr, {
|
2079 | text: lexer.match,
|
2080 | token: this.terminals_[symbol] || symbol,
|
2081 | line: lexer.yylineno,
|
2082 | loc: yyloc,
|
2083 | expected: expected
|
2084 | });
|
2085 | }
|
2086 | if (action[0] instanceof Array && action.length > 1) {
|
2087 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
2088 | }
|
2089 | switch (action[0]) {
|
2090 | case 1:
|
2091 | stack.push(symbol);
|
2092 | vstack.push(lexer.yytext);
|
2093 | lstack.push(lexer.yylloc);
|
2094 | stack.push(action[1]);
|
2095 | symbol = null;
|
2096 | if (!preErrorSymbol) {
|
2097 | yyleng = lexer.yyleng;
|
2098 | yytext = lexer.yytext;
|
2099 | yylineno = lexer.yylineno;
|
2100 | yyloc = lexer.yylloc;
|
2101 | if (recovering > 0) {
|
2102 | recovering--;
|
2103 | }
|
2104 | } else {
|
2105 | symbol = preErrorSymbol;
|
2106 | preErrorSymbol = null;
|
2107 | }
|
2108 | break;
|
2109 | case 2:
|
2110 | len = this.productions_[action[1]][1];
|
2111 | yyval.$ = vstack[vstack.length - len];
|
2112 | yyval._$ = {
|
2113 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
2114 | last_line: lstack[lstack.length - 1].last_line,
|
2115 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
2116 | last_column: lstack[lstack.length - 1].last_column
|
2117 | };
|
2118 | if (ranges) {
|
2119 | yyval._$.range = [
|
2120 | lstack[lstack.length - (len || 1)].range[0],
|
2121 | lstack[lstack.length - 1].range[1]
|
2122 | ];
|
2123 | }
|
2124 | r = this.performAction.apply(yyval, [
|
2125 | yytext,
|
2126 | yyleng,
|
2127 | yylineno,
|
2128 | sharedState.yy,
|
2129 | action[1],
|
2130 | vstack,
|
2131 | lstack
|
2132 | ].concat(args));
|
2133 | if (typeof r !== 'undefined') {
|
2134 | return r;
|
2135 | }
|
2136 | if (len) {
|
2137 | stack = stack.slice(0, -1 * len * 2);
|
2138 | vstack = vstack.slice(0, -1 * len);
|
2139 | lstack = lstack.slice(0, -1 * len);
|
2140 | }
|
2141 | stack.push(this.productions_[action[1]][0]);
|
2142 | vstack.push(yyval.$);
|
2143 | lstack.push(yyval._$);
|
2144 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
2145 | stack.push(newState);
|
2146 | break;
|
2147 | case 3:
|
2148 | return true;
|
2149 | }
|
2150 | }
|
2151 | return true;
|
2152 | }};
|
2153 |
|
2154 |
|
2155 | var lexer = (function(){
|
2156 | var lexer = ({
|
2157 |
|
2158 | EOF:1,
|
2159 |
|
2160 | parseError:function parseError(str, hash) {
|
2161 | if (this.yy.parser) {
|
2162 | this.yy.parser.parseError(str, hash);
|
2163 | } else {
|
2164 | throw new Error(str);
|
2165 | }
|
2166 | },
|
2167 |
|
2168 |
|
2169 | setInput:function (input, yy) {
|
2170 | this.yy = yy || this.yy || {};
|
2171 | this._input = input;
|
2172 | this._more = this._backtrack = this.done = false;
|
2173 | this.yylineno = this.yyleng = 0;
|
2174 | this.yytext = this.matched = this.match = '';
|
2175 | this.conditionStack = ['INITIAL'];
|
2176 | this.yylloc = {
|
2177 | first_line: 1,
|
2178 | first_column: 0,
|
2179 | last_line: 1,
|
2180 | last_column: 0
|
2181 | };
|
2182 | if (this.options.ranges) {
|
2183 | this.yylloc.range = [0,0];
|
2184 | }
|
2185 | this.offset = 0;
|
2186 | return this;
|
2187 | },
|
2188 |
|
2189 |
|
2190 | input:function () {
|
2191 | var ch = this._input[0];
|
2192 | this.yytext += ch;
|
2193 | this.yyleng++;
|
2194 | this.offset++;
|
2195 | this.match += ch;
|
2196 | this.matched += ch;
|
2197 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
2198 | if (lines) {
|
2199 | this.yylineno++;
|
2200 | this.yylloc.last_line++;
|
2201 | } else {
|
2202 | this.yylloc.last_column++;
|
2203 | }
|
2204 | if (this.options.ranges) {
|
2205 | this.yylloc.range[1]++;
|
2206 | }
|
2207 |
|
2208 | this._input = this._input.slice(1);
|
2209 | return ch;
|
2210 | },
|
2211 |
|
2212 |
|
2213 | unput:function (ch) {
|
2214 | var len = ch.length;
|
2215 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
2216 |
|
2217 | this._input = ch + this._input;
|
2218 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
2219 |
|
2220 | this.offset -= len;
|
2221 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
2222 | this.match = this.match.substr(0, this.match.length - 1);
|
2223 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
2224 |
|
2225 | if (lines.length - 1) {
|
2226 | this.yylineno -= lines.length - 1;
|
2227 | }
|
2228 | var r = this.yylloc.range;
|
2229 |
|
2230 | this.yylloc = {
|
2231 | first_line: this.yylloc.first_line,
|
2232 | last_line: this.yylineno + 1,
|
2233 | first_column: this.yylloc.first_column,
|
2234 | last_column: lines ?
|
2235 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
2236 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
2237 | this.yylloc.first_column - len
|
2238 | };
|
2239 |
|
2240 | if (this.options.ranges) {
|
2241 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
2242 | }
|
2243 | this.yyleng = this.yytext.length;
|
2244 | return this;
|
2245 | },
|
2246 |
|
2247 |
|
2248 | more:function () {
|
2249 | this._more = true;
|
2250 | return this;
|
2251 | },
|
2252 |
|
2253 |
|
2254 | reject:function () {
|
2255 | if (this.options.backtrack_lexer) {
|
2256 | this._backtrack = true;
|
2257 | } else {
|
2258 | 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(), {
|
2259 | text: "",
|
2260 | token: null,
|
2261 | line: this.yylineno
|
2262 | });
|
2263 |
|
2264 | }
|
2265 | return this;
|
2266 | },
|
2267 |
|
2268 |
|
2269 | less:function (n) {
|
2270 | this.unput(this.match.slice(n));
|
2271 | },
|
2272 |
|
2273 |
|
2274 | pastInput:function () {
|
2275 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
2276 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
2277 | },
|
2278 |
|
2279 |
|
2280 | upcomingInput:function () {
|
2281 | var next = this.match;
|
2282 | if (next.length < 20) {
|
2283 | next += this._input.substr(0, 20-next.length);
|
2284 | }
|
2285 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
2286 | },
|
2287 |
|
2288 |
|
2289 | showPosition:function () {
|
2290 | var pre = this.pastInput();
|
2291 | var c = new Array(pre.length + 1).join("-");
|
2292 | return pre + this.upcomingInput() + "\n" + c + "^";
|
2293 | },
|
2294 |
|
2295 |
|
2296 | test_match:function(match, indexed_rule) {
|
2297 | var token,
|
2298 | lines,
|
2299 | backup;
|
2300 |
|
2301 | if (this.options.backtrack_lexer) {
|
2302 |
|
2303 | backup = {
|
2304 | yylineno: this.yylineno,
|
2305 | yylloc: {
|
2306 | first_line: this.yylloc.first_line,
|
2307 | last_line: this.last_line,
|
2308 | first_column: this.yylloc.first_column,
|
2309 | last_column: this.yylloc.last_column
|
2310 | },
|
2311 | yytext: this.yytext,
|
2312 | match: this.match,
|
2313 | matches: this.matches,
|
2314 | matched: this.matched,
|
2315 | yyleng: this.yyleng,
|
2316 | offset: this.offset,
|
2317 | _more: this._more,
|
2318 | _input: this._input,
|
2319 | yy: this.yy,
|
2320 | conditionStack: this.conditionStack.slice(0),
|
2321 | done: this.done
|
2322 | };
|
2323 | if (this.options.ranges) {
|
2324 | backup.yylloc.range = this.yylloc.range.slice(0);
|
2325 | }
|
2326 | }
|
2327 |
|
2328 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
2329 | if (lines) {
|
2330 | this.yylineno += lines.length;
|
2331 | }
|
2332 | this.yylloc = {
|
2333 | first_line: this.yylloc.last_line,
|
2334 | last_line: this.yylineno + 1,
|
2335 | first_column: this.yylloc.last_column,
|
2336 | last_column: lines ?
|
2337 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
2338 | this.yylloc.last_column + match[0].length
|
2339 | };
|
2340 | this.yytext += match[0];
|
2341 | this.match += match[0];
|
2342 | this.matches = match;
|
2343 | this.yyleng = this.yytext.length;
|
2344 | if (this.options.ranges) {
|
2345 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
2346 | }
|
2347 | this._more = false;
|
2348 | this._backtrack = false;
|
2349 | this._input = this._input.slice(match[0].length);
|
2350 | this.matched += match[0];
|
2351 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
2352 | if (this.done && this._input) {
|
2353 | this.done = false;
|
2354 | }
|
2355 | if (token) {
|
2356 | return token;
|
2357 | } else if (this._backtrack) {
|
2358 |
|
2359 | for (var k in backup) {
|
2360 | this[k] = backup[k];
|
2361 | }
|
2362 | return false;
|
2363 | }
|
2364 | return false;
|
2365 | },
|
2366 |
|
2367 |
|
2368 | next:function () {
|
2369 | if (this.done) {
|
2370 | return this.EOF;
|
2371 | }
|
2372 | if (!this._input) {
|
2373 | this.done = true;
|
2374 | }
|
2375 |
|
2376 | var token,
|
2377 | match,
|
2378 | tempMatch,
|
2379 | index;
|
2380 | if (!this._more) {
|
2381 | this.yytext = '';
|
2382 | this.match = '';
|
2383 | }
|
2384 | var rules = this._currentRules();
|
2385 | for (var i = 0; i < rules.length; i++) {
|
2386 | tempMatch = this._input.match(this.rules[rules[i]]);
|
2387 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
2388 | match = tempMatch;
|
2389 | index = i;
|
2390 | if (this.options.backtrack_lexer) {
|
2391 | token = this.test_match(tempMatch, rules[i]);
|
2392 | if (token !== false) {
|
2393 | return token;
|
2394 | } else if (this._backtrack) {
|
2395 | match = false;
|
2396 | continue;
|
2397 | } else {
|
2398 |
|
2399 | return false;
|
2400 | }
|
2401 | } else if (!this.options.flex) {
|
2402 | break;
|
2403 | }
|
2404 | }
|
2405 | }
|
2406 | if (match) {
|
2407 | token = this.test_match(match, rules[index]);
|
2408 | if (token !== false) {
|
2409 | return token;
|
2410 | }
|
2411 |
|
2412 | return false;
|
2413 | }
|
2414 | if (this._input === "") {
|
2415 | return this.EOF;
|
2416 | } else {
|
2417 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
2418 | text: "",
|
2419 | token: null,
|
2420 | line: this.yylineno
|
2421 | });
|
2422 | }
|
2423 | },
|
2424 |
|
2425 |
|
2426 | lex:function lex () {
|
2427 | var r = this.next();
|
2428 | if (r) {
|
2429 | return r;
|
2430 | } else {
|
2431 | return this.lex();
|
2432 | }
|
2433 | },
|
2434 |
|
2435 |
|
2436 | begin:function begin (condition) {
|
2437 | this.conditionStack.push(condition);
|
2438 | },
|
2439 |
|
2440 |
|
2441 | popState:function popState () {
|
2442 | var n = this.conditionStack.length - 1;
|
2443 | if (n > 0) {
|
2444 | return this.conditionStack.pop();
|
2445 | } else {
|
2446 | return this.conditionStack[0];
|
2447 | }
|
2448 | },
|
2449 |
|
2450 |
|
2451 | _currentRules:function _currentRules () {
|
2452 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
2453 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
2454 | } else {
|
2455 | return this.conditions["INITIAL"].rules;
|
2456 | }
|
2457 | },
|
2458 |
|
2459 |
|
2460 | topState:function topState (n) {
|
2461 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
2462 | if (n >= 0) {
|
2463 | return this.conditionStack[n];
|
2464 | } else {
|
2465 | return "INITIAL";
|
2466 | }
|
2467 | },
|
2468 |
|
2469 |
|
2470 | pushState:function pushState (condition) {
|
2471 | this.begin(condition);
|
2472 | },
|
2473 |
|
2474 |
|
2475 | stateStackSize:function stateStackSize() {
|
2476 | return this.conditionStack.length;
|
2477 | },
|
2478 | options: {},
|
2479 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
2480 | var YYSTATE=YY_START;
|
2481 | switch($avoiding_name_collisions) {
|
2482 | case 0: this.begin('open_directive'); return 12;
|
2483 | break;
|
2484 | case 1: this.begin('type_directive'); return 13;
|
2485 | break;
|
2486 | case 2: this.popState(); this.begin('arg_directive'); return 10;
|
2487 | break;
|
2488 | case 3: this.popState(); this.popState(); return 15;
|
2489 | break;
|
2490 | case 4:return 14;
|
2491 | break;
|
2492 | case 5:
|
2493 | break;
|
2494 | case 6:
|
2495 | break;
|
2496 | case 7:this.begin("string");
|
2497 | break;
|
2498 | case 8:this.popState();
|
2499 | break;
|
2500 | case 9:return "STR";
|
2501 | break;
|
2502 | case 10:return 76;
|
2503 | break;
|
2504 | case 11:return 85;
|
2505 | break;
|
2506 | case 12:return 77;
|
2507 | break;
|
2508 | case 13:return 94;
|
2509 | break;
|
2510 | case 14:return 78;
|
2511 | break;
|
2512 | case 15:return 79;
|
2513 | break;
|
2514 | case 16:this.begin("href");
|
2515 | break;
|
2516 | case 17:this.popState();
|
2517 | break;
|
2518 | case 18:return 90;
|
2519 | break;
|
2520 | case 19:this.begin("callbackname");
|
2521 | break;
|
2522 | case 20:this.popState();
|
2523 | break;
|
2524 | case 21:this.popState(); this.begin("callbackargs");
|
2525 | break;
|
2526 | case 22:return 88;
|
2527 | break;
|
2528 | case 23:this.popState();
|
2529 | break;
|
2530 | case 24:return 89;
|
2531 | break;
|
2532 | case 25:this.begin("click");
|
2533 | break;
|
2534 | case 26:this.popState();
|
2535 | break;
|
2536 | case 27:return 80;
|
2537 | break;
|
2538 | case 28:if(yy.lex.firstGraph()){this.begin("dir");} return 24;
|
2539 | break;
|
2540 | case 29:if(yy.lex.firstGraph()){this.begin("dir");} return 24;
|
2541 | break;
|
2542 | case 30:return 38;
|
2543 | break;
|
2544 | case 31:return 42;
|
2545 | break;
|
2546 | case 32:return 91;
|
2547 | break;
|
2548 | case 33:return 91;
|
2549 | break;
|
2550 | case 34:return 91;
|
2551 | break;
|
2552 | case 35:return 91;
|
2553 | break;
|
2554 | case 36: this.popState(); return 25;
|
2555 | break;
|
2556 | case 37: this.popState(); return 26;
|
2557 | break;
|
2558 | case 38: this.popState(); return 26;
|
2559 | break;
|
2560 | case 39: this.popState(); return 26;
|
2561 | break;
|
2562 | case 40: this.popState(); return 26;
|
2563 | break;
|
2564 | case 41: this.popState(); return 26;
|
2565 | break;
|
2566 | case 42: this.popState(); return 26;
|
2567 | break;
|
2568 | case 43: this.popState(); return 26;
|
2569 | break;
|
2570 | case 44: this.popState(); return 26;
|
2571 | break;
|
2572 | case 45: this.popState(); return 26;
|
2573 | break;
|
2574 | case 46: this.popState(); return 26;
|
2575 | break;
|
2576 | case 47:return 110;
|
2577 | break;
|
2578 | case 48:return 111;
|
2579 | break;
|
2580 | case 49:return 112;
|
2581 | break;
|
2582 | case 50:return 113;
|
2583 | break;
|
2584 | case 51: return 95;
|
2585 | break;
|
2586 | case 52:return 103;
|
2587 | break;
|
2588 | case 53:return 48;
|
2589 | break;
|
2590 | case 54:return 100;
|
2591 | break;
|
2592 | case 55:return 47;
|
2593 | break;
|
2594 | case 56:return 20;
|
2595 | break;
|
2596 | case 57:return 96;
|
2597 | break;
|
2598 | case 58:return 118;
|
2599 | break;
|
2600 | case 59:return 71;
|
2601 | break;
|
2602 | case 60:return 71;
|
2603 | break;
|
2604 | case 61:return 71;
|
2605 | break;
|
2606 | case 62:return 70;
|
2607 | break;
|
2608 | case 63:return 70;
|
2609 | break;
|
2610 | case 64:return 70;
|
2611 | break;
|
2612 | case 65:return 52;
|
2613 | break;
|
2614 | case 66:return 53;
|
2615 | break;
|
2616 | case 67:return 54;
|
2617 | break;
|
2618 | case 68:return 55;
|
2619 | break;
|
2620 | case 69:return 56;
|
2621 | break;
|
2622 | case 70:return 57;
|
2623 | break;
|
2624 | case 71:return 58;
|
2625 | break;
|
2626 | case 72:return 59;
|
2627 | break;
|
2628 | case 73:return 101;
|
2629 | break;
|
2630 | case 74:return 104;
|
2631 | break;
|
2632 | case 75:return 119;
|
2633 | break;
|
2634 | case 76:return 116;
|
2635 | break;
|
2636 | case 77:return 105;
|
2637 | break;
|
2638 | case 78:return 117;
|
2639 | break;
|
2640 | case 79:return 117;
|
2641 | break;
|
2642 | case 80:return 106;
|
2643 | break;
|
2644 | case 81:return 62;
|
2645 | break;
|
2646 | case 82:return 82;
|
2647 | break;
|
2648 | case 83:return 'SEP';
|
2649 | break;
|
2650 | case 84:return 81;
|
2651 | break;
|
2652 | case 85:return 99;
|
2653 | break;
|
2654 | case 86:return 64;
|
2655 | break;
|
2656 | case 87:return 63;
|
2657 | break;
|
2658 | case 88:return 66;
|
2659 | break;
|
2660 | case 89:return 65;
|
2661 | break;
|
2662 | case 90:return 114;
|
2663 | break;
|
2664 | case 91:return 115;
|
2665 | break;
|
2666 | case 92:return 72;
|
2667 | break;
|
2668 | case 93:return 50;
|
2669 | break;
|
2670 | case 94:return 51;
|
2671 | break;
|
2672 | case 95:return 40;
|
2673 | break;
|
2674 | case 96:return 41;
|
2675 | break;
|
2676 | case 97:return 60
|
2677 | break;
|
2678 | case 98:return 61
|
2679 | break;
|
2680 | case 99:return 125;
|
2681 | break;
|
2682 | case 100:return 21;
|
2683 | break;
|
2684 | case 101:return 22;
|
2685 | break;
|
2686 | case 102:return 23;
|
2687 | break;
|
2688 | }
|
2689 | },
|
2690 | rules: [/^(?:%%\{)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)[^\n]*)/,/^(?:[^\}]%%[^\n]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?: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)/,/^(?:$)/],
|
2691 | 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":[23,24],"inclusive":false},"callbackname":{"rules":[20,21,22],"inclusive":false},"href":{"rules":[17,18],"inclusive":false},"click":{"rules":[26,27],"inclusive":false},"vertex":{"rules":[],"inclusive":false},"dir":{"rules":[36,37,38,39,40,41,42,43,44,45,46],"inclusive":false},"string":{"rules":[8,9],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,10,11,12,13,14,15,16,19,25,28,29,30,31,32,33,34,35,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,95,96,97,98,99,100,101,102],"inclusive":true}}
|
2692 | });
|
2693 | return lexer;
|
2694 | })();
|
2695 | parser.lexer = lexer;
|
2696 | function Parser () {
|
2697 | this.yy = {};
|
2698 | }
|
2699 | Parser.prototype = parser;parser.Parser = Parser;
|
2700 | return new Parser;
|
2701 | })();
|
2702 |
|
2703 |
|
2704 | if (true) {
|
2705 | exports.parser = parser;
|
2706 | exports.Parser = parser.Parser;
|
2707 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
2708 | exports.main = function commonjsMain (args) {
|
2709 | if (!args[1]) {
|
2710 | console.log('Usage: '+args[0]+' FILE');
|
2711 | process.exit(1);
|
2712 | }
|
2713 | var source = __webpack_require__(/*! fs */ "?dbae").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
|
2714 | return exports.parser.parse(source);
|
2715 | };
|
2716 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
2717 | exports.main(process.argv.slice(1));
|
2718 | }
|
2719 | }
|
2720 |
|
2721 | /***/ }),
|
2722 |
|
2723 | /***/ "./src/diagrams/gantt/parser/gantt.jison":
|
2724 | /*!***********************************************!*\
|
2725 | !*** ./src/diagrams/gantt/parser/gantt.jison ***!
|
2726 | \***********************************************/
|
2727 | /***/ ((module, exports, __webpack_require__) => {
|
2728 |
|
2729 | /* module decorator */ module = __webpack_require__.nmd(module);
|
2730 | /* parser generated by jison 0.4.18 */
|
2731 | /*
|
2732 | Returns a Parser object of the following structure:
|
2733 |
|
2734 | Parser: {
|
2735 | yy: {}
|
2736 | }
|
2737 |
|
2738 | Parser.prototype: {
|
2739 | yy: {},
|
2740 | trace: function(),
|
2741 | symbols_: {associative list: name ==> number},
|
2742 | terminals_: {associative list: number ==> name},
|
2743 | productions_: [...],
|
2744 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
2745 | table: [...],
|
2746 | defaultActions: {...},
|
2747 | parseError: function(str, hash),
|
2748 | parse: function(input),
|
2749 |
|
2750 | lexer: {
|
2751 | EOF: 1,
|
2752 | parseError: function(str, hash),
|
2753 | setInput: function(input),
|
2754 | input: function(),
|
2755 | unput: function(str),
|
2756 | more: function(),
|
2757 | less: function(n),
|
2758 | pastInput: function(),
|
2759 | upcomingInput: function(),
|
2760 | showPosition: function(),
|
2761 | test_match: function(regex_match_array, rule_index),
|
2762 | next: function(),
|
2763 | lex: function(),
|
2764 | begin: function(condition),
|
2765 | popState: function(),
|
2766 | _currentRules: function(),
|
2767 | topState: function(),
|
2768 | pushState: function(condition),
|
2769 |
|
2770 | options: {
|
2771 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
2772 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
2773 | 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)
|
2774 | },
|
2775 |
|
2776 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
2777 | rules: [...],
|
2778 | conditions: {associative list: name ==> set},
|
2779 | }
|
2780 | }
|
2781 |
|
2782 |
|
2783 | token location info (@$, _$, etc.): {
|
2784 | first_line: n,
|
2785 | last_line: n,
|
2786 | first_column: n,
|
2787 | last_column: n,
|
2788 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
2789 | }
|
2790 |
|
2791 |
|
2792 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
2793 | text: (matched text)
|
2794 | token: (the produced terminal token, if any)
|
2795 | line: (yylineno)
|
2796 | }
|
2797 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
2798 | loc: (yylloc)
|
2799 | expected: (string describing the set of expected tokens)
|
2800 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
2801 | }
|
2802 | */
|
2803 | var parser = (function(){
|
2804 | 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,21,28,33],$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,24],$Vc=[1,26],$Vd=[1,29],$Ve=[5,7,9,11,12,13,14,15,16,17,18,19,21,28,33];
|
2805 | var parser = {trace: function trace () { },
|
2806 | yy: {},
|
2807 | 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,"todayMarker":17,"title":18,"section":19,"clickStatement":20,"taskTxt":21,"taskData":22,"openDirective":23,"typeDirective":24,"closeDirective":25,":":26,"argDirective":27,"click":28,"callbackname":29,"callbackargs":30,"href":31,"clickStatementDebug":32,"open_directive":33,"type_directive":34,"arg_directive":35,"close_directive":36,"$accept":0,"$end":1},
|
2808 | terminals_: {2:"error",5:"gantt",7:"EOF",9:"SPACE",11:"NL",12:"dateFormat",13:"inclusiveEndDates",14:"topAxis",15:"axisFormat",16:"excludes",17:"todayMarker",18:"title",19:"section",21:"taskTxt",22:"taskData",26:":",28:"click",29:"callbackname",30:"callbackargs",31:"href",33:"open_directive",34:"type_directive",35:"arg_directive",36:"close_directive"},
|
2809 | 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,1],[10,2],[10,1],[4,4],[4,6],[20,2],[20,3],[20,3],[20,4],[20,3],[20,4],[20,2],[32,2],[32,3],[32,3],[32,4],[32,3],[32,4],[32,2],[23,1],[24,1],[27,1],[25,1]],
|
2810 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
2811 | /* this == yyval */
|
2812 |
|
2813 | var $0 = $$.length - 1;
|
2814 | switch (yystate) {
|
2815 | case 2:
|
2816 | return $$[$0-1];
|
2817 | break;
|
2818 | case 3:
|
2819 | this.$ = []
|
2820 | break;
|
2821 | case 4:
|
2822 | $$[$0-1].push($$[$0]);this.$ = $$[$0-1]
|
2823 | break;
|
2824 | case 5: case 6:
|
2825 | this.$ = $$[$0]
|
2826 | break;
|
2827 | case 7: case 8:
|
2828 | this.$=[];
|
2829 | break;
|
2830 | case 9:
|
2831 | yy.setDateFormat($$[$0].substr(11));this.$=$$[$0].substr(11);
|
2832 | break;
|
2833 | case 10:
|
2834 | yy.enableInclusiveEndDates();this.$=$$[$0].substr(18);
|
2835 | break;
|
2836 | case 11:
|
2837 | yy.TopAxis();this.$=$$[$0].substr(8);
|
2838 | break;
|
2839 | case 12:
|
2840 | yy.setAxisFormat($$[$0].substr(11));this.$=$$[$0].substr(11);
|
2841 | break;
|
2842 | case 13:
|
2843 | yy.setExcludes($$[$0].substr(9));this.$=$$[$0].substr(9);
|
2844 | break;
|
2845 | case 14:
|
2846 | yy.setTodayMarker($$[$0].substr(12));this.$=$$[$0].substr(12);
|
2847 | break;
|
2848 | case 15:
|
2849 | yy.setTitle($$[$0].substr(6));this.$=$$[$0].substr(6);
|
2850 | break;
|
2851 | case 16:
|
2852 | yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8);
|
2853 | break;
|
2854 | case 18:
|
2855 | yy.addTask($$[$0-1],$$[$0]);this.$='task';
|
2856 | break;
|
2857 | case 22:
|
2858 | this.$ = $$[$0-1];yy.setClickEvent($$[$0-1], $$[$0], null);
|
2859 | break;
|
2860 | case 23:
|
2861 | this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]);
|
2862 | break;
|
2863 | case 24:
|
2864 | this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], null);yy.setLink($$[$0-2],$$[$0]);
|
2865 | break;
|
2866 | case 25:
|
2867 | this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-2], $$[$0-1]);yy.setLink($$[$0-3],$$[$0]);
|
2868 | break;
|
2869 | case 26:
|
2870 | this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0], null);yy.setLink($$[$0-2],$$[$0-1]);
|
2871 | break;
|
2872 | case 27:
|
2873 | this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-1], $$[$0]);yy.setLink($$[$0-3],$$[$0-2]);
|
2874 | break;
|
2875 | case 28:
|
2876 | this.$ = $$[$0-1];yy.setLink($$[$0-1], $$[$0]);
|
2877 | break;
|
2878 | case 29: case 35:
|
2879 | this.$=$$[$0-1] + ' ' + $$[$0];
|
2880 | break;
|
2881 | case 30: case 31: case 33:
|
2882 | this.$=$$[$0-2] + ' ' + $$[$0-1] + ' ' + $$[$0];
|
2883 | break;
|
2884 | case 32: case 34:
|
2885 | this.$=$$[$0-3] + ' ' + $$[$0-2] + ' ' + $$[$0-1] + ' ' + $$[$0];
|
2886 | break;
|
2887 | case 36:
|
2888 | yy.parseDirective('%%{', 'open_directive');
|
2889 | break;
|
2890 | case 37:
|
2891 | yy.parseDirective($$[$0], 'type_directive');
|
2892 | break;
|
2893 | case 38:
|
2894 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
2895 | break;
|
2896 | case 39:
|
2897 | yy.parseDirective('}%%', 'close_directive', 'gantt');
|
2898 | break;
|
2899 | }
|
2900 | },
|
2901 | table: [{3:1,4:2,5:$V0,23:4,33:$V1},{1:[3]},{3:6,4:2,5:$V0,23:4,33:$V1},o($V2,[2,3],{6:7}),{24:8,34:[1,9]},{34:[2,36]},{1:[2,1]},{4:25,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:23,21:$Vb,23:4,28:$Vc,33:$V1},{25:27,26:[1,28],36:$Vd},o([26,36],[2,37]),o($V2,[2,8],{1:[2,2]}),o($V2,[2,4]),{4:25,10:30,12:$V3,13:$V4,14:$V5,15:$V6,16:$V7,17:$V8,18:$V9,19:$Va,20:23,21:$Vb,23:4,28:$Vc,33:$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]),o($V2,[2,17]),{22:[1,31]},o($V2,[2,19]),{29:[1,32],31:[1,33]},{11:[1,34]},{27:35,35:[1,36]},{11:[2,39]},o($V2,[2,5]),o($V2,[2,18]),o($V2,[2,22],{30:[1,37],31:[1,38]}),o($V2,[2,28],{29:[1,39]}),o($Ve,[2,20]),{25:40,36:$Vd},{36:[2,38]},o($V2,[2,23],{31:[1,41]}),o($V2,[2,24]),o($V2,[2,26],{30:[1,42]}),{11:[1,43]},o($V2,[2,25]),o($V2,[2,27]),o($Ve,[2,21])],
|
2902 | defaultActions: {5:[2,36],6:[2,1],29:[2,39],36:[2,38]},
|
2903 | parseError: function parseError (str, hash) {
|
2904 | if (hash.recoverable) {
|
2905 | this.trace(str);
|
2906 | } else {
|
2907 | var error = new Error(str);
|
2908 | error.hash = hash;
|
2909 | throw error;
|
2910 | }
|
2911 | },
|
2912 | parse: function parse(input) {
|
2913 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
2914 | var args = lstack.slice.call(arguments, 1);
|
2915 | var lexer = Object.create(this.lexer);
|
2916 | var sharedState = { yy: {} };
|
2917 | for (var k in this.yy) {
|
2918 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
2919 | sharedState.yy[k] = this.yy[k];
|
2920 | }
|
2921 | }
|
2922 | lexer.setInput(input, sharedState.yy);
|
2923 | sharedState.yy.lexer = lexer;
|
2924 | sharedState.yy.parser = this;
|
2925 | if (typeof lexer.yylloc == 'undefined') {
|
2926 | lexer.yylloc = {};
|
2927 | }
|
2928 | var yyloc = lexer.yylloc;
|
2929 | lstack.push(yyloc);
|
2930 | var ranges = lexer.options && lexer.options.ranges;
|
2931 | if (typeof sharedState.yy.parseError === 'function') {
|
2932 | this.parseError = sharedState.yy.parseError;
|
2933 | } else {
|
2934 | this.parseError = Object.getPrototypeOf(this).parseError;
|
2935 | }
|
2936 | function popStack(n) {
|
2937 | stack.length = stack.length - 2 * n;
|
2938 | vstack.length = vstack.length - n;
|
2939 | lstack.length = lstack.length - n;
|
2940 | }
|
2941 | function lex() {
|
2942 | var token;
|
2943 | token = tstack.pop() || lexer.lex() || EOF;
|
2944 | if (typeof token !== 'number') {
|
2945 | if (token instanceof Array) {
|
2946 | tstack = token;
|
2947 | token = tstack.pop();
|
2948 | }
|
2949 | token = self.symbols_[token] || token;
|
2950 | }
|
2951 | return token;
|
2952 | }
|
2953 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
2954 | while (true) {
|
2955 | state = stack[stack.length - 1];
|
2956 | if (this.defaultActions[state]) {
|
2957 | action = this.defaultActions[state];
|
2958 | } else {
|
2959 | if (symbol === null || typeof symbol == 'undefined') {
|
2960 | symbol = lex();
|
2961 | }
|
2962 | action = table[state] && table[state][symbol];
|
2963 | }
|
2964 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
2965 | var errStr = '';
|
2966 | expected = [];
|
2967 | for (p in table[state]) {
|
2968 | if (this.terminals_[p] && p > TERROR) {
|
2969 | expected.push('\'' + this.terminals_[p] + '\'');
|
2970 | }
|
2971 | }
|
2972 | if (lexer.showPosition) {
|
2973 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
2974 | } else {
|
2975 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
2976 | }
|
2977 | this.parseError(errStr, {
|
2978 | text: lexer.match,
|
2979 | token: this.terminals_[symbol] || symbol,
|
2980 | line: lexer.yylineno,
|
2981 | loc: yyloc,
|
2982 | expected: expected
|
2983 | });
|
2984 | }
|
2985 | if (action[0] instanceof Array && action.length > 1) {
|
2986 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
2987 | }
|
2988 | switch (action[0]) {
|
2989 | case 1:
|
2990 | stack.push(symbol);
|
2991 | vstack.push(lexer.yytext);
|
2992 | lstack.push(lexer.yylloc);
|
2993 | stack.push(action[1]);
|
2994 | symbol = null;
|
2995 | if (!preErrorSymbol) {
|
2996 | yyleng = lexer.yyleng;
|
2997 | yytext = lexer.yytext;
|
2998 | yylineno = lexer.yylineno;
|
2999 | yyloc = lexer.yylloc;
|
3000 | if (recovering > 0) {
|
3001 | recovering--;
|
3002 | }
|
3003 | } else {
|
3004 | symbol = preErrorSymbol;
|
3005 | preErrorSymbol = null;
|
3006 | }
|
3007 | break;
|
3008 | case 2:
|
3009 | len = this.productions_[action[1]][1];
|
3010 | yyval.$ = vstack[vstack.length - len];
|
3011 | yyval._$ = {
|
3012 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
3013 | last_line: lstack[lstack.length - 1].last_line,
|
3014 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
3015 | last_column: lstack[lstack.length - 1].last_column
|
3016 | };
|
3017 | if (ranges) {
|
3018 | yyval._$.range = [
|
3019 | lstack[lstack.length - (len || 1)].range[0],
|
3020 | lstack[lstack.length - 1].range[1]
|
3021 | ];
|
3022 | }
|
3023 | r = this.performAction.apply(yyval, [
|
3024 | yytext,
|
3025 | yyleng,
|
3026 | yylineno,
|
3027 | sharedState.yy,
|
3028 | action[1],
|
3029 | vstack,
|
3030 | lstack
|
3031 | ].concat(args));
|
3032 | if (typeof r !== 'undefined') {
|
3033 | return r;
|
3034 | }
|
3035 | if (len) {
|
3036 | stack = stack.slice(0, -1 * len * 2);
|
3037 | vstack = vstack.slice(0, -1 * len);
|
3038 | lstack = lstack.slice(0, -1 * len);
|
3039 | }
|
3040 | stack.push(this.productions_[action[1]][0]);
|
3041 | vstack.push(yyval.$);
|
3042 | lstack.push(yyval._$);
|
3043 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
3044 | stack.push(newState);
|
3045 | break;
|
3046 | case 3:
|
3047 | return true;
|
3048 | }
|
3049 | }
|
3050 | return true;
|
3051 | }};
|
3052 |
|
3053 | /* generated by jison-lex 0.3.4 */
|
3054 | var lexer = (function(){
|
3055 | var lexer = ({
|
3056 |
|
3057 | EOF:1,
|
3058 |
|
3059 | parseError:function parseError(str, hash) {
|
3060 | if (this.yy.parser) {
|
3061 | this.yy.parser.parseError(str, hash);
|
3062 | } else {
|
3063 | throw new Error(str);
|
3064 | }
|
3065 | },
|
3066 |
|
3067 | // resets the lexer, sets new input
|
3068 | setInput:function (input, yy) {
|
3069 | this.yy = yy || this.yy || {};
|
3070 | this._input = input;
|
3071 | this._more = this._backtrack = this.done = false;
|
3072 | this.yylineno = this.yyleng = 0;
|
3073 | this.yytext = this.matched = this.match = '';
|
3074 | this.conditionStack = ['INITIAL'];
|
3075 | this.yylloc = {
|
3076 | first_line: 1,
|
3077 | first_column: 0,
|
3078 | last_line: 1,
|
3079 | last_column: 0
|
3080 | };
|
3081 | if (this.options.ranges) {
|
3082 | this.yylloc.range = [0,0];
|
3083 | }
|
3084 | this.offset = 0;
|
3085 | return this;
|
3086 | },
|
3087 |
|
3088 | // consumes and returns one char from the input
|
3089 | input:function () {
|
3090 | var ch = this._input[0];
|
3091 | this.yytext += ch;
|
3092 | this.yyleng++;
|
3093 | this.offset++;
|
3094 | this.match += ch;
|
3095 | this.matched += ch;
|
3096 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
3097 | if (lines) {
|
3098 | this.yylineno++;
|
3099 | this.yylloc.last_line++;
|
3100 | } else {
|
3101 | this.yylloc.last_column++;
|
3102 | }
|
3103 | if (this.options.ranges) {
|
3104 | this.yylloc.range[1]++;
|
3105 | }
|
3106 |
|
3107 | this._input = this._input.slice(1);
|
3108 | return ch;
|
3109 | },
|
3110 |
|
3111 | // unshifts one char (or a string) into the input
|
3112 | unput:function (ch) {
|
3113 | var len = ch.length;
|
3114 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
3115 |
|
3116 | this._input = ch + this._input;
|
3117 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
3118 | //this.yyleng -= len;
|
3119 | this.offset -= len;
|
3120 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
3121 | this.match = this.match.substr(0, this.match.length - 1);
|
3122 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
3123 |
|
3124 | if (lines.length - 1) {
|
3125 | this.yylineno -= lines.length - 1;
|
3126 | }
|
3127 | var r = this.yylloc.range;
|
3128 |
|
3129 | this.yylloc = {
|
3130 | first_line: this.yylloc.first_line,
|
3131 | last_line: this.yylineno + 1,
|
3132 | first_column: this.yylloc.first_column,
|
3133 | last_column: lines ?
|
3134 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
3135 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
3136 | this.yylloc.first_column - len
|
3137 | };
|
3138 |
|
3139 | if (this.options.ranges) {
|
3140 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
3141 | }
|
3142 | this.yyleng = this.yytext.length;
|
3143 | return this;
|
3144 | },
|
3145 |
|
3146 | // When called from action, caches matched text and appends it on next action
|
3147 | more:function () {
|
3148 | this._more = true;
|
3149 | return this;
|
3150 | },
|
3151 |
|
3152 | // 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.
|
3153 | reject:function () {
|
3154 | if (this.options.backtrack_lexer) {
|
3155 | this._backtrack = true;
|
3156 | } else {
|
3157 | 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(), {
|
3158 | text: "",
|
3159 | token: null,
|
3160 | line: this.yylineno
|
3161 | });
|
3162 |
|
3163 | }
|
3164 | return this;
|
3165 | },
|
3166 |
|
3167 | // retain first n characters of the match
|
3168 | less:function (n) {
|
3169 | this.unput(this.match.slice(n));
|
3170 | },
|
3171 |
|
3172 | // displays already matched input, i.e. for error messages
|
3173 | pastInput:function () {
|
3174 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
3175 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
3176 | },
|
3177 |
|
3178 | // displays upcoming input, i.e. for error messages
|
3179 | upcomingInput:function () {
|
3180 | var next = this.match;
|
3181 | if (next.length < 20) {
|
3182 | next += this._input.substr(0, 20-next.length);
|
3183 | }
|
3184 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
3185 | },
|
3186 |
|
3187 | // displays the character position where the lexing error occurred, i.e. for error messages
|
3188 | showPosition:function () {
|
3189 | var pre = this.pastInput();
|
3190 | var c = new Array(pre.length + 1).join("-");
|
3191 | return pre + this.upcomingInput() + "\n" + c + "^";
|
3192 | },
|
3193 |
|
3194 | // test the lexed token: return FALSE when not a match, otherwise return token
|
3195 | test_match:function(match, indexed_rule) {
|
3196 | var token,
|
3197 | lines,
|
3198 | backup;
|
3199 |
|
3200 | if (this.options.backtrack_lexer) {
|
3201 | // save context
|
3202 | backup = {
|
3203 | yylineno: this.yylineno,
|
3204 | yylloc: {
|
3205 | first_line: this.yylloc.first_line,
|
3206 | last_line: this.last_line,
|
3207 | first_column: this.yylloc.first_column,
|
3208 | last_column: this.yylloc.last_column
|
3209 | },
|
3210 | yytext: this.yytext,
|
3211 | match: this.match,
|
3212 | matches: this.matches,
|
3213 | matched: this.matched,
|
3214 | yyleng: this.yyleng,
|
3215 | offset: this.offset,
|
3216 | _more: this._more,
|
3217 | _input: this._input,
|
3218 | yy: this.yy,
|
3219 | conditionStack: this.conditionStack.slice(0),
|
3220 | done: this.done
|
3221 | };
|
3222 | if (this.options.ranges) {
|
3223 | backup.yylloc.range = this.yylloc.range.slice(0);
|
3224 | }
|
3225 | }
|
3226 |
|
3227 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
3228 | if (lines) {
|
3229 | this.yylineno += lines.length;
|
3230 | }
|
3231 | this.yylloc = {
|
3232 | first_line: this.yylloc.last_line,
|
3233 | last_line: this.yylineno + 1,
|
3234 | first_column: this.yylloc.last_column,
|
3235 | last_column: lines ?
|
3236 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
3237 | this.yylloc.last_column + match[0].length
|
3238 | };
|
3239 | this.yytext += match[0];
|
3240 | this.match += match[0];
|
3241 | this.matches = match;
|
3242 | this.yyleng = this.yytext.length;
|
3243 | if (this.options.ranges) {
|
3244 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
3245 | }
|
3246 | this._more = false;
|
3247 | this._backtrack = false;
|
3248 | this._input = this._input.slice(match[0].length);
|
3249 | this.matched += match[0];
|
3250 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
3251 | if (this.done && this._input) {
|
3252 | this.done = false;
|
3253 | }
|
3254 | if (token) {
|
3255 | return token;
|
3256 | } else if (this._backtrack) {
|
3257 | // recover context
|
3258 | for (var k in backup) {
|
3259 | this[k] = backup[k];
|
3260 | }
|
3261 | return false; // rule action called reject() implying the next rule should be tested instead.
|
3262 | }
|
3263 | return false;
|
3264 | },
|
3265 |
|
3266 | // return next match in input
|
3267 | next:function () {
|
3268 | if (this.done) {
|
3269 | return this.EOF;
|
3270 | }
|
3271 | if (!this._input) {
|
3272 | this.done = true;
|
3273 | }
|
3274 |
|
3275 | var token,
|
3276 | match,
|
3277 | tempMatch,
|
3278 | index;
|
3279 | if (!this._more) {
|
3280 | this.yytext = '';
|
3281 | this.match = '';
|
3282 | }
|
3283 | var rules = this._currentRules();
|
3284 | for (var i = 0; i < rules.length; i++) {
|
3285 | tempMatch = this._input.match(this.rules[rules[i]]);
|
3286 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
3287 | match = tempMatch;
|
3288 | index = i;
|
3289 | if (this.options.backtrack_lexer) {
|
3290 | token = this.test_match(tempMatch, rules[i]);
|
3291 | if (token !== false) {
|
3292 | return token;
|
3293 | } else if (this._backtrack) {
|
3294 | match = false;
|
3295 | continue; // rule action called reject() implying a rule MISmatch.
|
3296 | } else {
|
3297 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
3298 | return false;
|
3299 | }
|
3300 | } else if (!this.options.flex) {
|
3301 | break;
|
3302 | }
|
3303 | }
|
3304 | }
|
3305 | if (match) {
|
3306 | token = this.test_match(match, rules[index]);
|
3307 | if (token !== false) {
|
3308 | return token;
|
3309 | }
|
3310 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
3311 | return false;
|
3312 | }
|
3313 | if (this._input === "") {
|
3314 | return this.EOF;
|
3315 | } else {
|
3316 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
3317 | text: "",
|
3318 | token: null,
|
3319 | line: this.yylineno
|
3320 | });
|
3321 | }
|
3322 | },
|
3323 |
|
3324 | // return next match that has a token
|
3325 | lex:function lex () {
|
3326 | var r = this.next();
|
3327 | if (r) {
|
3328 | return r;
|
3329 | } else {
|
3330 | return this.lex();
|
3331 | }
|
3332 | },
|
3333 |
|
3334 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
3335 | begin:function begin (condition) {
|
3336 | this.conditionStack.push(condition);
|
3337 | },
|
3338 |
|
3339 | // pop the previously active lexer condition state off the condition stack
|
3340 | popState:function popState () {
|
3341 | var n = this.conditionStack.length - 1;
|
3342 | if (n > 0) {
|
3343 | return this.conditionStack.pop();
|
3344 | } else {
|
3345 | return this.conditionStack[0];
|
3346 | }
|
3347 | },
|
3348 |
|
3349 | // produce the lexer rule set which is active for the currently active lexer condition state
|
3350 | _currentRules:function _currentRules () {
|
3351 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
3352 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
3353 | } else {
|
3354 | return this.conditions["INITIAL"].rules;
|
3355 | }
|
3356 | },
|
3357 |
|
3358 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
3359 | topState:function topState (n) {
|
3360 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
3361 | if (n >= 0) {
|
3362 | return this.conditionStack[n];
|
3363 | } else {
|
3364 | return "INITIAL";
|
3365 | }
|
3366 | },
|
3367 |
|
3368 | // alias for begin(condition)
|
3369 | pushState:function pushState (condition) {
|
3370 | this.begin(condition);
|
3371 | },
|
3372 |
|
3373 | // return the number of states currently on the stack
|
3374 | stateStackSize:function stateStackSize() {
|
3375 | return this.conditionStack.length;
|
3376 | },
|
3377 | options: {"case-insensitive":true},
|
3378 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
3379 | var YYSTATE=YY_START;
|
3380 | switch($avoiding_name_collisions) {
|
3381 | case 0: this.begin('open_directive'); return 33;
|
3382 | break;
|
3383 | case 1: this.begin('type_directive'); return 34;
|
3384 | break;
|
3385 | case 2: this.popState(); this.begin('arg_directive'); return 26;
|
3386 | break;
|
3387 | case 3: this.popState(); this.popState(); return 36;
|
3388 | break;
|
3389 | case 4:return 35;
|
3390 | break;
|
3391 | case 5:/* skip comments */
|
3392 | break;
|
3393 | case 6:/* skip comments */
|
3394 | break;
|
3395 | case 7:/* do nothing */
|
3396 | break;
|
3397 | case 8:return 11;
|
3398 | break;
|
3399 | case 9:/* skip whitespace */
|
3400 | break;
|
3401 | case 10:/* skip comments */
|
3402 | break;
|
3403 | case 11:/* skip comments */
|
3404 | break;
|
3405 | case 12:this.begin("href");
|
3406 | break;
|
3407 | case 13:this.popState();
|
3408 | break;
|
3409 | case 14:return 31;
|
3410 | break;
|
3411 | case 15:this.begin("callbackname");
|
3412 | break;
|
3413 | case 16:this.popState();
|
3414 | break;
|
3415 | case 17:this.popState(); this.begin("callbackargs");
|
3416 | break;
|
3417 | case 18:return 29;
|
3418 | break;
|
3419 | case 19:this.popState();
|
3420 | break;
|
3421 | case 20:return 30;
|
3422 | break;
|
3423 | case 21:this.begin("click");
|
3424 | break;
|
3425 | case 22:this.popState();
|
3426 | break;
|
3427 | case 23:return 28;
|
3428 | break;
|
3429 | case 24:return 5;
|
3430 | break;
|
3431 | case 25:return 12;
|
3432 | break;
|
3433 | case 26:return 13;
|
3434 | break;
|
3435 | case 27:return 14;
|
3436 | break;
|
3437 | case 28:return 15;
|
3438 | break;
|
3439 | case 29:return 16;
|
3440 | break;
|
3441 | case 30:return 17;
|
3442 | break;
|
3443 | case 31:return 'date';
|
3444 | break;
|
3445 | case 32:return 18;
|
3446 | break;
|
3447 | case 33:return 19;
|
3448 | break;
|
3449 | case 34:return 21;
|
3450 | break;
|
3451 | case 35:return 22;
|
3452 | break;
|
3453 | case 36:return 26;
|
3454 | break;
|
3455 | case 37:return 7;
|
3456 | break;
|
3457 | case 38:return 'INVALID';
|
3458 | break;
|
3459 | }
|
3460 | },
|
3461 | rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/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,/^(?:excludes\s[^#\n;]+)/i,/^(?:todayMarker\s[^\n;]+)/i,/^(?:\d\d\d\d-\d\d-\d\d\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],
|
3462 | 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":[19,20],"inclusive":false},"callbackname":{"rules":[16,17,18],"inclusive":false},"href":{"rules":[13,14],"inclusive":false},"click":{"rules":[22,23],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,11,12,15,21,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"inclusive":true}}
|
3463 | });
|
3464 | return lexer;
|
3465 | })();
|
3466 | parser.lexer = lexer;
|
3467 | function Parser () {
|
3468 | this.yy = {};
|
3469 | }
|
3470 | Parser.prototype = parser;parser.Parser = Parser;
|
3471 | return new Parser;
|
3472 | })();
|
3473 |
|
3474 |
|
3475 | if (true) {
|
3476 | exports.parser = parser;
|
3477 | exports.Parser = parser.Parser;
|
3478 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
3479 | exports.main = function commonjsMain (args) {
|
3480 | if (!args[1]) {
|
3481 | console.log('Usage: '+args[0]+' FILE');
|
3482 | process.exit(1);
|
3483 | }
|
3484 | var source = __webpack_require__(/*! fs */ "?8ed1").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
|
3485 | return exports.parser.parse(source);
|
3486 | };
|
3487 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
3488 | exports.main(process.argv.slice(1));
|
3489 | }
|
3490 | }
|
3491 |
|
3492 | /***/ }),
|
3493 |
|
3494 | /***/ "./src/diagrams/git/parser/gitGraph.jison":
|
3495 | /*!************************************************!*\
|
3496 | !*** ./src/diagrams/git/parser/gitGraph.jison ***!
|
3497 | \************************************************/
|
3498 | /***/ ((module, exports, __webpack_require__) => {
|
3499 |
|
3500 | /* module decorator */ module = __webpack_require__.nmd(module);
|
3501 | /* parser generated by jison 0.4.18 */
|
3502 | /*
|
3503 | Returns a Parser object of the following structure:
|
3504 |
|
3505 | Parser: {
|
3506 | yy: {}
|
3507 | }
|
3508 |
|
3509 | Parser.prototype: {
|
3510 | yy: {},
|
3511 | trace: function(),
|
3512 | symbols_: {associative list: name ==> number},
|
3513 | terminals_: {associative list: number ==> name},
|
3514 | productions_: [...],
|
3515 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
3516 | table: [...],
|
3517 | defaultActions: {...},
|
3518 | parseError: function(str, hash),
|
3519 | parse: function(input),
|
3520 |
|
3521 | lexer: {
|
3522 | EOF: 1,
|
3523 | parseError: function(str, hash),
|
3524 | setInput: function(input),
|
3525 | input: function(),
|
3526 | unput: function(str),
|
3527 | more: function(),
|
3528 | less: function(n),
|
3529 | pastInput: function(),
|
3530 | upcomingInput: function(),
|
3531 | showPosition: function(),
|
3532 | test_match: function(regex_match_array, rule_index),
|
3533 | next: function(),
|
3534 | lex: function(),
|
3535 | begin: function(condition),
|
3536 | popState: function(),
|
3537 | _currentRules: function(),
|
3538 | topState: function(),
|
3539 | pushState: function(condition),
|
3540 |
|
3541 | options: {
|
3542 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
3543 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
3544 | 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)
|
3545 | },
|
3546 |
|
3547 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
3548 | rules: [...],
|
3549 | conditions: {associative list: name ==> set},
|
3550 | }
|
3551 | }
|
3552 |
|
3553 |
|
3554 | token location info (@$, _$, etc.): {
|
3555 | first_line: n,
|
3556 | last_line: n,
|
3557 | first_column: n,
|
3558 | last_column: n,
|
3559 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
3560 | }
|
3561 |
|
3562 |
|
3563 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
3564 | text: (matched text)
|
3565 | token: (the produced terminal token, if any)
|
3566 | line: (yylineno)
|
3567 | }
|
3568 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
3569 | loc: (yylloc)
|
3570 | expected: (string describing the set of expected tokens)
|
3571 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
3572 | }
|
3573 | */
|
3574 | var parser = (function(){
|
3575 | var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[2,3],$V1=[1,7],$V2=[7,12,15,17,19,20,21],$V3=[7,11,12,15,17,19,20,21],$V4=[2,20],$V5=[1,32];
|
3576 | var parser = {trace: function trace () { },
|
3577 | yy: {},
|
3578 | symbols_: {"error":2,"start":3,"GG":4,":":5,"document":6,"EOF":7,"DIR":8,"options":9,"body":10,"OPT":11,"NL":12,"line":13,"statement":14,"COMMIT":15,"commit_arg":16,"BRANCH":17,"ID":18,"CHECKOUT":19,"MERGE":20,"RESET":21,"reset_arg":22,"STR":23,"HEAD":24,"reset_parents":25,"CARET":26,"$accept":0,"$end":1},
|
3579 | terminals_: {2:"error",4:"GG",5:":",7:"EOF",8:"DIR",11:"OPT",12:"NL",15:"COMMIT",17:"BRANCH",18:"ID",19:"CHECKOUT",20:"MERGE",21:"RESET",23:"STR",24:"HEAD",26:"CARET"},
|
3580 | productions_: [0,[3,4],[3,5],[6,0],[6,2],[9,2],[9,1],[10,0],[10,2],[13,2],[13,1],[14,2],[14,2],[14,2],[14,2],[14,2],[16,0],[16,1],[22,2],[22,2],[25,0],[25,2]],
|
3581 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
3582 | /* this == yyval */
|
3583 |
|
3584 | var $0 = $$.length - 1;
|
3585 | switch (yystate) {
|
3586 | case 1:
|
3587 | return $$[$0-1];
|
3588 | break;
|
3589 | case 2:
|
3590 | yy.setDirection($$[$0-3]); return $$[$0-1];
|
3591 | break;
|
3592 | case 4:
|
3593 | yy.setOptions($$[$0-1]); this.$ = $$[$0]
|
3594 | break;
|
3595 | case 5:
|
3596 | $$[$0-1] +=$$[$0]; this.$=$$[$0-1]
|
3597 | break;
|
3598 | case 7:
|
3599 | this.$ = []
|
3600 | break;
|
3601 | case 8:
|
3602 | $$[$0-1].push($$[$0]); this.$=$$[$0-1];
|
3603 | break;
|
3604 | case 9:
|
3605 | this.$ =$$[$0-1]
|
3606 | break;
|
3607 | case 11:
|
3608 | yy.commit($$[$0])
|
3609 | break;
|
3610 | case 12:
|
3611 | yy.branch($$[$0])
|
3612 | break;
|
3613 | case 13:
|
3614 | yy.checkout($$[$0])
|
3615 | break;
|
3616 | case 14:
|
3617 | yy.merge($$[$0])
|
3618 | break;
|
3619 | case 15:
|
3620 | yy.reset($$[$0])
|
3621 | break;
|
3622 | case 16:
|
3623 | this.$ = ""
|
3624 | break;
|
3625 | case 17:
|
3626 | this.$=$$[$0]
|
3627 | break;
|
3628 | case 18:
|
3629 | this.$ = $$[$0-1]+ ":" + $$[$0]
|
3630 | break;
|
3631 | case 19:
|
3632 | this.$ = $$[$0-1]+ ":" + yy.count; yy.count = 0
|
3633 | break;
|
3634 | case 20:
|
3635 | yy.count = 0
|
3636 | break;
|
3637 | case 21:
|
3638 | yy.count += 1
|
3639 | break;
|
3640 | }
|
3641 | },
|
3642 | table: [{3:1,4:[1,2]},{1:[3]},{5:[1,3],8:[1,4]},{6:5,7:$V0,9:6,12:$V1},{5:[1,8]},{7:[1,9]},o($V2,[2,7],{10:10,11:[1,11]}),o($V3,[2,6]),{6:12,7:$V0,9:6,12:$V1},{1:[2,1]},{7:[2,4],12:[1,15],13:13,14:14,15:[1,16],17:[1,17],19:[1,18],20:[1,19],21:[1,20]},o($V3,[2,5]),{7:[1,21]},o($V2,[2,8]),{12:[1,22]},o($V2,[2,10]),{12:[2,16],16:23,23:[1,24]},{18:[1,25]},{18:[1,26]},{18:[1,27]},{18:[1,30],22:28,24:[1,29]},{1:[2,2]},o($V2,[2,9]),{12:[2,11]},{12:[2,17]},{12:[2,12]},{12:[2,13]},{12:[2,14]},{12:[2,15]},{12:$V4,25:31,26:$V5},{12:$V4,25:33,26:$V5},{12:[2,18]},{12:$V4,25:34,26:$V5},{12:[2,19]},{12:[2,21]}],
|
3643 | defaultActions: {9:[2,1],21:[2,2],23:[2,11],24:[2,17],25:[2,12],26:[2,13],27:[2,14],28:[2,15],31:[2,18],33:[2,19],34:[2,21]},
|
3644 | parseError: function parseError (str, hash) {
|
3645 | if (hash.recoverable) {
|
3646 | this.trace(str);
|
3647 | } else {
|
3648 | var error = new Error(str);
|
3649 | error.hash = hash;
|
3650 | throw error;
|
3651 | }
|
3652 | },
|
3653 | parse: function parse(input) {
|
3654 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
3655 | var args = lstack.slice.call(arguments, 1);
|
3656 | var lexer = Object.create(this.lexer);
|
3657 | var sharedState = { yy: {} };
|
3658 | for (var k in this.yy) {
|
3659 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
3660 | sharedState.yy[k] = this.yy[k];
|
3661 | }
|
3662 | }
|
3663 | lexer.setInput(input, sharedState.yy);
|
3664 | sharedState.yy.lexer = lexer;
|
3665 | sharedState.yy.parser = this;
|
3666 | if (typeof lexer.yylloc == 'undefined') {
|
3667 | lexer.yylloc = {};
|
3668 | }
|
3669 | var yyloc = lexer.yylloc;
|
3670 | lstack.push(yyloc);
|
3671 | var ranges = lexer.options && lexer.options.ranges;
|
3672 | if (typeof sharedState.yy.parseError === 'function') {
|
3673 | this.parseError = sharedState.yy.parseError;
|
3674 | } else {
|
3675 | this.parseError = Object.getPrototypeOf(this).parseError;
|
3676 | }
|
3677 | function popStack(n) {
|
3678 | stack.length = stack.length - 2 * n;
|
3679 | vstack.length = vstack.length - n;
|
3680 | lstack.length = lstack.length - n;
|
3681 | }
|
3682 | function lex() {
|
3683 | var token;
|
3684 | token = tstack.pop() || lexer.lex() || EOF;
|
3685 | if (typeof token !== 'number') {
|
3686 | if (token instanceof Array) {
|
3687 | tstack = token;
|
3688 | token = tstack.pop();
|
3689 | }
|
3690 | token = self.symbols_[token] || token;
|
3691 | }
|
3692 | return token;
|
3693 | }
|
3694 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
3695 | while (true) {
|
3696 | state = stack[stack.length - 1];
|
3697 | if (this.defaultActions[state]) {
|
3698 | action = this.defaultActions[state];
|
3699 | } else {
|
3700 | if (symbol === null || typeof symbol == 'undefined') {
|
3701 | symbol = lex();
|
3702 | }
|
3703 | action = table[state] && table[state][symbol];
|
3704 | }
|
3705 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
3706 | var errStr = '';
|
3707 | expected = [];
|
3708 | for (p in table[state]) {
|
3709 | if (this.terminals_[p] && p > TERROR) {
|
3710 | expected.push('\'' + this.terminals_[p] + '\'');
|
3711 | }
|
3712 | }
|
3713 | if (lexer.showPosition) {
|
3714 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
3715 | } else {
|
3716 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
3717 | }
|
3718 | this.parseError(errStr, {
|
3719 | text: lexer.match,
|
3720 | token: this.terminals_[symbol] || symbol,
|
3721 | line: lexer.yylineno,
|
3722 | loc: yyloc,
|
3723 | expected: expected
|
3724 | });
|
3725 | }
|
3726 | if (action[0] instanceof Array && action.length > 1) {
|
3727 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
3728 | }
|
3729 | switch (action[0]) {
|
3730 | case 1:
|
3731 | stack.push(symbol);
|
3732 | vstack.push(lexer.yytext);
|
3733 | lstack.push(lexer.yylloc);
|
3734 | stack.push(action[1]);
|
3735 | symbol = null;
|
3736 | if (!preErrorSymbol) {
|
3737 | yyleng = lexer.yyleng;
|
3738 | yytext = lexer.yytext;
|
3739 | yylineno = lexer.yylineno;
|
3740 | yyloc = lexer.yylloc;
|
3741 | if (recovering > 0) {
|
3742 | recovering--;
|
3743 | }
|
3744 | } else {
|
3745 | symbol = preErrorSymbol;
|
3746 | preErrorSymbol = null;
|
3747 | }
|
3748 | break;
|
3749 | case 2:
|
3750 | len = this.productions_[action[1]][1];
|
3751 | yyval.$ = vstack[vstack.length - len];
|
3752 | yyval._$ = {
|
3753 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
3754 | last_line: lstack[lstack.length - 1].last_line,
|
3755 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
3756 | last_column: lstack[lstack.length - 1].last_column
|
3757 | };
|
3758 | if (ranges) {
|
3759 | yyval._$.range = [
|
3760 | lstack[lstack.length - (len || 1)].range[0],
|
3761 | lstack[lstack.length - 1].range[1]
|
3762 | ];
|
3763 | }
|
3764 | r = this.performAction.apply(yyval, [
|
3765 | yytext,
|
3766 | yyleng,
|
3767 | yylineno,
|
3768 | sharedState.yy,
|
3769 | action[1],
|
3770 | vstack,
|
3771 | lstack
|
3772 | ].concat(args));
|
3773 | if (typeof r !== 'undefined') {
|
3774 | return r;
|
3775 | }
|
3776 | if (len) {
|
3777 | stack = stack.slice(0, -1 * len * 2);
|
3778 | vstack = vstack.slice(0, -1 * len);
|
3779 | lstack = lstack.slice(0, -1 * len);
|
3780 | }
|
3781 | stack.push(this.productions_[action[1]][0]);
|
3782 | vstack.push(yyval.$);
|
3783 | lstack.push(yyval._$);
|
3784 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
3785 | stack.push(newState);
|
3786 | break;
|
3787 | case 3:
|
3788 | return true;
|
3789 | }
|
3790 | }
|
3791 | return true;
|
3792 | }};
|
3793 | /* generated by jison-lex 0.3.4 */
|
3794 | var lexer = (function(){
|
3795 | var lexer = ({
|
3796 |
|
3797 | EOF:1,
|
3798 |
|
3799 | parseError:function parseError(str, hash) {
|
3800 | if (this.yy.parser) {
|
3801 | this.yy.parser.parseError(str, hash);
|
3802 | } else {
|
3803 | throw new Error(str);
|
3804 | }
|
3805 | },
|
3806 |
|
3807 | // resets the lexer, sets new input
|
3808 | setInput:function (input, yy) {
|
3809 | this.yy = yy || this.yy || {};
|
3810 | this._input = input;
|
3811 | this._more = this._backtrack = this.done = false;
|
3812 | this.yylineno = this.yyleng = 0;
|
3813 | this.yytext = this.matched = this.match = '';
|
3814 | this.conditionStack = ['INITIAL'];
|
3815 | this.yylloc = {
|
3816 | first_line: 1,
|
3817 | first_column: 0,
|
3818 | last_line: 1,
|
3819 | last_column: 0
|
3820 | };
|
3821 | if (this.options.ranges) {
|
3822 | this.yylloc.range = [0,0];
|
3823 | }
|
3824 | this.offset = 0;
|
3825 | return this;
|
3826 | },
|
3827 |
|
3828 | // consumes and returns one char from the input
|
3829 | input:function () {
|
3830 | var ch = this._input[0];
|
3831 | this.yytext += ch;
|
3832 | this.yyleng++;
|
3833 | this.offset++;
|
3834 | this.match += ch;
|
3835 | this.matched += ch;
|
3836 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
3837 | if (lines) {
|
3838 | this.yylineno++;
|
3839 | this.yylloc.last_line++;
|
3840 | } else {
|
3841 | this.yylloc.last_column++;
|
3842 | }
|
3843 | if (this.options.ranges) {
|
3844 | this.yylloc.range[1]++;
|
3845 | }
|
3846 |
|
3847 | this._input = this._input.slice(1);
|
3848 | return ch;
|
3849 | },
|
3850 |
|
3851 | // unshifts one char (or a string) into the input
|
3852 | unput:function (ch) {
|
3853 | var len = ch.length;
|
3854 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
3855 |
|
3856 | this._input = ch + this._input;
|
3857 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
3858 | //this.yyleng -= len;
|
3859 | this.offset -= len;
|
3860 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
3861 | this.match = this.match.substr(0, this.match.length - 1);
|
3862 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
3863 |
|
3864 | if (lines.length - 1) {
|
3865 | this.yylineno -= lines.length - 1;
|
3866 | }
|
3867 | var r = this.yylloc.range;
|
3868 |
|
3869 | this.yylloc = {
|
3870 | first_line: this.yylloc.first_line,
|
3871 | last_line: this.yylineno + 1,
|
3872 | first_column: this.yylloc.first_column,
|
3873 | last_column: lines ?
|
3874 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
3875 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
3876 | this.yylloc.first_column - len
|
3877 | };
|
3878 |
|
3879 | if (this.options.ranges) {
|
3880 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
3881 | }
|
3882 | this.yyleng = this.yytext.length;
|
3883 | return this;
|
3884 | },
|
3885 |
|
3886 | // When called from action, caches matched text and appends it on next action
|
3887 | more:function () {
|
3888 | this._more = true;
|
3889 | return this;
|
3890 | },
|
3891 |
|
3892 | // 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.
|
3893 | reject:function () {
|
3894 | if (this.options.backtrack_lexer) {
|
3895 | this._backtrack = true;
|
3896 | } else {
|
3897 | 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(), {
|
3898 | text: "",
|
3899 | token: null,
|
3900 | line: this.yylineno
|
3901 | });
|
3902 |
|
3903 | }
|
3904 | return this;
|
3905 | },
|
3906 |
|
3907 | // retain first n characters of the match
|
3908 | less:function (n) {
|
3909 | this.unput(this.match.slice(n));
|
3910 | },
|
3911 |
|
3912 | // displays already matched input, i.e. for error messages
|
3913 | pastInput:function () {
|
3914 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
3915 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
3916 | },
|
3917 |
|
3918 | // displays upcoming input, i.e. for error messages
|
3919 | upcomingInput:function () {
|
3920 | var next = this.match;
|
3921 | if (next.length < 20) {
|
3922 | next += this._input.substr(0, 20-next.length);
|
3923 | }
|
3924 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
3925 | },
|
3926 |
|
3927 | // displays the character position where the lexing error occurred, i.e. for error messages
|
3928 | showPosition:function () {
|
3929 | var pre = this.pastInput();
|
3930 | var c = new Array(pre.length + 1).join("-");
|
3931 | return pre + this.upcomingInput() + "\n" + c + "^";
|
3932 | },
|
3933 |
|
3934 | // test the lexed token: return FALSE when not a match, otherwise return token
|
3935 | test_match:function(match, indexed_rule) {
|
3936 | var token,
|
3937 | lines,
|
3938 | backup;
|
3939 |
|
3940 | if (this.options.backtrack_lexer) {
|
3941 | // save context
|
3942 | backup = {
|
3943 | yylineno: this.yylineno,
|
3944 | yylloc: {
|
3945 | first_line: this.yylloc.first_line,
|
3946 | last_line: this.last_line,
|
3947 | first_column: this.yylloc.first_column,
|
3948 | last_column: this.yylloc.last_column
|
3949 | },
|
3950 | yytext: this.yytext,
|
3951 | match: this.match,
|
3952 | matches: this.matches,
|
3953 | matched: this.matched,
|
3954 | yyleng: this.yyleng,
|
3955 | offset: this.offset,
|
3956 | _more: this._more,
|
3957 | _input: this._input,
|
3958 | yy: this.yy,
|
3959 | conditionStack: this.conditionStack.slice(0),
|
3960 | done: this.done
|
3961 | };
|
3962 | if (this.options.ranges) {
|
3963 | backup.yylloc.range = this.yylloc.range.slice(0);
|
3964 | }
|
3965 | }
|
3966 |
|
3967 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
3968 | if (lines) {
|
3969 | this.yylineno += lines.length;
|
3970 | }
|
3971 | this.yylloc = {
|
3972 | first_line: this.yylloc.last_line,
|
3973 | last_line: this.yylineno + 1,
|
3974 | first_column: this.yylloc.last_column,
|
3975 | last_column: lines ?
|
3976 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
3977 | this.yylloc.last_column + match[0].length
|
3978 | };
|
3979 | this.yytext += match[0];
|
3980 | this.match += match[0];
|
3981 | this.matches = match;
|
3982 | this.yyleng = this.yytext.length;
|
3983 | if (this.options.ranges) {
|
3984 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
3985 | }
|
3986 | this._more = false;
|
3987 | this._backtrack = false;
|
3988 | this._input = this._input.slice(match[0].length);
|
3989 | this.matched += match[0];
|
3990 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
3991 | if (this.done && this._input) {
|
3992 | this.done = false;
|
3993 | }
|
3994 | if (token) {
|
3995 | return token;
|
3996 | } else if (this._backtrack) {
|
3997 | // recover context
|
3998 | for (var k in backup) {
|
3999 | this[k] = backup[k];
|
4000 | }
|
4001 | return false; // rule action called reject() implying the next rule should be tested instead.
|
4002 | }
|
4003 | return false;
|
4004 | },
|
4005 |
|
4006 | // return next match in input
|
4007 | next:function () {
|
4008 | if (this.done) {
|
4009 | return this.EOF;
|
4010 | }
|
4011 | if (!this._input) {
|
4012 | this.done = true;
|
4013 | }
|
4014 |
|
4015 | var token,
|
4016 | match,
|
4017 | tempMatch,
|
4018 | index;
|
4019 | if (!this._more) {
|
4020 | this.yytext = '';
|
4021 | this.match = '';
|
4022 | }
|
4023 | var rules = this._currentRules();
|
4024 | for (var i = 0; i < rules.length; i++) {
|
4025 | tempMatch = this._input.match(this.rules[rules[i]]);
|
4026 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
4027 | match = tempMatch;
|
4028 | index = i;
|
4029 | if (this.options.backtrack_lexer) {
|
4030 | token = this.test_match(tempMatch, rules[i]);
|
4031 | if (token !== false) {
|
4032 | return token;
|
4033 | } else if (this._backtrack) {
|
4034 | match = false;
|
4035 | continue; // rule action called reject() implying a rule MISmatch.
|
4036 | } else {
|
4037 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
4038 | return false;
|
4039 | }
|
4040 | } else if (!this.options.flex) {
|
4041 | break;
|
4042 | }
|
4043 | }
|
4044 | }
|
4045 | if (match) {
|
4046 | token = this.test_match(match, rules[index]);
|
4047 | if (token !== false) {
|
4048 | return token;
|
4049 | }
|
4050 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
4051 | return false;
|
4052 | }
|
4053 | if (this._input === "") {
|
4054 | return this.EOF;
|
4055 | } else {
|
4056 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
4057 | text: "",
|
4058 | token: null,
|
4059 | line: this.yylineno
|
4060 | });
|
4061 | }
|
4062 | },
|
4063 |
|
4064 | // return next match that has a token
|
4065 | lex:function lex () {
|
4066 | var r = this.next();
|
4067 | if (r) {
|
4068 | return r;
|
4069 | } else {
|
4070 | return this.lex();
|
4071 | }
|
4072 | },
|
4073 |
|
4074 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
4075 | begin:function begin (condition) {
|
4076 | this.conditionStack.push(condition);
|
4077 | },
|
4078 |
|
4079 | // pop the previously active lexer condition state off the condition stack
|
4080 | popState:function popState () {
|
4081 | var n = this.conditionStack.length - 1;
|
4082 | if (n > 0) {
|
4083 | return this.conditionStack.pop();
|
4084 | } else {
|
4085 | return this.conditionStack[0];
|
4086 | }
|
4087 | },
|
4088 |
|
4089 | // produce the lexer rule set which is active for the currently active lexer condition state
|
4090 | _currentRules:function _currentRules () {
|
4091 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
4092 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
4093 | } else {
|
4094 | return this.conditions["INITIAL"].rules;
|
4095 | }
|
4096 | },
|
4097 |
|
4098 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
4099 | topState:function topState (n) {
|
4100 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
4101 | if (n >= 0) {
|
4102 | return this.conditionStack[n];
|
4103 | } else {
|
4104 | return "INITIAL";
|
4105 | }
|
4106 | },
|
4107 |
|
4108 | // alias for begin(condition)
|
4109 | pushState:function pushState (condition) {
|
4110 | this.begin(condition);
|
4111 | },
|
4112 |
|
4113 | // return the number of states currently on the stack
|
4114 | stateStackSize:function stateStackSize() {
|
4115 | return this.conditionStack.length;
|
4116 | },
|
4117 | options: {"case-insensitive":true},
|
4118 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
4119 | var YYSTATE=YY_START;
|
4120 | switch($avoiding_name_collisions) {
|
4121 | case 0:return 12;
|
4122 | break;
|
4123 | case 1:/* skip all whitespace */
|
4124 | break;
|
4125 | case 2:/* skip comments */
|
4126 | break;
|
4127 | case 3:/* skip comments */
|
4128 | break;
|
4129 | case 4:return 4;
|
4130 | break;
|
4131 | case 5:return 15;
|
4132 | break;
|
4133 | case 6:return 17;
|
4134 | break;
|
4135 | case 7:return 20;
|
4136 | break;
|
4137 | case 8:return 21;
|
4138 | break;
|
4139 | case 9:return 19;
|
4140 | break;
|
4141 | case 10:return 8;
|
4142 | break;
|
4143 | case 11:return 8;
|
4144 | break;
|
4145 | case 12:return 5;
|
4146 | break;
|
4147 | case 13:return 26
|
4148 | break;
|
4149 | case 14:this.begin("options");
|
4150 | break;
|
4151 | case 15:this.popState();
|
4152 | break;
|
4153 | case 16:return 11;
|
4154 | break;
|
4155 | case 17:this.begin("string");
|
4156 | break;
|
4157 | case 18:this.popState();
|
4158 | break;
|
4159 | case 19:return 23;
|
4160 | break;
|
4161 | case 20:return 18;
|
4162 | break;
|
4163 | case 21:return 7;
|
4164 | break;
|
4165 | }
|
4166 | },
|
4167 | rules: [/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:gitGraph\b)/i,/^(?:commit\b)/i,/^(?:branch\b)/i,/^(?:merge\b)/i,/^(?:reset\b)/i,/^(?:checkout\b)/i,/^(?:LR\b)/i,/^(?:BT\b)/i,/^(?::)/i,/^(?:\^)/i,/^(?:options\r?\n)/i,/^(?:end\r?\n)/i,/^(?:[^\n]+\r?\n)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[a-zA-Z][-_\.a-zA-Z0-9]*[-_a-zA-Z0-9])/i,/^(?:$)/i],
|
4168 | conditions: {"options":{"rules":[15,16],"inclusive":false},"string":{"rules":[18,19],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,20,21],"inclusive":true}}
|
4169 | });
|
4170 | return lexer;
|
4171 | })();
|
4172 | parser.lexer = lexer;
|
4173 | function Parser () {
|
4174 | this.yy = {};
|
4175 | }
|
4176 | Parser.prototype = parser;parser.Parser = Parser;
|
4177 | return new Parser;
|
4178 | })();
|
4179 |
|
4180 |
|
4181 | if (true) {
|
4182 | exports.parser = parser;
|
4183 | exports.Parser = parser.Parser;
|
4184 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
4185 | exports.main = function commonjsMain (args) {
|
4186 | if (!args[1]) {
|
4187 | console.log('Usage: '+args[0]+' FILE');
|
4188 | process.exit(1);
|
4189 | }
|
4190 | var source = __webpack_require__(/*! fs */ "?2b40").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
|
4191 | return exports.parser.parse(source);
|
4192 | };
|
4193 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
4194 | exports.main(process.argv.slice(1));
|
4195 | }
|
4196 | }
|
4197 |
|
4198 | /***/ }),
|
4199 |
|
4200 | /***/ "./src/diagrams/info/parser/info.jison":
|
4201 | /*!*********************************************!*\
|
4202 | !*** ./src/diagrams/info/parser/info.jison ***!
|
4203 | \*********************************************/
|
4204 | /***/ ((module, exports, __webpack_require__) => {
|
4205 |
|
4206 | /* module decorator */ module = __webpack_require__.nmd(module);
|
4207 | /* parser generated by jison 0.4.18 */
|
4208 | /*
|
4209 | Returns a Parser object of the following structure:
|
4210 |
|
4211 | Parser: {
|
4212 | yy: {}
|
4213 | }
|
4214 |
|
4215 | Parser.prototype: {
|
4216 | yy: {},
|
4217 | trace: function(),
|
4218 | symbols_: {associative list: name ==> number},
|
4219 | terminals_: {associative list: number ==> name},
|
4220 | productions_: [...],
|
4221 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
4222 | table: [...],
|
4223 | defaultActions: {...},
|
4224 | parseError: function(str, hash),
|
4225 | parse: function(input),
|
4226 |
|
4227 | lexer: {
|
4228 | EOF: 1,
|
4229 | parseError: function(str, hash),
|
4230 | setInput: function(input),
|
4231 | input: function(),
|
4232 | unput: function(str),
|
4233 | more: function(),
|
4234 | less: function(n),
|
4235 | pastInput: function(),
|
4236 | upcomingInput: function(),
|
4237 | showPosition: function(),
|
4238 | test_match: function(regex_match_array, rule_index),
|
4239 | next: function(),
|
4240 | lex: function(),
|
4241 | begin: function(condition),
|
4242 | popState: function(),
|
4243 | _currentRules: function(),
|
4244 | topState: function(),
|
4245 | pushState: function(condition),
|
4246 |
|
4247 | options: {
|
4248 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
4249 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
4250 | 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)
|
4251 | },
|
4252 |
|
4253 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
4254 | rules: [...],
|
4255 | conditions: {associative list: name ==> set},
|
4256 | }
|
4257 | }
|
4258 |
|
4259 |
|
4260 | token location info (@$, _$, etc.): {
|
4261 | first_line: n,
|
4262 | last_line: n,
|
4263 | first_column: n,
|
4264 | last_column: n,
|
4265 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
4266 | }
|
4267 |
|
4268 |
|
4269 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
4270 | text: (matched text)
|
4271 | token: (the produced terminal token, if any)
|
4272 | line: (yylineno)
|
4273 | }
|
4274 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
4275 | loc: (yylloc)
|
4276 | expected: (string describing the set of expected tokens)
|
4277 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
4278 | }
|
4279 | */
|
4280 | var parser = (function(){
|
4281 | var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,9,10];
|
4282 | var parser = {trace: function trace () { },
|
4283 | yy: {},
|
4284 | symbols_: {"error":2,"start":3,"info":4,"document":5,"EOF":6,"line":7,"statement":8,"NL":9,"showInfo":10,"$accept":0,"$end":1},
|
4285 | terminals_: {2:"error",4:"info",6:"EOF",9:"NL",10:"showInfo"},
|
4286 | productions_: [0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],
|
4287 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
4288 | /* this == yyval */
|
4289 |
|
4290 | var $0 = $$.length - 1;
|
4291 | switch (yystate) {
|
4292 | case 1:
|
4293 | return yy;
|
4294 | break;
|
4295 | case 4:
|
4296 |
|
4297 | break;
|
4298 | case 6:
|
4299 | yy.setInfo(true);
|
4300 | break;
|
4301 | }
|
4302 | },
|
4303 | 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])],
|
4304 | defaultActions: {4:[2,1]},
|
4305 | parseError: function parseError (str, hash) {
|
4306 | if (hash.recoverable) {
|
4307 | this.trace(str);
|
4308 | } else {
|
4309 | var error = new Error(str);
|
4310 | error.hash = hash;
|
4311 | throw error;
|
4312 | }
|
4313 | },
|
4314 | parse: function parse(input) {
|
4315 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
4316 | var args = lstack.slice.call(arguments, 1);
|
4317 | var lexer = Object.create(this.lexer);
|
4318 | var sharedState = { yy: {} };
|
4319 | for (var k in this.yy) {
|
4320 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
4321 | sharedState.yy[k] = this.yy[k];
|
4322 | }
|
4323 | }
|
4324 | lexer.setInput(input, sharedState.yy);
|
4325 | sharedState.yy.lexer = lexer;
|
4326 | sharedState.yy.parser = this;
|
4327 | if (typeof lexer.yylloc == 'undefined') {
|
4328 | lexer.yylloc = {};
|
4329 | }
|
4330 | var yyloc = lexer.yylloc;
|
4331 | lstack.push(yyloc);
|
4332 | var ranges = lexer.options && lexer.options.ranges;
|
4333 | if (typeof sharedState.yy.parseError === 'function') {
|
4334 | this.parseError = sharedState.yy.parseError;
|
4335 | } else {
|
4336 | this.parseError = Object.getPrototypeOf(this).parseError;
|
4337 | }
|
4338 | function popStack(n) {
|
4339 | stack.length = stack.length - 2 * n;
|
4340 | vstack.length = vstack.length - n;
|
4341 | lstack.length = lstack.length - n;
|
4342 | }
|
4343 | function lex() {
|
4344 | var token;
|
4345 | token = tstack.pop() || lexer.lex() || EOF;
|
4346 | if (typeof token !== 'number') {
|
4347 | if (token instanceof Array) {
|
4348 | tstack = token;
|
4349 | token = tstack.pop();
|
4350 | }
|
4351 | token = self.symbols_[token] || token;
|
4352 | }
|
4353 | return token;
|
4354 | }
|
4355 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
4356 | while (true) {
|
4357 | state = stack[stack.length - 1];
|
4358 | if (this.defaultActions[state]) {
|
4359 | action = this.defaultActions[state];
|
4360 | } else {
|
4361 | if (symbol === null || typeof symbol == 'undefined') {
|
4362 | symbol = lex();
|
4363 | }
|
4364 | action = table[state] && table[state][symbol];
|
4365 | }
|
4366 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
4367 | var errStr = '';
|
4368 | expected = [];
|
4369 | for (p in table[state]) {
|
4370 | if (this.terminals_[p] && p > TERROR) {
|
4371 | expected.push('\'' + this.terminals_[p] + '\'');
|
4372 | }
|
4373 | }
|
4374 | if (lexer.showPosition) {
|
4375 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
4376 | } else {
|
4377 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
4378 | }
|
4379 | this.parseError(errStr, {
|
4380 | text: lexer.match,
|
4381 | token: this.terminals_[symbol] || symbol,
|
4382 | line: lexer.yylineno,
|
4383 | loc: yyloc,
|
4384 | expected: expected
|
4385 | });
|
4386 | }
|
4387 | if (action[0] instanceof Array && action.length > 1) {
|
4388 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
4389 | }
|
4390 | switch (action[0]) {
|
4391 | case 1:
|
4392 | stack.push(symbol);
|
4393 | vstack.push(lexer.yytext);
|
4394 | lstack.push(lexer.yylloc);
|
4395 | stack.push(action[1]);
|
4396 | symbol = null;
|
4397 | if (!preErrorSymbol) {
|
4398 | yyleng = lexer.yyleng;
|
4399 | yytext = lexer.yytext;
|
4400 | yylineno = lexer.yylineno;
|
4401 | yyloc = lexer.yylloc;
|
4402 | if (recovering > 0) {
|
4403 | recovering--;
|
4404 | }
|
4405 | } else {
|
4406 | symbol = preErrorSymbol;
|
4407 | preErrorSymbol = null;
|
4408 | }
|
4409 | break;
|
4410 | case 2:
|
4411 | len = this.productions_[action[1]][1];
|
4412 | yyval.$ = vstack[vstack.length - len];
|
4413 | yyval._$ = {
|
4414 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
4415 | last_line: lstack[lstack.length - 1].last_line,
|
4416 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
4417 | last_column: lstack[lstack.length - 1].last_column
|
4418 | };
|
4419 | if (ranges) {
|
4420 | yyval._$.range = [
|
4421 | lstack[lstack.length - (len || 1)].range[0],
|
4422 | lstack[lstack.length - 1].range[1]
|
4423 | ];
|
4424 | }
|
4425 | r = this.performAction.apply(yyval, [
|
4426 | yytext,
|
4427 | yyleng,
|
4428 | yylineno,
|
4429 | sharedState.yy,
|
4430 | action[1],
|
4431 | vstack,
|
4432 | lstack
|
4433 | ].concat(args));
|
4434 | if (typeof r !== 'undefined') {
|
4435 | return r;
|
4436 | }
|
4437 | if (len) {
|
4438 | stack = stack.slice(0, -1 * len * 2);
|
4439 | vstack = vstack.slice(0, -1 * len);
|
4440 | lstack = lstack.slice(0, -1 * len);
|
4441 | }
|
4442 | stack.push(this.productions_[action[1]][0]);
|
4443 | vstack.push(yyval.$);
|
4444 | lstack.push(yyval._$);
|
4445 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
4446 | stack.push(newState);
|
4447 | break;
|
4448 | case 3:
|
4449 | return true;
|
4450 | }
|
4451 | }
|
4452 | return true;
|
4453 | }};
|
4454 |
|
4455 | /* generated by jison-lex 0.3.4 */
|
4456 | var lexer = (function(){
|
4457 | var lexer = ({
|
4458 |
|
4459 | EOF:1,
|
4460 |
|
4461 | parseError:function parseError(str, hash) {
|
4462 | if (this.yy.parser) {
|
4463 | this.yy.parser.parseError(str, hash);
|
4464 | } else {
|
4465 | throw new Error(str);
|
4466 | }
|
4467 | },
|
4468 |
|
4469 | // resets the lexer, sets new input
|
4470 | setInput:function (input, yy) {
|
4471 | this.yy = yy || this.yy || {};
|
4472 | this._input = input;
|
4473 | this._more = this._backtrack = this.done = false;
|
4474 | this.yylineno = this.yyleng = 0;
|
4475 | this.yytext = this.matched = this.match = '';
|
4476 | this.conditionStack = ['INITIAL'];
|
4477 | this.yylloc = {
|
4478 | first_line: 1,
|
4479 | first_column: 0,
|
4480 | last_line: 1,
|
4481 | last_column: 0
|
4482 | };
|
4483 | if (this.options.ranges) {
|
4484 | this.yylloc.range = [0,0];
|
4485 | }
|
4486 | this.offset = 0;
|
4487 | return this;
|
4488 | },
|
4489 |
|
4490 | // consumes and returns one char from the input
|
4491 | input:function () {
|
4492 | var ch = this._input[0];
|
4493 | this.yytext += ch;
|
4494 | this.yyleng++;
|
4495 | this.offset++;
|
4496 | this.match += ch;
|
4497 | this.matched += ch;
|
4498 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
4499 | if (lines) {
|
4500 | this.yylineno++;
|
4501 | this.yylloc.last_line++;
|
4502 | } else {
|
4503 | this.yylloc.last_column++;
|
4504 | }
|
4505 | if (this.options.ranges) {
|
4506 | this.yylloc.range[1]++;
|
4507 | }
|
4508 |
|
4509 | this._input = this._input.slice(1);
|
4510 | return ch;
|
4511 | },
|
4512 |
|
4513 | // unshifts one char (or a string) into the input
|
4514 | unput:function (ch) {
|
4515 | var len = ch.length;
|
4516 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
4517 |
|
4518 | this._input = ch + this._input;
|
4519 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
4520 | //this.yyleng -= len;
|
4521 | this.offset -= len;
|
4522 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
4523 | this.match = this.match.substr(0, this.match.length - 1);
|
4524 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
4525 |
|
4526 | if (lines.length - 1) {
|
4527 | this.yylineno -= lines.length - 1;
|
4528 | }
|
4529 | var r = this.yylloc.range;
|
4530 |
|
4531 | this.yylloc = {
|
4532 | first_line: this.yylloc.first_line,
|
4533 | last_line: this.yylineno + 1,
|
4534 | first_column: this.yylloc.first_column,
|
4535 | last_column: lines ?
|
4536 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
4537 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
4538 | this.yylloc.first_column - len
|
4539 | };
|
4540 |
|
4541 | if (this.options.ranges) {
|
4542 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
4543 | }
|
4544 | this.yyleng = this.yytext.length;
|
4545 | return this;
|
4546 | },
|
4547 |
|
4548 | // When called from action, caches matched text and appends it on next action
|
4549 | more:function () {
|
4550 | this._more = true;
|
4551 | return this;
|
4552 | },
|
4553 |
|
4554 | // 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.
|
4555 | reject:function () {
|
4556 | if (this.options.backtrack_lexer) {
|
4557 | this._backtrack = true;
|
4558 | } else {
|
4559 | 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(), {
|
4560 | text: "",
|
4561 | token: null,
|
4562 | line: this.yylineno
|
4563 | });
|
4564 |
|
4565 | }
|
4566 | return this;
|
4567 | },
|
4568 |
|
4569 | // retain first n characters of the match
|
4570 | less:function (n) {
|
4571 | this.unput(this.match.slice(n));
|
4572 | },
|
4573 |
|
4574 | // displays already matched input, i.e. for error messages
|
4575 | pastInput:function () {
|
4576 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
4577 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
4578 | },
|
4579 |
|
4580 | // displays upcoming input, i.e. for error messages
|
4581 | upcomingInput:function () {
|
4582 | var next = this.match;
|
4583 | if (next.length < 20) {
|
4584 | next += this._input.substr(0, 20-next.length);
|
4585 | }
|
4586 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
4587 | },
|
4588 |
|
4589 | // displays the character position where the lexing error occurred, i.e. for error messages
|
4590 | showPosition:function () {
|
4591 | var pre = this.pastInput();
|
4592 | var c = new Array(pre.length + 1).join("-");
|
4593 | return pre + this.upcomingInput() + "\n" + c + "^";
|
4594 | },
|
4595 |
|
4596 | // test the lexed token: return FALSE when not a match, otherwise return token
|
4597 | test_match:function(match, indexed_rule) {
|
4598 | var token,
|
4599 | lines,
|
4600 | backup;
|
4601 |
|
4602 | if (this.options.backtrack_lexer) {
|
4603 | // save context
|
4604 | backup = {
|
4605 | yylineno: this.yylineno,
|
4606 | yylloc: {
|
4607 | first_line: this.yylloc.first_line,
|
4608 | last_line: this.last_line,
|
4609 | first_column: this.yylloc.first_column,
|
4610 | last_column: this.yylloc.last_column
|
4611 | },
|
4612 | yytext: this.yytext,
|
4613 | match: this.match,
|
4614 | matches: this.matches,
|
4615 | matched: this.matched,
|
4616 | yyleng: this.yyleng,
|
4617 | offset: this.offset,
|
4618 | _more: this._more,
|
4619 | _input: this._input,
|
4620 | yy: this.yy,
|
4621 | conditionStack: this.conditionStack.slice(0),
|
4622 | done: this.done
|
4623 | };
|
4624 | if (this.options.ranges) {
|
4625 | backup.yylloc.range = this.yylloc.range.slice(0);
|
4626 | }
|
4627 | }
|
4628 |
|
4629 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
4630 | if (lines) {
|
4631 | this.yylineno += lines.length;
|
4632 | }
|
4633 | this.yylloc = {
|
4634 | first_line: this.yylloc.last_line,
|
4635 | last_line: this.yylineno + 1,
|
4636 | first_column: this.yylloc.last_column,
|
4637 | last_column: lines ?
|
4638 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
4639 | this.yylloc.last_column + match[0].length
|
4640 | };
|
4641 | this.yytext += match[0];
|
4642 | this.match += match[0];
|
4643 | this.matches = match;
|
4644 | this.yyleng = this.yytext.length;
|
4645 | if (this.options.ranges) {
|
4646 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
4647 | }
|
4648 | this._more = false;
|
4649 | this._backtrack = false;
|
4650 | this._input = this._input.slice(match[0].length);
|
4651 | this.matched += match[0];
|
4652 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
4653 | if (this.done && this._input) {
|
4654 | this.done = false;
|
4655 | }
|
4656 | if (token) {
|
4657 | return token;
|
4658 | } else if (this._backtrack) {
|
4659 | // recover context
|
4660 | for (var k in backup) {
|
4661 | this[k] = backup[k];
|
4662 | }
|
4663 | return false; // rule action called reject() implying the next rule should be tested instead.
|
4664 | }
|
4665 | return false;
|
4666 | },
|
4667 |
|
4668 | // return next match in input
|
4669 | next:function () {
|
4670 | if (this.done) {
|
4671 | return this.EOF;
|
4672 | }
|
4673 | if (!this._input) {
|
4674 | this.done = true;
|
4675 | }
|
4676 |
|
4677 | var token,
|
4678 | match,
|
4679 | tempMatch,
|
4680 | index;
|
4681 | if (!this._more) {
|
4682 | this.yytext = '';
|
4683 | this.match = '';
|
4684 | }
|
4685 | var rules = this._currentRules();
|
4686 | for (var i = 0; i < rules.length; i++) {
|
4687 | tempMatch = this._input.match(this.rules[rules[i]]);
|
4688 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
4689 | match = tempMatch;
|
4690 | index = i;
|
4691 | if (this.options.backtrack_lexer) {
|
4692 | token = this.test_match(tempMatch, rules[i]);
|
4693 | if (token !== false) {
|
4694 | return token;
|
4695 | } else if (this._backtrack) {
|
4696 | match = false;
|
4697 | continue; // rule action called reject() implying a rule MISmatch.
|
4698 | } else {
|
4699 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
4700 | return false;
|
4701 | }
|
4702 | } else if (!this.options.flex) {
|
4703 | break;
|
4704 | }
|
4705 | }
|
4706 | }
|
4707 | if (match) {
|
4708 | token = this.test_match(match, rules[index]);
|
4709 | if (token !== false) {
|
4710 | return token;
|
4711 | }
|
4712 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
4713 | return false;
|
4714 | }
|
4715 | if (this._input === "") {
|
4716 | return this.EOF;
|
4717 | } else {
|
4718 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
4719 | text: "",
|
4720 | token: null,
|
4721 | line: this.yylineno
|
4722 | });
|
4723 | }
|
4724 | },
|
4725 |
|
4726 | // return next match that has a token
|
4727 | lex:function lex () {
|
4728 | var r = this.next();
|
4729 | if (r) {
|
4730 | return r;
|
4731 | } else {
|
4732 | return this.lex();
|
4733 | }
|
4734 | },
|
4735 |
|
4736 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
4737 | begin:function begin (condition) {
|
4738 | this.conditionStack.push(condition);
|
4739 | },
|
4740 |
|
4741 | // pop the previously active lexer condition state off the condition stack
|
4742 | popState:function popState () {
|
4743 | var n = this.conditionStack.length - 1;
|
4744 | if (n > 0) {
|
4745 | return this.conditionStack.pop();
|
4746 | } else {
|
4747 | return this.conditionStack[0];
|
4748 | }
|
4749 | },
|
4750 |
|
4751 | // produce the lexer rule set which is active for the currently active lexer condition state
|
4752 | _currentRules:function _currentRules () {
|
4753 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
4754 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
4755 | } else {
|
4756 | return this.conditions["INITIAL"].rules;
|
4757 | }
|
4758 | },
|
4759 |
|
4760 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
4761 | topState:function topState (n) {
|
4762 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
4763 | if (n >= 0) {
|
4764 | return this.conditionStack[n];
|
4765 | } else {
|
4766 | return "INITIAL";
|
4767 | }
|
4768 | },
|
4769 |
|
4770 | // alias for begin(condition)
|
4771 | pushState:function pushState (condition) {
|
4772 | this.begin(condition);
|
4773 | },
|
4774 |
|
4775 | // return the number of states currently on the stack
|
4776 | stateStackSize:function stateStackSize() {
|
4777 | return this.conditionStack.length;
|
4778 | },
|
4779 | options: {"case-insensitive":true},
|
4780 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
4781 | // Pre-lexer code can go here
|
4782 |
|
4783 | var YYSTATE=YY_START;
|
4784 | switch($avoiding_name_collisions) {
|
4785 | case 0:return 4 ;
|
4786 | break;
|
4787 | case 1:return 9 ;
|
4788 | break;
|
4789 | case 2:return 'space';
|
4790 | break;
|
4791 | case 3:return 10;
|
4792 | break;
|
4793 | case 4:return 6 ;
|
4794 | break;
|
4795 | case 5:return 'TXT' ;
|
4796 | break;
|
4797 | }
|
4798 | },
|
4799 | rules: [/^(?:info\b)/i,/^(?:[\s\n\r]+)/i,/^(?:[\s]+)/i,/^(?:showInfo\b)/i,/^(?:$)/i,/^(?:.)/i],
|
4800 | conditions: {"INITIAL":{"rules":[0,1,2,3,4,5],"inclusive":true}}
|
4801 | });
|
4802 | return lexer;
|
4803 | })();
|
4804 | parser.lexer = lexer;
|
4805 | function Parser () {
|
4806 | this.yy = {};
|
4807 | }
|
4808 | Parser.prototype = parser;parser.Parser = Parser;
|
4809 | return new Parser;
|
4810 | })();
|
4811 |
|
4812 |
|
4813 | if (true) {
|
4814 | exports.parser = parser;
|
4815 | exports.Parser = parser.Parser;
|
4816 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
4817 | exports.main = function commonjsMain (args) {
|
4818 | if (!args[1]) {
|
4819 | console.log('Usage: '+args[0]+' FILE');
|
4820 | process.exit(1);
|
4821 | }
|
4822 | var source = __webpack_require__(/*! fs */ "?c5f1").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
|
4823 | return exports.parser.parse(source);
|
4824 | };
|
4825 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
4826 | exports.main(process.argv.slice(1));
|
4827 | }
|
4828 | }
|
4829 |
|
4830 | /***/ }),
|
4831 |
|
4832 | /***/ "./src/diagrams/pie/parser/pie.jison":
|
4833 | /*!*******************************************!*\
|
4834 | !*** ./src/diagrams/pie/parser/pie.jison ***!
|
4835 | \*******************************************/
|
4836 | /***/ ((module, exports, __webpack_require__) => {
|
4837 |
|
4838 | /* module decorator */ module = __webpack_require__.nmd(module);
|
4839 | /* parser generated by jison 0.4.18 */
|
4840 | /*
|
4841 | Returns a Parser object of the following structure:
|
4842 |
|
4843 | Parser: {
|
4844 | yy: {}
|
4845 | }
|
4846 |
|
4847 | Parser.prototype: {
|
4848 | yy: {},
|
4849 | trace: function(),
|
4850 | symbols_: {associative list: name ==> number},
|
4851 | terminals_: {associative list: number ==> name},
|
4852 | productions_: [...],
|
4853 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
4854 | table: [...],
|
4855 | defaultActions: {...},
|
4856 | parseError: function(str, hash),
|
4857 | parse: function(input),
|
4858 |
|
4859 | lexer: {
|
4860 | EOF: 1,
|
4861 | parseError: function(str, hash),
|
4862 | setInput: function(input),
|
4863 | input: function(),
|
4864 | unput: function(str),
|
4865 | more: function(),
|
4866 | less: function(n),
|
4867 | pastInput: function(),
|
4868 | upcomingInput: function(),
|
4869 | showPosition: function(),
|
4870 | test_match: function(regex_match_array, rule_index),
|
4871 | next: function(),
|
4872 | lex: function(),
|
4873 | begin: function(condition),
|
4874 | popState: function(),
|
4875 | _currentRules: function(),
|
4876 | topState: function(),
|
4877 | pushState: function(condition),
|
4878 |
|
4879 | options: {
|
4880 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
4881 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
4882 | 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)
|
4883 | },
|
4884 |
|
4885 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
4886 | rules: [...],
|
4887 | conditions: {associative list: name ==> set},
|
4888 | }
|
4889 | }
|
4890 |
|
4891 |
|
4892 | token location info (@$, _$, etc.): {
|
4893 | first_line: n,
|
4894 | last_line: n,
|
4895 | first_column: n,
|
4896 | last_column: n,
|
4897 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
4898 | }
|
4899 |
|
4900 |
|
4901 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
4902 | text: (matched text)
|
4903 | token: (the produced terminal token, if any)
|
4904 | line: (yylineno)
|
4905 | }
|
4906 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
4907 | loc: (yylloc)
|
4908 | expected: (string describing the set of expected tokens)
|
4909 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
4910 | }
|
4911 | */
|
4912 | var parser = (function(){
|
4913 | 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,20,21,22,23],$V6=[2,5],$V7=[1,6,11,13,20,21,22,23],$V8=[20,21,22],$V9=[2,8],$Va=[1,18],$Vb=[1,19],$Vc=[1,24],$Vd=[6,20,21,22,23];
|
4914 | var parser = {trace: function trace () { },
|
4915 | yy: {},
|
4916 | 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,"openDirective":15,"typeDirective":16,"closeDirective":17,":":18,"argDirective":19,"NEWLINE":20,";":21,"EOF":22,"open_directive":23,"type_directive":24,"arg_directive":25,"close_directive":26,"$accept":0,"$end":1},
|
4917 | terminals_: {2:"error",6:"PIE",8:"showData",11:"txt",12:"value",13:"title",14:"title_value",18:":",20:"NEWLINE",21:";",22:"EOF",23:"open_directive",24:"type_directive",25:"arg_directive",26:"close_directive"},
|
4918 | productions_: [0,[3,2],[3,2],[3,2],[3,3],[7,0],[7,2],[9,2],[10,0],[10,2],[10,2],[10,1],[5,3],[5,5],[4,1],[4,1],[4,1],[15,1],[16,1],[19,1],[17,1]],
|
4919 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
4920 | /* this == yyval */
|
4921 |
|
4922 | var $0 = $$.length - 1;
|
4923 | switch (yystate) {
|
4924 | case 4:
|
4925 | yy.setShowData(true);
|
4926 | break;
|
4927 | case 7:
|
4928 | this.$ = $$[$0-1]
|
4929 | break;
|
4930 | case 9:
|
4931 | yy.addSection($$[$0-1],yy.cleanupValue($$[$0]));
|
4932 | break;
|
4933 | case 10:
|
4934 | this.$=$$[$0].trim();yy.setTitle(this.$);
|
4935 | break;
|
4936 | case 17:
|
4937 | yy.parseDirective('%%{', 'open_directive');
|
4938 | break;
|
4939 | case 18:
|
4940 | yy.parseDirective($$[$0], 'type_directive');
|
4941 | break;
|
4942 | case 19:
|
4943 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
4944 | break;
|
4945 | case 20:
|
4946 | yy.parseDirective('}%%', 'close_directive', 'pie');
|
4947 | break;
|
4948 | }
|
4949 | },
|
4950 | table: [{3:1,4:2,5:3,6:$V0,15:8,20:$V1,21:$V2,22:$V3,23:$V4},{1:[3]},{3:10,4:2,5:3,6:$V0,15:8,20:$V1,21:$V2,22:$V3,23:$V4},{3:11,4:2,5:3,6:$V0,15:8,20:$V1,21:$V2,22:$V3,23:$V4},o($V5,$V6,{7:12,8:[1,13]}),o($V7,[2,14]),o($V7,[2,15]),o($V7,[2,16]),{16:14,24:[1,15]},{24:[2,17]},{1:[2,1]},{1:[2,2]},o($V8,$V9,{15:8,9:16,10:17,5:20,1:[2,3],11:$Va,13:$Vb,23:$V4}),o($V5,$V6,{7:21}),{17:22,18:[1,23],26:$Vc},o([18,26],[2,18]),o($V5,[2,6]),{4:25,20:$V1,21:$V2,22:$V3},{12:[1,26]},{14:[1,27]},o($V8,[2,11]),o($V8,$V9,{15:8,9:16,10:17,5:20,1:[2,4],11:$Va,13:$Vb,23:$V4}),o($Vd,[2,12]),{19:28,25:[1,29]},o($Vd,[2,20]),o($V5,[2,7]),o($V8,[2,9]),o($V8,[2,10]),{17:30,26:$Vc},{26:[2,19]},o($Vd,[2,13])],
|
4951 | defaultActions: {9:[2,17],10:[2,1],11:[2,2],29:[2,19]},
|
4952 | parseError: function parseError (str, hash) {
|
4953 | if (hash.recoverable) {
|
4954 | this.trace(str);
|
4955 | } else {
|
4956 | var error = new Error(str);
|
4957 | error.hash = hash;
|
4958 | throw error;
|
4959 | }
|
4960 | },
|
4961 | parse: function parse(input) {
|
4962 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
4963 | var args = lstack.slice.call(arguments, 1);
|
4964 | var lexer = Object.create(this.lexer);
|
4965 | var sharedState = { yy: {} };
|
4966 | for (var k in this.yy) {
|
4967 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
4968 | sharedState.yy[k] = this.yy[k];
|
4969 | }
|
4970 | }
|
4971 | lexer.setInput(input, sharedState.yy);
|
4972 | sharedState.yy.lexer = lexer;
|
4973 | sharedState.yy.parser = this;
|
4974 | if (typeof lexer.yylloc == 'undefined') {
|
4975 | lexer.yylloc = {};
|
4976 | }
|
4977 | var yyloc = lexer.yylloc;
|
4978 | lstack.push(yyloc);
|
4979 | var ranges = lexer.options && lexer.options.ranges;
|
4980 | if (typeof sharedState.yy.parseError === 'function') {
|
4981 | this.parseError = sharedState.yy.parseError;
|
4982 | } else {
|
4983 | this.parseError = Object.getPrototypeOf(this).parseError;
|
4984 | }
|
4985 | function popStack(n) {
|
4986 | stack.length = stack.length - 2 * n;
|
4987 | vstack.length = vstack.length - n;
|
4988 | lstack.length = lstack.length - n;
|
4989 | }
|
4990 | function lex() {
|
4991 | var token;
|
4992 | token = tstack.pop() || lexer.lex() || EOF;
|
4993 | if (typeof token !== 'number') {
|
4994 | if (token instanceof Array) {
|
4995 | tstack = token;
|
4996 | token = tstack.pop();
|
4997 | }
|
4998 | token = self.symbols_[token] || token;
|
4999 | }
|
5000 | return token;
|
5001 | }
|
5002 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
5003 | while (true) {
|
5004 | state = stack[stack.length - 1];
|
5005 | if (this.defaultActions[state]) {
|
5006 | action = this.defaultActions[state];
|
5007 | } else {
|
5008 | if (symbol === null || typeof symbol == 'undefined') {
|
5009 | symbol = lex();
|
5010 | }
|
5011 | action = table[state] && table[state][symbol];
|
5012 | }
|
5013 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
5014 | var errStr = '';
|
5015 | expected = [];
|
5016 | for (p in table[state]) {
|
5017 | if (this.terminals_[p] && p > TERROR) {
|
5018 | expected.push('\'' + this.terminals_[p] + '\'');
|
5019 | }
|
5020 | }
|
5021 | if (lexer.showPosition) {
|
5022 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
5023 | } else {
|
5024 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
5025 | }
|
5026 | this.parseError(errStr, {
|
5027 | text: lexer.match,
|
5028 | token: this.terminals_[symbol] || symbol,
|
5029 | line: lexer.yylineno,
|
5030 | loc: yyloc,
|
5031 | expected: expected
|
5032 | });
|
5033 | }
|
5034 | if (action[0] instanceof Array && action.length > 1) {
|
5035 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
5036 | }
|
5037 | switch (action[0]) {
|
5038 | case 1:
|
5039 | stack.push(symbol);
|
5040 | vstack.push(lexer.yytext);
|
5041 | lstack.push(lexer.yylloc);
|
5042 | stack.push(action[1]);
|
5043 | symbol = null;
|
5044 | if (!preErrorSymbol) {
|
5045 | yyleng = lexer.yyleng;
|
5046 | yytext = lexer.yytext;
|
5047 | yylineno = lexer.yylineno;
|
5048 | yyloc = lexer.yylloc;
|
5049 | if (recovering > 0) {
|
5050 | recovering--;
|
5051 | }
|
5052 | } else {
|
5053 | symbol = preErrorSymbol;
|
5054 | preErrorSymbol = null;
|
5055 | }
|
5056 | break;
|
5057 | case 2:
|
5058 | len = this.productions_[action[1]][1];
|
5059 | yyval.$ = vstack[vstack.length - len];
|
5060 | yyval._$ = {
|
5061 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
5062 | last_line: lstack[lstack.length - 1].last_line,
|
5063 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
5064 | last_column: lstack[lstack.length - 1].last_column
|
5065 | };
|
5066 | if (ranges) {
|
5067 | yyval._$.range = [
|
5068 | lstack[lstack.length - (len || 1)].range[0],
|
5069 | lstack[lstack.length - 1].range[1]
|
5070 | ];
|
5071 | }
|
5072 | r = this.performAction.apply(yyval, [
|
5073 | yytext,
|
5074 | yyleng,
|
5075 | yylineno,
|
5076 | sharedState.yy,
|
5077 | action[1],
|
5078 | vstack,
|
5079 | lstack
|
5080 | ].concat(args));
|
5081 | if (typeof r !== 'undefined') {
|
5082 | return r;
|
5083 | }
|
5084 | if (len) {
|
5085 | stack = stack.slice(0, -1 * len * 2);
|
5086 | vstack = vstack.slice(0, -1 * len);
|
5087 | lstack = lstack.slice(0, -1 * len);
|
5088 | }
|
5089 | stack.push(this.productions_[action[1]][0]);
|
5090 | vstack.push(yyval.$);
|
5091 | lstack.push(yyval._$);
|
5092 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
5093 | stack.push(newState);
|
5094 | break;
|
5095 | case 3:
|
5096 | return true;
|
5097 | }
|
5098 | }
|
5099 | return true;
|
5100 | }};
|
5101 |
|
5102 | /* generated by jison-lex 0.3.4 */
|
5103 | var lexer = (function(){
|
5104 | var lexer = ({
|
5105 |
|
5106 | EOF:1,
|
5107 |
|
5108 | parseError:function parseError(str, hash) {
|
5109 | if (this.yy.parser) {
|
5110 | this.yy.parser.parseError(str, hash);
|
5111 | } else {
|
5112 | throw new Error(str);
|
5113 | }
|
5114 | },
|
5115 |
|
5116 | // resets the lexer, sets new input
|
5117 | setInput:function (input, yy) {
|
5118 | this.yy = yy || this.yy || {};
|
5119 | this._input = input;
|
5120 | this._more = this._backtrack = this.done = false;
|
5121 | this.yylineno = this.yyleng = 0;
|
5122 | this.yytext = this.matched = this.match = '';
|
5123 | this.conditionStack = ['INITIAL'];
|
5124 | this.yylloc = {
|
5125 | first_line: 1,
|
5126 | first_column: 0,
|
5127 | last_line: 1,
|
5128 | last_column: 0
|
5129 | };
|
5130 | if (this.options.ranges) {
|
5131 | this.yylloc.range = [0,0];
|
5132 | }
|
5133 | this.offset = 0;
|
5134 | return this;
|
5135 | },
|
5136 |
|
5137 | // consumes and returns one char from the input
|
5138 | input:function () {
|
5139 | var ch = this._input[0];
|
5140 | this.yytext += ch;
|
5141 | this.yyleng++;
|
5142 | this.offset++;
|
5143 | this.match += ch;
|
5144 | this.matched += ch;
|
5145 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
5146 | if (lines) {
|
5147 | this.yylineno++;
|
5148 | this.yylloc.last_line++;
|
5149 | } else {
|
5150 | this.yylloc.last_column++;
|
5151 | }
|
5152 | if (this.options.ranges) {
|
5153 | this.yylloc.range[1]++;
|
5154 | }
|
5155 |
|
5156 | this._input = this._input.slice(1);
|
5157 | return ch;
|
5158 | },
|
5159 |
|
5160 | // unshifts one char (or a string) into the input
|
5161 | unput:function (ch) {
|
5162 | var len = ch.length;
|
5163 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
5164 |
|
5165 | this._input = ch + this._input;
|
5166 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
5167 | //this.yyleng -= len;
|
5168 | this.offset -= len;
|
5169 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
5170 | this.match = this.match.substr(0, this.match.length - 1);
|
5171 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
5172 |
|
5173 | if (lines.length - 1) {
|
5174 | this.yylineno -= lines.length - 1;
|
5175 | }
|
5176 | var r = this.yylloc.range;
|
5177 |
|
5178 | this.yylloc = {
|
5179 | first_line: this.yylloc.first_line,
|
5180 | last_line: this.yylineno + 1,
|
5181 | first_column: this.yylloc.first_column,
|
5182 | last_column: lines ?
|
5183 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
5184 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
5185 | this.yylloc.first_column - len
|
5186 | };
|
5187 |
|
5188 | if (this.options.ranges) {
|
5189 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
5190 | }
|
5191 | this.yyleng = this.yytext.length;
|
5192 | return this;
|
5193 | },
|
5194 |
|
5195 | // When called from action, caches matched text and appends it on next action
|
5196 | more:function () {
|
5197 | this._more = true;
|
5198 | return this;
|
5199 | },
|
5200 |
|
5201 | // 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.
|
5202 | reject:function () {
|
5203 | if (this.options.backtrack_lexer) {
|
5204 | this._backtrack = true;
|
5205 | } else {
|
5206 | 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(), {
|
5207 | text: "",
|
5208 | token: null,
|
5209 | line: this.yylineno
|
5210 | });
|
5211 |
|
5212 | }
|
5213 | return this;
|
5214 | },
|
5215 |
|
5216 | // retain first n characters of the match
|
5217 | less:function (n) {
|
5218 | this.unput(this.match.slice(n));
|
5219 | },
|
5220 |
|
5221 | // displays already matched input, i.e. for error messages
|
5222 | pastInput:function () {
|
5223 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
5224 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
5225 | },
|
5226 |
|
5227 | // displays upcoming input, i.e. for error messages
|
5228 | upcomingInput:function () {
|
5229 | var next = this.match;
|
5230 | if (next.length < 20) {
|
5231 | next += this._input.substr(0, 20-next.length);
|
5232 | }
|
5233 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
5234 | },
|
5235 |
|
5236 | // displays the character position where the lexing error occurred, i.e. for error messages
|
5237 | showPosition:function () {
|
5238 | var pre = this.pastInput();
|
5239 | var c = new Array(pre.length + 1).join("-");
|
5240 | return pre + this.upcomingInput() + "\n" + c + "^";
|
5241 | },
|
5242 |
|
5243 | // test the lexed token: return FALSE when not a match, otherwise return token
|
5244 | test_match:function(match, indexed_rule) {
|
5245 | var token,
|
5246 | lines,
|
5247 | backup;
|
5248 |
|
5249 | if (this.options.backtrack_lexer) {
|
5250 | // save context
|
5251 | backup = {
|
5252 | yylineno: this.yylineno,
|
5253 | yylloc: {
|
5254 | first_line: this.yylloc.first_line,
|
5255 | last_line: this.last_line,
|
5256 | first_column: this.yylloc.first_column,
|
5257 | last_column: this.yylloc.last_column
|
5258 | },
|
5259 | yytext: this.yytext,
|
5260 | match: this.match,
|
5261 | matches: this.matches,
|
5262 | matched: this.matched,
|
5263 | yyleng: this.yyleng,
|
5264 | offset: this.offset,
|
5265 | _more: this._more,
|
5266 | _input: this._input,
|
5267 | yy: this.yy,
|
5268 | conditionStack: this.conditionStack.slice(0),
|
5269 | done: this.done
|
5270 | };
|
5271 | if (this.options.ranges) {
|
5272 | backup.yylloc.range = this.yylloc.range.slice(0);
|
5273 | }
|
5274 | }
|
5275 |
|
5276 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
5277 | if (lines) {
|
5278 | this.yylineno += lines.length;
|
5279 | }
|
5280 | this.yylloc = {
|
5281 | first_line: this.yylloc.last_line,
|
5282 | last_line: this.yylineno + 1,
|
5283 | first_column: this.yylloc.last_column,
|
5284 | last_column: lines ?
|
5285 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
5286 | this.yylloc.last_column + match[0].length
|
5287 | };
|
5288 | this.yytext += match[0];
|
5289 | this.match += match[0];
|
5290 | this.matches = match;
|
5291 | this.yyleng = this.yytext.length;
|
5292 | if (this.options.ranges) {
|
5293 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
5294 | }
|
5295 | this._more = false;
|
5296 | this._backtrack = false;
|
5297 | this._input = this._input.slice(match[0].length);
|
5298 | this.matched += match[0];
|
5299 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
5300 | if (this.done && this._input) {
|
5301 | this.done = false;
|
5302 | }
|
5303 | if (token) {
|
5304 | return token;
|
5305 | } else if (this._backtrack) {
|
5306 | // recover context
|
5307 | for (var k in backup) {
|
5308 | this[k] = backup[k];
|
5309 | }
|
5310 | return false; // rule action called reject() implying the next rule should be tested instead.
|
5311 | }
|
5312 | return false;
|
5313 | },
|
5314 |
|
5315 | // return next match in input
|
5316 | next:function () {
|
5317 | if (this.done) {
|
5318 | return this.EOF;
|
5319 | }
|
5320 | if (!this._input) {
|
5321 | this.done = true;
|
5322 | }
|
5323 |
|
5324 | var token,
|
5325 | match,
|
5326 | tempMatch,
|
5327 | index;
|
5328 | if (!this._more) {
|
5329 | this.yytext = '';
|
5330 | this.match = '';
|
5331 | }
|
5332 | var rules = this._currentRules();
|
5333 | for (var i = 0; i < rules.length; i++) {
|
5334 | tempMatch = this._input.match(this.rules[rules[i]]);
|
5335 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
5336 | match = tempMatch;
|
5337 | index = i;
|
5338 | if (this.options.backtrack_lexer) {
|
5339 | token = this.test_match(tempMatch, rules[i]);
|
5340 | if (token !== false) {
|
5341 | return token;
|
5342 | } else if (this._backtrack) {
|
5343 | match = false;
|
5344 | continue; // rule action called reject() implying a rule MISmatch.
|
5345 | } else {
|
5346 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
5347 | return false;
|
5348 | }
|
5349 | } else if (!this.options.flex) {
|
5350 | break;
|
5351 | }
|
5352 | }
|
5353 | }
|
5354 | if (match) {
|
5355 | token = this.test_match(match, rules[index]);
|
5356 | if (token !== false) {
|
5357 | return token;
|
5358 | }
|
5359 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
5360 | return false;
|
5361 | }
|
5362 | if (this._input === "") {
|
5363 | return this.EOF;
|
5364 | } else {
|
5365 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
5366 | text: "",
|
5367 | token: null,
|
5368 | line: this.yylineno
|
5369 | });
|
5370 | }
|
5371 | },
|
5372 |
|
5373 | // return next match that has a token
|
5374 | lex:function lex () {
|
5375 | var r = this.next();
|
5376 | if (r) {
|
5377 | return r;
|
5378 | } else {
|
5379 | return this.lex();
|
5380 | }
|
5381 | },
|
5382 |
|
5383 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
5384 | begin:function begin (condition) {
|
5385 | this.conditionStack.push(condition);
|
5386 | },
|
5387 |
|
5388 | // pop the previously active lexer condition state off the condition stack
|
5389 | popState:function popState () {
|
5390 | var n = this.conditionStack.length - 1;
|
5391 | if (n > 0) {
|
5392 | return this.conditionStack.pop();
|
5393 | } else {
|
5394 | return this.conditionStack[0];
|
5395 | }
|
5396 | },
|
5397 |
|
5398 | // produce the lexer rule set which is active for the currently active lexer condition state
|
5399 | _currentRules:function _currentRules () {
|
5400 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
5401 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
5402 | } else {
|
5403 | return this.conditions["INITIAL"].rules;
|
5404 | }
|
5405 | },
|
5406 |
|
5407 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
5408 | topState:function topState (n) {
|
5409 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
5410 | if (n >= 0) {
|
5411 | return this.conditionStack[n];
|
5412 | } else {
|
5413 | return "INITIAL";
|
5414 | }
|
5415 | },
|
5416 |
|
5417 | // alias for begin(condition)
|
5418 | pushState:function pushState (condition) {
|
5419 | this.begin(condition);
|
5420 | },
|
5421 |
|
5422 | // return the number of states currently on the stack
|
5423 | stateStackSize:function stateStackSize() {
|
5424 | return this.conditionStack.length;
|
5425 | },
|
5426 | options: {"case-insensitive":true},
|
5427 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
5428 | var YYSTATE=YY_START;
|
5429 | switch($avoiding_name_collisions) {
|
5430 | case 0: this.begin('open_directive'); return 23;
|
5431 | break;
|
5432 | case 1: this.begin('type_directive'); return 24;
|
5433 | break;
|
5434 | case 2: this.popState(); this.begin('arg_directive'); return 18;
|
5435 | break;
|
5436 | case 3: this.popState(); this.popState(); return 26;
|
5437 | break;
|
5438 | case 4:return 25;
|
5439 | break;
|
5440 | case 5:/* skip comments */
|
5441 | break;
|
5442 | case 6:/* skip comments */{ /*console.log('');*/ }
|
5443 | break;
|
5444 | case 7:return 20;
|
5445 | break;
|
5446 | case 8:/* do nothing */
|
5447 | break;
|
5448 | case 9:/* ignore */
|
5449 | break;
|
5450 | case 10: this.begin("title");return 13;
|
5451 | break;
|
5452 | case 11: this.popState(); return "title_value";
|
5453 | break;
|
5454 | case 12: this.begin("string");
|
5455 | break;
|
5456 | case 13: this.popState();
|
5457 | break;
|
5458 | case 14: return "txt";
|
5459 | break;
|
5460 | case 15:return 6;
|
5461 | break;
|
5462 | case 16:return 8;
|
5463 | break;
|
5464 | case 17:return "value";
|
5465 | break;
|
5466 | case 18:return 22;
|
5467 | break;
|
5468 | }
|
5469 | },
|
5470 | rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[\s]+)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:pie\b)/i,/^(?:showData\b)/i,/^(?::[\s]*[\d]+(?:\.[\d]+)?)/i,/^(?:$)/i],
|
5471 | 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},"title":{"rules":[11],"inclusive":false},"string":{"rules":[13,14],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,12,15,16,17,18],"inclusive":true}}
|
5472 | });
|
5473 | return lexer;
|
5474 | })();
|
5475 | parser.lexer = lexer;
|
5476 | function Parser () {
|
5477 | this.yy = {};
|
5478 | }
|
5479 | Parser.prototype = parser;parser.Parser = Parser;
|
5480 | return new Parser;
|
5481 | })();
|
5482 |
|
5483 |
|
5484 | if (true) {
|
5485 | exports.parser = parser;
|
5486 | exports.Parser = parser.Parser;
|
5487 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
5488 | exports.main = function commonjsMain (args) {
|
5489 | if (!args[1]) {
|
5490 | console.log('Usage: '+args[0]+' FILE');
|
5491 | process.exit(1);
|
5492 | }
|
5493 | var source = __webpack_require__(/*! fs */ "?a3fa").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
|
5494 | return exports.parser.parse(source);
|
5495 | };
|
5496 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
5497 | exports.main(process.argv.slice(1));
|
5498 | }
|
5499 | }
|
5500 |
|
5501 | /***/ }),
|
5502 |
|
5503 | /***/ "./src/diagrams/requirement/parser/requirementDiagram.jison":
|
5504 | /*!******************************************************************!*\
|
5505 | !*** ./src/diagrams/requirement/parser/requirementDiagram.jison ***!
|
5506 | \******************************************************************/
|
5507 | /***/ ((module, exports, __webpack_require__) => {
|
5508 |
|
5509 | /* module decorator */ module = __webpack_require__.nmd(module);
|
5510 | /* parser generated by jison 0.4.18 */
|
5511 | /*
|
5512 | Returns a Parser object of the following structure:
|
5513 |
|
5514 | Parser: {
|
5515 | yy: {}
|
5516 | }
|
5517 |
|
5518 | Parser.prototype: {
|
5519 | yy: {},
|
5520 | trace: function(),
|
5521 | symbols_: {associative list: name ==> number},
|
5522 | terminals_: {associative list: number ==> name},
|
5523 | productions_: [...],
|
5524 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
5525 | table: [...],
|
5526 | defaultActions: {...},
|
5527 | parseError: function(str, hash),
|
5528 | parse: function(input),
|
5529 |
|
5530 | lexer: {
|
5531 | EOF: 1,
|
5532 | parseError: function(str, hash),
|
5533 | setInput: function(input),
|
5534 | input: function(),
|
5535 | unput: function(str),
|
5536 | more: function(),
|
5537 | less: function(n),
|
5538 | pastInput: function(),
|
5539 | upcomingInput: function(),
|
5540 | showPosition: function(),
|
5541 | test_match: function(regex_match_array, rule_index),
|
5542 | next: function(),
|
5543 | lex: function(),
|
5544 | begin: function(condition),
|
5545 | popState: function(),
|
5546 | _currentRules: function(),
|
5547 | topState: function(),
|
5548 | pushState: function(condition),
|
5549 |
|
5550 | options: {
|
5551 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
5552 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
5553 | 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)
|
5554 | },
|
5555 |
|
5556 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
5557 | rules: [...],
|
5558 | conditions: {associative list: name ==> set},
|
5559 | }
|
5560 | }
|
5561 |
|
5562 |
|
5563 | token location info (@$, _$, etc.): {
|
5564 | first_line: n,
|
5565 | last_line: n,
|
5566 | first_column: n,
|
5567 | last_column: n,
|
5568 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
5569 | }
|
5570 |
|
5571 |
|
5572 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
5573 | text: (matched text)
|
5574 | token: (the produced terminal token, if any)
|
5575 | line: (yylineno)
|
5576 | }
|
5577 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
5578 | loc: (yylloc)
|
5579 | expected: (string describing the set of expected tokens)
|
5580 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
5581 | }
|
5582 | */
|
5583 | var parser = (function(){
|
5584 | 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,17],$V3=[2,10],$V4=[1,21],$V5=[1,22],$V6=[1,23],$V7=[1,24],$V8=[1,25],$V9=[1,26],$Va=[1,19],$Vb=[1,27],$Vc=[1,28],$Vd=[1,31],$Ve=[66,67],$Vf=[5,8,14,35,36,37,38,39,40,48,55,57,66,67],$Vg=[5,6,8,14,35,36,37,38,39,40,48,66,67],$Vh=[1,51],$Vi=[1,52],$Vj=[1,53],$Vk=[1,54],$Vl=[1,55],$Vm=[1,56],$Vn=[1,57],$Vo=[57,58],$Vp=[1,69],$Vq=[1,65],$Vr=[1,66],$Vs=[1,67],$Vt=[1,68],$Vu=[1,70],$Vv=[1,74],$Vw=[1,75],$Vx=[1,72],$Vy=[1,73],$Vz=[5,8,14,35,36,37,38,39,40,48,66,67];
|
5585 | var parser = {trace: function trace () { },
|
5586 | yy: {},
|
5587 | symbols_: {"error":2,"start":3,"directive":4,"NEWLINE":5,"RD":6,"diagram":7,"EOF":8,"openDirective":9,"typeDirective":10,"closeDirective":11,":":12,"argDirective":13,"open_directive":14,"type_directive":15,"arg_directive":16,"close_directive":17,"requirementDef":18,"elementDef":19,"relationshipDef":20,"requirementType":21,"requirementName":22,"STRUCT_START":23,"requirementBody":24,"ID":25,"COLONSEP":26,"id":27,"TEXT":28,"text":29,"RISK":30,"riskLevel":31,"VERIFYMTHD":32,"verifyType":33,"STRUCT_STOP":34,"REQUIREMENT":35,"FUNCTIONAL_REQUIREMENT":36,"INTERFACE_REQUIREMENT":37,"PERFORMANCE_REQUIREMENT":38,"PHYSICAL_REQUIREMENT":39,"DESIGN_CONSTRAINT":40,"LOW_RISK":41,"MED_RISK":42,"HIGH_RISK":43,"VERIFY_ANALYSIS":44,"VERIFY_DEMONSTRATION":45,"VERIFY_INSPECTION":46,"VERIFY_TEST":47,"ELEMENT":48,"elementName":49,"elementBody":50,"TYPE":51,"type":52,"DOCREF":53,"ref":54,"END_ARROW_L":55,"relationship":56,"LINE":57,"END_ARROW_R":58,"CONTAINS":59,"COPIES":60,"DERIVES":61,"SATISFIES":62,"VERIFIES":63,"REFINES":64,"TRACES":65,"unqString":66,"qString":67,"$accept":0,"$end":1},
|
5588 | terminals_: {2:"error",5:"NEWLINE",6:"RD",8:"EOF",12:":",14:"open_directive",15:"type_directive",16:"arg_directive",17:"close_directive",23:"STRUCT_START",25:"ID",26:"COLONSEP",28:"TEXT",30:"RISK",32:"VERIFYMTHD",34:"STRUCT_STOP",35:"REQUIREMENT",36:"FUNCTIONAL_REQUIREMENT",37:"INTERFACE_REQUIREMENT",38:"PERFORMANCE_REQUIREMENT",39:"PHYSICAL_REQUIREMENT",40:"DESIGN_CONSTRAINT",41:"LOW_RISK",42:"MED_RISK",43:"HIGH_RISK",44:"VERIFY_ANALYSIS",45:"VERIFY_DEMONSTRATION",46:"VERIFY_INSPECTION",47:"VERIFY_TEST",48:"ELEMENT",51:"TYPE",53:"DOCREF",55:"END_ARROW_L",57:"LINE",58:"END_ARROW_R",59:"CONTAINS",60:"COPIES",61:"DERIVES",62:"SATISFIES",63:"VERIFIES",64:"REFINES",65:"TRACES",66:"unqString",67:"qString"},
|
5589 | productions_: [0,[3,3],[3,2],[3,4],[4,3],[4,5],[9,1],[10,1],[13,1],[11,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[18,5],[24,5],[24,5],[24,5],[24,5],[24,2],[24,1],[21,1],[21,1],[21,1],[21,1],[21,1],[21,1],[31,1],[31,1],[31,1],[33,1],[33,1],[33,1],[33,1],[19,5],[50,5],[50,5],[50,2],[50,1],[20,5],[20,5],[56,1],[56,1],[56,1],[56,1],[56,1],[56,1],[56,1],[22,1],[22,1],[27,1],[27,1],[29,1],[29,1],[49,1],[49,1],[52,1],[52,1],[54,1],[54,1]],
|
5590 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
5591 | /* this == yyval */
|
5592 |
|
5593 | var $0 = $$.length - 1;
|
5594 | switch (yystate) {
|
5595 | case 6:
|
5596 | yy.parseDirective('%%{', 'open_directive');
|
5597 | break;
|
5598 | case 7:
|
5599 | yy.parseDirective($$[$0], 'type_directive');
|
5600 | break;
|
5601 | case 8:
|
5602 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
5603 | break;
|
5604 | case 9:
|
5605 | yy.parseDirective('}%%', 'close_directive', 'pie');
|
5606 | break;
|
5607 | case 10:
|
5608 | this.$ = []
|
5609 | break;
|
5610 | case 16:
|
5611 | yy.addRequirement($$[$0-3], $$[$0-4])
|
5612 | break;
|
5613 | case 17:
|
5614 | yy.setNewReqId($$[$0-2]);
|
5615 | break;
|
5616 | case 18:
|
5617 | yy.setNewReqText($$[$0-2]);
|
5618 | break;
|
5619 | case 19:
|
5620 | yy.setNewReqRisk($$[$0-2]);
|
5621 | break;
|
5622 | case 20:
|
5623 | yy.setNewReqVerifyMethod($$[$0-2]);
|
5624 | break;
|
5625 | case 23:
|
5626 | this.$=yy.RequirementType.REQUIREMENT;
|
5627 | break;
|
5628 | case 24:
|
5629 | this.$=yy.RequirementType.FUNCTIONAL_REQUIREMENT;
|
5630 | break;
|
5631 | case 25:
|
5632 | this.$=yy.RequirementType.INTERFACE_REQUIREMENT;
|
5633 | break;
|
5634 | case 26:
|
5635 | this.$=yy.RequirementType.PERFORMANCE_REQUIREMENT;
|
5636 | break;
|
5637 | case 27:
|
5638 | this.$=yy.RequirementType.PHYSICAL_REQUIREMENT;
|
5639 | break;
|
5640 | case 28:
|
5641 | this.$=yy.RequirementType.DESIGN_CONSTRAINT;
|
5642 | break;
|
5643 | case 29:
|
5644 | this.$=yy.RiskLevel.LOW_RISK;
|
5645 | break;
|
5646 | case 30:
|
5647 | this.$=yy.RiskLevel.MED_RISK;
|
5648 | break;
|
5649 | case 31:
|
5650 | this.$=yy.RiskLevel.HIGH_RISK;
|
5651 | break;
|
5652 | case 32:
|
5653 | this.$=yy.VerifyType.VERIFY_ANALYSIS;
|
5654 | break;
|
5655 | case 33:
|
5656 | this.$=yy.VerifyType.VERIFY_DEMONSTRATION;
|
5657 | break;
|
5658 | case 34:
|
5659 | this.$=yy.VerifyType.VERIFY_INSPECTION;
|
5660 | break;
|
5661 | case 35:
|
5662 | this.$=yy.VerifyType.VERIFY_TEST;
|
5663 | break;
|
5664 | case 36:
|
5665 | yy.addElement($$[$0-3])
|
5666 | break;
|
5667 | case 37:
|
5668 | yy.setNewElementType($$[$0-2]);
|
5669 | break;
|
5670 | case 38:
|
5671 | yy.setNewElementDocRef($$[$0-2]);
|
5672 | break;
|
5673 | case 41:
|
5674 | yy.addRelationship($$[$0-2], $$[$0], $$[$0-4])
|
5675 | break;
|
5676 | case 42:
|
5677 | yy.addRelationship($$[$0-2], $$[$0-4], $$[$0])
|
5678 | break;
|
5679 | case 43:
|
5680 | this.$=yy.Relationships.CONTAINS;
|
5681 | break;
|
5682 | case 44:
|
5683 | this.$=yy.Relationships.COPIES;
|
5684 | break;
|
5685 | case 45:
|
5686 | this.$=yy.Relationships.DERIVES;
|
5687 | break;
|
5688 | case 46:
|
5689 | this.$=yy.Relationships.SATISFIES;
|
5690 | break;
|
5691 | case 47:
|
5692 | this.$=yy.Relationships.VERIFIES;
|
5693 | break;
|
5694 | case 48:
|
5695 | this.$=yy.Relationships.REFINES;
|
5696 | break;
|
5697 | case 49:
|
5698 | this.$=yy.Relationships.TRACES;
|
5699 | break;
|
5700 | }
|
5701 | },
|
5702 | table: [{3:1,4:2,6:$V0,9:4,14:$V1},{1:[3]},{3:7,4:2,5:[1,6],6:$V0,9:4,14:$V1},{5:[1,8]},{10:9,15:[1,10]},{15:[2,6]},{3:11,4:2,6:$V0,9:4,14:$V1},{1:[2,2]},{4:16,5:$V2,7:12,8:$V3,9:4,14:$V1,18:13,19:14,20:15,21:18,27:20,35:$V4,36:$V5,37:$V6,38:$V7,39:$V8,40:$V9,48:$Va,66:$Vb,67:$Vc},{11:29,12:[1,30],17:$Vd},o([12,17],[2,7]),{1:[2,1]},{8:[1,32]},{4:16,5:$V2,7:33,8:$V3,9:4,14:$V1,18:13,19:14,20:15,21:18,27:20,35:$V4,36:$V5,37:$V6,38:$V7,39:$V8,40:$V9,48:$Va,66:$Vb,67:$Vc},{4:16,5:$V2,7:34,8:$V3,9:4,14:$V1,18:13,19:14,20:15,21:18,27:20,35:$V4,36:$V5,37:$V6,38:$V7,39:$V8,40:$V9,48:$Va,66:$Vb,67:$Vc},{4:16,5:$V2,7:35,8:$V3,9:4,14:$V1,18:13,19:14,20:15,21:18,27:20,35:$V4,36:$V5,37:$V6,38:$V7,39:$V8,40:$V9,48:$Va,66:$Vb,67:$Vc},{4:16,5:$V2,7:36,8:$V3,9:4,14:$V1,18:13,19:14,20:15,21:18,27:20,35:$V4,36:$V5,37:$V6,38:$V7,39:$V8,40:$V9,48:$Va,66:$Vb,67:$Vc},{4:16,5:$V2,7:37,8:$V3,9:4,14:$V1,18:13,19:14,20:15,21:18,27:20,35:$V4,36:$V5,37:$V6,38:$V7,39:$V8,40:$V9,48:$Va,66:$Vb,67:$Vc},{22:38,66:[1,39],67:[1,40]},{49:41,66:[1,42],67:[1,43]},{55:[1,44],57:[1,45]},o($Ve,[2,23]),o($Ve,[2,24]),o($Ve,[2,25]),o($Ve,[2,26]),o($Ve,[2,27]),o($Ve,[2,28]),o($Vf,[2,52]),o($Vf,[2,53]),o($Vg,[2,4]),{13:46,16:[1,47]},o($Vg,[2,9]),{1:[2,3]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{23:[1,48]},{23:[2,50]},{23:[2,51]},{23:[1,49]},{23:[2,56]},{23:[2,57]},{56:50,59:$Vh,60:$Vi,61:$Vj,62:$Vk,63:$Vl,64:$Vm,65:$Vn},{56:58,59:$Vh,60:$Vi,61:$Vj,62:$Vk,63:$Vl,64:$Vm,65:$Vn},{11:59,17:$Vd},{17:[2,8]},{5:[1,60]},{5:[1,61]},{57:[1,62]},o($Vo,[2,43]),o($Vo,[2,44]),o($Vo,[2,45]),o($Vo,[2,46]),o($Vo,[2,47]),o($Vo,[2,48]),o($Vo,[2,49]),{58:[1,63]},o($Vg,[2,5]),{5:$Vp,24:64,25:$Vq,28:$Vr,30:$Vs,32:$Vt,34:$Vu},{5:$Vv,34:$Vw,50:71,51:$Vx,53:$Vy},{27:76,66:$Vb,67:$Vc},{27:77,66:$Vb,67:$Vc},o($Vz,[2,16]),{26:[1,78]},{26:[1,79]},{26:[1,80]},{26:[1,81]},{5:$Vp,24:82,25:$Vq,28:$Vr,30:$Vs,32:$Vt,34:$Vu},o($Vz,[2,22]),o($Vz,[2,36]),{26:[1,83]},{26:[1,84]},{5:$Vv,34:$Vw,50:85,51:$Vx,53:$Vy},o($Vz,[2,40]),o($Vz,[2,41]),o($Vz,[2,42]),{27:86,66:$Vb,67:$Vc},{29:87,66:[1,88],67:[1,89]},{31:90,41:[1,91],42:[1,92],43:[1,93]},{33:94,44:[1,95],45:[1,96],46:[1,97],47:[1,98]},o($Vz,[2,21]),{52:99,66:[1,100],67:[1,101]},{54:102,66:[1,103],67:[1,104]},o($Vz,[2,39]),{5:[1,105]},{5:[1,106]},{5:[2,54]},{5:[2,55]},{5:[1,107]},{5:[2,29]},{5:[2,30]},{5:[2,31]},{5:[1,108]},{5:[2,32]},{5:[2,33]},{5:[2,34]},{5:[2,35]},{5:[1,109]},{5:[2,58]},{5:[2,59]},{5:[1,110]},{5:[2,60]},{5:[2,61]},{5:$Vp,24:111,25:$Vq,28:$Vr,30:$Vs,32:$Vt,34:$Vu},{5:$Vp,24:112,25:$Vq,28:$Vr,30:$Vs,32:$Vt,34:$Vu},{5:$Vp,24:113,25:$Vq,28:$Vr,30:$Vs,32:$Vt,34:$Vu},{5:$Vp,24:114,25:$Vq,28:$Vr,30:$Vs,32:$Vt,34:$Vu},{5:$Vv,34:$Vw,50:115,51:$Vx,53:$Vy},{5:$Vv,34:$Vw,50:116,51:$Vx,53:$Vy},o($Vz,[2,17]),o($Vz,[2,18]),o($Vz,[2,19]),o($Vz,[2,20]),o($Vz,[2,37]),o($Vz,[2,38])],
|
5703 | defaultActions: {5:[2,6],7:[2,2],11:[2,1],32:[2,3],33:[2,11],34:[2,12],35:[2,13],36:[2,14],37:[2,15],39:[2,50],40:[2,51],42:[2,56],43:[2,57],47:[2,8],88:[2,54],89:[2,55],91:[2,29],92:[2,30],93:[2,31],95:[2,32],96:[2,33],97:[2,34],98:[2,35],100:[2,58],101:[2,59],103:[2,60],104:[2,61]},
|
5704 | parseError: function parseError (str, hash) {
|
5705 | if (hash.recoverable) {
|
5706 | this.trace(str);
|
5707 | } else {
|
5708 | var error = new Error(str);
|
5709 | error.hash = hash;
|
5710 | throw error;
|
5711 | }
|
5712 | },
|
5713 | parse: function parse(input) {
|
5714 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
5715 | var args = lstack.slice.call(arguments, 1);
|
5716 | var lexer = Object.create(this.lexer);
|
5717 | var sharedState = { yy: {} };
|
5718 | for (var k in this.yy) {
|
5719 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
5720 | sharedState.yy[k] = this.yy[k];
|
5721 | }
|
5722 | }
|
5723 | lexer.setInput(input, sharedState.yy);
|
5724 | sharedState.yy.lexer = lexer;
|
5725 | sharedState.yy.parser = this;
|
5726 | if (typeof lexer.yylloc == 'undefined') {
|
5727 | lexer.yylloc = {};
|
5728 | }
|
5729 | var yyloc = lexer.yylloc;
|
5730 | lstack.push(yyloc);
|
5731 | var ranges = lexer.options && lexer.options.ranges;
|
5732 | if (typeof sharedState.yy.parseError === 'function') {
|
5733 | this.parseError = sharedState.yy.parseError;
|
5734 | } else {
|
5735 | this.parseError = Object.getPrototypeOf(this).parseError;
|
5736 | }
|
5737 | function popStack(n) {
|
5738 | stack.length = stack.length - 2 * n;
|
5739 | vstack.length = vstack.length - n;
|
5740 | lstack.length = lstack.length - n;
|
5741 | }
|
5742 | function lex() {
|
5743 | var token;
|
5744 | token = tstack.pop() || lexer.lex() || EOF;
|
5745 | if (typeof token !== 'number') {
|
5746 | if (token instanceof Array) {
|
5747 | tstack = token;
|
5748 | token = tstack.pop();
|
5749 | }
|
5750 | token = self.symbols_[token] || token;
|
5751 | }
|
5752 | return token;
|
5753 | }
|
5754 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
5755 | while (true) {
|
5756 | state = stack[stack.length - 1];
|
5757 | if (this.defaultActions[state]) {
|
5758 | action = this.defaultActions[state];
|
5759 | } else {
|
5760 | if (symbol === null || typeof symbol == 'undefined') {
|
5761 | symbol = lex();
|
5762 | }
|
5763 | action = table[state] && table[state][symbol];
|
5764 | }
|
5765 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
5766 | var errStr = '';
|
5767 | expected = [];
|
5768 | for (p in table[state]) {
|
5769 | if (this.terminals_[p] && p > TERROR) {
|
5770 | expected.push('\'' + this.terminals_[p] + '\'');
|
5771 | }
|
5772 | }
|
5773 | if (lexer.showPosition) {
|
5774 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
5775 | } else {
|
5776 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
5777 | }
|
5778 | this.parseError(errStr, {
|
5779 | text: lexer.match,
|
5780 | token: this.terminals_[symbol] || symbol,
|
5781 | line: lexer.yylineno,
|
5782 | loc: yyloc,
|
5783 | expected: expected
|
5784 | });
|
5785 | }
|
5786 | if (action[0] instanceof Array && action.length > 1) {
|
5787 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
5788 | }
|
5789 | switch (action[0]) {
|
5790 | case 1:
|
5791 | stack.push(symbol);
|
5792 | vstack.push(lexer.yytext);
|
5793 | lstack.push(lexer.yylloc);
|
5794 | stack.push(action[1]);
|
5795 | symbol = null;
|
5796 | if (!preErrorSymbol) {
|
5797 | yyleng = lexer.yyleng;
|
5798 | yytext = lexer.yytext;
|
5799 | yylineno = lexer.yylineno;
|
5800 | yyloc = lexer.yylloc;
|
5801 | if (recovering > 0) {
|
5802 | recovering--;
|
5803 | }
|
5804 | } else {
|
5805 | symbol = preErrorSymbol;
|
5806 | preErrorSymbol = null;
|
5807 | }
|
5808 | break;
|
5809 | case 2:
|
5810 | len = this.productions_[action[1]][1];
|
5811 | yyval.$ = vstack[vstack.length - len];
|
5812 | yyval._$ = {
|
5813 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
5814 | last_line: lstack[lstack.length - 1].last_line,
|
5815 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
5816 | last_column: lstack[lstack.length - 1].last_column
|
5817 | };
|
5818 | if (ranges) {
|
5819 | yyval._$.range = [
|
5820 | lstack[lstack.length - (len || 1)].range[0],
|
5821 | lstack[lstack.length - 1].range[1]
|
5822 | ];
|
5823 | }
|
5824 | r = this.performAction.apply(yyval, [
|
5825 | yytext,
|
5826 | yyleng,
|
5827 | yylineno,
|
5828 | sharedState.yy,
|
5829 | action[1],
|
5830 | vstack,
|
5831 | lstack
|
5832 | ].concat(args));
|
5833 | if (typeof r !== 'undefined') {
|
5834 | return r;
|
5835 | }
|
5836 | if (len) {
|
5837 | stack = stack.slice(0, -1 * len * 2);
|
5838 | vstack = vstack.slice(0, -1 * len);
|
5839 | lstack = lstack.slice(0, -1 * len);
|
5840 | }
|
5841 | stack.push(this.productions_[action[1]][0]);
|
5842 | vstack.push(yyval.$);
|
5843 | lstack.push(yyval._$);
|
5844 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
5845 | stack.push(newState);
|
5846 | break;
|
5847 | case 3:
|
5848 | return true;
|
5849 | }
|
5850 | }
|
5851 | return true;
|
5852 | }};
|
5853 |
|
5854 | /* generated by jison-lex 0.3.4 */
|
5855 | var lexer = (function(){
|
5856 | var lexer = ({
|
5857 |
|
5858 | EOF:1,
|
5859 |
|
5860 | parseError:function parseError(str, hash) {
|
5861 | if (this.yy.parser) {
|
5862 | this.yy.parser.parseError(str, hash);
|
5863 | } else {
|
5864 | throw new Error(str);
|
5865 | }
|
5866 | },
|
5867 |
|
5868 | // resets the lexer, sets new input
|
5869 | setInput:function (input, yy) {
|
5870 | this.yy = yy || this.yy || {};
|
5871 | this._input = input;
|
5872 | this._more = this._backtrack = this.done = false;
|
5873 | this.yylineno = this.yyleng = 0;
|
5874 | this.yytext = this.matched = this.match = '';
|
5875 | this.conditionStack = ['INITIAL'];
|
5876 | this.yylloc = {
|
5877 | first_line: 1,
|
5878 | first_column: 0,
|
5879 | last_line: 1,
|
5880 | last_column: 0
|
5881 | };
|
5882 | if (this.options.ranges) {
|
5883 | this.yylloc.range = [0,0];
|
5884 | }
|
5885 | this.offset = 0;
|
5886 | return this;
|
5887 | },
|
5888 |
|
5889 | // consumes and returns one char from the input
|
5890 | input:function () {
|
5891 | var ch = this._input[0];
|
5892 | this.yytext += ch;
|
5893 | this.yyleng++;
|
5894 | this.offset++;
|
5895 | this.match += ch;
|
5896 | this.matched += ch;
|
5897 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
5898 | if (lines) {
|
5899 | this.yylineno++;
|
5900 | this.yylloc.last_line++;
|
5901 | } else {
|
5902 | this.yylloc.last_column++;
|
5903 | }
|
5904 | if (this.options.ranges) {
|
5905 | this.yylloc.range[1]++;
|
5906 | }
|
5907 |
|
5908 | this._input = this._input.slice(1);
|
5909 | return ch;
|
5910 | },
|
5911 |
|
5912 | // unshifts one char (or a string) into the input
|
5913 | unput:function (ch) {
|
5914 | var len = ch.length;
|
5915 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
5916 |
|
5917 | this._input = ch + this._input;
|
5918 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
5919 | //this.yyleng -= len;
|
5920 | this.offset -= len;
|
5921 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
5922 | this.match = this.match.substr(0, this.match.length - 1);
|
5923 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
5924 |
|
5925 | if (lines.length - 1) {
|
5926 | this.yylineno -= lines.length - 1;
|
5927 | }
|
5928 | var r = this.yylloc.range;
|
5929 |
|
5930 | this.yylloc = {
|
5931 | first_line: this.yylloc.first_line,
|
5932 | last_line: this.yylineno + 1,
|
5933 | first_column: this.yylloc.first_column,
|
5934 | last_column: lines ?
|
5935 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
5936 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
5937 | this.yylloc.first_column - len
|
5938 | };
|
5939 |
|
5940 | if (this.options.ranges) {
|
5941 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
5942 | }
|
5943 | this.yyleng = this.yytext.length;
|
5944 | return this;
|
5945 | },
|
5946 |
|
5947 | // When called from action, caches matched text and appends it on next action
|
5948 | more:function () {
|
5949 | this._more = true;
|
5950 | return this;
|
5951 | },
|
5952 |
|
5953 | // 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.
|
5954 | reject:function () {
|
5955 | if (this.options.backtrack_lexer) {
|
5956 | this._backtrack = true;
|
5957 | } else {
|
5958 | 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(), {
|
5959 | text: "",
|
5960 | token: null,
|
5961 | line: this.yylineno
|
5962 | });
|
5963 |
|
5964 | }
|
5965 | return this;
|
5966 | },
|
5967 |
|
5968 | // retain first n characters of the match
|
5969 | less:function (n) {
|
5970 | this.unput(this.match.slice(n));
|
5971 | },
|
5972 |
|
5973 | // displays already matched input, i.e. for error messages
|
5974 | pastInput:function () {
|
5975 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
5976 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
5977 | },
|
5978 |
|
5979 | // displays upcoming input, i.e. for error messages
|
5980 | upcomingInput:function () {
|
5981 | var next = this.match;
|
5982 | if (next.length < 20) {
|
5983 | next += this._input.substr(0, 20-next.length);
|
5984 | }
|
5985 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
5986 | },
|
5987 |
|
5988 | // displays the character position where the lexing error occurred, i.e. for error messages
|
5989 | showPosition:function () {
|
5990 | var pre = this.pastInput();
|
5991 | var c = new Array(pre.length + 1).join("-");
|
5992 | return pre + this.upcomingInput() + "\n" + c + "^";
|
5993 | },
|
5994 |
|
5995 | // test the lexed token: return FALSE when not a match, otherwise return token
|
5996 | test_match:function(match, indexed_rule) {
|
5997 | var token,
|
5998 | lines,
|
5999 | backup;
|
6000 |
|
6001 | if (this.options.backtrack_lexer) {
|
6002 | // save context
|
6003 | backup = {
|
6004 | yylineno: this.yylineno,
|
6005 | yylloc: {
|
6006 | first_line: this.yylloc.first_line,
|
6007 | last_line: this.last_line,
|
6008 | first_column: this.yylloc.first_column,
|
6009 | last_column: this.yylloc.last_column
|
6010 | },
|
6011 | yytext: this.yytext,
|
6012 | match: this.match,
|
6013 | matches: this.matches,
|
6014 | matched: this.matched,
|
6015 | yyleng: this.yyleng,
|
6016 | offset: this.offset,
|
6017 | _more: this._more,
|
6018 | _input: this._input,
|
6019 | yy: this.yy,
|
6020 | conditionStack: this.conditionStack.slice(0),
|
6021 | done: this.done
|
6022 | };
|
6023 | if (this.options.ranges) {
|
6024 | backup.yylloc.range = this.yylloc.range.slice(0);
|
6025 | }
|
6026 | }
|
6027 |
|
6028 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
6029 | if (lines) {
|
6030 | this.yylineno += lines.length;
|
6031 | }
|
6032 | this.yylloc = {
|
6033 | first_line: this.yylloc.last_line,
|
6034 | last_line: this.yylineno + 1,
|
6035 | first_column: this.yylloc.last_column,
|
6036 | last_column: lines ?
|
6037 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
6038 | this.yylloc.last_column + match[0].length
|
6039 | };
|
6040 | this.yytext += match[0];
|
6041 | this.match += match[0];
|
6042 | this.matches = match;
|
6043 | this.yyleng = this.yytext.length;
|
6044 | if (this.options.ranges) {
|
6045 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
6046 | }
|
6047 | this._more = false;
|
6048 | this._backtrack = false;
|
6049 | this._input = this._input.slice(match[0].length);
|
6050 | this.matched += match[0];
|
6051 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
6052 | if (this.done && this._input) {
|
6053 | this.done = false;
|
6054 | }
|
6055 | if (token) {
|
6056 | return token;
|
6057 | } else if (this._backtrack) {
|
6058 | // recover context
|
6059 | for (var k in backup) {
|
6060 | this[k] = backup[k];
|
6061 | }
|
6062 | return false; // rule action called reject() implying the next rule should be tested instead.
|
6063 | }
|
6064 | return false;
|
6065 | },
|
6066 |
|
6067 | // return next match in input
|
6068 | next:function () {
|
6069 | if (this.done) {
|
6070 | return this.EOF;
|
6071 | }
|
6072 | if (!this._input) {
|
6073 | this.done = true;
|
6074 | }
|
6075 |
|
6076 | var token,
|
6077 | match,
|
6078 | tempMatch,
|
6079 | index;
|
6080 | if (!this._more) {
|
6081 | this.yytext = '';
|
6082 | this.match = '';
|
6083 | }
|
6084 | var rules = this._currentRules();
|
6085 | for (var i = 0; i < rules.length; i++) {
|
6086 | tempMatch = this._input.match(this.rules[rules[i]]);
|
6087 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
6088 | match = tempMatch;
|
6089 | index = i;
|
6090 | if (this.options.backtrack_lexer) {
|
6091 | token = this.test_match(tempMatch, rules[i]);
|
6092 | if (token !== false) {
|
6093 | return token;
|
6094 | } else if (this._backtrack) {
|
6095 | match = false;
|
6096 | continue; // rule action called reject() implying a rule MISmatch.
|
6097 | } else {
|
6098 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
6099 | return false;
|
6100 | }
|
6101 | } else if (!this.options.flex) {
|
6102 | break;
|
6103 | }
|
6104 | }
|
6105 | }
|
6106 | if (match) {
|
6107 | token = this.test_match(match, rules[index]);
|
6108 | if (token !== false) {
|
6109 | return token;
|
6110 | }
|
6111 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
6112 | return false;
|
6113 | }
|
6114 | if (this._input === "") {
|
6115 | return this.EOF;
|
6116 | } else {
|
6117 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
6118 | text: "",
|
6119 | token: null,
|
6120 | line: this.yylineno
|
6121 | });
|
6122 | }
|
6123 | },
|
6124 |
|
6125 | // return next match that has a token
|
6126 | lex:function lex () {
|
6127 | var r = this.next();
|
6128 | if (r) {
|
6129 | return r;
|
6130 | } else {
|
6131 | return this.lex();
|
6132 | }
|
6133 | },
|
6134 |
|
6135 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
6136 | begin:function begin (condition) {
|
6137 | this.conditionStack.push(condition);
|
6138 | },
|
6139 |
|
6140 | // pop the previously active lexer condition state off the condition stack
|
6141 | popState:function popState () {
|
6142 | var n = this.conditionStack.length - 1;
|
6143 | if (n > 0) {
|
6144 | return this.conditionStack.pop();
|
6145 | } else {
|
6146 | return this.conditionStack[0];
|
6147 | }
|
6148 | },
|
6149 |
|
6150 | // produce the lexer rule set which is active for the currently active lexer condition state
|
6151 | _currentRules:function _currentRules () {
|
6152 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
6153 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
6154 | } else {
|
6155 | return this.conditions["INITIAL"].rules;
|
6156 | }
|
6157 | },
|
6158 |
|
6159 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
6160 | topState:function topState (n) {
|
6161 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
6162 | if (n >= 0) {
|
6163 | return this.conditionStack[n];
|
6164 | } else {
|
6165 | return "INITIAL";
|
6166 | }
|
6167 | },
|
6168 |
|
6169 | // alias for begin(condition)
|
6170 | pushState:function pushState (condition) {
|
6171 | this.begin(condition);
|
6172 | },
|
6173 |
|
6174 | // return the number of states currently on the stack
|
6175 | stateStackSize:function stateStackSize() {
|
6176 | return this.conditionStack.length;
|
6177 | },
|
6178 | options: {"case-insensitive":true},
|
6179 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
6180 | var YYSTATE=YY_START;
|
6181 | switch($avoiding_name_collisions) {
|
6182 | case 0: this.begin('open_directive'); return 14;
|
6183 | break;
|
6184 | case 1: this.begin('type_directive'); return 15;
|
6185 | break;
|
6186 | case 2: this.popState(); this.begin('arg_directive'); return 12;
|
6187 | break;
|
6188 | case 3: this.popState(); this.popState(); return 17;
|
6189 | break;
|
6190 | case 4:return 16;
|
6191 | break;
|
6192 | case 5:return 5;
|
6193 | break;
|
6194 | case 6:/* skip all whitespace */
|
6195 | break;
|
6196 | case 7:/* skip comments */
|
6197 | break;
|
6198 | case 8:/* skip comments */
|
6199 | break;
|
6200 | case 9:return 8;
|
6201 | break;
|
6202 | case 10:return 6;
|
6203 | break;
|
6204 | case 11:return 23;
|
6205 | break;
|
6206 | case 12:return 34;
|
6207 | break;
|
6208 | case 13:return 26;
|
6209 | break;
|
6210 | case 14:return 25;
|
6211 | break;
|
6212 | case 15:return 28;
|
6213 | break;
|
6214 | case 16:return 30;
|
6215 | break;
|
6216 | case 17:return 32;
|
6217 | break;
|
6218 | case 18:return 35;
|
6219 | break;
|
6220 | case 19:return 36;
|
6221 | break;
|
6222 | case 20:return 37;
|
6223 | break;
|
6224 | case 21:return 38;
|
6225 | break;
|
6226 | case 22:return 39;
|
6227 | break;
|
6228 | case 23:return 40;
|
6229 | break;
|
6230 | case 24:return 41;
|
6231 | break;
|
6232 | case 25:return 42;
|
6233 | break;
|
6234 | case 26:return 43;
|
6235 | break;
|
6236 | case 27:return 44;
|
6237 | break;
|
6238 | case 28:return 45;
|
6239 | break;
|
6240 | case 29:return 46;
|
6241 | break;
|
6242 | case 30:return 47;
|
6243 | break;
|
6244 | case 31:return 48;
|
6245 | break;
|
6246 | case 32:return 59;
|
6247 | break;
|
6248 | case 33:return 60;
|
6249 | break;
|
6250 | case 34:return 61;
|
6251 | break;
|
6252 | case 35:return 62;
|
6253 | break;
|
6254 | case 36:return 63;
|
6255 | break;
|
6256 | case 37:return 64;
|
6257 | break;
|
6258 | case 38:return 65;
|
6259 | break;
|
6260 | case 39:return 51;
|
6261 | break;
|
6262 | case 40:return 53;
|
6263 | break;
|
6264 | case 41:return 55;
|
6265 | break;
|
6266 | case 42:return 58;
|
6267 | break;
|
6268 | case 43:return 57;
|
6269 | break;
|
6270 | case 44: this.begin("string");
|
6271 | break;
|
6272 | case 45: this.popState();
|
6273 | break;
|
6274 | case 46: return "qString";
|
6275 | break;
|
6276 | case 47: yy_.yytext = yy_.yytext.trim(); return 66;
|
6277 | break;
|
6278 | }
|
6279 | },
|
6280 | rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/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],
|
6281 | 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},"unqString":{"rules":[],"inclusive":false},"token":{"rules":[],"inclusive":false},"string":{"rules":[45,46],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,11,12,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,47],"inclusive":true}}
|
6282 | });
|
6283 | return lexer;
|
6284 | })();
|
6285 | parser.lexer = lexer;
|
6286 | function Parser () {
|
6287 | this.yy = {};
|
6288 | }
|
6289 | Parser.prototype = parser;parser.Parser = Parser;
|
6290 | return new Parser;
|
6291 | })();
|
6292 |
|
6293 |
|
6294 | if (true) {
|
6295 | exports.parser = parser;
|
6296 | exports.Parser = parser.Parser;
|
6297 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
6298 | exports.main = function commonjsMain (args) {
|
6299 | if (!args[1]) {
|
6300 | console.log('Usage: '+args[0]+' FILE');
|
6301 | process.exit(1);
|
6302 | }
|
6303 | var source = __webpack_require__(/*! fs */ "?ebf4").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
|
6304 | return exports.parser.parse(source);
|
6305 | };
|
6306 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
6307 | exports.main(process.argv.slice(1));
|
6308 | }
|
6309 | }
|
6310 |
|
6311 | /***/ }),
|
6312 |
|
6313 | /***/ "./src/diagrams/sequence/parser/sequenceDiagram.jison":
|
6314 | /*!************************************************************!*\
|
6315 | !*** ./src/diagrams/sequence/parser/sequenceDiagram.jison ***!
|
6316 | \************************************************************/
|
6317 | /***/ ((module, exports, __webpack_require__) => {
|
6318 |
|
6319 | /* module decorator */ module = __webpack_require__.nmd(module);
|
6320 | /* parser generated by jison 0.4.18 */
|
6321 | /*
|
6322 | Returns a Parser object of the following structure:
|
6323 |
|
6324 | Parser: {
|
6325 | yy: {}
|
6326 | }
|
6327 |
|
6328 | Parser.prototype: {
|
6329 | yy: {},
|
6330 | trace: function(),
|
6331 | symbols_: {associative list: name ==> number},
|
6332 | terminals_: {associative list: number ==> name},
|
6333 | productions_: [...],
|
6334 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
6335 | table: [...],
|
6336 | defaultActions: {...},
|
6337 | parseError: function(str, hash),
|
6338 | parse: function(input),
|
6339 |
|
6340 | lexer: {
|
6341 | EOF: 1,
|
6342 | parseError: function(str, hash),
|
6343 | setInput: function(input),
|
6344 | input: function(),
|
6345 | unput: function(str),
|
6346 | more: function(),
|
6347 | less: function(n),
|
6348 | pastInput: function(),
|
6349 | upcomingInput: function(),
|
6350 | showPosition: function(),
|
6351 | test_match: function(regex_match_array, rule_index),
|
6352 | next: function(),
|
6353 | lex: function(),
|
6354 | begin: function(condition),
|
6355 | popState: function(),
|
6356 | _currentRules: function(),
|
6357 | topState: function(),
|
6358 | pushState: function(condition),
|
6359 |
|
6360 | options: {
|
6361 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
6362 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
6363 | 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)
|
6364 | },
|
6365 |
|
6366 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
6367 | rules: [...],
|
6368 | conditions: {associative list: name ==> set},
|
6369 | }
|
6370 | }
|
6371 |
|
6372 |
|
6373 | token location info (@$, _$, etc.): {
|
6374 | first_line: n,
|
6375 | last_line: n,
|
6376 | first_column: n,
|
6377 | last_column: n,
|
6378 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
6379 | }
|
6380 |
|
6381 |
|
6382 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
6383 | text: (matched text)
|
6384 | token: (the produced terminal token, if any)
|
6385 | line: (yylineno)
|
6386 | }
|
6387 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
6388 | loc: (yylloc)
|
6389 | expected: (string describing the set of expected tokens)
|
6390 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
6391 | }
|
6392 | */
|
6393 | var parser = (function(){
|
6394 | 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,37],$Vj=[1,38],$Vk=[1,39],$Vl=[1,40],$Vm=[1,41],$Vn=[1,42],$Vo=[1,45],$Vp=[1,4,5,16,20,22,23,24,30,32,33,34,35,36,38,40,41,42,46,47,48,49,57,67],$Vq=[1,58],$Vr=[4,5,16,20,22,23,24,30,32,33,34,35,36,38,42,46,47,48,49,57,67],$Vs=[4,5,16,20,22,23,24,30,32,33,34,35,36,38,41,42,46,47,48,49,57,67],$Vt=[4,5,16,20,22,23,24,30,32,33,34,35,36,38,40,42,46,47,48,49,57,67],$Vu=[55,56,57],$Vv=[1,4,5,7,16,20,22,23,24,30,32,33,34,35,36,38,40,41,42,46,47,48,49,57,67];
|
6395 | var parser = {trace: function trace () { },
|
6396 | yy: {},
|
6397 | 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,"activate":23,"deactivate":24,"note_statement":25,"links_statement":26,"link_statement":27,"properties_statement":28,"details_statement":29,"title":30,"text2":31,"loop":32,"end":33,"rect":34,"opt":35,"alt":36,"else_sections":37,"par":38,"par_sections":39,"and":40,"else":41,"note":42,"placement":43,"over":44,"actor_pair":45,"links":46,"link":47,"properties":48,"details":49,"spaceList":50,",":51,"left_of":52,"right_of":53,"signaltype":54,"+":55,"-":56,"ACTOR":57,"SOLID_OPEN_ARROW":58,"DOTTED_OPEN_ARROW":59,"SOLID_ARROW":60,"DOTTED_ARROW":61,"SOLID_CROSS":62,"DOTTED_CROSS":63,"SOLID_POINT":64,"DOTTED_POINT":65,"TXT":66,"open_directive":67,"type_directive":68,"arg_directive":69,"close_directive":70,"$accept":0,"$end":1},
|
6398 | terminals_: {2:"error",4:"SPACE",5:"NEWLINE",7:"SD",14:":",16:"participant",18:"AS",19:"restOfLine",20:"participant_actor",22:"autonumber",23:"activate",24:"deactivate",30:"title",32:"loop",33:"end",34:"rect",35:"opt",36:"alt",38:"par",40:"and",41:"else",42:"note",44:"over",46:"links",47:"link",48:"properties",49:"details",51:",",52:"left_of",53:"right_of",55:"+",56:"-",57:"ACTOR",58:"SOLID_OPEN_ARROW",59:"DOTTED_OPEN_ARROW",60:"SOLID_ARROW",61:"DOTTED_ARROW",62:"SOLID_CROSS",63:"DOTTED_CROSS",64:"SOLID_POINT",65:"DOTTED_POINT",66:"TXT",67:"open_directive",68:"type_directive",69:"arg_directive",70:"close_directive"},
|
6399 | 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,1],[10,3],[10,3],[10,2],[10,2],[10,2],[10,2],[10,2],[10,3],[10,4],[10,4],[10,4],[10,4],[10,4],[10,1],[39,1],[39,4],[37,1],[37,4],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[50,2],[50,1],[45,3],[45,1],[43,1],[43,1],[21,5],[21,5],[21,4],[17,1],[54,1],[54,1],[54,1],[54,1],[54,1],[54,1],[54,1],[54,1],[31,1],[11,1],[12,1],[15,1],[13,1]],
|
6400 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
6401 | /* this == yyval */
|
6402 |
|
6403 | var $0 = $$.length - 1;
|
6404 | switch (yystate) {
|
6405 | case 4:
|
6406 | yy.apply($$[$0]);return $$[$0];
|
6407 | break;
|
6408 | case 5:
|
6409 | this.$ = []
|
6410 | break;
|
6411 | case 6:
|
6412 | $$[$0-1].push($$[$0]);this.$ = $$[$0-1]
|
6413 | break;
|
6414 | case 7: case 8:
|
6415 | this.$ = $$[$0]
|
6416 | break;
|
6417 | case 9:
|
6418 | this.$=[];
|
6419 | break;
|
6420 | case 12:
|
6421 | $$[$0-3].type='addParticipant';$$[$0-3].description=yy.parseMessage($$[$0-1]); this.$=$$[$0-3];
|
6422 | break;
|
6423 | case 13:
|
6424 | $$[$0-1].type='addParticipant';this.$=$$[$0-1];
|
6425 | break;
|
6426 | case 14:
|
6427 | $$[$0-3].type='addActor';$$[$0-3].description=yy.parseMessage($$[$0-1]); this.$=$$[$0-3];
|
6428 | break;
|
6429 | case 15:
|
6430 | $$[$0-1].type='addActor'; this.$=$$[$0-1];
|
6431 | break;
|
6432 | case 17:
|
6433 | yy.enableSequenceNumbers()
|
6434 | break;
|
6435 | case 18:
|
6436 | this.$={type: 'activeStart', signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0-1]};
|
6437 | break;
|
6438 | case 19:
|
6439 | this.$={type: 'activeEnd', signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0-1]};
|
6440 | break;
|
6441 | case 25:
|
6442 | this.$=[{type:'setTitle', text:$$[$0-1]}]
|
6443 | break;
|
6444 | case 26:
|
6445 |
|
6446 | $$[$0-1].unshift({type: 'loopStart', loopText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.LOOP_START});
|
6447 | $$[$0-1].push({type: 'loopEnd', loopText:$$[$0-2], signalType: yy.LINETYPE.LOOP_END});
|
6448 | this.$=$$[$0-1];
|
6449 | break;
|
6450 | case 27:
|
6451 |
|
6452 | $$[$0-1].unshift({type: 'rectStart', color:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.RECT_START });
|
6453 | $$[$0-1].push({type: 'rectEnd', color:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.RECT_END });
|
6454 | this.$=$$[$0-1];
|
6455 | break;
|
6456 | case 28:
|
6457 |
|
6458 | $$[$0-1].unshift({type: 'optStart', optText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.OPT_START});
|
6459 | $$[$0-1].push({type: 'optEnd', optText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.OPT_END});
|
6460 | this.$=$$[$0-1];
|
6461 | break;
|
6462 | case 29:
|
6463 |
|
6464 | // Alt start
|
6465 | $$[$0-1].unshift({type: 'altStart', altText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.ALT_START});
|
6466 | // Content in alt is already in $$[$0-1]
|
6467 | // End
|
6468 | $$[$0-1].push({type: 'altEnd', signalType: yy.LINETYPE.ALT_END});
|
6469 | this.$=$$[$0-1];
|
6470 | break;
|
6471 | case 30:
|
6472 |
|
6473 | // Parallel start
|
6474 | $$[$0-1].unshift({type: 'parStart', parText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.PAR_START});
|
6475 | // Content in par is already in $$[$0-1]
|
6476 | // End
|
6477 | $$[$0-1].push({type: 'parEnd', signalType: yy.LINETYPE.PAR_END});
|
6478 | this.$=$$[$0-1];
|
6479 | break;
|
6480 | case 33:
|
6481 | this.$ = $$[$0-3].concat([{type: 'and', parText:yy.parseMessage($$[$0-1]), signalType: yy.LINETYPE.PAR_AND}, $$[$0]]);
|
6482 | break;
|
6483 | case 35:
|
6484 | this.$ = $$[$0-3].concat([{type: 'else', altText:yy.parseMessage($$[$0-1]), signalType: yy.LINETYPE.ALT_ELSE}, $$[$0]]);
|
6485 | break;
|
6486 | case 36:
|
6487 |
|
6488 | this.$ = [$$[$0-1], {type:'addNote', placement:$$[$0-2], actor:$$[$0-1].actor, text:$$[$0]}];
|
6489 | break;
|
6490 | case 37:
|
6491 |
|
6492 | // Coerce actor_pair into a [to, from, ...] array
|
6493 | $$[$0-2] = [].concat($$[$0-1], $$[$0-1]).slice(0, 2);
|
6494 | $$[$0-2][0] = $$[$0-2][0].actor;
|
6495 | $$[$0-2][1] = $$[$0-2][1].actor;
|
6496 | this.$ = [$$[$0-1], {type:'addNote', placement:yy.PLACEMENT.OVER, actor:$$[$0-2].slice(0, 2), text:$$[$0]}];
|
6497 | break;
|
6498 | case 38:
|
6499 |
|
6500 | this.$ = [$$[$0-1], {type:'addLinks', actor:$$[$0-1].actor, text:$$[$0]}];
|
6501 |
|
6502 | break;
|
6503 | case 39:
|
6504 |
|
6505 | this.$ = [$$[$0-1], {type:'addALink', actor:$$[$0-1].actor, text:$$[$0]}];
|
6506 |
|
6507 | break;
|
6508 | case 40:
|
6509 |
|
6510 | this.$ = [$$[$0-1], {type:'addProperties', actor:$$[$0-1].actor, text:$$[$0]}];
|
6511 |
|
6512 | break;
|
6513 | case 41:
|
6514 |
|
6515 | this.$ = [$$[$0-1], {type:'addDetails', actor:$$[$0-1].actor, text:$$[$0]}];
|
6516 |
|
6517 | break;
|
6518 | case 44:
|
6519 | this.$ = [$$[$0-2], $$[$0]];
|
6520 | break;
|
6521 | case 45:
|
6522 | this.$ = $$[$0];
|
6523 | break;
|
6524 | case 46:
|
6525 | this.$ = yy.PLACEMENT.LEFTOF;
|
6526 | break;
|
6527 | case 47:
|
6528 | this.$ = yy.PLACEMENT.RIGHTOF;
|
6529 | break;
|
6530 | case 48:
|
6531 | this.$ = [$$[$0-4],$$[$0-1],{type: 'addMessage', from:$$[$0-4].actor, to:$$[$0-1].actor, signalType:$$[$0-3], msg:$$[$0]},
|
6532 | {type: 'activeStart', signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0-1]}
|
6533 | ]
|
6534 | break;
|
6535 | case 49:
|
6536 | this.$ = [$$[$0-4],$$[$0-1],{type: 'addMessage', from:$$[$0-4].actor, to:$$[$0-1].actor, signalType:$$[$0-3], msg:$$[$0]},
|
6537 | {type: 'activeEnd', signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0-4]}
|
6538 | ]
|
6539 | break;
|
6540 | case 50:
|
6541 | this.$ = [$$[$0-3],$$[$0-1],{type: 'addMessage', from:$$[$0-3].actor, to:$$[$0-1].actor, signalType:$$[$0-2], msg:$$[$0]}]
|
6542 | break;
|
6543 | case 51:
|
6544 | this.$={ type: 'addParticipant', actor:$$[$0]}
|
6545 | break;
|
6546 | case 52:
|
6547 | this.$ = yy.LINETYPE.SOLID_OPEN;
|
6548 | break;
|
6549 | case 53:
|
6550 | this.$ = yy.LINETYPE.DOTTED_OPEN;
|
6551 | break;
|
6552 | case 54:
|
6553 | this.$ = yy.LINETYPE.SOLID;
|
6554 | break;
|
6555 | case 55:
|
6556 | this.$ = yy.LINETYPE.DOTTED;
|
6557 | break;
|
6558 | case 56:
|
6559 | this.$ = yy.LINETYPE.SOLID_CROSS;
|
6560 | break;
|
6561 | case 57:
|
6562 | this.$ = yy.LINETYPE.DOTTED_CROSS;
|
6563 | break;
|
6564 | case 58:
|
6565 | this.$ = yy.LINETYPE.SOLID_POINT;
|
6566 | break;
|
6567 | case 59:
|
6568 | this.$ = yy.LINETYPE.DOTTED_POINT;
|
6569 | break;
|
6570 | case 60:
|
6571 | this.$ = yy.parseMessage($$[$0].trim().substring(1))
|
6572 | break;
|
6573 | case 61:
|
6574 | yy.parseDirective('%%{', 'open_directive');
|
6575 | break;
|
6576 | case 62:
|
6577 | yy.parseDirective($$[$0], 'type_directive');
|
6578 | break;
|
6579 | case 63:
|
6580 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
6581 | break;
|
6582 | case 64:
|
6583 | yy.parseDirective('}%%', 'close_directive', 'sequence');
|
6584 | break;
|
6585 | }
|
6586 | },
|
6587 | table: [{3:1,4:$V0,5:$V1,6:4,7:$V2,11:6,67:$V3},{1:[3]},{3:8,4:$V0,5:$V1,6:4,7:$V2,11:6,67:$V3},{3:9,4:$V0,5:$V1,6:4,7:$V2,11:6,67:$V3},{3:10,4:$V0,5:$V1,6:4,7:$V2,11:6,67:$V3},o([1,4,5,16,20,22,23,24,30,32,34,35,36,38,42,46,47,48,49,57,67],$V4,{8:11}),{12:12,68:[1,13]},{68:[2,61]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:$V5,5:$V6,6:35,9:14,10:16,11:6,16:$V7,17:36,20:$V8,21:20,22:$V9,23:$Va,24:$Vb,25:24,26:25,27:26,28:27,29:28,30:$Vc,32:$Vd,34:$Ve,35:$Vf,36:$Vg,38:$Vh,42:$Vi,46:$Vj,47:$Vk,48:$Vl,49:$Vm,57:$Vn,67:$V3},{13:43,14:[1,44],70:$Vo},o([14,70],[2,62]),o($Vp,[2,6]),{6:35,10:46,11:6,16:$V7,17:36,20:$V8,21:20,22:$V9,23:$Va,24:$Vb,25:24,26:25,27:26,28:27,29:28,30:$Vc,32:$Vd,34:$Ve,35:$Vf,36:$Vg,38:$Vh,42:$Vi,46:$Vj,47:$Vk,48:$Vl,49:$Vm,57:$Vn,67:$V3},o($Vp,[2,8]),o($Vp,[2,9]),{17:47,57:$Vn},{17:48,57:$Vn},{5:[1,49]},o($Vp,[2,17]),{17:50,57:$Vn},{17:51,57:$Vn},{5:[1,52]},{5:[1,53]},{5:[1,54]},{5:[1,55]},{5:[1,56]},{31:57,66:$Vq},{19:[1,59]},{19:[1,60]},{19:[1,61]},{19:[1,62]},{19:[1,63]},o($Vp,[2,31]),{54:64,58:[1,65],59:[1,66],60:[1,67],61:[1,68],62:[1,69],63:[1,70],64:[1,71],65:[1,72]},{43:73,44:[1,74],52:[1,75],53:[1,76]},{17:77,57:$Vn},{17:78,57:$Vn},{17:79,57:$Vn},{17:80,57:$Vn},o([5,18,51,58,59,60,61,62,63,64,65,66],[2,51]),{5:[1,81]},{15:82,69:[1,83]},{5:[2,64]},o($Vp,[2,7]),{5:[1,85],18:[1,84]},{5:[1,87],18:[1,86]},o($Vp,[2,16]),{5:[1,88]},{5:[1,89]},o($Vp,[2,20]),o($Vp,[2,21]),o($Vp,[2,22]),o($Vp,[2,23]),o($Vp,[2,24]),{5:[1,90]},{5:[2,60]},o($Vr,$V4,{8:91}),o($Vr,$V4,{8:92}),o($Vr,$V4,{8:93}),o($Vs,$V4,{37:94,8:95}),o($Vt,$V4,{39:96,8:97}),{17:100,55:[1,98],56:[1,99],57:$Vn},o($Vu,[2,52]),o($Vu,[2,53]),o($Vu,[2,54]),o($Vu,[2,55]),o($Vu,[2,56]),o($Vu,[2,57]),o($Vu,[2,58]),o($Vu,[2,59]),{17:101,57:$Vn},{17:103,45:102,57:$Vn},{57:[2,46]},{57:[2,47]},{31:104,66:$Vq},{31:105,66:$Vq},{31:106,66:$Vq},{31:107,66:$Vq},o($Vv,[2,10]),{13:108,70:$Vo},{70:[2,63]},{19:[1,109]},o($Vp,[2,13]),{19:[1,110]},o($Vp,[2,15]),o($Vp,[2,18]),o($Vp,[2,19]),o($Vp,[2,25]),{4:$V5,5:$V6,6:35,9:14,10:16,11:6,16:$V7,17:36,20:$V8,21:20,22:$V9,23:$Va,24:$Vb,25:24,26:25,27:26,28:27,29:28,30:$Vc,32:$Vd,33:[1,111],34:$Ve,35:$Vf,36:$Vg,38:$Vh,42:$Vi,46:$Vj,47:$Vk,48:$Vl,49:$Vm,57:$Vn,67:$V3},{4:$V5,5:$V6,6:35,9:14,10:16,11:6,16:$V7,17:36,20:$V8,21:20,22:$V9,23:$Va,24:$Vb,25:24,26:25,27:26,28:27,29:28,30:$Vc,32:$Vd,33:[1,112],34:$Ve,35:$Vf,36:$Vg,38:$Vh,42:$Vi,46:$Vj,47:$Vk,48:$Vl,49:$Vm,57:$Vn,67:$V3},{4:$V5,5:$V6,6:35,9:14,10:16,11:6,16:$V7,17:36,20:$V8,21:20,22:$V9,23:$Va,24:$Vb,25:24,26:25,27:26,28:27,29:28,30:$Vc,32:$Vd,33:[1,113],34:$Ve,35:$Vf,36:$Vg,38:$Vh,42:$Vi,46:$Vj,47:$Vk,48:$Vl,49:$Vm,57:$Vn,67:$V3},{33:[1,114]},{4:$V5,5:$V6,6:35,9:14,10:16,11:6,16:$V7,17:36,20:$V8,21:20,22:$V9,23:$Va,24:$Vb,25:24,26:25,27:26,28:27,29:28,30:$Vc,32:$Vd,33:[2,34],34:$Ve,35:$Vf,36:$Vg,38:$Vh,41:[1,115],42:$Vi,46:$Vj,47:$Vk,48:$Vl,49:$Vm,57:$Vn,67:$V3},{33:[1,116]},{4:$V5,5:$V6,6:35,9:14,10:16,11:6,16:$V7,17:36,20:$V8,21:20,22:$V9,23:$Va,24:$Vb,25:24,26:25,27:26,28:27,29:28,30:$Vc,32:$Vd,33:[2,32],34:$Ve,35:$Vf,36:$Vg,38:$Vh,40:[1,117],42:$Vi,46:$Vj,47:$Vk,48:$Vl,49:$Vm,57:$Vn,67:$V3},{17:118,57:$Vn},{17:119,57:$Vn},{31:120,66:$Vq},{31:121,66:$Vq},{31:122,66:$Vq},{51:[1,123],66:[2,45]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},{5:[1,124]},{5:[1,125]},{5:[1,126]},o($Vp,[2,26]),o($Vp,[2,27]),o($Vp,[2,28]),o($Vp,[2,29]),{19:[1,127]},o($Vp,[2,30]),{19:[1,128]},{31:129,66:$Vq},{31:130,66:$Vq},{5:[2,50]},{5:[2,36]},{5:[2,37]},{17:131,57:$Vn},o($Vv,[2,11]),o($Vp,[2,12]),o($Vp,[2,14]),o($Vs,$V4,{8:95,37:132}),o($Vt,$V4,{8:97,39:133}),{5:[2,48]},{5:[2,49]},{66:[2,44]},{33:[2,35]},{33:[2,33]}],
|
6588 | defaultActions: {7:[2,61],8:[2,1],9:[2,2],10:[2,3],45:[2,64],58:[2,60],75:[2,46],76:[2,47],83:[2,63],104:[2,38],105:[2,39],106:[2,40],107:[2,41],120:[2,50],121:[2,36],122:[2,37],129:[2,48],130:[2,49],131:[2,44],132:[2,35],133:[2,33]},
|
6589 | parseError: function parseError (str, hash) {
|
6590 | if (hash.recoverable) {
|
6591 | this.trace(str);
|
6592 | } else {
|
6593 | var error = new Error(str);
|
6594 | error.hash = hash;
|
6595 | throw error;
|
6596 | }
|
6597 | },
|
6598 | parse: function parse(input) {
|
6599 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
6600 | var args = lstack.slice.call(arguments, 1);
|
6601 | var lexer = Object.create(this.lexer);
|
6602 | var sharedState = { yy: {} };
|
6603 | for (var k in this.yy) {
|
6604 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
6605 | sharedState.yy[k] = this.yy[k];
|
6606 | }
|
6607 | }
|
6608 | lexer.setInput(input, sharedState.yy);
|
6609 | sharedState.yy.lexer = lexer;
|
6610 | sharedState.yy.parser = this;
|
6611 | if (typeof lexer.yylloc == 'undefined') {
|
6612 | lexer.yylloc = {};
|
6613 | }
|
6614 | var yyloc = lexer.yylloc;
|
6615 | lstack.push(yyloc);
|
6616 | var ranges = lexer.options && lexer.options.ranges;
|
6617 | if (typeof sharedState.yy.parseError === 'function') {
|
6618 | this.parseError = sharedState.yy.parseError;
|
6619 | } else {
|
6620 | this.parseError = Object.getPrototypeOf(this).parseError;
|
6621 | }
|
6622 | function popStack(n) {
|
6623 | stack.length = stack.length - 2 * n;
|
6624 | vstack.length = vstack.length - n;
|
6625 | lstack.length = lstack.length - n;
|
6626 | }
|
6627 | function lex() {
|
6628 | var token;
|
6629 | token = tstack.pop() || lexer.lex() || EOF;
|
6630 | if (typeof token !== 'number') {
|
6631 | if (token instanceof Array) {
|
6632 | tstack = token;
|
6633 | token = tstack.pop();
|
6634 | }
|
6635 | token = self.symbols_[token] || token;
|
6636 | }
|
6637 | return token;
|
6638 | }
|
6639 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
6640 | while (true) {
|
6641 | state = stack[stack.length - 1];
|
6642 | if (this.defaultActions[state]) {
|
6643 | action = this.defaultActions[state];
|
6644 | } else {
|
6645 | if (symbol === null || typeof symbol == 'undefined') {
|
6646 | symbol = lex();
|
6647 | }
|
6648 | action = table[state] && table[state][symbol];
|
6649 | }
|
6650 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
6651 | var errStr = '';
|
6652 | expected = [];
|
6653 | for (p in table[state]) {
|
6654 | if (this.terminals_[p] && p > TERROR) {
|
6655 | expected.push('\'' + this.terminals_[p] + '\'');
|
6656 | }
|
6657 | }
|
6658 | if (lexer.showPosition) {
|
6659 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
6660 | } else {
|
6661 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
6662 | }
|
6663 | this.parseError(errStr, {
|
6664 | text: lexer.match,
|
6665 | token: this.terminals_[symbol] || symbol,
|
6666 | line: lexer.yylineno,
|
6667 | loc: yyloc,
|
6668 | expected: expected
|
6669 | });
|
6670 | }
|
6671 | if (action[0] instanceof Array && action.length > 1) {
|
6672 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
6673 | }
|
6674 | switch (action[0]) {
|
6675 | case 1:
|
6676 | stack.push(symbol);
|
6677 | vstack.push(lexer.yytext);
|
6678 | lstack.push(lexer.yylloc);
|
6679 | stack.push(action[1]);
|
6680 | symbol = null;
|
6681 | if (!preErrorSymbol) {
|
6682 | yyleng = lexer.yyleng;
|
6683 | yytext = lexer.yytext;
|
6684 | yylineno = lexer.yylineno;
|
6685 | yyloc = lexer.yylloc;
|
6686 | if (recovering > 0) {
|
6687 | recovering--;
|
6688 | }
|
6689 | } else {
|
6690 | symbol = preErrorSymbol;
|
6691 | preErrorSymbol = null;
|
6692 | }
|
6693 | break;
|
6694 | case 2:
|
6695 | len = this.productions_[action[1]][1];
|
6696 | yyval.$ = vstack[vstack.length - len];
|
6697 | yyval._$ = {
|
6698 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
6699 | last_line: lstack[lstack.length - 1].last_line,
|
6700 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
6701 | last_column: lstack[lstack.length - 1].last_column
|
6702 | };
|
6703 | if (ranges) {
|
6704 | yyval._$.range = [
|
6705 | lstack[lstack.length - (len || 1)].range[0],
|
6706 | lstack[lstack.length - 1].range[1]
|
6707 | ];
|
6708 | }
|
6709 | r = this.performAction.apply(yyval, [
|
6710 | yytext,
|
6711 | yyleng,
|
6712 | yylineno,
|
6713 | sharedState.yy,
|
6714 | action[1],
|
6715 | vstack,
|
6716 | lstack
|
6717 | ].concat(args));
|
6718 | if (typeof r !== 'undefined') {
|
6719 | return r;
|
6720 | }
|
6721 | if (len) {
|
6722 | stack = stack.slice(0, -1 * len * 2);
|
6723 | vstack = vstack.slice(0, -1 * len);
|
6724 | lstack = lstack.slice(0, -1 * len);
|
6725 | }
|
6726 | stack.push(this.productions_[action[1]][0]);
|
6727 | vstack.push(yyval.$);
|
6728 | lstack.push(yyval._$);
|
6729 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
6730 | stack.push(newState);
|
6731 | break;
|
6732 | case 3:
|
6733 | return true;
|
6734 | }
|
6735 | }
|
6736 | return true;
|
6737 | }};
|
6738 |
|
6739 | /* generated by jison-lex 0.3.4 */
|
6740 | var lexer = (function(){
|
6741 | var lexer = ({
|
6742 |
|
6743 | EOF:1,
|
6744 |
|
6745 | parseError:function parseError(str, hash) {
|
6746 | if (this.yy.parser) {
|
6747 | this.yy.parser.parseError(str, hash);
|
6748 | } else {
|
6749 | throw new Error(str);
|
6750 | }
|
6751 | },
|
6752 |
|
6753 | // resets the lexer, sets new input
|
6754 | setInput:function (input, yy) {
|
6755 | this.yy = yy || this.yy || {};
|
6756 | this._input = input;
|
6757 | this._more = this._backtrack = this.done = false;
|
6758 | this.yylineno = this.yyleng = 0;
|
6759 | this.yytext = this.matched = this.match = '';
|
6760 | this.conditionStack = ['INITIAL'];
|
6761 | this.yylloc = {
|
6762 | first_line: 1,
|
6763 | first_column: 0,
|
6764 | last_line: 1,
|
6765 | last_column: 0
|
6766 | };
|
6767 | if (this.options.ranges) {
|
6768 | this.yylloc.range = [0,0];
|
6769 | }
|
6770 | this.offset = 0;
|
6771 | return this;
|
6772 | },
|
6773 |
|
6774 | // consumes and returns one char from the input
|
6775 | input:function () {
|
6776 | var ch = this._input[0];
|
6777 | this.yytext += ch;
|
6778 | this.yyleng++;
|
6779 | this.offset++;
|
6780 | this.match += ch;
|
6781 | this.matched += ch;
|
6782 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
6783 | if (lines) {
|
6784 | this.yylineno++;
|
6785 | this.yylloc.last_line++;
|
6786 | } else {
|
6787 | this.yylloc.last_column++;
|
6788 | }
|
6789 | if (this.options.ranges) {
|
6790 | this.yylloc.range[1]++;
|
6791 | }
|
6792 |
|
6793 | this._input = this._input.slice(1);
|
6794 | return ch;
|
6795 | },
|
6796 |
|
6797 | // unshifts one char (or a string) into the input
|
6798 | unput:function (ch) {
|
6799 | var len = ch.length;
|
6800 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
6801 |
|
6802 | this._input = ch + this._input;
|
6803 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
6804 | //this.yyleng -= len;
|
6805 | this.offset -= len;
|
6806 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
6807 | this.match = this.match.substr(0, this.match.length - 1);
|
6808 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
6809 |
|
6810 | if (lines.length - 1) {
|
6811 | this.yylineno -= lines.length - 1;
|
6812 | }
|
6813 | var r = this.yylloc.range;
|
6814 |
|
6815 | this.yylloc = {
|
6816 | first_line: this.yylloc.first_line,
|
6817 | last_line: this.yylineno + 1,
|
6818 | first_column: this.yylloc.first_column,
|
6819 | last_column: lines ?
|
6820 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
6821 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
6822 | this.yylloc.first_column - len
|
6823 | };
|
6824 |
|
6825 | if (this.options.ranges) {
|
6826 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
6827 | }
|
6828 | this.yyleng = this.yytext.length;
|
6829 | return this;
|
6830 | },
|
6831 |
|
6832 | // When called from action, caches matched text and appends it on next action
|
6833 | more:function () {
|
6834 | this._more = true;
|
6835 | return this;
|
6836 | },
|
6837 |
|
6838 | // 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.
|
6839 | reject:function () {
|
6840 | if (this.options.backtrack_lexer) {
|
6841 | this._backtrack = true;
|
6842 | } else {
|
6843 | 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(), {
|
6844 | text: "",
|
6845 | token: null,
|
6846 | line: this.yylineno
|
6847 | });
|
6848 |
|
6849 | }
|
6850 | return this;
|
6851 | },
|
6852 |
|
6853 | // retain first n characters of the match
|
6854 | less:function (n) {
|
6855 | this.unput(this.match.slice(n));
|
6856 | },
|
6857 |
|
6858 | // displays already matched input, i.e. for error messages
|
6859 | pastInput:function () {
|
6860 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
6861 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
6862 | },
|
6863 |
|
6864 | // displays upcoming input, i.e. for error messages
|
6865 | upcomingInput:function () {
|
6866 | var next = this.match;
|
6867 | if (next.length < 20) {
|
6868 | next += this._input.substr(0, 20-next.length);
|
6869 | }
|
6870 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
6871 | },
|
6872 |
|
6873 | // displays the character position where the lexing error occurred, i.e. for error messages
|
6874 | showPosition:function () {
|
6875 | var pre = this.pastInput();
|
6876 | var c = new Array(pre.length + 1).join("-");
|
6877 | return pre + this.upcomingInput() + "\n" + c + "^";
|
6878 | },
|
6879 |
|
6880 | // test the lexed token: return FALSE when not a match, otherwise return token
|
6881 | test_match:function(match, indexed_rule) {
|
6882 | var token,
|
6883 | lines,
|
6884 | backup;
|
6885 |
|
6886 | if (this.options.backtrack_lexer) {
|
6887 | // save context
|
6888 | backup = {
|
6889 | yylineno: this.yylineno,
|
6890 | yylloc: {
|
6891 | first_line: this.yylloc.first_line,
|
6892 | last_line: this.last_line,
|
6893 | first_column: this.yylloc.first_column,
|
6894 | last_column: this.yylloc.last_column
|
6895 | },
|
6896 | yytext: this.yytext,
|
6897 | match: this.match,
|
6898 | matches: this.matches,
|
6899 | matched: this.matched,
|
6900 | yyleng: this.yyleng,
|
6901 | offset: this.offset,
|
6902 | _more: this._more,
|
6903 | _input: this._input,
|
6904 | yy: this.yy,
|
6905 | conditionStack: this.conditionStack.slice(0),
|
6906 | done: this.done
|
6907 | };
|
6908 | if (this.options.ranges) {
|
6909 | backup.yylloc.range = this.yylloc.range.slice(0);
|
6910 | }
|
6911 | }
|
6912 |
|
6913 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
6914 | if (lines) {
|
6915 | this.yylineno += lines.length;
|
6916 | }
|
6917 | this.yylloc = {
|
6918 | first_line: this.yylloc.last_line,
|
6919 | last_line: this.yylineno + 1,
|
6920 | first_column: this.yylloc.last_column,
|
6921 | last_column: lines ?
|
6922 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
6923 | this.yylloc.last_column + match[0].length
|
6924 | };
|
6925 | this.yytext += match[0];
|
6926 | this.match += match[0];
|
6927 | this.matches = match;
|
6928 | this.yyleng = this.yytext.length;
|
6929 | if (this.options.ranges) {
|
6930 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
6931 | }
|
6932 | this._more = false;
|
6933 | this._backtrack = false;
|
6934 | this._input = this._input.slice(match[0].length);
|
6935 | this.matched += match[0];
|
6936 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
6937 | if (this.done && this._input) {
|
6938 | this.done = false;
|
6939 | }
|
6940 | if (token) {
|
6941 | return token;
|
6942 | } else if (this._backtrack) {
|
6943 | // recover context
|
6944 | for (var k in backup) {
|
6945 | this[k] = backup[k];
|
6946 | }
|
6947 | return false; // rule action called reject() implying the next rule should be tested instead.
|
6948 | }
|
6949 | return false;
|
6950 | },
|
6951 |
|
6952 | // return next match in input
|
6953 | next:function () {
|
6954 | if (this.done) {
|
6955 | return this.EOF;
|
6956 | }
|
6957 | if (!this._input) {
|
6958 | this.done = true;
|
6959 | }
|
6960 |
|
6961 | var token,
|
6962 | match,
|
6963 | tempMatch,
|
6964 | index;
|
6965 | if (!this._more) {
|
6966 | this.yytext = '';
|
6967 | this.match = '';
|
6968 | }
|
6969 | var rules = this._currentRules();
|
6970 | for (var i = 0; i < rules.length; i++) {
|
6971 | tempMatch = this._input.match(this.rules[rules[i]]);
|
6972 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
6973 | match = tempMatch;
|
6974 | index = i;
|
6975 | if (this.options.backtrack_lexer) {
|
6976 | token = this.test_match(tempMatch, rules[i]);
|
6977 | if (token !== false) {
|
6978 | return token;
|
6979 | } else if (this._backtrack) {
|
6980 | match = false;
|
6981 | continue; // rule action called reject() implying a rule MISmatch.
|
6982 | } else {
|
6983 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
6984 | return false;
|
6985 | }
|
6986 | } else if (!this.options.flex) {
|
6987 | break;
|
6988 | }
|
6989 | }
|
6990 | }
|
6991 | if (match) {
|
6992 | token = this.test_match(match, rules[index]);
|
6993 | if (token !== false) {
|
6994 | return token;
|
6995 | }
|
6996 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
6997 | return false;
|
6998 | }
|
6999 | if (this._input === "") {
|
7000 | return this.EOF;
|
7001 | } else {
|
7002 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
7003 | text: "",
|
7004 | token: null,
|
7005 | line: this.yylineno
|
7006 | });
|
7007 | }
|
7008 | },
|
7009 |
|
7010 | // return next match that has a token
|
7011 | lex:function lex () {
|
7012 | var r = this.next();
|
7013 | if (r) {
|
7014 | return r;
|
7015 | } else {
|
7016 | return this.lex();
|
7017 | }
|
7018 | },
|
7019 |
|
7020 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
7021 | begin:function begin (condition) {
|
7022 | this.conditionStack.push(condition);
|
7023 | },
|
7024 |
|
7025 | // pop the previously active lexer condition state off the condition stack
|
7026 | popState:function popState () {
|
7027 | var n = this.conditionStack.length - 1;
|
7028 | if (n > 0) {
|
7029 | return this.conditionStack.pop();
|
7030 | } else {
|
7031 | return this.conditionStack[0];
|
7032 | }
|
7033 | },
|
7034 |
|
7035 | // produce the lexer rule set which is active for the currently active lexer condition state
|
7036 | _currentRules:function _currentRules () {
|
7037 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
7038 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
7039 | } else {
|
7040 | return this.conditions["INITIAL"].rules;
|
7041 | }
|
7042 | },
|
7043 |
|
7044 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
7045 | topState:function topState (n) {
|
7046 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
7047 | if (n >= 0) {
|
7048 | return this.conditionStack[n];
|
7049 | } else {
|
7050 | return "INITIAL";
|
7051 | }
|
7052 | },
|
7053 |
|
7054 | // alias for begin(condition)
|
7055 | pushState:function pushState (condition) {
|
7056 | this.begin(condition);
|
7057 | },
|
7058 |
|
7059 | // return the number of states currently on the stack
|
7060 | stateStackSize:function stateStackSize() {
|
7061 | return this.conditionStack.length;
|
7062 | },
|
7063 | options: {"case-insensitive":true},
|
7064 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
7065 | var YYSTATE=YY_START;
|
7066 | switch($avoiding_name_collisions) {
|
7067 | case 0: this.begin('open_directive'); return 67;
|
7068 | break;
|
7069 | case 1: this.begin('type_directive'); return 68;
|
7070 | break;
|
7071 | case 2: this.popState(); this.begin('arg_directive'); return 14;
|
7072 | break;
|
7073 | case 3: this.popState(); this.popState(); return 70;
|
7074 | break;
|
7075 | case 4:return 69;
|
7076 | break;
|
7077 | case 5:return 5;
|
7078 | break;
|
7079 | case 6:/* skip all whitespace */
|
7080 | break;
|
7081 | case 7:/* skip same-line whitespace */
|
7082 | break;
|
7083 | case 8:/* skip comments */
|
7084 | break;
|
7085 | case 9:/* skip comments */
|
7086 | break;
|
7087 | case 10:/* skip comments */
|
7088 | break;
|
7089 | case 11: this.begin('ID'); return 16;
|
7090 | break;
|
7091 | case 12: this.begin('ID'); return 20;
|
7092 | break;
|
7093 | case 13: yy_.yytext = yy_.yytext.trim(); this.begin('ALIAS'); return 57;
|
7094 | break;
|
7095 | case 14: this.popState(); this.popState(); this.begin('LINE'); return 18;
|
7096 | break;
|
7097 | case 15: this.popState(); this.popState(); return 5;
|
7098 | break;
|
7099 | case 16: this.begin('LINE'); return 32;
|
7100 | break;
|
7101 | case 17: this.begin('LINE'); return 34;
|
7102 | break;
|
7103 | case 18: this.begin('LINE'); return 35;
|
7104 | break;
|
7105 | case 19: this.begin('LINE'); return 36;
|
7106 | break;
|
7107 | case 20: this.begin('LINE'); return 41;
|
7108 | break;
|
7109 | case 21: this.begin('LINE'); return 38;
|
7110 | break;
|
7111 | case 22: this.begin('LINE'); return 40;
|
7112 | break;
|
7113 | case 23: this.popState(); return 19;
|
7114 | break;
|
7115 | case 24:return 33;
|
7116 | break;
|
7117 | case 25:return 52;
|
7118 | break;
|
7119 | case 26:return 53;
|
7120 | break;
|
7121 | case 27:return 46;
|
7122 | break;
|
7123 | case 28:return 47;
|
7124 | break;
|
7125 | case 29:return 48;
|
7126 | break;
|
7127 | case 30:return 49;
|
7128 | break;
|
7129 | case 31:return 44;
|
7130 | break;
|
7131 | case 32:return 42;
|
7132 | break;
|
7133 | case 33: this.begin('ID'); return 23;
|
7134 | break;
|
7135 | case 34: this.begin('ID'); return 24;
|
7136 | break;
|
7137 | case 35:return 30;
|
7138 | break;
|
7139 | case 36:return 7;
|
7140 | break;
|
7141 | case 37:return 22;
|
7142 | break;
|
7143 | case 38:return 51;
|
7144 | break;
|
7145 | case 39:return 5;
|
7146 | break;
|
7147 | case 40: yy_.yytext = yy_.yytext.trim(); return 57;
|
7148 | break;
|
7149 | case 41:return 60;
|
7150 | break;
|
7151 | case 42:return 61;
|
7152 | break;
|
7153 | case 43:return 58;
|
7154 | break;
|
7155 | case 44:return 59;
|
7156 | break;
|
7157 | case 45:return 62;
|
7158 | break;
|
7159 | case 46:return 63;
|
7160 | break;
|
7161 | case 47:return 64;
|
7162 | break;
|
7163 | case 48:return 65;
|
7164 | break;
|
7165 | case 49:return 66;
|
7166 | break;
|
7167 | case 50:return 55;
|
7168 | break;
|
7169 | case 51:return 56;
|
7170 | break;
|
7171 | case 52:return 5;
|
7172 | break;
|
7173 | case 53:return 'INVALID';
|
7174 | break;
|
7175 | }
|
7176 | },
|
7177 | rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\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,/^(?:(?:[:]?(?: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\b)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\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],
|
7178 | conditions: {"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,13],"inclusive":false},"ALIAS":{"rules":[7,8,14,15],"inclusive":false},"LINE":{"rules":[7,8,23],"inclusive":false},"INITIAL":{"rules":[0,5,6,8,9,10,11,12,16,17,18,19,20,21,22,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],"inclusive":true}}
|
7179 | });
|
7180 | return lexer;
|
7181 | })();
|
7182 | parser.lexer = lexer;
|
7183 | function Parser () {
|
7184 | this.yy = {};
|
7185 | }
|
7186 | Parser.prototype = parser;parser.Parser = Parser;
|
7187 | return new Parser;
|
7188 | })();
|
7189 |
|
7190 |
|
7191 | if (true) {
|
7192 | exports.parser = parser;
|
7193 | exports.Parser = parser.Parser;
|
7194 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
7195 | exports.main = function commonjsMain (args) {
|
7196 | if (!args[1]) {
|
7197 | console.log('Usage: '+args[0]+' FILE');
|
7198 | process.exit(1);
|
7199 | }
|
7200 | var source = __webpack_require__(/*! fs */ "?e940").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
|
7201 | return exports.parser.parse(source);
|
7202 | };
|
7203 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
7204 | exports.main(process.argv.slice(1));
|
7205 | }
|
7206 | }
|
7207 |
|
7208 | /***/ }),
|
7209 |
|
7210 | /***/ "./src/diagrams/state/parser/stateDiagram.jison":
|
7211 | /*!******************************************************!*\
|
7212 | !*** ./src/diagrams/state/parser/stateDiagram.jison ***!
|
7213 | \******************************************************/
|
7214 | /***/ ((module, exports, __webpack_require__) => {
|
7215 |
|
7216 | /* module decorator */ module = __webpack_require__.nmd(module);
|
7217 | /* parser generated by jison 0.4.18 */
|
7218 | /*
|
7219 | Returns a Parser object of the following structure:
|
7220 |
|
7221 | Parser: {
|
7222 | yy: {}
|
7223 | }
|
7224 |
|
7225 | Parser.prototype: {
|
7226 | yy: {},
|
7227 | trace: function(),
|
7228 | symbols_: {associative list: name ==> number},
|
7229 | terminals_: {associative list: number ==> name},
|
7230 | productions_: [...],
|
7231 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
7232 | table: [...],
|
7233 | defaultActions: {...},
|
7234 | parseError: function(str, hash),
|
7235 | parse: function(input),
|
7236 |
|
7237 | lexer: {
|
7238 | EOF: 1,
|
7239 | parseError: function(str, hash),
|
7240 | setInput: function(input),
|
7241 | input: function(),
|
7242 | unput: function(str),
|
7243 | more: function(),
|
7244 | less: function(n),
|
7245 | pastInput: function(),
|
7246 | upcomingInput: function(),
|
7247 | showPosition: function(),
|
7248 | test_match: function(regex_match_array, rule_index),
|
7249 | next: function(),
|
7250 | lex: function(),
|
7251 | begin: function(condition),
|
7252 | popState: function(),
|
7253 | _currentRules: function(),
|
7254 | topState: function(),
|
7255 | pushState: function(condition),
|
7256 |
|
7257 | options: {
|
7258 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
7259 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
7260 | 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)
|
7261 | },
|
7262 |
|
7263 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
7264 | rules: [...],
|
7265 | conditions: {associative list: name ==> set},
|
7266 | }
|
7267 | }
|
7268 |
|
7269 |
|
7270 | token location info (@$, _$, etc.): {
|
7271 | first_line: n,
|
7272 | last_line: n,
|
7273 | first_column: n,
|
7274 | last_column: n,
|
7275 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
7276 | }
|
7277 |
|
7278 |
|
7279 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
7280 | text: (matched text)
|
7281 | token: (the produced terminal token, if any)
|
7282 | line: (yylineno)
|
7283 | }
|
7284 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
7285 | loc: (yylloc)
|
7286 | expected: (string describing the set of expected tokens)
|
7287 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
7288 | }
|
7289 | */
|
7290 | var parser = (function(){
|
7291 | 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,30],$Vc=[1,23],$Vd=[1,24],$Ve=[1,25],$Vf=[1,26],$Vg=[1,27],$Vh=[1,32],$Vi=[1,33],$Vj=[1,34],$Vk=[1,35],$Vl=[1,31],$Vm=[1,38],$Vn=[1,4,5,14,15,17,19,20,22,23,24,25,26,27,36,37,38,39,42,45],$Vo=[1,4,5,12,13,14,15,17,19,20,22,23,24,25,26,27,36,37,38,39,42,45],$Vp=[1,4,5,7,14,15,17,19,20,22,23,24,25,26,27,36,37,38,39,42,45],$Vq=[4,5,14,15,17,19,20,22,23,24,25,26,27,36,37,38,39,42,45];
|
7292 | var parser = {trace: function trace () { },
|
7293 | yy: {},
|
7294 | 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,"openDirective":31,"typeDirective":32,"closeDirective":33,":":34,"argDirective":35,"direction_tb":36,"direction_bt":37,"direction_rl":38,"direction_lr":39,"eol":40,";":41,"EDGE_STATE":42,"left_of":43,"right_of":44,"open_directive":45,"type_directive":46,"arg_directive":47,"close_directive":48,"$accept":0,"$end":1},
|
7295 | 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",34:":",36:"direction_tb",37:"direction_bt",38:"direction_rl",39:"direction_lr",41:";",42:"EDGE_STATE",43:"left_of",44:"right_of",45:"open_directive",46:"type_directive",47:"arg_directive",48:"close_directive"},
|
7296 | 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],[6,3],[6,5],[30,1],[30,1],[30,1],[30,1],[40,1],[40,1],[11,1],[11,1],[28,1],[28,1],[31,1],[32,1],[35,1],[33,1]],
|
7297 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
7298 | /* this == yyval */
|
7299 |
|
7300 | var $0 = $$.length - 1;
|
7301 | switch (yystate) {
|
7302 | case 4:
|
7303 | /*console.warn('Root document', $$[$0]);*/ yy.setRootDoc($$[$0]);return $$[$0];
|
7304 | break;
|
7305 | case 5:
|
7306 | this.$ = []
|
7307 | break;
|
7308 | case 6:
|
7309 |
|
7310 | if($$[$0]!='nl'){
|
7311 | $$[$0-1].push($$[$0]);this.$ = $$[$0-1]
|
7312 | }
|
7313 | // console.warn('Got document',$$[$0-1], $$[$0]);
|
7314 |
|
7315 | break;
|
7316 | case 7: case 8:
|
7317 | this.$ = $$[$0]
|
7318 | break;
|
7319 | case 9:
|
7320 | this.$='nl';
|
7321 | break;
|
7322 | case 10:
|
7323 | /*console.warn('got id and descr', $$[$0]);*/this.$={ stmt: 'state', id: $$[$0], type: 'default', description: ''};
|
7324 | break;
|
7325 | case 11:
|
7326 | /*console.warn('got id and descr', $$[$0-1], $$[$0].trim());*/this.$={ stmt: 'state', id: $$[$0-1], type: 'default', description: yy.trimColon($$[$0])};
|
7327 | break;
|
7328 | case 12:
|
7329 |
|
7330 | /*console.warn('got id', $$[$0-2]);yy.addRelation($$[$0-2], $$[$0]);*/
|
7331 | this.$={ stmt: 'relation', state1: { stmt: 'state', id: $$[$0-2], type: 'default', description: '' }, state2:{ stmt: 'state', id: $$[$0] ,type: 'default', description: ''}};
|
7332 |
|
7333 | break;
|
7334 | case 13:
|
7335 |
|
7336 | /*yy.addRelation($$[$0-3], $$[$0-1], $$[$0].substr(1).trim());*/
|
7337 | 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()};
|
7338 |
|
7339 | break;
|
7340 | case 17:
|
7341 |
|
7342 | /* console.warn('Adding document for state without id ', $$[$0-3]);*/
|
7343 | this.$={ stmt: 'state', id: $$[$0-3], type: 'default', description: '', doc: $$[$0-1] }
|
7344 |
|
7345 | break;
|
7346 | case 18:
|
7347 |
|
7348 | var id=$$[$0];
|
7349 | var description = $$[$0-2].trim();
|
7350 | if($$[$0].match(':')){
|
7351 | var parts = $$[$0].split(':');
|
7352 | id=parts[0];
|
7353 | description = [description, parts[1]];
|
7354 | }
|
7355 | this.$={stmt: 'state', id: id, type: 'default', description: description};
|
7356 |
|
7357 |
|
7358 | break;
|
7359 | case 19:
|
7360 |
|
7361 | // console.warn('Adding document for state with id zxzx', $$[$0-3], $$[$0-2], yy.getDirection()); yy.addDocument($$[$0-3]);
|
7362 | this.$={ stmt: 'state', id: $$[$0-3], type: 'default', description: $$[$0-5], doc: $$[$0-1] }
|
7363 |
|
7364 | break;
|
7365 | case 20:
|
7366 |
|
7367 | this.$={ stmt: 'state', id: $$[$0], type: 'fork' }
|
7368 |
|
7369 | break;
|
7370 | case 21:
|
7371 |
|
7372 | this.$={ stmt: 'state', id: $$[$0], type: 'join' }
|
7373 |
|
7374 | break;
|
7375 | case 22:
|
7376 |
|
7377 | this.$={ stmt: 'state', id: $$[$0], type: 'choice' }
|
7378 |
|
7379 | break;
|
7380 | case 23:
|
7381 |
|
7382 | this.$={ stmt: 'state', id: yy.getDividerId(), type: 'divider' }
|
7383 |
|
7384 | break;
|
7385 | case 24:
|
7386 |
|
7387 | /* console.warn('got NOTE, position: ', $$[$0-2].trim(), 'id = ', $$[$0-1].trim(), 'note: ', $$[$0]);*/
|
7388 | this.$={ stmt: 'state', id: $$[$0-1].trim(), note:{position: $$[$0-2].trim(), text: $$[$0].trim()}};
|
7389 |
|
7390 | break;
|
7391 | case 30:
|
7392 | yy.setDirection('TB');this.$={stmt:'dir', value:'TB'};
|
7393 | break;
|
7394 | case 31:
|
7395 | yy.setDirection('BT');this.$={stmt:'dir', value:'BT'};
|
7396 | break;
|
7397 | case 32:
|
7398 | yy.setDirection('RL'); this.$={stmt:'dir', value:'RL'};
|
7399 | break;
|
7400 | case 33:
|
7401 | yy.setDirection('LR');this.$={stmt:'dir', value:'LR'};
|
7402 | break;
|
7403 | case 36: case 37:
|
7404 | this.$=$$[$0];
|
7405 | break;
|
7406 | case 40:
|
7407 | yy.parseDirective('%%{', 'open_directive');
|
7408 | break;
|
7409 | case 41:
|
7410 | yy.parseDirective($$[$0], 'type_directive');
|
7411 | break;
|
7412 | case 42:
|
7413 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
7414 | break;
|
7415 | case 43:
|
7416 | yy.parseDirective('}%%', 'close_directive', 'state');
|
7417 | break;
|
7418 | }
|
7419 | },
|
7420 | table: [{3:1,4:$V0,5:$V1,6:4,7:$V2,31:6,45:$V3},{1:[3]},{3:8,4:$V0,5:$V1,6:4,7:$V2,31:6,45:$V3},{3:9,4:$V0,5:$V1,6:4,7:$V2,31:6,45:$V3},{3:10,4:$V0,5:$V1,6:4,7:$V2,31:6,45:$V3},o([1,4,5,14,15,17,20,22,23,24,25,26,27,36,37,38,39,42,45],$V4,{8:11}),{32:12,46:[1,13]},{46:[2,40]},{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:6,36:$Vh,37:$Vi,38:$Vj,39:$Vk,42:$Vl,45:$V3},{33:36,34:[1,37],48:$Vm},o([34,48],[2,41]),o($Vn,[2,6]),{6:28,10:39,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:6,36:$Vh,37:$Vi,38:$Vj,39:$Vk,42:$Vl,45:$V3},o($Vn,[2,8]),o($Vn,[2,9]),o($Vn,[2,10],{12:[1,40],13:[1,41]}),o($Vn,[2,14]),{16:[1,42]},o($Vn,[2,16],{18:[1,43]}),{21:[1,44]},o($Vn,[2,20]),o($Vn,[2,21]),o($Vn,[2,22]),o($Vn,[2,23]),{28:45,29:[1,46],43:[1,47],44:[1,48]},o($Vn,[2,26]),o($Vn,[2,27]),o($Vo,[2,36]),o($Vo,[2,37]),o($Vn,[2,30]),o($Vn,[2,31]),o($Vn,[2,32]),o($Vn,[2,33]),o($Vp,[2,28]),{35:49,47:[1,50]},o($Vp,[2,43]),o($Vn,[2,7]),o($Vn,[2,11]),{11:51,22:$Vb,42:$Vl},o($Vn,[2,15]),o($Vq,$V4,{8:52}),{22:[1,53]},{22:[1,54]},{21:[1,55]},{22:[2,38]},{22:[2,39]},{33:56,48:$Vm},{48:[2,42]},o($Vn,[2,12],{12:[1,57]}),{4:$V5,5:$V6,6:28,9:14,10:16,11:18,14:$V7,15:$V8,17:$V9,19:[1,58],20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,27:$Vg,30:29,31:6,36:$Vh,37:$Vi,38:$Vj,39:$Vk,42:$Vl,45:$V3},o($Vn,[2,18],{18:[1,59]}),{29:[1,60]},{22:[1,61]},o($Vp,[2,29]),o($Vn,[2,13]),o($Vn,[2,17]),o($Vq,$V4,{8:62}),o($Vn,[2,24]),o($Vn,[2,25]),{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:6,36:$Vh,37:$Vi,38:$Vj,39:$Vk,42:$Vl,45:$V3},o($Vn,[2,19])],
|
7421 | defaultActions: {7:[2,40],8:[2,1],9:[2,2],10:[2,3],47:[2,38],48:[2,39],50:[2,42]},
|
7422 | parseError: function parseError (str, hash) {
|
7423 | if (hash.recoverable) {
|
7424 | this.trace(str);
|
7425 | } else {
|
7426 | var error = new Error(str);
|
7427 | error.hash = hash;
|
7428 | throw error;
|
7429 | }
|
7430 | },
|
7431 | parse: function parse(input) {
|
7432 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
7433 | var args = lstack.slice.call(arguments, 1);
|
7434 | var lexer = Object.create(this.lexer);
|
7435 | var sharedState = { yy: {} };
|
7436 | for (var k in this.yy) {
|
7437 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
7438 | sharedState.yy[k] = this.yy[k];
|
7439 | }
|
7440 | }
|
7441 | lexer.setInput(input, sharedState.yy);
|
7442 | sharedState.yy.lexer = lexer;
|
7443 | sharedState.yy.parser = this;
|
7444 | if (typeof lexer.yylloc == 'undefined') {
|
7445 | lexer.yylloc = {};
|
7446 | }
|
7447 | var yyloc = lexer.yylloc;
|
7448 | lstack.push(yyloc);
|
7449 | var ranges = lexer.options && lexer.options.ranges;
|
7450 | if (typeof sharedState.yy.parseError === 'function') {
|
7451 | this.parseError = sharedState.yy.parseError;
|
7452 | } else {
|
7453 | this.parseError = Object.getPrototypeOf(this).parseError;
|
7454 | }
|
7455 | function popStack(n) {
|
7456 | stack.length = stack.length - 2 * n;
|
7457 | vstack.length = vstack.length - n;
|
7458 | lstack.length = lstack.length - n;
|
7459 | }
|
7460 | function lex() {
|
7461 | var token;
|
7462 | token = tstack.pop() || lexer.lex() || EOF;
|
7463 | if (typeof token !== 'number') {
|
7464 | if (token instanceof Array) {
|
7465 | tstack = token;
|
7466 | token = tstack.pop();
|
7467 | }
|
7468 | token = self.symbols_[token] || token;
|
7469 | }
|
7470 | return token;
|
7471 | }
|
7472 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
7473 | while (true) {
|
7474 | state = stack[stack.length - 1];
|
7475 | if (this.defaultActions[state]) {
|
7476 | action = this.defaultActions[state];
|
7477 | } else {
|
7478 | if (symbol === null || typeof symbol == 'undefined') {
|
7479 | symbol = lex();
|
7480 | }
|
7481 | action = table[state] && table[state][symbol];
|
7482 | }
|
7483 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
7484 | var errStr = '';
|
7485 | expected = [];
|
7486 | for (p in table[state]) {
|
7487 | if (this.terminals_[p] && p > TERROR) {
|
7488 | expected.push('\'' + this.terminals_[p] + '\'');
|
7489 | }
|
7490 | }
|
7491 | if (lexer.showPosition) {
|
7492 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
7493 | } else {
|
7494 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
7495 | }
|
7496 | this.parseError(errStr, {
|
7497 | text: lexer.match,
|
7498 | token: this.terminals_[symbol] || symbol,
|
7499 | line: lexer.yylineno,
|
7500 | loc: yyloc,
|
7501 | expected: expected
|
7502 | });
|
7503 | }
|
7504 | if (action[0] instanceof Array && action.length > 1) {
|
7505 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
7506 | }
|
7507 | switch (action[0]) {
|
7508 | case 1:
|
7509 | stack.push(symbol);
|
7510 | vstack.push(lexer.yytext);
|
7511 | lstack.push(lexer.yylloc);
|
7512 | stack.push(action[1]);
|
7513 | symbol = null;
|
7514 | if (!preErrorSymbol) {
|
7515 | yyleng = lexer.yyleng;
|
7516 | yytext = lexer.yytext;
|
7517 | yylineno = lexer.yylineno;
|
7518 | yyloc = lexer.yylloc;
|
7519 | if (recovering > 0) {
|
7520 | recovering--;
|
7521 | }
|
7522 | } else {
|
7523 | symbol = preErrorSymbol;
|
7524 | preErrorSymbol = null;
|
7525 | }
|
7526 | break;
|
7527 | case 2:
|
7528 | len = this.productions_[action[1]][1];
|
7529 | yyval.$ = vstack[vstack.length - len];
|
7530 | yyval._$ = {
|
7531 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
7532 | last_line: lstack[lstack.length - 1].last_line,
|
7533 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
7534 | last_column: lstack[lstack.length - 1].last_column
|
7535 | };
|
7536 | if (ranges) {
|
7537 | yyval._$.range = [
|
7538 | lstack[lstack.length - (len || 1)].range[0],
|
7539 | lstack[lstack.length - 1].range[1]
|
7540 | ];
|
7541 | }
|
7542 | r = this.performAction.apply(yyval, [
|
7543 | yytext,
|
7544 | yyleng,
|
7545 | yylineno,
|
7546 | sharedState.yy,
|
7547 | action[1],
|
7548 | vstack,
|
7549 | lstack
|
7550 | ].concat(args));
|
7551 | if (typeof r !== 'undefined') {
|
7552 | return r;
|
7553 | }
|
7554 | if (len) {
|
7555 | stack = stack.slice(0, -1 * len * 2);
|
7556 | vstack = vstack.slice(0, -1 * len);
|
7557 | lstack = lstack.slice(0, -1 * len);
|
7558 | }
|
7559 | stack.push(this.productions_[action[1]][0]);
|
7560 | vstack.push(yyval.$);
|
7561 | lstack.push(yyval._$);
|
7562 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
7563 | stack.push(newState);
|
7564 | break;
|
7565 | case 3:
|
7566 | return true;
|
7567 | }
|
7568 | }
|
7569 | return true;
|
7570 | }};
|
7571 |
|
7572 | /* generated by jison-lex 0.3.4 */
|
7573 | var lexer = (function(){
|
7574 | var lexer = ({
|
7575 |
|
7576 | EOF:1,
|
7577 |
|
7578 | parseError:function parseError(str, hash) {
|
7579 | if (this.yy.parser) {
|
7580 | this.yy.parser.parseError(str, hash);
|
7581 | } else {
|
7582 | throw new Error(str);
|
7583 | }
|
7584 | },
|
7585 |
|
7586 | // resets the lexer, sets new input
|
7587 | setInput:function (input, yy) {
|
7588 | this.yy = yy || this.yy || {};
|
7589 | this._input = input;
|
7590 | this._more = this._backtrack = this.done = false;
|
7591 | this.yylineno = this.yyleng = 0;
|
7592 | this.yytext = this.matched = this.match = '';
|
7593 | this.conditionStack = ['INITIAL'];
|
7594 | this.yylloc = {
|
7595 | first_line: 1,
|
7596 | first_column: 0,
|
7597 | last_line: 1,
|
7598 | last_column: 0
|
7599 | };
|
7600 | if (this.options.ranges) {
|
7601 | this.yylloc.range = [0,0];
|
7602 | }
|
7603 | this.offset = 0;
|
7604 | return this;
|
7605 | },
|
7606 |
|
7607 | // consumes and returns one char from the input
|
7608 | input:function () {
|
7609 | var ch = this._input[0];
|
7610 | this.yytext += ch;
|
7611 | this.yyleng++;
|
7612 | this.offset++;
|
7613 | this.match += ch;
|
7614 | this.matched += ch;
|
7615 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
7616 | if (lines) {
|
7617 | this.yylineno++;
|
7618 | this.yylloc.last_line++;
|
7619 | } else {
|
7620 | this.yylloc.last_column++;
|
7621 | }
|
7622 | if (this.options.ranges) {
|
7623 | this.yylloc.range[1]++;
|
7624 | }
|
7625 |
|
7626 | this._input = this._input.slice(1);
|
7627 | return ch;
|
7628 | },
|
7629 |
|
7630 | // unshifts one char (or a string) into the input
|
7631 | unput:function (ch) {
|
7632 | var len = ch.length;
|
7633 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
7634 |
|
7635 | this._input = ch + this._input;
|
7636 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
7637 | //this.yyleng -= len;
|
7638 | this.offset -= len;
|
7639 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
7640 | this.match = this.match.substr(0, this.match.length - 1);
|
7641 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
7642 |
|
7643 | if (lines.length - 1) {
|
7644 | this.yylineno -= lines.length - 1;
|
7645 | }
|
7646 | var r = this.yylloc.range;
|
7647 |
|
7648 | this.yylloc = {
|
7649 | first_line: this.yylloc.first_line,
|
7650 | last_line: this.yylineno + 1,
|
7651 | first_column: this.yylloc.first_column,
|
7652 | last_column: lines ?
|
7653 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
7654 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
7655 | this.yylloc.first_column - len
|
7656 | };
|
7657 |
|
7658 | if (this.options.ranges) {
|
7659 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
7660 | }
|
7661 | this.yyleng = this.yytext.length;
|
7662 | return this;
|
7663 | },
|
7664 |
|
7665 | // When called from action, caches matched text and appends it on next action
|
7666 | more:function () {
|
7667 | this._more = true;
|
7668 | return this;
|
7669 | },
|
7670 |
|
7671 | // 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.
|
7672 | reject:function () {
|
7673 | if (this.options.backtrack_lexer) {
|
7674 | this._backtrack = true;
|
7675 | } else {
|
7676 | 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(), {
|
7677 | text: "",
|
7678 | token: null,
|
7679 | line: this.yylineno
|
7680 | });
|
7681 |
|
7682 | }
|
7683 | return this;
|
7684 | },
|
7685 |
|
7686 | // retain first n characters of the match
|
7687 | less:function (n) {
|
7688 | this.unput(this.match.slice(n));
|
7689 | },
|
7690 |
|
7691 | // displays already matched input, i.e. for error messages
|
7692 | pastInput:function () {
|
7693 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
7694 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
7695 | },
|
7696 |
|
7697 | // displays upcoming input, i.e. for error messages
|
7698 | upcomingInput:function () {
|
7699 | var next = this.match;
|
7700 | if (next.length < 20) {
|
7701 | next += this._input.substr(0, 20-next.length);
|
7702 | }
|
7703 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
7704 | },
|
7705 |
|
7706 | // displays the character position where the lexing error occurred, i.e. for error messages
|
7707 | showPosition:function () {
|
7708 | var pre = this.pastInput();
|
7709 | var c = new Array(pre.length + 1).join("-");
|
7710 | return pre + this.upcomingInput() + "\n" + c + "^";
|
7711 | },
|
7712 |
|
7713 | // test the lexed token: return FALSE when not a match, otherwise return token
|
7714 | test_match:function(match, indexed_rule) {
|
7715 | var token,
|
7716 | lines,
|
7717 | backup;
|
7718 |
|
7719 | if (this.options.backtrack_lexer) {
|
7720 | // save context
|
7721 | backup = {
|
7722 | yylineno: this.yylineno,
|
7723 | yylloc: {
|
7724 | first_line: this.yylloc.first_line,
|
7725 | last_line: this.last_line,
|
7726 | first_column: this.yylloc.first_column,
|
7727 | last_column: this.yylloc.last_column
|
7728 | },
|
7729 | yytext: this.yytext,
|
7730 | match: this.match,
|
7731 | matches: this.matches,
|
7732 | matched: this.matched,
|
7733 | yyleng: this.yyleng,
|
7734 | offset: this.offset,
|
7735 | _more: this._more,
|
7736 | _input: this._input,
|
7737 | yy: this.yy,
|
7738 | conditionStack: this.conditionStack.slice(0),
|
7739 | done: this.done
|
7740 | };
|
7741 | if (this.options.ranges) {
|
7742 | backup.yylloc.range = this.yylloc.range.slice(0);
|
7743 | }
|
7744 | }
|
7745 |
|
7746 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
7747 | if (lines) {
|
7748 | this.yylineno += lines.length;
|
7749 | }
|
7750 | this.yylloc = {
|
7751 | first_line: this.yylloc.last_line,
|
7752 | last_line: this.yylineno + 1,
|
7753 | first_column: this.yylloc.last_column,
|
7754 | last_column: lines ?
|
7755 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
7756 | this.yylloc.last_column + match[0].length
|
7757 | };
|
7758 | this.yytext += match[0];
|
7759 | this.match += match[0];
|
7760 | this.matches = match;
|
7761 | this.yyleng = this.yytext.length;
|
7762 | if (this.options.ranges) {
|
7763 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
7764 | }
|
7765 | this._more = false;
|
7766 | this._backtrack = false;
|
7767 | this._input = this._input.slice(match[0].length);
|
7768 | this.matched += match[0];
|
7769 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
7770 | if (this.done && this._input) {
|
7771 | this.done = false;
|
7772 | }
|
7773 | if (token) {
|
7774 | return token;
|
7775 | } else if (this._backtrack) {
|
7776 | // recover context
|
7777 | for (var k in backup) {
|
7778 | this[k] = backup[k];
|
7779 | }
|
7780 | return false; // rule action called reject() implying the next rule should be tested instead.
|
7781 | }
|
7782 | return false;
|
7783 | },
|
7784 |
|
7785 | // return next match in input
|
7786 | next:function () {
|
7787 | if (this.done) {
|
7788 | return this.EOF;
|
7789 | }
|
7790 | if (!this._input) {
|
7791 | this.done = true;
|
7792 | }
|
7793 |
|
7794 | var token,
|
7795 | match,
|
7796 | tempMatch,
|
7797 | index;
|
7798 | if (!this._more) {
|
7799 | this.yytext = '';
|
7800 | this.match = '';
|
7801 | }
|
7802 | var rules = this._currentRules();
|
7803 | for (var i = 0; i < rules.length; i++) {
|
7804 | tempMatch = this._input.match(this.rules[rules[i]]);
|
7805 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
7806 | match = tempMatch;
|
7807 | index = i;
|
7808 | if (this.options.backtrack_lexer) {
|
7809 | token = this.test_match(tempMatch, rules[i]);
|
7810 | if (token !== false) {
|
7811 | return token;
|
7812 | } else if (this._backtrack) {
|
7813 | match = false;
|
7814 | continue; // rule action called reject() implying a rule MISmatch.
|
7815 | } else {
|
7816 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
7817 | return false;
|
7818 | }
|
7819 | } else if (!this.options.flex) {
|
7820 | break;
|
7821 | }
|
7822 | }
|
7823 | }
|
7824 | if (match) {
|
7825 | token = this.test_match(match, rules[index]);
|
7826 | if (token !== false) {
|
7827 | return token;
|
7828 | }
|
7829 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
7830 | return false;
|
7831 | }
|
7832 | if (this._input === "") {
|
7833 | return this.EOF;
|
7834 | } else {
|
7835 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
7836 | text: "",
|
7837 | token: null,
|
7838 | line: this.yylineno
|
7839 | });
|
7840 | }
|
7841 | },
|
7842 |
|
7843 | // return next match that has a token
|
7844 | lex:function lex () {
|
7845 | var r = this.next();
|
7846 | if (r) {
|
7847 | return r;
|
7848 | } else {
|
7849 | return this.lex();
|
7850 | }
|
7851 | },
|
7852 |
|
7853 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
7854 | begin:function begin (condition) {
|
7855 | this.conditionStack.push(condition);
|
7856 | },
|
7857 |
|
7858 | // pop the previously active lexer condition state off the condition stack
|
7859 | popState:function popState () {
|
7860 | var n = this.conditionStack.length - 1;
|
7861 | if (n > 0) {
|
7862 | return this.conditionStack.pop();
|
7863 | } else {
|
7864 | return this.conditionStack[0];
|
7865 | }
|
7866 | },
|
7867 |
|
7868 | // produce the lexer rule set which is active for the currently active lexer condition state
|
7869 | _currentRules:function _currentRules () {
|
7870 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
7871 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
7872 | } else {
|
7873 | return this.conditions["INITIAL"].rules;
|
7874 | }
|
7875 | },
|
7876 |
|
7877 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
7878 | topState:function topState (n) {
|
7879 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
7880 | if (n >= 0) {
|
7881 | return this.conditionStack[n];
|
7882 | } else {
|
7883 | return "INITIAL";
|
7884 | }
|
7885 | },
|
7886 |
|
7887 | // alias for begin(condition)
|
7888 | pushState:function pushState (condition) {
|
7889 | this.begin(condition);
|
7890 | },
|
7891 |
|
7892 | // return the number of states currently on the stack
|
7893 | stateStackSize:function stateStackSize() {
|
7894 | return this.conditionStack.length;
|
7895 | },
|
7896 | options: {"case-insensitive":true},
|
7897 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
7898 | var YYSTATE=YY_START;
|
7899 | switch($avoiding_name_collisions) {
|
7900 | case 0:return 36;
|
7901 | break;
|
7902 | case 1:return 37;
|
7903 | break;
|
7904 | case 2:return 38;
|
7905 | break;
|
7906 | case 3:return 39;
|
7907 | break;
|
7908 | case 4: this.begin('open_directive'); return 45;
|
7909 | break;
|
7910 | case 5: this.begin('type_directive'); return 46;
|
7911 | break;
|
7912 | case 6: this.popState(); this.begin('arg_directive'); return 34;
|
7913 | break;
|
7914 | case 7: this.popState(); this.popState(); return 48;
|
7915 | break;
|
7916 | case 8:return 47;
|
7917 | break;
|
7918 | case 9:/* skip comments */
|
7919 | break;
|
7920 | case 10:/* skip comments */{ /*console.log('Crap after close');*/ }
|
7921 | break;
|
7922 | case 11:return 5;
|
7923 | break;
|
7924 | case 12:/* skip all whitespace */
|
7925 | break;
|
7926 | case 13:/* skip same-line whitespace */
|
7927 | break;
|
7928 | case 14:/* skip comments */
|
7929 | break;
|
7930 | case 15:/* skip comments */
|
7931 | break;
|
7932 | case 16: this.pushState('SCALE'); /* console.log('Got scale', yy_.yytext);*/ return 15;
|
7933 | break;
|
7934 | case 17:return 16;
|
7935 | break;
|
7936 | case 18:this.popState();
|
7937 | break;
|
7938 | case 19: /*console.log('Starting STATE zxzx'+yy.getDirection());*/this.pushState('STATE');
|
7939 | break;
|
7940 | case 20:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim(); /*console.warn('Fork Fork: ',yy_.yytext);*/return 23;
|
7941 | break;
|
7942 | case 21:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 24;
|
7943 | break;
|
7944 | case 22:this.popState();yy_.yytext=yy_.yytext.slice(0,-10).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 25;
|
7945 | break;
|
7946 | case 23:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Fork: ',yy_.yytext);*/return 23;
|
7947 | break;
|
7948 | case 24:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 24;
|
7949 | break;
|
7950 | case 25:this.popState();yy_.yytext=yy_.yytext.slice(0,-10).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 25;
|
7951 | break;
|
7952 | case 26: return 36;
|
7953 | break;
|
7954 | case 27: return 37;
|
7955 | break;
|
7956 | case 28: return 38;
|
7957 | break;
|
7958 | case 29: return 39;
|
7959 | break;
|
7960 | case 30: /*console.log('Starting STATE_STRING zxzx');*/this.begin("STATE_STRING");
|
7961 | break;
|
7962 | case 31:this.popState();this.pushState('STATE_ID');return "AS";
|
7963 | break;
|
7964 | case 32:this.popState();/* console.log('STATE_ID', yy_.yytext);*/return "ID";
|
7965 | break;
|
7966 | case 33:this.popState();
|
7967 | break;
|
7968 | case 34: /*console.log('Long description:', yy_.yytext);*/return "STATE_DESCR";
|
7969 | break;
|
7970 | case 35:/*console.log('COMPOSIT_STATE', yy_.yytext);*/return 17;
|
7971 | break;
|
7972 | case 36:this.popState();
|
7973 | break;
|
7974 | case 37:this.popState();this.pushState('struct'); /*console.log('begin struct', yy_.yytext);*/return 18;
|
7975 | break;
|
7976 | case 38: /*console.log('Ending struct');*/ this.popState(); return 19;
|
7977 | break;
|
7978 | case 39:/* nothing */
|
7979 | break;
|
7980 | case 40: this.begin('NOTE'); return 27;
|
7981 | break;
|
7982 | case 41: this.popState();this.pushState('NOTE_ID');return 43;
|
7983 | break;
|
7984 | case 42: this.popState();this.pushState('NOTE_ID');return 44;
|
7985 | break;
|
7986 | case 43: this.popState();this.pushState('FLOATING_NOTE');
|
7987 | break;
|
7988 | case 44:this.popState();this.pushState('FLOATING_NOTE_ID');return "AS";
|
7989 | break;
|
7990 | case 45:/**/
|
7991 | break;
|
7992 | case 46: /*console.log('Floating note text: ', yy_.yytext);*/return "NOTE_TEXT";
|
7993 | break;
|
7994 | case 47:this.popState();/*console.log('Floating note ID', yy_.yytext);*/return "ID";
|
7995 | break;
|
7996 | case 48: this.popState();this.pushState('NOTE_TEXT');/*console.log('Got ID for note', yy_.yytext);*/return 22;
|
7997 | break;
|
7998 | case 49: this.popState();/*console.log('Got NOTE_TEXT for note',yy_.yytext);*/yy_.yytext = yy_.yytext.substr(2).trim();return 29;
|
7999 | break;
|
8000 | case 50: this.popState();/*console.log('Got NOTE_TEXT for note',yy_.yytext);*/yy_.yytext = yy_.yytext.slice(0,-8).trim();return 29;
|
8001 | break;
|
8002 | case 51: /*console.log('Got state diagram', yy_.yytext,'#');*/return 7;
|
8003 | break;
|
8004 | case 52: /*console.log('Got state diagram', yy_.yytext,'#');*/return 7;
|
8005 | break;
|
8006 | case 53: /*console.log('HIDE_EMPTY', yy_.yytext,'#');*/return 14;
|
8007 | break;
|
8008 | case 54: /*console.log('EDGE_STATE=',yy_.yytext);*/ return 42;
|
8009 | break;
|
8010 | case 55: /*console.log('=>ID=',yy_.yytext);*/ return 22;
|
8011 | break;
|
8012 | case 56: yy_.yytext = yy_.yytext.trim(); /*console.log('Descr = ', yy_.yytext);*/ return 12;
|
8013 | break;
|
8014 | case 57:return 13;
|
8015 | break;
|
8016 | case 58:return 26;
|
8017 | break;
|
8018 | case 59:return 5;
|
8019 | break;
|
8020 | case 60:return 'INVALID';
|
8021 | break;
|
8022 | }
|
8023 | },
|
8024 | 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,/^(?: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],
|
8025 | 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,19,26,27,28,29,38,39,40,54,55,56,57,58],"inclusive":false},"FLOATING_NOTE_ID":{"rules":[47],"inclusive":false},"FLOATING_NOTE":{"rules":[44,45,46],"inclusive":false},"NOTE_TEXT":{"rules":[49,50],"inclusive":false},"NOTE_ID":{"rules":[48],"inclusive":false},"NOTE":{"rules":[41,42,43],"inclusive":false},"SCALE":{"rules":[17,18],"inclusive":false},"ALIAS":{"rules":[],"inclusive":false},"STATE_ID":{"rules":[32],"inclusive":false},"STATE_STRING":{"rules":[33,34],"inclusive":false},"FORK_STATE":{"rules":[],"inclusive":false},"STATE":{"rules":[13,14,20,21,22,23,24,25,30,31,35,36,37],"inclusive":false},"ID":{"rules":[13,14],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,9,10,11,12,14,15,16,19,37,40,51,52,53,54,55,56,57,59,60],"inclusive":true}}
|
8026 | });
|
8027 | return lexer;
|
8028 | })();
|
8029 | parser.lexer = lexer;
|
8030 | function Parser () {
|
8031 | this.yy = {};
|
8032 | }
|
8033 | Parser.prototype = parser;parser.Parser = Parser;
|
8034 | return new Parser;
|
8035 | })();
|
8036 |
|
8037 |
|
8038 | if (true) {
|
8039 | exports.parser = parser;
|
8040 | exports.Parser = parser.Parser;
|
8041 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
8042 | exports.main = function commonjsMain (args) {
|
8043 | if (!args[1]) {
|
8044 | console.log('Usage: '+args[0]+' FILE');
|
8045 | process.exit(1);
|
8046 | }
|
8047 | var source = __webpack_require__(/*! fs */ "?a3b8").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
|
8048 | return exports.parser.parse(source);
|
8049 | };
|
8050 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
8051 | exports.main(process.argv.slice(1));
|
8052 | }
|
8053 | }
|
8054 |
|
8055 | /***/ }),
|
8056 |
|
8057 | /***/ "./src/diagrams/user-journey/parser/journey.jison":
|
8058 | /*!********************************************************!*\
|
8059 | !*** ./src/diagrams/user-journey/parser/journey.jison ***!
|
8060 | \********************************************************/
|
8061 | /***/ ((module, exports, __webpack_require__) => {
|
8062 |
|
8063 | /* module decorator */ module = __webpack_require__.nmd(module);
|
8064 | /* parser generated by jison 0.4.18 */
|
8065 | /*
|
8066 | Returns a Parser object of the following structure:
|
8067 |
|
8068 | Parser: {
|
8069 | yy: {}
|
8070 | }
|
8071 |
|
8072 | Parser.prototype: {
|
8073 | yy: {},
|
8074 | trace: function(),
|
8075 | symbols_: {associative list: name ==> number},
|
8076 | terminals_: {associative list: number ==> name},
|
8077 | productions_: [...],
|
8078 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
|
8079 | table: [...],
|
8080 | defaultActions: {...},
|
8081 | parseError: function(str, hash),
|
8082 | parse: function(input),
|
8083 |
|
8084 | lexer: {
|
8085 | EOF: 1,
|
8086 | parseError: function(str, hash),
|
8087 | setInput: function(input),
|
8088 | input: function(),
|
8089 | unput: function(str),
|
8090 | more: function(),
|
8091 | less: function(n),
|
8092 | pastInput: function(),
|
8093 | upcomingInput: function(),
|
8094 | showPosition: function(),
|
8095 | test_match: function(regex_match_array, rule_index),
|
8096 | next: function(),
|
8097 | lex: function(),
|
8098 | begin: function(condition),
|
8099 | popState: function(),
|
8100 | _currentRules: function(),
|
8101 | topState: function(),
|
8102 | pushState: function(condition),
|
8103 |
|
8104 | options: {
|
8105 | ranges: boolean (optional: true ==> token location info will include a .range[] member)
|
8106 | flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
|
8107 | 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)
|
8108 | },
|
8109 |
|
8110 | performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
|
8111 | rules: [...],
|
8112 | conditions: {associative list: name ==> set},
|
8113 | }
|
8114 | }
|
8115 |
|
8116 |
|
8117 | token location info (@$, _$, etc.): {
|
8118 | first_line: n,
|
8119 | last_line: n,
|
8120 | first_column: n,
|
8121 | last_column: n,
|
8122 | range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
|
8123 | }
|
8124 |
|
8125 |
|
8126 | the parseError function receives a 'hash' object with these members for lexer and parser errors: {
|
8127 | text: (matched text)
|
8128 | token: (the produced terminal token, if any)
|
8129 | line: (yylineno)
|
8130 | }
|
8131 | while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
|
8132 | loc: (yylloc)
|
8133 | expected: (string describing the set of expected tokens)
|
8134 | recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
|
8135 | }
|
8136 | */
|
8137 | var parser = (function(){
|
8138 | 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,19,21],$V3=[1,15],$V4=[1,16],$V5=[1,17],$V6=[1,21],$V7=[4,6,9,11,17,18,19,21];
|
8139 | var parser = {trace: function trace () { },
|
8140 | yy: {},
|
8141 | 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,"section":18,"taskName":19,"taskData":20,"open_directive":21,"type_directive":22,"arg_directive":23,"close_directive":24,"$accept":0,"$end":1},
|
8142 | terminals_: {2:"error",4:"journey",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",17:"title",18:"section",19:"taskName",20:"taskData",21:"open_directive",22:"type_directive",23:"arg_directive",24:"close_directive"},
|
8143 | 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,1],[10,2],[10,1],[12,1],[13,1],[16,1],[14,1]],
|
8144 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
|
8145 | /* this == yyval */
|
8146 |
|
8147 | var $0 = $$.length - 1;
|
8148 | switch (yystate) {
|
8149 | case 1:
|
8150 | return $$[$0-1];
|
8151 | break;
|
8152 | case 3:
|
8153 | this.$ = []
|
8154 | break;
|
8155 | case 4:
|
8156 | $$[$0-1].push($$[$0]);this.$ = $$[$0-1]
|
8157 | break;
|
8158 | case 5: case 6:
|
8159 | this.$ = $$[$0]
|
8160 | break;
|
8161 | case 7: case 8:
|
8162 | this.$=[];
|
8163 | break;
|
8164 | case 11:
|
8165 | yy.setTitle($$[$0].substr(6));this.$=$$[$0].substr(6);
|
8166 | break;
|
8167 | case 12:
|
8168 | yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8);
|
8169 | break;
|
8170 | case 13:
|
8171 | yy.addTask($$[$0-1], $$[$0]);this.$='task';
|
8172 | break;
|
8173 | case 15:
|
8174 | yy.parseDirective('%%{', 'open_directive');
|
8175 | break;
|
8176 | case 16:
|
8177 | yy.parseDirective($$[$0], 'type_directive');
|
8178 | break;
|
8179 | case 17:
|
8180 | $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
|
8181 | break;
|
8182 | case 18:
|
8183 | yy.parseDirective('}%%', 'close_directive', 'journey');
|
8184 | break;
|
8185 | }
|
8186 | },
|
8187 | table: [{3:1,4:$V0,7:3,12:4,21:$V1},{1:[3]},o($V2,[2,3],{5:6}),{3:7,4:$V0,7:3,12:4,21:$V1},{13:8,22:[1,9]},{22:[2,15]},{6:[1,10],7:18,8:11,9:[1,12],10:13,11:[1,14],12:4,17:$V3,18:$V4,19:$V5,21:$V1},{1:[2,2]},{14:19,15:[1,20],24:$V6},o([15,24],[2,16]),o($V2,[2,8],{1:[2,1]}),o($V2,[2,4]),{7:18,10:22,12:4,17:$V3,18:$V4,19:$V5,21:$V1},o($V2,[2,6]),o($V2,[2,7]),o($V2,[2,11]),o($V2,[2,12]),{20:[1,23]},o($V2,[2,14]),{11:[1,24]},{16:25,23:[1,26]},{11:[2,18]},o($V2,[2,5]),o($V2,[2,13]),o($V7,[2,9]),{14:27,24:$V6},{24:[2,17]},{11:[1,28]},o($V7,[2,10])],
|
8188 | defaultActions: {5:[2,15],7:[2,2],21:[2,18],26:[2,17]},
|
8189 | parseError: function parseError (str, hash) {
|
8190 | if (hash.recoverable) {
|
8191 | this.trace(str);
|
8192 | } else {
|
8193 | var error = new Error(str);
|
8194 | error.hash = hash;
|
8195 | throw error;
|
8196 | }
|
8197 | },
|
8198 | parse: function parse(input) {
|
8199 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
8200 | var args = lstack.slice.call(arguments, 1);
|
8201 | var lexer = Object.create(this.lexer);
|
8202 | var sharedState = { yy: {} };
|
8203 | for (var k in this.yy) {
|
8204 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
8205 | sharedState.yy[k] = this.yy[k];
|
8206 | }
|
8207 | }
|
8208 | lexer.setInput(input, sharedState.yy);
|
8209 | sharedState.yy.lexer = lexer;
|
8210 | sharedState.yy.parser = this;
|
8211 | if (typeof lexer.yylloc == 'undefined') {
|
8212 | lexer.yylloc = {};
|
8213 | }
|
8214 | var yyloc = lexer.yylloc;
|
8215 | lstack.push(yyloc);
|
8216 | var ranges = lexer.options && lexer.options.ranges;
|
8217 | if (typeof sharedState.yy.parseError === 'function') {
|
8218 | this.parseError = sharedState.yy.parseError;
|
8219 | } else {
|
8220 | this.parseError = Object.getPrototypeOf(this).parseError;
|
8221 | }
|
8222 | function popStack(n) {
|
8223 | stack.length = stack.length - 2 * n;
|
8224 | vstack.length = vstack.length - n;
|
8225 | lstack.length = lstack.length - n;
|
8226 | }
|
8227 | function lex() {
|
8228 | var token;
|
8229 | token = tstack.pop() || lexer.lex() || EOF;
|
8230 | if (typeof token !== 'number') {
|
8231 | if (token instanceof Array) {
|
8232 | tstack = token;
|
8233 | token = tstack.pop();
|
8234 | }
|
8235 | token = self.symbols_[token] || token;
|
8236 | }
|
8237 | return token;
|
8238 | }
|
8239 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
8240 | while (true) {
|
8241 | state = stack[stack.length - 1];
|
8242 | if (this.defaultActions[state]) {
|
8243 | action = this.defaultActions[state];
|
8244 | } else {
|
8245 | if (symbol === null || typeof symbol == 'undefined') {
|
8246 | symbol = lex();
|
8247 | }
|
8248 | action = table[state] && table[state][symbol];
|
8249 | }
|
8250 | if (typeof action === 'undefined' || !action.length || !action[0]) {
|
8251 | var errStr = '';
|
8252 | expected = [];
|
8253 | for (p in table[state]) {
|
8254 | if (this.terminals_[p] && p > TERROR) {
|
8255 | expected.push('\'' + this.terminals_[p] + '\'');
|
8256 | }
|
8257 | }
|
8258 | if (lexer.showPosition) {
|
8259 | errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
|
8260 | } else {
|
8261 | errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
|
8262 | }
|
8263 | this.parseError(errStr, {
|
8264 | text: lexer.match,
|
8265 | token: this.terminals_[symbol] || symbol,
|
8266 | line: lexer.yylineno,
|
8267 | loc: yyloc,
|
8268 | expected: expected
|
8269 | });
|
8270 | }
|
8271 | if (action[0] instanceof Array && action.length > 1) {
|
8272 | throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
|
8273 | }
|
8274 | switch (action[0]) {
|
8275 | case 1:
|
8276 | stack.push(symbol);
|
8277 | vstack.push(lexer.yytext);
|
8278 | lstack.push(lexer.yylloc);
|
8279 | stack.push(action[1]);
|
8280 | symbol = null;
|
8281 | if (!preErrorSymbol) {
|
8282 | yyleng = lexer.yyleng;
|
8283 | yytext = lexer.yytext;
|
8284 | yylineno = lexer.yylineno;
|
8285 | yyloc = lexer.yylloc;
|
8286 | if (recovering > 0) {
|
8287 | recovering--;
|
8288 | }
|
8289 | } else {
|
8290 | symbol = preErrorSymbol;
|
8291 | preErrorSymbol = null;
|
8292 | }
|
8293 | break;
|
8294 | case 2:
|
8295 | len = this.productions_[action[1]][1];
|
8296 | yyval.$ = vstack[vstack.length - len];
|
8297 | yyval._$ = {
|
8298 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
8299 | last_line: lstack[lstack.length - 1].last_line,
|
8300 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
8301 | last_column: lstack[lstack.length - 1].last_column
|
8302 | };
|
8303 | if (ranges) {
|
8304 | yyval._$.range = [
|
8305 | lstack[lstack.length - (len || 1)].range[0],
|
8306 | lstack[lstack.length - 1].range[1]
|
8307 | ];
|
8308 | }
|
8309 | r = this.performAction.apply(yyval, [
|
8310 | yytext,
|
8311 | yyleng,
|
8312 | yylineno,
|
8313 | sharedState.yy,
|
8314 | action[1],
|
8315 | vstack,
|
8316 | lstack
|
8317 | ].concat(args));
|
8318 | if (typeof r !== 'undefined') {
|
8319 | return r;
|
8320 | }
|
8321 | if (len) {
|
8322 | stack = stack.slice(0, -1 * len * 2);
|
8323 | vstack = vstack.slice(0, -1 * len);
|
8324 | lstack = lstack.slice(0, -1 * len);
|
8325 | }
|
8326 | stack.push(this.productions_[action[1]][0]);
|
8327 | vstack.push(yyval.$);
|
8328 | lstack.push(yyval._$);
|
8329 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
8330 | stack.push(newState);
|
8331 | break;
|
8332 | case 3:
|
8333 | return true;
|
8334 | }
|
8335 | }
|
8336 | return true;
|
8337 | }};
|
8338 |
|
8339 | /* generated by jison-lex 0.3.4 */
|
8340 | var lexer = (function(){
|
8341 | var lexer = ({
|
8342 |
|
8343 | EOF:1,
|
8344 |
|
8345 | parseError:function parseError(str, hash) {
|
8346 | if (this.yy.parser) {
|
8347 | this.yy.parser.parseError(str, hash);
|
8348 | } else {
|
8349 | throw new Error(str);
|
8350 | }
|
8351 | },
|
8352 |
|
8353 | // resets the lexer, sets new input
|
8354 | setInput:function (input, yy) {
|
8355 | this.yy = yy || this.yy || {};
|
8356 | this._input = input;
|
8357 | this._more = this._backtrack = this.done = false;
|
8358 | this.yylineno = this.yyleng = 0;
|
8359 | this.yytext = this.matched = this.match = '';
|
8360 | this.conditionStack = ['INITIAL'];
|
8361 | this.yylloc = {
|
8362 | first_line: 1,
|
8363 | first_column: 0,
|
8364 | last_line: 1,
|
8365 | last_column: 0
|
8366 | };
|
8367 | if (this.options.ranges) {
|
8368 | this.yylloc.range = [0,0];
|
8369 | }
|
8370 | this.offset = 0;
|
8371 | return this;
|
8372 | },
|
8373 |
|
8374 | // consumes and returns one char from the input
|
8375 | input:function () {
|
8376 | var ch = this._input[0];
|
8377 | this.yytext += ch;
|
8378 | this.yyleng++;
|
8379 | this.offset++;
|
8380 | this.match += ch;
|
8381 | this.matched += ch;
|
8382 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
8383 | if (lines) {
|
8384 | this.yylineno++;
|
8385 | this.yylloc.last_line++;
|
8386 | } else {
|
8387 | this.yylloc.last_column++;
|
8388 | }
|
8389 | if (this.options.ranges) {
|
8390 | this.yylloc.range[1]++;
|
8391 | }
|
8392 |
|
8393 | this._input = this._input.slice(1);
|
8394 | return ch;
|
8395 | },
|
8396 |
|
8397 | // unshifts one char (or a string) into the input
|
8398 | unput:function (ch) {
|
8399 | var len = ch.length;
|
8400 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
8401 |
|
8402 | this._input = ch + this._input;
|
8403 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
8404 | //this.yyleng -= len;
|
8405 | this.offset -= len;
|
8406 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
8407 | this.match = this.match.substr(0, this.match.length - 1);
|
8408 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
8409 |
|
8410 | if (lines.length - 1) {
|
8411 | this.yylineno -= lines.length - 1;
|
8412 | }
|
8413 | var r = this.yylloc.range;
|
8414 |
|
8415 | this.yylloc = {
|
8416 | first_line: this.yylloc.first_line,
|
8417 | last_line: this.yylineno + 1,
|
8418 | first_column: this.yylloc.first_column,
|
8419 | last_column: lines ?
|
8420 | (lines.length === oldLines.length ? this.yylloc.first_column : 0)
|
8421 | + oldLines[oldLines.length - lines.length].length - lines[0].length :
|
8422 | this.yylloc.first_column - len
|
8423 | };
|
8424 |
|
8425 | if (this.options.ranges) {
|
8426 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
8427 | }
|
8428 | this.yyleng = this.yytext.length;
|
8429 | return this;
|
8430 | },
|
8431 |
|
8432 | // When called from action, caches matched text and appends it on next action
|
8433 | more:function () {
|
8434 | this._more = true;
|
8435 | return this;
|
8436 | },
|
8437 |
|
8438 | // 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.
|
8439 | reject:function () {
|
8440 | if (this.options.backtrack_lexer) {
|
8441 | this._backtrack = true;
|
8442 | } else {
|
8443 | 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(), {
|
8444 | text: "",
|
8445 | token: null,
|
8446 | line: this.yylineno
|
8447 | });
|
8448 |
|
8449 | }
|
8450 | return this;
|
8451 | },
|
8452 |
|
8453 | // retain first n characters of the match
|
8454 | less:function (n) {
|
8455 | this.unput(this.match.slice(n));
|
8456 | },
|
8457 |
|
8458 | // displays already matched input, i.e. for error messages
|
8459 | pastInput:function () {
|
8460 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
8461 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
8462 | },
|
8463 |
|
8464 | // displays upcoming input, i.e. for error messages
|
8465 | upcomingInput:function () {
|
8466 | var next = this.match;
|
8467 | if (next.length < 20) {
|
8468 | next += this._input.substr(0, 20-next.length);
|
8469 | }
|
8470 | return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
|
8471 | },
|
8472 |
|
8473 | // displays the character position where the lexing error occurred, i.e. for error messages
|
8474 | showPosition:function () {
|
8475 | var pre = this.pastInput();
|
8476 | var c = new Array(pre.length + 1).join("-");
|
8477 | return pre + this.upcomingInput() + "\n" + c + "^";
|
8478 | },
|
8479 |
|
8480 | // test the lexed token: return FALSE when not a match, otherwise return token
|
8481 | test_match:function(match, indexed_rule) {
|
8482 | var token,
|
8483 | lines,
|
8484 | backup;
|
8485 |
|
8486 | if (this.options.backtrack_lexer) {
|
8487 | // save context
|
8488 | backup = {
|
8489 | yylineno: this.yylineno,
|
8490 | yylloc: {
|
8491 | first_line: this.yylloc.first_line,
|
8492 | last_line: this.last_line,
|
8493 | first_column: this.yylloc.first_column,
|
8494 | last_column: this.yylloc.last_column
|
8495 | },
|
8496 | yytext: this.yytext,
|
8497 | match: this.match,
|
8498 | matches: this.matches,
|
8499 | matched: this.matched,
|
8500 | yyleng: this.yyleng,
|
8501 | offset: this.offset,
|
8502 | _more: this._more,
|
8503 | _input: this._input,
|
8504 | yy: this.yy,
|
8505 | conditionStack: this.conditionStack.slice(0),
|
8506 | done: this.done
|
8507 | };
|
8508 | if (this.options.ranges) {
|
8509 | backup.yylloc.range = this.yylloc.range.slice(0);
|
8510 | }
|
8511 | }
|
8512 |
|
8513 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
8514 | if (lines) {
|
8515 | this.yylineno += lines.length;
|
8516 | }
|
8517 | this.yylloc = {
|
8518 | first_line: this.yylloc.last_line,
|
8519 | last_line: this.yylineno + 1,
|
8520 | first_column: this.yylloc.last_column,
|
8521 | last_column: lines ?
|
8522 | lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
|
8523 | this.yylloc.last_column + match[0].length
|
8524 | };
|
8525 | this.yytext += match[0];
|
8526 | this.match += match[0];
|
8527 | this.matches = match;
|
8528 | this.yyleng = this.yytext.length;
|
8529 | if (this.options.ranges) {
|
8530 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
8531 | }
|
8532 | this._more = false;
|
8533 | this._backtrack = false;
|
8534 | this._input = this._input.slice(match[0].length);
|
8535 | this.matched += match[0];
|
8536 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
8537 | if (this.done && this._input) {
|
8538 | this.done = false;
|
8539 | }
|
8540 | if (token) {
|
8541 | return token;
|
8542 | } else if (this._backtrack) {
|
8543 | // recover context
|
8544 | for (var k in backup) {
|
8545 | this[k] = backup[k];
|
8546 | }
|
8547 | return false; // rule action called reject() implying the next rule should be tested instead.
|
8548 | }
|
8549 | return false;
|
8550 | },
|
8551 |
|
8552 | // return next match in input
|
8553 | next:function () {
|
8554 | if (this.done) {
|
8555 | return this.EOF;
|
8556 | }
|
8557 | if (!this._input) {
|
8558 | this.done = true;
|
8559 | }
|
8560 |
|
8561 | var token,
|
8562 | match,
|
8563 | tempMatch,
|
8564 | index;
|
8565 | if (!this._more) {
|
8566 | this.yytext = '';
|
8567 | this.match = '';
|
8568 | }
|
8569 | var rules = this._currentRules();
|
8570 | for (var i = 0; i < rules.length; i++) {
|
8571 | tempMatch = this._input.match(this.rules[rules[i]]);
|
8572 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
8573 | match = tempMatch;
|
8574 | index = i;
|
8575 | if (this.options.backtrack_lexer) {
|
8576 | token = this.test_match(tempMatch, rules[i]);
|
8577 | if (token !== false) {
|
8578 | return token;
|
8579 | } else if (this._backtrack) {
|
8580 | match = false;
|
8581 | continue; // rule action called reject() implying a rule MISmatch.
|
8582 | } else {
|
8583 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
8584 | return false;
|
8585 | }
|
8586 | } else if (!this.options.flex) {
|
8587 | break;
|
8588 | }
|
8589 | }
|
8590 | }
|
8591 | if (match) {
|
8592 | token = this.test_match(match, rules[index]);
|
8593 | if (token !== false) {
|
8594 | return token;
|
8595 | }
|
8596 | // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
|
8597 | return false;
|
8598 | }
|
8599 | if (this._input === "") {
|
8600 | return this.EOF;
|
8601 | } else {
|
8602 | return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
|
8603 | text: "",
|
8604 | token: null,
|
8605 | line: this.yylineno
|
8606 | });
|
8607 | }
|
8608 | },
|
8609 |
|
8610 | // return next match that has a token
|
8611 | lex:function lex () {
|
8612 | var r = this.next();
|
8613 | if (r) {
|
8614 | return r;
|
8615 | } else {
|
8616 | return this.lex();
|
8617 | }
|
8618 | },
|
8619 |
|
8620 | // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
8621 | begin:function begin (condition) {
|
8622 | this.conditionStack.push(condition);
|
8623 | },
|
8624 |
|
8625 | // pop the previously active lexer condition state off the condition stack
|
8626 | popState:function popState () {
|
8627 | var n = this.conditionStack.length - 1;
|
8628 | if (n > 0) {
|
8629 | return this.conditionStack.pop();
|
8630 | } else {
|
8631 | return this.conditionStack[0];
|
8632 | }
|
8633 | },
|
8634 |
|
8635 | // produce the lexer rule set which is active for the currently active lexer condition state
|
8636 | _currentRules:function _currentRules () {
|
8637 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
8638 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
8639 | } else {
|
8640 | return this.conditions["INITIAL"].rules;
|
8641 | }
|
8642 | },
|
8643 |
|
8644 | // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
8645 | topState:function topState (n) {
|
8646 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
8647 | if (n >= 0) {
|
8648 | return this.conditionStack[n];
|
8649 | } else {
|
8650 | return "INITIAL";
|
8651 | }
|
8652 | },
|
8653 |
|
8654 | // alias for begin(condition)
|
8655 | pushState:function pushState (condition) {
|
8656 | this.begin(condition);
|
8657 | },
|
8658 |
|
8659 | // return the number of states currently on the stack
|
8660 | stateStackSize:function stateStackSize() {
|
8661 | return this.conditionStack.length;
|
8662 | },
|
8663 | options: {"case-insensitive":true},
|
8664 | performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
8665 | var YYSTATE=YY_START;
|
8666 | switch($avoiding_name_collisions) {
|
8667 | case 0: this.begin('open_directive'); return 21;
|
8668 | break;
|
8669 | case 1: this.begin('type_directive'); return 22;
|
8670 | break;
|
8671 | case 2: this.popState(); this.begin('arg_directive'); return 15;
|
8672 | break;
|
8673 | case 3: this.popState(); this.popState(); return 24;
|
8674 | break;
|
8675 | case 4:return 23;
|
8676 | break;
|
8677 | case 5:/* skip comments */
|
8678 | break;
|
8679 | case 6:/* skip comments */
|
8680 | break;
|
8681 | case 7:return 11;
|
8682 | break;
|
8683 | case 8:/* skip whitespace */
|
8684 | break;
|
8685 | case 9:/* skip comments */
|
8686 | break;
|
8687 | case 10:return 4;
|
8688 | break;
|
8689 | case 11:return 17;
|
8690 | break;
|
8691 | case 12:return 18;
|
8692 | break;
|
8693 | case 13:return 19;
|
8694 | break;
|
8695 | case 14:return 20;
|
8696 | break;
|
8697 | case 15:return 15;
|
8698 | break;
|
8699 | case 16:return 6;
|
8700 | break;
|
8701 | case 17:return 'INVALID';
|
8702 | break;
|
8703 | }
|
8704 | },
|
8705 | rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],
|
8706 | conditions: {"open_directive":{"rules":[1],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,11,12,13,14,15,16,17],"inclusive":true}}
|
8707 | });
|
8708 | return lexer;
|
8709 | })();
|
8710 | parser.lexer = lexer;
|
8711 | function Parser () {
|
8712 | this.yy = {};
|
8713 | }
|
8714 | Parser.prototype = parser;parser.Parser = Parser;
|
8715 | return new Parser;
|
8716 | })();
|
8717 |
|
8718 |
|
8719 | if (true) {
|
8720 | exports.parser = parser;
|
8721 | exports.Parser = parser.Parser;
|
8722 | exports.parse = function () { return parser.parse.apply(parser, arguments); };
|
8723 | exports.main = function commonjsMain (args) {
|
8724 | if (!args[1]) {
|
8725 | console.log('Usage: '+args[0]+' FILE');
|
8726 | process.exit(1);
|
8727 | }
|
8728 | var source = __webpack_require__(/*! fs */ "?0f62").readFileSync(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize(args[1]), "utf8");
|
8729 | return exports.parser.parse(source);
|
8730 | };
|
8731 | if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
|
8732 | exports.main(process.argv.slice(1));
|
8733 | }
|
8734 | }
|
8735 |
|
8736 | /***/ }),
|
8737 |
|
8738 | /***/ "./src/config.js":
|
8739 | /*!***********************!*\
|
8740 | !*** ./src/config.js ***!
|
8741 | \***********************/
|
8742 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
8743 |
|
8744 | "use strict";
|
8745 | __webpack_require__.r(__webpack_exports__);
|
8746 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
8747 | /* harmony export */ "defaultConfig": () => (/* binding */ defaultConfig),
|
8748 | /* harmony export */ "updateCurrentConfig": () => (/* binding */ updateCurrentConfig),
|
8749 | /* harmony export */ "setSiteConfig": () => (/* binding */ setSiteConfig),
|
8750 | /* harmony export */ "saveConfigFromInitilize": () => (/* binding */ saveConfigFromInitilize),
|
8751 | /* harmony export */ "updateSiteConfig": () => (/* binding */ updateSiteConfig),
|
8752 | /* harmony export */ "getSiteConfig": () => (/* binding */ getSiteConfig),
|
8753 | /* harmony export */ "setConfig": () => (/* binding */ setConfig),
|
8754 | /* harmony export */ "getConfig": () => (/* binding */ getConfig),
|
8755 | /* harmony export */ "sanitize": () => (/* binding */ sanitize),
|
8756 | /* harmony export */ "addDirective": () => (/* binding */ addDirective),
|
8757 | /* harmony export */ "reset": () => (/* binding */ reset)
|
8758 | /* harmony export */ });
|
8759 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
|
8760 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
|
8761 | /* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
|
8762 | /* harmony import */ var _defaultConfig__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defaultConfig */ "./src/defaultConfig.js");
|
8763 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
8764 |
|
8765 |
|
8766 |
|
8767 |
|
8768 | // debugger;
|
8769 |
|
8770 | var defaultConfig = Object.freeze(_defaultConfig__WEBPACK_IMPORTED_MODULE_0__["default"]);
|
8771 | var siteConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, defaultConfig);
|
8772 | var configFromInitialize;
|
8773 | var directives = [];
|
8774 | var currentConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, defaultConfig);
|
8775 | var updateCurrentConfig = function updateCurrentConfig(siteCfg, _directives) {
|
8776 | // start with config beeing the siteConfig
|
8777 | var cfg = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, siteCfg); // let sCfg = assignWithDepth(defaultConfig, siteConfigDelta);
|
8778 | // Join directives
|
8779 |
|
8780 | var sumOfDirectives = {};
|
8781 |
|
8782 | for (var i = 0; i < _directives.length; i++) {
|
8783 | var d = _directives[i];
|
8784 | sanitize(d); // Apply the data from the directive where the the overrides the themeVaraibles
|
8785 |
|
8786 | sumOfDirectives = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(sumOfDirectives, d);
|
8787 | }
|
8788 |
|
8789 | cfg = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(cfg, sumOfDirectives);
|
8790 |
|
8791 | if (sumOfDirectives.theme) {
|
8792 | var tmpConfigFromInitialize = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, configFromInitialize);
|
8793 | var themeVariables = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(tmpConfigFromInitialize.themeVariables || {}, sumOfDirectives.themeVariables);
|
8794 | cfg.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_2__["default"][cfg.theme].getThemeVariables(themeVariables);
|
8795 | }
|
8796 |
|
8797 | currentConfig = cfg;
|
8798 | return cfg;
|
8799 | };
|
8800 | /**
|
8801 | *## setSiteConfig
|
8802 | *| Function | Description | Type | Values |
|
8803 | *| --------- | ------------------- | ------- | ------------------ |
|
8804 | *| setSiteConfig|Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array|
|
8805 | ***Notes:**
|
8806 | *Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls to reset() will reset
|
8807 | *the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig) will reset siteConfig and currentConfig
|
8808 | *to the defaultConfig
|
8809 | *Note: currentConfig is set in this function
|
8810 | **Default value: At default, will mirror Global Config**
|
8811 | * @param conf - the base currentConfig to use as siteConfig
|
8812 | * @returns {*} - the siteConfig
|
8813 | */
|
8814 |
|
8815 | var setSiteConfig = function setSiteConfig(conf) {
|
8816 | siteConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, defaultConfig);
|
8817 | siteConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(siteConfig, conf);
|
8818 |
|
8819 | if (conf.theme) {
|
8820 | siteConfig.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_2__["default"][conf.theme].getThemeVariables(conf.themeVariables);
|
8821 | }
|
8822 |
|
8823 | currentConfig = updateCurrentConfig(siteConfig, directives);
|
8824 | return siteConfig;
|
8825 | };
|
8826 | var saveConfigFromInitilize = function saveConfigFromInitilize(conf) {
|
8827 | configFromInitialize = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, conf);
|
8828 | };
|
8829 | var updateSiteConfig = function updateSiteConfig(conf) {
|
8830 | siteConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(siteConfig, conf);
|
8831 | updateCurrentConfig(siteConfig, directives);
|
8832 | return siteConfig;
|
8833 | };
|
8834 | /**
|
8835 | *## getSiteConfig
|
8836 | *| Function | Description | Type | Values |
|
8837 | *| --------- | ------------------- | ------- | ------------------ |
|
8838 | *| setSiteConfig|Returns the current siteConfig base configuration | Get Request | Returns Any Values in siteConfig|
|
8839 | ***Notes**:
|
8840 | *Returns **any** values in siteConfig.
|
8841 | * @returns {*}
|
8842 | */
|
8843 |
|
8844 | var getSiteConfig = function getSiteConfig() {
|
8845 | return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, siteConfig);
|
8846 | };
|
8847 | /**
|
8848 | *## setConfig
|
8849 | *| Function | Description | Type | Values |
|
8850 | *| --------- | ------------------- | ------- | ------------------ |
|
8851 | *| setSiteConfig|Sets the siteConfig to desired values | Put Request| Any Values, except ones in secure array|
|
8852 | ***Notes**:
|
8853 | *Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure keys. Any
|
8854 | *values found in conf with key found in siteConfig.secure will be replaced with the corresponding
|
8855 | *siteConfig value.
|
8856 | * @param conf - the potential currentConfig
|
8857 | * @returns {*} - the currentConfig merged with the sanitized conf
|
8858 | */
|
8859 |
|
8860 | var setConfig = function setConfig(conf) {
|
8861 | // sanitize(conf);
|
8862 | // Object.keys(conf).forEach(key => {
|
8863 | // const manipulator = manipulators[key];
|
8864 | // conf[key] = manipulator ? manipulator(conf[key]) : conf[key];
|
8865 | // });
|
8866 | (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(currentConfig, conf);
|
8867 | return getConfig();
|
8868 | };
|
8869 | /**
|
8870 | * ## getConfig
|
8871 | *| Function | Description | Type | Return Values |
|
8872 | *| --------- | ------------------- | ------- | ------------------ |
|
8873 | *| getConfig |Obtains the currentConfig | Get Request | Any Values from currentConfig|
|
8874 | ***Notes**:
|
8875 | *Returns **any** the currentConfig
|
8876 | * @returns {*} - the currentConfig
|
8877 | */
|
8878 |
|
8879 | var getConfig = function getConfig() {
|
8880 | return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, currentConfig);
|
8881 | };
|
8882 | /**
|
8883 | *## sanitize
|
8884 | *| Function | Description | Type | Values |
|
8885 | *| --------- | ------------------- | ------- | ------------------ |
|
8886 | *| sanitize |Sets the siteConfig to desired values. | Put Request |None|
|
8887 | *Ensures options parameter does not attempt to override siteConfig secure keys
|
8888 | *Note: modifies options in-place
|
8889 | * @param options - the potential setConfig parameter
|
8890 | */
|
8891 |
|
8892 | var sanitize = function sanitize(options) {
|
8893 | // Checking that options are not in the list of excluded options
|
8894 | Object.keys(siteConfig.secure).forEach(function (key) {
|
8895 | if (typeof options[siteConfig.secure[key]] !== 'undefined') {
|
8896 | // DO NOT attempt to print options[siteConfig.secure[key]] within `${}` as a malicious script
|
8897 | // can exploit the logger's attempt to stringify the value and execute arbitrary code
|
8898 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug("Denied attempt to modify a secure key ".concat(siteConfig.secure[key]), options[siteConfig.secure[key]]);
|
8899 | delete options[siteConfig.secure[key]];
|
8900 | }
|
8901 | }); // Check that there no attempts of prototype pollution
|
8902 |
|
8903 | Object.keys(options).forEach(function (key) {
|
8904 | if (key.indexOf('__') === 0) {
|
8905 | delete options[key];
|
8906 | }
|
8907 | }); // Check that there no attempts of xss, there should be no tags at all in the directive
|
8908 | // blocking data urls as base64 urls can contain svgs with inline script tags
|
8909 |
|
8910 | Object.keys(options).forEach(function (key) {
|
8911 | if (typeof options[key] === 'string') {
|
8912 | if (options[key].indexOf('<') > -1 || options[key].indexOf('>') > -1 || options[key].indexOf('url(data:') > -1) {
|
8913 | delete options[key];
|
8914 | }
|
8915 | }
|
8916 |
|
8917 | if (_typeof(options[key]) === 'object') {
|
8918 | sanitize(options[key]);
|
8919 | }
|
8920 | });
|
8921 | };
|
8922 | var addDirective = function addDirective(directive) {
|
8923 | if (directive.fontFamily) {
|
8924 | if (!directive.themeVariables) {
|
8925 | directive.themeVariables = {
|
8926 | fontFamily: directive.fontFamily
|
8927 | };
|
8928 | } else {
|
8929 | if (!directive.themeVariables.fontFamily) {
|
8930 | directive.themeVariables = {
|
8931 | fontFamily: directive.fontFamily
|
8932 | };
|
8933 | }
|
8934 | }
|
8935 | }
|
8936 |
|
8937 | directives.push(directive);
|
8938 | updateCurrentConfig(siteConfig, directives);
|
8939 | };
|
8940 | /**
|
8941 | *## reset
|
8942 | *| Function | Description | Type | Required | Values |
|
8943 | *| --------- | ------------------- | ------- | -------- | ------------------ |
|
8944 | *| reset|Resets currentConfig to conf| Put Request | Required | None|
|
8945 | *
|
8946 | *| Parameter | Description |Type | Required | Values|
|
8947 | *| --- | --- | --- | --- | --- |
|
8948 | *| conf| base set of values, which currentConfig coul be **reset** to.| Dictionary | Required | Any Values, with respect to the secure Array|
|
8949 | *
|
8950 | **Notes :
|
8951 | (default: current siteConfig ) (optional, default `getSiteConfig()`)
|
8952 | * @param conf the base currentConfig to reset to (default: current siteConfig ) (optional, default `getSiteConfig()`)
|
8953 | */
|
8954 |
|
8955 | var reset = function reset() {
|
8956 | // Replace current config with siteConfig
|
8957 | directives = [];
|
8958 | updateCurrentConfig(siteConfig, directives);
|
8959 | };
|
8960 |
|
8961 | /***/ }),
|
8962 |
|
8963 | /***/ "./src/dagre-wrapper/clusters.js":
|
8964 | /*!***************************************!*\
|
8965 | !*** ./src/dagre-wrapper/clusters.js ***!
|
8966 | \***************************************/
|
8967 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
8968 |
|
8969 | "use strict";
|
8970 | __webpack_require__.r(__webpack_exports__);
|
8971 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
8972 | /* harmony export */ "insertCluster": () => (/* binding */ insertCluster),
|
8973 | /* harmony export */ "getClusterTitleWidth": () => (/* binding */ getClusterTitleWidth),
|
8974 | /* harmony export */ "clear": () => (/* binding */ clear),
|
8975 | /* harmony export */ "positionCluster": () => (/* binding */ positionCluster)
|
8976 | /* harmony export */ });
|
8977 | /* harmony import */ var _intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./intersect/intersect-rect */ "./src/dagre-wrapper/intersect/intersect-rect.js");
|
8978 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
|
8979 | /* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
|
8980 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
8981 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
8982 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../config */ "./src/config.js");
|
8983 | /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js");
|
8984 |
|
8985 |
|
8986 |
|
8987 |
|
8988 |
|
8989 |
|
8990 |
|
8991 | var rect = function rect(parent, node) {
|
8992 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Creating subgraph rect for ', node.id, node); // Add outer g element
|
8993 |
|
8994 | var shapeSvg = parent.insert('g').attr('class', 'cluster' + (node.class ? ' ' + node.class : '')).attr('id', node.id); // add the rect
|
8995 |
|
8996 | var rect = shapeSvg.insert('rect', ':first-child'); // Create the label and insert it after the rect
|
8997 |
|
8998 | var label = shapeSvg.insert('g').attr('class', 'cluster-label');
|
8999 | var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true)); // Get the size of the label
|
9000 |
|
9001 | var bbox = text.getBBox();
|
9002 |
|
9003 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels)) {
|
9004 | var div = text.children[0];
|
9005 | var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text);
|
9006 | bbox = div.getBoundingClientRect();
|
9007 | dv.attr('width', bbox.width);
|
9008 | dv.attr('height', bbox.height);
|
9009 | }
|
9010 |
|
9011 | var padding = 0 * node.padding;
|
9012 | var halfPadding = padding / 2;
|
9013 | var width = node.width <= bbox.width + padding ? bbox.width + padding : node.width;
|
9014 |
|
9015 | if (node.width <= bbox.width + padding) {
|
9016 | node.diff = (bbox.width - node.width) / 2;
|
9017 | } else {
|
9018 | node.diff = -node.padding / 2;
|
9019 | }
|
9020 |
|
9021 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Data ', node, JSON.stringify(node)); // center the rect around its coordinate
|
9022 |
|
9023 | 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
|
9024 |
|
9025 | label.attr('transform', 'translate(' + (node.x - bbox.width / 2) + ', ' + (node.y - node.height / 2 + node.padding / 3) + ')');
|
9026 | var rectBox = rect.node().getBBox();
|
9027 | node.width = rectBox.width;
|
9028 | node.height = rectBox.height;
|
9029 |
|
9030 | node.intersect = function (point) {
|
9031 | return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point);
|
9032 | };
|
9033 |
|
9034 | return shapeSvg;
|
9035 | };
|
9036 | /**
|
9037 | * Non visiable cluster where the note is group with its
|
9038 | */
|
9039 |
|
9040 |
|
9041 | var noteGroup = function noteGroup(parent, node) {
|
9042 | // Add outer g element
|
9043 | var shapeSvg = parent.insert('g').attr('class', 'note-cluster').attr('id', node.id); // add the rect
|
9044 |
|
9045 | var rect = shapeSvg.insert('rect', ':first-child');
|
9046 | var padding = 0 * node.padding;
|
9047 | var halfPadding = padding / 2; // center the rect around its coordinate
|
9048 |
|
9049 | 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');
|
9050 | var rectBox = rect.node().getBBox();
|
9051 | node.width = rectBox.width;
|
9052 | node.height = rectBox.height;
|
9053 |
|
9054 | node.intersect = function (point) {
|
9055 | return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point);
|
9056 | };
|
9057 |
|
9058 | return shapeSvg;
|
9059 | };
|
9060 |
|
9061 | var roundedWithTitle = function roundedWithTitle(parent, node) {
|
9062 | // Add outer g element
|
9063 | var shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id); // add the rect
|
9064 |
|
9065 | var rect = shapeSvg.insert('rect', ':first-child'); // Create the label and insert it after the rect
|
9066 |
|
9067 | var label = shapeSvg.insert('g').attr('class', 'cluster-label');
|
9068 | var innerRect = shapeSvg.append('rect');
|
9069 | var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true)); // Get the size of the label
|
9070 |
|
9071 | var bbox = text.getBBox();
|
9072 |
|
9073 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels)) {
|
9074 | var div = text.children[0];
|
9075 | var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text);
|
9076 | bbox = div.getBoundingClientRect();
|
9077 | dv.attr('width', bbox.width);
|
9078 | dv.attr('height', bbox.height);
|
9079 | }
|
9080 |
|
9081 | bbox = text.getBBox();
|
9082 | var padding = 0 * node.padding;
|
9083 | var halfPadding = padding / 2;
|
9084 | var width = node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width;
|
9085 |
|
9086 | if (node.width <= bbox.width + node.padding) {
|
9087 | node.diff = (bbox.width + node.padding * 0 - node.width) / 2;
|
9088 | } else {
|
9089 | node.diff = -node.padding / 2;
|
9090 | } // center the rect around its coordinate
|
9091 |
|
9092 |
|
9093 | 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);
|
9094 | 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
|
9095 |
|
9096 | 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)) + ')');
|
9097 | var rectBox = rect.node().getBBox();
|
9098 | node.height = rectBox.height;
|
9099 |
|
9100 | node.intersect = function (point) {
|
9101 | return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point);
|
9102 | };
|
9103 |
|
9104 | return shapeSvg;
|
9105 | };
|
9106 |
|
9107 | var divider = function divider(parent, node) {
|
9108 | // Add outer g element
|
9109 | var shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id); // add the rect
|
9110 |
|
9111 | var rect = shapeSvg.insert('rect', ':first-child');
|
9112 | var padding = 0 * node.padding;
|
9113 | var halfPadding = padding / 2; // center the rect around its coordinate
|
9114 |
|
9115 | 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);
|
9116 | var rectBox = rect.node().getBBox();
|
9117 | node.width = rectBox.width;
|
9118 | node.height = rectBox.height;
|
9119 | node.diff = -node.padding / 2;
|
9120 |
|
9121 | node.intersect = function (point) {
|
9122 | return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point);
|
9123 | };
|
9124 |
|
9125 | return shapeSvg;
|
9126 | };
|
9127 |
|
9128 | var shapes = {
|
9129 | rect: rect,
|
9130 | roundedWithTitle: roundedWithTitle,
|
9131 | noteGroup: noteGroup,
|
9132 | divider: divider
|
9133 | };
|
9134 | var clusterElems = {};
|
9135 | var insertCluster = function insertCluster(elem, node) {
|
9136 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Inserting cluster');
|
9137 | var shape = node.shape || 'rect';
|
9138 | clusterElems[node.id] = shapes[shape](elem, node);
|
9139 | };
|
9140 | var getClusterTitleWidth = function getClusterTitleWidth(elem, node) {
|
9141 | var label = (0,_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true);
|
9142 | elem.node().appendChild(label);
|
9143 | var width = label.getBBox().width;
|
9144 | elem.node().removeChild(label);
|
9145 | return width;
|
9146 | };
|
9147 | var clear = function clear() {
|
9148 | clusterElems = {};
|
9149 | };
|
9150 | var positionCluster = function positionCluster(node) {
|
9151 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Position cluster (' + node.id + ', ' + node.x + ', ' + node.y + ')');
|
9152 | var el = clusterElems[node.id];
|
9153 | el.attr('transform', 'translate(' + node.x + ', ' + node.y + ')');
|
9154 | };
|
9155 |
|
9156 | /***/ }),
|
9157 |
|
9158 | /***/ "./src/dagre-wrapper/createLabel.js":
|
9159 | /*!******************************************!*\
|
9160 | !*** ./src/dagre-wrapper/createLabel.js ***!
|
9161 | \******************************************/
|
9162 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
9163 |
|
9164 | "use strict";
|
9165 | __webpack_require__.r(__webpack_exports__);
|
9166 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
9167 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
9168 | /* harmony export */ });
|
9169 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
9170 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
9171 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
|
9172 | /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js");
|
9173 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../config */ "./src/config.js");
|
9174 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
9175 |
|
9176 |
|
9177 | // eslint-disable-line
|
9178 |
|
9179 | // let vertexNode;
|
9180 | // if (evaluate(getConfig().flowchart.htmlLabels)) {
|
9181 | // // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
|
9182 | // const node = {
|
9183 | // label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, s => `<i class='${s.replace(':', ' ')}'></i>`)
|
9184 | // };
|
9185 | // vertexNode = addHtmlLabel(svg, node).node();
|
9186 | // vertexNode.parentNode.removeChild(vertexNode);
|
9187 | // } else {
|
9188 | // const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
9189 | // svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
|
9190 | // const rows = vertexText.split(common.lineBreakRegex);
|
9191 | // for (let j = 0; j < rows.length; j++) {
|
9192 | // const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
9193 | // tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
9194 | // tspan.setAttribute('dy', '1em');
|
9195 | // tspan.setAttribute('x', '1');
|
9196 | // tspan.textContent = rows[j];
|
9197 | // svgLabel.appendChild(tspan);
|
9198 | // }
|
9199 | // vertexNode = svgLabel;
|
9200 | // }
|
9201 |
|
9202 |
|
9203 |
|
9204 | function applyStyle(dom, styleFn) {
|
9205 | if (styleFn) {
|
9206 | dom.attr('style', styleFn);
|
9207 | }
|
9208 | }
|
9209 |
|
9210 | function addHtmlLabel(node) {
|
9211 | // var fo = root.append('foreignObject').attr('width', '100000');
|
9212 | // var div = fo.append('xhtml:div');
|
9213 | // div.attr('xmlns', 'http://www.w3.org/1999/xhtml');
|
9214 | // var label = node.label;
|
9215 | // switch (typeof label) {
|
9216 | // case 'function':
|
9217 | // div.insert(label);
|
9218 | // break;
|
9219 | // case 'object':
|
9220 | // // Currently we assume this is a DOM object.
|
9221 | // div.insert(function() {
|
9222 | // return label;
|
9223 | // });
|
9224 | // break;
|
9225 | // default:
|
9226 | // div.html(label);
|
9227 | // }
|
9228 | // applyStyle(div, node.labelStyle);
|
9229 | // div.style('display', 'inline-block');
|
9230 | // // Fix for firefox
|
9231 | // div.style('white-space', 'nowrap');
|
9232 | // var client = div.node().getBoundingClientRect();
|
9233 | // fo.attr('width', client.width).attr('height', client.height);
|
9234 | var fo = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject'));
|
9235 | var div = fo.append('xhtml:div');
|
9236 | var label = node.label;
|
9237 | var labelClass = node.isNode ? 'nodeLabel' : 'edgeLabel';
|
9238 | div.html('<span class="' + labelClass + '" ' + (node.labelStyle ? 'style="' + node.labelStyle + '"' : '') + '>' + label + '</span>');
|
9239 | applyStyle(div, node.labelStyle);
|
9240 | div.style('display', 'inline-block'); // Fix for firefox
|
9241 |
|
9242 | div.style('white-space', 'nowrap');
|
9243 | div.attr('xmlns', 'http://www.w3.org/1999/xhtml');
|
9244 | return fo.node();
|
9245 | }
|
9246 |
|
9247 | var createLabel = function createLabel(_vertexText, style, isTitle, isNode) {
|
9248 | var vertexText = _vertexText || '';
|
9249 | if (_typeof(vertexText) === 'object') vertexText = vertexText[0];
|
9250 |
|
9251 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) {
|
9252 | // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
|
9253 | vertexText = vertexText.replace(/\\n|\n/g, '<br />');
|
9254 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('vertexText' + vertexText);
|
9255 | var node = {
|
9256 | isNode: isNode,
|
9257 | label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
|
9258 | return "<i class='".concat(s.replace(':', ' '), "'></i>");
|
9259 | }),
|
9260 | labelStyle: style.replace('fill:', 'color:')
|
9261 | };
|
9262 | var vertexNode = addHtmlLabel(node); // vertexNode.parentNode.removeChild(vertexNode);
|
9263 |
|
9264 | return vertexNode;
|
9265 | } else {
|
9266 | var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
9267 | svgLabel.setAttribute('style', style.replace('color:', 'fill:'));
|
9268 | var rows = [];
|
9269 |
|
9270 | if (typeof vertexText === 'string') {
|
9271 | rows = vertexText.split(/\\n|\n|<br\s*\/?>/gi);
|
9272 | } else if (Array.isArray(vertexText)) {
|
9273 | rows = vertexText;
|
9274 | } else {
|
9275 | rows = [];
|
9276 | }
|
9277 |
|
9278 | for (var j = 0; j < rows.length; j++) {
|
9279 | var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
9280 | tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
9281 | tspan.setAttribute('dy', '1em');
|
9282 | tspan.setAttribute('x', '0');
|
9283 |
|
9284 | if (isTitle) {
|
9285 | tspan.setAttribute('class', 'title-row');
|
9286 | } else {
|
9287 | tspan.setAttribute('class', 'row');
|
9288 | }
|
9289 |
|
9290 | tspan.textContent = rows[j].trim();
|
9291 | svgLabel.appendChild(tspan);
|
9292 | }
|
9293 |
|
9294 | return svgLabel;
|
9295 | }
|
9296 | };
|
9297 |
|
9298 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (createLabel);
|
9299 |
|
9300 | /***/ }),
|
9301 |
|
9302 | /***/ "./src/dagre-wrapper/edges.js":
|
9303 | /*!************************************!*\
|
9304 | !*** ./src/dagre-wrapper/edges.js ***!
|
9305 | \************************************/
|
9306 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
9307 |
|
9308 | "use strict";
|
9309 | __webpack_require__.r(__webpack_exports__);
|
9310 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
9311 | /* harmony export */ "clear": () => (/* binding */ clear),
|
9312 | /* harmony export */ "insertEdgeLabel": () => (/* binding */ insertEdgeLabel),
|
9313 | /* harmony export */ "positionEdgeLabel": () => (/* binding */ positionEdgeLabel),
|
9314 | /* harmony export */ "intersection": () => (/* binding */ intersection),
|
9315 | /* harmony export */ "insertEdge": () => (/* binding */ insertEdge)
|
9316 | /* harmony export */ });
|
9317 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
|
9318 | /* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
|
9319 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
9320 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
9321 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../config */ "./src/config.js");
|
9322 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils */ "./src/utils.js");
|
9323 | /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js");
|
9324 | // eslint-disable-line
|
9325 |
|
9326 | // import { line, curveBasis, curveLinear, select } from 'd3';
|
9327 |
|
9328 |
|
9329 |
|
9330 |
|
9331 |
|
9332 | var edgeLabels = {};
|
9333 | var terminalLabels = {};
|
9334 | var clear = function clear() {
|
9335 | edgeLabels = {};
|
9336 | terminalLabels = {};
|
9337 | };
|
9338 | var insertEdgeLabel = function insertEdgeLabel(elem, edge) {
|
9339 | // Create the actual text element
|
9340 | var labelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.label, edge.labelStyle); // Create outer g, edgeLabel, this will be positioned after graph layout
|
9341 |
|
9342 | var edgeLabel = elem.insert('g').attr('class', 'edgeLabel'); // Create inner g, label, this will be positioned now for centering the text
|
9343 |
|
9344 | var label = edgeLabel.insert('g').attr('class', 'label');
|
9345 | label.node().appendChild(labelElement); // Center the label
|
9346 |
|
9347 | var bbox = labelElement.getBBox();
|
9348 |
|
9349 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().flowchart.htmlLabels)) {
|
9350 | var div = labelElement.children[0];
|
9351 | var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(labelElement);
|
9352 | bbox = div.getBoundingClientRect();
|
9353 | dv.attr('width', bbox.width);
|
9354 | dv.attr('height', bbox.height);
|
9355 | }
|
9356 |
|
9357 | label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')'); // Make element accessible by id for positioning
|
9358 |
|
9359 | edgeLabels[edge.id] = edgeLabel; // Update the abstract data of the edge with the new information about its width and height
|
9360 |
|
9361 | edge.width = bbox.width;
|
9362 | edge.height = bbox.height;
|
9363 | var fo;
|
9364 |
|
9365 | if (edge.startLabelLeft) {
|
9366 | // Create the actual text element
|
9367 | var startLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.startLabelLeft, edge.labelStyle);
|
9368 | var startEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');
|
9369 | var inner = startEdgeLabelLeft.insert('g').attr('class', 'inner');
|
9370 | fo = inner.node().appendChild(startLabelElement);
|
9371 | var slBox = startLabelElement.getBBox();
|
9372 | inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
9373 |
|
9374 | if (!terminalLabels[edge.id]) {
|
9375 | terminalLabels[edge.id] = {};
|
9376 | }
|
9377 |
|
9378 | terminalLabels[edge.id].startLeft = startEdgeLabelLeft;
|
9379 | setTerminalWidth(fo, edge.startLabelLeft);
|
9380 | }
|
9381 |
|
9382 | if (edge.startLabelRight) {
|
9383 | // Create the actual text element
|
9384 | var _startLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.startLabelRight, edge.labelStyle);
|
9385 |
|
9386 | var startEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
|
9387 |
|
9388 | var _inner = startEdgeLabelRight.insert('g').attr('class', 'inner');
|
9389 |
|
9390 | fo = startEdgeLabelRight.node().appendChild(_startLabelElement);
|
9391 |
|
9392 | _inner.node().appendChild(_startLabelElement);
|
9393 |
|
9394 | var _slBox = _startLabelElement.getBBox();
|
9395 |
|
9396 | _inner.attr('transform', 'translate(' + -_slBox.width / 2 + ', ' + -_slBox.height / 2 + ')');
|
9397 |
|
9398 | if (!terminalLabels[edge.id]) {
|
9399 | terminalLabels[edge.id] = {};
|
9400 | }
|
9401 |
|
9402 | terminalLabels[edge.id].startRight = startEdgeLabelRight;
|
9403 | setTerminalWidth(fo, edge.startLabelRight);
|
9404 | }
|
9405 |
|
9406 | if (edge.endLabelLeft) {
|
9407 | // Create the actual text element
|
9408 | var endLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.endLabelLeft, edge.labelStyle);
|
9409 | var endEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');
|
9410 |
|
9411 | var _inner2 = endEdgeLabelLeft.insert('g').attr('class', 'inner');
|
9412 |
|
9413 | fo = _inner2.node().appendChild(endLabelElement);
|
9414 |
|
9415 | var _slBox2 = endLabelElement.getBBox();
|
9416 |
|
9417 | _inner2.attr('transform', 'translate(' + -_slBox2.width / 2 + ', ' + -_slBox2.height / 2 + ')');
|
9418 |
|
9419 | endEdgeLabelLeft.node().appendChild(endLabelElement);
|
9420 |
|
9421 | if (!terminalLabels[edge.id]) {
|
9422 | terminalLabels[edge.id] = {};
|
9423 | }
|
9424 |
|
9425 | terminalLabels[edge.id].endLeft = endEdgeLabelLeft;
|
9426 | setTerminalWidth(fo, edge.endLabelLeft);
|
9427 | }
|
9428 |
|
9429 | if (edge.endLabelRight) {
|
9430 | // Create the actual text element
|
9431 | var _endLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.endLabelRight, edge.labelStyle);
|
9432 |
|
9433 | var endEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
|
9434 |
|
9435 | var _inner3 = endEdgeLabelRight.insert('g').attr('class', 'inner');
|
9436 |
|
9437 | fo = _inner3.node().appendChild(_endLabelElement);
|
9438 |
|
9439 | var _slBox3 = _endLabelElement.getBBox();
|
9440 |
|
9441 | _inner3.attr('transform', 'translate(' + -_slBox3.width / 2 + ', ' + -_slBox3.height / 2 + ')');
|
9442 |
|
9443 | endEdgeLabelRight.node().appendChild(_endLabelElement);
|
9444 |
|
9445 | if (!terminalLabels[edge.id]) {
|
9446 | terminalLabels[edge.id] = {};
|
9447 | }
|
9448 |
|
9449 | terminalLabels[edge.id].endRight = endEdgeLabelRight;
|
9450 | setTerminalWidth(fo, edge.endLabelRight);
|
9451 | }
|
9452 | };
|
9453 |
|
9454 | function setTerminalWidth(fo, value) {
|
9455 | if ((0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().flowchart.htmlLabels && fo) {
|
9456 | fo.style.width = value.length * 9 + 'px';
|
9457 | fo.style.height = '12px';
|
9458 | }
|
9459 | }
|
9460 |
|
9461 | var positionEdgeLabel = function positionEdgeLabel(edge, paths) {
|
9462 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Moving label abc78 ', edge.id, edge.label, edgeLabels[edge.id]);
|
9463 | var path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
|
9464 |
|
9465 | if (edge.label) {
|
9466 | var el = edgeLabels[edge.id];
|
9467 | var x = edge.x;
|
9468 | var y = edge.y;
|
9469 |
|
9470 | if (path) {
|
9471 | // // debugger;
|
9472 | var pos = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcLabelPosition(path);
|
9473 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Moving label from (', x, ',', y, ') to (', pos.x, ',', pos.y, ') abc78'); // x = pos.x;
|
9474 | // y = pos.y;
|
9475 | }
|
9476 |
|
9477 | el.attr('transform', 'translate(' + x + ', ' + y + ')');
|
9478 | } //let path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
|
9479 |
|
9480 |
|
9481 | if (edge.startLabelLeft) {
|
9482 | var _el = terminalLabels[edge.id].startLeft;
|
9483 | var _x2 = edge.x;
|
9484 | var _y2 = edge.y;
|
9485 |
|
9486 | if (path) {
|
9487 | // debugger;
|
9488 | var _pos = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, 'start_left', path);
|
9489 |
|
9490 | _x2 = _pos.x;
|
9491 | _y2 = _pos.y;
|
9492 | }
|
9493 |
|
9494 | _el.attr('transform', 'translate(' + _x2 + ', ' + _y2 + ')');
|
9495 | }
|
9496 |
|
9497 | if (edge.startLabelRight) {
|
9498 | var _el2 = terminalLabels[edge.id].startRight;
|
9499 | var _x3 = edge.x;
|
9500 | var _y3 = edge.y;
|
9501 |
|
9502 | if (path) {
|
9503 | // debugger;
|
9504 | var _pos2 = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, 'start_right', path);
|
9505 |
|
9506 | _x3 = _pos2.x;
|
9507 | _y3 = _pos2.y;
|
9508 | }
|
9509 |
|
9510 | _el2.attr('transform', 'translate(' + _x3 + ', ' + _y3 + ')');
|
9511 | }
|
9512 |
|
9513 | if (edge.endLabelLeft) {
|
9514 | var _el3 = terminalLabels[edge.id].endLeft;
|
9515 | var _x4 = edge.x;
|
9516 | var _y4 = edge.y;
|
9517 |
|
9518 | if (path) {
|
9519 | // debugger;
|
9520 | var _pos3 = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, 'end_left', path);
|
9521 |
|
9522 | _x4 = _pos3.x;
|
9523 | _y4 = _pos3.y;
|
9524 | }
|
9525 |
|
9526 | _el3.attr('transform', 'translate(' + _x4 + ', ' + _y4 + ')');
|
9527 | }
|
9528 |
|
9529 | if (edge.endLabelRight) {
|
9530 | var _el4 = terminalLabels[edge.id].endRight;
|
9531 | var _x5 = edge.x;
|
9532 | var _y5 = edge.y;
|
9533 |
|
9534 | if (path) {
|
9535 | // debugger;
|
9536 | var _pos4 = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, 'end_right', path);
|
9537 |
|
9538 | _x5 = _pos4.x;
|
9539 | _y5 = _pos4.y;
|
9540 | }
|
9541 |
|
9542 | _el4.attr('transform', 'translate(' + _x5 + ', ' + _y5 + ')');
|
9543 | }
|
9544 | }; // const getRelationType = function(type) {
|
9545 | // switch (type) {
|
9546 | // case stateDb.relationType.AGGREGATION:
|
9547 | // return 'aggregation';
|
9548 | // case stateDb.relationType.EXTENSION:
|
9549 | // return 'extension';
|
9550 | // case stateDb.relationType.COMPOSITION:
|
9551 | // return 'composition';
|
9552 | // case stateDb.relationType.DEPENDENCY:
|
9553 | // return 'dependency';
|
9554 | // }
|
9555 | // };
|
9556 |
|
9557 | var outsideNode = function outsideNode(node, point) {
|
9558 | // log.warn('Checking bounds ', node, point);
|
9559 | var x = node.x;
|
9560 | var y = node.y;
|
9561 | var dx = Math.abs(point.x - x);
|
9562 | var dy = Math.abs(point.y - y);
|
9563 | var w = node.width / 2;
|
9564 | var h = node.height / 2;
|
9565 |
|
9566 | if (dx >= w || dy >= h) {
|
9567 | return true;
|
9568 | }
|
9569 |
|
9570 | return false;
|
9571 | };
|
9572 |
|
9573 | var intersection = function intersection(node, outsidePoint, insidePoint) {
|
9574 | _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));
|
9575 | var x = node.x;
|
9576 | var y = node.y;
|
9577 | var dx = Math.abs(x - insidePoint.x); // const dy = Math.abs(y - insidePoint.y);
|
9578 |
|
9579 | var w = node.width / 2;
|
9580 | var r = insidePoint.x < outsidePoint.x ? w - dx : w + dx;
|
9581 | var h = node.height / 2; // const edges = {
|
9582 | // x1: x - w,
|
9583 | // x2: x + w,
|
9584 | // y1: y - h,
|
9585 | // y2: y + h
|
9586 | // };
|
9587 | // if (
|
9588 | // outsidePoint.x === edges.x1 ||
|
9589 | // outsidePoint.x === edges.x2 ||
|
9590 | // outsidePoint.y === edges.y1 ||
|
9591 | // outsidePoint.y === edges.y2
|
9592 | // ) {
|
9593 | // log.warn('abc89 calc equals on edge', outsidePoint, edges);
|
9594 | // return outsidePoint;
|
9595 | // }
|
9596 |
|
9597 | var Q = Math.abs(outsidePoint.y - insidePoint.y);
|
9598 | var R = Math.abs(outsidePoint.x - insidePoint.x); // log.warn();
|
9599 |
|
9600 | if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {
|
9601 | // eslint-disable-line
|
9602 | // Intersection is top or bottom of rect.
|
9603 | // let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
|
9604 | var q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
|
9605 | r = R * q / Q;
|
9606 | var res = {
|
9607 | x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r,
|
9608 | y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q
|
9609 | };
|
9610 |
|
9611 | if (r === 0) {
|
9612 | res.x = outsidePoint.x;
|
9613 | res.y = outsidePoint.y;
|
9614 | }
|
9615 |
|
9616 | if (R === 0) {
|
9617 | res.x = outsidePoint.x;
|
9618 | }
|
9619 |
|
9620 | if (Q === 0) {
|
9621 | res.y = outsidePoint.y;
|
9622 | }
|
9623 |
|
9624 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("abc89 topp/bott calc, Q ".concat(Q, ", q ").concat(q, ", R ").concat(R, ", r ").concat(r), res);
|
9625 | return res;
|
9626 | } else {
|
9627 | // Intersection onn sides of rect
|
9628 | if (insidePoint.x < outsidePoint.x) {
|
9629 | r = outsidePoint.x - w - x;
|
9630 | } else {
|
9631 | // r = outsidePoint.x - w - x;
|
9632 | r = x - w - outsidePoint.x;
|
9633 | }
|
9634 |
|
9635 | var _q = Q * r / R; // OK let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x + dx - w;
|
9636 | // OK let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : outsidePoint.x + r;
|
9637 |
|
9638 |
|
9639 | 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;
|
9640 |
|
9641 |
|
9642 | var _y = insidePoint.y < outsidePoint.y ? insidePoint.y + _q : insidePoint.y - _q;
|
9643 |
|
9644 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("sides calc abc89, Q ".concat(Q, ", q ").concat(_q, ", R ").concat(R, ", r ").concat(r), {
|
9645 | _x: _x,
|
9646 | _y: _y
|
9647 | });
|
9648 |
|
9649 | if (r === 0) {
|
9650 | _x = outsidePoint.x;
|
9651 | _y = outsidePoint.y;
|
9652 | }
|
9653 |
|
9654 | if (R === 0) {
|
9655 | _x = outsidePoint.x;
|
9656 | }
|
9657 |
|
9658 | if (Q === 0) {
|
9659 | _y = outsidePoint.y;
|
9660 | }
|
9661 |
|
9662 | return {
|
9663 | x: _x,
|
9664 | y: _y
|
9665 | };
|
9666 | }
|
9667 | };
|
9668 | /**
|
9669 | * This function will page a path and node where the last point(s) in the path is inside the node
|
9670 | * and return an update path ending by the border of the node.
|
9671 | * @param {*} points
|
9672 | * @param {*} boundryNode
|
9673 | * @returns
|
9674 | */
|
9675 |
|
9676 | var cutPathAtIntersect = function cutPathAtIntersect(_points, boundryNode) {
|
9677 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 cutPathAtIntersect', _points, boundryNode);
|
9678 | var points = [];
|
9679 | var lastPointOutside = _points[0];
|
9680 | var isInside = false;
|
9681 |
|
9682 | _points.forEach(function (point) {
|
9683 | // const node = clusterDb[edge.toCluster].node;
|
9684 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('abc88 checking point', point, boundryNode); // check if point is inside the boundry rect
|
9685 |
|
9686 | if (!outsideNode(boundryNode, point) && !isInside) {
|
9687 | // First point inside the rect found
|
9688 | // Calc the intersection coord between the point anf the last opint ouside the rect
|
9689 | var inter = intersection(boundryNode, lastPointOutside, point);
|
9690 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 inside', point, lastPointOutside, inter);
|
9691 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 intersection', inter); // // Check case where the intersection is the same as the last point
|
9692 |
|
9693 | var pointPresent = false;
|
9694 | points.forEach(function (p) {
|
9695 | pointPresent = pointPresent || p.x === inter.x && p.y === inter.y;
|
9696 | }); // // if (!pointPresent) {
|
9697 |
|
9698 | if (!points.find(function (e) {
|
9699 | return e.x === inter.x && e.y === inter.y;
|
9700 | })) {
|
9701 | points.push(inter);
|
9702 | } else {
|
9703 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 no intersect', inter, points);
|
9704 | } // points.push(inter);
|
9705 |
|
9706 |
|
9707 | isInside = true;
|
9708 | } else {
|
9709 | // Outside
|
9710 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 outside', point, lastPointOutside);
|
9711 | lastPointOutside = point; // points.push(point);
|
9712 |
|
9713 | if (!isInside) points.push(point);
|
9714 | }
|
9715 | });
|
9716 |
|
9717 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 returning points', points);
|
9718 | return points;
|
9719 | }; //(edgePaths, e, edge, clusterDb, diagramtype, graph)
|
9720 |
|
9721 |
|
9722 | var insertEdge = function insertEdge(elem, e, edge, clusterDb, diagramType, graph) {
|
9723 | var points = edge.points;
|
9724 | var pointsHasChanged = false;
|
9725 | var tail = graph.node(e.v);
|
9726 | var head = graph.node(e.w);
|
9727 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('abc88 InsertEdge: ', edge);
|
9728 |
|
9729 | if (head.intersect && tail.intersect) {
|
9730 | points = points.slice(1, edge.points.length - 1);
|
9731 | points.unshift(tail.intersect(points[0]));
|
9732 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Last point', points[points.length - 1], head, head.intersect(points[points.length - 1]));
|
9733 | points.push(head.intersect(points[points.length - 1]));
|
9734 | }
|
9735 |
|
9736 | if (edge.toCluster) {
|
9737 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('to cluster abc88', clusterDb[edge.toCluster]);
|
9738 | points = cutPathAtIntersect(edge.points, clusterDb[edge.toCluster].node); // log.trace('edge', edge);
|
9739 | // points = [];
|
9740 | // let lastPointOutside; // = edge.points[0];
|
9741 | // let isInside = false;
|
9742 | // edge.points.forEach(point => {
|
9743 | // const node = clusterDb[edge.toCluster].node;
|
9744 | // log.warn('checking from', edge.fromCluster, point, node);
|
9745 | // if (!outsideNode(node, point) && !isInside) {
|
9746 | // log.trace('inside', edge.toCluster, point, lastPointOutside);
|
9747 | // // First point inside the rect
|
9748 | // const inter = intersection(node, lastPointOutside, point);
|
9749 | // let pointPresent = false;
|
9750 | // points.forEach(p => {
|
9751 | // pointPresent = pointPresent || (p.x === inter.x && p.y === inter.y);
|
9752 | // });
|
9753 | // // if (!pointPresent) {
|
9754 | // if (!points.find(e => e.x === inter.x && e.y === inter.y)) {
|
9755 | // points.push(inter);
|
9756 | // } else {
|
9757 | // log.warn('no intersect', inter, points);
|
9758 | // }
|
9759 | // isInside = true;
|
9760 | // } else {
|
9761 | // // outtside
|
9762 | // lastPointOutside = point;
|
9763 | // if (!isInside) points.push(point);
|
9764 | // }
|
9765 | // });
|
9766 |
|
9767 | pointsHasChanged = true;
|
9768 | }
|
9769 |
|
9770 | if (edge.fromCluster) {
|
9771 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('from cluster abc88', clusterDb[edge.fromCluster]);
|
9772 | points = cutPathAtIntersect(points.reverse(), clusterDb[edge.fromCluster].node).reverse(); // log.warn('edge', edge);
|
9773 | // log.warn('from cluster', clusterDb[edge.fromCluster], points);
|
9774 | // const updatedPoints = [];
|
9775 | // let lastPointOutside = edge.points[edge.points.length - 1];
|
9776 | // let isInside = false;
|
9777 | // for (let i = points.length - 1; i >= 0; i--) {
|
9778 | // const point = points[i];
|
9779 | // const node = clusterDb[edge.fromCluster].node;
|
9780 | // log.warn('checking to', edge.fromCluster, point, node);
|
9781 | // if (!outsideNode(node, point) && !isInside) {
|
9782 | // log.warn('inside', edge.fromCluster, point, node);
|
9783 | // // First point inside the rect
|
9784 | // const inter = intersection(node, lastPointOutside, point);
|
9785 | // log.warn('intersect', intersection(node, lastPointOutside, point));
|
9786 | // let pointPresent = false;
|
9787 | // points.forEach(p => {
|
9788 | // pointPresent = pointPresent || (p.x === inter.x && p.y === inter.y);
|
9789 | // });
|
9790 | // // if (!pointPresent) {
|
9791 | // if (!points.find(e => e.x === inter.x && e.y === inter.y)) {
|
9792 | // updatedPoints.unshift(inter);
|
9793 | // log.warn('Adding point -updated = ', updatedPoints);
|
9794 | // } else {
|
9795 | // log.warn('no intersect', inter, points);
|
9796 | // }
|
9797 | // // points.push(insterection);
|
9798 | // isInside = true;
|
9799 | // } else {
|
9800 | // // at the outside
|
9801 | // // if (!isInside) updatedPoints.unshift(point);
|
9802 | // updatedPoints.unshift(point);
|
9803 | // log.warn('Outside point', point, updatedPoints);
|
9804 | // }
|
9805 | // lastPointOutside = point;
|
9806 | // }
|
9807 | // points = updatedPoints;
|
9808 | // points = edge.points;
|
9809 |
|
9810 | pointsHasChanged = true;
|
9811 | } // The data for our line
|
9812 |
|
9813 |
|
9814 | var lineData = points.filter(function (p) {
|
9815 | return !Number.isNaN(p.y);
|
9816 | }); // This is the accessor function we talked about above
|
9817 |
|
9818 | var curve; // Currently only flowcharts get the curve from the settings, perhaps this should
|
9819 | // be expanded to a common setting? Restricting it for now in order not to cause side-effects that
|
9820 | // have not been thought through
|
9821 |
|
9822 | if (diagramType === 'graph' || diagramType === 'flowchart') {
|
9823 | curve = edge.curve || d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis;
|
9824 | } else {
|
9825 | curve = d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis;
|
9826 | } // curve = curveLinear;
|
9827 |
|
9828 |
|
9829 | var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) {
|
9830 | return d.x;
|
9831 | }).y(function (d) {
|
9832 | return d.y;
|
9833 | }).curve(curve); // Contruct stroke classes based on properties
|
9834 |
|
9835 | var strokeClasses;
|
9836 |
|
9837 | switch (edge.thickness) {
|
9838 | case 'normal':
|
9839 | strokeClasses = 'edge-thickness-normal';
|
9840 | break;
|
9841 |
|
9842 | case 'thick':
|
9843 | strokeClasses = 'edge-thickness-thick';
|
9844 | break;
|
9845 |
|
9846 | default:
|
9847 | strokeClasses = '';
|
9848 | }
|
9849 |
|
9850 | switch (edge.pattern) {
|
9851 | case 'solid':
|
9852 | strokeClasses += ' edge-pattern-solid';
|
9853 | break;
|
9854 |
|
9855 | case 'dotted':
|
9856 | strokeClasses += ' edge-pattern-dotted';
|
9857 | break;
|
9858 |
|
9859 | case 'dashed':
|
9860 | strokeClasses += ' edge-pattern-dashed';
|
9861 | break;
|
9862 | }
|
9863 |
|
9864 | 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
|
9865 | // edge.points.forEach(point => {
|
9866 | // elem
|
9867 | // .append('circle')
|
9868 | // .style('stroke', 'red')
|
9869 | // .style('fill', 'red')
|
9870 | // .attr('r', 1)
|
9871 | // .attr('cx', point.x)
|
9872 | // .attr('cy', point.y);
|
9873 | // });
|
9874 |
|
9875 | var url = '';
|
9876 |
|
9877 | if ((0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().state.arrowMarkerAbsolute) {
|
9878 | url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
|
9879 | url = url.replace(/\(/g, '\\(');
|
9880 | url = url.replace(/\)/g, '\\)');
|
9881 | }
|
9882 |
|
9883 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('arrowTypeStart', edge.arrowTypeStart);
|
9884 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('arrowTypeEnd', edge.arrowTypeEnd);
|
9885 |
|
9886 | switch (edge.arrowTypeStart) {
|
9887 | case 'arrow_cross':
|
9888 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-crossStart' + ')');
|
9889 | break;
|
9890 |
|
9891 | case 'arrow_point':
|
9892 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-pointStart' + ')');
|
9893 | break;
|
9894 |
|
9895 | case 'arrow_barb':
|
9896 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-barbStart' + ')');
|
9897 | break;
|
9898 |
|
9899 | case 'arrow_circle':
|
9900 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-circleStart' + ')');
|
9901 | break;
|
9902 |
|
9903 | case 'aggregation':
|
9904 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-aggregationStart' + ')');
|
9905 | break;
|
9906 |
|
9907 | case 'extension':
|
9908 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-extensionStart' + ')');
|
9909 | break;
|
9910 |
|
9911 | case 'composition':
|
9912 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-compositionStart' + ')');
|
9913 | break;
|
9914 |
|
9915 | case 'dependency':
|
9916 | svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-dependencyStart' + ')');
|
9917 | break;
|
9918 |
|
9919 | default:
|
9920 | }
|
9921 |
|
9922 | switch (edge.arrowTypeEnd) {
|
9923 | case 'arrow_cross':
|
9924 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-crossEnd' + ')');
|
9925 | break;
|
9926 |
|
9927 | case 'arrow_point':
|
9928 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-pointEnd' + ')');
|
9929 | break;
|
9930 |
|
9931 | case 'arrow_barb':
|
9932 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-barbEnd' + ')');
|
9933 | break;
|
9934 |
|
9935 | case 'arrow_circle':
|
9936 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-circleEnd' + ')');
|
9937 | break;
|
9938 |
|
9939 | case 'aggregation':
|
9940 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-aggregationEnd' + ')');
|
9941 | break;
|
9942 |
|
9943 | case 'extension':
|
9944 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-extensionEnd' + ')');
|
9945 | break;
|
9946 |
|
9947 | case 'composition':
|
9948 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-compositionEnd' + ')');
|
9949 | break;
|
9950 |
|
9951 | case 'dependency':
|
9952 | svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-dependencyEnd' + ')');
|
9953 | break;
|
9954 |
|
9955 | default:
|
9956 | }
|
9957 |
|
9958 | var paths = {};
|
9959 |
|
9960 | if (pointsHasChanged) {
|
9961 | paths.updatedPath = points;
|
9962 | }
|
9963 |
|
9964 | paths.originalPath = edge.points;
|
9965 | return paths;
|
9966 | };
|
9967 |
|
9968 | /***/ }),
|
9969 |
|
9970 | /***/ "./src/dagre-wrapper/index.js":
|
9971 | /*!************************************!*\
|
9972 | !*** ./src/dagre-wrapper/index.js ***!
|
9973 | \************************************/
|
9974 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
9975 |
|
9976 | "use strict";
|
9977 | __webpack_require__.r(__webpack_exports__);
|
9978 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
9979 | /* harmony export */ "render": () => (/* binding */ render)
|
9980 | /* harmony export */ });
|
9981 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dagre */ "dagre");
|
9982 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_0__);
|
9983 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphlib */ "graphlib");
|
9984 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_1__);
|
9985 | /* harmony import */ var _markers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./markers */ "./src/dagre-wrapper/markers.js");
|
9986 | /* harmony import */ var _shapes_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shapes/util */ "./src/dagre-wrapper/shapes/util.js");
|
9987 | /* harmony import */ var _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./mermaid-graphlib */ "./src/dagre-wrapper/mermaid-graphlib.js");
|
9988 | /* harmony import */ var _nodes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./nodes */ "./src/dagre-wrapper/nodes.js");
|
9989 | /* harmony import */ var _clusters__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./clusters */ "./src/dagre-wrapper/clusters.js");
|
9990 | /* harmony import */ var _edges__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./edges */ "./src/dagre-wrapper/edges.js");
|
9991 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
|
9992 |
|
9993 |
|
9994 |
|
9995 |
|
9996 |
|
9997 |
|
9998 |
|
9999 |
|
10000 |
|
10001 |
|
10002 | var recursiveRender = function recursiveRender(_elem, graph, diagramtype, parentCluster) {
|
10003 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Graph in recursive render: XXX', graphlib__WEBPACK_IMPORTED_MODULE_1___default().json.write(graph), parentCluster);
|
10004 | var dir = graph.graph().rankdir;
|
10005 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Dir in recursive render - dir:', dir);
|
10006 |
|
10007 | var elem = _elem.insert('g').attr('class', 'root'); // eslint-disable-line
|
10008 |
|
10009 |
|
10010 | if (!graph.nodes()) {
|
10011 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('No nodes found for', graph);
|
10012 | } else {
|
10013 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Recursive render XXX', graph.nodes());
|
10014 | }
|
10015 |
|
10016 | if (graph.edges().length > 0) {
|
10017 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Recursive edges', graph.edge(graph.edges()[0]));
|
10018 | }
|
10019 |
|
10020 | var clusters = elem.insert('g').attr('class', 'clusters'); // eslint-disable-line
|
10021 |
|
10022 | var edgePaths = elem.insert('g').attr('class', 'edgePaths');
|
10023 | var edgeLabels = elem.insert('g').attr('class', 'edgeLabels');
|
10024 | 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
|
10025 | // to the abstract node and is later used by dagre for the layout
|
10026 |
|
10027 | graph.nodes().forEach(function (v) {
|
10028 | var node = graph.node(v);
|
10029 |
|
10030 | if (typeof parentCluster !== 'undefined') {
|
10031 | var data = JSON.parse(JSON.stringify(parentCluster.clusterData)); // data.clusterPositioning = true;
|
10032 |
|
10033 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Setting data for cluster XXX (', v, ') ', data, parentCluster);
|
10034 | graph.setNode(parentCluster.id, data);
|
10035 |
|
10036 | if (!graph.parent(v)) {
|
10037 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Setting parent', v, parentCluster.id);
|
10038 | graph.setParent(v, parentCluster.id, data);
|
10039 | }
|
10040 | }
|
10041 |
|
10042 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('(Insert) Node XXX' + v + ': ' + JSON.stringify(graph.node(v)));
|
10043 |
|
10044 | if (node && node.clusterNode) {
|
10045 | // const children = graph.children(v);
|
10046 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Cluster identified', v, node.width, graph.node(v));
|
10047 | var o = recursiveRender(nodes, node.graph, diagramtype, graph.node(v));
|
10048 | var newEl = o.elem;
|
10049 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, newEl);
|
10050 | node.diff = o.diff || 0;
|
10051 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Node bounds (abc123)', v, node, node.width, node.x, node.y);
|
10052 | (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.setNodeElem)(newEl, node);
|
10053 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.warn('Recursive render complete ', newEl, node);
|
10054 | } else {
|
10055 | if (graph.children(v).length > 0) {
|
10056 | // This is a cluster but not to be rendered recusively
|
10057 | // Render as before
|
10058 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Cluster - the non recursive path XXX', v, node.id, node, graph);
|
10059 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info((0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.findNonClusterChild)(node.id, graph));
|
10060 | _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb[node.id] = {
|
10061 | id: (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.findNonClusterChild)(node.id, graph),
|
10062 | node: node
|
10063 | }; // insertCluster(clusters, graph.node(v));
|
10064 | } else {
|
10065 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Node - the non recursive path', v, node.id, node);
|
10066 | (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.insertNode)(nodes, graph.node(v), dir);
|
10067 | }
|
10068 | }
|
10069 | }); // Insert labels, this will insert them into the dom so that the width can be calculated
|
10070 | // Also figure out which edges point to/from clusters and adjust them accordingly
|
10071 | // Edges from/to clusters really points to the first child in the cluster.
|
10072 | // TODO: pick optimal child in the cluster to us as link anchor
|
10073 |
|
10074 | graph.edges().forEach(function (e) {
|
10075 | var edge = graph.edge(e.v, e.w, e.name);
|
10076 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
|
10077 | _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
|
10078 |
|
10079 | _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]);
|
10080 | (0,_edges__WEBPACK_IMPORTED_MODULE_6__.insertEdgeLabel)(edgeLabels, edge);
|
10081 | });
|
10082 | graph.edges().forEach(function (e) {
|
10083 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
|
10084 | });
|
10085 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('#############################################');
|
10086 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('### Layout ###');
|
10087 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('#############################################');
|
10088 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info(graph);
|
10089 | dagre__WEBPACK_IMPORTED_MODULE_0___default().layout(graph);
|
10090 | _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
|
10091 |
|
10092 | var diff = 0;
|
10093 | (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.sortNodesByHierarchy)(graph).forEach(function (v) {
|
10094 | var node = graph.node(v);
|
10095 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Position ' + v + ': ' + JSON.stringify(graph.node(v)));
|
10096 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Position ' + v + ': (' + node.x, ',' + node.y, ') width: ', node.width, ' height: ', node.height);
|
10097 |
|
10098 | if (node && node.clusterNode) {
|
10099 | // clusterDb[node.id].node = node;
|
10100 | (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.positionNode)(node);
|
10101 | } else {
|
10102 | // Non cluster node
|
10103 | if (graph.children(v).length > 0) {
|
10104 | // A cluster in the non-recurive way
|
10105 | // positionCluster(node);
|
10106 | (0,_clusters__WEBPACK_IMPORTED_MODULE_7__.insertCluster)(clusters, node);
|
10107 | _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb[node.id].node = node;
|
10108 | } else {
|
10109 | (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.positionNode)(node);
|
10110 | }
|
10111 | }
|
10112 | }); // Move the edge labels to the correct place after layout
|
10113 |
|
10114 | graph.edges().forEach(function (e) {
|
10115 | var edge = graph.edge(e);
|
10116 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(edge), edge);
|
10117 | var paths = (0,_edges__WEBPACK_IMPORTED_MODULE_6__.insertEdge)(edgePaths, e, edge, _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb, diagramtype, graph);
|
10118 | (0,_edges__WEBPACK_IMPORTED_MODULE_6__.positionEdgeLabel)(edge, paths);
|
10119 | });
|
10120 | graph.nodes().forEach(function (v) {
|
10121 | var n = graph.node(v);
|
10122 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info(v, n.type, n.diff);
|
10123 |
|
10124 | if (n.type === 'group') {
|
10125 | diff = n.diff;
|
10126 | }
|
10127 | });
|
10128 | return {
|
10129 | elem: elem,
|
10130 | diff: diff
|
10131 | };
|
10132 | };
|
10133 |
|
10134 | var render = function render(elem, graph, markers, diagramtype, id) {
|
10135 | (0,_markers__WEBPACK_IMPORTED_MODULE_8__["default"])(elem, markers, diagramtype, id);
|
10136 | (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.clear)();
|
10137 | (0,_edges__WEBPACK_IMPORTED_MODULE_6__.clear)();
|
10138 | (0,_clusters__WEBPACK_IMPORTED_MODULE_7__.clear)();
|
10139 | (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clear)();
|
10140 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.warn('Graph at first:', graphlib__WEBPACK_IMPORTED_MODULE_1___default().json.write(graph));
|
10141 | (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.adjustClustersAndEdges)(graph);
|
10142 | _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));
|
10143 |
|
10144 | recursiveRender(elem, graph, diagramtype);
|
10145 | }; // const shapeDefinitions = {};
|
10146 | // export const addShape = ({ shapeType: fun }) => {
|
10147 | // shapeDefinitions[shapeType] = fun;
|
10148 | // };
|
10149 | // const arrowDefinitions = {};
|
10150 | // export const addArrow = ({ arrowType: fun }) => {
|
10151 | // arrowDefinitions[arrowType] = fun;
|
10152 | // };
|
10153 |
|
10154 | /***/ }),
|
10155 |
|
10156 | /***/ "./src/dagre-wrapper/intersect/index.js":
|
10157 | /*!**********************************************!*\
|
10158 | !*** ./src/dagre-wrapper/intersect/index.js ***!
|
10159 | \**********************************************/
|
10160 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10161 |
|
10162 | "use strict";
|
10163 | __webpack_require__.r(__webpack_exports__);
|
10164 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10165 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
10166 | /* harmony export */ });
|
10167 | /* harmony import */ var _intersect_node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-node.js */ "./src/dagre-wrapper/intersect/intersect-node.js");
|
10168 | /* harmony import */ var _intersect_node_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_intersect_node_js__WEBPACK_IMPORTED_MODULE_0__);
|
10169 | /* harmony import */ var _intersect_circle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./intersect-circle.js */ "./src/dagre-wrapper/intersect/intersect-circle.js");
|
10170 | /* harmony import */ var _intersect_ellipse_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./intersect-ellipse.js */ "./src/dagre-wrapper/intersect/intersect-ellipse.js");
|
10171 | /* harmony import */ var _intersect_polygon_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./intersect-polygon.js */ "./src/dagre-wrapper/intersect/intersect-polygon.js");
|
10172 | /* harmony import */ var _intersect_rect_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./intersect-rect.js */ "./src/dagre-wrapper/intersect/intersect-rect.js");
|
10173 | /*
|
10174 | * Borrowed with love from from dagrge-d3. Many thanks to cpettitt!
|
10175 | */
|
10176 |
|
10177 |
|
10178 |
|
10179 |
|
10180 |
|
10181 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
10182 | node: (_intersect_node_js__WEBPACK_IMPORTED_MODULE_0___default()),
|
10183 | circle: _intersect_circle_js__WEBPACK_IMPORTED_MODULE_1__["default"],
|
10184 | ellipse: _intersect_ellipse_js__WEBPACK_IMPORTED_MODULE_2__["default"],
|
10185 | polygon: _intersect_polygon_js__WEBPACK_IMPORTED_MODULE_3__["default"],
|
10186 | rect: _intersect_rect_js__WEBPACK_IMPORTED_MODULE_4__["default"]
|
10187 | });
|
10188 |
|
10189 | /***/ }),
|
10190 |
|
10191 | /***/ "./src/dagre-wrapper/intersect/intersect-circle.js":
|
10192 | /*!*********************************************************!*\
|
10193 | !*** ./src/dagre-wrapper/intersect/intersect-circle.js ***!
|
10194 | \*********************************************************/
|
10195 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10196 |
|
10197 | "use strict";
|
10198 | __webpack_require__.r(__webpack_exports__);
|
10199 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10200 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
10201 | /* harmony export */ });
|
10202 | /* harmony import */ var _intersect_ellipse__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-ellipse */ "./src/dagre-wrapper/intersect/intersect-ellipse.js");
|
10203 |
|
10204 |
|
10205 | function intersectCircle(node, rx, point) {
|
10206 | return (0,_intersect_ellipse__WEBPACK_IMPORTED_MODULE_0__["default"])(node, rx, rx, point);
|
10207 | }
|
10208 |
|
10209 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectCircle);
|
10210 |
|
10211 | /***/ }),
|
10212 |
|
10213 | /***/ "./src/dagre-wrapper/intersect/intersect-ellipse.js":
|
10214 | /*!**********************************************************!*\
|
10215 | !*** ./src/dagre-wrapper/intersect/intersect-ellipse.js ***!
|
10216 | \**********************************************************/
|
10217 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10218 |
|
10219 | "use strict";
|
10220 | __webpack_require__.r(__webpack_exports__);
|
10221 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10222 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
10223 | /* harmony export */ });
|
10224 | function intersectEllipse(node, rx, ry, point) {
|
10225 | // Formulae from: http://mathworld.wolfram.com/Ellipse-LineIntersection.html
|
10226 | var cx = node.x;
|
10227 | var cy = node.y;
|
10228 | var px = cx - point.x;
|
10229 | var py = cy - point.y;
|
10230 | var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
|
10231 | var dx = Math.abs(rx * ry * px / det);
|
10232 |
|
10233 | if (point.x < cx) {
|
10234 | dx = -dx;
|
10235 | }
|
10236 |
|
10237 | var dy = Math.abs(rx * ry * py / det);
|
10238 |
|
10239 | if (point.y < cy) {
|
10240 | dy = -dy;
|
10241 | }
|
10242 |
|
10243 | return {
|
10244 | x: cx + dx,
|
10245 | y: cy + dy
|
10246 | };
|
10247 | }
|
10248 |
|
10249 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectEllipse);
|
10250 |
|
10251 | /***/ }),
|
10252 |
|
10253 | /***/ "./src/dagre-wrapper/intersect/intersect-line.js":
|
10254 | /*!*******************************************************!*\
|
10255 | !*** ./src/dagre-wrapper/intersect/intersect-line.js ***!
|
10256 | \*******************************************************/
|
10257 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10258 |
|
10259 | "use strict";
|
10260 | __webpack_require__.r(__webpack_exports__);
|
10261 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10262 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
10263 | /* harmony export */ });
|
10264 | /*
|
10265 | * Returns the point at which two lines, p and q, intersect or returns
|
10266 | * undefined if they do not intersect.
|
10267 | */
|
10268 | function intersectLine(p1, p2, q1, q2) {
|
10269 | // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,
|
10270 | // p7 and p473.
|
10271 | var a1, a2, b1, b2, c1, c2;
|
10272 | var r1, r2, r3, r4;
|
10273 | var denom, offset, num;
|
10274 | var x, y; // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +
|
10275 | // b1 y + c1 = 0.
|
10276 |
|
10277 | a1 = p2.y - p1.y;
|
10278 | b1 = p1.x - p2.x;
|
10279 | c1 = p2.x * p1.y - p1.x * p2.y; // Compute r3 and r4.
|
10280 |
|
10281 | r3 = a1 * q1.x + b1 * q1.y + c1;
|
10282 | r4 = a1 * q2.x + b1 * q2.y + c1; // Check signs of r3 and r4. If both point 3 and point 4 lie on
|
10283 | // same side of line 1, the line segments do not intersect.
|
10284 |
|
10285 | if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
|
10286 | return;
|
10287 | } // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0
|
10288 |
|
10289 |
|
10290 | a2 = q2.y - q1.y;
|
10291 | b2 = q1.x - q2.x;
|
10292 | c2 = q2.x * q1.y - q1.x * q2.y; // Compute r1 and r2
|
10293 |
|
10294 | r1 = a2 * p1.x + b2 * p1.y + c2;
|
10295 | r2 = a2 * p2.x + b2 * p2.y + c2; // Check signs of r1 and r2. If both point 1 and point 2 lie
|
10296 | // on same side of second line segment, the line segments do
|
10297 | // not intersect.
|
10298 |
|
10299 | if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {
|
10300 | return;
|
10301 | } // Line segments intersect: compute intersection point.
|
10302 |
|
10303 |
|
10304 | denom = a1 * b2 - a2 * b1;
|
10305 |
|
10306 | if (denom === 0) {
|
10307 | return;
|
10308 | }
|
10309 |
|
10310 | offset = Math.abs(denom / 2); // The denom/2 is to get rounding instead of truncating. It
|
10311 | // is added or subtracted to the numerator, depending upon the
|
10312 | // sign of the numerator.
|
10313 |
|
10314 | num = b1 * c2 - b2 * c1;
|
10315 | x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
|
10316 | num = a2 * c1 - a1 * c2;
|
10317 | y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
|
10318 | return {
|
10319 | x: x,
|
10320 | y: y
|
10321 | };
|
10322 | }
|
10323 |
|
10324 | function sameSign(r1, r2) {
|
10325 | return r1 * r2 > 0;
|
10326 | }
|
10327 |
|
10328 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectLine);
|
10329 |
|
10330 | /***/ }),
|
10331 |
|
10332 | /***/ "./src/dagre-wrapper/intersect/intersect-node.js":
|
10333 | /*!*******************************************************!*\
|
10334 | !*** ./src/dagre-wrapper/intersect/intersect-node.js ***!
|
10335 | \*******************************************************/
|
10336 | /***/ ((module) => {
|
10337 |
|
10338 | module.exports = intersectNode;
|
10339 |
|
10340 | function intersectNode(node, point) {
|
10341 | // console.info('Intersect Node');
|
10342 | return node.intersect(point);
|
10343 | }
|
10344 |
|
10345 | /***/ }),
|
10346 |
|
10347 | /***/ "./src/dagre-wrapper/intersect/intersect-polygon.js":
|
10348 | /*!**********************************************************!*\
|
10349 | !*** ./src/dagre-wrapper/intersect/intersect-polygon.js ***!
|
10350 | \**********************************************************/
|
10351 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10352 |
|
10353 | "use strict";
|
10354 | __webpack_require__.r(__webpack_exports__);
|
10355 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10356 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
10357 | /* harmony export */ });
|
10358 | /* harmony import */ var _intersect_line__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-line */ "./src/dagre-wrapper/intersect/intersect-line.js");
|
10359 | /* eslint "no-console": off */
|
10360 |
|
10361 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectPolygon);
|
10362 | /*
|
10363 | * Returns the point ({x, y}) at which the point argument intersects with the
|
10364 | * node argument assuming that it has the shape specified by polygon.
|
10365 | */
|
10366 |
|
10367 | function intersectPolygon(node, polyPoints, point) {
|
10368 | var x1 = node.x;
|
10369 | var y1 = node.y;
|
10370 | var intersections = [];
|
10371 | var minX = Number.POSITIVE_INFINITY;
|
10372 | var minY = Number.POSITIVE_INFINITY;
|
10373 |
|
10374 | if (typeof polyPoints.forEach === 'function') {
|
10375 | polyPoints.forEach(function (entry) {
|
10376 | minX = Math.min(minX, entry.x);
|
10377 | minY = Math.min(minY, entry.y);
|
10378 | });
|
10379 | } else {
|
10380 | minX = Math.min(minX, polyPoints.x);
|
10381 | minY = Math.min(minY, polyPoints.y);
|
10382 | }
|
10383 |
|
10384 | var left = x1 - node.width / 2 - minX;
|
10385 | var top = y1 - node.height / 2 - minY;
|
10386 |
|
10387 | for (var i = 0; i < polyPoints.length; i++) {
|
10388 | var p1 = polyPoints[i];
|
10389 | var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
|
10390 | var intersect = (0,_intersect_line__WEBPACK_IMPORTED_MODULE_0__["default"])(node, point, {
|
10391 | x: left + p1.x,
|
10392 | y: top + p1.y
|
10393 | }, {
|
10394 | x: left + p2.x,
|
10395 | y: top + p2.y
|
10396 | });
|
10397 |
|
10398 | if (intersect) {
|
10399 | intersections.push(intersect);
|
10400 | }
|
10401 | }
|
10402 |
|
10403 | if (!intersections.length) {
|
10404 | // console.log('NO INTERSECTION FOUND, RETURN NODE CENTER', node);
|
10405 | return node;
|
10406 | }
|
10407 |
|
10408 | if (intersections.length > 1) {
|
10409 | // More intersections, find the one nearest to edge end point
|
10410 | intersections.sort(function (p, q) {
|
10411 | var pdx = p.x - point.x;
|
10412 | var pdy = p.y - point.y;
|
10413 | var distp = Math.sqrt(pdx * pdx + pdy * pdy);
|
10414 | var qdx = q.x - point.x;
|
10415 | var qdy = q.y - point.y;
|
10416 | var distq = Math.sqrt(qdx * qdx + qdy * qdy);
|
10417 | return distp < distq ? -1 : distp === distq ? 0 : 1;
|
10418 | });
|
10419 | }
|
10420 |
|
10421 | return intersections[0];
|
10422 | }
|
10423 |
|
10424 | /***/ }),
|
10425 |
|
10426 | /***/ "./src/dagre-wrapper/intersect/intersect-rect.js":
|
10427 | /*!*******************************************************!*\
|
10428 | !*** ./src/dagre-wrapper/intersect/intersect-rect.js ***!
|
10429 | \*******************************************************/
|
10430 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10431 |
|
10432 | "use strict";
|
10433 | __webpack_require__.r(__webpack_exports__);
|
10434 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10435 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
10436 | /* harmony export */ });
|
10437 | var intersectRect = function intersectRect(node, point) {
|
10438 | var x = node.x;
|
10439 | var y = node.y; // Rectangle intersection algorithm from:
|
10440 | // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes
|
10441 |
|
10442 | var dx = point.x - x;
|
10443 | var dy = point.y - y;
|
10444 | var w = node.width / 2;
|
10445 | var h = node.height / 2;
|
10446 | var sx, sy;
|
10447 |
|
10448 | if (Math.abs(dy) * w > Math.abs(dx) * h) {
|
10449 | // Intersection is top or bottom of rect.
|
10450 | if (dy < 0) {
|
10451 | h = -h;
|
10452 | }
|
10453 |
|
10454 | sx = dy === 0 ? 0 : h * dx / dy;
|
10455 | sy = h;
|
10456 | } else {
|
10457 | // Intersection is left or right of rect.
|
10458 | if (dx < 0) {
|
10459 | w = -w;
|
10460 | }
|
10461 |
|
10462 | sx = w;
|
10463 | sy = dx === 0 ? 0 : w * dy / dx;
|
10464 | }
|
10465 |
|
10466 | return {
|
10467 | x: x + sx,
|
10468 | y: y + sy
|
10469 | };
|
10470 | };
|
10471 |
|
10472 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectRect);
|
10473 |
|
10474 | /***/ }),
|
10475 |
|
10476 | /***/ "./src/dagre-wrapper/markers.js":
|
10477 | /*!**************************************!*\
|
10478 | !*** ./src/dagre-wrapper/markers.js ***!
|
10479 | \**************************************/
|
10480 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10481 |
|
10482 | "use strict";
|
10483 | __webpack_require__.r(__webpack_exports__);
|
10484 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10485 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
10486 | /* harmony export */ });
|
10487 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
|
10488 | /**
|
10489 | * Setup arrow head and define the marker. The result is appended to the svg.
|
10490 | */
|
10491 | // Only add the number of markers that the diagram needs
|
10492 |
|
10493 | var insertMarkers = function insertMarkers(elem, markerArray, type, id) {
|
10494 | markerArray.forEach(function (markerName) {
|
10495 | markers[markerName](elem, type, id);
|
10496 | });
|
10497 | };
|
10498 |
|
10499 | var extension = function extension(elem, type, id) {
|
10500 | _logger__WEBPACK_IMPORTED_MODULE_0__.log.trace('Making markers for ', id);
|
10501 | 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');
|
10502 | 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
|
10503 | };
|
10504 |
|
10505 | var composition = function composition(elem, type) {
|
10506 | 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');
|
10507 | 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');
|
10508 | };
|
10509 |
|
10510 | var aggregation = function aggregation(elem, type) {
|
10511 | 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');
|
10512 | 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');
|
10513 | };
|
10514 |
|
10515 | var dependency = function dependency(elem, type) {
|
10516 | 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');
|
10517 | 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');
|
10518 | };
|
10519 |
|
10520 | var point = function point(elem, type) {
|
10521 | 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');
|
10522 | 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');
|
10523 | };
|
10524 |
|
10525 | var circle = function circle(elem, type) {
|
10526 | 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');
|
10527 | 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');
|
10528 | };
|
10529 |
|
10530 | var cross = function cross(elem, type) {
|
10531 | 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')
|
10532 | .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');
|
10533 | 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')
|
10534 | .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');
|
10535 | };
|
10536 |
|
10537 | var barb = function barb(elem, type) {
|
10538 | 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');
|
10539 | }; // TODO rename the class diagram markers to something shape descriptive and semanitc free
|
10540 |
|
10541 |
|
10542 | var markers = {
|
10543 | extension: extension,
|
10544 | composition: composition,
|
10545 | aggregation: aggregation,
|
10546 | dependency: dependency,
|
10547 | point: point,
|
10548 | circle: circle,
|
10549 | cross: cross,
|
10550 | barb: barb
|
10551 | };
|
10552 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (insertMarkers);
|
10553 |
|
10554 | /***/ }),
|
10555 |
|
10556 | /***/ "./src/dagre-wrapper/mermaid-graphlib.js":
|
10557 | /*!***********************************************!*\
|
10558 | !*** ./src/dagre-wrapper/mermaid-graphlib.js ***!
|
10559 | \***********************************************/
|
10560 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10561 |
|
10562 | "use strict";
|
10563 | __webpack_require__.r(__webpack_exports__);
|
10564 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10565 | /* harmony export */ "clusterDb": () => (/* binding */ clusterDb),
|
10566 | /* harmony export */ "clear": () => (/* binding */ clear),
|
10567 | /* harmony export */ "extractDecendants": () => (/* binding */ extractDecendants),
|
10568 | /* harmony export */ "validate": () => (/* binding */ validate),
|
10569 | /* harmony export */ "findNonClusterChild": () => (/* binding */ findNonClusterChild),
|
10570 | /* harmony export */ "adjustClustersAndEdges": () => (/* binding */ adjustClustersAndEdges),
|
10571 | /* harmony export */ "extractor": () => (/* binding */ extractor),
|
10572 | /* harmony export */ "sortNodesByHierarchy": () => (/* binding */ sortNodesByHierarchy)
|
10573 | /* harmony export */ });
|
10574 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
|
10575 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
|
10576 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
|
10577 | /**
|
10578 | * Decorates with functions required by mermaids dagre-wrapper.
|
10579 | */
|
10580 |
|
10581 |
|
10582 | var clusterDb = {};
|
10583 | var decendants = {};
|
10584 | var parents = {};
|
10585 | var clear = function clear() {
|
10586 | decendants = {};
|
10587 | parents = {};
|
10588 | clusterDb = {};
|
10589 | };
|
10590 |
|
10591 | var isDecendant = function isDecendant(id, ancenstorId) {
|
10592 | // if (id === ancenstorId) return true;
|
10593 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('In isDecendant', ancenstorId, ' ', id, ' = ', decendants[ancenstorId].indexOf(id) >= 0);
|
10594 | if (decendants[ancenstorId].indexOf(id) >= 0) return true;
|
10595 | return false;
|
10596 | };
|
10597 |
|
10598 | var edgeInCluster = function edgeInCluster(edge, clusterId) {
|
10599 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Decendants of ', clusterId, ' is ', decendants[clusterId]);
|
10600 | _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
|
10601 |
|
10602 | if (edge.v === clusterId) return false;
|
10603 | if (edge.w === clusterId) return false;
|
10604 |
|
10605 | if (!decendants[clusterId]) {
|
10606 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Tilt, ', clusterId, ',not in decendants');
|
10607 | return false;
|
10608 | }
|
10609 |
|
10610 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Here ');
|
10611 | if (decendants[clusterId].indexOf(edge.v) >= 0) return true;
|
10612 | if (isDecendant(edge.v, clusterId)) return true;
|
10613 | if (isDecendant(edge.w, clusterId)) return true;
|
10614 | if (decendants[clusterId].indexOf(edge.w) >= 0) return true;
|
10615 | return false;
|
10616 | };
|
10617 |
|
10618 | var copy = function copy(clusterId, graph, newGraph, rootId) {
|
10619 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Copying children of ', clusterId, 'root', rootId, 'data', graph.node(clusterId), rootId);
|
10620 | var nodes = graph.children(clusterId) || []; // Include cluster node if it is not the root
|
10621 |
|
10622 | if (clusterId !== rootId) {
|
10623 | nodes.push(clusterId);
|
10624 | }
|
10625 |
|
10626 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Copying (nodes) clusterId', clusterId, 'nodes', nodes);
|
10627 | nodes.forEach(function (node) {
|
10628 | if (graph.children(node).length > 0) {
|
10629 | copy(node, graph, newGraph, rootId);
|
10630 | } else {
|
10631 | var data = graph.node(node);
|
10632 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('cp ', node, ' to ', rootId, ' with parent ', clusterId); //,node, data, ' parent is ', clusterId);
|
10633 |
|
10634 | newGraph.setNode(node, data);
|
10635 |
|
10636 | if (rootId !== graph.parent(node)) {
|
10637 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Setting parent', node, graph.parent(node));
|
10638 | newGraph.setParent(node, graph.parent(node));
|
10639 | }
|
10640 |
|
10641 | if (clusterId !== rootId && node !== clusterId) {
|
10642 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Setting parent', node, clusterId);
|
10643 | newGraph.setParent(node, clusterId);
|
10644 | } else {
|
10645 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('In copy ', clusterId, 'root', rootId, 'data', graph.node(clusterId), rootId);
|
10646 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Not Setting parent for node=', node, 'cluster!==rootId', clusterId !== rootId, 'node!==clusterId', node !== clusterId);
|
10647 | }
|
10648 |
|
10649 | var edges = graph.edges(node);
|
10650 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Copying Edges', edges);
|
10651 | edges.forEach(function (edge) {
|
10652 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Edge', edge);
|
10653 | var data = graph.edge(edge.v, edge.w, edge.name);
|
10654 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Edge data', data, rootId);
|
10655 |
|
10656 | try {
|
10657 | // Do not copy edges in and out of the root cluster, they belong to the parent graph
|
10658 | if (edgeInCluster(edge, rootId)) {
|
10659 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Copying as ', edge.v, edge.w, data, edge.name);
|
10660 | newGraph.setEdge(edge.v, edge.w, data, edge.name);
|
10661 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('newGraph edges ', newGraph.edges(), newGraph.edge(newGraph.edges()[0]));
|
10662 | } else {
|
10663 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Skipping copy of edge ', edge.v, '-->', edge.w, ' rootId: ', rootId, ' clusterId:', clusterId);
|
10664 | }
|
10665 | } catch (e) {
|
10666 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error(e);
|
10667 | }
|
10668 | });
|
10669 | }
|
10670 |
|
10671 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Removing node', node);
|
10672 | graph.removeNode(node);
|
10673 | });
|
10674 | };
|
10675 |
|
10676 | var extractDecendants = function extractDecendants(id, graph) {
|
10677 | // log.debug('Extracting ', id);
|
10678 | var children = graph.children(id);
|
10679 | var res = [].concat(children);
|
10680 |
|
10681 | for (var i = 0; i < children.length; i++) {
|
10682 | parents[children[i]] = id;
|
10683 | res = res.concat(extractDecendants(children[i], graph));
|
10684 | }
|
10685 |
|
10686 | return res;
|
10687 | };
|
10688 | /**
|
10689 | * Validates the graph, checking that all parent child relation points to existing nodes and that
|
10690 | * edges between nodes also ia correct. When not correct the function logs the discrepancies.
|
10691 | * @param {graphlib graph} g
|
10692 | */
|
10693 |
|
10694 | var validate = function validate(graph) {
|
10695 | var edges = graph.edges();
|
10696 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Edges: ', edges);
|
10697 |
|
10698 | for (var i = 0; i < edges.length; i++) {
|
10699 | if (graph.children(edges[i].v).length > 0) {
|
10700 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('The node ', edges[i].v, ' is part of and edge even though it has children');
|
10701 | return false;
|
10702 | }
|
10703 |
|
10704 | if (graph.children(edges[i].w).length > 0) {
|
10705 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('The node ', edges[i].w, ' is part of and edge even though it has children');
|
10706 | return false;
|
10707 | }
|
10708 | }
|
10709 |
|
10710 | return true;
|
10711 | };
|
10712 | /**
|
10713 | * Finds a child that is not a cluster. When faking a edge between a node and a cluster.
|
10714 | * @param {Finds a } id
|
10715 | * @param {*} graph
|
10716 | */
|
10717 |
|
10718 | var findNonClusterChild = function findNonClusterChild(id, graph) {
|
10719 | // const node = graph.node(id);
|
10720 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Searching', id); // const children = graph.children(id).reverse();
|
10721 |
|
10722 | var children = graph.children(id); //.reverse();
|
10723 |
|
10724 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Searching children of id ', id, children);
|
10725 |
|
10726 | if (children.length < 1) {
|
10727 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('This is a valid node', id);
|
10728 | return id;
|
10729 | }
|
10730 |
|
10731 | for (var i = 0; i < children.length; i++) {
|
10732 | var _id = findNonClusterChild(children[i], graph);
|
10733 |
|
10734 | if (_id) {
|
10735 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Found replacement for', id, ' => ', _id);
|
10736 | return _id;
|
10737 | }
|
10738 | }
|
10739 | };
|
10740 |
|
10741 | var getAnchorId = function getAnchorId(id) {
|
10742 | if (!clusterDb[id]) {
|
10743 | return id;
|
10744 | } // If the cluster has no external connections
|
10745 |
|
10746 |
|
10747 | if (!clusterDb[id].externalConnections) {
|
10748 | return id;
|
10749 | } // Return the replacement node
|
10750 |
|
10751 |
|
10752 | if (clusterDb[id]) {
|
10753 | return clusterDb[id].id;
|
10754 | }
|
10755 |
|
10756 | return id;
|
10757 | };
|
10758 |
|
10759 | var adjustClustersAndEdges = function adjustClustersAndEdges(graph, depth) {
|
10760 | if (!graph || depth > 10) {
|
10761 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Opting out, no graph ');
|
10762 | return;
|
10763 | } else {
|
10764 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Opting in, graph ');
|
10765 | } // Go through the nodes and for each cluster found, save a replacment node, this can be used when
|
10766 | // faking a link to a cluster
|
10767 |
|
10768 |
|
10769 | graph.nodes().forEach(function (id) {
|
10770 | var children = graph.children(id);
|
10771 |
|
10772 | if (children.length > 0) {
|
10773 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Cluster identified', id, ' Replacement id in edges: ', findNonClusterChild(id, graph));
|
10774 | decendants[id] = extractDecendants(id, graph);
|
10775 | clusterDb[id] = {
|
10776 | id: findNonClusterChild(id, graph),
|
10777 | clusterData: graph.node(id)
|
10778 | };
|
10779 | }
|
10780 | }); // Check incoming and outgoing edges for each cluster
|
10781 |
|
10782 | graph.nodes().forEach(function (id) {
|
10783 | var children = graph.children(id);
|
10784 | var edges = graph.edges();
|
10785 |
|
10786 | if (children.length > 0) {
|
10787 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Cluster identified', id, decendants);
|
10788 | edges.forEach(function (edge) {
|
10789 | // log.debug('Edge, decendants: ', edge, decendants[id]);
|
10790 | // Check if any edge leaves the cluster (not the actual cluster, thats a link from the box)
|
10791 | if (edge.v !== id && edge.w !== id) {
|
10792 | // Any edge where either the one of the nodes is decending to the cluster but not the other
|
10793 | // if (decendants[id].indexOf(edge.v) < 0 && decendants[id].indexOf(edge.w) < 0) {
|
10794 | var d1 = isDecendant(edge.v, id);
|
10795 | var d2 = isDecendant(edge.w, id); // d1 xor d2 - if either d1 is true and d2 is false or the other way around
|
10796 |
|
10797 | if (d1 ^ d2) {
|
10798 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Edge: ', edge, ' leaves cluster ', id);
|
10799 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Decendants of XXX ', id, ': ', decendants[id]);
|
10800 | clusterDb[id].externalConnections = true;
|
10801 | }
|
10802 | }
|
10803 | });
|
10804 | } else {
|
10805 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Not a cluster ', id, decendants);
|
10806 | }
|
10807 | }); // For clusters with incoming and/or outgoing edges translate those edges to a real node
|
10808 | // in the cluster inorder to fake the edge
|
10809 |
|
10810 | graph.edges().forEach(function (e) {
|
10811 | var edge = graph.edge(e);
|
10812 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
|
10813 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));
|
10814 | var v = e.v;
|
10815 | var w = e.w; // Check if link is either from or to a cluster
|
10816 |
|
10817 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fix XXX', clusterDb, 'ids:', e.v, e.w, 'Translateing: ', clusterDb[e.v], ' --- ', clusterDb[e.w]);
|
10818 |
|
10819 | if (clusterDb[e.v] || clusterDb[e.w]) {
|
10820 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fixing and trixing - removing XXX', e.v, e.w, e.name);
|
10821 | v = getAnchorId(e.v);
|
10822 | w = getAnchorId(e.w);
|
10823 | graph.removeEdge(e.v, e.w, e.name);
|
10824 | if (v !== e.v) edge.fromCluster = e.v;
|
10825 | if (w !== e.w) edge.toCluster = e.w;
|
10826 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fix Replacing with XXX', v, w, e.name);
|
10827 | graph.setEdge(v, w, edge, e.name);
|
10828 | }
|
10829 | });
|
10830 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Adjusted Graph', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph));
|
10831 | extractor(graph, 0);
|
10832 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace(clusterDb); // Remove references to extracted cluster
|
10833 | // graph.edges().forEach(edge => {
|
10834 | // if (isDecendant(edge.v, clusterId) || isDecendant(edge.w, clusterId)) {
|
10835 | // graph.removeEdge(edge);
|
10836 | // }
|
10837 | // });
|
10838 | };
|
10839 | var extractor = function extractor(graph, depth) {
|
10840 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('extractor - ', depth, graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph), graph.children('D'));
|
10841 |
|
10842 | if (depth > 10) {
|
10843 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('Bailing out');
|
10844 | return;
|
10845 | } // For clusters without incoming and/or outgoing edges, create a new cluster-node
|
10846 | // containing the nodes and edges in the custer in a new graph
|
10847 | // for (let i = 0;)
|
10848 |
|
10849 |
|
10850 | var nodes = graph.nodes();
|
10851 | var hasChildren = false;
|
10852 |
|
10853 | for (var i = 0; i < nodes.length; i++) {
|
10854 | var node = nodes[i];
|
10855 | var children = graph.children(node);
|
10856 | hasChildren = hasChildren || children.length > 0;
|
10857 | }
|
10858 |
|
10859 | if (!hasChildren) {
|
10860 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Done, no node has children', graph.nodes());
|
10861 | return;
|
10862 | } // const clusters = Object.keys(clusterDb);
|
10863 | // clusters.forEach(clusterId => {
|
10864 |
|
10865 |
|
10866 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Nodes = ', nodes, depth);
|
10867 |
|
10868 | for (var _i = 0; _i < nodes.length; _i++) {
|
10869 | var _node = nodes[_i];
|
10870 | _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
|
10871 | // that it still is in the game
|
10872 |
|
10873 | if (!clusterDb[_node]) {
|
10874 | // Skip if the node is not a cluster
|
10875 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Not a cluster', _node, depth); // break;
|
10876 | } else if (!clusterDb[_node].externalConnections && // !graph.parent(node) &&
|
10877 | graph.children(_node) && graph.children(_node).length > 0) {
|
10878 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Cluster without external connections, without a parent and with children', _node, depth);
|
10879 | var graphSettings = graph.graph();
|
10880 | var dir = graphSettings.rankdir === 'TB' ? 'LR' : 'TB';
|
10881 |
|
10882 | if (clusterDb[_node]) {
|
10883 | if (clusterDb[_node].clusterData && clusterDb[_node].clusterData.dir) {
|
10884 | dir = clusterDb[_node].clusterData.dir;
|
10885 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fixing dir', clusterDb[_node].clusterData.dir, dir);
|
10886 | }
|
10887 | }
|
10888 |
|
10889 | var clusterGraph = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
|
10890 | multigraph: true,
|
10891 | compound: true
|
10892 | }).setGraph({
|
10893 | rankdir: dir,
|
10894 | // Todo: set proper spacing
|
10895 | nodesep: 50,
|
10896 | ranksep: 50,
|
10897 | marginx: 8,
|
10898 | marginy: 8
|
10899 | }).setDefaultEdgeLabel(function () {
|
10900 | return {};
|
10901 | });
|
10902 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Old graph before copy', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph));
|
10903 | copy(_node, graph, clusterGraph, _node);
|
10904 | graph.setNode(_node, {
|
10905 | clusterNode: true,
|
10906 | id: _node,
|
10907 | clusterData: clusterDb[_node].clusterData,
|
10908 | labelText: clusterDb[_node].labelText,
|
10909 | graph: clusterGraph
|
10910 | });
|
10911 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('New graph after copy node: (', _node, ')', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(clusterGraph));
|
10912 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Old graph after copy', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph));
|
10913 | } else {
|
10914 | _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);
|
10915 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(clusterDb);
|
10916 | }
|
10917 | }
|
10918 |
|
10919 | nodes = graph.nodes();
|
10920 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('New list of nodes', nodes);
|
10921 |
|
10922 | for (var _i2 = 0; _i2 < nodes.length; _i2++) {
|
10923 | var _node2 = nodes[_i2];
|
10924 | var data = graph.node(_node2);
|
10925 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn(' Now next level', _node2, data);
|
10926 |
|
10927 | if (data.clusterNode) {
|
10928 | extractor(data.graph, depth + 1);
|
10929 | }
|
10930 | }
|
10931 | };
|
10932 |
|
10933 | var sorter = function sorter(graph, nodes) {
|
10934 | if (nodes.length === 0) return [];
|
10935 | var result = Object.assign(nodes);
|
10936 | nodes.forEach(function (node) {
|
10937 | var children = graph.children(node);
|
10938 | var sorted = sorter(graph, children);
|
10939 | result = result.concat(sorted);
|
10940 | });
|
10941 | return result;
|
10942 | };
|
10943 |
|
10944 | var sortNodesByHierarchy = function sortNodesByHierarchy(graph) {
|
10945 | return sorter(graph, graph.children());
|
10946 | };
|
10947 |
|
10948 | /***/ }),
|
10949 |
|
10950 | /***/ "./src/dagre-wrapper/nodes.js":
|
10951 | /*!************************************!*\
|
10952 | !*** ./src/dagre-wrapper/nodes.js ***!
|
10953 | \************************************/
|
10954 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
10955 |
|
10956 | "use strict";
|
10957 | __webpack_require__.r(__webpack_exports__);
|
10958 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10959 | /* harmony export */ "insertNode": () => (/* binding */ insertNode),
|
10960 | /* harmony export */ "setNodeElem": () => (/* binding */ setNodeElem),
|
10961 | /* harmony export */ "clear": () => (/* binding */ clear),
|
10962 | /* harmony export */ "positionNode": () => (/* binding */ positionNode)
|
10963 | /* harmony export */ });
|
10964 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
10965 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
10966 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
|
10967 | /* harmony import */ var _shapes_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shapes/util */ "./src/dagre-wrapper/shapes/util.js");
|
10968 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../config */ "./src/config.js");
|
10969 | /* harmony import */ var _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./intersect/index.js */ "./src/dagre-wrapper/intersect/index.js");
|
10970 | /* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
|
10971 | /* harmony import */ var _shapes_note__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./shapes/note */ "./src/dagre-wrapper/shapes/note.js");
|
10972 | /* harmony import */ var _diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../diagrams/class/svgDraw */ "./src/diagrams/class/svgDraw.js");
|
10973 | /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js");
|
10974 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
10975 |
|
10976 |
|
10977 | // eslint-disable-line
|
10978 |
|
10979 |
|
10980 |
|
10981 |
|
10982 |
|
10983 |
|
10984 |
|
10985 |
|
10986 |
|
10987 | var question = function question(parent, node) {
|
10988 | var _labelHelper = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
|
10989 | shapeSvg = _labelHelper.shapeSvg,
|
10990 | bbox = _labelHelper.bbox;
|
10991 |
|
10992 | var w = bbox.width + node.padding;
|
10993 | var h = bbox.height + node.padding;
|
10994 | var s = w + h;
|
10995 | var points = [{
|
10996 | x: s / 2,
|
10997 | y: 0
|
10998 | }, {
|
10999 | x: s,
|
11000 | y: -s / 2
|
11001 | }, {
|
11002 | x: s / 2,
|
11003 | y: -s
|
11004 | }, {
|
11005 | x: 0,
|
11006 | y: -s / 2
|
11007 | }];
|
11008 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Question main (Circle)');
|
11009 | var questionElem = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, s, s, points);
|
11010 | questionElem.attr('style', node.style);
|
11011 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, questionElem);
|
11012 |
|
11013 | node.intersect = function (point) {
|
11014 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.warn('Intersect called');
|
11015 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
|
11016 | };
|
11017 |
|
11018 | return shapeSvg;
|
11019 | };
|
11020 |
|
11021 | var choice = function choice(parent, node) {
|
11022 | var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
|
11023 | var s = 28;
|
11024 | var points = [{
|
11025 | x: 0,
|
11026 | y: s / 2
|
11027 | }, {
|
11028 | x: s / 2,
|
11029 | y: 0
|
11030 | }, {
|
11031 | x: 0,
|
11032 | y: -s / 2
|
11033 | }, {
|
11034 | x: -s / 2,
|
11035 | y: 0
|
11036 | }];
|
11037 | var choice = shapeSvg.insert('polygon', ':first-child').attr('points', points.map(function (d) {
|
11038 | return d.x + ',' + d.y;
|
11039 | }).join(' ')); // center the circle around its coordinate
|
11040 |
|
11041 | choice.attr('class', 'state-start').attr('r', 7).attr('width', 28).attr('height', 28);
|
11042 | node.width = 28;
|
11043 | node.height = 28;
|
11044 |
|
11045 | node.intersect = function (point) {
|
11046 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].circle(node, 14, point);
|
11047 | };
|
11048 |
|
11049 | return shapeSvg;
|
11050 | };
|
11051 |
|
11052 | var hexagon = function hexagon(parent, node) {
|
11053 | var _labelHelper2 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
|
11054 | shapeSvg = _labelHelper2.shapeSvg,
|
11055 | bbox = _labelHelper2.bbox;
|
11056 |
|
11057 | var f = 4;
|
11058 | var h = bbox.height + node.padding;
|
11059 | var m = h / f;
|
11060 | var w = bbox.width + 2 * m + node.padding;
|
11061 | var points = [{
|
11062 | x: m,
|
11063 | y: 0
|
11064 | }, {
|
11065 | x: w - m,
|
11066 | y: 0
|
11067 | }, {
|
11068 | x: w,
|
11069 | y: -h / 2
|
11070 | }, {
|
11071 | x: w - m,
|
11072 | y: -h
|
11073 | }, {
|
11074 | x: m,
|
11075 | y: -h
|
11076 | }, {
|
11077 | x: 0,
|
11078 | y: -h / 2
|
11079 | }];
|
11080 | var hex = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
|
11081 | hex.attr('style', node.style);
|
11082 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, hex);
|
11083 |
|
11084 | node.intersect = function (point) {
|
11085 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
|
11086 | };
|
11087 |
|
11088 | return shapeSvg;
|
11089 | };
|
11090 |
|
11091 | var rect_left_inv_arrow = function rect_left_inv_arrow(parent, node) {
|
11092 | var _labelHelper3 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
|
11093 | shapeSvg = _labelHelper3.shapeSvg,
|
11094 | bbox = _labelHelper3.bbox;
|
11095 |
|
11096 | var w = bbox.width + node.padding;
|
11097 | var h = bbox.height + node.padding;
|
11098 | var points = [{
|
11099 | x: -h / 2,
|
11100 | y: 0
|
11101 | }, {
|
11102 | x: w,
|
11103 | y: 0
|
11104 | }, {
|
11105 | x: w,
|
11106 | y: -h
|
11107 | }, {
|
11108 | x: -h / 2,
|
11109 | y: -h
|
11110 | }, {
|
11111 | x: 0,
|
11112 | y: -h / 2
|
11113 | }];
|
11114 | var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
|
11115 | el.attr('style', node.style);
|
11116 | node.width = w + h;
|
11117 | node.height = h;
|
11118 |
|
11119 | node.intersect = function (point) {
|
11120 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
|
11121 | };
|
11122 |
|
11123 | return shapeSvg;
|
11124 | };
|
11125 |
|
11126 | var lean_right = function lean_right(parent, node) {
|
11127 | var _labelHelper4 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
|
11128 | shapeSvg = _labelHelper4.shapeSvg,
|
11129 | bbox = _labelHelper4.bbox;
|
11130 |
|
11131 | var w = bbox.width + node.padding;
|
11132 | var h = bbox.height + node.padding;
|
11133 | var points = [{
|
11134 | x: -2 * h / 6,
|
11135 | y: 0
|
11136 | }, {
|
11137 | x: w - h / 6,
|
11138 | y: 0
|
11139 | }, {
|
11140 | x: w + 2 * h / 6,
|
11141 | y: -h
|
11142 | }, {
|
11143 | x: h / 6,
|
11144 | y: -h
|
11145 | }];
|
11146 | var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
|
11147 | el.attr('style', node.style);
|
11148 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, el);
|
11149 |
|
11150 | node.intersect = function (point) {
|
11151 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
|
11152 | };
|
11153 |
|
11154 | return shapeSvg;
|
11155 | };
|
11156 |
|
11157 | var lean_left = function lean_left(parent, node) {
|
11158 | var _labelHelper5 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
|
11159 | shapeSvg = _labelHelper5.shapeSvg,
|
11160 | bbox = _labelHelper5.bbox;
|
11161 |
|
11162 | var w = bbox.width + node.padding;
|
11163 | var h = bbox.height + node.padding;
|
11164 | var points = [{
|
11165 | x: 2 * h / 6,
|
11166 | y: 0
|
11167 | }, {
|
11168 | x: w + h / 6,
|
11169 | y: 0
|
11170 | }, {
|
11171 | x: w - 2 * h / 6,
|
11172 | y: -h
|
11173 | }, {
|
11174 | x: -h / 6,
|
11175 | y: -h
|
11176 | }];
|
11177 | var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
|
11178 | el.attr('style', node.style);
|
11179 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, el);
|
11180 |
|
11181 | node.intersect = function (point) {
|
11182 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
|
11183 | };
|
11184 |
|
11185 | return shapeSvg;
|
11186 | };
|
11187 |
|
11188 | var trapezoid = function trapezoid(parent, node) {
|
11189 | var _labelHelper6 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
|
11190 | shapeSvg = _labelHelper6.shapeSvg,
|
11191 | bbox = _labelHelper6.bbox;
|
11192 |
|
11193 | var w = bbox.width + node.padding;
|
11194 | var h = bbox.height + node.padding;
|
11195 | var points = [{
|
11196 | x: -2 * h / 6,
|
11197 | y: 0
|
11198 | }, {
|
11199 | x: w + 2 * h / 6,
|
11200 | y: 0
|
11201 | }, {
|
11202 | x: w - h / 6,
|
11203 | y: -h
|
11204 | }, {
|
11205 | x: h / 6,
|
11206 | y: -h
|
11207 | }];
|
11208 | var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
|
11209 | el.attr('style', node.style);
|
11210 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, el);
|
11211 |
|
11212 | node.intersect = function (point) {
|
11213 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
|
11214 | };
|
11215 |
|
11216 | return shapeSvg;
|
11217 | };
|
11218 |
|
11219 | var inv_trapezoid = function inv_trapezoid(parent, node) {
|
11220 | var _labelHelper7 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
|
11221 | shapeSvg = _labelHelper7.shapeSvg,
|
11222 | bbox = _labelHelper7.bbox;
|
11223 |
|
11224 | var w = bbox.width + node.padding;
|
11225 | var h = bbox.height + node.padding;
|
11226 | var points = [{
|
11227 | x: h / 6,
|
11228 | y: 0
|
11229 | }, {
|
11230 | x: w - h / 6,
|
11231 | y: 0
|
11232 | }, {
|
11233 | x: w + 2 * h / 6,
|
11234 | y: -h
|
11235 | }, {
|
11236 | x: -2 * h / 6,
|
11237 | y: -h
|
11238 | }];
|
11239 | var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
|
11240 | el.attr('style', node.style);
|
11241 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, el);
|
11242 |
|
11243 | node.intersect = function (point) {
|
11244 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
|
11245 | };
|
11246 |
|
11247 | return shapeSvg;
|
11248 | };
|
11249 |
|
11250 | var rect_right_inv_arrow = function rect_right_inv_arrow(parent, node) {
|
11251 | var _labelHelper8 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
|
11252 | shapeSvg = _labelHelper8.shapeSvg,
|
11253 | bbox = _labelHelper8.bbox;
|
11254 |
|
11255 | var w = bbox.width + node.padding;
|
11256 | var h = bbox.height + node.padding;
|
11257 | var points = [{
|
11258 | x: 0,
|
11259 | y: 0
|
11260 | }, {
|
11261 | x: w + h / 2,
|
11262 | y: 0
|
11263 | }, {
|
11264 | x: w,
|
11265 | y: -h / 2
|
11266 | }, {
|
11267 | x: w + h / 2,
|
11268 | y: -h
|
11269 | }, {
|
11270 | x: 0,
|
11271 | y: -h
|
11272 | }];
|
11273 | var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
|
11274 | el.attr('style', node.style);
|
11275 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, el);
|
11276 |
|
11277 | node.intersect = function (point) {
|
11278 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
|
11279 | };
|
11280 |
|
11281 | return shapeSvg;
|
11282 | };
|
11283 |
|
11284 | var cylinder = function cylinder(parent, node) {
|
11285 | var _labelHelper9 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
|
11286 | shapeSvg = _labelHelper9.shapeSvg,
|
11287 | bbox = _labelHelper9.bbox;
|
11288 |
|
11289 | var w = bbox.width + node.padding;
|
11290 | var rx = w / 2;
|
11291 | var ry = rx / (2.5 + w / 50);
|
11292 | var h = bbox.height + ry + node.padding;
|
11293 | 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;
|
11294 | 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) + ')');
|
11295 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, el);
|
11296 |
|
11297 | node.intersect = function (point) {
|
11298 | var pos = _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].rect(node, point);
|
11299 | var x = pos.x - node.x;
|
11300 |
|
11301 | 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)) {
|
11302 | // ellipsis equation: x*x / a*a + y*y / b*b = 1
|
11303 | // solve for y to get adjustion value for pos.y
|
11304 | var y = ry * ry * (1 - x * x / (rx * rx));
|
11305 | if (y != 0) y = Math.sqrt(y);
|
11306 | y = ry - y;
|
11307 | if (point.y - node.y > 0) y = -y;
|
11308 | pos.y += y;
|
11309 | }
|
11310 |
|
11311 | return pos;
|
11312 | };
|
11313 |
|
11314 | return shapeSvg;
|
11315 | };
|
11316 |
|
11317 | var rect = function rect(parent, node) {
|
11318 | var _labelHelper10 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, 'node ' + node.classes, true),
|
11319 | shapeSvg = _labelHelper10.shapeSvg,
|
11320 | bbox = _labelHelper10.bbox,
|
11321 | halfPadding = _labelHelper10.halfPadding;
|
11322 |
|
11323 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Classes = ', node.classes); // add the rect
|
11324 |
|
11325 | var rect = shapeSvg.insert('rect', ':first-child');
|
11326 | 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', bbox.width + node.padding).attr('height', bbox.height + node.padding);
|
11327 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, rect);
|
11328 |
|
11329 | node.intersect = function (point) {
|
11330 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].rect(node, point);
|
11331 | };
|
11332 |
|
11333 | return shapeSvg;
|
11334 | };
|
11335 |
|
11336 | var rectWithTitle = function rectWithTitle(parent, node) {
|
11337 | // const { shapeSvg, bbox, halfPadding } = labelHelper(parent, node, 'node ' + node.classes);
|
11338 | var classes;
|
11339 |
|
11340 | if (!node.classes) {
|
11341 | classes = 'node default';
|
11342 | } else {
|
11343 | classes = 'node ' + node.classes;
|
11344 | } // Add outer g element
|
11345 |
|
11346 |
|
11347 | var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the title label and insert it after the rect
|
11348 |
|
11349 | var rect = shapeSvg.insert('rect', ':first-child'); // const innerRect = shapeSvg.insert('rect');
|
11350 |
|
11351 | var innerLine = shapeSvg.insert('line');
|
11352 | var label = shapeSvg.insert('g').attr('class', 'label');
|
11353 | var text2 = node.labelText.flat ? node.labelText.flat() : node.labelText; // const text2 = typeof text2prim === 'object' ? text2prim[0] : text2prim;
|
11354 |
|
11355 | var title = '';
|
11356 |
|
11357 | if (_typeof(text2) === 'object') {
|
11358 | title = text2[0];
|
11359 | } else {
|
11360 | title = text2;
|
11361 | }
|
11362 |
|
11363 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Label text abc79', title, text2, _typeof(text2) === 'object');
|
11364 | var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_4__["default"])(title, node.labelStyle, true, true));
|
11365 | var bbox = {
|
11366 | width: 0,
|
11367 | height: 0
|
11368 | };
|
11369 |
|
11370 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
|
11371 | var div = text.children[0];
|
11372 | var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text);
|
11373 | bbox = div.getBoundingClientRect();
|
11374 | dv.attr('width', bbox.width);
|
11375 | dv.attr('height', bbox.height);
|
11376 | }
|
11377 |
|
11378 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Text 2', text2);
|
11379 | var textRows = text2.slice(1, text2.length);
|
11380 | var titleBox = text.getBBox();
|
11381 | var descr = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_4__["default"])(textRows.join ? textRows.join('<br/>') : textRows, node.labelStyle, true, true));
|
11382 |
|
11383 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
|
11384 | var _div = descr.children[0];
|
11385 |
|
11386 | var _dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(descr);
|
11387 |
|
11388 | bbox = _div.getBoundingClientRect();
|
11389 |
|
11390 | _dv.attr('width', bbox.width);
|
11391 |
|
11392 | _dv.attr('height', bbox.height);
|
11393 | } // bbox = label.getBBox();
|
11394 | // log.info(descr);
|
11395 |
|
11396 |
|
11397 | var halfPadding = node.padding / 2;
|
11398 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(descr).attr('transform', 'translate( ' + (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ', ' + (titleBox.height + halfPadding + 5) + ')');
|
11399 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text).attr('transform', 'translate( ' + (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ', ' + 0 + ')'); // Get the size of the label
|
11400 | // Bounding box for title and text
|
11401 |
|
11402 | bbox = label.node().getBBox(); // Center the label
|
11403 |
|
11404 | label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + (-bbox.height / 2 - halfPadding + 3) + ')');
|
11405 | 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);
|
11406 | 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);
|
11407 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, rect);
|
11408 |
|
11409 | node.intersect = function (point) {
|
11410 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].rect(node, point);
|
11411 | };
|
11412 |
|
11413 | return shapeSvg;
|
11414 | };
|
11415 |
|
11416 | var stadium = function stadium(parent, node) {
|
11417 | var _labelHelper11 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
|
11418 | shapeSvg = _labelHelper11.shapeSvg,
|
11419 | bbox = _labelHelper11.bbox;
|
11420 |
|
11421 | var h = bbox.height + node.padding;
|
11422 | var w = bbox.width + h / 4 + node.padding; // add the rect
|
11423 |
|
11424 | 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);
|
11425 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, rect);
|
11426 |
|
11427 | node.intersect = function (point) {
|
11428 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].rect(node, point);
|
11429 | };
|
11430 |
|
11431 | return shapeSvg;
|
11432 | };
|
11433 |
|
11434 | var circle = function circle(parent, node) {
|
11435 | var _labelHelper12 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
|
11436 | shapeSvg = _labelHelper12.shapeSvg,
|
11437 | bbox = _labelHelper12.bbox,
|
11438 | halfPadding = _labelHelper12.halfPadding;
|
11439 |
|
11440 | var circle = shapeSvg.insert('circle', ':first-child'); // center the circle around its coordinate
|
11441 |
|
11442 | 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);
|
11443 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Circle main');
|
11444 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, circle);
|
11445 |
|
11446 | node.intersect = function (point) {
|
11447 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Circle intersect', node, bbox.width / 2 + halfPadding, point);
|
11448 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].circle(node, bbox.width / 2 + halfPadding, point);
|
11449 | };
|
11450 |
|
11451 | return shapeSvg;
|
11452 | };
|
11453 |
|
11454 | var subroutine = function subroutine(parent, node) {
|
11455 | var _labelHelper13 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
|
11456 | shapeSvg = _labelHelper13.shapeSvg,
|
11457 | bbox = _labelHelper13.bbox;
|
11458 |
|
11459 | var w = bbox.width + node.padding;
|
11460 | var h = bbox.height + node.padding;
|
11461 | var points = [{
|
11462 | x: 0,
|
11463 | y: 0
|
11464 | }, {
|
11465 | x: w,
|
11466 | y: 0
|
11467 | }, {
|
11468 | x: w,
|
11469 | y: -h
|
11470 | }, {
|
11471 | x: 0,
|
11472 | y: -h
|
11473 | }, {
|
11474 | x: 0,
|
11475 | y: 0
|
11476 | }, {
|
11477 | x: -8,
|
11478 | y: 0
|
11479 | }, {
|
11480 | x: w + 8,
|
11481 | y: 0
|
11482 | }, {
|
11483 | x: w + 8,
|
11484 | y: -h
|
11485 | }, {
|
11486 | x: -8,
|
11487 | y: -h
|
11488 | }, {
|
11489 | x: -8,
|
11490 | y: 0
|
11491 | }];
|
11492 | var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
|
11493 | el.attr('style', node.style);
|
11494 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, el);
|
11495 |
|
11496 | node.intersect = function (point) {
|
11497 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
|
11498 | };
|
11499 |
|
11500 | return shapeSvg;
|
11501 | };
|
11502 |
|
11503 | var start = function start(parent, node) {
|
11504 | var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
|
11505 | var circle = shapeSvg.insert('circle', ':first-child'); // center the circle around its coordinate
|
11506 |
|
11507 | circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);
|
11508 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, circle);
|
11509 |
|
11510 | node.intersect = function (point) {
|
11511 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].circle(node, 7, point);
|
11512 | };
|
11513 |
|
11514 | return shapeSvg;
|
11515 | };
|
11516 |
|
11517 | var forkJoin = function forkJoin(parent, node, dir) {
|
11518 | var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
|
11519 | var width = 70;
|
11520 | var height = 10;
|
11521 |
|
11522 | if (dir === 'LR') {
|
11523 | width = 10;
|
11524 | height = 70;
|
11525 | }
|
11526 |
|
11527 | 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');
|
11528 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, shape);
|
11529 | node.height = node.height + node.padding / 2;
|
11530 | node.width = node.width + node.padding / 2;
|
11531 |
|
11532 | node.intersect = function (point) {
|
11533 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].rect(node, point);
|
11534 | };
|
11535 |
|
11536 | return shapeSvg;
|
11537 | };
|
11538 |
|
11539 | var end = function end(parent, node) {
|
11540 | var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
|
11541 | var innerCircle = shapeSvg.insert('circle', ':first-child');
|
11542 | var circle = shapeSvg.insert('circle', ':first-child');
|
11543 | circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);
|
11544 | innerCircle.attr('class', 'state-end').attr('r', 5).attr('width', 10).attr('height', 10);
|
11545 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, circle);
|
11546 |
|
11547 | node.intersect = function (point) {
|
11548 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].circle(node, 7, point);
|
11549 | };
|
11550 |
|
11551 | return shapeSvg;
|
11552 | };
|
11553 |
|
11554 | var class_box = function class_box(parent, node) {
|
11555 | var halfPadding = node.padding / 2;
|
11556 | var rowPadding = 4;
|
11557 | var lineHeight = 8;
|
11558 | var classes;
|
11559 |
|
11560 | if (!node.classes) {
|
11561 | classes = 'node default';
|
11562 | } else {
|
11563 | classes = 'node ' + node.classes;
|
11564 | } // Add outer g element
|
11565 |
|
11566 |
|
11567 | var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the title label and insert it after the rect
|
11568 |
|
11569 | var rect = shapeSvg.insert('rect', ':first-child');
|
11570 | var topLine = shapeSvg.insert('line');
|
11571 | var bottomLine = shapeSvg.insert('line');
|
11572 | var maxWidth = 0;
|
11573 | var maxHeight = rowPadding;
|
11574 | var labelContainer = shapeSvg.insert('g').attr('class', 'label');
|
11575 | var verticalPos = 0;
|
11576 | var hasInterface = node.classData.annotations && node.classData.annotations[0]; // 1. Create the labels
|
11577 |
|
11578 | var interfaceLabelText = node.classData.annotations[0] ? '«' + node.classData.annotations[0] + '»' : '';
|
11579 | var interfaceLabel = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_4__["default"])(interfaceLabelText, node.labelStyle, true, true));
|
11580 | var interfaceBBox = interfaceLabel.getBBox();
|
11581 |
|
11582 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
|
11583 | var div = interfaceLabel.children[0];
|
11584 | var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(interfaceLabel);
|
11585 | interfaceBBox = div.getBoundingClientRect();
|
11586 | dv.attr('width', interfaceBBox.width);
|
11587 | dv.attr('height', interfaceBBox.height);
|
11588 | }
|
11589 |
|
11590 | if (node.classData.annotations[0]) {
|
11591 | maxHeight += interfaceBBox.height + rowPadding;
|
11592 | maxWidth += interfaceBBox.width;
|
11593 | }
|
11594 |
|
11595 | var classTitleString = node.classData.id;
|
11596 |
|
11597 | if (node.classData.type !== undefined && node.classData.type !== '') {
|
11598 | if ((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels) {
|
11599 | classTitleString += '<' + node.classData.type + '>';
|
11600 | } else {
|
11601 | classTitleString += '<' + node.classData.type + '>';
|
11602 | }
|
11603 | }
|
11604 |
|
11605 | var classTitleLabel = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_4__["default"])(classTitleString, node.labelStyle, true, true));
|
11606 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(classTitleLabel).attr('class', 'classTitle');
|
11607 | var classTitleBBox = classTitleLabel.getBBox();
|
11608 |
|
11609 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
|
11610 | var _div2 = classTitleLabel.children[0];
|
11611 |
|
11612 | var _dv2 = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(classTitleLabel);
|
11613 |
|
11614 | classTitleBBox = _div2.getBoundingClientRect();
|
11615 |
|
11616 | _dv2.attr('width', classTitleBBox.width);
|
11617 |
|
11618 | _dv2.attr('height', classTitleBBox.height);
|
11619 | }
|
11620 |
|
11621 | maxHeight += classTitleBBox.height + rowPadding;
|
11622 |
|
11623 | if (classTitleBBox.width > maxWidth) {
|
11624 | maxWidth = classTitleBBox.width;
|
11625 | }
|
11626 |
|
11627 | var classAttributes = [];
|
11628 | node.classData.members.forEach(function (str) {
|
11629 | var parsedInfo = (0,_diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__.parseMember)(str);
|
11630 | var parsedText = parsedInfo.displayText;
|
11631 |
|
11632 | if ((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels) {
|
11633 | parsedText = parsedText.replace(/</g, '<').replace(/>/g, '>');
|
11634 | }
|
11635 |
|
11636 | var lbl = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_4__["default"])(parsedText, parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle, true, true));
|
11637 | var bbox = lbl.getBBox();
|
11638 |
|
11639 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
|
11640 | var _div3 = lbl.children[0];
|
11641 |
|
11642 | var _dv3 = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl);
|
11643 |
|
11644 | bbox = _div3.getBoundingClientRect();
|
11645 |
|
11646 | _dv3.attr('width', bbox.width);
|
11647 |
|
11648 | _dv3.attr('height', bbox.height);
|
11649 | }
|
11650 |
|
11651 | if (bbox.width > maxWidth) {
|
11652 | maxWidth = bbox.width;
|
11653 | }
|
11654 |
|
11655 | maxHeight += bbox.height + rowPadding;
|
11656 | classAttributes.push(lbl);
|
11657 | });
|
11658 | maxHeight += lineHeight;
|
11659 | var classMethods = [];
|
11660 | node.classData.methods.forEach(function (str) {
|
11661 | var parsedInfo = (0,_diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__.parseMember)(str);
|
11662 | var displayText = parsedInfo.displayText;
|
11663 |
|
11664 | if ((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels) {
|
11665 | displayText = displayText.replace(/</g, '<').replace(/>/g, '>');
|
11666 | }
|
11667 |
|
11668 | var lbl = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_4__["default"])(displayText, parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle, true, true));
|
11669 | var bbox = lbl.getBBox();
|
11670 |
|
11671 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
|
11672 | var _div4 = lbl.children[0];
|
11673 |
|
11674 | var _dv4 = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl);
|
11675 |
|
11676 | bbox = _div4.getBoundingClientRect();
|
11677 |
|
11678 | _dv4.attr('width', bbox.width);
|
11679 |
|
11680 | _dv4.attr('height', bbox.height);
|
11681 | }
|
11682 |
|
11683 | if (bbox.width > maxWidth) {
|
11684 | maxWidth = bbox.width;
|
11685 | }
|
11686 |
|
11687 | maxHeight += bbox.height + rowPadding;
|
11688 | classMethods.push(lbl);
|
11689 | });
|
11690 | maxHeight += lineHeight; // 2. Position the labels
|
11691 | // position the interface label
|
11692 |
|
11693 | if (hasInterface) {
|
11694 | var _diffX = (maxWidth - interfaceBBox.width) / 2;
|
11695 |
|
11696 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(interfaceLabel).attr('transform', 'translate( ' + (-1 * maxWidth / 2 + _diffX) + ', ' + -1 * maxHeight / 2 + ')');
|
11697 | verticalPos = interfaceBBox.height + rowPadding;
|
11698 | } // Positin the class title label
|
11699 |
|
11700 |
|
11701 | var diffX = (maxWidth - classTitleBBox.width) / 2;
|
11702 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(classTitleLabel).attr('transform', 'translate( ' + (-1 * maxWidth / 2 + diffX) + ', ' + (-1 * maxHeight / 2 + verticalPos) + ')');
|
11703 | verticalPos += classTitleBBox.height + rowPadding;
|
11704 | 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);
|
11705 | verticalPos += lineHeight;
|
11706 | classAttributes.forEach(function (lbl) {
|
11707 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl).attr('transform', 'translate( ' + -maxWidth / 2 + ', ' + (-1 * maxHeight / 2 + verticalPos + lineHeight / 2) + ')');
|
11708 | verticalPos += classTitleBBox.height + rowPadding;
|
11709 | });
|
11710 | verticalPos += lineHeight;
|
11711 | 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);
|
11712 | verticalPos += lineHeight;
|
11713 | classMethods.forEach(function (lbl) {
|
11714 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl).attr('transform', 'translate( ' + -maxWidth / 2 + ', ' + (-1 * maxHeight / 2 + verticalPos) + ')');
|
11715 | verticalPos += classTitleBBox.height + rowPadding;
|
11716 | }); //
|
11717 | // let bbox;
|
11718 | // if (evaluate(getConfig().flowchart.htmlLabels)) {
|
11719 | // const div = interfaceLabel.children[0];
|
11720 | // const dv = select(interfaceLabel);
|
11721 | // bbox = div.getBoundingClientRect();
|
11722 | // dv.attr('width', bbox.width);
|
11723 | // dv.attr('height', bbox.height);
|
11724 | // }
|
11725 | // bbox = labelContainer.getBBox();
|
11726 | // log.info('Text 2', text2);
|
11727 | // const textRows = text2.slice(1, text2.length);
|
11728 | // let titleBox = text.getBBox();
|
11729 | // const descr = label
|
11730 | // .node()
|
11731 | // .appendChild(createLabel(textRows.join('<br/>'), node.labelStyle, true, true));
|
11732 | // if (evaluate(getConfig().flowchart.htmlLabels)) {
|
11733 | // const div = descr.children[0];
|
11734 | // const dv = select(descr);
|
11735 | // bbox = div.getBoundingClientRect();
|
11736 | // dv.attr('width', bbox.width);
|
11737 | // dv.attr('height', bbox.height);
|
11738 | // }
|
11739 | // // bbox = label.getBBox();
|
11740 | // // log.info(descr);
|
11741 | // select(descr).attr(
|
11742 | // 'transform',
|
11743 | // 'translate( ' +
|
11744 | // // (titleBox.width - bbox.width) / 2 +
|
11745 | // (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) +
|
11746 | // ', ' +
|
11747 | // (titleBox.height + halfPadding + 5) +
|
11748 | // ')'
|
11749 | // );
|
11750 | // select(text).attr(
|
11751 | // 'transform',
|
11752 | // 'translate( ' +
|
11753 | // // (titleBox.width - bbox.width) / 2 +
|
11754 | // (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) +
|
11755 | // ', ' +
|
11756 | // 0 +
|
11757 | // ')'
|
11758 | // );
|
11759 | // // Get the size of the label
|
11760 | // // Bounding box for title and text
|
11761 | // bbox = label.node().getBBox();
|
11762 | // // Center the label
|
11763 | // label.attr(
|
11764 | // 'transform',
|
11765 | // 'translate(' + -bbox.width / 2 + ', ' + (-bbox.height / 2 - halfPadding + 3) + ')'
|
11766 | // );
|
11767 |
|
11768 | 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
|
11769 | // .attr('class', 'divider')
|
11770 | // .attr('x1', -bbox.width / 2 - halfPadding)
|
11771 | // .attr('x2', bbox.width / 2 + halfPadding)
|
11772 | // .attr('y1', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding)
|
11773 | // .attr('y2', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
|
11774 |
|
11775 | (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, rect);
|
11776 |
|
11777 | node.intersect = function (point) {
|
11778 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].rect(node, point);
|
11779 | };
|
11780 |
|
11781 | return shapeSvg;
|
11782 | };
|
11783 |
|
11784 | var shapes = {
|
11785 | question: question,
|
11786 | rect: rect,
|
11787 | rectWithTitle: rectWithTitle,
|
11788 | choice: choice,
|
11789 | circle: circle,
|
11790 | stadium: stadium,
|
11791 | hexagon: hexagon,
|
11792 | rect_left_inv_arrow: rect_left_inv_arrow,
|
11793 | lean_right: lean_right,
|
11794 | lean_left: lean_left,
|
11795 | trapezoid: trapezoid,
|
11796 | inv_trapezoid: inv_trapezoid,
|
11797 | rect_right_inv_arrow: rect_right_inv_arrow,
|
11798 | cylinder: cylinder,
|
11799 | start: start,
|
11800 | end: end,
|
11801 | note: _shapes_note__WEBPACK_IMPORTED_MODULE_8__["default"],
|
11802 | subroutine: subroutine,
|
11803 | fork: forkJoin,
|
11804 | join: forkJoin,
|
11805 | class_box: class_box
|
11806 | };
|
11807 | var nodeElems = {};
|
11808 | var insertNode = function insertNode(elem, node, dir) {
|
11809 | var newEl;
|
11810 | var el; // Add link when appropriate
|
11811 |
|
11812 | if (node.link) {
|
11813 | newEl = elem.insert('svg:a').attr('xlink:href', node.link).attr('target', node.linkTarget || '_blank');
|
11814 | el = shapes[node.shape](newEl, node, dir);
|
11815 | } else {
|
11816 | el = shapes[node.shape](elem, node, dir);
|
11817 | newEl = el;
|
11818 | }
|
11819 |
|
11820 | if (node.tooltip) {
|
11821 | el.attr('title', node.tooltip);
|
11822 | }
|
11823 |
|
11824 | if (node.class) {
|
11825 | el.attr('class', 'node default ' + node.class);
|
11826 | }
|
11827 |
|
11828 | nodeElems[node.id] = newEl;
|
11829 |
|
11830 | if (node.haveCallback) {
|
11831 | nodeElems[node.id].attr('class', nodeElems[node.id].attr('class') + ' clickable');
|
11832 | }
|
11833 | };
|
11834 | var setNodeElem = function setNodeElem(elem, node) {
|
11835 | nodeElems[node.id] = elem;
|
11836 | };
|
11837 | var clear = function clear() {
|
11838 | nodeElems = {};
|
11839 | };
|
11840 | var positionNode = function positionNode(node) {
|
11841 | var el = nodeElems[node.id];
|
11842 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Transforming node', node.diff, node, 'translate(' + (node.x - node.width / 2 - 5) + ', ' + node.width / 2 + ')');
|
11843 | var padding = 8;
|
11844 | var diff = node.diff || 0;
|
11845 |
|
11846 | if (node.clusterNode) {
|
11847 | el.attr('transform', 'translate(' + (node.x + diff - node.width / 2) + ', ' + (node.y - node.height / 2 - padding) + ')');
|
11848 | } else {
|
11849 | el.attr('transform', 'translate(' + node.x + ', ' + node.y + ')');
|
11850 | }
|
11851 |
|
11852 | return diff;
|
11853 | };
|
11854 |
|
11855 | /***/ }),
|
11856 |
|
11857 | /***/ "./src/dagre-wrapper/shapes/note.js":
|
11858 | /*!******************************************!*\
|
11859 | !*** ./src/dagre-wrapper/shapes/note.js ***!
|
11860 | \******************************************/
|
11861 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
11862 |
|
11863 | "use strict";
|
11864 | __webpack_require__.r(__webpack_exports__);
|
11865 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
11866 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
11867 | /* harmony export */ });
|
11868 | /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "./src/dagre-wrapper/shapes/util.js");
|
11869 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
11870 | /* harmony import */ var _intersect_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../intersect/index.js */ "./src/dagre-wrapper/intersect/index.js");
|
11871 |
|
11872 | // eslint-disable-line
|
11873 |
|
11874 |
|
11875 |
|
11876 | var note = function note(parent, node) {
|
11877 | var _labelHelper = (0,_util__WEBPACK_IMPORTED_MODULE_0__.labelHelper)(parent, node, 'node ' + node.classes, true),
|
11878 | shapeSvg = _labelHelper.shapeSvg,
|
11879 | bbox = _labelHelper.bbox,
|
11880 | halfPadding = _labelHelper.halfPadding;
|
11881 |
|
11882 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Classes = ', node.classes); // add the rect
|
11883 |
|
11884 | var rect = shapeSvg.insert('rect', ':first-child');
|
11885 | 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);
|
11886 | (0,_util__WEBPACK_IMPORTED_MODULE_0__.updateNodeBounds)(node, rect);
|
11887 |
|
11888 | node.intersect = function (point) {
|
11889 | return _intersect_index_js__WEBPACK_IMPORTED_MODULE_2__["default"].rect(node, point);
|
11890 | };
|
11891 |
|
11892 | return shapeSvg;
|
11893 | };
|
11894 |
|
11895 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (note);
|
11896 |
|
11897 | /***/ }),
|
11898 |
|
11899 | /***/ "./src/dagre-wrapper/shapes/util.js":
|
11900 | /*!******************************************!*\
|
11901 | !*** ./src/dagre-wrapper/shapes/util.js ***!
|
11902 | \******************************************/
|
11903 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
11904 |
|
11905 | "use strict";
|
11906 | __webpack_require__.r(__webpack_exports__);
|
11907 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
11908 | /* harmony export */ "labelHelper": () => (/* binding */ labelHelper),
|
11909 | /* harmony export */ "updateNodeBounds": () => (/* binding */ updateNodeBounds),
|
11910 | /* harmony export */ "insertPolygonShape": () => (/* binding */ insertPolygonShape)
|
11911 | /* harmony export */ });
|
11912 | /* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../createLabel */ "./src/dagre-wrapper/createLabel.js");
|
11913 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
11914 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
11915 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
11916 | /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../diagrams/common/common */ "./src/diagrams/common/common.js");
|
11917 |
|
11918 |
|
11919 |
|
11920 |
|
11921 | var labelHelper = function labelHelper(parent, node, _classes, isNode) {
|
11922 | var classes;
|
11923 |
|
11924 | if (!_classes) {
|
11925 | classes = 'node default';
|
11926 | } else {
|
11927 | classes = _classes;
|
11928 | } // Add outer g element
|
11929 |
|
11930 |
|
11931 | var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the label and insert it after the rect
|
11932 |
|
11933 | var label = shapeSvg.insert('g').attr('class', 'label').attr('style', node.labelStyle);
|
11934 | var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(node.labelText, node.labelStyle, false, isNode)); // Get the size of the label
|
11935 |
|
11936 | var bbox = text.getBBox();
|
11937 |
|
11938 | if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().flowchart.htmlLabels)) {
|
11939 | var div = text.children[0];
|
11940 | var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text);
|
11941 | bbox = div.getBoundingClientRect();
|
11942 | dv.attr('width', bbox.width);
|
11943 | dv.attr('height', bbox.height);
|
11944 | }
|
11945 |
|
11946 | var halfPadding = node.padding / 2; // Center the label
|
11947 |
|
11948 | label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')');
|
11949 | return {
|
11950 | shapeSvg: shapeSvg,
|
11951 | bbox: bbox,
|
11952 | halfPadding: halfPadding,
|
11953 | label: label
|
11954 | };
|
11955 | };
|
11956 | var updateNodeBounds = function updateNodeBounds(node, element) {
|
11957 | var bbox = element.node().getBBox();
|
11958 | node.width = bbox.width;
|
11959 | node.height = bbox.height;
|
11960 | };
|
11961 | function insertPolygonShape(parent, w, h, points) {
|
11962 | return parent.insert('polygon', ':first-child').attr('points', points.map(function (d) {
|
11963 | return d.x + ',' + d.y;
|
11964 | }).join(' ')).attr('class', 'label-container').attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');
|
11965 | }
|
11966 |
|
11967 | /***/ }),
|
11968 |
|
11969 | /***/ "./src/defaultConfig.js":
|
11970 | /*!******************************!*\
|
11971 | !*** ./src/defaultConfig.js ***!
|
11972 | \******************************/
|
11973 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
11974 |
|
11975 | "use strict";
|
11976 | __webpack_require__.r(__webpack_exports__);
|
11977 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
11978 | /* harmony export */ "configKeys": () => (/* binding */ configKeys),
|
11979 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
11980 | /* harmony export */ });
|
11981 | /* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
|
11982 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
11983 |
|
11984 | 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."); }
|
11985 |
|
11986 | 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); }
|
11987 |
|
11988 | function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
11989 |
|
11990 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
11991 |
|
11992 | 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; }
|
11993 |
|
11994 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
11995 |
|
11996 |
|
11997 | /**
|
11998 | * **Configuration methods in Mermaid version 8.6.0 have been updated, to learn more[[click here](8.6.0_docs.md)].**
|
11999 | *
|
12000 | * ## **What follows are config instructions for older versions**
|
12001 | *
|
12002 | * These are the default options which can be overridden with the initialization call like so:
|
12003 | *
|
12004 | * **Example 1:**
|
12005 | * <pre>
|
12006 | * mermaid.initialize({
|
12007 | * flowchart:{
|
12008 | * htmlLabels: false
|
12009 | * }
|
12010 | * });
|
12011 | * </pre>
|
12012 | *
|
12013 | * **Example 2:**
|
12014 | * <pre>
|
12015 | * <script>
|
12016 | * var config = {
|
12017 | * startOnLoad:true,
|
12018 | * flowchart:{
|
12019 | * useMaxWidth:true,
|
12020 | * htmlLabels:true,
|
12021 | * curve:'cardinal',
|
12022 | * },
|
12023 | *
|
12024 | * securityLevel:'loose',
|
12025 | * };
|
12026 | * mermaid.initialize(config);
|
12027 | * </script>
|
12028 | * </pre>
|
12029 | * A summary of all options and their defaults is found [here](#mermaidapi-configuration-defaults). A description of each option follows below.
|
12030 | *
|
12031 | * @name Configuration
|
12032 | */
|
12033 |
|
12034 | var config = {
|
12035 | /**
|
12036 | * theme , the CSS style sheet
|
12037 | *
|
12038 | * | Parameter | Description | Type | Required | Values |
|
12039 | * | --- | --- | --- | --- | --- |
|
12040 | * | theme | Built in Themes | string | Optional | 'default', 'forest', 'dark', 'neutral', 'null'|
|
12041 | *
|
12042 | * **Notes:** To disable any pre-defined mermaid theme, use "null".
|
12043 | *
|
12044 | * <pre>
|
12045 | * "theme": "forest",
|
12046 | * "themeCSS": ".node rect { fill: red; }"
|
12047 | * </pre>
|
12048 | */
|
12049 | theme: 'default',
|
12050 | themeVariables: _themes__WEBPACK_IMPORTED_MODULE_0__["default"]["default"].getThemeVariables(),
|
12051 | themeCSS: undefined,
|
12052 |
|
12053 | /* **maxTextSize** - The maximum allowed size of the users text diamgram */
|
12054 | maxTextSize: 50000,
|
12055 |
|
12056 | /**
|
12057 | * | Parameter | Description | Type | Required | Values |
|
12058 | * | --- | --- | --- | --- | --- |
|
12059 | * | fontFamily | specifies the font to be used in the rendered diagrams| string | Required | Any Posiable CSS FontFamily |
|
12060 | *
|
12061 | * **Notes:**
|
12062 | * Default value: '"trebuchet ms", verdana, arial, sans-serif;'.
|
12063 | */
|
12064 | fontFamily: '"trebuchet ms", verdana, arial, sans-serif;',
|
12065 |
|
12066 | /**
|
12067 | * | Parameter | Description | Type | Required | Values |
|
12068 | * | --- | --- | --- | --- | --- |
|
12069 | * | logLevel |This option decides the amount of logging to be used.| string \| number | Required | 1, 2, 3, 4, 5 |
|
12070 | *
|
12071 | *
|
12072 | * **Notes:**
|
12073 | *
|
12074 | * - debug: 1
|
12075 | * - info: 2
|
12076 | * - warn: 3
|
12077 | * - error: 4
|
12078 | * - fatal: 5 (default)
|
12079 | */
|
12080 | logLevel: 5,
|
12081 |
|
12082 | /**
|
12083 | * | Parameter | Description | Type | Required | Values |
|
12084 | * | --- | --- | --- | --- | --- |
|
12085 | * | securitylevel | Level of trust for parsed diagram|string | Required | 'strict', 'loose', 'antiscript' |
|
12086 | *
|
12087 | * **Notes**:
|
12088 | *
|
12089 | * - **strict**: (**default**) tags in text are encoded, click functionality is disabled
|
12090 | * - **loose**: tags in text are allowed, click functionality is enabled
|
12091 | * - **antiscript**: html tags in text are allowed, (only script element is removed), click functionality is enabled
|
12092 | */
|
12093 | securityLevel: 'strict',
|
12094 |
|
12095 | /**
|
12096 | * | Parameter | Description | Type | Required | Values |
|
12097 | * | --- | --- | --- | --- | --- |
|
12098 | * | startOnLoad | Dictates whether mermaind starts on Page load | boolean | Required | true, false |
|
12099 | *
|
12100 | * **Notes:** Default value: true
|
12101 | */
|
12102 | startOnLoad: true,
|
12103 |
|
12104 | /**
|
12105 | * | Parameter | Description |Type | Required |Values|
|
12106 | * | --- | --- | --- | --- | --- |
|
12107 | * | arrowMarkerAbsolute | Controls whether or arrow markers in html code are absolute paths or anchors | boolean | Required | true, false |
|
12108 | *
|
12109 | *
|
12110 | * **Notes**:
|
12111 | *
|
12112 | * This matters if you are using base tag settings.
|
12113 | *
|
12114 | * Default value: false
|
12115 | */
|
12116 | arrowMarkerAbsolute: false,
|
12117 |
|
12118 | /**
|
12119 | * This option controls which currentConfig keys are considered _secure_ and can only be changed via
|
12120 | * call to mermaidAPI.initialize. Calls to mermaidAPI.reinitialize cannot make changes to
|
12121 | * the `secure` keys in the current currentConfig. This prevents malicious graph directives from
|
12122 | * overriding a site's default security.
|
12123 | * **Notes**:
|
12124 | *
|
12125 | * Default value: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']
|
12126 | */
|
12127 | secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize'],
|
12128 |
|
12129 | /**
|
12130 | * This option controls if the generated ids of nodes in the SVG are generated randomly or based on a seed.
|
12131 | * If set to false, the IDs are generated based on the current date and thus are not deterministic. This is the default behaviour.
|
12132 | *
|
12133 | * **Notes**:
|
12134 | *
|
12135 | * This matters if your files are checked into sourcecontrol e.g. git and should not change unless content is changed.
|
12136 | *
|
12137 | * Default value: false
|
12138 | */
|
12139 | deterministicIds: false,
|
12140 |
|
12141 | /**
|
12142 | * This option is the optional seed for deterministic ids. if set to undefined but deterministicIds is true, a simple number iterator is used.
|
12143 | * You can set this attribute to base the seed on a static string.
|
12144 | */
|
12145 | deterministicIDSeed: undefined,
|
12146 |
|
12147 | /**
|
12148 | * The object containing configurations specific for flowcharts
|
12149 | */
|
12150 | flowchart: {
|
12151 | /**
|
12152 | * | Parameter | Description | Type | Required | Values |
|
12153 | * | --- | --- | --- | --- | --- |
|
12154 | * | diagramPadding | Amount of padding around the diagram as a whole | Integer | Required | Any Positive Value |
|
12155 | *
|
12156 | * **Notes:**
|
12157 | *
|
12158 | * The amount of padding around the diagram as a whole so that embedded diagrams have margins, expressed in pixels
|
12159 | *
|
12160 | * Default value: 8
|
12161 | */
|
12162 | diagramPadding: 8,
|
12163 |
|
12164 | /**
|
12165 | * | Parameter | Description | Type | Required | Values |
|
12166 | * | --- | --- | --- | --- | --- |
|
12167 | * | htmlLabels | Flag for setting whether or not a html tag should be used for rendering labels on the edges. | boolean| Required | true, false |
|
12168 | *
|
12169 | * **Notes:** Default value: true.
|
12170 | */
|
12171 | htmlLabels: true,
|
12172 |
|
12173 | /**
|
12174 | * | Parameter | Description | Type | Required | Values |
|
12175 | * | --- | --- | --- | --- | --- |
|
12176 | * | nodeSpacing | Defines the spacing between nodes on the same level | Integer | Required | Any positive Number |
|
12177 | *
|
12178 | * **Notes:**
|
12179 | *
|
12180 | * Pertains to horizontal spacing for TB (top to bottom) or BT (bottom to top) graphs, and the vertical spacing for LR as well as RL graphs.**
|
12181 | *
|
12182 | * Default value: 50
|
12183 | */
|
12184 | nodeSpacing: 50,
|
12185 |
|
12186 | /**
|
12187 | * | Parameter | Description | Type | Required | Values |
|
12188 | * | --- | --- | --- | --- | --- |
|
12189 | * | rankSpacing | Defines the spacing between nodes on different levels | Integer | Required | Any Positive Number |
|
12190 | *
|
12191 | * **Notes**:
|
12192 | *
|
12193 | * pertains to vertical spacing for TB (top to bottom) or BT (bottom to top), and the horizontal spacing for LR as well as RL graphs.
|
12194 | *
|
12195 | * Default value 50
|
12196 | */
|
12197 | rankSpacing: 50,
|
12198 |
|
12199 | /**
|
12200 | * | Parameter | Description | Type | Required | Values |
|
12201 | * | --- | --- | --- | --- | --- |
|
12202 | * | curve | Defines how mermaid renders curves for flowcharts. | string | Required | 'basis', 'linear', 'cardinal'|
|
12203 | *
|
12204 | * **Notes:**
|
12205 | *
|
12206 | * Default Vaue: 'basis'
|
12207 | */
|
12208 | curve: 'basis',
|
12209 | // Only used in new experimental rendering
|
12210 | // represents the padding between the labels and the shape
|
12211 | padding: 15,
|
12212 |
|
12213 | /**
|
12214 | * | Parameter | Description | Type | Required | Values|
|
12215 | * | --- | --- | --- | --- | --- |
|
12216 | * | useMaxWidth | See notes | boolean | 4 | true, false |
|
12217 | *
|
12218 | * **Notes:**
|
12219 | *
|
12220 | * When this flag is set the height and width is set to 100% and is then scaling with the
|
12221 | * available space if not the absolute space required is used.
|
12222 | *
|
12223 | * Default value: true
|
12224 | */
|
12225 | useMaxWidth: true,
|
12226 |
|
12227 | /**
|
12228 | * | Parameter | Description | Type | Required | Values|
|
12229 | * | --- | --- | --- | --- | --- |
|
12230 | * | defaultRenderer | See notes | boolean | 4 | dagre-d3, dagre-wrapper |
|
12231 | *
|
12232 | * **Notes:**
|
12233 | *
|
12234 | * Decides which rendering engine that is to be used for the rendering. Legal values are:
|
12235 | * * dagre-d3
|
12236 | * * dagre-wrapper - wrapper for dagre implemented in mermaid
|
12237 | *
|
12238 | * Default value: 'dagre-d3'
|
12239 | */
|
12240 | defaultRenderer: 'dagre-d3'
|
12241 | },
|
12242 |
|
12243 | /**
|
12244 | * The object containing configurations specific for sequence diagrams
|
12245 | */
|
12246 | sequence: {
|
12247 | /**
|
12248 | * | Parameter | Description | Type | Required | Values |
|
12249 | * | --- | --- | --- | --- | --- |
|
12250 | * | activationWidth | Width of the activation rect | Integer | Required | Any Positive Value |
|
12251 | *
|
12252 | *
|
12253 | * **Notes:** Default value :10
|
12254 | */
|
12255 | activationWidth: 10,
|
12256 |
|
12257 | /**
|
12258 | * | Parameter | Description | Type | Required | Values |
|
12259 | * | --- | --- | --- | --- | --- |
|
12260 | * | diagramMarginX | Margin to the right and left of the sequence diagram | Integer | Required | Any Positive Value |
|
12261 | *
|
12262 | * **Notes:** Default value: 50
|
12263 | */
|
12264 | diagramMarginX: 50,
|
12265 |
|
12266 | /**
|
12267 | *| Parameter | Description | Type | Required | Values |
|
12268 | *| --- | --- | --- | --- | --- |
|
12269 | *| diagramMarginY | Margin to the over and under the sequence diagram | Integer | Required | Any Positive Value |
|
12270 | *
|
12271 | * **Notes:** Default value: 10
|
12272 | */
|
12273 | diagramMarginY: 10,
|
12274 |
|
12275 | /**
|
12276 | * | Parameter | Description | Type | Required | Values |
|
12277 | * | --- | --- | --- | --- | --- |
|
12278 | * | actorMargin | Margin between actors | Integer | Required | Any Positive Value |
|
12279 | *
|
12280 | * **Notes:**
|
12281 | * Default value: 50
|
12282 | */
|
12283 | actorMargin: 50,
|
12284 |
|
12285 | /**
|
12286 | * | Parameter | Description | Type | Required | Values |
|
12287 | * | --- | --- | --- | --- | --- |
|
12288 | * | width | Width of actor boxes | Integer | Required | Any Positive Value |
|
12289 | *
|
12290 | * **Notes:**
|
12291 | * Default value: 150
|
12292 | */
|
12293 | width: 150,
|
12294 |
|
12295 | /**
|
12296 | * | Parameter | Description | Type | Required | Values |
|
12297 | * | --- | --- | --- | --- | --- |
|
12298 | * | height | Height of actor boxes | Integer | Required | Any Positive Value|
|
12299 | *
|
12300 | * **Notes:**
|
12301 | * Default value: 65
|
12302 | */
|
12303 | height: 65,
|
12304 |
|
12305 | /**
|
12306 | * | Parameter | Description | Type | Required | Values |
|
12307 | * | --- | --- | --- | --- | --- |
|
12308 | * | boxMargin | Margin around loop boxes | Integer | Required | Any Positive Value |
|
12309 | *
|
12310 | * **Notes:**
|
12311 | * Default value: 10
|
12312 | */
|
12313 | boxMargin: 10,
|
12314 |
|
12315 | /**
|
12316 | * | Parameter | Description | Type | Required | Values |
|
12317 | * | --- | --- | --- | --- | --- |
|
12318 | * | boxTextMargin | Margin around the text in loop/alt/opt boxes | Integer | Required | Any Positive Value |
|
12319 | *
|
12320 | * **Notes:**
|
12321 | * Default value: 5
|
12322 | */
|
12323 | boxTextMargin: 5,
|
12324 |
|
12325 | /**
|
12326 | * | Parameter | Description | Type | Required | Values |
|
12327 | * | --- | --- | --- | --- | --- |
|
12328 | * | noteMargin | margin around notes | Integer | Required | Any Positive Value |
|
12329 | *
|
12330 | * **Notes:**
|
12331 | * Default value: 10
|
12332 | */
|
12333 | noteMargin: 10,
|
12334 |
|
12335 | /**
|
12336 | * | Parameter | Description | Type | Required | Values |
|
12337 | * | --- | --- | --- | --- | --- |
|
12338 | * | messageMargin | Space between messages | Integer | Required | Any Positive Value |
|
12339 | *
|
12340 | * **Notes:**
|
12341 | * Default value: 35
|
12342 | */
|
12343 | messageMargin: 35,
|
12344 |
|
12345 | /**
|
12346 | * | Parameter | Description | Type | Required | Values |
|
12347 | * | --- | --- | --- | --- | --- |
|
12348 | * | messageAlign | Multiline message alignment | string | Required | 'left', 'center', 'right' |
|
12349 | *
|
12350 | * **Notes:**
|
12351 | * Default value: 'center'
|
12352 | */
|
12353 | messageAlign: 'center',
|
12354 |
|
12355 | /**
|
12356 | * | Parameter | Description | Type | Required | Values |
|
12357 | * | --- | --- | --- | --- | --- |
|
12358 | * | mirrorActors | Mirror actors under diagram | boolean | Required | true, false |
|
12359 | *
|
12360 | * **Notes:**
|
12361 | * Default value: true
|
12362 | */
|
12363 | mirrorActors: true,
|
12364 |
|
12365 | /**
|
12366 | *| Parameter | Description |Type | Required | Values|
|
12367 | *| --- | --- | --- | --- | --- |
|
12368 | *| forceMenus | forces actor popup menus to always be visible (to support E2E testing). | Boolean| Required | True, False |
|
12369 | *
|
12370 | * **Notes:**
|
12371 | *
|
12372 | * Default value: false.
|
12373 | */
|
12374 | forceMenus: false,
|
12375 |
|
12376 | /**
|
12377 | * | Parameter | Description | Type | Required | Values |
|
12378 | * | --- | --- | --- | --- | --- |
|
12379 | * | bottomMarginAdj | Prolongs the edge of the diagram downwards | Integer | Required | Any Positive Value |
|
12380 | *
|
12381 | * **Notes:**
|
12382 | *
|
12383 | * Depending on css styling this might need adjustment.
|
12384 | *
|
12385 | * Default value: 1
|
12386 | */
|
12387 | bottomMarginAdj: 1,
|
12388 |
|
12389 | /**
|
12390 | * | Parameter | Description | Type | Required | Values |
|
12391 | * | --- | --- | --- | --- | --- |
|
12392 | * | useMaxWidth | See Notes | boolean | Required | true, false |
|
12393 | *
|
12394 | * **Notes:**
|
12395 | * When this flag is set to true, the height and width is set to 100% and is then scaling with the
|
12396 | * available space. If set to false, the absolute space required is used.
|
12397 | *
|
12398 | * Default value: true
|
12399 | */
|
12400 | useMaxWidth: true,
|
12401 |
|
12402 | /**
|
12403 | * | Parameter | Description | Type | Required | Values |
|
12404 | * | --- | --- | --- | --- | --- |
|
12405 | * | rightAngles | display curve arrows as right angles | boolean | Required | true, false |
|
12406 | *
|
12407 | * **Notes:**
|
12408 | *
|
12409 | * This will display arrows that start and begin at the same node as right angles, rather than a curve
|
12410 | *
|
12411 | * Default value: false
|
12412 | */
|
12413 | rightAngles: false,
|
12414 |
|
12415 | /**
|
12416 | * | Parameter | Description | Type | Required | Values |
|
12417 | * | --- | --- | --- | --- | --- |
|
12418 | * | showSequenceNumbers | This will show the node numbers | boolean | Required | true, false |
|
12419 | *
|
12420 | * **Notes:**
|
12421 | * Default value: false
|
12422 | */
|
12423 | showSequenceNumbers: false,
|
12424 |
|
12425 | /**
|
12426 | * | Parameter | Description | Type | Required | Values |
|
12427 | * | --- | --- | --- | --- | --- |
|
12428 | * | actorFontSize| This sets the font size of the actor's description | Integer | Require | Any Positive Value |
|
12429 | *
|
12430 | ***Notes:**
|
12431 | ***Default value 14**..
|
12432 | */
|
12433 | actorFontSize: 14,
|
12434 |
|
12435 | /**
|
12436 | * | Parameter | Description | Type | Required | Values |
|
12437 | * | --- | --- | --- | --- | --- |
|
12438 | * | actorFontFamily |This sets the font family of the actor's description | string | Required | Any Posiable CSS FontFamily |
|
12439 | *
|
12440 | * **Notes:**
|
12441 | * Default value: "'Open-Sans", "sans-serif"'
|
12442 | */
|
12443 | actorFontFamily: '"Open-Sans", "sans-serif"',
|
12444 |
|
12445 | /**
|
12446 | * This sets the font weight of the actor's description
|
12447 | *
|
12448 | * **Notes:**
|
12449 | * Default value: 400.
|
12450 | */
|
12451 | actorFontWeight: 400,
|
12452 |
|
12453 | /**
|
12454 | * | Parameter | Description | Type | Required | Values |
|
12455 | * | --- | --- | --- | --- | --- |
|
12456 | * | noteFontSize | This sets the font size of actor-attached notes | Integer | Required | Any Positive Value |
|
12457 | *
|
12458 | * **Notes:**
|
12459 | * Default value: 14
|
12460 | */
|
12461 | noteFontSize: 14,
|
12462 |
|
12463 | /**
|
12464 | * | Parameter | Description | Type | Required | Values |
|
12465 | * | --- | --- | --- | --- | --- |
|
12466 | * | noteFontFamily| This sets the font family of actor-attached notes. | string | Required | Any Posiable CSS FontFamily |
|
12467 | *
|
12468 | * **Notes:**
|
12469 | * Default value: ''"trebuchet ms", verdana, arial, sans-serif'
|
12470 | */
|
12471 | noteFontFamily: '"trebuchet ms", verdana, arial, sans-serif',
|
12472 |
|
12473 | /**
|
12474 | * This sets the font weight of the note's description
|
12475 | *
|
12476 | * **Notes:**
|
12477 | * Default value: 400
|
12478 | */
|
12479 | noteFontWeight: 400,
|
12480 |
|
12481 | /**
|
12482 | * | Parameter | Description | Type | Required | Values |
|
12483 | * | --- | --- | --- | --- | --- |
|
12484 | * | noteAlign | This sets the text alignment of actor-attached notes | string | required | 'left', 'center', 'right'|
|
12485 | *
|
12486 | * **Notes:**
|
12487 | * Default value: 'center'
|
12488 | */
|
12489 | noteAlign: 'center',
|
12490 |
|
12491 | /**
|
12492 | * | Parameter | Description | Type | Required | Values |
|
12493 | * | --- | --- | --- | --- | --- |
|
12494 | * | messageFontSize | This sets the font size of actor messages | Integer | Required | Any Positive Number |
|
12495 | *
|
12496 | * **Notes:**
|
12497 | * Default value: 16
|
12498 | */
|
12499 | messageFontSize: 16,
|
12500 |
|
12501 | /**
|
12502 | * | Parameter | Description | Type | Required | Values |
|
12503 | * | --- | --- | --- | --- | --- |
|
12504 | * | messageFontFamily | This sets the font family of actor messages | string | Required | Any Posiable CSS FontFamily |
|
12505 | *
|
12506 | * **Notes:**
|
12507 | * Default value: '"trebuchet ms", verdana, arial, sans-serif'
|
12508 | */
|
12509 | messageFontFamily: '"trebuchet ms", verdana, arial, sans-serif',
|
12510 |
|
12511 | /**
|
12512 | * This sets the font weight of the message's description
|
12513 | *
|
12514 | * **Notes:**
|
12515 | * Default value: 400.
|
12516 | */
|
12517 | messageFontWeight: 400,
|
12518 |
|
12519 | /**
|
12520 | * This sets the auto-wrap state for the diagram
|
12521 | *
|
12522 | * **Notes:**
|
12523 | * Default value: false.
|
12524 | */
|
12525 | wrap: false,
|
12526 |
|
12527 | /**
|
12528 | * This sets the auto-wrap padding for the diagram (sides only)
|
12529 | *
|
12530 | * **Notes:**
|
12531 | * Default value: 0.
|
12532 | */
|
12533 | wrapPadding: 10,
|
12534 |
|
12535 | /**
|
12536 | * This sets the width of the loop-box (loop, alt, opt, par)
|
12537 | *
|
12538 | * **Notes:**
|
12539 | * Default value: 50.
|
12540 | */
|
12541 | labelBoxWidth: 50,
|
12542 |
|
12543 | /**
|
12544 | * This sets the height of the loop-box (loop, alt, opt, par)
|
12545 | *
|
12546 | * **Notes:**
|
12547 | * Default value: 20.
|
12548 | */
|
12549 | labelBoxHeight: 20,
|
12550 | messageFont: function messageFont() {
|
12551 | return {
|
12552 | fontFamily: this.messageFontFamily,
|
12553 | fontSize: this.messageFontSize,
|
12554 | fontWeight: this.messageFontWeight
|
12555 | };
|
12556 | },
|
12557 | noteFont: function noteFont() {
|
12558 | return {
|
12559 | fontFamily: this.noteFontFamily,
|
12560 | fontSize: this.noteFontSize,
|
12561 | fontWeight: this.noteFontWeight
|
12562 | };
|
12563 | },
|
12564 | actorFont: function actorFont() {
|
12565 | return {
|
12566 | fontFamily: this.actorFontFamily,
|
12567 | fontSize: this.actorFontSize,
|
12568 | fontWeight: this.actorFontWeight
|
12569 | };
|
12570 | }
|
12571 | },
|
12572 |
|
12573 | /**
|
12574 | * The object containing configurations specific for gantt diagrams
|
12575 | */
|
12576 | gantt: {
|
12577 | /**
|
12578 | * ### titleTopMargin
|
12579 | *
|
12580 | * | Parameter | Description | Type | Required | Values |
|
12581 | * | --- | --- | --- | --- | --- |
|
12582 | * | titleTopMargin | Margin top for the text over the gantt diagram | Integer | Required | Any Positive Value |
|
12583 | *
|
12584 | * **Notes:**
|
12585 | * Default value: 25
|
12586 | */
|
12587 | titleTopMargin: 25,
|
12588 |
|
12589 | /**
|
12590 | * | Parameter | Description | Type | Required | Values |
|
12591 | * | --- | --- | --- | --- | --- |
|
12592 | * | barHeight | The height of the bars in the graph | Integer | Required | Any Positive Value |
|
12593 | *
|
12594 | * **Notes:**
|
12595 | * Default value: 20
|
12596 | */
|
12597 | barHeight: 20,
|
12598 |
|
12599 | /**
|
12600 | * | Parameter | Description | Type | Required | Values |
|
12601 | * | --- | --- | --- | --- | --- |
|
12602 | * | barGap | The margin between the different activities in the gantt diagram | Integer | Optional | Any Positive Value |
|
12603 | *
|
12604 | * **Notes:**
|
12605 | * Default value: 4
|
12606 | */
|
12607 | barGap: 4,
|
12608 |
|
12609 | /**
|
12610 | * | Parameter | Description | Type | Required | Values|
|
12611 | * | --- | --- | --- | --- | --- |
|
12612 | * | topPadding | Margin between title and gantt diagram and between axis and gantt diagram. | Integer | Required | Any Positive Value |
|
12613 | *
|
12614 | * **Notes:**
|
12615 | * Default value: 50
|
12616 | */
|
12617 | topPadding: 50,
|
12618 |
|
12619 | /**
|
12620 | * | Parameter | Description | Type | Required | Values|
|
12621 | * | --- | --- | --- | --- | --- |
|
12622 | * | rightPadding | The space allocated for the section name to the right of the activities | Integer | Required | Any Positive Value |
|
12623 | *
|
12624 | * **Notes:**
|
12625 | * Default value: 75
|
12626 | */
|
12627 | rightPadding: 75,
|
12628 |
|
12629 | /**
|
12630 | * | Parameter | Description | Type | Required | Values|
|
12631 | * | --- | --- | --- | --- | --- |
|
12632 | * | leftPadding | The space allocated for the section name to the left of the activities | Integer | Required | Any Positive Value |
|
12633 | *
|
12634 | * **Notes:**
|
12635 | * Default value: 75
|
12636 | */
|
12637 | leftPadding: 75,
|
12638 |
|
12639 | /**
|
12640 | * | Parameter | Description | Type | Required | Values|
|
12641 | * | --- | --- | --- | --- | --- |
|
12642 | * | gridLineStartPadding | Vertical starting position of the grid lines | Integer | Required | Any Positive Value |
|
12643 | *
|
12644 | * **Notes:**
|
12645 | * Default value: 35
|
12646 | */
|
12647 | gridLineStartPadding: 35,
|
12648 |
|
12649 | /**
|
12650 | * | Parameter | Description | Type | Required | Values|
|
12651 | * | --- | --- | --- | --- | --- |
|
12652 | * | fontSize | Font size | Integer | Required | Any Positive Value |
|
12653 | *
|
12654 | * **Notes:**
|
12655 | * Default value: 11
|
12656 | */
|
12657 | fontSize: 11,
|
12658 |
|
12659 | /**
|
12660 | * | Parameter | Description | Type | Required | Values|
|
12661 | * | --- | --- | --- | --- | --- |
|
12662 | * | sectionFontSize | Font size for secions| Integer | Required | Any Positive Value |
|
12663 | *
|
12664 | * **Notes:**
|
12665 | * Default value: 11
|
12666 | */
|
12667 | sectionFontSize: 11,
|
12668 |
|
12669 | /**
|
12670 | * | Parameter | Description | Type | Required | Values|
|
12671 | * | --- | --- | --- | --- | --- |
|
12672 | * | numberSectionStyles | The number of alternating section styles | Integer | 4 | Any Positive Value |
|
12673 | *
|
12674 | * **Notes:**
|
12675 | * Default value: 4
|
12676 | */
|
12677 | numberSectionStyles: 4,
|
12678 |
|
12679 | /**
|
12680 | * | Parameter | Description | Type | Required | Values |
|
12681 | * | --- | --- | --- | --- | --- |
|
12682 | * | axisFormat | Datetime format of the axis | 3 | Required | Date in yy-mm-dd |
|
12683 | *
|
12684 | * **Notes:**
|
12685 | *
|
12686 | * This might need adjustment to match your locale and preferences
|
12687 | *
|
12688 | * Default value: '%Y-%m-%d'.
|
12689 | */
|
12690 | axisFormat: '%Y-%m-%d',
|
12691 |
|
12692 | /**
|
12693 | * | Parameter | Description | Type | Required | Values |
|
12694 | * | --- | --- | --- | --- | --- |
|
12695 | * | useMaxWidth | See notes | boolean | 4 | true, false |
|
12696 | *
|
12697 | * **Notes:**
|
12698 | *
|
12699 | * When this flag is set the height and width is set to 100% and is then scaling with the
|
12700 | * available space if not the absolute space required is used.
|
12701 | *
|
12702 | * Default value: true
|
12703 | */
|
12704 | useMaxWidth: true,
|
12705 |
|
12706 | /**
|
12707 | *| Parameter | Description |Type | Required | Values|
|
12708 | *| --- | --- | --- | --- | --- |
|
12709 | *| topAxis | See notes | Boolean | 4 | True, False |
|
12710 | *
|
12711 | ***Notes:** when this flag is set date labels will be added to the
|
12712 | top of the chart
|
12713 | *
|
12714 | ***Default value false**.
|
12715 | */
|
12716 | topAxis: false,
|
12717 | useWidth: undefined
|
12718 | },
|
12719 |
|
12720 | /**
|
12721 | * The object containing configurations specific for journey diagrams
|
12722 | */
|
12723 | journey: {
|
12724 | /**
|
12725 | * | Parameter | Description | Type | Required | Values |
|
12726 | * | --- | --- | --- | --- | --- |
|
12727 | * | diagramMarginX | Margin to the right and left of the sequence diagram | Integer | Required | Any Positive Value |
|
12728 | *
|
12729 | * **Notes:**
|
12730 | * Default value: 50
|
12731 | */
|
12732 | diagramMarginX: 50,
|
12733 |
|
12734 | /**
|
12735 | * | Parameter | Description | Type | Required | Values |
|
12736 | * | --- | --- | --- | --- | --- |
|
12737 | * | diagramMarginY | Margin to the over and under the sequence diagram. | Integer | Required | Any Positive Value |
|
12738 | *
|
12739 | * **Notes:**
|
12740 | * Default value: 10
|
12741 | */
|
12742 | diagramMarginY: 10,
|
12743 |
|
12744 | /**
|
12745 | * | Parameter | Description | Type | Required | Values |
|
12746 | * | --- | --- | --- | --- | --- |
|
12747 | * | actorMargin | Margin between actors | Integer | Required | Any Positive Value |
|
12748 | *
|
12749 | * **Notes:**
|
12750 | * Default value: 50
|
12751 | */
|
12752 | leftMargin: 150,
|
12753 |
|
12754 | /**
|
12755 | * | Parameter | Description | Type | Required | Values |
|
12756 | * | --- | --- | --- | --- | --- |
|
12757 | * | width | Width of actor boxes | Integer | Required | Any Positive Value |
|
12758 | *
|
12759 | * **Notes:**
|
12760 | * Default value: 150
|
12761 | */
|
12762 | width: 150,
|
12763 |
|
12764 | /**
|
12765 | * | Parameter | Description | Type | Required | Values |
|
12766 | * | --- | --- | --- | --- | --- |
|
12767 | * | height | Height of actor boxes | Integer | Required | Any Positive Value |
|
12768 | *
|
12769 | * **Notes:**
|
12770 | * Default value: 65
|
12771 | */
|
12772 | height: 50,
|
12773 |
|
12774 | /**
|
12775 | *| Parameter | Description |Type | Required | Values|
|
12776 | *| --- | --- | --- | --- | --- |
|
12777 | *| boxMargin | Margin around loop boxes | Integer | Required | Any Positive Value |
|
12778 | *
|
12779 | * **Notes:**
|
12780 | * Default value: 10
|
12781 | */
|
12782 | boxMargin: 10,
|
12783 |
|
12784 | /**
|
12785 | * | Parameter | Description | Type | Required | Values |
|
12786 | * | --- | --- | --- | --- | --- |
|
12787 | * | boxTextMargin | Margin around the text in loop/alt/opt boxes | Integer | Required | Any Positive Value |
|
12788 | *
|
12789 | * **Notes:**
|
12790 | * Default value: 5
|
12791 | */
|
12792 | boxTextMargin: 5,
|
12793 |
|
12794 | /**
|
12795 | * | Parameter | Description | Type | Required | Values |
|
12796 | * | --- | --- | --- | --- | --- |
|
12797 | * | noteMargin | Margin around notes | Integer | Required | Any Positive Value |
|
12798 | *
|
12799 | * **Notes:**
|
12800 | * Default value: 10
|
12801 | */
|
12802 | noteMargin: 10,
|
12803 |
|
12804 | /**
|
12805 | * | Parameter | Description | Type | Required | Values |
|
12806 | * | --- | --- | --- | --- | --- |
|
12807 | * | messageMargin |Space between messages. | Integer | Required | Any Positive Value |
|
12808 | *
|
12809 | * **Notes:**
|
12810 | *
|
12811 | * Space between messages.
|
12812 | *
|
12813 | * Default value: 35
|
12814 | */
|
12815 | messageMargin: 35,
|
12816 |
|
12817 | /**
|
12818 | * | Parameter | Description | Type | Required | Values |
|
12819 | * | --- | --- | --- | --- | --- |
|
12820 | * | messageAlign | Multiline message alignment | 3 | 4 | 'left', 'center', 'right' |
|
12821 | *
|
12822 | * **Notes:**
|
12823 | * Default value: 'center'
|
12824 | */
|
12825 | messageAlign: 'center',
|
12826 |
|
12827 | /**
|
12828 | * | Parameter | Description | Type | Required | Values |
|
12829 | * | --- | --- | --- | --- | --- |
|
12830 | * | bottomMarginAdj | Prolongs the edge of the diagram downwards | Integer | 4 | Any Positive Value |
|
12831 | *
|
12832 | * **Notes:**
|
12833 | *
|
12834 | * Depending on css styling this might need adjustment.
|
12835 | *
|
12836 | * Default value: 1
|
12837 | */
|
12838 | bottomMarginAdj: 1,
|
12839 |
|
12840 | /**
|
12841 | * | Parameter | Description | Type | Required | Values |
|
12842 | * | --- | --- | --- | --- | --- |
|
12843 | * | useMaxWidth | See notes | boolean | 4 | true, false |
|
12844 | *
|
12845 | * **Notes:**
|
12846 | *
|
12847 | * When this flag is set the height and width is set to 100% and is then scaling with the
|
12848 | * available space if not the absolute space required is used.
|
12849 | *
|
12850 | * Default value: true
|
12851 | */
|
12852 | useMaxWidth: true,
|
12853 |
|
12854 | /**
|
12855 | * | Parameter | Description | Type | Required | Values |
|
12856 | * | --- | --- | --- | --- | --- |
|
12857 | * | rightAngles | Curved Arrows become Right Angles | 3 | 4 | true, false |
|
12858 | *
|
12859 | * **Notes:**
|
12860 | *
|
12861 | * This will display arrows that start and begin at the same node as right angles, rather than a curves
|
12862 | *
|
12863 | * Default value: false
|
12864 | */
|
12865 | rightAngles: false,
|
12866 | taskFontSize: 14,
|
12867 | taskFontFamily: '"Open-Sans", "sans-serif"',
|
12868 | taskMargin: 50,
|
12869 | // width of activation box
|
12870 | activationWidth: 10,
|
12871 | // text placement as: tspan | fo | old only text as before
|
12872 | textPlacement: 'fo',
|
12873 | actorColours: ['#8FBC8F', '#7CFC00', '#00FFFF', '#20B2AA', '#B0E0E6', '#FFFFE0'],
|
12874 | sectionFills: ['#191970', '#8B008B', '#4B0082', '#2F4F4F', '#800000', '#8B4513', '#00008B'],
|
12875 | sectionColours: ['#fff']
|
12876 | },
|
12877 | class: {
|
12878 | arrowMarkerAbsolute: false,
|
12879 |
|
12880 | /**
|
12881 | * | Parameter | Description | Type | Required | Values |
|
12882 | * | --- | --- | --- | --- | --- |
|
12883 | * | useMaxWidth | See notes | boolean | 4 | true, false |
|
12884 | *
|
12885 | * **Notes:**
|
12886 | *
|
12887 | * When this flag is set the height and width is set to 100% and is then scaling with the
|
12888 | * available space if not the absolute space required is used.
|
12889 | *
|
12890 | * Default value: true
|
12891 | */
|
12892 | useMaxWidth: true,
|
12893 |
|
12894 | /**
|
12895 | * | Parameter | Description | Type | Required | Values|
|
12896 | * | --- | --- | --- | --- | --- |
|
12897 | * | defaultRenderer | See notes | boolean | 4 | dagre-d3, dagre-wrapper |
|
12898 | *
|
12899 | * **Notes:**
|
12900 | *
|
12901 | * Decides which rendering engine that is to be used for the rendering. Legal values are:
|
12902 | * * dagre-d3
|
12903 | * * dagre-wrapper - wrapper for dagre implemented in mermaid
|
12904 | *
|
12905 | * Default value: 'dagre-d3'
|
12906 | */
|
12907 | defaultRenderer: 'dagre-wrapper'
|
12908 | },
|
12909 | git: {
|
12910 | arrowMarkerAbsolute: false,
|
12911 | useWidth: undefined,
|
12912 |
|
12913 | /**
|
12914 | * | Parameter | Description | Type | Required | Values |
|
12915 | * | --- | --- | --- | --- | --- |
|
12916 | * | useMaxWidth | See notes | boolean | 4 | true, false |
|
12917 | *
|
12918 | * **Notes:**
|
12919 | *
|
12920 | * When this flag is set the height and width is set to 100% and is then scaling with the
|
12921 | * available space if not the absolute space required is used.
|
12922 | *
|
12923 | * Default value: true
|
12924 | */
|
12925 | useMaxWidth: true
|
12926 | },
|
12927 | state: {
|
12928 | dividerMargin: 10,
|
12929 | sizeUnit: 5,
|
12930 | padding: 8,
|
12931 | textHeight: 10,
|
12932 | titleShift: -15,
|
12933 | noteMargin: 10,
|
12934 | forkWidth: 70,
|
12935 | forkHeight: 7,
|
12936 | // Used
|
12937 | miniPadding: 2,
|
12938 | // Font size factor, this is used to guess the width of the edges labels before rendering by dagre
|
12939 | // layout. This might need updating if/when switching font
|
12940 | fontSizeFactor: 5.02,
|
12941 | fontSize: 24,
|
12942 | labelHeight: 16,
|
12943 | edgeLengthFactor: '20',
|
12944 | compositTitleSize: 35,
|
12945 | radius: 5,
|
12946 |
|
12947 | /**
|
12948 | * | Parameter | Description | Type | Required | Values |
|
12949 | * | --- | --- | --- | --- | --- |
|
12950 | * | useMaxWidth | See notes | boolean | 4 | true, false |
|
12951 | *
|
12952 | * **Notes:**
|
12953 | *
|
12954 | * When this flag is set the height and width is set to 100% and is then scaling with the
|
12955 | * available space if not the absolute space required is used.
|
12956 | *
|
12957 | * Default value: true
|
12958 | */
|
12959 | useMaxWidth: true,
|
12960 |
|
12961 | /**
|
12962 | * | Parameter | Description | Type | Required | Values|
|
12963 | * | --- | --- | --- | --- | --- |
|
12964 | * | defaultRenderer | See notes | boolean | 4 | dagre-d3, dagre-wrapper |
|
12965 | *
|
12966 | * **Notes:**
|
12967 | *
|
12968 | * Decides which rendering engine that is to be used for the rendering. Legal values are:
|
12969 | * * dagre-d3
|
12970 | * * dagre-wrapper - wrapper for dagre implemented in mermaid
|
12971 | *
|
12972 | * Default value: 'dagre-d3'
|
12973 | */
|
12974 | defaultRenderer: 'dagre-wrapper'
|
12975 | },
|
12976 |
|
12977 | /**
|
12978 | * The object containing configurations specific for entity relationship diagrams
|
12979 | */
|
12980 | er: {
|
12981 | /**
|
12982 | * | Parameter | Description | Type | Required | Values |
|
12983 | * | --- | --- | --- | --- | --- |
|
12984 | * | diagramPadding | Amount of padding around the diagram as a whole | Integer | Required | Any Positive Value |
|
12985 | *
|
12986 | * **Notes:**
|
12987 | *
|
12988 | * The amount of padding around the diagram as a whole so that embedded diagrams have margins, expressed in pixels
|
12989 | *
|
12990 | * Default value: 20
|
12991 | */
|
12992 | diagramPadding: 20,
|
12993 |
|
12994 | /**
|
12995 | * | Parameter | Description | Type | Required | Values |
|
12996 | * | --- | --- | --- | --- | --- |
|
12997 | * | layoutDirection | Directional bias for layout of entities. | string | Required | "TB", "BT", "LR", "RL" |
|
12998 | *
|
12999 | * **Notes:**
|
13000 | *
|
13001 | * 'TB' for Top-Bottom, 'BT'for Bottom-Top, 'LR' for Left-Right, or 'RL' for Right to Left.
|
13002 | *
|
13003 | * T = top, B = bottom, L = left, and R = right.
|
13004 | *
|
13005 | * Default value: 'TB'
|
13006 | */
|
13007 | layoutDirection: 'TB',
|
13008 |
|
13009 | /**
|
13010 | * | Parameter | Description | Type | Required | Values |
|
13011 | * | --- | --- | --- | --- | --- |
|
13012 | * | minEntityWidth | The mimimum width of an entity box | Integer | Required | Any Positive Value |
|
13013 | *
|
13014 | * **Notes:**
|
13015 | * Expressed in pixels.
|
13016 | * Default value: 100
|
13017 | */
|
13018 | minEntityWidth: 100,
|
13019 |
|
13020 | /**
|
13021 | * | Parameter | Description | Type | Required | Values |
|
13022 | * | --- | --- | --- | --- | --- |
|
13023 | * | minEntityHeight| The minimum height of an entity box | Integer | 4 | Any Positive Value |
|
13024 | *
|
13025 | * **Notes:**
|
13026 | * Expressed in pixels
|
13027 | * Default value: 75
|
13028 | */
|
13029 | minEntityHeight: 75,
|
13030 |
|
13031 | /**
|
13032 | * | Parameter | Description | Type | Required | Values |
|
13033 | * | --- | --- | --- | --- | --- |
|
13034 | * | entityPadding | Minimum internal padding betweentext in box and box borders | Integer | 4 | Any Positive Value |
|
13035 | *
|
13036 | * **Notes:**
|
13037 | *
|
13038 | * The minimum internal padding betweentext in an entity box and the enclosing box borders, expressed in pixels.
|
13039 | *
|
13040 | * Default value: 15
|
13041 | */
|
13042 | entityPadding: 15,
|
13043 |
|
13044 | /**
|
13045 | * | Parameter | Description | Type | Required | Values |
|
13046 | * | --- | --- | --- | --- | --- |
|
13047 | * | stroke | Stroke color of box edges and lines | string | 4 | Any recognized color |
|
13048 | *
|
13049 | * **Notes:**
|
13050 | * Default value: 'gray'
|
13051 | */
|
13052 | stroke: 'gray',
|
13053 |
|
13054 | /**
|
13055 | * | Parameter | Description | Type | Required | Values |
|
13056 | * | --- | --- | --- | --- | --- |
|
13057 | * | fill | Fill color of entity boxes | string | 4 | Any recognized color |
|
13058 | *
|
13059 | * **Notes:**
|
13060 | * Default value: 'honeydew'
|
13061 | */
|
13062 | fill: 'honeydew',
|
13063 |
|
13064 | /**
|
13065 | * | Parameter | Description | Type | Required | Values |
|
13066 | * | --- | --- | --- | --- | --- |
|
13067 | * | fontSize | Font Size in pixels | Integer | | Any Positive Value |
|
13068 | *
|
13069 | * **Notes:**
|
13070 | *
|
13071 | * Font size (expressed as an integer representing a number of pixels)
|
13072 | * Default value: 12
|
13073 | */
|
13074 | fontSize: 12,
|
13075 |
|
13076 | /**
|
13077 | * | Parameter | Description | Type | Required | Values |
|
13078 | * | --- | --- | --- | --- | --- |
|
13079 | * | useMaxWidth | See Notes | boolean | Required | true, false |
|
13080 | *
|
13081 | * **Notes:**
|
13082 | *
|
13083 | * When this flag is set to true, the diagram width is locked to 100% and
|
13084 | * scaled based on available space. If set to false, the diagram reserves its
|
13085 | * absolute width.
|
13086 | *
|
13087 | * Default value: true
|
13088 | */
|
13089 | useMaxWidth: true
|
13090 | },
|
13091 |
|
13092 | /**
|
13093 | * The object containing configurations specific for pie diagrams
|
13094 | */
|
13095 | pie: {
|
13096 | useWidth: undefined,
|
13097 |
|
13098 | /**
|
13099 | * | Parameter | Description | Type | Required | Values |
|
13100 | * | --- | --- | --- | --- | --- |
|
13101 | * | useMaxWidth | See Notes | boolean | Required | true, false |
|
13102 | *
|
13103 | * **Notes:**
|
13104 | *
|
13105 | * When this flag is set to true, the diagram width is locked to 100% and
|
13106 | * scaled based on available space. If set to false, the diagram reserves its
|
13107 | * absolute width.
|
13108 | *
|
13109 | * Default value: true
|
13110 | */
|
13111 | useMaxWidth: true
|
13112 | },
|
13113 |
|
13114 | /**
|
13115 | * The object containing configurations specific for req diagrams
|
13116 | */
|
13117 | requirement: {
|
13118 | useWidth: undefined,
|
13119 |
|
13120 | /**
|
13121 | * | Parameter | Description | Type | Required | Values |
|
13122 | * | --- | --- | --- | --- | --- |
|
13123 | * | useMaxWidth | See Notes | boolean | Required | true, false |
|
13124 | *
|
13125 | * **Notes:**
|
13126 | *
|
13127 | * When this flag is set to true, the diagram width is locked to 100% and
|
13128 | * scaled based on available space. If set to false, the diagram reserves its
|
13129 | * absolute width.
|
13130 | *
|
13131 | * Default value: true
|
13132 | */
|
13133 | useMaxWidth: true,
|
13134 | rect_fill: '#f9f9f9',
|
13135 | text_color: '#333',
|
13136 | rect_border_size: '0.5px',
|
13137 | rect_border_color: '#bbb',
|
13138 | rect_min_width: 200,
|
13139 | rect_min_height: 200,
|
13140 | fontSize: 14,
|
13141 | rect_padding: 10,
|
13142 | line_height: 20
|
13143 | }
|
13144 | };
|
13145 | config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
|
13146 | config.git.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
|
13147 |
|
13148 | var keyify = function keyify(obj) {
|
13149 | var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
13150 | return Object.keys(obj).reduce(function (res, el) {
|
13151 | if (Array.isArray(obj[el])) {
|
13152 | return res;
|
13153 | } else if (_typeof(obj[el]) === 'object' && obj[el] !== null) {
|
13154 | return [].concat(_toConsumableArray(res), [prefix + el], _toConsumableArray(keyify(obj[el], '')));
|
13155 | }
|
13156 |
|
13157 | return [].concat(_toConsumableArray(res), [prefix + el]);
|
13158 | }, []);
|
13159 | };
|
13160 |
|
13161 | var configKeys = keyify(config, '');
|
13162 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (config);
|
13163 |
|
13164 | /***/ }),
|
13165 |
|
13166 | /***/ "./src/diagrams/class/classDb.js":
|
13167 | /*!***************************************!*\
|
13168 | !*** ./src/diagrams/class/classDb.js ***!
|
13169 | \***************************************/
|
13170 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
13171 |
|
13172 | "use strict";
|
13173 | __webpack_require__.r(__webpack_exports__);
|
13174 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
13175 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
13176 | /* harmony export */ "addClass": () => (/* binding */ addClass),
|
13177 | /* harmony export */ "lookUpDomId": () => (/* binding */ lookUpDomId),
|
13178 | /* harmony export */ "clear": () => (/* binding */ clear),
|
13179 | /* harmony export */ "getClass": () => (/* binding */ getClass),
|
13180 | /* harmony export */ "getClasses": () => (/* binding */ getClasses),
|
13181 | /* harmony export */ "getRelations": () => (/* binding */ getRelations),
|
13182 | /* harmony export */ "addRelation": () => (/* binding */ addRelation),
|
13183 | /* harmony export */ "addAnnotation": () => (/* binding */ addAnnotation),
|
13184 | /* harmony export */ "addMember": () => (/* binding */ addMember),
|
13185 | /* harmony export */ "addMembers": () => (/* binding */ addMembers),
|
13186 | /* harmony export */ "cleanupLabel": () => (/* binding */ cleanupLabel),
|
13187 | /* harmony export */ "setCssClass": () => (/* binding */ setCssClass),
|
13188 | /* harmony export */ "setLink": () => (/* binding */ setLink),
|
13189 | /* harmony export */ "setClickEvent": () => (/* binding */ setClickEvent),
|
13190 | /* harmony export */ "bindFunctions": () => (/* binding */ bindFunctions),
|
13191 | /* harmony export */ "lineType": () => (/* binding */ lineType),
|
13192 | /* harmony export */ "relationType": () => (/* binding */ relationType),
|
13193 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
13194 | /* harmony export */ });
|
13195 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
13196 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
13197 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
13198 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
13199 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
13200 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
13201 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
13202 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
13203 |
|
13204 | 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."); }
|
13205 |
|
13206 | 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); }
|
13207 |
|
13208 | function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
13209 |
|
13210 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
13211 |
|
13212 | 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; }
|
13213 |
|
13214 |
|
13215 |
|
13216 |
|
13217 |
|
13218 |
|
13219 |
|
13220 | var MERMAID_DOM_ID_PREFIX = 'classid-';
|
13221 | var relations = [];
|
13222 | var classes = {};
|
13223 | var classCounter = 0;
|
13224 | var funs = [];
|
13225 | var parseDirective = function parseDirective(statement, context, type) {
|
13226 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].parseDirective(this, statement, context, type);
|
13227 | };
|
13228 |
|
13229 | var splitClassNameAndType = function splitClassNameAndType(id) {
|
13230 | var genericType = '';
|
13231 | var className = id;
|
13232 |
|
13233 | if (id.indexOf('~') > 0) {
|
13234 | var split = id.split('~');
|
13235 | className = split[0];
|
13236 | genericType = split[1];
|
13237 | }
|
13238 |
|
13239 | return {
|
13240 | className: className,
|
13241 | type: genericType
|
13242 | };
|
13243 | };
|
13244 | /**
|
13245 | * Function called by parser when a node definition has been found.
|
13246 | * @param id
|
13247 | * @public
|
13248 | */
|
13249 |
|
13250 |
|
13251 | var addClass = function addClass(id) {
|
13252 | var classId = splitClassNameAndType(id); // Only add class if not exists
|
13253 |
|
13254 | if (typeof classes[classId.className] !== 'undefined') return;
|
13255 | classes[classId.className] = {
|
13256 | id: classId.className,
|
13257 | type: classId.type,
|
13258 | cssClasses: [],
|
13259 | methods: [],
|
13260 | members: [],
|
13261 | annotations: [],
|
13262 | domId: MERMAID_DOM_ID_PREFIX + classId.className + '-' + classCounter
|
13263 | };
|
13264 | classCounter++;
|
13265 | };
|
13266 | /**
|
13267 | * Function to lookup domId from id in the graph definition.
|
13268 | * @param id
|
13269 | * @public
|
13270 | */
|
13271 |
|
13272 | var lookUpDomId = function lookUpDomId(id) {
|
13273 | var classKeys = Object.keys(classes);
|
13274 |
|
13275 | for (var i = 0; i < classKeys.length; i++) {
|
13276 | if (classes[classKeys[i]].id === id) {
|
13277 | return classes[classKeys[i]].domId;
|
13278 | }
|
13279 | }
|
13280 | };
|
13281 | var clear = function clear() {
|
13282 | relations = [];
|
13283 | classes = {};
|
13284 | funs = [];
|
13285 | funs.push(setupToolTips);
|
13286 | };
|
13287 | var getClass = function getClass(id) {
|
13288 | return classes[id];
|
13289 | };
|
13290 | var getClasses = function getClasses() {
|
13291 | return classes;
|
13292 | };
|
13293 | var getRelations = function getRelations() {
|
13294 | return relations;
|
13295 | };
|
13296 | var addRelation = function addRelation(relation) {
|
13297 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('Adding relation: ' + JSON.stringify(relation));
|
13298 | addClass(relation.id1);
|
13299 | addClass(relation.id2);
|
13300 | relation.id1 = splitClassNameAndType(relation.id1).className;
|
13301 | relation.id2 = splitClassNameAndType(relation.id2).className;
|
13302 | relations.push(relation);
|
13303 | };
|
13304 | /**
|
13305 | * Adds an annotation to the specified class
|
13306 | * Annotations mark special properties of the given type (like 'interface' or 'service')
|
13307 | * @param className The class name
|
13308 | * @param annotation The name of the annotation without any brackets
|
13309 | * @public
|
13310 | */
|
13311 |
|
13312 | var addAnnotation = function addAnnotation(className, annotation) {
|
13313 | var validatedClassName = splitClassNameAndType(className).className;
|
13314 | classes[validatedClassName].annotations.push(annotation);
|
13315 | };
|
13316 | /**
|
13317 | * Adds a member to the specified class
|
13318 | * @param className The class name
|
13319 | * @param member The full name of the member.
|
13320 | * If the member is enclosed in <<brackets>> it is treated as an annotation
|
13321 | * If the member is ending with a closing bracket ) it is treated as a method
|
13322 | * Otherwise the member will be treated as a normal property
|
13323 | * @public
|
13324 | */
|
13325 |
|
13326 | var addMember = function addMember(className, member) {
|
13327 | var validatedClassName = splitClassNameAndType(className).className;
|
13328 | var theClass = classes[validatedClassName];
|
13329 |
|
13330 | if (typeof member === 'string') {
|
13331 | // Member can contain white spaces, we trim them out
|
13332 | var memberString = member.trim();
|
13333 |
|
13334 | if (memberString.startsWith('<<') && memberString.endsWith('>>')) {
|
13335 | // Remove leading and trailing brackets
|
13336 | theClass.annotations.push(memberString.substring(2, memberString.length - 2));
|
13337 | } else if (memberString.indexOf(')') > 0) {
|
13338 | theClass.methods.push(memberString);
|
13339 | } else if (memberString) {
|
13340 | theClass.members.push(memberString);
|
13341 | }
|
13342 | }
|
13343 | };
|
13344 | var addMembers = function addMembers(className, members) {
|
13345 | if (Array.isArray(members)) {
|
13346 | members.reverse();
|
13347 | members.forEach(function (member) {
|
13348 | return addMember(className, member);
|
13349 | });
|
13350 | }
|
13351 | };
|
13352 | var cleanupLabel = function cleanupLabel(label) {
|
13353 | if (label.substring(0, 1) === ':') {
|
13354 | return label.substr(1).trim();
|
13355 | } else {
|
13356 | return label.trim();
|
13357 | }
|
13358 | };
|
13359 | /**
|
13360 | * Called by parser when a special node is found, e.g. a clickable element.
|
13361 | * @param ids Comma separated list of ids
|
13362 | * @param className Class to add
|
13363 | */
|
13364 |
|
13365 | var setCssClass = function setCssClass(ids, className) {
|
13366 | ids.split(',').forEach(function (_id) {
|
13367 | var id = _id;
|
13368 | if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
13369 |
|
13370 | if (typeof classes[id] !== 'undefined') {
|
13371 | classes[id].cssClasses.push(className);
|
13372 | }
|
13373 | });
|
13374 | };
|
13375 | /**
|
13376 | * Called by parser when a tooltip is found, e.g. a clickable element.
|
13377 | * @param ids Comma separated list of ids
|
13378 | * @param tooltip Tooltip to add
|
13379 | */
|
13380 |
|
13381 | var setTooltip = function setTooltip(ids, tooltip) {
|
13382 | var config = _config__WEBPACK_IMPORTED_MODULE_3__.getConfig();
|
13383 | ids.split(',').forEach(function (id) {
|
13384 | if (typeof tooltip !== 'undefined') {
|
13385 | classes[id].tooltip = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].sanitizeText(tooltip, config);
|
13386 | }
|
13387 | });
|
13388 | };
|
13389 | /**
|
13390 | * Called by parser when a link is found. Adds the URL to the vertex data.
|
13391 | * @param ids Comma separated list of ids
|
13392 | * @param linkStr URL to create a link for
|
13393 | * @param target Target of the link, _blank by default as originally defined in the svgDraw.js file
|
13394 | */
|
13395 |
|
13396 |
|
13397 | var setLink = function setLink(ids, linkStr, target) {
|
13398 | var config = _config__WEBPACK_IMPORTED_MODULE_3__.getConfig();
|
13399 | ids.split(',').forEach(function (_id) {
|
13400 | var id = _id;
|
13401 | if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
13402 |
|
13403 | if (typeof classes[id] !== 'undefined') {
|
13404 | classes[id].link = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].formatUrl(linkStr, config);
|
13405 |
|
13406 | if (typeof target === 'string') {
|
13407 | classes[id].linkTarget = target;
|
13408 | } else {
|
13409 | classes[id].linkTarget = '_blank';
|
13410 | }
|
13411 | }
|
13412 | });
|
13413 | setCssClass(ids, 'clickable');
|
13414 | };
|
13415 | /**
|
13416 | * Called by parser when a click definition is found. Registers an event handler.
|
13417 | * @param ids Comma separated list of ids
|
13418 | * @param functionName Function to be called on click
|
13419 | * @param functionArgs Function args the function should be called with
|
13420 | */
|
13421 |
|
13422 | var setClickEvent = function setClickEvent(ids, functionName, functionArgs) {
|
13423 | ids.split(',').forEach(function (id) {
|
13424 | setClickFunc(id, functionName, functionArgs);
|
13425 | classes[id].haveCallback = true;
|
13426 | });
|
13427 | setCssClass(ids, 'clickable');
|
13428 | };
|
13429 |
|
13430 | var setClickFunc = function setClickFunc(domId, functionName, functionArgs) {
|
13431 | var config = _config__WEBPACK_IMPORTED_MODULE_3__.getConfig();
|
13432 | var id = domId;
|
13433 | var elemId = lookUpDomId(id);
|
13434 |
|
13435 | if (config.securityLevel !== 'loose') {
|
13436 | return;
|
13437 | }
|
13438 |
|
13439 | if (typeof functionName === 'undefined') {
|
13440 | return;
|
13441 | }
|
13442 |
|
13443 | if (typeof classes[id] !== 'undefined') {
|
13444 | var argList = [];
|
13445 |
|
13446 | if (typeof functionArgs === 'string') {
|
13447 | /* Splits functionArgs by ',', ignoring all ',' in double quoted strings */
|
13448 | argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
|
13449 |
|
13450 | for (var i = 0; i < argList.length; i++) {
|
13451 | var item = argList[i].trim();
|
13452 | /* Removes all double quotes at the start and end of an argument */
|
13453 |
|
13454 | /* This preserves all starting and ending whitespace inside */
|
13455 |
|
13456 | if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
|
13457 | item = item.substr(1, item.length - 2);
|
13458 | }
|
13459 |
|
13460 | argList[i] = item;
|
13461 | }
|
13462 | }
|
13463 | /* if no arguments passed into callback, default to passing in id */
|
13464 |
|
13465 |
|
13466 | if (argList.length === 0) {
|
13467 | argList.push(elemId);
|
13468 | }
|
13469 |
|
13470 | funs.push(function () {
|
13471 | var elem = document.querySelector("[id=\"".concat(elemId, "\"]"));
|
13472 |
|
13473 | if (elem !== null) {
|
13474 | elem.addEventListener('click', function () {
|
13475 | _utils__WEBPACK_IMPORTED_MODULE_5__["default"].runFunc.apply(_utils__WEBPACK_IMPORTED_MODULE_5__["default"], [functionName].concat(_toConsumableArray(argList)));
|
13476 | }, false);
|
13477 | }
|
13478 | });
|
13479 | }
|
13480 | };
|
13481 |
|
13482 | var bindFunctions = function bindFunctions(element) {
|
13483 | funs.forEach(function (fun) {
|
13484 | fun(element);
|
13485 | });
|
13486 | };
|
13487 | var lineType = {
|
13488 | LINE: 0,
|
13489 | DOTTED_LINE: 1
|
13490 | };
|
13491 | var relationType = {
|
13492 | AGGREGATION: 0,
|
13493 | EXTENSION: 1,
|
13494 | COMPOSITION: 2,
|
13495 | DEPENDENCY: 3
|
13496 | };
|
13497 |
|
13498 | var setupToolTips = function setupToolTips(element) {
|
13499 | var tooltipElem = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('.mermaidTooltip');
|
13500 |
|
13501 | if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
|
13502 | tooltipElem = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
|
13503 | }
|
13504 |
|
13505 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(element).select('svg');
|
13506 | var nodes = svg.selectAll('g.node');
|
13507 | nodes.on('mouseover', function () {
|
13508 | var el = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(this);
|
13509 | var title = el.attr('title'); // Dont try to draw a tooltip if no data is provided
|
13510 |
|
13511 | if (title === null) {
|
13512 | return;
|
13513 | }
|
13514 |
|
13515 | var rect = this.getBoundingClientRect();
|
13516 | tooltipElem.transition().duration(200).style('opacity', '.9');
|
13517 | tooltipElem.html(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');
|
13518 | el.classed('hover', true);
|
13519 | }).on('mouseout', function () {
|
13520 | tooltipElem.transition().duration(500).style('opacity', 0);
|
13521 | var el = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(this);
|
13522 | el.classed('hover', false);
|
13523 | });
|
13524 | };
|
13525 |
|
13526 | funs.push(setupToolTips);
|
13527 | var direction = 'TB';
|
13528 |
|
13529 | var getDirection = function getDirection() {
|
13530 | return direction;
|
13531 | };
|
13532 |
|
13533 | var setDirection = function setDirection(dir) {
|
13534 | direction = dir;
|
13535 | };
|
13536 |
|
13537 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
13538 | parseDirective: parseDirective,
|
13539 | getConfig: function getConfig() {
|
13540 | return _config__WEBPACK_IMPORTED_MODULE_3__.getConfig().class;
|
13541 | },
|
13542 | addClass: addClass,
|
13543 | bindFunctions: bindFunctions,
|
13544 | clear: clear,
|
13545 | getClass: getClass,
|
13546 | getClasses: getClasses,
|
13547 | addAnnotation: addAnnotation,
|
13548 | getRelations: getRelations,
|
13549 | addRelation: addRelation,
|
13550 | getDirection: getDirection,
|
13551 | setDirection: setDirection,
|
13552 | addMember: addMember,
|
13553 | addMembers: addMembers,
|
13554 | cleanupLabel: cleanupLabel,
|
13555 | lineType: lineType,
|
13556 | relationType: relationType,
|
13557 | setClickEvent: setClickEvent,
|
13558 | setCssClass: setCssClass,
|
13559 | setLink: setLink,
|
13560 | setTooltip: setTooltip,
|
13561 | lookUpDomId: lookUpDomId
|
13562 | });
|
13563 |
|
13564 | /***/ }),
|
13565 |
|
13566 | /***/ "./src/diagrams/class/classRenderer-v2.js":
|
13567 | /*!************************************************!*\
|
13568 | !*** ./src/diagrams/class/classRenderer-v2.js ***!
|
13569 | \************************************************/
|
13570 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
13571 |
|
13572 | "use strict";
|
13573 | __webpack_require__.r(__webpack_exports__);
|
13574 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
13575 | /* harmony export */ "addClasses": () => (/* binding */ addClasses),
|
13576 | /* harmony export */ "addRelations": () => (/* binding */ addRelations),
|
13577 | /* harmony export */ "setConf": () => (/* binding */ setConf),
|
13578 | /* harmony export */ "drawOld": () => (/* binding */ drawOld),
|
13579 | /* harmony export */ "draw": () => (/* binding */ draw),
|
13580 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
13581 | /* harmony export */ });
|
13582 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
13583 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
13584 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
|
13585 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
|
13586 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
|
13587 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
|
13588 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
13589 | /* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js");
|
13590 | /* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison");
|
13591 | /* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__);
|
13592 | /* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/class/svgDraw.js");
|
13593 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
13594 | /* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
|
13595 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
13596 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
13597 |
|
13598 |
|
13599 |
|
13600 |
|
13601 |
|
13602 |
|
13603 |
|
13604 |
|
13605 | // import addHtmlLabel from 'dagre-d3/lib/label/add-html-label.js';
|
13606 |
|
13607 |
|
13608 |
|
13609 |
|
13610 | _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"];
|
13611 | var idCache = {};
|
13612 | var padding = 20;
|
13613 | var conf = {
|
13614 | dividerMargin: 10,
|
13615 | padding: 5,
|
13616 | textHeight: 10
|
13617 | };
|
13618 | /**
|
13619 | * Function that adds the vertices found during parsing to the graph to be rendered.
|
13620 | * @param vert Object containing the vertices.
|
13621 | * @param g The graph that is to be drawn.
|
13622 | */
|
13623 |
|
13624 | var addClasses = function addClasses(classes, g) {
|
13625 | // const svg = select(`[id="${svgId}"]`);
|
13626 | var keys = Object.keys(classes);
|
13627 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('keys:', keys);
|
13628 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info(classes); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
|
13629 |
|
13630 | keys.forEach(function (id) {
|
13631 | var vertex = classes[id];
|
13632 | /**
|
13633 | * Variable for storing the classes for the vertex
|
13634 | * @type {string}
|
13635 | */
|
13636 |
|
13637 | var cssClassStr = '';
|
13638 |
|
13639 | if (vertex.cssClasses.length > 0) {
|
13640 | cssClassStr = cssClassStr + ' ' + vertex.cssClasses.join(' ');
|
13641 | } // if (vertex.classes.length > 0) {
|
13642 | // classStr = vertex.classes.join(' ');
|
13643 | // }
|
13644 |
|
13645 |
|
13646 | var styles = {
|
13647 | labelStyle: ''
|
13648 | }; //getStylesFromArray(vertex.styles);
|
13649 | // Use vertex id as text in the box if no text is provided by the graph definition
|
13650 |
|
13651 | var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
|
13652 | // let vertexNode;
|
13653 | // if (evaluate(getConfig().flowchart.htmlLabels)) {
|
13654 | // const node = {
|
13655 | // label: vertexText.replace(
|
13656 | // /fa[lrsb]?:fa-[\w-]+/g,
|
13657 | // s => `<i class='${s.replace(':', ' ')}'></i>`
|
13658 | // )
|
13659 | // };
|
13660 | // vertexNode = addHtmlLabel(svg, node).node();
|
13661 | // vertexNode.parentNode.removeChild(vertexNode);
|
13662 | // } else {
|
13663 | // const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
13664 | // svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
|
13665 | // const rows = vertexText.split(common.lineBreakRegex);
|
13666 | // for (let j = 0; j < rows.length; j++) {
|
13667 | // const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
13668 | // tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
13669 | // tspan.setAttribute('dy', '1em');
|
13670 | // tspan.setAttribute('x', '1');
|
13671 | // tspan.textContent = rows[j];
|
13672 | // svgLabel.appendChild(tspan);
|
13673 | // }
|
13674 | // vertexNode = svgLabel;
|
13675 | // }
|
13676 |
|
13677 | var radious = 0;
|
13678 | var _shape = ''; // Set the shape based parameters
|
13679 |
|
13680 | switch (vertex.type) {
|
13681 | case 'class':
|
13682 | _shape = 'class_box';
|
13683 | break;
|
13684 |
|
13685 | default:
|
13686 | _shape = 'class_box';
|
13687 | } // Add the node
|
13688 |
|
13689 |
|
13690 | g.setNode(vertex.id, {
|
13691 | labelStyle: styles.labelStyle,
|
13692 | shape: _shape,
|
13693 | labelText: vertexText,
|
13694 | classData: vertex,
|
13695 | rx: radious,
|
13696 | ry: radious,
|
13697 | class: cssClassStr,
|
13698 | style: styles.style,
|
13699 | id: vertex.id,
|
13700 | domId: vertex.domId,
|
13701 | haveCallback: vertex.haveCallback,
|
13702 | link: vertex.link,
|
13703 | width: vertex.type === 'group' ? 500 : undefined,
|
13704 | type: vertex.type,
|
13705 | padding: (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.padding
|
13706 | });
|
13707 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('setNode', {
|
13708 | labelStyle: styles.labelStyle,
|
13709 | shape: _shape,
|
13710 | labelText: vertexText,
|
13711 | rx: radious,
|
13712 | ry: radious,
|
13713 | class: cssClassStr,
|
13714 | style: styles.style,
|
13715 | id: vertex.id,
|
13716 | width: vertex.type === 'group' ? 500 : undefined,
|
13717 | type: vertex.type,
|
13718 | padding: (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.padding
|
13719 | });
|
13720 | });
|
13721 | };
|
13722 | /**
|
13723 | * Add edges to graph based on parsed graph defninition
|
13724 | * @param {Object} edges The edges to add to the graph
|
13725 | * @param {Object} g The graph object
|
13726 | */
|
13727 |
|
13728 | var addRelations = function addRelations(relations, g) {
|
13729 | var cnt = 0;
|
13730 | var defaultStyle;
|
13731 | var defaultLabelStyle; // if (typeof relations.defaultStyle !== 'undefined') {
|
13732 | // const defaultStyles = getStylesFromArray(relations.defaultStyle);
|
13733 | // defaultStyle = defaultStyles.style;
|
13734 | // defaultLabelStyle = defaultStyles.labelStyle;
|
13735 | // }
|
13736 |
|
13737 | relations.forEach(function (edge) {
|
13738 | cnt++;
|
13739 | var edgeData = {}; //Set relationship style and line type
|
13740 |
|
13741 | edgeData.classes = 'relation';
|
13742 | edgeData.pattern = edge.relation.lineType == 1 ? 'dashed' : 'solid';
|
13743 | edgeData.id = 'id' + cnt; // Set link type for rendering
|
13744 |
|
13745 | if (edge.type === 'arrow_open') {
|
13746 | edgeData.arrowhead = 'none';
|
13747 | } else {
|
13748 | edgeData.arrowhead = 'normal';
|
13749 | }
|
13750 |
|
13751 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info(edgeData, edge); //Set edge extra labels
|
13752 | //edgeData.startLabelLeft = edge.relationTitle1;
|
13753 |
|
13754 | edgeData.startLabelRight = edge.relationTitle1 === 'none' ? '' : edge.relationTitle1;
|
13755 | edgeData.endLabelLeft = edge.relationTitle2 === 'none' ? '' : edge.relationTitle2; //edgeData.endLabelRight = edge.relationTitle2;
|
13756 | //Set relation arrow types
|
13757 |
|
13758 | edgeData.arrowTypeStart = getArrowMarker(edge.relation.type1);
|
13759 | edgeData.arrowTypeEnd = getArrowMarker(edge.relation.type2);
|
13760 | var style = '';
|
13761 | var labelStyle = '';
|
13762 |
|
13763 | if (typeof edge.style !== 'undefined') {
|
13764 | var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_7__.getStylesFromArray)(edge.style);
|
13765 | style = styles.style;
|
13766 | labelStyle = styles.labelStyle;
|
13767 | } else {
|
13768 | style = 'fill:none';
|
13769 |
|
13770 | if (typeof defaultStyle !== 'undefined') {
|
13771 | style = defaultStyle;
|
13772 | }
|
13773 |
|
13774 | if (typeof defaultLabelStyle !== 'undefined') {
|
13775 | labelStyle = defaultLabelStyle;
|
13776 | }
|
13777 | }
|
13778 |
|
13779 | edgeData.style = style;
|
13780 | edgeData.labelStyle = labelStyle;
|
13781 |
|
13782 | if (typeof edge.interpolate !== 'undefined') {
|
13783 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_7__.interpolateToCurve)(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_0__.curveLinear);
|
13784 | } else if (typeof relations.defaultInterpolate !== 'undefined') {
|
13785 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_7__.interpolateToCurve)(relations.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_0__.curveLinear);
|
13786 | } else {
|
13787 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_7__.interpolateToCurve)(conf.curve, d3__WEBPACK_IMPORTED_MODULE_0__.curveLinear);
|
13788 | }
|
13789 |
|
13790 | edge.text = edge.title;
|
13791 |
|
13792 | if (typeof edge.text === 'undefined') {
|
13793 | if (typeof edge.style !== 'undefined') {
|
13794 | edgeData.arrowheadStyle = 'fill: #333';
|
13795 | }
|
13796 | } else {
|
13797 | edgeData.arrowheadStyle = 'fill: #333';
|
13798 | edgeData.labelpos = 'c';
|
13799 |
|
13800 | if ((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels) {
|
13801 | // eslint-disable-line
|
13802 | edgeData.labelType = 'html';
|
13803 | edgeData.label = '<span class="edgeLabel">' + edge.text + '</span>';
|
13804 | } else {
|
13805 | edgeData.labelType = 'text';
|
13806 | edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_8__["default"].lineBreakRegex, '\n');
|
13807 |
|
13808 | if (typeof edge.style === 'undefined') {
|
13809 | edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
|
13810 | }
|
13811 |
|
13812 | edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
|
13813 | }
|
13814 | } // Add the edge to the graph
|
13815 |
|
13816 |
|
13817 | g.setEdge(edge.id1, edge.id2, edgeData, cnt);
|
13818 | });
|
13819 | }; // Todo optimize
|
13820 |
|
13821 | var getGraphId = function getGraphId(label) {
|
13822 | var keys = Object.keys(idCache);
|
13823 |
|
13824 | for (var i = 0; i < keys.length; i++) {
|
13825 | if (idCache[keys[i]].label === label) {
|
13826 | return keys[i];
|
13827 | }
|
13828 | }
|
13829 |
|
13830 | return undefined;
|
13831 | };
|
13832 |
|
13833 | var setConf = function setConf(cnf) {
|
13834 | var keys = Object.keys(cnf);
|
13835 | keys.forEach(function (key) {
|
13836 | conf[key] = cnf[key];
|
13837 | });
|
13838 | };
|
13839 | /**
|
13840 | * Draws a flowchart in the tag with id: id based on the graph definition in text.
|
13841 | * @param text
|
13842 | * @param id
|
13843 | */
|
13844 |
|
13845 | var drawOld = function drawOld(text, id) {
|
13846 | idCache = {};
|
13847 | _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy.clear();
|
13848 | _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.parse(text);
|
13849 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Rendering diagram ' + text); // Fetch the default direction, use TD if none was found
|
13850 |
|
13851 | var diagram = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id='".concat(id, "']")); // insertMarkers(diagram);
|
13852 | // Layout graph, Create a new directed graph
|
13853 |
|
13854 | var g = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
|
13855 | multigraph: true
|
13856 | }); // Set an object for the graph label
|
13857 |
|
13858 | g.setGraph({
|
13859 | isMultiGraph: true
|
13860 | }); // Default to assigning a new object as a label for each new edge.
|
13861 |
|
13862 | g.setDefaultEdgeLabel(function () {
|
13863 | return {};
|
13864 | });
|
13865 | var classes = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getClasses();
|
13866 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('classes:');
|
13867 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info(classes);
|
13868 | var keys = Object.keys(classes);
|
13869 |
|
13870 | for (var i = 0; i < keys.length; i++) {
|
13871 | var classDef = classes[keys[i]];
|
13872 | var node = _svgDraw__WEBPACK_IMPORTED_MODULE_9__["default"].drawClass(diagram, classDef, conf);
|
13873 | idCache[node.id] = node; // Add nodes to the graph. The first argument is the node id. The second is
|
13874 | // metadata about the node. In this case we're going to add labels to each of
|
13875 | // our nodes.
|
13876 |
|
13877 | g.setNode(node.id, node);
|
13878 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Org height: ' + node.height);
|
13879 | }
|
13880 |
|
13881 | var relations = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
|
13882 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('relations:', relations);
|
13883 | relations.forEach(function (relation) {
|
13884 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation));
|
13885 | g.setEdge(getGraphId(relation.id1), getGraphId(relation.id2), {
|
13886 | relation: relation
|
13887 | }, relation.title || 'DEFAULT');
|
13888 | });
|
13889 | dagre__WEBPACK_IMPORTED_MODULE_1___default().layout(g);
|
13890 | g.nodes().forEach(function (v) {
|
13891 | if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') {
|
13892 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
|
13893 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + (0,_classDb__WEBPACK_IMPORTED_MODULE_4__.lookUpDomId)(v)).attr('transform', 'translate(' + (g.node(v).x - g.node(v).width / 2) + ',' + (g.node(v).y - g.node(v).height / 2) + ' )');
|
13894 | }
|
13895 | });
|
13896 | g.edges().forEach(function (e) {
|
13897 | if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') {
|
13898 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
|
13899 | _svgDraw__WEBPACK_IMPORTED_MODULE_9__["default"].drawEdge(diagram, g.edge(e), g.edge(e).relation, conf);
|
13900 | }
|
13901 | });
|
13902 | var svgBounds = diagram.node().getBBox();
|
13903 | var width = svgBounds.width + padding * 2;
|
13904 | var height = svgBounds.height + padding * 2;
|
13905 | (0,_utils__WEBPACK_IMPORTED_MODULE_7__.configureSvgSize)(diagram, height, width, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
|
13906 |
|
13907 | var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
|
13908 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug("viewBox ".concat(vBox));
|
13909 | diagram.attr('viewBox', vBox);
|
13910 | };
|
13911 | var draw = function draw(text, id) {
|
13912 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Drawing class');
|
13913 | _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].clear(); // const parser = classDb.parser;
|
13914 | // parser.yy = classDb;
|
13915 | // Parse the graph definition
|
13916 | // try {
|
13917 |
|
13918 | _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.parse(text); // } catch (err) {
|
13919 | // log.debug('Parsing failed');
|
13920 | // }
|
13921 | // Fetch the default direction, use TD if none was found
|
13922 | //let dir = 'TD';
|
13923 |
|
13924 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart;
|
13925 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('config:', conf);
|
13926 | var nodeSpacing = conf.nodeSpacing || 50;
|
13927 | var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
|
13928 |
|
13929 | var g = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
|
13930 | multigraph: true,
|
13931 | compound: true
|
13932 | }).setGraph({
|
13933 | rankdir: _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getDirection(),
|
13934 | nodesep: nodeSpacing,
|
13935 | ranksep: rankSpacing,
|
13936 | marginx: 8,
|
13937 | marginy: 8
|
13938 | }).setDefaultEdgeLabel(function () {
|
13939 | return {};
|
13940 | }); // let subG;
|
13941 | // const subGraphs = flowDb.getSubGraphs();
|
13942 | // log.info('Subgraphs - ', subGraphs);
|
13943 | // for (let i = subGraphs.length - 1; i >= 0; i--) {
|
13944 | // subG = subGraphs[i];
|
13945 | // log.info('Subgraph - ', subG);
|
13946 | // flowDb.addVertex(subG.id, subG.title, 'group', undefined, subG.classes);
|
13947 | // }
|
13948 | // Fetch the verices/nodes and edges/links from the parsed graph definition
|
13949 |
|
13950 | var classes = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getClasses();
|
13951 | var relations = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
|
13952 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info(relations); // let i = 0;
|
13953 | // for (i = subGraphs.length - 1; i >= 0; i--) {
|
13954 | // subG = subGraphs[i];
|
13955 | // selectAll('cluster').append('text');
|
13956 | // for (let j = 0; j < subG.nodes.length; j++) {
|
13957 | // g.setParent(subG.nodes[j], subG.id);
|
13958 | // }
|
13959 | // }
|
13960 |
|
13961 | addClasses(classes, g, id);
|
13962 | addRelations(relations, g); // Add custom shapes
|
13963 | // flowChartShapes.addToRenderV2(addShape);
|
13964 | // Set up an SVG group so that we can translate the final graph.
|
13965 |
|
13966 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id=\"".concat(id, "\"]"));
|
13967 | svg.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink'); // Run the renderer. This is what draws the final graph.
|
13968 |
|
13969 | var element = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + id + ' g');
|
13970 | (0,_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_10__.render)(element, g, ['aggregation', 'extension', 'composition', 'dependency'], 'classDiagram', id); // element.selectAll('g.node').attr('title', function() {
|
13971 | // return flowDb.getTooltip(this.id);
|
13972 | // });
|
13973 |
|
13974 | var padding = 8;
|
13975 | var svgBounds = svg.node().getBBox();
|
13976 | var width = svgBounds.width + padding * 2;
|
13977 | var height = svgBounds.height + padding * 2;
|
13978 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug("new ViewBox 0 0 ".concat(width, " ").concat(height), "translate(".concat(padding - g._label.marginx, ", ").concat(padding - g._label.marginy, ")"));
|
13979 | (0,_utils__WEBPACK_IMPORTED_MODULE_7__.configureSvgSize)(svg, height, width, conf.useMaxWidth);
|
13980 | svg.attr('viewBox', "0 0 ".concat(width, " ").concat(height));
|
13981 | svg.select('g').attr('transform', "translate(".concat(padding - g._label.marginx, ", ").concat(padding - svgBounds.y, ")")); // Index nodes
|
13982 | // flowDb.indexNodes('subGraph' + i);
|
13983 | // Add label rects for non html labels
|
13984 |
|
13985 | if (!conf.htmlLabels) {
|
13986 | var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
13987 |
|
13988 | for (var k = 0; k < labels.length; k++) {
|
13989 | var label = labels[k]; // Get dimensions of label
|
13990 |
|
13991 | var dim = label.getBBox();
|
13992 | var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
|
13993 | rect.setAttribute('rx', 0);
|
13994 | rect.setAttribute('ry', 0);
|
13995 | rect.setAttribute('width', dim.width);
|
13996 | rect.setAttribute('height', dim.height); // rect.setAttribute('style', 'fill:#e8e8e8;');
|
13997 |
|
13998 | label.insertBefore(rect, label.firstChild);
|
13999 | }
|
14000 | } // If node has a link, wrap it in an anchor SVG object.
|
14001 | // const keys = Object.keys(classes);
|
14002 | // keys.forEach(function(key) {
|
14003 | // const vertex = classes[key];
|
14004 | // if (vertex.link) {
|
14005 | // const node = select('#' + id + ' [id="' + key + '"]');
|
14006 | // if (node) {
|
14007 | // const link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
|
14008 | // link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
|
14009 | // link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
|
14010 | // link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
|
14011 | // const linkNode = node.insert(function() {
|
14012 | // return link;
|
14013 | // }, ':first-child');
|
14014 | // const shape = node.select('.label-container');
|
14015 | // if (shape) {
|
14016 | // linkNode.append(function() {
|
14017 | // return shape.node();
|
14018 | // });
|
14019 | // }
|
14020 | // const label = node.select('.label');
|
14021 | // if (label) {
|
14022 | // linkNode.append(function() {
|
14023 | // return label.node();
|
14024 | // });
|
14025 | // }
|
14026 | // }
|
14027 | // }
|
14028 | // });
|
14029 |
|
14030 | };
|
14031 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
14032 | setConf: setConf,
|
14033 | draw: draw
|
14034 | });
|
14035 |
|
14036 | function getArrowMarker(type) {
|
14037 | var marker;
|
14038 |
|
14039 | switch (type) {
|
14040 | case 0:
|
14041 | marker = 'aggregation';
|
14042 | break;
|
14043 |
|
14044 | case 1:
|
14045 | marker = 'extension';
|
14046 | break;
|
14047 |
|
14048 | case 2:
|
14049 | marker = 'composition';
|
14050 | break;
|
14051 |
|
14052 | case 3:
|
14053 | marker = 'dependency';
|
14054 | break;
|
14055 |
|
14056 | default:
|
14057 | marker = 'none';
|
14058 | }
|
14059 |
|
14060 | return marker;
|
14061 | }
|
14062 |
|
14063 | /***/ }),
|
14064 |
|
14065 | /***/ "./src/diagrams/class/classRenderer.js":
|
14066 | /*!*********************************************!*\
|
14067 | !*** ./src/diagrams/class/classRenderer.js ***!
|
14068 | \*********************************************/
|
14069 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
14070 |
|
14071 | "use strict";
|
14072 | __webpack_require__.r(__webpack_exports__);
|
14073 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
14074 | /* harmony export */ "setConf": () => (/* binding */ setConf),
|
14075 | /* harmony export */ "draw": () => (/* binding */ draw),
|
14076 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
14077 | /* harmony export */ });
|
14078 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
14079 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
14080 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
|
14081 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
|
14082 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
|
14083 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
|
14084 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
14085 | /* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js");
|
14086 | /* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison");
|
14087 | /* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__);
|
14088 | /* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/class/svgDraw.js");
|
14089 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
14090 |
|
14091 |
|
14092 |
|
14093 |
|
14094 |
|
14095 |
|
14096 |
|
14097 |
|
14098 | _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"];
|
14099 | var idCache = {};
|
14100 | var padding = 20;
|
14101 | var conf = {
|
14102 | dividerMargin: 10,
|
14103 | padding: 5,
|
14104 | textHeight: 10
|
14105 | }; // Todo optimize
|
14106 |
|
14107 | var getGraphId = function getGraphId(label) {
|
14108 | var keys = Object.keys(idCache);
|
14109 |
|
14110 | for (var i = 0; i < keys.length; i++) {
|
14111 | if (idCache[keys[i]].label === label) {
|
14112 | return keys[i];
|
14113 | }
|
14114 | }
|
14115 |
|
14116 | return undefined;
|
14117 | };
|
14118 | /**
|
14119 | * Setup arrow head and define the marker. The result is appended to the svg.
|
14120 | */
|
14121 |
|
14122 |
|
14123 | var insertMarkers = function insertMarkers(elem) {
|
14124 | 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');
|
14125 | 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
|
14126 |
|
14127 | 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');
|
14128 | 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');
|
14129 | 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');
|
14130 | 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');
|
14131 | 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');
|
14132 | 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');
|
14133 | };
|
14134 |
|
14135 | var setConf = function setConf(cnf) {
|
14136 | var keys = Object.keys(cnf);
|
14137 | keys.forEach(function (key) {
|
14138 | conf[key] = cnf[key];
|
14139 | });
|
14140 | };
|
14141 | /**
|
14142 | * Draws a flowchart in the tag with id: id based on the graph definition in text.
|
14143 | * @param text
|
14144 | * @param id
|
14145 | */
|
14146 |
|
14147 | var draw = function draw(text, id) {
|
14148 | idCache = {};
|
14149 | _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy.clear();
|
14150 | _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.parse(text);
|
14151 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Rendering diagram ' + text); // Fetch the default direction, use TD if none was found
|
14152 |
|
14153 | var diagram = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id='".concat(id, "']"));
|
14154 | diagram.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink');
|
14155 | insertMarkers(diagram); // Layout graph, Create a new directed graph
|
14156 |
|
14157 | var g = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
|
14158 | multigraph: true
|
14159 | }); // Set an object for the graph label
|
14160 |
|
14161 | g.setGraph({
|
14162 | isMultiGraph: true
|
14163 | }); // Default to assigning a new object as a label for each new edge.
|
14164 |
|
14165 | g.setDefaultEdgeLabel(function () {
|
14166 | return {};
|
14167 | });
|
14168 | var classes = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getClasses();
|
14169 | var keys = Object.keys(classes);
|
14170 |
|
14171 | for (var i = 0; i < keys.length; i++) {
|
14172 | var classDef = classes[keys[i]];
|
14173 | var node = _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawClass(diagram, classDef, conf);
|
14174 | idCache[node.id] = node; // Add nodes to the graph. The first argument is the node id. The second is
|
14175 | // metadata about the node. In this case we're going to add labels to each of
|
14176 | // our nodes.
|
14177 |
|
14178 | g.setNode(node.id, node);
|
14179 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Org height: ' + node.height);
|
14180 | }
|
14181 |
|
14182 | var relations = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
|
14183 | relations.forEach(function (relation) {
|
14184 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation));
|
14185 | g.setEdge(getGraphId(relation.id1), getGraphId(relation.id2), {
|
14186 | relation: relation
|
14187 | }, relation.title || 'DEFAULT');
|
14188 | });
|
14189 | dagre__WEBPACK_IMPORTED_MODULE_1___default().layout(g);
|
14190 | g.nodes().forEach(function (v) {
|
14191 | if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') {
|
14192 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
|
14193 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + (0,_classDb__WEBPACK_IMPORTED_MODULE_4__.lookUpDomId)(v)).attr('transform', 'translate(' + (g.node(v).x - g.node(v).width / 2) + ',' + (g.node(v).y - g.node(v).height / 2) + ' )');
|
14194 | }
|
14195 | });
|
14196 | g.edges().forEach(function (e) {
|
14197 | if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') {
|
14198 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
|
14199 | _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawEdge(diagram, g.edge(e), g.edge(e).relation, conf);
|
14200 | }
|
14201 | });
|
14202 | var svgBounds = diagram.node().getBBox();
|
14203 | var width = svgBounds.width + padding * 2;
|
14204 | var height = svgBounds.height + padding * 2;
|
14205 | (0,_utils__WEBPACK_IMPORTED_MODULE_7__.configureSvgSize)(diagram, height, width, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
|
14206 |
|
14207 | var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
|
14208 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug("viewBox ".concat(vBox));
|
14209 | diagram.attr('viewBox', vBox);
|
14210 | };
|
14211 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
14212 | setConf: setConf,
|
14213 | draw: draw
|
14214 | });
|
14215 |
|
14216 | /***/ }),
|
14217 |
|
14218 | /***/ "./src/diagrams/class/styles.js":
|
14219 | /*!**************************************!*\
|
14220 | !*** ./src/diagrams/class/styles.js ***!
|
14221 | \**************************************/
|
14222 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
14223 |
|
14224 | "use strict";
|
14225 | __webpack_require__.r(__webpack_exports__);
|
14226 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
14227 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
14228 | /* harmony export */ });
|
14229 | var getStyles = function getStyles(options) {
|
14230 | 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");
|
14231 | };
|
14232 |
|
14233 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
14234 |
|
14235 | /***/ }),
|
14236 |
|
14237 | /***/ "./src/diagrams/class/svgDraw.js":
|
14238 | /*!***************************************!*\
|
14239 | !*** ./src/diagrams/class/svgDraw.js ***!
|
14240 | \***************************************/
|
14241 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
14242 |
|
14243 | "use strict";
|
14244 | __webpack_require__.r(__webpack_exports__);
|
14245 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
14246 | /* harmony export */ "drawEdge": () => (/* binding */ drawEdge),
|
14247 | /* harmony export */ "drawClass": () => (/* binding */ drawClass),
|
14248 | /* harmony export */ "parseMember": () => (/* binding */ parseMember),
|
14249 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
14250 | /* harmony export */ });
|
14251 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
14252 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
14253 | /* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js");
|
14254 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
14255 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
14256 |
|
14257 |
|
14258 |
|
14259 |
|
14260 | var edgeCount = 0;
|
14261 | var drawEdge = function drawEdge(elem, path, relation, conf) {
|
14262 | var getRelationType = function getRelationType(type) {
|
14263 | switch (type) {
|
14264 | case _classDb__WEBPACK_IMPORTED_MODULE_1__.relationType.AGGREGATION:
|
14265 | return 'aggregation';
|
14266 |
|
14267 | case _classDb__WEBPACK_IMPORTED_MODULE_1__.relationType.EXTENSION:
|
14268 | return 'extension';
|
14269 |
|
14270 | case _classDb__WEBPACK_IMPORTED_MODULE_1__.relationType.COMPOSITION:
|
14271 | return 'composition';
|
14272 |
|
14273 | case _classDb__WEBPACK_IMPORTED_MODULE_1__.relationType.DEPENDENCY:
|
14274 | return 'dependency';
|
14275 | }
|
14276 | };
|
14277 |
|
14278 | path.points = path.points.filter(function (p) {
|
14279 | return !Number.isNaN(p.y);
|
14280 | }); // The data for our line
|
14281 |
|
14282 | var lineData = path.points; // This is the accessor function we talked about above
|
14283 |
|
14284 | var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) {
|
14285 | return d.x;
|
14286 | }).y(function (d) {
|
14287 | return d.y;
|
14288 | }).curve(d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis);
|
14289 | var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', 'edge' + edgeCount).attr('class', 'relation');
|
14290 | var url = '';
|
14291 |
|
14292 | if (conf.arrowMarkerAbsolute) {
|
14293 | url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
|
14294 | url = url.replace(/\(/g, '\\(');
|
14295 | url = url.replace(/\)/g, '\\)');
|
14296 | }
|
14297 |
|
14298 | if (relation.relation.lineType == 1) {
|
14299 | svgPath.attr('class', 'relation dashed-line');
|
14300 | }
|
14301 |
|
14302 | if (relation.relation.type1 !== 'none') {
|
14303 | svgPath.attr('marker-start', 'url(' + url + '#' + getRelationType(relation.relation.type1) + 'Start' + ')');
|
14304 | }
|
14305 |
|
14306 | if (relation.relation.type2 !== 'none') {
|
14307 | svgPath.attr('marker-end', 'url(' + url + '#' + getRelationType(relation.relation.type2) + 'End' + ')');
|
14308 | }
|
14309 |
|
14310 | var x, y;
|
14311 | var l = path.points.length; // Calculate Label position
|
14312 |
|
14313 | var labelPosition = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcLabelPosition(path.points);
|
14314 | x = labelPosition.x;
|
14315 | y = labelPosition.y;
|
14316 | var p1_card_x, p1_card_y;
|
14317 | var p2_card_x, p2_card_y;
|
14318 |
|
14319 | if (l % 2 !== 0 && l > 1) {
|
14320 | var cardinality_1_point = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcCardinalityPosition(relation.relation.type1 !== 'none', path.points, path.points[0]);
|
14321 | var cardinality_2_point = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcCardinalityPosition(relation.relation.type2 !== 'none', path.points, path.points[l - 1]);
|
14322 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('cardinality_1_point ' + JSON.stringify(cardinality_1_point));
|
14323 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('cardinality_2_point ' + JSON.stringify(cardinality_2_point));
|
14324 | p1_card_x = cardinality_1_point.x;
|
14325 | p1_card_y = cardinality_1_point.y;
|
14326 | p2_card_x = cardinality_2_point.x;
|
14327 | p2_card_y = cardinality_2_point.y;
|
14328 | }
|
14329 |
|
14330 | if (typeof relation.title !== 'undefined') {
|
14331 | var g = elem.append('g').attr('class', 'classLabel');
|
14332 | var label = g.append('text').attr('class', 'label').attr('x', x).attr('y', y).attr('fill', 'red').attr('text-anchor', 'middle').text(relation.title);
|
14333 | window.label = label;
|
14334 | var bounds = label.node().getBBox();
|
14335 | 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);
|
14336 | }
|
14337 |
|
14338 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('Rendering relation ' + JSON.stringify(relation));
|
14339 |
|
14340 | if (typeof relation.relationTitle1 !== 'undefined' && relation.relationTitle1 !== 'none') {
|
14341 | var _g = elem.append('g').attr('class', 'cardinality');
|
14342 |
|
14343 | _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);
|
14344 | }
|
14345 |
|
14346 | if (typeof relation.relationTitle2 !== 'undefined' && relation.relationTitle2 !== 'none') {
|
14347 | var _g2 = elem.append('g').attr('class', 'cardinality');
|
14348 |
|
14349 | _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);
|
14350 | }
|
14351 |
|
14352 | edgeCount++;
|
14353 | };
|
14354 | var drawClass = function drawClass(elem, classDef, conf) {
|
14355 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('Rendering class ' + classDef);
|
14356 | var id = classDef.id;
|
14357 | var classInfo = {
|
14358 | id: id,
|
14359 | label: classDef.id,
|
14360 | width: 0,
|
14361 | height: 0
|
14362 | }; // add class group
|
14363 |
|
14364 | var g = elem.append('g').attr('id', (0,_classDb__WEBPACK_IMPORTED_MODULE_1__.lookUpDomId)(id)).attr('class', 'classGroup'); // add title
|
14365 |
|
14366 | var title;
|
14367 |
|
14368 | if (classDef.link) {
|
14369 | 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);
|
14370 | } else {
|
14371 | title = g.append('text').attr('y', conf.textHeight + conf.padding).attr('x', 0);
|
14372 | } // add annotations
|
14373 |
|
14374 |
|
14375 | var isFirst = true;
|
14376 | classDef.annotations.forEach(function (member) {
|
14377 | var titleText2 = title.append('tspan').text('«' + member + '»');
|
14378 | if (!isFirst) titleText2.attr('dy', conf.textHeight);
|
14379 | isFirst = false;
|
14380 | });
|
14381 | var classTitleString = classDef.id;
|
14382 |
|
14383 | if (classDef.type !== undefined && classDef.type !== '') {
|
14384 | classTitleString += '<' + classDef.type + '>';
|
14385 | }
|
14386 |
|
14387 | 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
|
14388 |
|
14389 | if (!isFirst) classTitle.attr('dy', conf.textHeight);
|
14390 | var titleHeight = title.node().getBBox().height;
|
14391 | var membersLine = g.append('line') // text label for the x axis
|
14392 | .attr('x1', 0).attr('y1', conf.padding + titleHeight + conf.dividerMargin / 2).attr('y2', conf.padding + titleHeight + conf.dividerMargin / 2);
|
14393 | var members = g.append('text') // text label for the x axis
|
14394 | .attr('x', conf.padding).attr('y', titleHeight + conf.dividerMargin + conf.textHeight).attr('fill', 'white').attr('class', 'classText');
|
14395 | isFirst = true;
|
14396 | classDef.members.forEach(function (member) {
|
14397 | addTspan(members, member, isFirst, conf);
|
14398 | isFirst = false;
|
14399 | });
|
14400 | var membersBox = members.node().getBBox();
|
14401 | var methodsLine = g.append('line') // text label for the x axis
|
14402 | .attr('x1', 0).attr('y1', conf.padding + titleHeight + conf.dividerMargin + membersBox.height).attr('y2', conf.padding + titleHeight + conf.dividerMargin + membersBox.height);
|
14403 | var methods = g.append('text') // text label for the x axis
|
14404 | .attr('x', conf.padding).attr('y', titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight).attr('fill', 'white').attr('class', 'classText');
|
14405 | isFirst = true;
|
14406 | classDef.methods.forEach(function (method) {
|
14407 | addTspan(methods, method, isFirst, conf);
|
14408 | isFirst = false;
|
14409 | });
|
14410 | var classBox = g.node().getBBox();
|
14411 | var cssClassStr = ' ';
|
14412 |
|
14413 | if (classDef.cssClasses.length > 0) {
|
14414 | cssClassStr = cssClassStr + classDef.cssClasses.join(' ');
|
14415 | }
|
14416 |
|
14417 | 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);
|
14418 | var rectWidth = rect.node().getBBox().width; // Center title
|
14419 | // We subtract the width of each text element from the class box width and divide it by 2
|
14420 |
|
14421 | title.node().childNodes.forEach(function (x) {
|
14422 | x.setAttribute('x', (rectWidth - x.getBBox().width) / 2);
|
14423 | });
|
14424 |
|
14425 | if (classDef.tooltip) {
|
14426 | title.insert('title').text(classDef.tooltip);
|
14427 | }
|
14428 |
|
14429 | membersLine.attr('x2', rectWidth);
|
14430 | methodsLine.attr('x2', rectWidth);
|
14431 | classInfo.width = rectWidth;
|
14432 | classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
|
14433 | return classInfo;
|
14434 | };
|
14435 | var parseMember = function parseMember(text) {
|
14436 | var fieldRegEx = /^(\+|-|~|#)?(\w+)(~\w+~|\[\])?\s+(\w+) *(\*|\$)?$/;
|
14437 | var methodRegEx = /^([+|\-|~|#])?(\w+) *\( *(.*)\) *(\*|\$)? *(\w*[~|[\]]*\s*\w*~?)$/;
|
14438 | var fieldMatch = text.match(fieldRegEx);
|
14439 | var methodMatch = text.match(methodRegEx);
|
14440 |
|
14441 | if (fieldMatch && !methodMatch) {
|
14442 | return buildFieldDisplay(fieldMatch);
|
14443 | } else if (methodMatch) {
|
14444 | return buildMethodDisplay(methodMatch);
|
14445 | } else {
|
14446 | return buildLegacyDisplay(text);
|
14447 | }
|
14448 | };
|
14449 |
|
14450 | var buildFieldDisplay = function buildFieldDisplay(parsedText) {
|
14451 | var cssStyle = '';
|
14452 | var displayText = '';
|
14453 |
|
14454 | try {
|
14455 | var visibility = parsedText[1] ? parsedText[1].trim() : '';
|
14456 | var fieldType = parsedText[2] ? parsedText[2].trim() : '';
|
14457 | var genericType = parsedText[3] ? parseGenericTypes(parsedText[3].trim()) : '';
|
14458 | var fieldName = parsedText[4] ? parsedText[4].trim() : '';
|
14459 | var classifier = parsedText[5] ? parsedText[5].trim() : '';
|
14460 | displayText = visibility + fieldType + genericType + ' ' + fieldName;
|
14461 | cssStyle = parseClassifier(classifier);
|
14462 | } catch (err) {
|
14463 | displayText = parsedText;
|
14464 | }
|
14465 |
|
14466 | return {
|
14467 | displayText: displayText,
|
14468 | cssStyle: cssStyle
|
14469 | };
|
14470 | };
|
14471 |
|
14472 | var buildMethodDisplay = function buildMethodDisplay(parsedText) {
|
14473 | var cssStyle = '';
|
14474 | var displayText = '';
|
14475 |
|
14476 | try {
|
14477 | var visibility = parsedText[1] ? parsedText[1].trim() : '';
|
14478 | var methodName = parsedText[2] ? parsedText[2].trim() : '';
|
14479 | var parameters = parsedText[3] ? parseGenericTypes(parsedText[3].trim()) : '';
|
14480 | var classifier = parsedText[4] ? parsedText[4].trim() : '';
|
14481 | var returnType = parsedText[5] ? ' : ' + parseGenericTypes(parsedText[5]).trim() : '';
|
14482 | displayText = visibility + methodName + '(' + parameters + ')' + returnType;
|
14483 | cssStyle = parseClassifier(classifier);
|
14484 | } catch (err) {
|
14485 | displayText = parsedText;
|
14486 | }
|
14487 |
|
14488 | return {
|
14489 | displayText: displayText,
|
14490 | cssStyle: cssStyle
|
14491 | };
|
14492 | };
|
14493 |
|
14494 | var buildLegacyDisplay = function buildLegacyDisplay(text) {
|
14495 | // if for some reason we dont have any match, use old format to parse text
|
14496 | var displayText = '';
|
14497 | var cssStyle = '';
|
14498 | var memberText = '';
|
14499 | var returnType = '';
|
14500 | var methodStart = text.indexOf('(');
|
14501 | var methodEnd = text.indexOf(')');
|
14502 |
|
14503 | if (methodStart > 1 && methodEnd > methodStart && methodEnd <= text.length) {
|
14504 | var visibility = '';
|
14505 | var methodName = '';
|
14506 | var firstChar = text.substring(0, 1);
|
14507 |
|
14508 | if (firstChar.match(/\w/)) {
|
14509 | methodName = text.substring(0, methodStart).trim();
|
14510 | } else {
|
14511 | if (firstChar.match(/\+|-|~|#/)) {
|
14512 | visibility = firstChar;
|
14513 | }
|
14514 |
|
14515 | methodName = text.substring(1, methodStart).trim();
|
14516 | }
|
14517 |
|
14518 | var parameters = text.substring(methodStart + 1, methodEnd);
|
14519 | var classifier = text.substring(methodEnd + 1, 1);
|
14520 | cssStyle = parseClassifier(classifier);
|
14521 | displayText = visibility + methodName + '(' + parseGenericTypes(parameters.trim()) + ')';
|
14522 |
|
14523 | if (methodEnd < memberText.length) {
|
14524 | returnType = text.substring(methodEnd + 2).trim();
|
14525 |
|
14526 | if (returnType !== '') {
|
14527 | returnType = ' : ' + parseGenericTypes(returnType);
|
14528 | }
|
14529 | }
|
14530 | } else {
|
14531 | // finally - if all else fails, just send the text back as written (other than parsing for generic types)
|
14532 | displayText = parseGenericTypes(text);
|
14533 | }
|
14534 |
|
14535 | return {
|
14536 | displayText: displayText,
|
14537 | cssStyle: cssStyle
|
14538 | };
|
14539 | };
|
14540 |
|
14541 | var addTspan = function addTspan(textEl, txt, isFirst, conf) {
|
14542 | var member = parseMember(txt);
|
14543 | var tSpan = textEl.append('tspan').attr('x', conf.padding).text(member.displayText);
|
14544 |
|
14545 | if (member.cssStyle !== '') {
|
14546 | tSpan.attr('style', member.cssStyle);
|
14547 | }
|
14548 |
|
14549 | if (!isFirst) {
|
14550 | tSpan.attr('dy', conf.textHeight);
|
14551 | }
|
14552 | };
|
14553 |
|
14554 | var parseGenericTypes = function parseGenericTypes(text) {
|
14555 | var cleanedText = text;
|
14556 |
|
14557 | if (text.indexOf('~') != -1) {
|
14558 | cleanedText = cleanedText.replace('~', '<');
|
14559 | cleanedText = cleanedText.replace('~', '>');
|
14560 | return parseGenericTypes(cleanedText);
|
14561 | } else {
|
14562 | return cleanedText;
|
14563 | }
|
14564 | };
|
14565 |
|
14566 | var parseClassifier = function parseClassifier(classifier) {
|
14567 | switch (classifier) {
|
14568 | case '*':
|
14569 | return 'font-style:italic;';
|
14570 |
|
14571 | case '$':
|
14572 | return 'text-decoration:underline;';
|
14573 |
|
14574 | default:
|
14575 | return '';
|
14576 | }
|
14577 | };
|
14578 |
|
14579 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
14580 | drawClass: drawClass,
|
14581 | drawEdge: drawEdge,
|
14582 | parseMember: parseMember
|
14583 | });
|
14584 |
|
14585 | /***/ }),
|
14586 |
|
14587 | /***/ "./src/diagrams/common/common.js":
|
14588 | /*!***************************************!*\
|
14589 | !*** ./src/diagrams/common/common.js ***!
|
14590 | \***************************************/
|
14591 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
14592 |
|
14593 | "use strict";
|
14594 | __webpack_require__.r(__webpack_exports__);
|
14595 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
14596 | /* harmony export */ "getRows": () => (/* binding */ getRows),
|
14597 | /* harmony export */ "removeScript": () => (/* binding */ removeScript),
|
14598 | /* harmony export */ "sanitizeText": () => (/* binding */ sanitizeText),
|
14599 | /* harmony export */ "lineBreakRegex": () => (/* binding */ lineBreakRegex),
|
14600 | /* harmony export */ "hasBreaks": () => (/* binding */ hasBreaks),
|
14601 | /* harmony export */ "splitBreaks": () => (/* binding */ splitBreaks),
|
14602 | /* harmony export */ "evaluate": () => (/* binding */ evaluate),
|
14603 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
14604 | /* harmony export */ });
|
14605 | /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dompurify */ "dompurify");
|
14606 | /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dompurify__WEBPACK_IMPORTED_MODULE_0__);
|
14607 |
|
14608 | var getRows = function getRows(s) {
|
14609 | if (!s) return 1;
|
14610 | var str = breakToPlaceholder(s);
|
14611 | str = str.replace(/\\n/g, '#br#');
|
14612 | return str.split('#br#');
|
14613 | };
|
14614 | var removeScript = function removeScript(txt) {
|
14615 | var rs = '';
|
14616 | var idx = 0;
|
14617 |
|
14618 | while (idx >= 0) {
|
14619 | idx = txt.indexOf('<script');
|
14620 |
|
14621 | if (idx >= 0) {
|
14622 | rs += txt.substr(0, idx);
|
14623 | txt = txt.substr(idx + 1);
|
14624 | idx = txt.indexOf('</script>');
|
14625 |
|
14626 | if (idx >= 0) {
|
14627 | idx += 9;
|
14628 | txt = txt.substr(idx);
|
14629 | }
|
14630 | } else {
|
14631 | rs += txt;
|
14632 | idx = -1;
|
14633 | break;
|
14634 | }
|
14635 | }
|
14636 |
|
14637 | rs = rs.replace(/script>/gi, '#');
|
14638 | rs = rs.replace(/script>/gi, '#');
|
14639 | rs = rs.replace(/javascript:/gi, '#');
|
14640 | rs = rs.replace(/onerror=/gi, 'onerror:');
|
14641 | rs = rs.replace(/<iframe/gi, '');
|
14642 | return rs;
|
14643 | };
|
14644 |
|
14645 | var sanitizeMore = function sanitizeMore(text, config) {
|
14646 | var txt = text;
|
14647 | var htmlLabels = true;
|
14648 |
|
14649 | if (config.flowchart && (config.flowchart.htmlLabels === false || config.flowchart.htmlLabels === 'false')) {
|
14650 | htmlLabels = false;
|
14651 | }
|
14652 |
|
14653 | if (htmlLabels) {
|
14654 | var level = config.securityLevel;
|
14655 |
|
14656 | if (level === 'antiscript') {
|
14657 | txt = removeScript(txt);
|
14658 | } else if (level !== 'loose') {
|
14659 | // eslint-disable-line
|
14660 | txt = breakToPlaceholder(txt);
|
14661 | txt = txt.replace(/</g, '<').replace(/>/g, '>');
|
14662 | txt = txt.replace(/=/g, '=');
|
14663 | txt = placeholderToBreak(txt);
|
14664 | }
|
14665 | }
|
14666 |
|
14667 | return txt;
|
14668 | };
|
14669 |
|
14670 | var sanitizeText = function sanitizeText(text, config) {
|
14671 | if (!text) return text;
|
14672 | var txt = dompurify__WEBPACK_IMPORTED_MODULE_0___default().sanitize(sanitizeMore(text, config));
|
14673 | return txt;
|
14674 | };
|
14675 | var lineBreakRegex = /<br\s*\/?>/gi;
|
14676 | var hasBreaks = function hasBreaks(text) {
|
14677 | return /<br\s*[/]?>/gi.test(text);
|
14678 | };
|
14679 | var splitBreaks = function splitBreaks(text) {
|
14680 | return text.split(/<br\s*[/]?>/gi);
|
14681 | };
|
14682 |
|
14683 | var placeholderToBreak = function placeholderToBreak(s) {
|
14684 | return s.replace(/#br#/g, '<br/>');
|
14685 | };
|
14686 |
|
14687 | var breakToPlaceholder = function breakToPlaceholder(s) {
|
14688 | return s.replace(lineBreakRegex, '#br#');
|
14689 | };
|
14690 |
|
14691 | var getUrl = function getUrl(useAbsolute) {
|
14692 | var url = '';
|
14693 |
|
14694 | if (useAbsolute) {
|
14695 | url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
|
14696 | url = url.replace(/\(/g, '\\(');
|
14697 | url = url.replace(/\)/g, '\\)');
|
14698 | }
|
14699 |
|
14700 | return url;
|
14701 | };
|
14702 |
|
14703 | var evaluate = function evaluate(val) {
|
14704 | return val === 'false' || val === false ? false : true;
|
14705 | };
|
14706 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
14707 | getRows: getRows,
|
14708 | sanitizeText: sanitizeText,
|
14709 | hasBreaks: hasBreaks,
|
14710 | splitBreaks: splitBreaks,
|
14711 | lineBreakRegex: lineBreakRegex,
|
14712 | removeScript: removeScript,
|
14713 | getUrl: getUrl,
|
14714 | evaluate: evaluate
|
14715 | });
|
14716 |
|
14717 | /***/ }),
|
14718 |
|
14719 | /***/ "./src/diagrams/er/erDb.js":
|
14720 | /*!*********************************!*\
|
14721 | !*** ./src/diagrams/er/erDb.js ***!
|
14722 | \*********************************/
|
14723 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
14724 |
|
14725 | "use strict";
|
14726 | __webpack_require__.r(__webpack_exports__);
|
14727 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
14728 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
14729 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
14730 | /* harmony export */ });
|
14731 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
14732 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
14733 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
14734 | /**
|
14735 | *
|
14736 | */
|
14737 |
|
14738 |
|
14739 |
|
14740 | var entities = {};
|
14741 | var relationships = [];
|
14742 | var title = '';
|
14743 | var Cardinality = {
|
14744 | ZERO_OR_ONE: 'ZERO_OR_ONE',
|
14745 | ZERO_OR_MORE: 'ZERO_OR_MORE',
|
14746 | ONE_OR_MORE: 'ONE_OR_MORE',
|
14747 | ONLY_ONE: 'ONLY_ONE'
|
14748 | };
|
14749 | var Identification = {
|
14750 | NON_IDENTIFYING: 'NON_IDENTIFYING',
|
14751 | IDENTIFYING: 'IDENTIFYING'
|
14752 | };
|
14753 | var parseDirective = function parseDirective(statement, context, type) {
|
14754 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
|
14755 | };
|
14756 |
|
14757 | var addEntity = function addEntity(name) {
|
14758 | if (typeof entities[name] === 'undefined') {
|
14759 | entities[name] = {
|
14760 | attributes: []
|
14761 | };
|
14762 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Added new entity :', name);
|
14763 | }
|
14764 |
|
14765 | return entities[name];
|
14766 | };
|
14767 |
|
14768 | var getEntities = function getEntities() {
|
14769 | return entities;
|
14770 | };
|
14771 |
|
14772 | var addAttributes = function addAttributes(entityName, attribs) {
|
14773 | var entity = addEntity(entityName); // May do nothing (if entity has already been added)
|
14774 | // Process attribs in reverse order due to effect of recursive construction (last attribute is first)
|
14775 |
|
14776 | var i;
|
14777 |
|
14778 | for (i = attribs.length - 1; i >= 0; i--) {
|
14779 | entity.attributes.push(attribs[i]);
|
14780 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Added attribute ', attribs[i].attributeName);
|
14781 | }
|
14782 | };
|
14783 | /**
|
14784 | * Add a relationship
|
14785 | * @param entA The first entity in the relationship
|
14786 | * @param rolA The role played by the first entity in relation to the second
|
14787 | * @param entB The second entity in the relationship
|
14788 | * @param rSpec The details of the relationship between the two entities
|
14789 | */
|
14790 |
|
14791 |
|
14792 | var addRelationship = function addRelationship(entA, rolA, entB, rSpec) {
|
14793 | var rel = {
|
14794 | entityA: entA,
|
14795 | roleA: rolA,
|
14796 | entityB: entB,
|
14797 | relSpec: rSpec
|
14798 | };
|
14799 | relationships.push(rel);
|
14800 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Added new relationship :', rel);
|
14801 | };
|
14802 |
|
14803 | var getRelationships = function getRelationships() {
|
14804 | return relationships;
|
14805 | }; // Keep this - TODO: revisit...allow the diagram to have a title
|
14806 |
|
14807 |
|
14808 | var setTitle = function setTitle(txt) {
|
14809 | title = txt;
|
14810 | };
|
14811 |
|
14812 | var getTitle = function getTitle() {
|
14813 | return title;
|
14814 | };
|
14815 |
|
14816 | var clear = function clear() {
|
14817 | entities = {};
|
14818 | relationships = [];
|
14819 | title = '';
|
14820 | };
|
14821 |
|
14822 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
14823 | Cardinality: Cardinality,
|
14824 | Identification: Identification,
|
14825 | parseDirective: parseDirective,
|
14826 | getConfig: function getConfig() {
|
14827 | return _config__WEBPACK_IMPORTED_MODULE_2__.getConfig().er;
|
14828 | },
|
14829 | addEntity: addEntity,
|
14830 | addAttributes: addAttributes,
|
14831 | getEntities: getEntities,
|
14832 | addRelationship: addRelationship,
|
14833 | getRelationships: getRelationships,
|
14834 | clear: clear,
|
14835 | setTitle: setTitle,
|
14836 | getTitle: getTitle
|
14837 | });
|
14838 |
|
14839 | /***/ }),
|
14840 |
|
14841 | /***/ "./src/diagrams/er/erMarkers.js":
|
14842 | /*!**************************************!*\
|
14843 | !*** ./src/diagrams/er/erMarkers.js ***!
|
14844 | \**************************************/
|
14845 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
14846 |
|
14847 | "use strict";
|
14848 | __webpack_require__.r(__webpack_exports__);
|
14849 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
14850 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
14851 | /* harmony export */ });
|
14852 | var ERMarkers = {
|
14853 | ONLY_ONE_START: 'ONLY_ONE_START',
|
14854 | ONLY_ONE_END: 'ONLY_ONE_END',
|
14855 | ZERO_OR_ONE_START: 'ZERO_OR_ONE_START',
|
14856 | ZERO_OR_ONE_END: 'ZERO_OR_ONE_END',
|
14857 | ONE_OR_MORE_START: 'ONE_OR_MORE_START',
|
14858 | ONE_OR_MORE_END: 'ONE_OR_MORE_END',
|
14859 | ZERO_OR_MORE_START: 'ZERO_OR_MORE_START',
|
14860 | ZERO_OR_MORE_END: 'ZERO_OR_MORE_END'
|
14861 | };
|
14862 | /**
|
14863 | * Put the markers into the svg DOM for later use with edge paths
|
14864 | */
|
14865 |
|
14866 | var insertMarkers = function insertMarkers(elem, conf) {
|
14867 | var marker;
|
14868 | 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');
|
14869 | 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');
|
14870 | 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');
|
14871 | marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 21).attr('cy', 9).attr('r', 6);
|
14872 | marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M9,0 L9,18');
|
14873 | 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');
|
14874 | marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 9).attr('cy', 9).attr('r', 6);
|
14875 | marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M21,0 L21,18');
|
14876 | 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');
|
14877 | 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');
|
14878 | 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');
|
14879 | marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 48).attr('cy', 18).attr('r', 6);
|
14880 | marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M0,18 Q18,0 36,18 Q18,36 0,18');
|
14881 | 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');
|
14882 | marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 9).attr('cy', 18).attr('r', 6);
|
14883 | marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M21,18 Q39,0 57,18 Q39,36 21,18');
|
14884 | return;
|
14885 | };
|
14886 |
|
14887 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
14888 | ERMarkers: ERMarkers,
|
14889 | insertMarkers: insertMarkers
|
14890 | });
|
14891 |
|
14892 | /***/ }),
|
14893 |
|
14894 | /***/ "./src/diagrams/er/erRenderer.js":
|
14895 | /*!***************************************!*\
|
14896 | !*** ./src/diagrams/er/erRenderer.js ***!
|
14897 | \***************************************/
|
14898 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
14899 |
|
14900 | "use strict";
|
14901 | __webpack_require__.r(__webpack_exports__);
|
14902 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
14903 | /* harmony export */ "setConf": () => (/* binding */ setConf),
|
14904 | /* harmony export */ "draw": () => (/* binding */ draw),
|
14905 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
14906 | /* harmony export */ });
|
14907 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
|
14908 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
|
14909 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
|
14910 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
|
14911 | /* harmony import */ var _erDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./erDb */ "./src/diagrams/er/erDb.js");
|
14912 | /* harmony import */ var _parser_erDiagram__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./parser/erDiagram */ "./src/diagrams/er/parser/erDiagram.jison");
|
14913 | /* harmony import */ var _parser_erDiagram__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_parser_erDiagram__WEBPACK_IMPORTED_MODULE_7__);
|
14914 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dagre */ "dagre");
|
14915 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_2__);
|
14916 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
14917 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
14918 | /* harmony import */ var _erMarkers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./erMarkers */ "./src/diagrams/er/erMarkers.js");
|
14919 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
14920 |
|
14921 |
|
14922 |
|
14923 |
|
14924 |
|
14925 |
|
14926 |
|
14927 |
|
14928 |
|
14929 | var conf = {};
|
14930 | /**
|
14931 | * Allows the top-level API module to inject config specific to this renderer,
|
14932 | * storing it in the local conf object. Note that generic config still needs to be
|
14933 | * retrieved using getConfig() imported from the config module
|
14934 | */
|
14935 |
|
14936 | var setConf = function setConf(cnf) {
|
14937 | var keys = Object.keys(cnf);
|
14938 |
|
14939 | for (var i = 0; i < keys.length; i++) {
|
14940 | conf[keys[i]] = cnf[keys[i]];
|
14941 | }
|
14942 | };
|
14943 | /**
|
14944 | * Draw attributes for an entity
|
14945 | * @param groupNode the svg group node for the entity
|
14946 | * @param entityTextNode the svg node for the entity label text
|
14947 | * @param attributes an array of attributes defined for the entity (each attribute has a type and a name)
|
14948 | * @return the bounding box of the entity, after attributes have been added
|
14949 | */
|
14950 |
|
14951 | var drawAttributes = function drawAttributes(groupNode, entityTextNode, attributes) {
|
14952 | var heightPadding = conf.entityPadding / 3; // Padding internal to attribute boxes
|
14953 |
|
14954 | var widthPadding = conf.entityPadding / 3; // Ditto
|
14955 |
|
14956 | var attrFontSize = conf.fontSize * 0.85;
|
14957 | var labelBBox = entityTextNode.node().getBBox();
|
14958 | var attributeNodes = []; // Intermediate storage for attribute nodes created so that we can do a second pass
|
14959 |
|
14960 | var hasKeyType = false;
|
14961 | var hasComment = false;
|
14962 | var maxWidth = 0;
|
14963 | var maxTypeWidth = 0;
|
14964 | var maxNameWidth = 0;
|
14965 | var maxKeyWidth = 0;
|
14966 | var maxCommentWidth = 0;
|
14967 | var cumulativeHeight = labelBBox.height + heightPadding * 2;
|
14968 | var attrNum = 1;
|
14969 | attributes.forEach(function (item) {
|
14970 | var attrPrefix = "".concat(entityTextNode.node().id, "-attr-").concat(attrNum);
|
14971 | var nodeWidth = 0;
|
14972 | var nodeHeight = 0; // Add a text node for the attribute type
|
14973 |
|
14974 | 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
|
14975 |
|
14976 | 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);
|
14977 | var attributeNode = {};
|
14978 | attributeNode.tn = typeNode;
|
14979 | attributeNode.nn = nameNode;
|
14980 | var typeBBox = typeNode.node().getBBox();
|
14981 | var nameBBox = nameNode.node().getBBox();
|
14982 | maxTypeWidth = Math.max(maxTypeWidth, typeBBox.width);
|
14983 | maxNameWidth = Math.max(maxNameWidth, nameBBox.width);
|
14984 | nodeWidth += typeBBox.width;
|
14985 | nodeWidth += nameBBox.width;
|
14986 | nodeHeight = Math.max(typeBBox.height, nameBBox.height);
|
14987 |
|
14988 | if (hasKeyType || item.attributeKeyType !== undefined) {
|
14989 | var keyTypeNode = 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.attributeKeyType || '');
|
14990 | attributeNode.kn = keyTypeNode;
|
14991 | var keyTypeBBox = keyTypeNode.node().getBBox();
|
14992 | nodeWidth += keyTypeBBox.width;
|
14993 | maxKeyWidth = Math.max(maxKeyWidth, nodeWidth);
|
14994 | nodeHeight = Math.max(nodeHeight, keyTypeBBox.height);
|
14995 | hasKeyType = true;
|
14996 | }
|
14997 |
|
14998 | if (hasComment || item.attributeComment !== undefined) {
|
14999 | var commentNode = 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.attributeComment || '');
|
15000 | attributeNode.cn = commentNode;
|
15001 | var commentNodeBBox = commentNode.node().getBBox();
|
15002 | nodeWidth += commentNodeBBox.width;
|
15003 | maxCommentWidth = Math.max(nodeWidth, nameBBox.width);
|
15004 | nodeHeight = Math.max(nodeHeight, commentNodeBBox.height);
|
15005 | hasComment = true;
|
15006 | }
|
15007 |
|
15008 | attributeNode.height = nodeHeight; // Keep a reference to the nodes so that we can iterate through them later
|
15009 |
|
15010 | attributeNodes.push(attributeNode);
|
15011 | maxWidth = Math.max(maxWidth, nodeWidth);
|
15012 | cumulativeHeight += nodeHeight + heightPadding * 2;
|
15013 | attrNum += 1;
|
15014 | }); // Calculate the new bounding box of the overall entity, now that attributes have been added
|
15015 |
|
15016 | var bBox = {
|
15017 | width: Math.max(conf.minEntityWidth, Math.max(labelBBox.width + conf.entityPadding * 2, maxWidth + widthPadding * 4)),
|
15018 | height: attributes.length > 0 ? cumulativeHeight : Math.max(conf.minEntityHeight, labelBBox.height + conf.entityPadding * 2)
|
15019 | }; // There might be some spare width for padding out attributes if the entity name is very long
|
15020 |
|
15021 | var spareWidth = Math.max(0, bBox.width - maxWidth - widthPadding * 4);
|
15022 |
|
15023 | if (attributes.length > 0) {
|
15024 | // Position the entity label near the top of the entity bounding box
|
15025 | entityTextNode.attr('transform', 'translate(' + bBox.width / 2 + ',' + (heightPadding + labelBBox.height / 2) + ')'); // Add rectangular boxes for the attribute types/names
|
15026 |
|
15027 | var heightOffset = labelBBox.height + heightPadding * 2; // Start at the bottom of the entity label
|
15028 |
|
15029 | var attribStyle = 'attributeBoxOdd'; // We will flip the style on alternate rows to achieve a banded effect
|
15030 |
|
15031 | attributeNodes.forEach(function (attributeNode) {
|
15032 | // Calculate the alignment y co-ordinate for the type/name of the attribute
|
15033 | var alignY = heightOffset + heightPadding + attributeNode.height / 2; // Position the type of the attribute
|
15034 |
|
15035 | attributeNode.tn.attr('transform', 'translate(' + widthPadding + ',' + alignY + ')'); // Insert a rectangle for the type
|
15036 |
|
15037 | 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 * 2 + spareWidth / 2).attr('height', attributeNode.tn.node().getBBox().height + heightPadding * 2); // Position the name of the attribute
|
15038 |
|
15039 | attributeNode.nn.attr('transform', 'translate(' + (parseFloat(typeRect.attr('width')) + widthPadding) + ',' + alignY + ')'); // Insert a rectangle for the name
|
15040 |
|
15041 | 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', "".concat(typeRect.attr('x') + typeRect.attr('width'))).attr('y', heightOffset).attr('width', maxNameWidth + widthPadding * 2 + spareWidth / 2).attr('height', attributeNode.nn.node().getBBox().height + heightPadding * 2);
|
15042 |
|
15043 | if (hasKeyType) {
|
15044 | // Position the name of the attribute
|
15045 | attributeNode.kn.attr('transform', 'translate(' + (parseFloat(typeRect.attr('width')) + widthPadding) + ',' + alignY + ')'); // Insert a rectangle for the name
|
15046 |
|
15047 | 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', "".concat(typeRect.attr('x') + typeRect.attr('width'))).attr('y', heightOffset).attr('width', maxKeyWidth + widthPadding * 2 + spareWidth / 2).attr('height', attributeNode.kn.node().getBBox().height + heightPadding * 2);
|
15048 | }
|
15049 |
|
15050 | if (hasComment) {
|
15051 | // Position the name of the attribute
|
15052 | attributeNode.cn.attr('transform', 'translate(' + (parseFloat(typeRect.attr('width')) + widthPadding) + ',' + alignY + ')'); // Insert a rectangle for the name
|
15053 |
|
15054 | 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', "".concat(typeRect.attr('x') + typeRect.attr('width'))).attr('y', heightOffset).attr('width', maxCommentWidth + widthPadding * 2 + spareWidth / 2).attr('height', attributeNode.cn.node().getBBox().height + heightPadding * 2);
|
15055 | } // Increment the height offset to move to the next row
|
15056 |
|
15057 |
|
15058 | heightOffset += attributeNode.height + heightPadding * 2; // Flip the attribute style for row banding
|
15059 |
|
15060 | attribStyle = attribStyle == 'attributeBoxOdd' ? 'attributeBoxEven' : 'attributeBoxOdd';
|
15061 | });
|
15062 | } else {
|
15063 | // Ensure the entity box is a decent size without any attributes
|
15064 | bBox.height = Math.max(conf.minEntityHeight, cumulativeHeight); // Position the entity label in the middle of the box
|
15065 |
|
15066 | entityTextNode.attr('transform', 'translate(' + bBox.width / 2 + ',' + bBox.height / 2 + ')');
|
15067 | }
|
15068 |
|
15069 | return bBox;
|
15070 | };
|
15071 | /**
|
15072 | * Use D3 to construct the svg elements for the entities
|
15073 | * @param svgNode the svg node that contains the diagram
|
15074 | * @param entities The entities to be drawn
|
15075 | * @param graph The graph that contains the vertex and edge definitions post-layout
|
15076 | * @return The first entity that was inserted
|
15077 | */
|
15078 |
|
15079 |
|
15080 | var drawEntities = function drawEntities(svgNode, entities, graph) {
|
15081 | var keys = Object.keys(entities);
|
15082 | var firstOne;
|
15083 | keys.forEach(function (id) {
|
15084 | // Create a group for each entity
|
15085 | var groupNode = svgNode.append('g').attr('id', id);
|
15086 | firstOne = firstOne === undefined ? id : firstOne; // Label the entity - this is done first so that we can get the bounding box
|
15087 | // which then determines the size of the rectangle
|
15088 |
|
15089 | var textId = 'entity-' + id;
|
15090 | 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);
|
15091 |
|
15092 | var _drawAttributes = drawAttributes(groupNode, textNode, entities[id].attributes),
|
15093 | entityWidth = _drawAttributes.width,
|
15094 | entityHeight = _drawAttributes.height; // Draw the rectangle - insert it before the text so that the text is not obscured
|
15095 |
|
15096 |
|
15097 | 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);
|
15098 | var rectBBox = rectNode.node().getBBox(); // Add the entity to the graph
|
15099 |
|
15100 | graph.setNode(id, {
|
15101 | width: rectBBox.width,
|
15102 | height: rectBBox.height,
|
15103 | shape: 'rect',
|
15104 | id: id
|
15105 | });
|
15106 | });
|
15107 | return firstOne;
|
15108 | }; // drawEntities
|
15109 |
|
15110 |
|
15111 | var adjustEntities = function adjustEntities(svgNode, graph) {
|
15112 | graph.nodes().forEach(function (v) {
|
15113 | if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
|
15114 | svgNode.select('#' + v).attr('transform', 'translate(' + (graph.node(v).x - graph.node(v).width / 2) + ',' + (graph.node(v).y - graph.node(v).height / 2) + ' )');
|
15115 | }
|
15116 | });
|
15117 | return;
|
15118 | };
|
15119 |
|
15120 | var getEdgeName = function getEdgeName(rel) {
|
15121 | return (rel.entityA + rel.roleA + rel.entityB).replace(/\s/g, '');
|
15122 | };
|
15123 | /**
|
15124 | * Add each relationship to the graph
|
15125 | * @param relationships the relationships to be added
|
15126 | * @param g the graph
|
15127 | * @return {Array} The array of relationships
|
15128 | */
|
15129 |
|
15130 |
|
15131 | var addRelationships = function addRelationships(relationships, g) {
|
15132 | relationships.forEach(function (r) {
|
15133 | g.setEdge(r.entityA, r.entityB, {
|
15134 | relationship: r
|
15135 | }, getEdgeName(r));
|
15136 | });
|
15137 | return relationships;
|
15138 | }; // addRelationships
|
15139 |
|
15140 |
|
15141 | var relCnt = 0;
|
15142 | /**
|
15143 | * Draw a relationship using edge information from the graph
|
15144 | * @param svg the svg node
|
15145 | * @param rel the relationship to draw in the svg
|
15146 | * @param g the graph containing the edge information
|
15147 | * @param insert the insertion point in the svg DOM (because relationships have markers that need to sit 'behind' opaque entity boxes)
|
15148 | */
|
15149 |
|
15150 | var drawRelationshipFromLayout = function drawRelationshipFromLayout(svg, rel, g, insert) {
|
15151 | relCnt++; // Find the edge relating to this relationship
|
15152 |
|
15153 | var edge = g.edge(rel.entityA, rel.entityB, getEdgeName(rel)); // Get a function that will generate the line path
|
15154 |
|
15155 | var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_1__.line)().x(function (d) {
|
15156 | return d.x;
|
15157 | }).y(function (d) {
|
15158 | return d.y;
|
15159 | }).curve(d3__WEBPACK_IMPORTED_MODULE_1__.curveBasis); // Insert the line at the right place
|
15160 |
|
15161 | 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
|
15162 |
|
15163 | if (rel.relSpec.relType === _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Identification.NON_IDENTIFYING) {
|
15164 | svgPath.attr('stroke-dasharray', '8,8');
|
15165 | } // TODO: Understand this better
|
15166 |
|
15167 |
|
15168 | var url = '';
|
15169 |
|
15170 | if (conf.arrowMarkerAbsolute) {
|
15171 | url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
|
15172 | url = url.replace(/\(/g, '\\(');
|
15173 | url = url.replace(/\)/g, '\\)');
|
15174 | } // Decide which start and end markers it needs. It may be possible to be more concise here
|
15175 | // by reversing a start marker to make an end marker...but this will do for now
|
15176 | // Note that the 'A' entity's marker is at the end of the relationship and the 'B' entity's marker is at the start
|
15177 |
|
15178 |
|
15179 | switch (rel.relSpec.cardA) {
|
15180 | case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ZERO_OR_ONE:
|
15181 | svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ZERO_OR_ONE_END + ')');
|
15182 | break;
|
15183 |
|
15184 | case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ZERO_OR_MORE:
|
15185 | svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ZERO_OR_MORE_END + ')');
|
15186 | break;
|
15187 |
|
15188 | case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ONE_OR_MORE:
|
15189 | svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ONE_OR_MORE_END + ')');
|
15190 | break;
|
15191 |
|
15192 | case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ONLY_ONE:
|
15193 | svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ONLY_ONE_END + ')');
|
15194 | break;
|
15195 | }
|
15196 |
|
15197 | switch (rel.relSpec.cardB) {
|
15198 | case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ZERO_OR_ONE:
|
15199 | svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ZERO_OR_ONE_START + ')');
|
15200 | break;
|
15201 |
|
15202 | case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ZERO_OR_MORE:
|
15203 | svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ZERO_OR_MORE_START + ')');
|
15204 | break;
|
15205 |
|
15206 | case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ONE_OR_MORE:
|
15207 | svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ONE_OR_MORE_START + ')');
|
15208 | break;
|
15209 |
|
15210 | case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ONLY_ONE:
|
15211 | svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ONLY_ONE_START + ')');
|
15212 | break;
|
15213 | } // Now label the relationship
|
15214 | // Find the half-way point
|
15215 |
|
15216 |
|
15217 | var len = svgPath.node().getTotalLength();
|
15218 | var labelPoint = svgPath.node().getPointAtLength(len * 0.5); // Append a text node containing the label
|
15219 |
|
15220 | var labelId = 'rel' + relCnt;
|
15221 | 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
|
15222 |
|
15223 | var labelBBox = labelNode.node().getBBox(); // Insert the opaque rectangle before the text label
|
15224 |
|
15225 | 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%');
|
15226 | return;
|
15227 | };
|
15228 | /**
|
15229 | * Draw en E-R diagram in the tag with id: id based on the text definition of the diagram
|
15230 | * @param text the text of the diagram
|
15231 | * @param id the unique id of the DOM node that contains the diagram
|
15232 | */
|
15233 |
|
15234 |
|
15235 | var draw = function draw(text, id) {
|
15236 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('Drawing ER diagram');
|
15237 | _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].clear();
|
15238 | var parser = (_parser_erDiagram__WEBPACK_IMPORTED_MODULE_7___default().parser);
|
15239 | parser.yy = _erDb__WEBPACK_IMPORTED_MODULE_4__["default"]; // Parse the text to populate erDb
|
15240 |
|
15241 | try {
|
15242 | parser.parse(text);
|
15243 | } catch (err) {
|
15244 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Parsing failed');
|
15245 | } // Get a reference to the svg node that contains the text
|
15246 |
|
15247 |
|
15248 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)("[id='".concat(id, "']")); // Add cardinality marker definitions to the svg
|
15249 |
|
15250 | _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].insertMarkers(svg, conf); // Now we have to construct the diagram in a specific way:
|
15251 | // ---
|
15252 | // 1. Create all the entities in the svg node at 0,0, but with the correct dimensions (allowing for text content)
|
15253 | // 2. Make sure they are all added to the graph
|
15254 | // 3. Add all the edges (relationships) to the graph aswell
|
15255 | // 4. Let dagre do its magic to layout the graph. This assigns:
|
15256 | // - the centre co-ordinates for each node, bearing in mind the dimensions and edge relationships
|
15257 | // - the path co-ordinates for each edge
|
15258 | // But it has no impact on the svg child nodes - the diagram remains with every entity rooted at 0,0
|
15259 | // 5. Now assign a transform to each entity in the svg node so that it gets drawn in the correct place, as determined by
|
15260 | // its centre point, which is obtained from the graph, and it's width and height
|
15261 | // 6. And finally, create all the edges in the svg node using information from the graph
|
15262 | // ---
|
15263 | // Create the graph
|
15264 |
|
15265 | var g; // TODO: Explore directed vs undirected graphs, and how the layout is affected
|
15266 | // An E-R diagram could be said to be undirected, but there is merit in setting
|
15267 | // the direction from parent to child in a one-to-many as this influences graphlib to
|
15268 | // put the parent above the child (does it?), which is intuitive. Most relationships
|
15269 | // in ER diagrams are one-to-many.
|
15270 |
|
15271 | g = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
|
15272 | multigraph: true,
|
15273 | directed: true,
|
15274 | compound: false
|
15275 | }).setGraph({
|
15276 | rankdir: conf.layoutDirection,
|
15277 | marginx: 20,
|
15278 | marginy: 20,
|
15279 | nodesep: 100,
|
15280 | edgesep: 100,
|
15281 | ranksep: 100
|
15282 | }).setDefaultEdgeLabel(function () {
|
15283 | return {};
|
15284 | }); // Draw the entities (at 0,0), returning the first svg node that got
|
15285 | // inserted - this represents the insertion point for relationship paths
|
15286 |
|
15287 | var firstEntity = drawEntities(svg, _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].getEntities(), g); // TODO: externalise the addition of entities to the graph - it's a bit 'buried' in the above
|
15288 | // Add all the relationships to the graph
|
15289 |
|
15290 | var relationships = addRelationships(_erDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelationships(), g);
|
15291 | dagre__WEBPACK_IMPORTED_MODULE_2___default().layout(g); // Node and edge positions will be updated
|
15292 | // Adjust the positions of the entities so that they adhere to the layout
|
15293 |
|
15294 | adjustEntities(svg, g); // Draw the relationships
|
15295 |
|
15296 | relationships.forEach(function (rel) {
|
15297 | drawRelationshipFromLayout(svg, rel, g, firstEntity);
|
15298 | });
|
15299 | var padding = conf.diagramPadding;
|
15300 | var svgBounds = svg.node().getBBox();
|
15301 | var width = svgBounds.width + padding * 2;
|
15302 | var height = svgBounds.height + padding * 2;
|
15303 | (0,_utils__WEBPACK_IMPORTED_MODULE_8__.configureSvgSize)(svg, height, width, conf.useMaxWidth);
|
15304 | svg.attr('viewBox', "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height));
|
15305 | }; // draw
|
15306 |
|
15307 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
15308 | setConf: setConf,
|
15309 | draw: draw
|
15310 | });
|
15311 |
|
15312 | /***/ }),
|
15313 |
|
15314 | /***/ "./src/diagrams/er/styles.js":
|
15315 | /*!***********************************!*\
|
15316 | !*** ./src/diagrams/er/styles.js ***!
|
15317 | \***********************************/
|
15318 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
15319 |
|
15320 | "use strict";
|
15321 | __webpack_require__.r(__webpack_exports__);
|
15322 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
15323 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
15324 | /* harmony export */ });
|
15325 | var getStyles = function getStyles(options) {
|
15326 | 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");
|
15327 | };
|
15328 |
|
15329 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
15330 |
|
15331 | /***/ }),
|
15332 |
|
15333 | /***/ "./src/diagrams/flowchart/flowChartShapes.js":
|
15334 | /*!***************************************************!*\
|
15335 | !*** ./src/diagrams/flowchart/flowChartShapes.js ***!
|
15336 | \***************************************************/
|
15337 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
15338 |
|
15339 | "use strict";
|
15340 | __webpack_require__.r(__webpack_exports__);
|
15341 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
15342 | /* harmony export */ "addToRender": () => (/* binding */ addToRender),
|
15343 | /* harmony export */ "addToRenderV2": () => (/* binding */ addToRenderV2),
|
15344 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
15345 | /* harmony export */ });
|
15346 | /* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dagre-d3 */ "dagre-d3");
|
15347 | /* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dagre_d3__WEBPACK_IMPORTED_MODULE_0__);
|
15348 |
|
15349 |
|
15350 | function question(parent, bbox, node) {
|
15351 | var w = bbox.width;
|
15352 | var h = bbox.height;
|
15353 | var s = (w + h) * 0.9;
|
15354 | var points = [{
|
15355 | x: s / 2,
|
15356 | y: 0
|
15357 | }, {
|
15358 | x: s,
|
15359 | y: -s / 2
|
15360 | }, {
|
15361 | x: s / 2,
|
15362 | y: -s
|
15363 | }, {
|
15364 | x: 0,
|
15365 | y: -s / 2
|
15366 | }];
|
15367 | var shapeSvg = insertPolygonShape(parent, s, s, points);
|
15368 |
|
15369 | node.intersect = function (point) {
|
15370 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
15371 | };
|
15372 |
|
15373 | return shapeSvg;
|
15374 | }
|
15375 |
|
15376 | function hexagon(parent, bbox, node) {
|
15377 | var f = 4;
|
15378 | var h = bbox.height;
|
15379 | var m = h / f;
|
15380 | var w = bbox.width + 2 * m;
|
15381 | var points = [{
|
15382 | x: m,
|
15383 | y: 0
|
15384 | }, {
|
15385 | x: w - m,
|
15386 | y: 0
|
15387 | }, {
|
15388 | x: w,
|
15389 | y: -h / 2
|
15390 | }, {
|
15391 | x: w - m,
|
15392 | y: -h
|
15393 | }, {
|
15394 | x: m,
|
15395 | y: -h
|
15396 | }, {
|
15397 | x: 0,
|
15398 | y: -h / 2
|
15399 | }];
|
15400 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
15401 |
|
15402 | node.intersect = function (point) {
|
15403 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
15404 | };
|
15405 |
|
15406 | return shapeSvg;
|
15407 | }
|
15408 |
|
15409 | function rect_left_inv_arrow(parent, bbox, node) {
|
15410 | var w = bbox.width;
|
15411 | var h = bbox.height;
|
15412 | var points = [{
|
15413 | x: -h / 2,
|
15414 | y: 0
|
15415 | }, {
|
15416 | x: w,
|
15417 | y: 0
|
15418 | }, {
|
15419 | x: w,
|
15420 | y: -h
|
15421 | }, {
|
15422 | x: -h / 2,
|
15423 | y: -h
|
15424 | }, {
|
15425 | x: 0,
|
15426 | y: -h / 2
|
15427 | }];
|
15428 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
15429 |
|
15430 | node.intersect = function (point) {
|
15431 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
15432 | };
|
15433 |
|
15434 | return shapeSvg;
|
15435 | }
|
15436 |
|
15437 | function lean_right(parent, bbox, node) {
|
15438 | var w = bbox.width;
|
15439 | var h = bbox.height;
|
15440 | var points = [{
|
15441 | x: -2 * h / 6,
|
15442 | y: 0
|
15443 | }, {
|
15444 | x: w - h / 6,
|
15445 | y: 0
|
15446 | }, {
|
15447 | x: w + 2 * h / 6,
|
15448 | y: -h
|
15449 | }, {
|
15450 | x: h / 6,
|
15451 | y: -h
|
15452 | }];
|
15453 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
15454 |
|
15455 | node.intersect = function (point) {
|
15456 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
15457 | };
|
15458 |
|
15459 | return shapeSvg;
|
15460 | }
|
15461 |
|
15462 | function lean_left(parent, bbox, node) {
|
15463 | var w = bbox.width;
|
15464 | var h = bbox.height;
|
15465 | var points = [{
|
15466 | x: 2 * h / 6,
|
15467 | y: 0
|
15468 | }, {
|
15469 | x: w + h / 6,
|
15470 | y: 0
|
15471 | }, {
|
15472 | x: w - 2 * h / 6,
|
15473 | y: -h
|
15474 | }, {
|
15475 | x: -h / 6,
|
15476 | y: -h
|
15477 | }];
|
15478 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
15479 |
|
15480 | node.intersect = function (point) {
|
15481 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
15482 | };
|
15483 |
|
15484 | return shapeSvg;
|
15485 | }
|
15486 |
|
15487 | function trapezoid(parent, bbox, node) {
|
15488 | var w = bbox.width;
|
15489 | var h = bbox.height;
|
15490 | var points = [{
|
15491 | x: -2 * h / 6,
|
15492 | y: 0
|
15493 | }, {
|
15494 | x: w + 2 * h / 6,
|
15495 | y: 0
|
15496 | }, {
|
15497 | x: w - h / 6,
|
15498 | y: -h
|
15499 | }, {
|
15500 | x: h / 6,
|
15501 | y: -h
|
15502 | }];
|
15503 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
15504 |
|
15505 | node.intersect = function (point) {
|
15506 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
15507 | };
|
15508 |
|
15509 | return shapeSvg;
|
15510 | }
|
15511 |
|
15512 | function inv_trapezoid(parent, bbox, node) {
|
15513 | var w = bbox.width;
|
15514 | var h = bbox.height;
|
15515 | var points = [{
|
15516 | x: h / 6,
|
15517 | y: 0
|
15518 | }, {
|
15519 | x: w - h / 6,
|
15520 | y: 0
|
15521 | }, {
|
15522 | x: w + 2 * h / 6,
|
15523 | y: -h
|
15524 | }, {
|
15525 | x: -2 * h / 6,
|
15526 | y: -h
|
15527 | }];
|
15528 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
15529 |
|
15530 | node.intersect = function (point) {
|
15531 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
15532 | };
|
15533 |
|
15534 | return shapeSvg;
|
15535 | }
|
15536 |
|
15537 | function rect_right_inv_arrow(parent, bbox, node) {
|
15538 | var w = bbox.width;
|
15539 | var h = bbox.height;
|
15540 | var points = [{
|
15541 | x: 0,
|
15542 | y: 0
|
15543 | }, {
|
15544 | x: w + h / 2,
|
15545 | y: 0
|
15546 | }, {
|
15547 | x: w,
|
15548 | y: -h / 2
|
15549 | }, {
|
15550 | x: w + h / 2,
|
15551 | y: -h
|
15552 | }, {
|
15553 | x: 0,
|
15554 | y: -h
|
15555 | }];
|
15556 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
15557 |
|
15558 | node.intersect = function (point) {
|
15559 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
15560 | };
|
15561 |
|
15562 | return shapeSvg;
|
15563 | }
|
15564 |
|
15565 | function stadium(parent, bbox, node) {
|
15566 | var h = bbox.height;
|
15567 | var w = bbox.width + h / 4;
|
15568 | 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);
|
15569 |
|
15570 | node.intersect = function (point) {
|
15571 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.rect(node, point);
|
15572 | };
|
15573 |
|
15574 | return shapeSvg;
|
15575 | }
|
15576 |
|
15577 | function subroutine(parent, bbox, node) {
|
15578 | var w = bbox.width;
|
15579 | var h = bbox.height;
|
15580 | var points = [{
|
15581 | x: 0,
|
15582 | y: 0
|
15583 | }, {
|
15584 | x: w,
|
15585 | y: 0
|
15586 | }, {
|
15587 | x: w,
|
15588 | y: -h
|
15589 | }, {
|
15590 | x: 0,
|
15591 | y: -h
|
15592 | }, {
|
15593 | x: 0,
|
15594 | y: 0
|
15595 | }, {
|
15596 | x: -8,
|
15597 | y: 0
|
15598 | }, {
|
15599 | x: w + 8,
|
15600 | y: 0
|
15601 | }, {
|
15602 | x: w + 8,
|
15603 | y: -h
|
15604 | }, {
|
15605 | x: -8,
|
15606 | y: -h
|
15607 | }, {
|
15608 | x: -8,
|
15609 | y: 0
|
15610 | }];
|
15611 | var shapeSvg = insertPolygonShape(parent, w, h, points);
|
15612 |
|
15613 | node.intersect = function (point) {
|
15614 | return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
|
15615 | };
|
15616 |
|
15617 | return shapeSvg;
|
15618 | }
|
15619 |
|
15620 | function cylinder(parent, bbox, node) {
|
15621 | var w = bbox.width;
|
15622 | var rx = w / 2;
|
15623 | var ry = rx / (2.5 + w / 50);
|
15624 | var h = bbox.height + ry;
|
15625 | 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;
|
15626 | var shapeSvg = parent.attr('label-offset-y', ry).insert('path', ':first-child').attr('d', shape).attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')');
|
15627 |
|
15628 | node.intersect = function (point) {
|
15629 | var pos = dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.rect(node, point);
|
15630 | var x = pos.x - node.x;
|
15631 |
|
15632 | 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)) {
|
15633 | // ellipsis equation: x*x / a*a + y*y / b*b = 1
|
15634 | // solve for y to get adjustion value for pos.y
|
15635 | var y = ry * ry * (1 - x * x / (rx * rx));
|
15636 | if (y != 0) y = Math.sqrt(y);
|
15637 | y = ry - y;
|
15638 | if (point.y - node.y > 0) y = -y;
|
15639 | pos.y += y;
|
15640 | }
|
15641 |
|
15642 | return pos;
|
15643 | };
|
15644 |
|
15645 | return shapeSvg;
|
15646 | }
|
15647 |
|
15648 | function addToRender(render) {
|
15649 | render.shapes().question = question;
|
15650 | render.shapes().hexagon = hexagon;
|
15651 | render.shapes().stadium = stadium;
|
15652 | render.shapes().subroutine = subroutine;
|
15653 | render.shapes().cylinder = cylinder; // Add custom shape for box with inverted arrow on left side
|
15654 |
|
15655 | render.shapes().rect_left_inv_arrow = rect_left_inv_arrow; // Add custom shape for box with inverted arrow on left side
|
15656 |
|
15657 | render.shapes().lean_right = lean_right; // Add custom shape for box with inverted arrow on left side
|
15658 |
|
15659 | render.shapes().lean_left = lean_left; // Add custom shape for box with inverted arrow on left side
|
15660 |
|
15661 | render.shapes().trapezoid = trapezoid; // Add custom shape for box with inverted arrow on left side
|
15662 |
|
15663 | render.shapes().inv_trapezoid = inv_trapezoid; // Add custom shape for box with inverted arrow on right side
|
15664 |
|
15665 | render.shapes().rect_right_inv_arrow = rect_right_inv_arrow;
|
15666 | }
|
15667 | function addToRenderV2(addShape) {
|
15668 | addShape({
|
15669 | question: question
|
15670 | });
|
15671 | addShape({
|
15672 | hexagon: hexagon
|
15673 | });
|
15674 | addShape({
|
15675 | stadium: stadium
|
15676 | });
|
15677 | addShape({
|
15678 | subroutine: subroutine
|
15679 | });
|
15680 | addShape({
|
15681 | cylinder: cylinder
|
15682 | }); // Add custom shape for box with inverted arrow on left side
|
15683 |
|
15684 | addShape({
|
15685 | rect_left_inv_arrow: rect_left_inv_arrow
|
15686 | }); // Add custom shape for box with inverted arrow on left side
|
15687 |
|
15688 | addShape({
|
15689 | lean_right: lean_right
|
15690 | }); // Add custom shape for box with inverted arrow on left side
|
15691 |
|
15692 | addShape({
|
15693 | lean_left: lean_left
|
15694 | }); // Add custom shape for box with inverted arrow on left side
|
15695 |
|
15696 | addShape({
|
15697 | trapezoid: trapezoid
|
15698 | }); // Add custom shape for box with inverted arrow on left side
|
15699 |
|
15700 | addShape({
|
15701 | inv_trapezoid: inv_trapezoid
|
15702 | }); // Add custom shape for box with inverted arrow on right side
|
15703 |
|
15704 | addShape({
|
15705 | rect_right_inv_arrow: rect_right_inv_arrow
|
15706 | });
|
15707 | }
|
15708 |
|
15709 | function insertPolygonShape(parent, w, h, points) {
|
15710 | return parent.insert('polygon', ':first-child').attr('points', points.map(function (d) {
|
15711 | return d.x + ',' + d.y;
|
15712 | }).join(' ')).attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');
|
15713 | }
|
15714 |
|
15715 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
15716 | addToRender: addToRender,
|
15717 | addToRenderV2: addToRenderV2
|
15718 | });
|
15719 |
|
15720 | /***/ }),
|
15721 |
|
15722 | /***/ "./src/diagrams/flowchart/flowDb.js":
|
15723 | /*!******************************************!*\
|
15724 | !*** ./src/diagrams/flowchart/flowDb.js ***!
|
15725 | \******************************************/
|
15726 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
15727 |
|
15728 | "use strict";
|
15729 | __webpack_require__.r(__webpack_exports__);
|
15730 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
15731 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
15732 | /* harmony export */ "lookUpDomId": () => (/* binding */ lookUpDomId),
|
15733 | /* harmony export */ "addVertex": () => (/* binding */ addVertex),
|
15734 | /* harmony export */ "addSingleLink": () => (/* binding */ addSingleLink),
|
15735 | /* harmony export */ "addLink": () => (/* binding */ addLink),
|
15736 | /* harmony export */ "updateLinkInterpolate": () => (/* binding */ updateLinkInterpolate),
|
15737 | /* harmony export */ "updateLink": () => (/* binding */ updateLink),
|
15738 | /* harmony export */ "addClass": () => (/* binding */ addClass),
|
15739 | /* harmony export */ "setDirection": () => (/* binding */ setDirection),
|
15740 | /* harmony export */ "setClass": () => (/* binding */ setClass),
|
15741 | /* harmony export */ "setLink": () => (/* binding */ setLink),
|
15742 | /* harmony export */ "getTooltip": () => (/* binding */ getTooltip),
|
15743 | /* harmony export */ "setClickEvent": () => (/* binding */ setClickEvent),
|
15744 | /* harmony export */ "bindFunctions": () => (/* binding */ bindFunctions),
|
15745 | /* harmony export */ "getDirection": () => (/* binding */ getDirection),
|
15746 | /* harmony export */ "getVertices": () => (/* binding */ getVertices),
|
15747 | /* harmony export */ "getEdges": () => (/* binding */ getEdges),
|
15748 | /* harmony export */ "getClasses": () => (/* binding */ getClasses),
|
15749 | /* harmony export */ "clear": () => (/* binding */ clear),
|
15750 | /* harmony export */ "setGen": () => (/* binding */ setGen),
|
15751 | /* harmony export */ "defaultStyle": () => (/* binding */ defaultStyle),
|
15752 | /* harmony export */ "addSubGraph": () => (/* binding */ addSubGraph),
|
15753 | /* harmony export */ "getDepthFirstPos": () => (/* binding */ getDepthFirstPos),
|
15754 | /* harmony export */ "indexNodes": () => (/* binding */ indexNodes),
|
15755 | /* harmony export */ "getSubGraphs": () => (/* binding */ getSubGraphs),
|
15756 | /* harmony export */ "firstGraph": () => (/* binding */ firstGraph),
|
15757 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
15758 | /* harmony export */ });
|
15759 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
15760 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
15761 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
15762 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
15763 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
15764 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
15765 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
15766 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
15767 |
|
15768 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
15769 |
|
15770 | 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."); }
|
15771 |
|
15772 | 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); }
|
15773 |
|
15774 | function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
15775 |
|
15776 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
15777 |
|
15778 | 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; }
|
15779 |
|
15780 |
|
15781 |
|
15782 |
|
15783 |
|
15784 |
|
15785 |
|
15786 | var MERMAID_DOM_ID_PREFIX = 'flowchart-';
|
15787 | var vertexCounter = 0;
|
15788 | var config = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig();
|
15789 | var vertices = {};
|
15790 | var edges = [];
|
15791 | var classes = [];
|
15792 | var subGraphs = [];
|
15793 | var subGraphLookup = {};
|
15794 | var tooltips = {};
|
15795 | var subCount = 0;
|
15796 | var firstGraphFlag = true;
|
15797 | var direction;
|
15798 | var version; // As in graph
|
15799 | // Functions to be run after graph rendering
|
15800 |
|
15801 | var funs = [];
|
15802 | var parseDirective = function parseDirective(statement, context, type) {
|
15803 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__["default"].parseDirective(this, statement, context, type);
|
15804 | };
|
15805 | /**
|
15806 | * Function to lookup domId from id in the graph definition.
|
15807 | * @param id
|
15808 | * @public
|
15809 | */
|
15810 |
|
15811 | var lookUpDomId = function lookUpDomId(id) {
|
15812 | var veritceKeys = Object.keys(vertices);
|
15813 |
|
15814 | for (var i = 0; i < veritceKeys.length; i++) {
|
15815 | if (vertices[veritceKeys[i]].id === id) {
|
15816 | return vertices[veritceKeys[i]].domId;
|
15817 | }
|
15818 | }
|
15819 |
|
15820 | return id;
|
15821 | };
|
15822 | /**
|
15823 | * Function called by parser when a node definition has been found
|
15824 | * @param id
|
15825 | * @param text
|
15826 | * @param type
|
15827 | * @param style
|
15828 | * @param classes
|
15829 | */
|
15830 |
|
15831 | var addVertex = function addVertex(_id, text, type, style, classes, dir) {
|
15832 | var txt;
|
15833 | var id = _id;
|
15834 |
|
15835 | if (typeof id === 'undefined') {
|
15836 | return;
|
15837 | }
|
15838 |
|
15839 | if (id.trim().length === 0) {
|
15840 | return;
|
15841 | } // if (id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
15842 |
|
15843 |
|
15844 | if (typeof vertices[id] === 'undefined') {
|
15845 | vertices[id] = {
|
15846 | id: id,
|
15847 | domId: MERMAID_DOM_ID_PREFIX + id + '-' + vertexCounter,
|
15848 | styles: [],
|
15849 | classes: []
|
15850 | };
|
15851 | }
|
15852 |
|
15853 | vertexCounter++;
|
15854 |
|
15855 | if (typeof text !== 'undefined') {
|
15856 | config = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig();
|
15857 | txt = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(text.trim(), config); // strip quotes if string starts and ends with a quote
|
15858 |
|
15859 | if (txt[0] === '"' && txt[txt.length - 1] === '"') {
|
15860 | txt = txt.substring(1, txt.length - 1);
|
15861 | }
|
15862 |
|
15863 | vertices[id].text = txt;
|
15864 | } else {
|
15865 | if (typeof vertices[id].text === 'undefined') {
|
15866 | vertices[id].text = _id;
|
15867 | }
|
15868 | }
|
15869 |
|
15870 | if (typeof type !== 'undefined') {
|
15871 | vertices[id].type = type;
|
15872 | }
|
15873 |
|
15874 | if (typeof style !== 'undefined') {
|
15875 | if (style !== null) {
|
15876 | style.forEach(function (s) {
|
15877 | vertices[id].styles.push(s);
|
15878 | });
|
15879 | }
|
15880 | }
|
15881 |
|
15882 | if (typeof classes !== 'undefined') {
|
15883 | if (classes !== null) {
|
15884 | classes.forEach(function (s) {
|
15885 | vertices[id].classes.push(s);
|
15886 | });
|
15887 | }
|
15888 | }
|
15889 |
|
15890 | if (typeof dir !== 'undefined') {
|
15891 | vertices[id].dir = dir;
|
15892 | }
|
15893 | };
|
15894 | /**
|
15895 | * Function called by parser when a link/edge definition has been found
|
15896 | * @param start
|
15897 | * @param end
|
15898 | * @param type
|
15899 | * @param linktext
|
15900 | */
|
15901 |
|
15902 | var addSingleLink = function addSingleLink(_start, _end, type, linktext) {
|
15903 | var start = _start;
|
15904 | var end = _end; // if (start[0].match(/\d/)) start = MERMAID_DOM_ID_PREFIX + start;
|
15905 | // if (end[0].match(/\d/)) end = MERMAID_DOM_ID_PREFIX + end;
|
15906 | // log.info('Got edge...', start, end);
|
15907 |
|
15908 | var edge = {
|
15909 | start: start,
|
15910 | end: end,
|
15911 | type: undefined,
|
15912 | text: ''
|
15913 | };
|
15914 | linktext = type.text;
|
15915 |
|
15916 | if (typeof linktext !== 'undefined') {
|
15917 | edge.text = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(linktext.trim(), config); // strip quotes if string starts and exnds with a quote
|
15918 |
|
15919 | if (edge.text[0] === '"' && edge.text[edge.text.length - 1] === '"') {
|
15920 | edge.text = edge.text.substring(1, edge.text.length - 1);
|
15921 | }
|
15922 | }
|
15923 |
|
15924 | if (typeof type !== 'undefined') {
|
15925 | edge.type = type.type;
|
15926 | edge.stroke = type.stroke;
|
15927 | edge.length = type.length;
|
15928 | }
|
15929 |
|
15930 | edges.push(edge);
|
15931 | };
|
15932 | var addLink = function addLink(_start, _end, type, linktext) {
|
15933 | var i, j;
|
15934 |
|
15935 | for (i = 0; i < _start.length; i++) {
|
15936 | for (j = 0; j < _end.length; j++) {
|
15937 | addSingleLink(_start[i], _end[j], type, linktext);
|
15938 | }
|
15939 | }
|
15940 | };
|
15941 | /**
|
15942 | * Updates a link's line interpolation algorithm
|
15943 | * @param pos
|
15944 | * @param interpolate
|
15945 | */
|
15946 |
|
15947 | var updateLinkInterpolate = function updateLinkInterpolate(positions, interp) {
|
15948 | positions.forEach(function (pos) {
|
15949 | if (pos === 'default') {
|
15950 | edges.defaultInterpolate = interp;
|
15951 | } else {
|
15952 | edges[pos].interpolate = interp;
|
15953 | }
|
15954 | });
|
15955 | };
|
15956 | /**
|
15957 | * Updates a link with a style
|
15958 | * @param pos
|
15959 | * @param style
|
15960 | */
|
15961 |
|
15962 | var updateLink = function updateLink(positions, style) {
|
15963 | positions.forEach(function (pos) {
|
15964 | if (pos === 'default') {
|
15965 | edges.defaultStyle = style;
|
15966 | } else {
|
15967 | if (_utils__WEBPACK_IMPORTED_MODULE_4__["default"].isSubstringInArray('fill', style) === -1) {
|
15968 | style.push('fill:none');
|
15969 | }
|
15970 |
|
15971 | edges[pos].style = style;
|
15972 | }
|
15973 | });
|
15974 | };
|
15975 | var addClass = function addClass(id, style) {
|
15976 | if (typeof classes[id] === 'undefined') {
|
15977 | classes[id] = {
|
15978 | id: id,
|
15979 | styles: [],
|
15980 | textStyles: []
|
15981 | };
|
15982 | }
|
15983 |
|
15984 | if (typeof style !== 'undefined') {
|
15985 | if (style !== null) {
|
15986 | style.forEach(function (s) {
|
15987 | if (s.match('color')) {
|
15988 | var newStyle1 = s.replace('fill', 'bgFill');
|
15989 | var newStyle2 = newStyle1.replace('color', 'fill');
|
15990 | classes[id].textStyles.push(newStyle2);
|
15991 | }
|
15992 |
|
15993 | classes[id].styles.push(s);
|
15994 | });
|
15995 | }
|
15996 | }
|
15997 | };
|
15998 | /**
|
15999 | * Called by parser when a graph definition is found, stores the direction of the chart.
|
16000 | * @param dir
|
16001 | */
|
16002 |
|
16003 | var setDirection = function setDirection(dir) {
|
16004 | direction = dir;
|
16005 |
|
16006 | if (direction.match(/.*</)) {
|
16007 | direction = 'RL';
|
16008 | }
|
16009 |
|
16010 | if (direction.match(/.*\^/)) {
|
16011 | direction = 'BT';
|
16012 | }
|
16013 |
|
16014 | if (direction.match(/.*>/)) {
|
16015 | direction = 'LR';
|
16016 | }
|
16017 |
|
16018 | if (direction.match(/.*v/)) {
|
16019 | direction = 'TB';
|
16020 | }
|
16021 | };
|
16022 | /**
|
16023 | * Called by parser when a special node is found, e.g. a clickable element.
|
16024 | * @param ids Comma separated list of ids
|
16025 | * @param className Class to add
|
16026 | */
|
16027 |
|
16028 | var setClass = function setClass(ids, className) {
|
16029 | ids.split(',').forEach(function (_id) {
|
16030 | // let id = version === 'gen-2' ? lookUpDomId(_id) : _id;
|
16031 | var id = _id; // if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
16032 |
|
16033 | if (typeof vertices[id] !== 'undefined') {
|
16034 | vertices[id].classes.push(className);
|
16035 | }
|
16036 |
|
16037 | if (typeof subGraphLookup[id] !== 'undefined') {
|
16038 | subGraphLookup[id].classes.push(className);
|
16039 | }
|
16040 | });
|
16041 | };
|
16042 |
|
16043 | var setTooltip = function setTooltip(ids, tooltip) {
|
16044 | ids.split(',').forEach(function (id) {
|
16045 | if (typeof tooltip !== 'undefined') {
|
16046 | tooltips[version === 'gen-1' ? lookUpDomId(id) : id] = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(tooltip, config);
|
16047 | }
|
16048 | });
|
16049 | };
|
16050 |
|
16051 | var setClickFun = function setClickFun(id, functionName, functionArgs) {
|
16052 | var domId = lookUpDomId(id); // if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
16053 |
|
16054 | if (_config__WEBPACK_IMPORTED_MODULE_1__.getConfig().securityLevel !== 'loose') {
|
16055 | return;
|
16056 | }
|
16057 |
|
16058 | if (typeof functionName === 'undefined') {
|
16059 | return;
|
16060 | }
|
16061 |
|
16062 | var argList = [];
|
16063 |
|
16064 | if (typeof functionArgs === 'string') {
|
16065 | /* Splits functionArgs by ',', ignoring all ',' in double quoted strings */
|
16066 | argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
|
16067 |
|
16068 | for (var i = 0; i < argList.length; i++) {
|
16069 | var item = argList[i].trim();
|
16070 | /* Removes all double quotes at the start and end of an argument */
|
16071 |
|
16072 | /* This preserves all starting and ending whitespace inside */
|
16073 |
|
16074 | if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
|
16075 | item = item.substr(1, item.length - 2);
|
16076 | }
|
16077 |
|
16078 | argList[i] = item;
|
16079 | }
|
16080 | }
|
16081 | /* if no arguments passed into callback, default to passing in id */
|
16082 |
|
16083 |
|
16084 | if (argList.length === 0) {
|
16085 | argList.push(id);
|
16086 | }
|
16087 |
|
16088 | if (typeof vertices[id] !== 'undefined') {
|
16089 | vertices[id].haveCallback = true;
|
16090 | funs.push(function () {
|
16091 | var elem = document.querySelector("[id=\"".concat(domId, "\"]"));
|
16092 |
|
16093 | if (elem !== null) {
|
16094 | elem.addEventListener('click', function () {
|
16095 | _utils__WEBPACK_IMPORTED_MODULE_4__["default"].runFunc.apply(_utils__WEBPACK_IMPORTED_MODULE_4__["default"], [functionName].concat(_toConsumableArray(argList)));
|
16096 | }, false);
|
16097 | }
|
16098 | });
|
16099 | }
|
16100 | };
|
16101 | /**
|
16102 | * Called by parser when a link is found. Adds the URL to the vertex data.
|
16103 | * @param ids Comma separated list of ids
|
16104 | * @param linkStr URL to create a link for
|
16105 | */
|
16106 |
|
16107 |
|
16108 | var setLink = function setLink(ids, linkStr, target) {
|
16109 | ids.split(',').forEach(function (id) {
|
16110 | if (typeof vertices[id] !== 'undefined') {
|
16111 | vertices[id].link = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].formatUrl(linkStr, config);
|
16112 | vertices[id].linkTarget = target;
|
16113 | }
|
16114 | });
|
16115 | setClass(ids, 'clickable');
|
16116 | };
|
16117 | var getTooltip = function getTooltip(id) {
|
16118 | return tooltips[id];
|
16119 | };
|
16120 | /**
|
16121 | * Called by parser when a click definition is found. Registers an event handler.
|
16122 | * @param ids Comma separated list of ids
|
16123 | * @param functionName Function to be called on click
|
16124 | * @param tooltip Tooltip for the clickable element
|
16125 | */
|
16126 |
|
16127 | var setClickEvent = function setClickEvent(ids, functionName, functionArgs) {
|
16128 | ids.split(',').forEach(function (id) {
|
16129 | setClickFun(id, functionName, functionArgs);
|
16130 | });
|
16131 | setClass(ids, 'clickable');
|
16132 | };
|
16133 | var bindFunctions = function bindFunctions(element) {
|
16134 | funs.forEach(function (fun) {
|
16135 | fun(element);
|
16136 | });
|
16137 | };
|
16138 | var getDirection = function getDirection() {
|
16139 | return direction.trim();
|
16140 | };
|
16141 | /**
|
16142 | * Retrieval function for fetching the found nodes after parsing has completed.
|
16143 | * @returns {{}|*|vertices}
|
16144 | */
|
16145 |
|
16146 | var getVertices = function getVertices() {
|
16147 | return vertices;
|
16148 | };
|
16149 | /**
|
16150 | * Retrieval function for fetching the found links after parsing has completed.
|
16151 | * @returns {{}|*|edges}
|
16152 | */
|
16153 |
|
16154 | var getEdges = function getEdges() {
|
16155 | return edges;
|
16156 | };
|
16157 | /**
|
16158 | * Retrieval function for fetching the found class definitions after parsing has completed.
|
16159 | * @returns {{}|*|classes}
|
16160 | */
|
16161 |
|
16162 | var getClasses = function getClasses() {
|
16163 | return classes;
|
16164 | };
|
16165 |
|
16166 | var setupToolTips = function setupToolTips(element) {
|
16167 | var tooltipElem = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('.mermaidTooltip');
|
16168 |
|
16169 | if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
|
16170 | tooltipElem = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
|
16171 | }
|
16172 |
|
16173 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(element).select('svg');
|
16174 | var nodes = svg.selectAll('g.node');
|
16175 | nodes.on('mouseover', function () {
|
16176 | var el = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(this);
|
16177 | var title = el.attr('title'); // Dont try to draw a tooltip if no data is provided
|
16178 |
|
16179 | if (title === null) {
|
16180 | return;
|
16181 | }
|
16182 |
|
16183 | var rect = this.getBoundingClientRect();
|
16184 | tooltipElem.transition().duration(200).style('opacity', '.9');
|
16185 | tooltipElem.html(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');
|
16186 | el.classed('hover', true);
|
16187 | }).on('mouseout', function () {
|
16188 | tooltipElem.transition().duration(500).style('opacity', 0);
|
16189 | var el = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(this);
|
16190 | el.classed('hover', false);
|
16191 | });
|
16192 | };
|
16193 |
|
16194 | funs.push(setupToolTips);
|
16195 | /**
|
16196 | * Clears the internal graph db so that a new graph can be parsed.
|
16197 | */
|
16198 |
|
16199 | var clear = function clear(ver) {
|
16200 | vertices = {};
|
16201 | classes = {};
|
16202 | edges = [];
|
16203 | funs = [];
|
16204 | funs.push(setupToolTips);
|
16205 | subGraphs = [];
|
16206 | subGraphLookup = {};
|
16207 | subCount = 0;
|
16208 | tooltips = [];
|
16209 | firstGraphFlag = true;
|
16210 | version = ver || 'gen-1';
|
16211 | };
|
16212 | var setGen = function setGen(ver) {
|
16213 | version = ver || 'gen-1';
|
16214 | };
|
16215 | /**
|
16216 | *
|
16217 | * @returns {string}
|
16218 | */
|
16219 |
|
16220 | var defaultStyle = function defaultStyle() {
|
16221 | return 'fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;';
|
16222 | };
|
16223 | /**
|
16224 | * Clears the internal graph db so that a new graph can be parsed.
|
16225 | */
|
16226 |
|
16227 | var addSubGraph = function addSubGraph(_id, list, _title) {
|
16228 | // console.log('addSubGraph', _id, list, _title);
|
16229 | var id = _id.trim();
|
16230 |
|
16231 | var title = _title;
|
16232 |
|
16233 | if (_id === _title && _title.match(/\s/)) {
|
16234 | id = undefined;
|
16235 | }
|
16236 |
|
16237 | function uniq(a) {
|
16238 | var prims = {
|
16239 | boolean: {},
|
16240 | number: {},
|
16241 | string: {}
|
16242 | };
|
16243 | var objs = [];
|
16244 | var dir; // = unbdefined; direction.trim();
|
16245 |
|
16246 | var nodeList = a.filter(function (item) {
|
16247 | var type = _typeof(item);
|
16248 |
|
16249 | if (item.stmt && item.stmt === 'dir') {
|
16250 | dir = item.value;
|
16251 | return false;
|
16252 | }
|
16253 |
|
16254 | if (item.trim() === '') {
|
16255 | return false;
|
16256 | }
|
16257 |
|
16258 | if (type in prims) {
|
16259 | return prims[type].hasOwnProperty(item) ? false : prims[type][item] = true; // eslint-disable-line
|
16260 | } else {
|
16261 | return objs.indexOf(item) >= 0 ? false : objs.push(item);
|
16262 | }
|
16263 | });
|
16264 | return {
|
16265 | nodeList: nodeList,
|
16266 | dir: dir
|
16267 | };
|
16268 | }
|
16269 |
|
16270 | var nodeList = [];
|
16271 |
|
16272 | var _uniq = uniq(nodeList.concat.apply(nodeList, list)),
|
16273 | nl = _uniq.nodeList,
|
16274 | dir = _uniq.dir;
|
16275 |
|
16276 | nodeList = nl;
|
16277 |
|
16278 | if (version === 'gen-1') {
|
16279 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.warn('LOOKING UP');
|
16280 |
|
16281 | for (var i = 0; i < nodeList.length; i++) {
|
16282 | nodeList[i] = lookUpDomId(nodeList[i]);
|
16283 | }
|
16284 | }
|
16285 |
|
16286 | id = id || 'subGraph' + subCount; // if (id[0].match(/\d/)) id = lookUpDomId(id);
|
16287 |
|
16288 | title = title || '';
|
16289 | title = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(title, config);
|
16290 | subCount = subCount + 1;
|
16291 | var subGraph = {
|
16292 | id: id,
|
16293 | nodes: nodeList,
|
16294 | title: title.trim(),
|
16295 | classes: [],
|
16296 | dir: dir
|
16297 | };
|
16298 | _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Adding', subGraph.id, subGraph.nodes, subGraph.dir);
|
16299 | /**
|
16300 | * Deletes an id from all subgraphs
|
16301 | */
|
16302 | // const del = _id => {
|
16303 | // subGraphs.forEach(sg => {
|
16304 | // const pos = sg.nodes.indexOf(_id);
|
16305 | // if (pos >= 0) {
|
16306 | // sg.nodes.splice(pos, 1);
|
16307 | // }
|
16308 | // });
|
16309 | // };
|
16310 | // // Removes the members of this subgraph from any other subgraphs, a node only belong to one subgraph
|
16311 | // subGraph.nodes.forEach(_id => del(_id));
|
16312 | // Remove the members in the new subgraph if they already belong to another subgraph
|
16313 |
|
16314 | subGraph.nodes = makeUniq(subGraph, subGraphs).nodes;
|
16315 | subGraphs.push(subGraph);
|
16316 | subGraphLookup[id] = subGraph;
|
16317 | return id;
|
16318 | };
|
16319 |
|
16320 | var getPosForId = function getPosForId(id) {
|
16321 | for (var i = 0; i < subGraphs.length; i++) {
|
16322 | if (subGraphs[i].id === id) {
|
16323 | return i;
|
16324 | }
|
16325 | }
|
16326 |
|
16327 | return -1;
|
16328 | };
|
16329 |
|
16330 | var secCount = -1;
|
16331 | var posCrossRef = [];
|
16332 |
|
16333 | var indexNodes2 = function indexNodes2(id, pos) {
|
16334 | var nodes = subGraphs[pos].nodes;
|
16335 | secCount = secCount + 1;
|
16336 |
|
16337 | if (secCount > 2000) {
|
16338 | return;
|
16339 | }
|
16340 |
|
16341 | posCrossRef[secCount] = pos; // Check if match
|
16342 |
|
16343 | if (subGraphs[pos].id === id) {
|
16344 | return {
|
16345 | result: true,
|
16346 | count: 0
|
16347 | };
|
16348 | }
|
16349 |
|
16350 | var count = 0;
|
16351 | var posCount = 1;
|
16352 |
|
16353 | while (count < nodes.length) {
|
16354 | var childPos = getPosForId(nodes[count]); // Ignore regular nodes (pos will be -1)
|
16355 |
|
16356 | if (childPos >= 0) {
|
16357 | var res = indexNodes2(id, childPos);
|
16358 |
|
16359 | if (res.result) {
|
16360 | return {
|
16361 | result: true,
|
16362 | count: posCount + res.count
|
16363 | };
|
16364 | } else {
|
16365 | posCount = posCount + res.count;
|
16366 | }
|
16367 | }
|
16368 |
|
16369 | count = count + 1;
|
16370 | }
|
16371 |
|
16372 | return {
|
16373 | result: false,
|
16374 | count: posCount
|
16375 | };
|
16376 | };
|
16377 |
|
16378 | var getDepthFirstPos = function getDepthFirstPos(pos) {
|
16379 | return posCrossRef[pos];
|
16380 | };
|
16381 | var indexNodes = function indexNodes() {
|
16382 | secCount = -1;
|
16383 |
|
16384 | if (subGraphs.length > 0) {
|
16385 | indexNodes2('none', subGraphs.length - 1, 0);
|
16386 | }
|
16387 | };
|
16388 | var getSubGraphs = function getSubGraphs() {
|
16389 | return subGraphs;
|
16390 | };
|
16391 | var firstGraph = function firstGraph() {
|
16392 | if (firstGraphFlag) {
|
16393 | firstGraphFlag = false;
|
16394 | return true;
|
16395 | }
|
16396 |
|
16397 | return false;
|
16398 | };
|
16399 |
|
16400 | var destructStartLink = function destructStartLink(_str) {
|
16401 | var str = _str.trim();
|
16402 |
|
16403 | var type = 'arrow_open';
|
16404 |
|
16405 | switch (str[0]) {
|
16406 | case '<':
|
16407 | type = 'arrow_point';
|
16408 | str = str.slice(1);
|
16409 | break;
|
16410 |
|
16411 | case 'x':
|
16412 | type = 'arrow_cross';
|
16413 | str = str.slice(1);
|
16414 | break;
|
16415 |
|
16416 | case 'o':
|
16417 | type = 'arrow_circle';
|
16418 | str = str.slice(1);
|
16419 | break;
|
16420 | }
|
16421 |
|
16422 | var stroke = 'normal';
|
16423 |
|
16424 | if (str.indexOf('=') !== -1) {
|
16425 | stroke = 'thick';
|
16426 | }
|
16427 |
|
16428 | if (str.indexOf('.') !== -1) {
|
16429 | stroke = 'dotted';
|
16430 | }
|
16431 |
|
16432 | return {
|
16433 | type: type,
|
16434 | stroke: stroke
|
16435 | };
|
16436 | };
|
16437 |
|
16438 | var countChar = function countChar(char, str) {
|
16439 | var length = str.length;
|
16440 | var count = 0;
|
16441 |
|
16442 | for (var i = 0; i < length; ++i) {
|
16443 | if (str[i] === char) {
|
16444 | ++count;
|
16445 | }
|
16446 | }
|
16447 |
|
16448 | return count;
|
16449 | };
|
16450 |
|
16451 | var destructEndLink = function destructEndLink(_str) {
|
16452 | var str = _str.trim();
|
16453 |
|
16454 | var line = str.slice(0, -1);
|
16455 | var type = 'arrow_open';
|
16456 |
|
16457 | switch (str.slice(-1)) {
|
16458 | case 'x':
|
16459 | type = 'arrow_cross';
|
16460 |
|
16461 | if (str[0] === 'x') {
|
16462 | type = 'double_' + type;
|
16463 | line = line.slice(1);
|
16464 | }
|
16465 |
|
16466 | break;
|
16467 |
|
16468 | case '>':
|
16469 | type = 'arrow_point';
|
16470 |
|
16471 | if (str[0] === '<') {
|
16472 | type = 'double_' + type;
|
16473 | line = line.slice(1);
|
16474 | }
|
16475 |
|
16476 | break;
|
16477 |
|
16478 | case 'o':
|
16479 | type = 'arrow_circle';
|
16480 |
|
16481 | if (str[0] === 'o') {
|
16482 | type = 'double_' + type;
|
16483 | line = line.slice(1);
|
16484 | }
|
16485 |
|
16486 | break;
|
16487 | }
|
16488 |
|
16489 | var stroke = 'normal';
|
16490 | var length = line.length - 1;
|
16491 |
|
16492 | if (line[0] === '=') {
|
16493 | stroke = 'thick';
|
16494 | }
|
16495 |
|
16496 | var dots = countChar('.', line);
|
16497 |
|
16498 | if (dots) {
|
16499 | stroke = 'dotted';
|
16500 | length = dots;
|
16501 | }
|
16502 |
|
16503 | return {
|
16504 | type: type,
|
16505 | stroke: stroke,
|
16506 | length: length
|
16507 | };
|
16508 | };
|
16509 |
|
16510 | var destructLink = function destructLink(_str, _startStr) {
|
16511 | var info = destructEndLink(_str);
|
16512 | var startInfo;
|
16513 |
|
16514 | if (_startStr) {
|
16515 | startInfo = destructStartLink(_startStr);
|
16516 |
|
16517 | if (startInfo.stroke !== info.stroke) {
|
16518 | return {
|
16519 | type: 'INVALID',
|
16520 | stroke: 'INVALID'
|
16521 | };
|
16522 | }
|
16523 |
|
16524 | if (startInfo.type === 'arrow_open') {
|
16525 | // -- xyz --> - take arrow type from ending
|
16526 | startInfo.type = info.type;
|
16527 | } else {
|
16528 | // x-- xyz --> - not supported
|
16529 | if (startInfo.type !== info.type) return {
|
16530 | type: 'INVALID',
|
16531 | stroke: 'INVALID'
|
16532 | };
|
16533 | startInfo.type = 'double_' + startInfo.type;
|
16534 | }
|
16535 |
|
16536 | if (startInfo.type === 'double_arrow') {
|
16537 | startInfo.type = 'double_arrow_point';
|
16538 | }
|
16539 |
|
16540 | startInfo.length = info.length;
|
16541 | return startInfo;
|
16542 | }
|
16543 |
|
16544 | return info;
|
16545 | }; // Todo optimizer this by caching existing nodes
|
16546 |
|
16547 |
|
16548 | var exists = function exists(allSgs, _id) {
|
16549 | var res = false;
|
16550 | allSgs.forEach(function (sg) {
|
16551 | var pos = sg.nodes.indexOf(_id);
|
16552 |
|
16553 | if (pos >= 0) {
|
16554 | res = true;
|
16555 | }
|
16556 | });
|
16557 | return res;
|
16558 | };
|
16559 | /**
|
16560 | * Deletes an id from all subgraphs
|
16561 | */
|
16562 |
|
16563 |
|
16564 | var makeUniq = function makeUniq(sg, allSubgraphs) {
|
16565 | var res = [];
|
16566 | sg.nodes.forEach(function (_id, pos) {
|
16567 | if (!exists(allSubgraphs, _id)) {
|
16568 | res.push(sg.nodes[pos]);
|
16569 | }
|
16570 | });
|
16571 | return {
|
16572 | nodes: res
|
16573 | };
|
16574 | };
|
16575 |
|
16576 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
16577 | parseDirective: parseDirective,
|
16578 | defaultConfig: function defaultConfig() {
|
16579 | return _config__WEBPACK_IMPORTED_MODULE_1__.defaultConfig.flowchart;
|
16580 | },
|
16581 | addVertex: addVertex,
|
16582 | lookUpDomId: lookUpDomId,
|
16583 | addLink: addLink,
|
16584 | updateLinkInterpolate: updateLinkInterpolate,
|
16585 | updateLink: updateLink,
|
16586 | addClass: addClass,
|
16587 | setDirection: setDirection,
|
16588 | setClass: setClass,
|
16589 | setTooltip: setTooltip,
|
16590 | getTooltip: getTooltip,
|
16591 | setClickEvent: setClickEvent,
|
16592 | setLink: setLink,
|
16593 | bindFunctions: bindFunctions,
|
16594 | getDirection: getDirection,
|
16595 | getVertices: getVertices,
|
16596 | getEdges: getEdges,
|
16597 | getClasses: getClasses,
|
16598 | clear: clear,
|
16599 | setGen: setGen,
|
16600 | defaultStyle: defaultStyle,
|
16601 | addSubGraph: addSubGraph,
|
16602 | getDepthFirstPos: getDepthFirstPos,
|
16603 | indexNodes: indexNodes,
|
16604 | getSubGraphs: getSubGraphs,
|
16605 | destructLink: destructLink,
|
16606 | lex: {
|
16607 | firstGraph: firstGraph
|
16608 | },
|
16609 | exists: exists,
|
16610 | makeUniq: makeUniq
|
16611 | });
|
16612 |
|
16613 | /***/ }),
|
16614 |
|
16615 | /***/ "./src/diagrams/flowchart/flowRenderer-v2.js":
|
16616 | /*!***************************************************!*\
|
16617 | !*** ./src/diagrams/flowchart/flowRenderer-v2.js ***!
|
16618 | \***************************************************/
|
16619 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
16620 |
|
16621 | "use strict";
|
16622 | __webpack_require__.r(__webpack_exports__);
|
16623 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
16624 | /* harmony export */ "setConf": () => (/* binding */ setConf),
|
16625 | /* harmony export */ "addVertices": () => (/* binding */ addVertices),
|
16626 | /* harmony export */ "addEdges": () => (/* binding */ addEdges),
|
16627 | /* harmony export */ "getClasses": () => (/* binding */ getClasses),
|
16628 | /* harmony export */ "draw": () => (/* binding */ draw),
|
16629 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
16630 | /* harmony export */ });
|
16631 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
|
16632 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
|
16633 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
|
16634 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
|
16635 | /* harmony import */ var _flowDb__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./flowDb */ "./src/diagrams/flowchart/flowDb.js");
|
16636 | /* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./parser/flow */ "./src/diagrams/flowchart/parser/flow.jison");
|
16637 | /* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_parser_flow__WEBPACK_IMPORTED_MODULE_8__);
|
16638 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
16639 | /* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
|
16640 | /* 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");
|
16641 | /* 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__);
|
16642 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
16643 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
16644 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
16645 |
|
16646 |
|
16647 |
|
16648 |
|
16649 |
|
16650 |
|
16651 |
|
16652 |
|
16653 |
|
16654 |
|
16655 | var conf = {};
|
16656 | var setConf = function setConf(cnf) {
|
16657 | var keys = Object.keys(cnf);
|
16658 |
|
16659 | for (var i = 0; i < keys.length; i++) {
|
16660 | conf[keys[i]] = cnf[keys[i]];
|
16661 | }
|
16662 | };
|
16663 | /**
|
16664 | * Function that adds the vertices found during parsing to the graph to be rendered.
|
16665 | * @param vert Object containing the vertices.
|
16666 | * @param g The graph that is to be drawn.
|
16667 | */
|
16668 |
|
16669 | var addVertices = function addVertices(vert, g, svgId) {
|
16670 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)("[id=\"".concat(svgId, "\"]"));
|
16671 | var keys = Object.keys(vert); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
|
16672 |
|
16673 | keys.forEach(function (id) {
|
16674 | var vertex = vert[id];
|
16675 | /**
|
16676 | * Variable for storing the classes for the vertex
|
16677 | * @type {string}
|
16678 | */
|
16679 |
|
16680 | var classStr = 'default';
|
16681 |
|
16682 | if (vertex.classes.length > 0) {
|
16683 | classStr = vertex.classes.join(' ');
|
16684 | }
|
16685 |
|
16686 | 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
|
16687 |
|
16688 | var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
|
16689 |
|
16690 | var vertexNode;
|
16691 |
|
16692 | if ((0,_common_common__WEBPACK_IMPORTED_MODULE_4__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().flowchart.htmlLabels)) {
|
16693 | // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
|
16694 | var node = {
|
16695 | label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
|
16696 | return "<i class='".concat(s.replace(':', ' '), "'></i>");
|
16697 | })
|
16698 | };
|
16699 | vertexNode = dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_2___default()(svg, node).node();
|
16700 | vertexNode.parentNode.removeChild(vertexNode);
|
16701 | } else {
|
16702 | var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
16703 | svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
|
16704 | var rows = vertexText.split(_common_common__WEBPACK_IMPORTED_MODULE_4__["default"].lineBreakRegex);
|
16705 |
|
16706 | for (var j = 0; j < rows.length; j++) {
|
16707 | var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
16708 | tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
16709 | tspan.setAttribute('dy', '1em');
|
16710 | tspan.setAttribute('x', '1');
|
16711 | tspan.textContent = rows[j];
|
16712 | svgLabel.appendChild(tspan);
|
16713 | }
|
16714 |
|
16715 | vertexNode = svgLabel;
|
16716 | }
|
16717 |
|
16718 | var radious = 0;
|
16719 | var _shape = ''; // Set the shape based parameters
|
16720 |
|
16721 | switch (vertex.type) {
|
16722 | case 'round':
|
16723 | radious = 5;
|
16724 | _shape = 'rect';
|
16725 | break;
|
16726 |
|
16727 | case 'square':
|
16728 | _shape = 'rect';
|
16729 | break;
|
16730 |
|
16731 | case 'diamond':
|
16732 | _shape = 'question';
|
16733 | break;
|
16734 |
|
16735 | case 'hexagon':
|
16736 | _shape = 'hexagon';
|
16737 | break;
|
16738 |
|
16739 | case 'odd':
|
16740 | _shape = 'rect_left_inv_arrow';
|
16741 | break;
|
16742 |
|
16743 | case 'lean_right':
|
16744 | _shape = 'lean_right';
|
16745 | break;
|
16746 |
|
16747 | case 'lean_left':
|
16748 | _shape = 'lean_left';
|
16749 | break;
|
16750 |
|
16751 | case 'trapezoid':
|
16752 | _shape = 'trapezoid';
|
16753 | break;
|
16754 |
|
16755 | case 'inv_trapezoid':
|
16756 | _shape = 'inv_trapezoid';
|
16757 | break;
|
16758 |
|
16759 | case 'odd_right':
|
16760 | _shape = 'rect_left_inv_arrow';
|
16761 | break;
|
16762 |
|
16763 | case 'circle':
|
16764 | _shape = 'circle';
|
16765 | break;
|
16766 |
|
16767 | case 'ellipse':
|
16768 | _shape = 'ellipse';
|
16769 | break;
|
16770 |
|
16771 | case 'stadium':
|
16772 | _shape = 'stadium';
|
16773 | break;
|
16774 |
|
16775 | case 'subroutine':
|
16776 | _shape = 'subroutine';
|
16777 | break;
|
16778 |
|
16779 | case 'cylinder':
|
16780 | _shape = 'cylinder';
|
16781 | break;
|
16782 |
|
16783 | case 'group':
|
16784 | _shape = 'rect';
|
16785 | break;
|
16786 |
|
16787 | default:
|
16788 | _shape = 'rect';
|
16789 | } // Add the node
|
16790 |
|
16791 |
|
16792 | g.setNode(vertex.id, {
|
16793 | labelStyle: styles.labelStyle,
|
16794 | shape: _shape,
|
16795 | labelText: vertexText,
|
16796 | rx: radious,
|
16797 | ry: radious,
|
16798 | class: classStr,
|
16799 | style: styles.style,
|
16800 | id: vertex.id,
|
16801 | link: vertex.link,
|
16802 | linkTarget: vertex.linkTarget,
|
16803 | tooltip: _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].getTooltip(vertex.id) || '',
|
16804 | domId: _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].lookUpDomId(vertex.id),
|
16805 | haveCallback: vertex.haveCallback,
|
16806 | width: vertex.type === 'group' ? 500 : undefined,
|
16807 | dir: vertex.dir,
|
16808 | type: vertex.type,
|
16809 | padding: (0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().flowchart.padding
|
16810 | });
|
16811 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('setNode', {
|
16812 | labelStyle: styles.labelStyle,
|
16813 | shape: _shape,
|
16814 | labelText: vertexText,
|
16815 | rx: radious,
|
16816 | ry: radious,
|
16817 | class: classStr,
|
16818 | style: styles.style,
|
16819 | id: vertex.id,
|
16820 | domId: _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].lookUpDomId(vertex.id),
|
16821 | width: vertex.type === 'group' ? 500 : undefined,
|
16822 | type: vertex.type,
|
16823 | dir: vertex.dir,
|
16824 | padding: (0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().flowchart.padding
|
16825 | });
|
16826 | });
|
16827 | };
|
16828 | /**
|
16829 | * Add edges to graph based on parsed graph defninition
|
16830 | * @param {Object} edges The edges to add to the graph
|
16831 | * @param {Object} g The graph object
|
16832 | */
|
16833 |
|
16834 | var addEdges = function addEdges(edges, g) {
|
16835 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('abc78 edges = ', edges);
|
16836 | var cnt = 0;
|
16837 | var linkIdCnt = {};
|
16838 | var defaultStyle;
|
16839 | var defaultLabelStyle;
|
16840 |
|
16841 | if (typeof edges.defaultStyle !== 'undefined') {
|
16842 | var defaultStyles = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getStylesFromArray)(edges.defaultStyle);
|
16843 | defaultStyle = defaultStyles.style;
|
16844 | defaultLabelStyle = defaultStyles.labelStyle;
|
16845 | }
|
16846 |
|
16847 | edges.forEach(function (edge) {
|
16848 | cnt++; // Identify Link
|
16849 |
|
16850 | var linkIdBase = 'L-' + edge.start + '-' + edge.end; // count the links from+to the same node to give unique id
|
16851 |
|
16852 | if (typeof linkIdCnt[linkIdBase] === 'undefined') {
|
16853 | linkIdCnt[linkIdBase] = 0;
|
16854 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('abc78 new entry', linkIdBase, linkIdCnt[linkIdBase]);
|
16855 | } else {
|
16856 | linkIdCnt[linkIdBase]++;
|
16857 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('abc78 new entry', linkIdBase, linkIdCnt[linkIdBase]);
|
16858 | }
|
16859 |
|
16860 | var linkId = linkIdBase + '-' + linkIdCnt[linkIdBase];
|
16861 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('abc78 new link id to be used is', linkIdBase, linkId, linkIdCnt[linkIdBase]);
|
16862 | var linkNameStart = 'LS-' + edge.start;
|
16863 | var linkNameEnd = 'LE-' + edge.end;
|
16864 | var edgeData = {
|
16865 | style: '',
|
16866 | labelStyle: ''
|
16867 | };
|
16868 | edgeData.minlen = edge.length || 1; //edgeData.id = 'id' + cnt;
|
16869 | // Set link type for rendering
|
16870 |
|
16871 | if (edge.type === 'arrow_open') {
|
16872 | edgeData.arrowhead = 'none';
|
16873 | } else {
|
16874 | edgeData.arrowhead = 'normal';
|
16875 | } // Check of arrow types, placed here in order not to break old rendering
|
16876 |
|
16877 |
|
16878 | edgeData.arrowTypeStart = 'arrow_open';
|
16879 | edgeData.arrowTypeEnd = 'arrow_open';
|
16880 | /* eslint-disable no-fallthrough */
|
16881 |
|
16882 | switch (edge.type) {
|
16883 | case 'double_arrow_cross':
|
16884 | edgeData.arrowTypeStart = 'arrow_cross';
|
16885 |
|
16886 | case 'arrow_cross':
|
16887 | edgeData.arrowTypeEnd = 'arrow_cross';
|
16888 | break;
|
16889 |
|
16890 | case 'double_arrow_point':
|
16891 | edgeData.arrowTypeStart = 'arrow_point';
|
16892 |
|
16893 | case 'arrow_point':
|
16894 | edgeData.arrowTypeEnd = 'arrow_point';
|
16895 | break;
|
16896 |
|
16897 | case 'double_arrow_circle':
|
16898 | edgeData.arrowTypeStart = 'arrow_circle';
|
16899 |
|
16900 | case 'arrow_circle':
|
16901 | edgeData.arrowTypeEnd = 'arrow_circle';
|
16902 | break;
|
16903 | }
|
16904 |
|
16905 | var style = '';
|
16906 | var labelStyle = '';
|
16907 |
|
16908 | switch (edge.stroke) {
|
16909 | case 'normal':
|
16910 | style = 'fill:none;';
|
16911 |
|
16912 | if (typeof defaultStyle !== 'undefined') {
|
16913 | style = defaultStyle;
|
16914 | }
|
16915 |
|
16916 | if (typeof defaultLabelStyle !== 'undefined') {
|
16917 | labelStyle = defaultLabelStyle;
|
16918 | }
|
16919 |
|
16920 | edgeData.thickness = 'normal';
|
16921 | edgeData.pattern = 'solid';
|
16922 | break;
|
16923 |
|
16924 | case 'dotted':
|
16925 | edgeData.thickness = 'normal';
|
16926 | edgeData.pattern = 'dotted';
|
16927 | edgeData.style = 'fill:none;stroke-width:2px;stroke-dasharray:3;';
|
16928 | break;
|
16929 |
|
16930 | case 'thick':
|
16931 | edgeData.thickness = 'thick';
|
16932 | edgeData.pattern = 'solid';
|
16933 | edgeData.style = 'stroke-width: 3.5px;fill:none;';
|
16934 | break;
|
16935 | }
|
16936 |
|
16937 | if (typeof edge.style !== 'undefined') {
|
16938 | var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getStylesFromArray)(edge.style);
|
16939 | style = styles.style;
|
16940 | labelStyle = styles.labelStyle;
|
16941 | }
|
16942 |
|
16943 | edgeData.style = edgeData.style += style;
|
16944 | edgeData.labelStyle = edgeData.labelStyle += labelStyle;
|
16945 |
|
16946 | if (typeof edge.interpolate !== 'undefined') {
|
16947 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.interpolateToCurve)(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
|
16948 | } else if (typeof edges.defaultInterpolate !== 'undefined') {
|
16949 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.interpolateToCurve)(edges.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
|
16950 | } else {
|
16951 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.interpolateToCurve)(conf.curve, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
|
16952 | }
|
16953 |
|
16954 | if (typeof edge.text === 'undefined') {
|
16955 | if (typeof edge.style !== 'undefined') {
|
16956 | edgeData.arrowheadStyle = 'fill: #333';
|
16957 | }
|
16958 | } else {
|
16959 | edgeData.arrowheadStyle = 'fill: #333';
|
16960 | edgeData.labelpos = 'c';
|
16961 | } // if (evaluate(getConfig().flowchart.htmlLabels) && false) {
|
16962 | // // eslint-disable-line
|
16963 | // edgeData.labelType = 'html';
|
16964 | // edgeData.label = `<span id="L-${linkId}" class="edgeLabel L-${linkNameStart}' L-${linkNameEnd}">${edge.text}</span>`;
|
16965 | // } else {
|
16966 |
|
16967 |
|
16968 | edgeData.labelType = 'text';
|
16969 | edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_4__["default"].lineBreakRegex, '\n');
|
16970 |
|
16971 | if (typeof edge.style === 'undefined') {
|
16972 | edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none;';
|
16973 | }
|
16974 |
|
16975 | edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:'); // }
|
16976 |
|
16977 | edgeData.id = linkId;
|
16978 | edgeData.classes = 'flowchart-link ' + linkNameStart + ' ' + linkNameEnd; // Add the edge to the graph
|
16979 |
|
16980 | g.setEdge(edge.start, edge.end, edgeData, cnt);
|
16981 | });
|
16982 | };
|
16983 | /**
|
16984 | * Returns the all the styles from classDef statements in the graph definition.
|
16985 | * @returns {object} classDef styles
|
16986 | */
|
16987 |
|
16988 | var getClasses = function getClasses(text) {
|
16989 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Extracting classes');
|
16990 | _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].clear();
|
16991 | var parser = (_parser_flow__WEBPACK_IMPORTED_MODULE_8___default().parser);
|
16992 | parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"];
|
16993 |
|
16994 | try {
|
16995 | // Parse the graph definition
|
16996 | parser.parse(text);
|
16997 | } catch (e) {
|
16998 | return;
|
16999 | }
|
17000 |
|
17001 | return _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].getClasses();
|
17002 | };
|
17003 | /**
|
17004 | * Draws a flowchart in the tag with id: id based on the graph definition in text.
|
17005 | * @param text
|
17006 | * @param id
|
17007 | */
|
17008 |
|
17009 | var draw = function draw(text, id) {
|
17010 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Drawing flowchart');
|
17011 | _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].clear();
|
17012 | _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].setGen('gen-2');
|
17013 | var parser = (_parser_flow__WEBPACK_IMPORTED_MODULE_8___default().parser);
|
17014 | parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"]; // Parse the graph definition
|
17015 | // try {
|
17016 |
|
17017 | parser.parse(text); // } catch (err) {
|
17018 | // log.debug('Parsing failed');
|
17019 | // }
|
17020 | // Fetch the default direction, use TD if none was found
|
17021 |
|
17022 | var dir = _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].getDirection();
|
17023 |
|
17024 | if (typeof dir === 'undefined') {
|
17025 | dir = 'TD';
|
17026 | }
|
17027 |
|
17028 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().flowchart;
|
17029 | var nodeSpacing = conf.nodeSpacing || 50;
|
17030 | var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
|
17031 |
|
17032 | var g = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
|
17033 | multigraph: true,
|
17034 | compound: true
|
17035 | }).setGraph({
|
17036 | rankdir: dir,
|
17037 | nodesep: nodeSpacing,
|
17038 | ranksep: rankSpacing,
|
17039 | marginx: 8,
|
17040 | marginy: 8
|
17041 | }).setDefaultEdgeLabel(function () {
|
17042 | return {};
|
17043 | });
|
17044 | var subG;
|
17045 | var subGraphs = _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].getSubGraphs();
|
17046 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Subgraphs - ', subGraphs);
|
17047 |
|
17048 | for (var _i = subGraphs.length - 1; _i >= 0; _i--) {
|
17049 | subG = subGraphs[_i];
|
17050 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Subgraph - ', subG);
|
17051 | _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].addVertex(subG.id, subG.title, 'group', undefined, subG.classes, subG.dir);
|
17052 | } // Fetch the verices/nodes and edges/links from the parsed graph definition
|
17053 |
|
17054 |
|
17055 | var vert = _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].getVertices();
|
17056 | var edges = _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].getEdges();
|
17057 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info(edges);
|
17058 | var i = 0;
|
17059 |
|
17060 | for (i = subGraphs.length - 1; i >= 0; i--) {
|
17061 | // for (let i = 0; i < subGraphs.length; i++) {
|
17062 | subG = subGraphs[i];
|
17063 | (0,d3__WEBPACK_IMPORTED_MODULE_1__.selectAll)('cluster').append('text');
|
17064 |
|
17065 | for (var j = 0; j < subG.nodes.length; j++) {
|
17066 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Setting up subgraphs', subG.nodes[j], subG.id);
|
17067 | g.setParent(subG.nodes[j], subG.id);
|
17068 | }
|
17069 | }
|
17070 |
|
17071 | addVertices(vert, g, id);
|
17072 | addEdges(edges, g); // Add custom shapes
|
17073 | // flowChartShapes.addToRenderV2(addShape);
|
17074 | // Set up an SVG group so that we can translate the final graph.
|
17075 |
|
17076 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)("[id=\"".concat(id, "\"]"));
|
17077 | svg.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink'); // Run the renderer. This is what draws the final graph.
|
17078 |
|
17079 | var element = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#' + id + ' g');
|
17080 | (0,_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_9__.render)(element, g, ['point', 'circle', 'cross'], 'flowchart', id);
|
17081 | var padding = conf.diagramPadding;
|
17082 | var svgBounds = svg.node().getBBox();
|
17083 | var width = svgBounds.width + padding * 2;
|
17084 | var height = svgBounds.height + padding * 2;
|
17085 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.debug("new ViewBox 0 0 ".concat(width, " ").concat(height), "translate(".concat(padding - g._label.marginx, ", ").concat(padding - g._label.marginy, ")"));
|
17086 | (0,_utils__WEBPACK_IMPORTED_MODULE_3__.configureSvgSize)(svg, height, width, conf.useMaxWidth);
|
17087 | svg.attr('viewBox', "0 0 ".concat(width, " ").concat(height));
|
17088 | svg.select('g').attr('transform', "translate(".concat(padding - g._label.marginx, ", ").concat(padding - svgBounds.y, ")")); // Index nodes
|
17089 |
|
17090 | _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].indexNodes('subGraph' + i); // Add label rects for non html labels
|
17091 |
|
17092 | if (!conf.htmlLabels) {
|
17093 | var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
17094 |
|
17095 | for (var k = 0; k < labels.length; k++) {
|
17096 | var label = labels[k]; // Get dimensions of label
|
17097 |
|
17098 | var dim = label.getBBox();
|
17099 | var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
|
17100 | rect.setAttribute('rx', 0);
|
17101 | rect.setAttribute('ry', 0);
|
17102 | rect.setAttribute('width', dim.width);
|
17103 | rect.setAttribute('height', dim.height); // rect.setAttribute('style', 'fill:#e8e8e8;');
|
17104 |
|
17105 | label.insertBefore(rect, label.firstChild);
|
17106 | }
|
17107 | } // If node has a link, wrap it in an anchor SVG object.
|
17108 |
|
17109 |
|
17110 | var keys = Object.keys(vert);
|
17111 | keys.forEach(function (key) {
|
17112 | var vertex = vert[key];
|
17113 |
|
17114 | if (vertex.link) {
|
17115 | var node = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#' + id + ' [id="' + key + '"]');
|
17116 |
|
17117 | if (node) {
|
17118 | var link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
|
17119 | link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
|
17120 | link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
|
17121 | link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
|
17122 |
|
17123 | if (vertex.linkTarget) {
|
17124 | link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);
|
17125 | }
|
17126 |
|
17127 | var linkNode = node.insert(function () {
|
17128 | return link;
|
17129 | }, ':first-child');
|
17130 | var shape = node.select('.label-container');
|
17131 |
|
17132 | if (shape) {
|
17133 | linkNode.append(function () {
|
17134 | return shape.node();
|
17135 | });
|
17136 | }
|
17137 |
|
17138 | var _label = node.select('.label');
|
17139 |
|
17140 | if (_label) {
|
17141 | linkNode.append(function () {
|
17142 | return _label.node();
|
17143 | });
|
17144 | }
|
17145 | }
|
17146 | }
|
17147 | });
|
17148 | };
|
17149 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
17150 | setConf: setConf,
|
17151 | addVertices: addVertices,
|
17152 | addEdges: addEdges,
|
17153 | getClasses: getClasses,
|
17154 | draw: draw
|
17155 | });
|
17156 |
|
17157 | /***/ }),
|
17158 |
|
17159 | /***/ "./src/diagrams/flowchart/flowRenderer.js":
|
17160 | /*!************************************************!*\
|
17161 | !*** ./src/diagrams/flowchart/flowRenderer.js ***!
|
17162 | \************************************************/
|
17163 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
17164 |
|
17165 | "use strict";
|
17166 | __webpack_require__.r(__webpack_exports__);
|
17167 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
17168 | /* harmony export */ "setConf": () => (/* binding */ setConf),
|
17169 | /* harmony export */ "addVertices": () => (/* binding */ addVertices),
|
17170 | /* harmony export */ "addEdges": () => (/* binding */ addEdges),
|
17171 | /* harmony export */ "getClasses": () => (/* binding */ getClasses),
|
17172 | /* harmony export */ "draw": () => (/* binding */ draw),
|
17173 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
17174 | /* harmony export */ });
|
17175 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
|
17176 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
|
17177 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
|
17178 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
|
17179 | /* harmony import */ var _flowDb__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./flowDb */ "./src/diagrams/flowchart/flowDb.js");
|
17180 | /* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./parser/flow */ "./src/diagrams/flowchart/parser/flow.jison");
|
17181 | /* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_parser_flow__WEBPACK_IMPORTED_MODULE_9__);
|
17182 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
17183 | /* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dagre-d3 */ "dagre-d3");
|
17184 | /* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(dagre_d3__WEBPACK_IMPORTED_MODULE_2__);
|
17185 | /* 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");
|
17186 | /* 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__);
|
17187 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
17188 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
17189 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
17190 | /* harmony import */ var _flowChartShapes__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./flowChartShapes */ "./src/diagrams/flowchart/flowChartShapes.js");
|
17191 |
|
17192 |
|
17193 |
|
17194 |
|
17195 |
|
17196 |
|
17197 |
|
17198 |
|
17199 |
|
17200 |
|
17201 |
|
17202 | var conf = {};
|
17203 | var setConf = function setConf(cnf) {
|
17204 | var keys = Object.keys(cnf);
|
17205 |
|
17206 | for (var i = 0; i < keys.length; i++) {
|
17207 | conf[keys[i]] = cnf[keys[i]];
|
17208 | }
|
17209 | };
|
17210 | /**
|
17211 | * Function that adds the vertices found in the graph definition to the graph to be rendered.
|
17212 | * @param vert Object containing the vertices.
|
17213 | * @param g The graph that is to be drawn.
|
17214 | */
|
17215 |
|
17216 | var addVertices = function addVertices(vert, g, svgId) {
|
17217 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)("[id=\"".concat(svgId, "\"]"));
|
17218 | var keys = Object.keys(vert); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
|
17219 |
|
17220 | keys.forEach(function (id) {
|
17221 | var vertex = vert[id];
|
17222 | /**
|
17223 | * Variable for storing the classes for the vertex
|
17224 | * @type {string}
|
17225 | */
|
17226 |
|
17227 | var classStr = 'default';
|
17228 |
|
17229 | if (vertex.classes.length > 0) {
|
17230 | classStr = vertex.classes.join(' ');
|
17231 | }
|
17232 |
|
17233 | var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getStylesFromArray)(vertex.styles); // Use vertex id as text in the box if no text is provided by the graph definition
|
17234 |
|
17235 | var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
|
17236 |
|
17237 | var vertexNode;
|
17238 |
|
17239 | if ((0,_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
|
17240 | // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
|
17241 | var node = {
|
17242 | label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
|
17243 | return "<i class='".concat(s.replace(':', ' '), "'></i>");
|
17244 | })
|
17245 | };
|
17246 | vertexNode = dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_3___default()(svg, node).node();
|
17247 | vertexNode.parentNode.removeChild(vertexNode);
|
17248 | } else {
|
17249 | var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
17250 | svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
|
17251 | var rows = vertexText.split(_common_common__WEBPACK_IMPORTED_MODULE_5__["default"].lineBreakRegex);
|
17252 |
|
17253 | for (var j = 0; j < rows.length; j++) {
|
17254 | var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
17255 | tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
17256 | tspan.setAttribute('dy', '1em');
|
17257 | tspan.setAttribute('x', '1');
|
17258 | tspan.textContent = rows[j];
|
17259 | svgLabel.appendChild(tspan);
|
17260 | }
|
17261 |
|
17262 | vertexNode = svgLabel;
|
17263 | }
|
17264 |
|
17265 | var radious = 0;
|
17266 | var _shape = ''; // Set the shape based parameters
|
17267 |
|
17268 | switch (vertex.type) {
|
17269 | case 'round':
|
17270 | radious = 5;
|
17271 | _shape = 'rect';
|
17272 | break;
|
17273 |
|
17274 | case 'square':
|
17275 | _shape = 'rect';
|
17276 | break;
|
17277 |
|
17278 | case 'diamond':
|
17279 | _shape = 'question';
|
17280 | break;
|
17281 |
|
17282 | case 'hexagon':
|
17283 | _shape = 'hexagon';
|
17284 | break;
|
17285 |
|
17286 | case 'odd':
|
17287 | _shape = 'rect_left_inv_arrow';
|
17288 | break;
|
17289 |
|
17290 | case 'lean_right':
|
17291 | _shape = 'lean_right';
|
17292 | break;
|
17293 |
|
17294 | case 'lean_left':
|
17295 | _shape = 'lean_left';
|
17296 | break;
|
17297 |
|
17298 | case 'trapezoid':
|
17299 | _shape = 'trapezoid';
|
17300 | break;
|
17301 |
|
17302 | case 'inv_trapezoid':
|
17303 | _shape = 'inv_trapezoid';
|
17304 | break;
|
17305 |
|
17306 | case 'odd_right':
|
17307 | _shape = 'rect_left_inv_arrow';
|
17308 | break;
|
17309 |
|
17310 | case 'circle':
|
17311 | _shape = 'circle';
|
17312 | break;
|
17313 |
|
17314 | case 'ellipse':
|
17315 | _shape = 'ellipse';
|
17316 | break;
|
17317 |
|
17318 | case 'stadium':
|
17319 | _shape = 'stadium';
|
17320 | break;
|
17321 |
|
17322 | case 'subroutine':
|
17323 | _shape = 'subroutine';
|
17324 | break;
|
17325 |
|
17326 | case 'cylinder':
|
17327 | _shape = 'cylinder';
|
17328 | break;
|
17329 |
|
17330 | case 'group':
|
17331 | _shape = 'rect';
|
17332 | break;
|
17333 |
|
17334 | default:
|
17335 | _shape = 'rect';
|
17336 | } // Add the node
|
17337 |
|
17338 |
|
17339 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.warn('Adding node', vertex.id, vertex.domId);
|
17340 | g.setNode(_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(vertex.id), {
|
17341 | labelType: 'svg',
|
17342 | labelStyle: styles.labelStyle,
|
17343 | shape: _shape,
|
17344 | label: vertexNode,
|
17345 | rx: radious,
|
17346 | ry: radious,
|
17347 | class: classStr,
|
17348 | style: styles.style,
|
17349 | id: _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(vertex.id)
|
17350 | });
|
17351 | });
|
17352 | };
|
17353 | /**
|
17354 | * Add edges to graph based on parsed graph defninition
|
17355 | * @param {Object} edges The edges to add to the graph
|
17356 | * @param {Object} g The graph object
|
17357 | */
|
17358 |
|
17359 | var addEdges = function addEdges(edges, g) {
|
17360 | var cnt = 0;
|
17361 | var defaultStyle;
|
17362 | var defaultLabelStyle;
|
17363 |
|
17364 | if (typeof edges.defaultStyle !== 'undefined') {
|
17365 | var defaultStyles = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getStylesFromArray)(edges.defaultStyle);
|
17366 | defaultStyle = defaultStyles.style;
|
17367 | defaultLabelStyle = defaultStyles.labelStyle;
|
17368 | }
|
17369 |
|
17370 | edges.forEach(function (edge) {
|
17371 | cnt++; // Identify Link
|
17372 |
|
17373 | var linkId = 'L-' + edge.start + '-' + edge.end;
|
17374 | var linkNameStart = 'LS-' + edge.start;
|
17375 | var linkNameEnd = 'LE-' + edge.end;
|
17376 | var edgeData = {}; // Set link type for rendering
|
17377 |
|
17378 | if (edge.type === 'arrow_open') {
|
17379 | edgeData.arrowhead = 'none';
|
17380 | } else {
|
17381 | edgeData.arrowhead = 'normal';
|
17382 | }
|
17383 |
|
17384 | var style = '';
|
17385 | var labelStyle = '';
|
17386 |
|
17387 | if (typeof edge.style !== 'undefined') {
|
17388 | var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getStylesFromArray)(edge.style);
|
17389 | style = styles.style;
|
17390 | labelStyle = styles.labelStyle;
|
17391 | } else {
|
17392 | switch (edge.stroke) {
|
17393 | case 'normal':
|
17394 | style = 'fill:none';
|
17395 |
|
17396 | if (typeof defaultStyle !== 'undefined') {
|
17397 | style = defaultStyle;
|
17398 | }
|
17399 |
|
17400 | if (typeof defaultLabelStyle !== 'undefined') {
|
17401 | labelStyle = defaultLabelStyle;
|
17402 | }
|
17403 |
|
17404 | break;
|
17405 |
|
17406 | case 'dotted':
|
17407 | style = 'fill:none;stroke-width:2px;stroke-dasharray:3;';
|
17408 | break;
|
17409 |
|
17410 | case 'thick':
|
17411 | style = ' stroke-width: 3.5px;fill:none';
|
17412 | break;
|
17413 | }
|
17414 | }
|
17415 |
|
17416 | edgeData.style = style;
|
17417 | edgeData.labelStyle = labelStyle;
|
17418 |
|
17419 | if (typeof edge.interpolate !== 'undefined') {
|
17420 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.interpolateToCurve)(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
|
17421 | } else if (typeof edges.defaultInterpolate !== 'undefined') {
|
17422 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.interpolateToCurve)(edges.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
|
17423 | } else {
|
17424 | edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.interpolateToCurve)(conf.curve, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
|
17425 | }
|
17426 |
|
17427 | if (typeof edge.text === 'undefined') {
|
17428 | if (typeof edge.style !== 'undefined') {
|
17429 | edgeData.arrowheadStyle = 'fill: #333';
|
17430 | }
|
17431 | } else {
|
17432 | edgeData.arrowheadStyle = 'fill: #333';
|
17433 | edgeData.labelpos = 'c';
|
17434 |
|
17435 | if ((0,_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
|
17436 | edgeData.labelType = 'html';
|
17437 | edgeData.label = "<span id=\"L-".concat(linkId, "\" class=\"edgeLabel L-").concat(linkNameStart, "' L-").concat(linkNameEnd, "\">").concat(edge.text.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
|
17438 | return "<i class='".concat(s.replace(':', ' '), "'></i>");
|
17439 | }), "</span>");
|
17440 | } else {
|
17441 | edgeData.labelType = 'text';
|
17442 | edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_5__["default"].lineBreakRegex, '\n');
|
17443 |
|
17444 | if (typeof edge.style === 'undefined') {
|
17445 | edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
|
17446 | }
|
17447 |
|
17448 | edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
|
17449 | }
|
17450 | }
|
17451 |
|
17452 | edgeData.id = linkId;
|
17453 | edgeData.class = linkNameStart + ' ' + linkNameEnd;
|
17454 | edgeData.minlen = edge.length || 1; // Add the edge to the graph
|
17455 |
|
17456 | g.setEdge(_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(edge.start), _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(edge.end), edgeData, cnt);
|
17457 | });
|
17458 | };
|
17459 | /**
|
17460 | * Returns the all the styles from classDef statements in the graph definition.
|
17461 | * @returns {object} classDef styles
|
17462 | */
|
17463 |
|
17464 | var getClasses = function getClasses(text) {
|
17465 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Extracting classes');
|
17466 | _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].clear();
|
17467 |
|
17468 | try {
|
17469 | var parser = (_parser_flow__WEBPACK_IMPORTED_MODULE_9___default().parser);
|
17470 | parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"]; // Parse the graph definition
|
17471 |
|
17472 | parser.parse(text);
|
17473 | return _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].getClasses();
|
17474 | } catch (e) {
|
17475 | return;
|
17476 | }
|
17477 | };
|
17478 | /**
|
17479 | * Draws a flowchart in the tag with id: id based on the graph definition in text.
|
17480 | * @param text
|
17481 | * @param id
|
17482 | */
|
17483 |
|
17484 | var draw = function draw(text, id) {
|
17485 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Drawing flowchart');
|
17486 | _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].clear();
|
17487 | _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].setGen('gen-1');
|
17488 | var parser = (_parser_flow__WEBPACK_IMPORTED_MODULE_9___default().parser);
|
17489 | parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"]; // Parse the graph definition
|
17490 | // try {
|
17491 |
|
17492 | parser.parse(text); // } catch (err) {
|
17493 | // log.debug('Parsing failed');
|
17494 | // }
|
17495 | // Fetch the default direction, use TD if none was found
|
17496 |
|
17497 | var dir = _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].getDirection();
|
17498 |
|
17499 | if (typeof dir === 'undefined') {
|
17500 | dir = 'TD';
|
17501 | }
|
17502 |
|
17503 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart;
|
17504 | var nodeSpacing = conf.nodeSpacing || 50;
|
17505 | var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
|
17506 |
|
17507 | var g = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
|
17508 | multigraph: true,
|
17509 | compound: true
|
17510 | }).setGraph({
|
17511 | rankdir: dir,
|
17512 | nodesep: nodeSpacing,
|
17513 | ranksep: rankSpacing,
|
17514 | marginx: 8,
|
17515 | marginy: 8
|
17516 | }).setDefaultEdgeLabel(function () {
|
17517 | return {};
|
17518 | });
|
17519 | var subG;
|
17520 | var subGraphs = _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].getSubGraphs();
|
17521 |
|
17522 | for (var _i = subGraphs.length - 1; _i >= 0; _i--) {
|
17523 | subG = subGraphs[_i];
|
17524 | _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].addVertex(subG.id, subG.title, 'group', undefined, subG.classes);
|
17525 | } // Fetch the verices/nodes and edges/links from the parsed graph definition
|
17526 |
|
17527 |
|
17528 | var vert = _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].getVertices();
|
17529 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.warn('Get vertices', vert);
|
17530 | var edges = _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].getEdges();
|
17531 | var i = 0;
|
17532 |
|
17533 | for (i = subGraphs.length - 1; i >= 0; i--) {
|
17534 | subG = subGraphs[i];
|
17535 | (0,d3__WEBPACK_IMPORTED_MODULE_1__.selectAll)('cluster').append('text');
|
17536 |
|
17537 | for (var j = 0; j < subG.nodes.length; j++) {
|
17538 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.warn('Setting subgraph', subG.nodes[j], _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(subG.nodes[j]), _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(subG.id));
|
17539 | g.setParent(_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(subG.nodes[j]), _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(subG.id));
|
17540 | }
|
17541 | }
|
17542 |
|
17543 | addVertices(vert, g, id);
|
17544 | addEdges(edges, g); // Create the renderer
|
17545 |
|
17546 | var Render = (dagre_d3__WEBPACK_IMPORTED_MODULE_2___default().render);
|
17547 | var render = new Render(); // Add custom shapes
|
17548 |
|
17549 | _flowChartShapes__WEBPACK_IMPORTED_MODULE_10__["default"].addToRender(render); // Add our custom arrow - an empty arrowhead
|
17550 |
|
17551 | render.arrows().none = function normal(parent, id, edge, type) {
|
17552 | 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');
|
17553 | var path = marker.append('path').attr('d', 'M 0 0 L 0 0 L 0 0 z');
|
17554 | dagre_d3__WEBPACK_IMPORTED_MODULE_2___default().util.applyStyle(path, edge[type + 'Style']);
|
17555 | }; // Override normal arrowhead defined in d3. Remove style & add class to allow css styling.
|
17556 |
|
17557 |
|
17558 | render.arrows().normal = function normal(parent, id) {
|
17559 | 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');
|
17560 | 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');
|
17561 | }; // Set up an SVG group so that we can translate the final graph.
|
17562 |
|
17563 |
|
17564 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)("[id=\"".concat(id, "\"]"));
|
17565 | svg.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink');
|
17566 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.warn(g); // Run the renderer. This is what draws the final graph.
|
17567 |
|
17568 | var element = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#' + id + ' g');
|
17569 | render(element, g);
|
17570 | element.selectAll('g.node').attr('title', function () {
|
17571 | return _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].getTooltip(this.id);
|
17572 | });
|
17573 | var padding = conf.diagramPadding;
|
17574 | var svgBounds = svg.node().getBBox();
|
17575 | var width = svgBounds.width + padding * 2;
|
17576 | var height = svgBounds.height + padding * 2;
|
17577 | (0,_utils__WEBPACK_IMPORTED_MODULE_4__.configureSvgSize)(svg, height, width, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
|
17578 |
|
17579 | var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
|
17580 | _logger__WEBPACK_IMPORTED_MODULE_7__.log.debug("viewBox ".concat(vBox));
|
17581 | svg.attr('viewBox', vBox); // Index nodes
|
17582 |
|
17583 | _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].indexNodes('subGraph' + i); // reposition labels
|
17584 |
|
17585 | for (i = 0; i < subGraphs.length; i++) {
|
17586 | subG = subGraphs[i];
|
17587 |
|
17588 | if (subG.title !== 'undefined') {
|
17589 | var clusterRects = document.querySelectorAll('#' + id + ' [id="' + _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(subG.id) + '"] rect');
|
17590 | var clusterEl = document.querySelectorAll('#' + id + ' [id="' + _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(subG.id) + '"]');
|
17591 | var xPos = clusterRects[0].x.baseVal.value;
|
17592 | var yPos = clusterRects[0].y.baseVal.value;
|
17593 | var _width = clusterRects[0].width.baseVal.value;
|
17594 | var cluster = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)(clusterEl[0]);
|
17595 | var te = cluster.select('.label');
|
17596 | te.attr('transform', "translate(".concat(xPos + _width / 2, ", ").concat(yPos + 14, ")"));
|
17597 | te.attr('id', id + 'Text');
|
17598 |
|
17599 | for (var _j = 0; _j < subG.classes.length; _j++) {
|
17600 | clusterEl[0].classList.add(subG.classes[_j]);
|
17601 | }
|
17602 | }
|
17603 | } // Add label rects for non html labels
|
17604 |
|
17605 |
|
17606 | if (!(0,_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)(conf.htmlLabels) || true) {
|
17607 | // eslint-disable-line
|
17608 | var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
17609 |
|
17610 | for (var k = 0; k < labels.length; k++) {
|
17611 | var label = labels[k]; // Get dimensions of label
|
17612 |
|
17613 | var dim = label.getBBox();
|
17614 | var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
|
17615 | rect.setAttribute('rx', 0);
|
17616 | rect.setAttribute('ry', 0);
|
17617 | rect.setAttribute('width', dim.width);
|
17618 | rect.setAttribute('height', dim.height); // rect.setAttribute('style', 'fill:#e8e8e8;');
|
17619 |
|
17620 | label.insertBefore(rect, label.firstChild);
|
17621 | }
|
17622 | } // If node has a link, wrap it in an anchor SVG object.
|
17623 |
|
17624 |
|
17625 | var keys = Object.keys(vert);
|
17626 | keys.forEach(function (key) {
|
17627 | var vertex = vert[key];
|
17628 |
|
17629 | if (vertex.link) {
|
17630 | var node = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#' + id + ' [id="' + _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(key) + '"]');
|
17631 |
|
17632 | if (node) {
|
17633 | var link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
|
17634 | link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
|
17635 | link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
|
17636 | link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
|
17637 |
|
17638 | if (vertex.linkTarget) {
|
17639 | link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);
|
17640 | }
|
17641 |
|
17642 | var linkNode = node.insert(function () {
|
17643 | return link;
|
17644 | }, ':first-child');
|
17645 | var shape = node.select('.label-container');
|
17646 |
|
17647 | if (shape) {
|
17648 | linkNode.append(function () {
|
17649 | return shape.node();
|
17650 | });
|
17651 | }
|
17652 |
|
17653 | var _label = node.select('.label');
|
17654 |
|
17655 | if (_label) {
|
17656 | linkNode.append(function () {
|
17657 | return _label.node();
|
17658 | });
|
17659 | }
|
17660 | }
|
17661 | }
|
17662 | });
|
17663 | };
|
17664 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
17665 | setConf: setConf,
|
17666 | addVertices: addVertices,
|
17667 | addEdges: addEdges,
|
17668 | getClasses: getClasses,
|
17669 | draw: draw
|
17670 | });
|
17671 |
|
17672 | /***/ }),
|
17673 |
|
17674 | /***/ "./src/diagrams/flowchart/styles.js":
|
17675 | /*!******************************************!*\
|
17676 | !*** ./src/diagrams/flowchart/styles.js ***!
|
17677 | \******************************************/
|
17678 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
17679 |
|
17680 | "use strict";
|
17681 | __webpack_require__.r(__webpack_exports__);
|
17682 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
17683 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
17684 | /* harmony export */ });
|
17685 | var getStyles = function getStyles(options) {
|
17686 | 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");
|
17687 | };
|
17688 |
|
17689 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
17690 |
|
17691 | /***/ }),
|
17692 |
|
17693 | /***/ "./src/diagrams/gantt/ganttDb.js":
|
17694 | /*!***************************************!*\
|
17695 | !*** ./src/diagrams/gantt/ganttDb.js ***!
|
17696 | \***************************************/
|
17697 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
17698 |
|
17699 | "use strict";
|
17700 | __webpack_require__.r(__webpack_exports__);
|
17701 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
17702 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
17703 | /* harmony export */ "clear": () => (/* binding */ clear),
|
17704 | /* harmony export */ "setAxisFormat": () => (/* binding */ setAxisFormat),
|
17705 | /* harmony export */ "getAxisFormat": () => (/* binding */ getAxisFormat),
|
17706 | /* harmony export */ "setTodayMarker": () => (/* binding */ setTodayMarker),
|
17707 | /* harmony export */ "getTodayMarker": () => (/* binding */ getTodayMarker),
|
17708 | /* harmony export */ "setDateFormat": () => (/* binding */ setDateFormat),
|
17709 | /* harmony export */ "enableInclusiveEndDates": () => (/* binding */ enableInclusiveEndDates),
|
17710 | /* harmony export */ "endDatesAreInclusive": () => (/* binding */ endDatesAreInclusive),
|
17711 | /* harmony export */ "enableTopAxis": () => (/* binding */ enableTopAxis),
|
17712 | /* harmony export */ "topAxisEnabled": () => (/* binding */ topAxisEnabled),
|
17713 | /* harmony export */ "getDateFormat": () => (/* binding */ getDateFormat),
|
17714 | /* harmony export */ "setExcludes": () => (/* binding */ setExcludes),
|
17715 | /* harmony export */ "getExcludes": () => (/* binding */ getExcludes),
|
17716 | /* harmony export */ "setTitle": () => (/* binding */ setTitle),
|
17717 | /* harmony export */ "getTitle": () => (/* binding */ getTitle),
|
17718 | /* harmony export */ "addSection": () => (/* binding */ addSection),
|
17719 | /* harmony export */ "getSections": () => (/* binding */ getSections),
|
17720 | /* harmony export */ "getTasks": () => (/* binding */ getTasks),
|
17721 | /* harmony export */ "addTask": () => (/* binding */ addTask),
|
17722 | /* harmony export */ "findTaskById": () => (/* binding */ findTaskById),
|
17723 | /* harmony export */ "addTaskOrg": () => (/* binding */ addTaskOrg),
|
17724 | /* harmony export */ "setLink": () => (/* binding */ setLink),
|
17725 | /* harmony export */ "setClass": () => (/* binding */ setClass),
|
17726 | /* harmony export */ "setClickEvent": () => (/* binding */ setClickEvent),
|
17727 | /* harmony export */ "bindFunctions": () => (/* binding */ bindFunctions),
|
17728 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
17729 | /* harmony export */ });
|
17730 | /* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment-mini */ "moment-mini");
|
17731 | /* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_mini__WEBPACK_IMPORTED_MODULE_0__);
|
17732 | /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @braintree/sanitize-url */ "@braintree/sanitize-url");
|
17733 | /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__);
|
17734 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
17735 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
17736 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
17737 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
17738 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
17739 |
|
17740 | 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."); }
|
17741 |
|
17742 | 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); }
|
17743 |
|
17744 | function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
17745 |
|
17746 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
17747 |
|
17748 | 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; }
|
17749 |
|
17750 |
|
17751 |
|
17752 |
|
17753 |
|
17754 |
|
17755 |
|
17756 | var dateFormat = '';
|
17757 | var axisFormat = '';
|
17758 | var todayMarker = '';
|
17759 | var excludes = [];
|
17760 | var title = '';
|
17761 | var sections = [];
|
17762 | var tasks = [];
|
17763 | var currentSection = '';
|
17764 | var tags = ['active', 'done', 'crit', 'milestone'];
|
17765 | var funs = [];
|
17766 | var inclusiveEndDates = false;
|
17767 | var topAxis = false; // The serial order of the task in the script
|
17768 |
|
17769 | var lastOrder = 0;
|
17770 | var parseDirective = function parseDirective(statement, context, type) {
|
17771 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__["default"].parseDirective(this, statement, context, type);
|
17772 | };
|
17773 | var clear = function clear() {
|
17774 | sections = [];
|
17775 | tasks = [];
|
17776 | currentSection = '';
|
17777 | funs = [];
|
17778 | title = '';
|
17779 | taskCnt = 0;
|
17780 | lastTask = undefined;
|
17781 | lastTaskID = undefined;
|
17782 | rawTasks = [];
|
17783 | dateFormat = '';
|
17784 | axisFormat = '';
|
17785 | todayMarker = '';
|
17786 | excludes = [];
|
17787 | inclusiveEndDates = false;
|
17788 | topAxis = false;
|
17789 | lastOrder = 0;
|
17790 | };
|
17791 | var setAxisFormat = function setAxisFormat(txt) {
|
17792 | axisFormat = txt;
|
17793 | };
|
17794 | var getAxisFormat = function getAxisFormat() {
|
17795 | return axisFormat;
|
17796 | };
|
17797 | var setTodayMarker = function setTodayMarker(txt) {
|
17798 | todayMarker = txt;
|
17799 | };
|
17800 | var getTodayMarker = function getTodayMarker() {
|
17801 | return todayMarker;
|
17802 | };
|
17803 | var setDateFormat = function setDateFormat(txt) {
|
17804 | dateFormat = txt;
|
17805 | };
|
17806 | var enableInclusiveEndDates = function enableInclusiveEndDates() {
|
17807 | inclusiveEndDates = true;
|
17808 | };
|
17809 | var endDatesAreInclusive = function endDatesAreInclusive() {
|
17810 | return inclusiveEndDates;
|
17811 | };
|
17812 | var enableTopAxis = function enableTopAxis() {
|
17813 | topAxis = true;
|
17814 | };
|
17815 | var topAxisEnabled = function topAxisEnabled() {
|
17816 | return topAxis;
|
17817 | };
|
17818 | var getDateFormat = function getDateFormat() {
|
17819 | return dateFormat;
|
17820 | };
|
17821 | var setExcludes = function setExcludes(txt) {
|
17822 | excludes = txt.toLowerCase().split(/[\s,]+/);
|
17823 | };
|
17824 | var getExcludes = function getExcludes() {
|
17825 | return excludes;
|
17826 | };
|
17827 | var setTitle = function setTitle(txt) {
|
17828 | title = txt;
|
17829 | };
|
17830 | var getTitle = function getTitle() {
|
17831 | return title;
|
17832 | };
|
17833 | var addSection = function addSection(txt) {
|
17834 | currentSection = txt;
|
17835 | sections.push(txt);
|
17836 | };
|
17837 | var getSections = function getSections() {
|
17838 | return sections;
|
17839 | };
|
17840 | var getTasks = function getTasks() {
|
17841 | var allItemsPricessed = compileTasks();
|
17842 | var maxDepth = 10;
|
17843 | var iterationCount = 0;
|
17844 |
|
17845 | while (!allItemsPricessed && iterationCount < maxDepth) {
|
17846 | allItemsPricessed = compileTasks();
|
17847 | iterationCount++;
|
17848 | }
|
17849 |
|
17850 | tasks = rawTasks;
|
17851 | return tasks;
|
17852 | };
|
17853 |
|
17854 | var isInvalidDate = function isInvalidDate(date, dateFormat, excludes) {
|
17855 | if (date.isoWeekday() >= 6 && excludes.indexOf('weekends') >= 0) {
|
17856 | return true;
|
17857 | }
|
17858 |
|
17859 | if (excludes.indexOf(date.format('dddd').toLowerCase()) >= 0) {
|
17860 | return true;
|
17861 | }
|
17862 |
|
17863 | return excludes.indexOf(date.format(dateFormat.trim())) >= 0;
|
17864 | };
|
17865 |
|
17866 | var checkTaskDates = function checkTaskDates(task, dateFormat, excludes) {
|
17867 | if (!excludes.length || task.manualEndTime) return;
|
17868 | var startTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(task.startTime, dateFormat, true);
|
17869 | startTime.add(1, 'd');
|
17870 | var endTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(task.endTime, dateFormat, true);
|
17871 | var renderEndTime = fixTaskDates(startTime, endTime, dateFormat, excludes);
|
17872 | task.endTime = endTime.toDate();
|
17873 | task.renderEndTime = renderEndTime;
|
17874 | };
|
17875 |
|
17876 | var fixTaskDates = function fixTaskDates(startTime, endTime, dateFormat, excludes) {
|
17877 | var invalid = false;
|
17878 | var renderEndTime = null;
|
17879 |
|
17880 | while (startTime <= endTime) {
|
17881 | if (!invalid) {
|
17882 | renderEndTime = endTime.toDate();
|
17883 | }
|
17884 |
|
17885 | invalid = isInvalidDate(startTime, dateFormat, excludes);
|
17886 |
|
17887 | if (invalid) {
|
17888 | endTime.add(1, 'd');
|
17889 | }
|
17890 |
|
17891 | startTime.add(1, 'd');
|
17892 | }
|
17893 |
|
17894 | return renderEndTime;
|
17895 | };
|
17896 |
|
17897 | var getStartDate = function getStartDate(prevTime, dateFormat, str) {
|
17898 | str = str.trim(); // Test for after
|
17899 |
|
17900 | var re = /^after\s+([\d\w- ]+)/;
|
17901 | var afterStatement = re.exec(str.trim());
|
17902 |
|
17903 | if (afterStatement !== null) {
|
17904 | // check all after ids and take the latest
|
17905 | var latestEndingTask = null;
|
17906 | afterStatement[1].split(' ').forEach(function (id) {
|
17907 | var task = findTaskById(id);
|
17908 |
|
17909 | if (typeof task !== 'undefined') {
|
17910 | if (!latestEndingTask) {
|
17911 | latestEndingTask = task;
|
17912 | } else {
|
17913 | if (task.endTime > latestEndingTask.endTime) {
|
17914 | latestEndingTask = task;
|
17915 | }
|
17916 | }
|
17917 | }
|
17918 | });
|
17919 |
|
17920 | if (!latestEndingTask) {
|
17921 | var dt = new Date();
|
17922 | dt.setHours(0, 0, 0, 0);
|
17923 | return dt;
|
17924 | } else {
|
17925 | return latestEndingTask.endTime;
|
17926 | }
|
17927 | } // Check for actual date set
|
17928 |
|
17929 |
|
17930 | var mDate = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(str, dateFormat.trim(), true);
|
17931 |
|
17932 | if (mDate.isValid()) {
|
17933 | return mDate.toDate();
|
17934 | } else {
|
17935 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('Invalid date:' + str);
|
17936 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('With date format:' + dateFormat.trim());
|
17937 | } // Default date - now
|
17938 |
|
17939 |
|
17940 | return new Date();
|
17941 | };
|
17942 |
|
17943 | var durationToDate = function durationToDate(durationStatement, relativeTime) {
|
17944 | if (durationStatement !== null) {
|
17945 | switch (durationStatement[2]) {
|
17946 | case 's':
|
17947 | relativeTime.add(durationStatement[1], 'seconds');
|
17948 | break;
|
17949 |
|
17950 | case 'm':
|
17951 | relativeTime.add(durationStatement[1], 'minutes');
|
17952 | break;
|
17953 |
|
17954 | case 'h':
|
17955 | relativeTime.add(durationStatement[1], 'hours');
|
17956 | break;
|
17957 |
|
17958 | case 'd':
|
17959 | relativeTime.add(durationStatement[1], 'days');
|
17960 | break;
|
17961 |
|
17962 | case 'w':
|
17963 | relativeTime.add(durationStatement[1], 'weeks');
|
17964 | break;
|
17965 | }
|
17966 | } // Default date - now
|
17967 |
|
17968 |
|
17969 | return relativeTime.toDate();
|
17970 | };
|
17971 |
|
17972 | var getEndDate = function getEndDate(prevTime, dateFormat, str, inclusive) {
|
17973 | inclusive = inclusive || false;
|
17974 | str = str.trim(); // Check for actual date
|
17975 |
|
17976 | var mDate = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(str, dateFormat.trim(), true);
|
17977 |
|
17978 | if (mDate.isValid()) {
|
17979 | if (inclusive) {
|
17980 | mDate.add(1, 'd');
|
17981 | }
|
17982 |
|
17983 | return mDate.toDate();
|
17984 | }
|
17985 |
|
17986 | return durationToDate(/^([\d]+)([wdhms])/.exec(str.trim()), moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(prevTime));
|
17987 | };
|
17988 |
|
17989 | var taskCnt = 0;
|
17990 |
|
17991 | var parseId = function parseId(idStr) {
|
17992 | if (typeof idStr === 'undefined') {
|
17993 | taskCnt = taskCnt + 1;
|
17994 | return 'task' + taskCnt;
|
17995 | }
|
17996 |
|
17997 | return idStr;
|
17998 | }; // id, startDate, endDate
|
17999 | // id, startDate, length
|
18000 | // id, after x, endDate
|
18001 | // id, after x, length
|
18002 | // startDate, endDate
|
18003 | // startDate, length
|
18004 | // after x, endDate
|
18005 | // after x, length
|
18006 | // endDate
|
18007 | // length
|
18008 |
|
18009 |
|
18010 | var compileData = function compileData(prevTask, dataStr) {
|
18011 | var ds;
|
18012 |
|
18013 | if (dataStr.substr(0, 1) === ':') {
|
18014 | ds = dataStr.substr(1, dataStr.length);
|
18015 | } else {
|
18016 | ds = dataStr;
|
18017 | }
|
18018 |
|
18019 | var data = ds.split(',');
|
18020 | var task = {}; // Get tags like active, done, crit and milestone
|
18021 |
|
18022 | getTaskTags(data, task, tags);
|
18023 |
|
18024 | for (var i = 0; i < data.length; i++) {
|
18025 | data[i] = data[i].trim();
|
18026 | }
|
18027 |
|
18028 | var endTimeData = '';
|
18029 |
|
18030 | switch (data.length) {
|
18031 | case 1:
|
18032 | task.id = parseId();
|
18033 | task.startTime = prevTask.endTime;
|
18034 | endTimeData = data[0];
|
18035 | break;
|
18036 |
|
18037 | case 2:
|
18038 | task.id = parseId();
|
18039 | task.startTime = getStartDate(undefined, dateFormat, data[0]);
|
18040 | endTimeData = data[1];
|
18041 | break;
|
18042 |
|
18043 | case 3:
|
18044 | task.id = parseId(data[0]);
|
18045 | task.startTime = getStartDate(undefined, dateFormat, data[1]);
|
18046 | endTimeData = data[2];
|
18047 | break;
|
18048 |
|
18049 | default:
|
18050 | }
|
18051 |
|
18052 | if (endTimeData) {
|
18053 | task.endTime = getEndDate(task.startTime, dateFormat, endTimeData, inclusiveEndDates);
|
18054 | task.manualEndTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(endTimeData, 'YYYY-MM-DD', true).isValid();
|
18055 | checkTaskDates(task, dateFormat, excludes);
|
18056 | }
|
18057 |
|
18058 | return task;
|
18059 | };
|
18060 |
|
18061 | var parseData = function parseData(prevTaskId, dataStr) {
|
18062 | var ds;
|
18063 |
|
18064 | if (dataStr.substr(0, 1) === ':') {
|
18065 | ds = dataStr.substr(1, dataStr.length);
|
18066 | } else {
|
18067 | ds = dataStr;
|
18068 | }
|
18069 |
|
18070 | var data = ds.split(',');
|
18071 | var task = {}; // Get tags like active, done, crit and milestone
|
18072 |
|
18073 | getTaskTags(data, task, tags);
|
18074 |
|
18075 | for (var i = 0; i < data.length; i++) {
|
18076 | data[i] = data[i].trim();
|
18077 | }
|
18078 |
|
18079 | switch (data.length) {
|
18080 | case 1:
|
18081 | task.id = parseId();
|
18082 | task.startTime = {
|
18083 | type: 'prevTaskEnd',
|
18084 | id: prevTaskId
|
18085 | };
|
18086 | task.endTime = {
|
18087 | data: data[0]
|
18088 | };
|
18089 | break;
|
18090 |
|
18091 | case 2:
|
18092 | task.id = parseId();
|
18093 | task.startTime = {
|
18094 | type: 'getStartDate',
|
18095 | startData: data[0]
|
18096 | };
|
18097 | task.endTime = {
|
18098 | data: data[1]
|
18099 | };
|
18100 | break;
|
18101 |
|
18102 | case 3:
|
18103 | task.id = parseId(data[0]);
|
18104 | task.startTime = {
|
18105 | type: 'getStartDate',
|
18106 | startData: data[1]
|
18107 | };
|
18108 | task.endTime = {
|
18109 | data: data[2]
|
18110 | };
|
18111 | break;
|
18112 |
|
18113 | default:
|
18114 | }
|
18115 |
|
18116 | return task;
|
18117 | };
|
18118 |
|
18119 | var lastTask;
|
18120 | var lastTaskID;
|
18121 | var rawTasks = [];
|
18122 | var taskDb = {};
|
18123 | var addTask = function addTask(descr, data) {
|
18124 | var rawTask = {
|
18125 | section: currentSection,
|
18126 | type: currentSection,
|
18127 | processed: false,
|
18128 | manualEndTime: false,
|
18129 | renderEndTime: null,
|
18130 | raw: {
|
18131 | data: data
|
18132 | },
|
18133 | task: descr,
|
18134 | classes: []
|
18135 | };
|
18136 | var taskInfo = parseData(lastTaskID, data);
|
18137 | rawTask.raw.startTime = taskInfo.startTime;
|
18138 | rawTask.raw.endTime = taskInfo.endTime;
|
18139 | rawTask.id = taskInfo.id;
|
18140 | rawTask.prevTaskId = lastTaskID;
|
18141 | rawTask.active = taskInfo.active;
|
18142 | rawTask.done = taskInfo.done;
|
18143 | rawTask.crit = taskInfo.crit;
|
18144 | rawTask.milestone = taskInfo.milestone;
|
18145 | rawTask.order = lastOrder;
|
18146 | lastOrder++;
|
18147 | var pos = rawTasks.push(rawTask);
|
18148 | lastTaskID = rawTask.id; // Store cross ref
|
18149 |
|
18150 | taskDb[rawTask.id] = pos - 1;
|
18151 | };
|
18152 | var findTaskById = function findTaskById(id) {
|
18153 | var pos = taskDb[id];
|
18154 | return rawTasks[pos];
|
18155 | };
|
18156 | var addTaskOrg = function addTaskOrg(descr, data) {
|
18157 | var newTask = {
|
18158 | section: currentSection,
|
18159 | type: currentSection,
|
18160 | description: descr,
|
18161 | task: descr,
|
18162 | classes: []
|
18163 | };
|
18164 | var taskInfo = compileData(lastTask, data);
|
18165 | newTask.startTime = taskInfo.startTime;
|
18166 | newTask.endTime = taskInfo.endTime;
|
18167 | newTask.id = taskInfo.id;
|
18168 | newTask.active = taskInfo.active;
|
18169 | newTask.done = taskInfo.done;
|
18170 | newTask.crit = taskInfo.crit;
|
18171 | newTask.milestone = taskInfo.milestone;
|
18172 | lastTask = newTask;
|
18173 | tasks.push(newTask);
|
18174 | };
|
18175 |
|
18176 | var compileTasks = function compileTasks() {
|
18177 | var compileTask = function compileTask(pos) {
|
18178 | var task = rawTasks[pos];
|
18179 | var startTime = '';
|
18180 |
|
18181 | switch (rawTasks[pos].raw.startTime.type) {
|
18182 | case 'prevTaskEnd':
|
18183 | {
|
18184 | var prevTask = findTaskById(task.prevTaskId);
|
18185 | task.startTime = prevTask.endTime;
|
18186 | break;
|
18187 | }
|
18188 |
|
18189 | case 'getStartDate':
|
18190 | startTime = getStartDate(undefined, dateFormat, rawTasks[pos].raw.startTime.startData);
|
18191 |
|
18192 | if (startTime) {
|
18193 | rawTasks[pos].startTime = startTime;
|
18194 | }
|
18195 |
|
18196 | break;
|
18197 | }
|
18198 |
|
18199 | if (rawTasks[pos].startTime) {
|
18200 | rawTasks[pos].endTime = getEndDate(rawTasks[pos].startTime, dateFormat, rawTasks[pos].raw.endTime.data, inclusiveEndDates);
|
18201 |
|
18202 | if (rawTasks[pos].endTime) {
|
18203 | rawTasks[pos].processed = true;
|
18204 | rawTasks[pos].manualEndTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(rawTasks[pos].raw.endTime.data, 'YYYY-MM-DD', true).isValid();
|
18205 | checkTaskDates(rawTasks[pos], dateFormat, excludes);
|
18206 | }
|
18207 | }
|
18208 |
|
18209 | return rawTasks[pos].processed;
|
18210 | };
|
18211 |
|
18212 | var allProcessed = true;
|
18213 |
|
18214 | for (var i = 0; i < rawTasks.length; i++) {
|
18215 | compileTask(i);
|
18216 | allProcessed = allProcessed && rawTasks[i].processed;
|
18217 | }
|
18218 |
|
18219 | return allProcessed;
|
18220 | };
|
18221 | /**
|
18222 | * Called by parser when a link is found. Adds the URL to the vertex data.
|
18223 | * @param ids Comma separated list of ids
|
18224 | * @param linkStr URL to create a link for
|
18225 | */
|
18226 |
|
18227 |
|
18228 | var setLink = function setLink(ids, _linkStr) {
|
18229 | var linkStr = _linkStr;
|
18230 |
|
18231 | if (_config__WEBPACK_IMPORTED_MODULE_4__.getConfig().securityLevel !== 'loose') {
|
18232 | linkStr = (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__.sanitizeUrl)(_linkStr);
|
18233 | }
|
18234 |
|
18235 | ids.split(',').forEach(function (id) {
|
18236 | var rawTask = findTaskById(id);
|
18237 |
|
18238 | if (typeof rawTask !== 'undefined') {
|
18239 | pushFun(id, function () {
|
18240 | window.open(linkStr, '_self');
|
18241 | });
|
18242 | }
|
18243 | });
|
18244 | setClass(ids, 'clickable');
|
18245 | };
|
18246 | /**
|
18247 | * Called by parser when a special node is found, e.g. a clickable element.
|
18248 | * @param ids Comma separated list of ids
|
18249 | * @param className Class to add
|
18250 | */
|
18251 |
|
18252 | var setClass = function setClass(ids, className) {
|
18253 | ids.split(',').forEach(function (id) {
|
18254 | var rawTask = findTaskById(id);
|
18255 |
|
18256 | if (typeof rawTask !== 'undefined') {
|
18257 | rawTask.classes.push(className);
|
18258 | }
|
18259 | });
|
18260 | };
|
18261 |
|
18262 | var setClickFun = function setClickFun(id, functionName, functionArgs) {
|
18263 | if (_config__WEBPACK_IMPORTED_MODULE_4__.getConfig().securityLevel !== 'loose') {
|
18264 | return;
|
18265 | }
|
18266 |
|
18267 | if (typeof functionName === 'undefined') {
|
18268 | return;
|
18269 | }
|
18270 |
|
18271 | var argList = [];
|
18272 |
|
18273 | if (typeof functionArgs === 'string') {
|
18274 | /* Splits functionArgs by ',', ignoring all ',' in double quoted strings */
|
18275 | argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
|
18276 |
|
18277 | for (var i = 0; i < argList.length; i++) {
|
18278 | var item = argList[i].trim();
|
18279 | /* Removes all double quotes at the start and end of an argument */
|
18280 |
|
18281 | /* This preserves all starting and ending whitespace inside */
|
18282 |
|
18283 | if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
|
18284 | item = item.substr(1, item.length - 2);
|
18285 | }
|
18286 |
|
18287 | argList[i] = item;
|
18288 | }
|
18289 | }
|
18290 | /* if no arguments passed into callback, default to passing in id */
|
18291 |
|
18292 |
|
18293 | if (argList.length === 0) {
|
18294 | argList.push(id);
|
18295 | }
|
18296 |
|
18297 | var rawTask = findTaskById(id);
|
18298 |
|
18299 | if (typeof rawTask !== 'undefined') {
|
18300 | pushFun(id, function () {
|
18301 | _utils__WEBPACK_IMPORTED_MODULE_5__["default"].runFunc.apply(_utils__WEBPACK_IMPORTED_MODULE_5__["default"], [functionName].concat(_toConsumableArray(argList)));
|
18302 | });
|
18303 | }
|
18304 | };
|
18305 | /**
|
18306 | * The callbackFunction is executed in a click event bound to the task with the specified id or the task's assigned text
|
18307 | * @param id The task's id
|
18308 | * @param callbackFunction A function to be executed when clicked on the task or the task's text
|
18309 | */
|
18310 |
|
18311 |
|
18312 | var pushFun = function pushFun(id, callbackFunction) {
|
18313 | funs.push(function () {
|
18314 | // const elem = d3.select(element).select(`[id="${id}"]`)
|
18315 | var elem = document.querySelector("[id=\"".concat(id, "\"]"));
|
18316 |
|
18317 | if (elem !== null) {
|
18318 | elem.addEventListener('click', function () {
|
18319 | callbackFunction();
|
18320 | });
|
18321 | }
|
18322 | });
|
18323 | funs.push(function () {
|
18324 | // const elem = d3.select(element).select(`[id="${id}-text"]`)
|
18325 | var elem = document.querySelector("[id=\"".concat(id, "-text\"]"));
|
18326 |
|
18327 | if (elem !== null) {
|
18328 | elem.addEventListener('click', function () {
|
18329 | callbackFunction();
|
18330 | });
|
18331 | }
|
18332 | });
|
18333 | };
|
18334 | /**
|
18335 | * Called by parser when a click definition is found. Registers an event handler.
|
18336 | * @param ids Comma separated list of ids
|
18337 | * @param functionName Function to be called on click
|
18338 | * @param functionArgs Function args the function should be called with
|
18339 | */
|
18340 |
|
18341 |
|
18342 | var setClickEvent = function setClickEvent(ids, functionName, functionArgs) {
|
18343 | ids.split(',').forEach(function (id) {
|
18344 | setClickFun(id, functionName, functionArgs);
|
18345 | });
|
18346 | setClass(ids, 'clickable');
|
18347 | };
|
18348 | /**
|
18349 | * Binds all functions previously added to fun (specified through click) to the element
|
18350 | * @param element
|
18351 | */
|
18352 |
|
18353 | var bindFunctions = function bindFunctions(element) {
|
18354 | funs.forEach(function (fun) {
|
18355 | fun(element);
|
18356 | });
|
18357 | };
|
18358 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
18359 | parseDirective: parseDirective,
|
18360 | getConfig: function getConfig() {
|
18361 | return _config__WEBPACK_IMPORTED_MODULE_4__.getConfig().gantt;
|
18362 | },
|
18363 | clear: clear,
|
18364 | setDateFormat: setDateFormat,
|
18365 | getDateFormat: getDateFormat,
|
18366 | enableInclusiveEndDates: enableInclusiveEndDates,
|
18367 | endDatesAreInclusive: endDatesAreInclusive,
|
18368 | enableTopAxis: enableTopAxis,
|
18369 | topAxisEnabled: topAxisEnabled,
|
18370 | setAxisFormat: setAxisFormat,
|
18371 | getAxisFormat: getAxisFormat,
|
18372 | setTodayMarker: setTodayMarker,
|
18373 | getTodayMarker: getTodayMarker,
|
18374 | setTitle: setTitle,
|
18375 | getTitle: getTitle,
|
18376 | addSection: addSection,
|
18377 | getSections: getSections,
|
18378 | getTasks: getTasks,
|
18379 | addTask: addTask,
|
18380 | findTaskById: findTaskById,
|
18381 | addTaskOrg: addTaskOrg,
|
18382 | setExcludes: setExcludes,
|
18383 | getExcludes: getExcludes,
|
18384 | setClickEvent: setClickEvent,
|
18385 | setLink: setLink,
|
18386 | bindFunctions: bindFunctions,
|
18387 | durationToDate: durationToDate
|
18388 | });
|
18389 |
|
18390 | function getTaskTags(data, task, tags) {
|
18391 | var matchFound = true;
|
18392 |
|
18393 | while (matchFound) {
|
18394 | matchFound = false;
|
18395 | tags.forEach(function (t) {
|
18396 | var pattern = '^\\s*' + t + '\\s*$';
|
18397 | var regex = new RegExp(pattern);
|
18398 |
|
18399 | if (data[0].match(regex)) {
|
18400 | task[t] = true;
|
18401 | data.shift(1);
|
18402 | matchFound = true;
|
18403 | }
|
18404 | });
|
18405 | }
|
18406 | }
|
18407 |
|
18408 | /***/ }),
|
18409 |
|
18410 | /***/ "./src/diagrams/gantt/ganttRenderer.js":
|
18411 | /*!*********************************************!*\
|
18412 | !*** ./src/diagrams/gantt/ganttRenderer.js ***!
|
18413 | \*********************************************/
|
18414 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
18415 |
|
18416 | "use strict";
|
18417 | __webpack_require__.r(__webpack_exports__);
|
18418 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
18419 | /* harmony export */ "setConf": () => (/* binding */ setConf),
|
18420 | /* harmony export */ "draw": () => (/* binding */ draw),
|
18421 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
18422 | /* harmony export */ });
|
18423 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
18424 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
18425 | /* harmony import */ var _parser_gantt__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parser/gantt */ "./src/diagrams/gantt/parser/gantt.jison");
|
18426 | /* harmony import */ var _parser_gantt__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_parser_gantt__WEBPACK_IMPORTED_MODULE_1__);
|
18427 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
18428 | /* harmony import */ var _ganttDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ganttDb */ "./src/diagrams/gantt/ganttDb.js");
|
18429 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
18430 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
18431 |
|
18432 |
|
18433 |
|
18434 |
|
18435 |
|
18436 |
|
18437 | _parser_gantt__WEBPACK_IMPORTED_MODULE_1__.parser.yy = _ganttDb__WEBPACK_IMPORTED_MODULE_2__["default"];
|
18438 | var setConf = function setConf() {// const keys = Object.keys(cnf);
|
18439 | // keys.forEach(function(key) {
|
18440 | // conf[key] = cnf[key];
|
18441 | // });
|
18442 | };
|
18443 | var w;
|
18444 | var draw = function draw(text, id) {
|
18445 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().gantt;
|
18446 | _parser_gantt__WEBPACK_IMPORTED_MODULE_1__.parser.yy.clear();
|
18447 | _parser_gantt__WEBPACK_IMPORTED_MODULE_1__.parser.parse(text);
|
18448 | var elem = document.getElementById(id);
|
18449 | w = elem.parentElement.offsetWidth;
|
18450 |
|
18451 | if (typeof w === 'undefined') {
|
18452 | w = 1200;
|
18453 | }
|
18454 |
|
18455 | if (typeof conf.useWidth !== 'undefined') {
|
18456 | w = conf.useWidth;
|
18457 | }
|
18458 |
|
18459 | var taskArray = _parser_gantt__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getTasks(); // Set height based on number of tasks
|
18460 |
|
18461 | var h = taskArray.length * (conf.barHeight + conf.barGap) + 2 * conf.topPadding; // Set viewBox
|
18462 |
|
18463 | elem.setAttribute('viewBox', '0 0 ' + w + ' ' + h);
|
18464 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id=\"".concat(id, "\"]")); // Set timescale
|
18465 |
|
18466 | var timeScale = (0,d3__WEBPACK_IMPORTED_MODULE_0__.scaleTime)().domain([(0,d3__WEBPACK_IMPORTED_MODULE_0__.min)(taskArray, function (d) {
|
18467 | return d.startTime;
|
18468 | }), (0,d3__WEBPACK_IMPORTED_MODULE_0__.max)(taskArray, function (d) {
|
18469 | return d.endTime;
|
18470 | })]).rangeRound([0, w - conf.leftPadding - conf.rightPadding]);
|
18471 | var categories = [];
|
18472 |
|
18473 | for (var i = 0; i < taskArray.length; i++) {
|
18474 | categories.push(taskArray[i].type);
|
18475 | }
|
18476 |
|
18477 | var catsUnfiltered = categories; // for vert labels
|
18478 |
|
18479 | categories = checkUnique(categories);
|
18480 |
|
18481 | function taskCompare(a, b) {
|
18482 | var taskA = a.startTime;
|
18483 | var taskB = b.startTime;
|
18484 | var result = 0;
|
18485 |
|
18486 | if (taskA > taskB) {
|
18487 | result = 1;
|
18488 | } else if (taskA < taskB) {
|
18489 | result = -1;
|
18490 | }
|
18491 |
|
18492 | return result;
|
18493 | } // Sort the task array using the above taskCompare() so that
|
18494 | // tasks are created based on their order of startTime
|
18495 |
|
18496 |
|
18497 | taskArray.sort(taskCompare);
|
18498 | makeGant(taskArray, w, h);
|
18499 | (0,_utils__WEBPACK_IMPORTED_MODULE_4__.configureSvgSize)(svg, h, w, conf.useMaxWidth);
|
18500 | svg.append('text').text(_parser_gantt__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getTitle()).attr('x', w / 2).attr('y', conf.titleTopMargin).attr('class', 'titleText');
|
18501 |
|
18502 | function makeGant(tasks, pageWidth, pageHeight) {
|
18503 | var barHeight = conf.barHeight;
|
18504 | var gap = barHeight + conf.barGap;
|
18505 | var topPadding = conf.topPadding;
|
18506 | var leftPadding = conf.leftPadding;
|
18507 | var colorScale = (0,d3__WEBPACK_IMPORTED_MODULE_0__.scaleLinear)().domain([0, categories.length]).range(['#00B9FA', '#F95002']).interpolate(d3__WEBPACK_IMPORTED_MODULE_0__.interpolateHcl);
|
18508 | makeGrid(leftPadding, topPadding, pageWidth, pageHeight);
|
18509 | drawRects(tasks, gap, topPadding, leftPadding, barHeight, colorScale, pageWidth, pageHeight);
|
18510 | vertLabels(gap, topPadding, leftPadding, barHeight, colorScale);
|
18511 | drawToday(leftPadding, topPadding, pageWidth, pageHeight);
|
18512 | }
|
18513 |
|
18514 | function drawRects(theArray, theGap, theTopPad, theSidePad, theBarHeight, theColorScale, w) {
|
18515 | // Draw background rects covering the entire width of the graph, these form the section rows.
|
18516 | svg.append('g').selectAll('rect').data(theArray).enter().append('rect').attr('x', 0).attr('y', function (d, i) {
|
18517 | // Ignore the incoming i value and use our order instead
|
18518 | i = d.order;
|
18519 | return i * theGap + theTopPad - 2;
|
18520 | }).attr('width', function () {
|
18521 | return w - conf.rightPadding / 2;
|
18522 | }).attr('height', theGap).attr('class', function (d) {
|
18523 | for (var _i = 0; _i < categories.length; _i++) {
|
18524 | if (d.type === categories[_i]) {
|
18525 | return 'section section' + _i % conf.numberSectionStyles;
|
18526 | }
|
18527 | }
|
18528 |
|
18529 | return 'section section0';
|
18530 | }); // Draw the rects representing the tasks
|
18531 |
|
18532 | var rectangles = svg.append('g').selectAll('rect').data(theArray).enter();
|
18533 | rectangles.append('rect').attr('id', function (d) {
|
18534 | return d.id;
|
18535 | }).attr('rx', 3).attr('ry', 3).attr('x', function (d) {
|
18536 | if (d.milestone) {
|
18537 | return timeScale(d.startTime) + theSidePad + 0.5 * (timeScale(d.endTime) - timeScale(d.startTime)) - 0.5 * theBarHeight;
|
18538 | }
|
18539 |
|
18540 | return timeScale(d.startTime) + theSidePad;
|
18541 | }).attr('y', function (d, i) {
|
18542 | // Ignore the incoming i value and use our order instead
|
18543 | i = d.order;
|
18544 | return i * theGap + theTopPad;
|
18545 | }).attr('width', function (d) {
|
18546 | if (d.milestone) {
|
18547 | return theBarHeight;
|
18548 | }
|
18549 |
|
18550 | return timeScale(d.renderEndTime || d.endTime) - timeScale(d.startTime);
|
18551 | }).attr('height', theBarHeight).attr('transform-origin', function (d, i) {
|
18552 | // Ignore the incoming i value and use our order instead
|
18553 | i = d.order;
|
18554 | return (timeScale(d.startTime) + theSidePad + 0.5 * (timeScale(d.endTime) - timeScale(d.startTime))).toString() + 'px ' + (i * theGap + theTopPad + 0.5 * theBarHeight).toString() + 'px';
|
18555 | }).attr('class', function (d) {
|
18556 | var res = 'task';
|
18557 | var classStr = '';
|
18558 |
|
18559 | if (d.classes.length > 0) {
|
18560 | classStr = d.classes.join(' ');
|
18561 | }
|
18562 |
|
18563 | var secNum = 0;
|
18564 |
|
18565 | for (var _i2 = 0; _i2 < categories.length; _i2++) {
|
18566 | if (d.type === categories[_i2]) {
|
18567 | secNum = _i2 % conf.numberSectionStyles;
|
18568 | }
|
18569 | }
|
18570 |
|
18571 | var taskClass = '';
|
18572 |
|
18573 | if (d.active) {
|
18574 | if (d.crit) {
|
18575 | taskClass += ' activeCrit';
|
18576 | } else {
|
18577 | taskClass = ' active';
|
18578 | }
|
18579 | } else if (d.done) {
|
18580 | if (d.crit) {
|
18581 | taskClass = ' doneCrit';
|
18582 | } else {
|
18583 | taskClass = ' done';
|
18584 | }
|
18585 | } else {
|
18586 | if (d.crit) {
|
18587 | taskClass += ' crit';
|
18588 | }
|
18589 | }
|
18590 |
|
18591 | if (taskClass.length === 0) {
|
18592 | taskClass = ' task';
|
18593 | }
|
18594 |
|
18595 | if (d.milestone) {
|
18596 | taskClass = ' milestone ' + taskClass;
|
18597 | }
|
18598 |
|
18599 | taskClass += secNum;
|
18600 | taskClass += ' ' + classStr;
|
18601 | return res + taskClass;
|
18602 | }); // Append task labels
|
18603 |
|
18604 | rectangles.append('text').attr('id', function (d) {
|
18605 | return d.id + '-text';
|
18606 | }).text(function (d) {
|
18607 | return d.task;
|
18608 | }).attr('font-size', conf.fontSize).attr('x', function (d) {
|
18609 | var startX = timeScale(d.startTime);
|
18610 | var endX = timeScale(d.renderEndTime || d.endTime);
|
18611 |
|
18612 | if (d.milestone) {
|
18613 | startX += 0.5 * (timeScale(d.endTime) - timeScale(d.startTime)) - 0.5 * theBarHeight;
|
18614 | }
|
18615 |
|
18616 | if (d.milestone) {
|
18617 | endX = startX + theBarHeight;
|
18618 | }
|
18619 |
|
18620 | var textWidth = this.getBBox().width; // Check id text width > width of rectangle
|
18621 |
|
18622 | if (textWidth > endX - startX) {
|
18623 | if (endX + textWidth + 1.5 * conf.leftPadding > w) {
|
18624 | return startX + theSidePad - 5;
|
18625 | } else {
|
18626 | return endX + theSidePad + 5;
|
18627 | }
|
18628 | } else {
|
18629 | return (endX - startX) / 2 + startX + theSidePad;
|
18630 | }
|
18631 | }).attr('y', function (d, i) {
|
18632 | // Ignore the incoming i value and use our order instead
|
18633 | i = d.order;
|
18634 | return i * theGap + conf.barHeight / 2 + (conf.fontSize / 2 - 2) + theTopPad;
|
18635 | }).attr('text-height', theBarHeight).attr('class', function (d) {
|
18636 | var startX = timeScale(d.startTime);
|
18637 | var endX = timeScale(d.endTime);
|
18638 |
|
18639 | if (d.milestone) {
|
18640 | endX = startX + theBarHeight;
|
18641 | }
|
18642 |
|
18643 | var textWidth = this.getBBox().width;
|
18644 | var classStr = '';
|
18645 |
|
18646 | if (d.classes.length > 0) {
|
18647 | classStr = d.classes.join(' ');
|
18648 | }
|
18649 |
|
18650 | var secNum = 0;
|
18651 |
|
18652 | for (var _i3 = 0; _i3 < categories.length; _i3++) {
|
18653 | if (d.type === categories[_i3]) {
|
18654 | secNum = _i3 % conf.numberSectionStyles;
|
18655 | }
|
18656 | }
|
18657 |
|
18658 | var taskType = '';
|
18659 |
|
18660 | if (d.active) {
|
18661 | if (d.crit) {
|
18662 | taskType = 'activeCritText' + secNum;
|
18663 | } else {
|
18664 | taskType = 'activeText' + secNum;
|
18665 | }
|
18666 | }
|
18667 |
|
18668 | if (d.done) {
|
18669 | if (d.crit) {
|
18670 | taskType = taskType + ' doneCritText' + secNum;
|
18671 | } else {
|
18672 | taskType = taskType + ' doneText' + secNum;
|
18673 | }
|
18674 | } else {
|
18675 | if (d.crit) {
|
18676 | taskType = taskType + ' critText' + secNum;
|
18677 | }
|
18678 | }
|
18679 |
|
18680 | if (d.milestone) {
|
18681 | taskType += ' milestoneText';
|
18682 | } // Check id text width > width of rectangle
|
18683 |
|
18684 |
|
18685 | if (textWidth > endX - startX) {
|
18686 | if (endX + textWidth + 1.5 * conf.leftPadding > w) {
|
18687 | return classStr + ' taskTextOutsideLeft taskTextOutside' + secNum + ' ' + taskType;
|
18688 | } else {
|
18689 | return classStr + ' taskTextOutsideRight taskTextOutside' + secNum + ' ' + taskType + ' width-' + textWidth;
|
18690 | }
|
18691 | } else {
|
18692 | return classStr + ' taskText taskText' + secNum + ' ' + taskType + ' width-' + textWidth;
|
18693 | }
|
18694 | });
|
18695 | }
|
18696 |
|
18697 | function makeGrid(theSidePad, theTopPad, w, h) {
|
18698 | var bottomXAxis = (0,d3__WEBPACK_IMPORTED_MODULE_0__.axisBottom)(timeScale).tickSize(-h + theTopPad + conf.gridLineStartPadding).tickFormat((0,d3__WEBPACK_IMPORTED_MODULE_0__.timeFormat)(_parser_gantt__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getAxisFormat() || conf.axisFormat || '%Y-%m-%d'));
|
18699 | 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');
|
18700 |
|
18701 | if (_ganttDb__WEBPACK_IMPORTED_MODULE_2__["default"].topAxisEnabled() || conf.topAxis) {
|
18702 | var topXAxis = (0,d3__WEBPACK_IMPORTED_MODULE_0__.axisTop)(timeScale).tickSize(-h + theTopPad + conf.gridLineStartPadding).tickFormat((0,d3__WEBPACK_IMPORTED_MODULE_0__.timeFormat)(_parser_gantt__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getAxisFormat() || conf.axisFormat || '%Y-%m-%d'));
|
18703 | 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');
|
18704 | }
|
18705 | }
|
18706 |
|
18707 | function vertLabels(theGap, theTopPad) {
|
18708 | var numOccurances = [];
|
18709 | var prevGap = 0;
|
18710 |
|
18711 | for (var _i4 = 0; _i4 < categories.length; _i4++) {
|
18712 | numOccurances[_i4] = [categories[_i4], getCount(categories[_i4], catsUnfiltered)];
|
18713 | }
|
18714 |
|
18715 | svg.append('g') // without doing this, impossible to put grid lines behind text
|
18716 | .selectAll('text').data(numOccurances).enter().append(function (d) {
|
18717 | var rows = d[0].split(_common_common__WEBPACK_IMPORTED_MODULE_5__["default"].lineBreakRegex);
|
18718 | var dy = -(rows.length - 1) / 2;
|
18719 | var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
18720 | svgLabel.setAttribute('dy', dy + 'em');
|
18721 |
|
18722 | for (var j = 0; j < rows.length; j++) {
|
18723 | var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
18724 | tspan.setAttribute('alignment-baseline', 'central');
|
18725 | tspan.setAttribute('x', '10');
|
18726 | if (j > 0) tspan.setAttribute('dy', '1em');
|
18727 | tspan.textContent = rows[j];
|
18728 | svgLabel.appendChild(tspan);
|
18729 | }
|
18730 |
|
18731 | return svgLabel;
|
18732 | }).attr('x', 10).attr('y', function (d, i) {
|
18733 | if (i > 0) {
|
18734 | for (var j = 0; j < i; j++) {
|
18735 | prevGap += numOccurances[i - 1][1];
|
18736 | return d[1] * theGap / 2 + prevGap * theGap + theTopPad;
|
18737 | }
|
18738 | } else {
|
18739 | return d[1] * theGap / 2 + theTopPad;
|
18740 | }
|
18741 | }).attr('font-size', conf.sectionFontSize).attr('font-size', conf.sectionFontSize).attr('class', function (d) {
|
18742 | for (var _i5 = 0; _i5 < categories.length; _i5++) {
|
18743 | if (d[0] === categories[_i5]) {
|
18744 | return 'sectionTitle sectionTitle' + _i5 % conf.numberSectionStyles;
|
18745 | }
|
18746 | }
|
18747 |
|
18748 | return 'sectionTitle';
|
18749 | });
|
18750 | }
|
18751 |
|
18752 | function drawToday(theSidePad, theTopPad, w, h) {
|
18753 | var todayMarker = _ganttDb__WEBPACK_IMPORTED_MODULE_2__["default"].getTodayMarker();
|
18754 |
|
18755 | if (todayMarker === 'off') {
|
18756 | return;
|
18757 | }
|
18758 |
|
18759 | var todayG = svg.append('g').attr('class', 'today');
|
18760 | var today = new Date();
|
18761 | var todayLine = todayG.append('line');
|
18762 | todayLine.attr('x1', timeScale(today) + theSidePad).attr('x2', timeScale(today) + theSidePad).attr('y1', conf.titleTopMargin).attr('y2', h - conf.titleTopMargin).attr('class', 'today');
|
18763 |
|
18764 | if (todayMarker !== '') {
|
18765 | todayLine.attr('style', todayMarker.replace(/,/g, ';'));
|
18766 | }
|
18767 | } // from this stackexchange question: http://stackoverflow.com/questions/1890203/unique-for-arrays-in-javascript
|
18768 |
|
18769 |
|
18770 | function checkUnique(arr) {
|
18771 | var hash = {};
|
18772 | var result = [];
|
18773 |
|
18774 | for (var _i6 = 0, l = arr.length; _i6 < l; ++_i6) {
|
18775 | if (!hash.hasOwnProperty(arr[_i6])) {
|
18776 | // eslint-disable-line
|
18777 | // it works with objects! in FF, at least
|
18778 | hash[arr[_i6]] = true;
|
18779 | result.push(arr[_i6]);
|
18780 | }
|
18781 | }
|
18782 |
|
18783 | return result;
|
18784 | } // from this stackexchange question: http://stackoverflow.com/questions/14227981/count-how-many-strings-in-an-array-have-duplicates-in-the-same-array
|
18785 |
|
18786 |
|
18787 | function getCounts(arr) {
|
18788 | var i = arr.length; // const to loop over
|
18789 |
|
18790 | var obj = {}; // obj to store results
|
18791 |
|
18792 | while (i) {
|
18793 | obj[arr[--i]] = (obj[arr[i]] || 0) + 1; // count occurrences
|
18794 | }
|
18795 |
|
18796 | return obj;
|
18797 | } // get specific from everything
|
18798 |
|
18799 |
|
18800 | function getCount(word, arr) {
|
18801 | return getCounts(arr)[word] || 0;
|
18802 | }
|
18803 | };
|
18804 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
18805 | setConf: setConf,
|
18806 | draw: draw
|
18807 | });
|
18808 |
|
18809 | /***/ }),
|
18810 |
|
18811 | /***/ "./src/diagrams/gantt/styles.js":
|
18812 | /*!**************************************!*\
|
18813 | !*** ./src/diagrams/gantt/styles.js ***!
|
18814 | \**************************************/
|
18815 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
18816 |
|
18817 | "use strict";
|
18818 | __webpack_require__.r(__webpack_exports__);
|
18819 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
18820 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
18821 | /* harmony export */ });
|
18822 | var getStyles = function getStyles(options) {
|
18823 | return "\n .mermaid-main-font {\n font-family: \"trebuchet ms\", verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\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");
|
18824 | };
|
18825 |
|
18826 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
18827 |
|
18828 | /***/ }),
|
18829 |
|
18830 | /***/ "./src/diagrams/git/gitGraphAst.js":
|
18831 | /*!*****************************************!*\
|
18832 | !*** ./src/diagrams/git/gitGraphAst.js ***!
|
18833 | \*****************************************/
|
18834 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
18835 |
|
18836 | "use strict";
|
18837 | __webpack_require__.r(__webpack_exports__);
|
18838 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
18839 | /* harmony export */ "setDirection": () => (/* binding */ setDirection),
|
18840 | /* harmony export */ "setOptions": () => (/* binding */ setOptions),
|
18841 | /* harmony export */ "getOptions": () => (/* binding */ getOptions),
|
18842 | /* harmony export */ "commit": () => (/* binding */ commit),
|
18843 | /* harmony export */ "branch": () => (/* binding */ branch),
|
18844 | /* harmony export */ "merge": () => (/* binding */ merge),
|
18845 | /* harmony export */ "checkout": () => (/* binding */ checkout),
|
18846 | /* harmony export */ "reset": () => (/* binding */ reset),
|
18847 | /* harmony export */ "prettyPrint": () => (/* binding */ prettyPrint),
|
18848 | /* harmony export */ "clear": () => (/* binding */ clear),
|
18849 | /* harmony export */ "getBranchesAsObjArray": () => (/* binding */ getBranchesAsObjArray),
|
18850 | /* harmony export */ "getBranches": () => (/* binding */ getBranches),
|
18851 | /* harmony export */ "getCommits": () => (/* binding */ getCommits),
|
18852 | /* harmony export */ "getCommitsArray": () => (/* binding */ getCommitsArray),
|
18853 | /* harmony export */ "getCurrentBranch": () => (/* binding */ getCurrentBranch),
|
18854 | /* harmony export */ "getDirection": () => (/* binding */ getDirection),
|
18855 | /* harmony export */ "getHead": () => (/* binding */ getHead),
|
18856 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
18857 | /* harmony export */ });
|
18858 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
18859 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
18860 |
|
18861 |
|
18862 | var commits = {};
|
18863 | var head = null;
|
18864 | var branches = {
|
18865 | master: head
|
18866 | };
|
18867 | var curBranch = 'master';
|
18868 | var direction = 'LR';
|
18869 | var seq = 0;
|
18870 |
|
18871 | function getId() {
|
18872 | return (0,_utils__WEBPACK_IMPORTED_MODULE_0__.random)({
|
18873 | length: 7
|
18874 | });
|
18875 | }
|
18876 |
|
18877 | function isfastforwardable(currentCommit, otherCommit) {
|
18878 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Entering isfastforwardable:', currentCommit.id, otherCommit.id);
|
18879 |
|
18880 | while (currentCommit.seq <= otherCommit.seq && currentCommit !== otherCommit) {
|
18881 | // only if other branch has more commits
|
18882 | if (otherCommit.parent == null) break;
|
18883 |
|
18884 | if (Array.isArray(otherCommit.parent)) {
|
18885 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('In merge commit:', otherCommit.parent);
|
18886 | return isfastforwardable(currentCommit, commits[otherCommit.parent[0]]) || isfastforwardable(currentCommit, commits[otherCommit.parent[1]]);
|
18887 | } else {
|
18888 | otherCommit = commits[otherCommit.parent];
|
18889 | }
|
18890 | }
|
18891 |
|
18892 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(currentCommit.id, otherCommit.id);
|
18893 | return currentCommit.id === otherCommit.id;
|
18894 | }
|
18895 |
|
18896 | function isReachableFrom(currentCommit, otherCommit) {
|
18897 | var currentSeq = currentCommit.seq;
|
18898 | var otherSeq = otherCommit.seq;
|
18899 | if (currentSeq > otherSeq) return isfastforwardable(otherCommit, currentCommit);
|
18900 | return false;
|
18901 | }
|
18902 |
|
18903 | function uniqBy(list, fn) {
|
18904 | var recordMap = Object.create(null);
|
18905 | return list.reduce(function (out, item) {
|
18906 | var key = fn(item);
|
18907 |
|
18908 | if (!recordMap[key]) {
|
18909 | recordMap[key] = true;
|
18910 | out.push(item);
|
18911 | }
|
18912 |
|
18913 | return out;
|
18914 | }, []);
|
18915 | }
|
18916 |
|
18917 | var setDirection = function setDirection(dir) {
|
18918 | direction = dir;
|
18919 | };
|
18920 | var options = {};
|
18921 | var setOptions = function setOptions(rawOptString) {
|
18922 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('options str', rawOptString);
|
18923 | rawOptString = rawOptString && rawOptString.trim();
|
18924 | rawOptString = rawOptString || '{}';
|
18925 |
|
18926 | try {
|
18927 | options = JSON.parse(rawOptString);
|
18928 | } catch (e) {
|
18929 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('error while parsing gitGraph options', e.message);
|
18930 | }
|
18931 | };
|
18932 | var getOptions = function getOptions() {
|
18933 | return options;
|
18934 | };
|
18935 | var commit = function commit(msg) {
|
18936 | var commit = {
|
18937 | id: getId(),
|
18938 | message: msg,
|
18939 | seq: seq++,
|
18940 | parent: head == null ? null : head.id
|
18941 | };
|
18942 | head = commit;
|
18943 | commits[commit.id] = commit;
|
18944 | branches[curBranch] = commit.id;
|
18945 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('in pushCommit ' + commit.id);
|
18946 | };
|
18947 | var branch = function branch(name) {
|
18948 | branches[name] = head != null ? head.id : null;
|
18949 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('in createBranch');
|
18950 | };
|
18951 | var merge = function merge(otherBranch) {
|
18952 | var currentCommit = commits[branches[curBranch]];
|
18953 | var otherCommit = commits[branches[otherBranch]];
|
18954 |
|
18955 | if (isReachableFrom(currentCommit, otherCommit)) {
|
18956 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Already merged');
|
18957 | return;
|
18958 | }
|
18959 |
|
18960 | if (isfastforwardable(currentCommit, otherCommit)) {
|
18961 | branches[curBranch] = branches[otherBranch];
|
18962 | head = commits[branches[curBranch]];
|
18963 | } else {
|
18964 | // create merge commit
|
18965 | var _commit = {
|
18966 | id: getId(),
|
18967 | message: 'merged branch ' + otherBranch + ' into ' + curBranch,
|
18968 | seq: seq++,
|
18969 | parent: [head == null ? null : head.id, branches[otherBranch]]
|
18970 | };
|
18971 | head = _commit;
|
18972 | commits[_commit.id] = _commit;
|
18973 | branches[curBranch] = _commit.id;
|
18974 | }
|
18975 |
|
18976 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(branches);
|
18977 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('in mergeBranch');
|
18978 | };
|
18979 | var checkout = function checkout(branch) {
|
18980 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('in checkout');
|
18981 | curBranch = branch;
|
18982 | var id = branches[curBranch];
|
18983 | head = commits[id];
|
18984 | };
|
18985 | var reset = function reset(commitRef) {
|
18986 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('in reset', commitRef);
|
18987 | var ref = commitRef.split(':')[0];
|
18988 | var parentCount = parseInt(commitRef.split(':')[1]);
|
18989 | var commit = ref === 'HEAD' ? head : commits[branches[ref]];
|
18990 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(commit, parentCount);
|
18991 |
|
18992 | while (parentCount > 0) {
|
18993 | commit = commits[commit.parent];
|
18994 | parentCount--;
|
18995 |
|
18996 | if (!commit) {
|
18997 | var err = 'Critical error - unique parent commit not found during reset';
|
18998 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error(err);
|
18999 | throw err;
|
19000 | }
|
19001 | }
|
19002 |
|
19003 | head = commit;
|
19004 | branches[curBranch] = commit.id;
|
19005 | };
|
19006 |
|
19007 | function upsert(arr, key, newval) {
|
19008 | var index = arr.indexOf(key);
|
19009 |
|
19010 | if (index === -1) {
|
19011 | arr.push(newval);
|
19012 | } else {
|
19013 | arr.splice(index, 1, newval);
|
19014 | }
|
19015 | }
|
19016 |
|
19017 | function prettyPrintCommitHistory(commitArr) {
|
19018 | var commit = commitArr.reduce(function (out, commit) {
|
19019 | if (out.seq > commit.seq) return out;
|
19020 | return commit;
|
19021 | }, commitArr[0]);
|
19022 | var line = '';
|
19023 | commitArr.forEach(function (c) {
|
19024 | if (c === commit) {
|
19025 | line += '\t*';
|
19026 | } else {
|
19027 | line += '\t|';
|
19028 | }
|
19029 | });
|
19030 | var label = [line, commit.id, commit.seq];
|
19031 |
|
19032 | for (var _branch in branches) {
|
19033 | if (branches[_branch] === commit.id) label.push(_branch);
|
19034 | }
|
19035 |
|
19036 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(label.join(' '));
|
19037 |
|
19038 | if (Array.isArray(commit.parent)) {
|
19039 | var newCommit = commits[commit.parent[0]];
|
19040 | upsert(commitArr, commit, newCommit);
|
19041 | commitArr.push(commits[commit.parent[1]]);
|
19042 | } else if (commit.parent == null) {
|
19043 | return;
|
19044 | } else {
|
19045 | var nextCommit = commits[commit.parent];
|
19046 | upsert(commitArr, commit, nextCommit);
|
19047 | }
|
19048 |
|
19049 | commitArr = uniqBy(commitArr, function (c) {
|
19050 | return c.id;
|
19051 | });
|
19052 | prettyPrintCommitHistory(commitArr);
|
19053 | }
|
19054 |
|
19055 | var prettyPrint = function prettyPrint() {
|
19056 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(commits);
|
19057 | var node = getCommitsArray()[0];
|
19058 | prettyPrintCommitHistory([node]);
|
19059 | };
|
19060 | var clear = function clear() {
|
19061 | commits = {};
|
19062 | head = null;
|
19063 | branches = {
|
19064 | master: head
|
19065 | };
|
19066 | curBranch = 'master';
|
19067 | seq = 0;
|
19068 | };
|
19069 | var getBranchesAsObjArray = function getBranchesAsObjArray() {
|
19070 | var branchArr = [];
|
19071 |
|
19072 | for (var _branch2 in branches) {
|
19073 | branchArr.push({
|
19074 | name: _branch2,
|
19075 | commit: commits[branches[_branch2]]
|
19076 | });
|
19077 | }
|
19078 |
|
19079 | return branchArr;
|
19080 | };
|
19081 | var getBranches = function getBranches() {
|
19082 | return branches;
|
19083 | };
|
19084 | var getCommits = function getCommits() {
|
19085 | return commits;
|
19086 | };
|
19087 | var getCommitsArray = function getCommitsArray() {
|
19088 | var commitArr = Object.keys(commits).map(function (key) {
|
19089 | return commits[key];
|
19090 | });
|
19091 | commitArr.forEach(function (o) {
|
19092 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(o.id);
|
19093 | });
|
19094 | commitArr.sort(function (a, b) {
|
19095 | return b.seq - a.seq;
|
19096 | });
|
19097 | return commitArr;
|
19098 | };
|
19099 | var getCurrentBranch = function getCurrentBranch() {
|
19100 | return curBranch;
|
19101 | };
|
19102 | var getDirection = function getDirection() {
|
19103 | return direction;
|
19104 | };
|
19105 | var getHead = function getHead() {
|
19106 | return head;
|
19107 | };
|
19108 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
19109 | setDirection: setDirection,
|
19110 | setOptions: setOptions,
|
19111 | getOptions: getOptions,
|
19112 | commit: commit,
|
19113 | branch: branch,
|
19114 | merge: merge,
|
19115 | checkout: checkout,
|
19116 | reset: reset,
|
19117 | prettyPrint: prettyPrint,
|
19118 | clear: clear,
|
19119 | getBranchesAsObjArray: getBranchesAsObjArray,
|
19120 | getBranches: getBranches,
|
19121 | getCommits: getCommits,
|
19122 | getCommitsArray: getCommitsArray,
|
19123 | getCurrentBranch: getCurrentBranch,
|
19124 | getDirection: getDirection,
|
19125 | getHead: getHead
|
19126 | });
|
19127 |
|
19128 | /***/ }),
|
19129 |
|
19130 | /***/ "./src/diagrams/git/gitGraphRenderer.js":
|
19131 | /*!**********************************************!*\
|
19132 | !*** ./src/diagrams/git/gitGraphRenderer.js ***!
|
19133 | \**********************************************/
|
19134 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
19135 |
|
19136 | "use strict";
|
19137 | __webpack_require__.r(__webpack_exports__);
|
19138 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
19139 | /* harmony export */ "setConf": () => (/* binding */ setConf),
|
19140 | /* harmony export */ "draw": () => (/* binding */ draw),
|
19141 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
19142 | /* harmony export */ });
|
19143 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
19144 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
19145 | /* harmony import */ var _gitGraphAst__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./gitGraphAst */ "./src/diagrams/git/gitGraphAst.js");
|
19146 | /* harmony import */ var _parser_gitGraph__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/gitGraph */ "./src/diagrams/git/parser/gitGraph.jison");
|
19147 | /* harmony import */ var _parser_gitGraph__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_gitGraph__WEBPACK_IMPORTED_MODULE_3__);
|
19148 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
19149 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
19150 |
|
19151 |
|
19152 |
|
19153 |
|
19154 |
|
19155 | var allCommitsDict = {};
|
19156 | var branchNum;
|
19157 | var config = {
|
19158 | nodeSpacing: 150,
|
19159 | nodeFillColor: 'yellow',
|
19160 | nodeStrokeWidth: 2,
|
19161 | nodeStrokeColor: 'grey',
|
19162 | lineStrokeWidth: 4,
|
19163 | branchOffset: 50,
|
19164 | lineColor: 'grey',
|
19165 | leftMargin: 50,
|
19166 | branchColors: ['#442f74', '#983351', '#609732', '#AA9A39'],
|
19167 | nodeRadius: 10,
|
19168 | nodeLabel: {
|
19169 | width: 75,
|
19170 | height: 100,
|
19171 | x: -25,
|
19172 | y: 0
|
19173 | }
|
19174 | };
|
19175 | var apiConfig = {};
|
19176 | var setConf = function setConf(c) {
|
19177 | apiConfig = c;
|
19178 | };
|
19179 |
|
19180 | function svgCreateDefs(svg) {
|
19181 | svg.append('defs').append('g').attr('id', 'def-commit').append('circle').attr('r', config.nodeRadius).attr('cx', 0).attr('cy', 0);
|
19182 | svg.select('#def-commit').append('foreignObject').attr('width', config.nodeLabel.width).attr('height', config.nodeLabel.height).attr('x', config.nodeLabel.x).attr('y', config.nodeLabel.y).attr('class', 'node-label').attr('requiredFeatures', 'http://www.w3.org/TR/SVG11/feature#Extensibility').append('p').html('');
|
19183 | }
|
19184 |
|
19185 | function svgDrawLine(svg, points, colorIdx, interpolate) {
|
19186 | var curve = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.interpolateToCurve)(interpolate, d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis);
|
19187 | var color = config.branchColors[colorIdx % config.branchColors.length];
|
19188 | var lineGen = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) {
|
19189 | return Math.round(d.x);
|
19190 | }).y(function (d) {
|
19191 | return Math.round(d.y);
|
19192 | }).curve(curve);
|
19193 | svg.append('svg:path').attr('d', lineGen(points)).style('stroke', color).style('stroke-width', config.lineStrokeWidth).style('fill', 'none');
|
19194 | } // Pass in the element and its pre-transform coords
|
19195 |
|
19196 |
|
19197 | function getElementCoords(element, coords) {
|
19198 | coords = coords || element.node().getBBox();
|
19199 | var ctm = element.node().getCTM();
|
19200 | var xn = ctm.e + coords.x * ctm.a;
|
19201 | var yn = ctm.f + coords.y * ctm.d;
|
19202 | return {
|
19203 | left: xn,
|
19204 | top: yn,
|
19205 | width: coords.width,
|
19206 | height: coords.height
|
19207 | };
|
19208 | }
|
19209 |
|
19210 | function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
|
19211 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('svgDrawLineForCommits: ', fromId, toId);
|
19212 | var fromBbox = getElementCoords(svg.select('#node-' + fromId + ' circle'));
|
19213 | var toBbox = getElementCoords(svg.select('#node-' + toId + ' circle'));
|
19214 |
|
19215 | switch (direction) {
|
19216 | case 'LR':
|
19217 | // (toBbox)
|
19218 | // +--------
|
19219 | // + (fromBbox)
|
19220 | if (fromBbox.left - toBbox.left > config.nodeSpacing) {
|
19221 | var lineStart = {
|
19222 | x: fromBbox.left - config.nodeSpacing,
|
19223 | y: toBbox.top + toBbox.height / 2
|
19224 | };
|
19225 | var lineEnd = {
|
19226 | x: toBbox.left + toBbox.width,
|
19227 | y: toBbox.top + toBbox.height / 2
|
19228 | };
|
19229 | svgDrawLine(svg, [lineStart, lineEnd], color, 'linear');
|
19230 | svgDrawLine(svg, [{
|
19231 | x: fromBbox.left,
|
19232 | y: fromBbox.top + fromBbox.height / 2
|
19233 | }, {
|
19234 | x: fromBbox.left - config.nodeSpacing / 2,
|
19235 | y: fromBbox.top + fromBbox.height / 2
|
19236 | }, {
|
19237 | x: fromBbox.left - config.nodeSpacing / 2,
|
19238 | y: lineStart.y
|
19239 | }, lineStart], color);
|
19240 | } else {
|
19241 | svgDrawLine(svg, [{
|
19242 | x: fromBbox.left,
|
19243 | y: fromBbox.top + fromBbox.height / 2
|
19244 | }, {
|
19245 | x: fromBbox.left - config.nodeSpacing / 2,
|
19246 | y: fromBbox.top + fromBbox.height / 2
|
19247 | }, {
|
19248 | x: fromBbox.left - config.nodeSpacing / 2,
|
19249 | y: toBbox.top + toBbox.height / 2
|
19250 | }, {
|
19251 | x: toBbox.left + toBbox.width,
|
19252 | y: toBbox.top + toBbox.height / 2
|
19253 | }], color);
|
19254 | }
|
19255 |
|
19256 | break;
|
19257 |
|
19258 | case 'BT':
|
19259 | // + (fromBbox)
|
19260 | // |
|
19261 | // |
|
19262 | // + (toBbox)
|
19263 | if (toBbox.top - fromBbox.top > config.nodeSpacing) {
|
19264 | var _lineStart = {
|
19265 | x: toBbox.left + toBbox.width / 2,
|
19266 | y: fromBbox.top + fromBbox.height + config.nodeSpacing
|
19267 | };
|
19268 | var _lineEnd = {
|
19269 | x: toBbox.left + toBbox.width / 2,
|
19270 | y: toBbox.top
|
19271 | };
|
19272 | svgDrawLine(svg, [_lineStart, _lineEnd], color, 'linear');
|
19273 | svgDrawLine(svg, [{
|
19274 | x: fromBbox.left + fromBbox.width / 2,
|
19275 | y: fromBbox.top + fromBbox.height
|
19276 | }, {
|
19277 | x: fromBbox.left + fromBbox.width / 2,
|
19278 | y: fromBbox.top + fromBbox.height + config.nodeSpacing / 2
|
19279 | }, {
|
19280 | x: toBbox.left + toBbox.width / 2,
|
19281 | y: _lineStart.y - config.nodeSpacing / 2
|
19282 | }, _lineStart], color);
|
19283 | } else {
|
19284 | svgDrawLine(svg, [{
|
19285 | x: fromBbox.left + fromBbox.width / 2,
|
19286 | y: fromBbox.top + fromBbox.height
|
19287 | }, {
|
19288 | x: fromBbox.left + fromBbox.width / 2,
|
19289 | y: fromBbox.top + config.nodeSpacing / 2
|
19290 | }, {
|
19291 | x: toBbox.left + toBbox.width / 2,
|
19292 | y: toBbox.top - config.nodeSpacing / 2
|
19293 | }, {
|
19294 | x: toBbox.left + toBbox.width / 2,
|
19295 | y: toBbox.top
|
19296 | }], color);
|
19297 | }
|
19298 |
|
19299 | break;
|
19300 | }
|
19301 | }
|
19302 |
|
19303 | function cloneNode(svg, selector) {
|
19304 | return svg.select(selector).node().cloneNode(true);
|
19305 | }
|
19306 |
|
19307 | function renderCommitHistory(svg, commitid, branches, direction) {
|
19308 | var commit;
|
19309 | var numCommits = Object.keys(allCommitsDict).length;
|
19310 |
|
19311 | if (typeof commitid === 'string') {
|
19312 | do {
|
19313 | commit = allCommitsDict[commitid];
|
19314 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('in renderCommitHistory', commit.id, commit.seq);
|
19315 |
|
19316 | if (svg.select('#node-' + commitid).size() > 0) {
|
19317 | return;
|
19318 | }
|
19319 |
|
19320 | svg.append(function () {
|
19321 | return cloneNode(svg, '#def-commit');
|
19322 | }).attr('class', 'commit').attr('id', function () {
|
19323 | return 'node-' + commit.id;
|
19324 | }).attr('transform', function () {
|
19325 | switch (direction) {
|
19326 | case 'LR':
|
19327 | return 'translate(' + (commit.seq * config.nodeSpacing + config.leftMargin) + ', ' + branchNum * config.branchOffset + ')';
|
19328 |
|
19329 | case 'BT':
|
19330 | return 'translate(' + (branchNum * config.branchOffset + config.leftMargin) + ', ' + (numCommits - commit.seq) * config.nodeSpacing + ')';
|
19331 | }
|
19332 | }).attr('fill', config.nodeFillColor).attr('stroke', config.nodeStrokeColor).attr('stroke-width', config.nodeStrokeWidth);
|
19333 | var branch = void 0;
|
19334 |
|
19335 | for (var branchName in branches) {
|
19336 | if (branches[branchName].commit === commit) {
|
19337 | branch = branches[branchName];
|
19338 | break;
|
19339 | }
|
19340 | }
|
19341 |
|
19342 | if (branch) {
|
19343 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('found branch ', branch.name);
|
19344 | svg.select('#node-' + commit.id + ' p').append('xhtml:span').attr('class', 'branch-label').text(branch.name + ', ');
|
19345 | }
|
19346 |
|
19347 | svg.select('#node-' + commit.id + ' p').append('xhtml:span').attr('class', 'commit-id').text(commit.id);
|
19348 |
|
19349 | if (commit.message !== '' && direction === 'BT') {
|
19350 | svg.select('#node-' + commit.id + ' p').append('xhtml:span').attr('class', 'commit-msg').text(', ' + commit.message);
|
19351 | }
|
19352 |
|
19353 | commitid = commit.parent;
|
19354 | } while (commitid && allCommitsDict[commitid]);
|
19355 | }
|
19356 |
|
19357 | if (Array.isArray(commitid)) {
|
19358 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('found merge commmit', commitid);
|
19359 | renderCommitHistory(svg, commitid[0], branches, direction);
|
19360 | branchNum++;
|
19361 | renderCommitHistory(svg, commitid[1], branches, direction);
|
19362 | branchNum--;
|
19363 | }
|
19364 | }
|
19365 |
|
19366 | function renderLines(svg, commit, direction, branchColor) {
|
19367 | branchColor = branchColor || 0;
|
19368 |
|
19369 | while (commit.seq > 0 && !commit.lineDrawn) {
|
19370 | if (typeof commit.parent === 'string') {
|
19371 | svgDrawLineForCommits(svg, commit.id, commit.parent, direction, branchColor);
|
19372 | commit.lineDrawn = true;
|
19373 | commit = allCommitsDict[commit.parent];
|
19374 | } else if (Array.isArray(commit.parent)) {
|
19375 | svgDrawLineForCommits(svg, commit.id, commit.parent[0], direction, branchColor);
|
19376 | svgDrawLineForCommits(svg, commit.id, commit.parent[1], direction, branchColor + 1);
|
19377 | renderLines(svg, allCommitsDict[commit.parent[1]], direction, branchColor + 1);
|
19378 | commit.lineDrawn = true;
|
19379 | commit = allCommitsDict[commit.parent[0]];
|
19380 | }
|
19381 | }
|
19382 | }
|
19383 |
|
19384 | var draw = function draw(txt, id, ver) {
|
19385 | try {
|
19386 | var parser = (_parser_gitGraph__WEBPACK_IMPORTED_MODULE_3___default().parser);
|
19387 | parser.yy = _gitGraphAst__WEBPACK_IMPORTED_MODULE_4__["default"];
|
19388 | parser.yy.clear();
|
19389 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('in gitgraph renderer', txt + '\n', 'id:', id, ver); // Parse the graph definition
|
19390 |
|
19391 | parser.parse(txt + '\n');
|
19392 | config = Object.assign(config, apiConfig, _gitGraphAst__WEBPACK_IMPORTED_MODULE_4__["default"].getOptions());
|
19393 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('effective options', config);
|
19394 | var direction = _gitGraphAst__WEBPACK_IMPORTED_MODULE_4__["default"].getDirection();
|
19395 | allCommitsDict = _gitGraphAst__WEBPACK_IMPORTED_MODULE_4__["default"].getCommits();
|
19396 | var branches = _gitGraphAst__WEBPACK_IMPORTED_MODULE_4__["default"].getBranchesAsObjArray();
|
19397 |
|
19398 | if (direction === 'BT') {
|
19399 | config.nodeLabel.x = branches.length * config.branchOffset;
|
19400 | config.nodeLabel.width = '100%';
|
19401 | config.nodeLabel.y = -1 * 2 * config.nodeRadius;
|
19402 | }
|
19403 |
|
19404 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id=\"".concat(id, "\"]"));
|
19405 | svgCreateDefs(svg);
|
19406 | branchNum = 1;
|
19407 |
|
19408 | for (var branch in branches) {
|
19409 | var v = branches[branch];
|
19410 | renderCommitHistory(svg, v.commit.id, branches, direction);
|
19411 | renderLines(svg, v.commit, direction);
|
19412 | branchNum++;
|
19413 | }
|
19414 |
|
19415 | svg.attr('height', function () {
|
19416 | if (direction === 'BT') return Object.keys(allCommitsDict).length * config.nodeSpacing;
|
19417 | return (branches.length + 1) * config.branchOffset;
|
19418 | });
|
19419 | } catch (e) {
|
19420 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.error('Error while rendering gitgraph');
|
19421 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.error(e.message);
|
19422 | }
|
19423 | };
|
19424 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
19425 | setConf: setConf,
|
19426 | draw: draw
|
19427 | });
|
19428 |
|
19429 | /***/ }),
|
19430 |
|
19431 | /***/ "./src/diagrams/git/styles.js":
|
19432 | /*!************************************!*\
|
19433 | !*** ./src/diagrams/git/styles.js ***!
|
19434 | \************************************/
|
19435 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
19436 |
|
19437 | "use strict";
|
19438 | __webpack_require__.r(__webpack_exports__);
|
19439 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
19440 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
19441 | /* harmony export */ });
|
19442 | var getStyles = function getStyles() {
|
19443 | 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";
|
19444 | };
|
19445 |
|
19446 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
19447 |
|
19448 | /***/ }),
|
19449 |
|
19450 | /***/ "./src/diagrams/info/infoDb.js":
|
19451 | /*!*************************************!*\
|
19452 | !*** ./src/diagrams/info/infoDb.js ***!
|
19453 | \*************************************/
|
19454 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
19455 |
|
19456 | "use strict";
|
19457 | __webpack_require__.r(__webpack_exports__);
|
19458 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
19459 | /* harmony export */ "setMessage": () => (/* binding */ setMessage),
|
19460 | /* harmony export */ "getMessage": () => (/* binding */ getMessage),
|
19461 | /* harmony export */ "setInfo": () => (/* binding */ setInfo),
|
19462 | /* harmony export */ "getInfo": () => (/* binding */ getInfo),
|
19463 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
19464 | /* harmony export */ });
|
19465 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
19466 | /**
|
19467 | * Created by knut on 15-01-14.
|
19468 | */
|
19469 |
|
19470 | var message = '';
|
19471 | var info = false;
|
19472 | var setMessage = function setMessage(txt) {
|
19473 | _logger__WEBPACK_IMPORTED_MODULE_0__.log.debug('Setting message to: ' + txt);
|
19474 | message = txt;
|
19475 | };
|
19476 | var getMessage = function getMessage() {
|
19477 | return message;
|
19478 | };
|
19479 | var setInfo = function setInfo(inf) {
|
19480 | info = inf;
|
19481 | };
|
19482 | var getInfo = function getInfo() {
|
19483 | return info;
|
19484 | }; // export const parseError = (err, hash) => {
|
19485 | // global.mermaidAPI.parseError(err, hash)
|
19486 | // }
|
19487 |
|
19488 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
19489 | setMessage: setMessage,
|
19490 | getMessage: getMessage,
|
19491 | setInfo: setInfo,
|
19492 | getInfo: getInfo // parseError
|
19493 |
|
19494 | });
|
19495 |
|
19496 | /***/ }),
|
19497 |
|
19498 | /***/ "./src/diagrams/info/infoRenderer.js":
|
19499 | /*!*******************************************!*\
|
19500 | !*** ./src/diagrams/info/infoRenderer.js ***!
|
19501 | \*******************************************/
|
19502 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
19503 |
|
19504 | "use strict";
|
19505 | __webpack_require__.r(__webpack_exports__);
|
19506 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
19507 | /* harmony export */ "setConf": () => (/* binding */ setConf),
|
19508 | /* harmony export */ "draw": () => (/* binding */ draw),
|
19509 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
19510 | /* harmony export */ });
|
19511 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
19512 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
19513 | /* harmony import */ var _infoDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./infoDb */ "./src/diagrams/info/infoDb.js");
|
19514 | /* harmony import */ var _parser_info__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parser/info */ "./src/diagrams/info/parser/info.jison");
|
19515 | /* harmony import */ var _parser_info__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_parser_info__WEBPACK_IMPORTED_MODULE_1__);
|
19516 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
19517 | /**
|
19518 | * Created by knut on 14-12-11.
|
19519 | */
|
19520 |
|
19521 |
|
19522 |
|
19523 |
|
19524 | var conf = {};
|
19525 | var setConf = function setConf(cnf) {
|
19526 | var keys = Object.keys(cnf);
|
19527 | keys.forEach(function (key) {
|
19528 | conf[key] = cnf[key];
|
19529 | });
|
19530 | };
|
19531 | /**
|
19532 | * Draws a an info picture in the tag with id: id based on the graph definition in text.
|
19533 | * @param text
|
19534 | * @param id
|
19535 | */
|
19536 |
|
19537 | var draw = function draw(txt, id, ver) {
|
19538 | try {
|
19539 | var parser = (_parser_info__WEBPACK_IMPORTED_MODULE_1___default().parser);
|
19540 | parser.yy = _infoDb__WEBPACK_IMPORTED_MODULE_2__["default"];
|
19541 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('Renering info diagram\n' + txt); // Parse the graph definition
|
19542 |
|
19543 | parser.parse(txt);
|
19544 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('Parsed info diagram'); // Fetch the default direction, use TD if none was found
|
19545 |
|
19546 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + id);
|
19547 | var g = svg.append('g');
|
19548 | g.append('text') // text label for the x axis
|
19549 | .attr('x', 100).attr('y', 40).attr('class', 'version').attr('font-size', '32px').style('text-anchor', 'middle').text('v ' + ver);
|
19550 | svg.attr('height', 100);
|
19551 | svg.attr('width', 400); // svg.attr('viewBox', '0 0 300 150');
|
19552 | } catch (e) {
|
19553 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.error('Error while rendering info diagram');
|
19554 | _logger__WEBPACK_IMPORTED_MODULE_3__.log.error(e.message);
|
19555 | }
|
19556 | };
|
19557 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
19558 | setConf: setConf,
|
19559 | draw: draw
|
19560 | });
|
19561 |
|
19562 | /***/ }),
|
19563 |
|
19564 | /***/ "./src/diagrams/info/styles.js":
|
19565 | /*!*************************************!*\
|
19566 | !*** ./src/diagrams/info/styles.js ***!
|
19567 | \*************************************/
|
19568 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
19569 |
|
19570 | "use strict";
|
19571 | __webpack_require__.r(__webpack_exports__);
|
19572 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
19573 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
19574 | /* harmony export */ });
|
19575 | var getStyles = function getStyles() {
|
19576 | return "";
|
19577 | };
|
19578 |
|
19579 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
19580 |
|
19581 | /***/ }),
|
19582 |
|
19583 | /***/ "./src/diagrams/pie/pieDb.js":
|
19584 | /*!***********************************!*\
|
19585 | !*** ./src/diagrams/pie/pieDb.js ***!
|
19586 | \***********************************/
|
19587 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
19588 |
|
19589 | "use strict";
|
19590 | __webpack_require__.r(__webpack_exports__);
|
19591 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
19592 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
19593 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
19594 | /* harmony export */ });
|
19595 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
19596 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
19597 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
19598 | /**
|
19599 | *
|
19600 | */
|
19601 |
|
19602 |
|
19603 |
|
19604 | var sections = {};
|
19605 | var title = '';
|
19606 | var showData = false;
|
19607 | var parseDirective = function parseDirective(statement, context, type) {
|
19608 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
|
19609 | };
|
19610 |
|
19611 | var addSection = function addSection(id, value) {
|
19612 | if (typeof sections[id] === 'undefined') {
|
19613 | sections[id] = value;
|
19614 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Added new section :', id);
|
19615 | }
|
19616 | };
|
19617 |
|
19618 | var getSections = function getSections() {
|
19619 | return sections;
|
19620 | };
|
19621 |
|
19622 | var setTitle = function setTitle(txt) {
|
19623 | title = txt;
|
19624 | };
|
19625 |
|
19626 | var setShowData = function setShowData(toggle) {
|
19627 | showData = toggle;
|
19628 | };
|
19629 |
|
19630 | var getShowData = function getShowData() {
|
19631 | return showData;
|
19632 | };
|
19633 |
|
19634 | var getTitle = function getTitle() {
|
19635 | return title;
|
19636 | };
|
19637 |
|
19638 | var cleanupValue = function cleanupValue(value) {
|
19639 | if (value.substring(0, 1) === ':') {
|
19640 | value = value.substring(1).trim();
|
19641 | return Number(value.trim());
|
19642 | } else {
|
19643 | return Number(value.trim());
|
19644 | }
|
19645 | };
|
19646 |
|
19647 | var clear = function clear() {
|
19648 | sections = {};
|
19649 | title = '';
|
19650 | showData = false;
|
19651 | }; // export const parseError = (err, hash) => {
|
19652 | // global.mermaidAPI.parseError(err, hash)
|
19653 | // }
|
19654 |
|
19655 |
|
19656 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
19657 | parseDirective: parseDirective,
|
19658 | getConfig: function getConfig() {
|
19659 | return _config__WEBPACK_IMPORTED_MODULE_2__.getConfig().pie;
|
19660 | },
|
19661 | addSection: addSection,
|
19662 | getSections: getSections,
|
19663 | cleanupValue: cleanupValue,
|
19664 | clear: clear,
|
19665 | setTitle: setTitle,
|
19666 | getTitle: getTitle,
|
19667 | setShowData: setShowData,
|
19668 | getShowData: getShowData // parseError
|
19669 |
|
19670 | });
|
19671 |
|
19672 | /***/ }),
|
19673 |
|
19674 | /***/ "./src/diagrams/pie/pieRenderer.js":
|
19675 | /*!*****************************************!*\
|
19676 | !*** ./src/diagrams/pie/pieRenderer.js ***!
|
19677 | \*****************************************/
|
19678 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
19679 |
|
19680 | "use strict";
|
19681 | __webpack_require__.r(__webpack_exports__);
|
19682 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
19683 | /* harmony export */ "draw": () => (/* binding */ draw),
|
19684 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
19685 | /* harmony export */ });
|
19686 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
19687 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
19688 | /* harmony import */ var _pieDb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pieDb */ "./src/diagrams/pie/pieDb.js");
|
19689 | /* harmony import */ var _parser_pie__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./parser/pie */ "./src/diagrams/pie/parser/pie.jison");
|
19690 | /* harmony import */ var _parser_pie__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_parser_pie__WEBPACK_IMPORTED_MODULE_2__);
|
19691 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
19692 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
19693 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
19694 | /**
|
19695 | * Created by AshishJ on 11-09-2019.
|
19696 | */
|
19697 |
|
19698 |
|
19699 |
|
19700 |
|
19701 |
|
19702 |
|
19703 | var conf = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig();
|
19704 | /**
|
19705 | * Draws a Pie Chart with the data given in text.
|
19706 | * @param text
|
19707 | * @param id
|
19708 | */
|
19709 |
|
19710 | var width;
|
19711 | var height = 450;
|
19712 | var draw = function draw(txt, id) {
|
19713 | try {
|
19714 | conf = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig();
|
19715 | var parser = (_parser_pie__WEBPACK_IMPORTED_MODULE_2___default().parser);
|
19716 | parser.yy = _pieDb__WEBPACK_IMPORTED_MODULE_3__["default"];
|
19717 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Rendering info diagram\n' + txt); // Parse the Pie Chart definition
|
19718 |
|
19719 | parser.yy.clear();
|
19720 | parser.parse(txt);
|
19721 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Parsed info diagram');
|
19722 | var elem = document.getElementById(id);
|
19723 | width = elem.parentElement.offsetWidth;
|
19724 |
|
19725 | if (typeof width === 'undefined') {
|
19726 | width = 1200;
|
19727 | }
|
19728 |
|
19729 | if (typeof conf.useWidth !== 'undefined') {
|
19730 | width = conf.useWidth;
|
19731 | }
|
19732 |
|
19733 | if (typeof conf.pie.useWidth !== 'undefined') {
|
19734 | width = conf.pie.useWidth;
|
19735 | }
|
19736 |
|
19737 | var diagram = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + id);
|
19738 | (0,_utils__WEBPACK_IMPORTED_MODULE_5__.configureSvgSize)(diagram, height, width, conf.pie.useMaxWidth); // Set viewBox
|
19739 |
|
19740 | elem.setAttribute('viewBox', '0 0 ' + width + ' ' + height); // Fetch the default direction, use TD if none was found
|
19741 |
|
19742 | var margin = 40;
|
19743 | var legendRectSize = 18;
|
19744 | var legendSpacing = 4;
|
19745 | var radius = Math.min(width, height) / 2 - margin;
|
19746 | var svg = diagram.append('g').attr('transform', 'translate(' + width / 2 + ',' + height / 2 + ')');
|
19747 | var data = _pieDb__WEBPACK_IMPORTED_MODULE_3__["default"].getSections();
|
19748 | var sum = 0;
|
19749 | Object.keys(data).forEach(function (key) {
|
19750 | sum += data[key];
|
19751 | });
|
19752 | var themeVariables = conf.themeVariables;
|
19753 | 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
|
19754 |
|
19755 | var color = (0,d3__WEBPACK_IMPORTED_MODULE_0__.scaleOrdinal)().range(myGeneratedColors); // Compute the position of each group on the pie:
|
19756 |
|
19757 | var pie = (0,d3__WEBPACK_IMPORTED_MODULE_0__.pie)().value(function (d) {
|
19758 | return d[1];
|
19759 | });
|
19760 | var dataReady = pie(Object.entries(data)); // Shape helper to build arcs:
|
19761 |
|
19762 | 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.
|
19763 |
|
19764 | svg.selectAll('mySlices').data(dataReady).enter().append('path').attr('d', arcGenerator).attr('fill', function (d) {
|
19765 | return color(d.data[0]);
|
19766 | }).attr('class', 'pieCircle'); // Now add the percentage.
|
19767 | // Use the centroid method to get the best coordinates.
|
19768 |
|
19769 | svg.selectAll('mySlices').data(dataReady).enter().append('text').text(function (d) {
|
19770 | return (d.data[1] / sum * 100).toFixed(0) + '%';
|
19771 | }).attr('transform', function (d) {
|
19772 | return 'translate(' + arcGenerator.centroid(d) + ')';
|
19773 | }).style('text-anchor', 'middle').attr('class', 'slice');
|
19774 | svg.append('text').text(parser.yy.getTitle()).attr('x', 0).attr('y', -(height - 50) / 2).attr('class', 'pieTitleText'); // Add the legends/annotations for each section
|
19775 |
|
19776 | var legend = svg.selectAll('.legend').data(color.domain()).enter().append('g').attr('class', 'legend').attr('transform', function (d, i) {
|
19777 | var height = legendRectSize + legendSpacing;
|
19778 | var offset = height * color.domain().length / 2;
|
19779 | var horz = 12 * legendRectSize;
|
19780 | var vert = i * height - offset;
|
19781 | return 'translate(' + horz + ',' + vert + ')';
|
19782 | });
|
19783 | legend.append('rect').attr('width', legendRectSize).attr('height', legendRectSize).style('fill', color).style('stroke', color);
|
19784 | legend.data(dataReady).append('text').attr('x', legendRectSize + legendSpacing).attr('y', legendRectSize - legendSpacing).text(function (d) {
|
19785 | if (parser.yy.getShowData() || conf.showData || conf.pie.showData) {
|
19786 | return d.data[0] + ' [' + d.data[1] + ']';
|
19787 | } else {
|
19788 | return d.data[0];
|
19789 | }
|
19790 | });
|
19791 | } catch (e) {
|
19792 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.error('Error while rendering info diagram');
|
19793 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.error(e);
|
19794 | }
|
19795 | };
|
19796 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
19797 | draw: draw
|
19798 | });
|
19799 |
|
19800 | /***/ }),
|
19801 |
|
19802 | /***/ "./src/diagrams/pie/styles.js":
|
19803 | /*!************************************!*\
|
19804 | !*** ./src/diagrams/pie/styles.js ***!
|
19805 | \************************************/
|
19806 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
19807 |
|
19808 | "use strict";
|
19809 | __webpack_require__.r(__webpack_exports__);
|
19810 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
19811 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
19812 | /* harmony export */ });
|
19813 | var getStyles = function getStyles(options) {
|
19814 | 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");
|
19815 | };
|
19816 |
|
19817 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
19818 |
|
19819 | /***/ }),
|
19820 |
|
19821 | /***/ "./src/diagrams/requirement/requirementDb.js":
|
19822 | /*!***************************************************!*\
|
19823 | !*** ./src/diagrams/requirement/requirementDb.js ***!
|
19824 | \***************************************************/
|
19825 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
19826 |
|
19827 | "use strict";
|
19828 | __webpack_require__.r(__webpack_exports__);
|
19829 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
19830 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
19831 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
19832 | /* harmony export */ });
|
19833 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
19834 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
19835 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
19836 |
|
19837 |
|
19838 |
|
19839 | var relations = [];
|
19840 | var latestRequirement = {};
|
19841 | var requirements = {};
|
19842 | var latestElement = {};
|
19843 | var elements = {};
|
19844 | var RequirementType = {
|
19845 | REQUIREMENT: 'Requirement',
|
19846 | FUNCTIONAL_REQUIREMENT: 'Functional Requirement',
|
19847 | INTERFACE_REQUIREMENT: 'Interface Requirement',
|
19848 | PERFORMANCE_REQUIREMENT: 'Performance Requirement',
|
19849 | PHYSICAL_REQUIREMENT: 'Physical Requirement',
|
19850 | DESIGN_CONSTRAINT: 'Design Constraint'
|
19851 | };
|
19852 | var RiskLevel = {
|
19853 | LOW_RISK: 'Low',
|
19854 | MED_RISK: 'Medium',
|
19855 | HIGH_RISK: 'High'
|
19856 | };
|
19857 | var VerifyType = {
|
19858 | VERIFY_ANALYSIS: 'Analysis',
|
19859 | VERIFY_DEMONSTRATION: 'Demonstration',
|
19860 | VERIFY_INSPECTION: 'Inspection',
|
19861 | VERIFY_TEST: 'Test'
|
19862 | };
|
19863 | var Relationships = {
|
19864 | CONTAINS: 'contains',
|
19865 | COPIES: 'copies',
|
19866 | DERIVES: 'derives',
|
19867 | SATISFIES: 'satisfies',
|
19868 | VERIFIES: 'verifies',
|
19869 | REFINES: 'refines',
|
19870 | TRACES: 'traces'
|
19871 | };
|
19872 | var parseDirective = function parseDirective(statement, context, type) {
|
19873 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
|
19874 | };
|
19875 |
|
19876 | var addRequirement = function addRequirement(name, type) {
|
19877 | if (typeof requirements[name] === 'undefined') {
|
19878 | requirements[name] = {
|
19879 | name: name,
|
19880 | type: type,
|
19881 | id: latestRequirement.id,
|
19882 | text: latestRequirement.text,
|
19883 | risk: latestRequirement.risk,
|
19884 | verifyMethod: latestRequirement.verifyMethod
|
19885 | };
|
19886 | }
|
19887 |
|
19888 | latestRequirement = {};
|
19889 | return requirements[name];
|
19890 | };
|
19891 |
|
19892 | var getRequirements = function getRequirements() {
|
19893 | return requirements;
|
19894 | };
|
19895 |
|
19896 | var setNewReqId = function setNewReqId(id) {
|
19897 | if (typeof latestRequirement != 'undefined') {
|
19898 | latestRequirement.id = id;
|
19899 | }
|
19900 | };
|
19901 |
|
19902 | var setNewReqText = function setNewReqText(text) {
|
19903 | if (typeof latestRequirement != 'undefined') {
|
19904 | latestRequirement.text = text;
|
19905 | }
|
19906 | };
|
19907 |
|
19908 | var setNewReqRisk = function setNewReqRisk(risk) {
|
19909 | if (typeof latestRequirement != 'undefined') {
|
19910 | latestRequirement.risk = risk;
|
19911 | }
|
19912 | };
|
19913 |
|
19914 | var setNewReqVerifyMethod = function setNewReqVerifyMethod(verifyMethod) {
|
19915 | if (typeof latestRequirement != 'undefined') {
|
19916 | latestRequirement.verifyMethod = verifyMethod;
|
19917 | }
|
19918 | };
|
19919 |
|
19920 | var addElement = function addElement(name) {
|
19921 | if (typeof elements[name] === 'undefined') {
|
19922 | elements[name] = {
|
19923 | name: name,
|
19924 | type: latestElement.type,
|
19925 | docRef: latestElement.docRef
|
19926 | };
|
19927 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Added new requirement: ', name);
|
19928 | }
|
19929 |
|
19930 | latestElement = {};
|
19931 | return elements[name];
|
19932 | };
|
19933 |
|
19934 | var getElements = function getElements() {
|
19935 | return elements;
|
19936 | };
|
19937 |
|
19938 | var setNewElementType = function setNewElementType(type) {
|
19939 | if (typeof latestElement != 'undefined') {
|
19940 | latestElement.type = type;
|
19941 | }
|
19942 | };
|
19943 |
|
19944 | var setNewElementDocRef = function setNewElementDocRef(docRef) {
|
19945 | if (typeof latestElement != 'undefined') {
|
19946 | latestElement.docRef = docRef;
|
19947 | }
|
19948 | };
|
19949 |
|
19950 | var addRelationship = function addRelationship(type, src, dst) {
|
19951 | relations.push({
|
19952 | type: type,
|
19953 | src: src,
|
19954 | dst: dst
|
19955 | });
|
19956 | };
|
19957 |
|
19958 | var getRelationships = function getRelationships() {
|
19959 | return relations;
|
19960 | };
|
19961 |
|
19962 | var clear = function clear() {
|
19963 | relations = [];
|
19964 | latestRequirement = {};
|
19965 | requirements = {};
|
19966 | latestElement = {};
|
19967 | elements = {};
|
19968 | };
|
19969 |
|
19970 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
19971 | RequirementType: RequirementType,
|
19972 | RiskLevel: RiskLevel,
|
19973 | VerifyType: VerifyType,
|
19974 | Relationships: Relationships,
|
19975 | parseDirective: parseDirective,
|
19976 | getConfig: function getConfig() {
|
19977 | return _config__WEBPACK_IMPORTED_MODULE_2__.getConfig().req;
|
19978 | },
|
19979 | addRequirement: addRequirement,
|
19980 | getRequirements: getRequirements,
|
19981 | setNewReqId: setNewReqId,
|
19982 | setNewReqText: setNewReqText,
|
19983 | setNewReqRisk: setNewReqRisk,
|
19984 | setNewReqVerifyMethod: setNewReqVerifyMethod,
|
19985 | addElement: addElement,
|
19986 | getElements: getElements,
|
19987 | setNewElementType: setNewElementType,
|
19988 | setNewElementDocRef: setNewElementDocRef,
|
19989 | addRelationship: addRelationship,
|
19990 | getRelationships: getRelationships,
|
19991 | clear: clear
|
19992 | });
|
19993 |
|
19994 | /***/ }),
|
19995 |
|
19996 | /***/ "./src/diagrams/requirement/requirementMarkers.js":
|
19997 | /*!********************************************************!*\
|
19998 | !*** ./src/diagrams/requirement/requirementMarkers.js ***!
|
19999 | \********************************************************/
|
20000 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
20001 |
|
20002 | "use strict";
|
20003 | __webpack_require__.r(__webpack_exports__);
|
20004 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
20005 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
20006 | /* harmony export */ });
|
20007 | var ReqMarkers = {
|
20008 | CONTAINS: 'contains',
|
20009 | ARROW: 'arrow'
|
20010 | };
|
20011 |
|
20012 | var insertLineEndings = function insertLineEndings(parentNode, conf) {
|
20013 | 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');
|
20014 | 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)
|
20015 | // .attr('stroke-width', 1)
|
20016 | .attr('fill', 'none');
|
20017 | 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)
|
20018 | .attr('stroke-width', 1);
|
20019 | 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)
|
20020 | .attr('stroke-width', 1);
|
20021 | 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);
|
20022 | };
|
20023 |
|
20024 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
20025 | ReqMarkers: ReqMarkers,
|
20026 | insertLineEndings: insertLineEndings
|
20027 | });
|
20028 |
|
20029 | /***/ }),
|
20030 |
|
20031 | /***/ "./src/diagrams/requirement/requirementRenderer.js":
|
20032 | /*!*********************************************************!*\
|
20033 | !*** ./src/diagrams/requirement/requirementRenderer.js ***!
|
20034 | \*********************************************************/
|
20035 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
20036 |
|
20037 | "use strict";
|
20038 | __webpack_require__.r(__webpack_exports__);
|
20039 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
20040 | /* harmony export */ "setConf": () => (/* binding */ setConf),
|
20041 | /* harmony export */ "drawReqs": () => (/* binding */ drawReqs),
|
20042 | /* harmony export */ "drawElements": () => (/* binding */ drawElements),
|
20043 | /* harmony export */ "draw": () => (/* binding */ draw),
|
20044 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
20045 | /* harmony export */ });
|
20046 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
20047 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
20048 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
|
20049 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
|
20050 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
|
20051 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
|
20052 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
20053 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
20054 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
20055 | /* harmony import */ var _parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./parser/requirementDiagram */ "./src/diagrams/requirement/parser/requirementDiagram.jison");
|
20056 | /* harmony import */ var _parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_7__);
|
20057 | /* harmony import */ var _requirementDb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./requirementDb */ "./src/diagrams/requirement/requirementDb.js");
|
20058 | /* harmony import */ var _requirementMarkers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./requirementMarkers */ "./src/diagrams/requirement/requirementMarkers.js");
|
20059 |
|
20060 |
|
20061 | // import * as configApi from '../../config';
|
20062 |
|
20063 |
|
20064 |
|
20065 |
|
20066 |
|
20067 |
|
20068 |
|
20069 | var conf = {};
|
20070 | var relCnt = 0;
|
20071 | var setConf = function setConf(cnf) {
|
20072 | if (typeof cnf === 'undefined') {
|
20073 | return;
|
20074 | }
|
20075 |
|
20076 | var keys = Object.keys(cnf);
|
20077 |
|
20078 | for (var i = 0; i < keys.length; i++) {
|
20079 | conf[keys[i]] = cnf[keys[i]];
|
20080 | }
|
20081 | };
|
20082 |
|
20083 | var newRectNode = function newRectNode(parentNode, id) {
|
20084 | 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');
|
20085 | };
|
20086 |
|
20087 | var newTitleNode = function newTitleNode(parentNode, id, txts) {
|
20088 | var x = conf.rect_min_width / 2;
|
20089 | 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(
|
20090 | // 'style',
|
20091 | // 'font-family: ' + configApi.getConfig().fontFamily + '; font-size: ' + conf.fontSize + 'px'
|
20092 | // )
|
20093 |
|
20094 | var i = 0;
|
20095 | txts.forEach(function (textStr) {
|
20096 | if (i == 0) {
|
20097 | title.append('tspan').attr('text-anchor', 'middle').attr('x', conf.rect_min_width / 2).attr('dy', 0).text(textStr);
|
20098 | } else {
|
20099 | title.append('tspan').attr('text-anchor', 'middle').attr('x', conf.rect_min_width / 2).attr('dy', conf.line_height * 0.75).text(textStr);
|
20100 | }
|
20101 |
|
20102 | i++;
|
20103 | });
|
20104 | var yPadding = 1.5 * conf.rect_padding;
|
20105 | var linePadding = i * conf.line_height * 0.75;
|
20106 | var totalY = yPadding + linePadding;
|
20107 | parentNode.append('line').attr('class', 'req-title-line').attr('x1', '0').attr('x2', conf.rect_min_width).attr('y1', totalY).attr('y2', totalY);
|
20108 | return {
|
20109 | titleNode: title,
|
20110 | y: totalY
|
20111 | };
|
20112 | };
|
20113 |
|
20114 | var newBodyNode = function newBodyNode(parentNode, id, txts, yStart) {
|
20115 | 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(
|
20116 | // 'style',
|
20117 | // 'font-family: ' + configApi.getConfig().fontFamily + '; font-size: ' + conf.fontSize + 'px'
|
20118 | // );
|
20119 |
|
20120 | var currentRow = 0;
|
20121 | var charLimit = 30;
|
20122 | var wrappedTxts = [];
|
20123 | txts.forEach(function (textStr) {
|
20124 | var currentTextLen = textStr.length;
|
20125 |
|
20126 | while (currentTextLen > charLimit && currentRow < 3) {
|
20127 | var firstPart = textStr.substring(0, charLimit);
|
20128 | textStr = textStr.substring(charLimit, textStr.length);
|
20129 | currentTextLen = textStr.length;
|
20130 | wrappedTxts[wrappedTxts.length] = firstPart;
|
20131 | currentRow++;
|
20132 | }
|
20133 |
|
20134 | if (currentRow == 3) {
|
20135 | var lastStr = wrappedTxts[wrappedTxts.length - 1];
|
20136 | wrappedTxts[wrappedTxts.length - 1] = lastStr.substring(0, lastStr.length - 4) + '...';
|
20137 | } else {
|
20138 | wrappedTxts[wrappedTxts.length] = textStr;
|
20139 | }
|
20140 |
|
20141 | currentRow = 0;
|
20142 | });
|
20143 | wrappedTxts.forEach(function (textStr) {
|
20144 | body.append('tspan').attr('x', conf.rect_padding).attr('dy', conf.line_height).text(textStr);
|
20145 | });
|
20146 | return body;
|
20147 | };
|
20148 |
|
20149 | var addEdgeLabel = function addEdgeLabel(parentNode, svgPath, conf, txt) {
|
20150 | // Find the half-way point
|
20151 | var len = svgPath.node().getTotalLength();
|
20152 | var labelPoint = svgPath.node().getPointAtLength(len * 0.5); // Append a text node containing the label
|
20153 |
|
20154 | var labelId = 'rel' + relCnt;
|
20155 | relCnt++;
|
20156 | 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')
|
20157 | .text(txt); // Figure out how big the opaque 'container' rectangle needs to be
|
20158 |
|
20159 | var labelBBox = labelNode.node().getBBox(); // Insert the opaque rectangle before the text label
|
20160 |
|
20161 | 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%');
|
20162 | };
|
20163 |
|
20164 | var drawRelationshipFromLayout = function drawRelationshipFromLayout(svg, rel, g, insert) {
|
20165 | // Find the edge relating to this relationship
|
20166 | var edge = g.edge(elementString(rel.src), elementString(rel.dst)); // Get a function that will generate the line path
|
20167 |
|
20168 | var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) {
|
20169 | return d.x;
|
20170 | }).y(function (d) {
|
20171 | return d.y;
|
20172 | }); // Insert the line at the right place
|
20173 |
|
20174 | var svgPath = svg.insert('path', '#' + insert).attr('class', 'er relationshipLine').attr('d', lineFunction(edge.points)).attr('fill', 'none');
|
20175 |
|
20176 | if (rel.type == _requirementDb__WEBPACK_IMPORTED_MODULE_3__["default"].Relationships.CONTAINS) {
|
20177 | svgPath.attr('marker-start', 'url(' + _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].getUrl(conf.arrowMarkerAbsolute) + '#' + rel.type + '_line_ending' + ')');
|
20178 | } else {
|
20179 | svgPath.attr('stroke-dasharray', '10,7');
|
20180 | svgPath.attr('marker-end', 'url(' + _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].getUrl(conf.arrowMarkerAbsolute) + '#' + _requirementMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ReqMarkers.ARROW + '_line_ending' + ')');
|
20181 | }
|
20182 |
|
20183 | addEdgeLabel(svg, svgPath, conf, "<<".concat(rel.type, ">>"));
|
20184 | return;
|
20185 | };
|
20186 |
|
20187 | var drawReqs = function drawReqs(reqs, graph, svgNode) {
|
20188 | Object.keys(reqs).forEach(function (reqName) {
|
20189 | var req = reqs[reqName];
|
20190 | reqName = elementString(reqName);
|
20191 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('Added new requirement: ', reqName);
|
20192 | var groupNode = svgNode.append('g').attr('id', reqName);
|
20193 | var textId = 'req-' + reqName;
|
20194 | var rectNode = newRectNode(groupNode, textId);
|
20195 | var nodes = [];
|
20196 | var titleNodeInfo = newTitleNode(groupNode, reqName + '_title', ["<<".concat(req.type, ">>"), "".concat(req.name)]);
|
20197 | nodes.push(titleNodeInfo.titleNode);
|
20198 | var bodyNode = newBodyNode(groupNode, reqName + '_body', ["Id: ".concat(req.id), "Text: ".concat(req.text), "Risk: ".concat(req.risk), "Verification: ".concat(req.verifyMethod)], titleNodeInfo.y);
|
20199 | nodes.push(bodyNode);
|
20200 | var rectBBox = rectNode.node().getBBox(); // Add the entity to the graph
|
20201 |
|
20202 | graph.setNode(reqName, {
|
20203 | width: rectBBox.width,
|
20204 | height: rectBBox.height,
|
20205 | shape: 'rect',
|
20206 | id: reqName
|
20207 | });
|
20208 | });
|
20209 | };
|
20210 | var drawElements = function drawElements(els, graph, svgNode) {
|
20211 | Object.keys(els).forEach(function (elName) {
|
20212 | var el = els[elName];
|
20213 | var id = elementString(elName);
|
20214 | var groupNode = svgNode.append('g').attr('id', id);
|
20215 | var textId = 'element-' + id;
|
20216 | var rectNode = newRectNode(groupNode, textId);
|
20217 | var nodes = [];
|
20218 | var titleNodeInfo = newTitleNode(groupNode, textId + '_title', ["<<Element>>", "".concat(elName)]);
|
20219 | nodes.push(titleNodeInfo.titleNode);
|
20220 | var bodyNode = newBodyNode(groupNode, textId + '_body', ["Type: ".concat(el.type || 'Not Specified'), "Doc Ref: ".concat(el.docRef || 'None')], titleNodeInfo.y);
|
20221 | nodes.push(bodyNode);
|
20222 | var rectBBox = rectNode.node().getBBox(); // Add the entity to the graph
|
20223 |
|
20224 | graph.setNode(id, {
|
20225 | width: rectBBox.width,
|
20226 | height: rectBBox.height,
|
20227 | shape: 'rect',
|
20228 | id: id
|
20229 | });
|
20230 | });
|
20231 | };
|
20232 |
|
20233 | var addRelationships = function addRelationships(relationships, g) {
|
20234 | relationships.forEach(function (r) {
|
20235 | var src = elementString(r.src);
|
20236 | var dst = elementString(r.dst);
|
20237 | g.setEdge(src, dst, {
|
20238 | relationship: r
|
20239 | });
|
20240 | });
|
20241 | return relationships;
|
20242 | };
|
20243 |
|
20244 | var adjustEntities = function adjustEntities(svgNode, graph) {
|
20245 | graph.nodes().forEach(function (v) {
|
20246 | if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
|
20247 | svgNode.select('#' + v);
|
20248 | svgNode.select('#' + v).attr('transform', 'translate(' + (graph.node(v).x - graph.node(v).width / 2) + ',' + (graph.node(v).y - graph.node(v).height / 2) + ' )');
|
20249 | }
|
20250 | });
|
20251 | return;
|
20252 | };
|
20253 |
|
20254 | var elementString = function elementString(str) {
|
20255 | return str.replace(/\s/g, '').replace(/\./g, '_');
|
20256 | };
|
20257 |
|
20258 | var draw = function draw(text, id) {
|
20259 | _parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_7__.parser.yy = _requirementDb__WEBPACK_IMPORTED_MODULE_3__["default"];
|
20260 | _parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_7__.parser.yy.clear();
|
20261 | _parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_7__.parser.parse(text);
|
20262 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id='".concat(id, "']"));
|
20263 | _requirementMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].insertLineEndings(svg, conf);
|
20264 | var g = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
|
20265 | multigraph: false,
|
20266 | compound: false,
|
20267 | directed: true
|
20268 | }).setGraph({
|
20269 | rankdir: conf.layoutDirection,
|
20270 | marginx: 20,
|
20271 | marginy: 20,
|
20272 | nodesep: 100,
|
20273 | edgesep: 100,
|
20274 | ranksep: 100
|
20275 | }).setDefaultEdgeLabel(function () {
|
20276 | return {};
|
20277 | });
|
20278 | var requirements = _requirementDb__WEBPACK_IMPORTED_MODULE_3__["default"].getRequirements();
|
20279 | var elements = _requirementDb__WEBPACK_IMPORTED_MODULE_3__["default"].getElements();
|
20280 | var relationships = _requirementDb__WEBPACK_IMPORTED_MODULE_3__["default"].getRelationships();
|
20281 | drawReqs(requirements, g, svg);
|
20282 | drawElements(elements, g, svg);
|
20283 | addRelationships(relationships, g);
|
20284 | dagre__WEBPACK_IMPORTED_MODULE_1___default().layout(g);
|
20285 | adjustEntities(svg, g);
|
20286 | relationships.forEach(function (rel) {
|
20287 | drawRelationshipFromLayout(svg, rel, g, id);
|
20288 | }); // svg.attr('height', '500px');
|
20289 |
|
20290 | var padding = conf.rect_padding;
|
20291 | var svgBounds = svg.node().getBBox();
|
20292 | var width = svgBounds.width + padding * 2;
|
20293 | var height = svgBounds.height + padding * 2;
|
20294 | (0,_utils__WEBPACK_IMPORTED_MODULE_8__.configureSvgSize)(svg, height, width, conf.useMaxWidth);
|
20295 | svg.attr('viewBox', "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height));
|
20296 | };
|
20297 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
20298 | setConf: setConf,
|
20299 | draw: draw
|
20300 | });
|
20301 |
|
20302 | /***/ }),
|
20303 |
|
20304 | /***/ "./src/diagrams/requirement/styles.js":
|
20305 | /*!********************************************!*\
|
20306 | !*** ./src/diagrams/requirement/styles.js ***!
|
20307 | \********************************************/
|
20308 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
20309 |
|
20310 | "use strict";
|
20311 | __webpack_require__.r(__webpack_exports__);
|
20312 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
20313 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
20314 | /* harmony export */ });
|
20315 | var getStyles = function getStyles(options) {
|
20316 | 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");
|
20317 | }; // fill', conf.rect_fill)
|
20318 |
|
20319 |
|
20320 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
20321 |
|
20322 | /***/ }),
|
20323 |
|
20324 | /***/ "./src/diagrams/sequence/sequenceDb.js":
|
20325 | /*!*********************************************!*\
|
20326 | !*** ./src/diagrams/sequence/sequenceDb.js ***!
|
20327 | \*********************************************/
|
20328 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
20329 |
|
20330 | "use strict";
|
20331 | __webpack_require__.r(__webpack_exports__);
|
20332 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
20333 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
20334 | /* harmony export */ "addActor": () => (/* binding */ addActor),
|
20335 | /* harmony export */ "addMessage": () => (/* binding */ addMessage),
|
20336 | /* harmony export */ "addSignal": () => (/* binding */ addSignal),
|
20337 | /* harmony export */ "getMessages": () => (/* binding */ getMessages),
|
20338 | /* harmony export */ "getActors": () => (/* binding */ getActors),
|
20339 | /* harmony export */ "getActor": () => (/* binding */ getActor),
|
20340 | /* harmony export */ "getActorKeys": () => (/* binding */ getActorKeys),
|
20341 | /* harmony export */ "getTitle": () => (/* binding */ getTitle),
|
20342 | /* harmony export */ "getTitleWrapped": () => (/* binding */ getTitleWrapped),
|
20343 | /* harmony export */ "enableSequenceNumbers": () => (/* binding */ enableSequenceNumbers),
|
20344 | /* harmony export */ "showSequenceNumbers": () => (/* binding */ showSequenceNumbers),
|
20345 | /* harmony export */ "setWrap": () => (/* binding */ setWrap),
|
20346 | /* harmony export */ "autoWrap": () => (/* binding */ autoWrap),
|
20347 | /* harmony export */ "clear": () => (/* binding */ clear),
|
20348 | /* harmony export */ "parseMessage": () => (/* binding */ parseMessage),
|
20349 | /* harmony export */ "LINETYPE": () => (/* binding */ LINETYPE),
|
20350 | /* harmony export */ "ARROWTYPE": () => (/* binding */ ARROWTYPE),
|
20351 | /* harmony export */ "PLACEMENT": () => (/* binding */ PLACEMENT),
|
20352 | /* harmony export */ "addNote": () => (/* binding */ addNote),
|
20353 | /* harmony export */ "addLinks": () => (/* binding */ addLinks),
|
20354 | /* harmony export */ "addALink": () => (/* binding */ addALink),
|
20355 | /* harmony export */ "addProperties": () => (/* binding */ addProperties),
|
20356 | /* harmony export */ "addDetails": () => (/* binding */ addDetails),
|
20357 | /* harmony export */ "getActorProperty": () => (/* binding */ getActorProperty),
|
20358 | /* harmony export */ "setTitle": () => (/* binding */ setTitle),
|
20359 | /* harmony export */ "apply": () => (/* binding */ apply),
|
20360 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
20361 | /* harmony export */ });
|
20362 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
20363 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
20364 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
20365 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
20366 |
|
20367 |
|
20368 |
|
20369 |
|
20370 | var prevActor = undefined;
|
20371 | var actors = {};
|
20372 | var messages = [];
|
20373 | var notes = [];
|
20374 | var title = '';
|
20375 | var titleWrapped = false;
|
20376 | var sequenceNumbersEnabled = false;
|
20377 | var wrapEnabled = false;
|
20378 | var parseDirective = function parseDirective(statement, context, type) {
|
20379 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
|
20380 | };
|
20381 | var addActor = function addActor(id, name, description, type) {
|
20382 | // Don't allow description nulling
|
20383 | var old = actors[id];
|
20384 | if (old && name === old.name && description == null) return; // Don't allow null descriptions, either
|
20385 |
|
20386 | if (description == null || description.text == null) {
|
20387 | description = {
|
20388 | text: name,
|
20389 | wrap: null,
|
20390 | type: type
|
20391 | };
|
20392 | }
|
20393 |
|
20394 | if (type == null || description.text == null) {
|
20395 | description = {
|
20396 | text: name,
|
20397 | wrap: null,
|
20398 | type: type
|
20399 | };
|
20400 | }
|
20401 |
|
20402 | actors[id] = {
|
20403 | name: name,
|
20404 | description: description.text,
|
20405 | wrap: description.wrap === undefined && autoWrap() || !!description.wrap,
|
20406 | prevActor: prevActor,
|
20407 | links: {},
|
20408 | properties: {},
|
20409 | actorCnt: null,
|
20410 | rectData: null,
|
20411 | type: type || 'participant'
|
20412 | };
|
20413 |
|
20414 | if (prevActor && actors[prevActor]) {
|
20415 | actors[prevActor].nextActor = id;
|
20416 | }
|
20417 |
|
20418 | prevActor = id;
|
20419 | };
|
20420 |
|
20421 | var activationCount = function activationCount(part) {
|
20422 | var i;
|
20423 | var count = 0;
|
20424 |
|
20425 | for (i = 0; i < messages.length; i++) {
|
20426 | if (messages[i].type === LINETYPE.ACTIVE_START) {
|
20427 | if (messages[i].from.actor === part) {
|
20428 | count++;
|
20429 | }
|
20430 | }
|
20431 |
|
20432 | if (messages[i].type === LINETYPE.ACTIVE_END) {
|
20433 | if (messages[i].from.actor === part) {
|
20434 | count--;
|
20435 | }
|
20436 | }
|
20437 | }
|
20438 |
|
20439 | return count;
|
20440 | };
|
20441 |
|
20442 | var addMessage = function addMessage(idFrom, idTo, message, answer) {
|
20443 | messages.push({
|
20444 | from: idFrom,
|
20445 | to: idTo,
|
20446 | message: message.text,
|
20447 | wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
|
20448 | answer: answer
|
20449 | });
|
20450 | };
|
20451 | var addSignal = function addSignal(idFrom, idTo) {
|
20452 | var message = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
20453 | text: undefined,
|
20454 | wrap: undefined
|
20455 | };
|
20456 | var messageType = arguments.length > 3 ? arguments[3] : undefined;
|
20457 |
|
20458 | if (messageType === LINETYPE.ACTIVE_END) {
|
20459 | var cnt = activationCount(idFrom.actor);
|
20460 |
|
20461 | if (cnt < 1) {
|
20462 | // Bail out as there is an activation signal from an inactive participant
|
20463 | var error = new Error('Trying to inactivate an inactive participant (' + idFrom.actor + ')');
|
20464 | error.hash = {
|
20465 | text: '->>-',
|
20466 | token: '->>-',
|
20467 | line: '1',
|
20468 | loc: {
|
20469 | first_line: 1,
|
20470 | last_line: 1,
|
20471 | first_column: 1,
|
20472 | last_column: 1
|
20473 | },
|
20474 | expected: ["'ACTIVE_PARTICIPANT'"]
|
20475 | };
|
20476 | throw error;
|
20477 | }
|
20478 | }
|
20479 |
|
20480 | messages.push({
|
20481 | from: idFrom,
|
20482 | to: idTo,
|
20483 | message: message.text,
|
20484 | wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
|
20485 | type: messageType
|
20486 | });
|
20487 | return true;
|
20488 | };
|
20489 | var getMessages = function getMessages() {
|
20490 | return messages;
|
20491 | };
|
20492 | var getActors = function getActors() {
|
20493 | return actors;
|
20494 | };
|
20495 | var getActor = function getActor(id) {
|
20496 | return actors[id];
|
20497 | };
|
20498 | var getActorKeys = function getActorKeys() {
|
20499 | return Object.keys(actors);
|
20500 | };
|
20501 | var getTitle = function getTitle() {
|
20502 | return title;
|
20503 | };
|
20504 | var getTitleWrapped = function getTitleWrapped() {
|
20505 | return titleWrapped;
|
20506 | };
|
20507 | var enableSequenceNumbers = function enableSequenceNumbers() {
|
20508 | sequenceNumbersEnabled = true;
|
20509 | };
|
20510 | var showSequenceNumbers = function showSequenceNumbers() {
|
20511 | return sequenceNumbersEnabled;
|
20512 | };
|
20513 | var setWrap = function setWrap(wrapSetting) {
|
20514 | wrapEnabled = wrapSetting;
|
20515 | };
|
20516 | var autoWrap = function autoWrap() {
|
20517 | return wrapEnabled;
|
20518 | };
|
20519 | var clear = function clear() {
|
20520 | actors = {};
|
20521 | messages = [];
|
20522 | };
|
20523 | var parseMessage = function parseMessage(str) {
|
20524 | var _str = str.trim();
|
20525 |
|
20526 | var message = {
|
20527 | text: _str.replace(/^[:]?(?:no)?wrap:/, '').trim(),
|
20528 | wrap: _str.match(/^[:]?wrap:/) !== null ? true : _str.match(/^[:]?nowrap:/) !== null ? false : undefined
|
20529 | };
|
20530 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('parseMessage:', message);
|
20531 | return message;
|
20532 | };
|
20533 | var LINETYPE = {
|
20534 | SOLID: 0,
|
20535 | DOTTED: 1,
|
20536 | NOTE: 2,
|
20537 | SOLID_CROSS: 3,
|
20538 | DOTTED_CROSS: 4,
|
20539 | SOLID_OPEN: 5,
|
20540 | DOTTED_OPEN: 6,
|
20541 | LOOP_START: 10,
|
20542 | LOOP_END: 11,
|
20543 | ALT_START: 12,
|
20544 | ALT_ELSE: 13,
|
20545 | ALT_END: 14,
|
20546 | OPT_START: 15,
|
20547 | OPT_END: 16,
|
20548 | ACTIVE_START: 17,
|
20549 | ACTIVE_END: 18,
|
20550 | PAR_START: 19,
|
20551 | PAR_AND: 20,
|
20552 | PAR_END: 21,
|
20553 | RECT_START: 22,
|
20554 | RECT_END: 23,
|
20555 | SOLID_POINT: 24,
|
20556 | DOTTED_POINT: 25
|
20557 | };
|
20558 | var ARROWTYPE = {
|
20559 | FILLED: 0,
|
20560 | OPEN: 1
|
20561 | };
|
20562 | var PLACEMENT = {
|
20563 | LEFTOF: 0,
|
20564 | RIGHTOF: 1,
|
20565 | OVER: 2
|
20566 | };
|
20567 | var addNote = function addNote(actor, placement, message) {
|
20568 | var note = {
|
20569 | actor: actor,
|
20570 | placement: placement,
|
20571 | message: message.text,
|
20572 | wrap: message.wrap === undefined && autoWrap() || !!message.wrap
|
20573 | }; // Coerce actor into a [to, from, ...] array
|
20574 |
|
20575 | var actors = [].concat(actor, actor);
|
20576 | notes.push(note);
|
20577 | messages.push({
|
20578 | from: actors[0],
|
20579 | to: actors[1],
|
20580 | message: message.text,
|
20581 | wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
|
20582 | type: LINETYPE.NOTE,
|
20583 | placement: placement
|
20584 | });
|
20585 | };
|
20586 | var addLinks = function addLinks(actorId, text) {
|
20587 | // find the actor
|
20588 | var actor = getActor(actorId); // JSON.parse the text
|
20589 |
|
20590 | try {
|
20591 | var sanitizedText = (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.sanitizeText)(text.text, _config__WEBPACK_IMPORTED_MODULE_3__.getConfig());
|
20592 | sanitizedText = sanitizedText.replace(/&/g, '&');
|
20593 | sanitizedText = sanitizedText.replace(/=/g, '=');
|
20594 | var links = JSON.parse(sanitizedText); // add the deserialized text to the actor's links field.
|
20595 |
|
20596 | insertLinks(actor, links);
|
20597 | } catch (e) {
|
20598 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('error while parsing actor link text', e);
|
20599 | }
|
20600 | };
|
20601 | var addALink = function addALink(actorId, text) {
|
20602 | // find the actor
|
20603 | var actor = getActor(actorId);
|
20604 |
|
20605 | try {
|
20606 | var links = {};
|
20607 | var sanitizedText = (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.sanitizeText)(text.text, _config__WEBPACK_IMPORTED_MODULE_3__.getConfig());
|
20608 | var sep = sanitizedText.indexOf('@');
|
20609 | sanitizedText = sanitizedText.replace(/&/g, '&');
|
20610 | sanitizedText = sanitizedText.replace(/=/g, '=');
|
20611 | var label = sanitizedText.slice(0, sep - 1).trim();
|
20612 | var link = sanitizedText.slice(sep + 1).trim();
|
20613 | links[label] = link; // add the deserialized text to the actor's links field.
|
20614 |
|
20615 | insertLinks(actor, links);
|
20616 | } catch (e) {
|
20617 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('error while parsing actor link text', e);
|
20618 | }
|
20619 | };
|
20620 |
|
20621 | function insertLinks(actor, links) {
|
20622 | if (actor.links == null) {
|
20623 | actor.links = links;
|
20624 | } else {
|
20625 | for (var key in links) {
|
20626 | actor.links[key] = links[key];
|
20627 | }
|
20628 | }
|
20629 | }
|
20630 |
|
20631 | var addProperties = function addProperties(actorId, text) {
|
20632 | // find the actor
|
20633 | var actor = getActor(actorId); // JSON.parse the text
|
20634 |
|
20635 | try {
|
20636 | var sanitizedText = (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.sanitizeText)(text.text, _config__WEBPACK_IMPORTED_MODULE_3__.getConfig());
|
20637 | var properties = JSON.parse(sanitizedText); // add the deserialized text to the actor's property field.
|
20638 |
|
20639 | insertProperties(actor, properties);
|
20640 | } catch (e) {
|
20641 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('error while parsing actor properties text', e);
|
20642 | }
|
20643 | };
|
20644 |
|
20645 | function insertProperties(actor, properties) {
|
20646 | if (actor.properties == null) {
|
20647 | actor.properties = properties;
|
20648 | } else {
|
20649 | for (var key in properties) {
|
20650 | actor.properties[key] = properties[key];
|
20651 | }
|
20652 | }
|
20653 | }
|
20654 |
|
20655 | var addDetails = function addDetails(actorId, text) {
|
20656 | // find the actor
|
20657 | var actor = getActor(actorId);
|
20658 | var elem = document.getElementById(text.text); // JSON.parse the text
|
20659 |
|
20660 | try {
|
20661 | var _text = elem.innerHTML;
|
20662 | var details = JSON.parse(_text); // add the deserialized text to the actor's property field.
|
20663 |
|
20664 | if (details['properties']) {
|
20665 | insertProperties(actor, details['properties']);
|
20666 | }
|
20667 |
|
20668 | if (details['links']) {
|
20669 | insertLinks(actor, details['links']);
|
20670 | }
|
20671 | } catch (e) {
|
20672 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('error while parsing actor details text', e);
|
20673 | }
|
20674 | };
|
20675 | var getActorProperty = function getActorProperty(actor, key) {
|
20676 | if (typeof actor !== 'undefined' && typeof actor.properties !== 'undefined') {
|
20677 | return actor.properties[key];
|
20678 | }
|
20679 |
|
20680 | return undefined;
|
20681 | };
|
20682 | var setTitle = function setTitle(titleWrap) {
|
20683 | title = titleWrap.text;
|
20684 | titleWrapped = titleWrap.wrap === undefined && autoWrap() || !!titleWrap.wrap;
|
20685 | };
|
20686 | var apply = function apply(param) {
|
20687 | if (param instanceof Array) {
|
20688 | param.forEach(function (item) {
|
20689 | apply(item);
|
20690 | });
|
20691 | } else {
|
20692 | switch (param.type) {
|
20693 | case 'addParticipant':
|
20694 | addActor(param.actor, param.actor, param.description, 'participant');
|
20695 | break;
|
20696 |
|
20697 | case 'addActor':
|
20698 | addActor(param.actor, param.actor, param.description, 'actor');
|
20699 | break;
|
20700 |
|
20701 | case 'activeStart':
|
20702 | addSignal(param.actor, undefined, undefined, param.signalType);
|
20703 | break;
|
20704 |
|
20705 | case 'activeEnd':
|
20706 | addSignal(param.actor, undefined, undefined, param.signalType);
|
20707 | break;
|
20708 |
|
20709 | case 'addNote':
|
20710 | addNote(param.actor, param.placement, param.text);
|
20711 | break;
|
20712 |
|
20713 | case 'addLinks':
|
20714 | addLinks(param.actor, param.text);
|
20715 | break;
|
20716 |
|
20717 | case 'addALink':
|
20718 | addALink(param.actor, param.text);
|
20719 | break;
|
20720 |
|
20721 | case 'addProperties':
|
20722 | addProperties(param.actor, param.text);
|
20723 | break;
|
20724 |
|
20725 | case 'addDetails':
|
20726 | addDetails(param.actor, param.text);
|
20727 | break;
|
20728 |
|
20729 | case 'addMessage':
|
20730 | addSignal(param.from, param.to, param.msg, param.signalType);
|
20731 | break;
|
20732 |
|
20733 | case 'loopStart':
|
20734 | addSignal(undefined, undefined, param.loopText, param.signalType);
|
20735 | break;
|
20736 |
|
20737 | case 'loopEnd':
|
20738 | addSignal(undefined, undefined, undefined, param.signalType);
|
20739 | break;
|
20740 |
|
20741 | case 'rectStart':
|
20742 | addSignal(undefined, undefined, param.color, param.signalType);
|
20743 | break;
|
20744 |
|
20745 | case 'rectEnd':
|
20746 | addSignal(undefined, undefined, undefined, param.signalType);
|
20747 | break;
|
20748 |
|
20749 | case 'optStart':
|
20750 | addSignal(undefined, undefined, param.optText, param.signalType);
|
20751 | break;
|
20752 |
|
20753 | case 'optEnd':
|
20754 | addSignal(undefined, undefined, undefined, param.signalType);
|
20755 | break;
|
20756 |
|
20757 | case 'altStart':
|
20758 | addSignal(undefined, undefined, param.altText, param.signalType);
|
20759 | break;
|
20760 |
|
20761 | case 'else':
|
20762 | addSignal(undefined, undefined, param.altText, param.signalType);
|
20763 | break;
|
20764 |
|
20765 | case 'altEnd':
|
20766 | addSignal(undefined, undefined, undefined, param.signalType);
|
20767 | break;
|
20768 |
|
20769 | case 'setTitle':
|
20770 | setTitle(param.text);
|
20771 | break;
|
20772 |
|
20773 | case 'parStart':
|
20774 | addSignal(undefined, undefined, param.parText, param.signalType);
|
20775 | break;
|
20776 |
|
20777 | case 'and':
|
20778 | addSignal(undefined, undefined, param.parText, param.signalType);
|
20779 | break;
|
20780 |
|
20781 | case 'parEnd':
|
20782 | addSignal(undefined, undefined, undefined, param.signalType);
|
20783 | break;
|
20784 | }
|
20785 | }
|
20786 | };
|
20787 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
20788 | addActor: addActor,
|
20789 | addMessage: addMessage,
|
20790 | addSignal: addSignal,
|
20791 | addLinks: addLinks,
|
20792 | addDetails: addDetails,
|
20793 | addProperties: addProperties,
|
20794 | autoWrap: autoWrap,
|
20795 | setWrap: setWrap,
|
20796 | enableSequenceNumbers: enableSequenceNumbers,
|
20797 | showSequenceNumbers: showSequenceNumbers,
|
20798 | getMessages: getMessages,
|
20799 | getActors: getActors,
|
20800 | getActor: getActor,
|
20801 | getActorKeys: getActorKeys,
|
20802 | getActorProperty: getActorProperty,
|
20803 | getTitle: getTitle,
|
20804 | parseDirective: parseDirective,
|
20805 | getConfig: function getConfig() {
|
20806 | return _config__WEBPACK_IMPORTED_MODULE_3__.getConfig().sequence;
|
20807 | },
|
20808 | getTitleWrapped: getTitleWrapped,
|
20809 | clear: clear,
|
20810 | parseMessage: parseMessage,
|
20811 | LINETYPE: LINETYPE,
|
20812 | ARROWTYPE: ARROWTYPE,
|
20813 | PLACEMENT: PLACEMENT,
|
20814 | addNote: addNote,
|
20815 | setTitle: setTitle,
|
20816 | apply: apply
|
20817 | });
|
20818 |
|
20819 | /***/ }),
|
20820 |
|
20821 | /***/ "./src/diagrams/sequence/sequenceRenderer.js":
|
20822 | /*!***************************************************!*\
|
20823 | !*** ./src/diagrams/sequence/sequenceRenderer.js ***!
|
20824 | \***************************************************/
|
20825 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
20826 |
|
20827 | "use strict";
|
20828 | __webpack_require__.r(__webpack_exports__);
|
20829 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
20830 | /* harmony export */ "bounds": () => (/* binding */ bounds),
|
20831 | /* harmony export */ "drawActors": () => (/* binding */ drawActors),
|
20832 | /* harmony export */ "drawActorsPopup": () => (/* binding */ drawActorsPopup),
|
20833 | /* harmony export */ "setConf": () => (/* binding */ setConf),
|
20834 | /* harmony export */ "draw": () => (/* binding */ draw),
|
20835 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
20836 | /* harmony export */ });
|
20837 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
20838 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
20839 | /* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/sequence/svgDraw.js");
|
20840 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
20841 | /* harmony import */ var _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parser/sequenceDiagram */ "./src/diagrams/sequence/parser/sequenceDiagram.jison");
|
20842 | /* harmony import */ var _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__);
|
20843 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
20844 | /* harmony import */ var _sequenceDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./sequenceDb */ "./src/diagrams/sequence/sequenceDb.js");
|
20845 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
20846 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
20847 |
|
20848 |
|
20849 |
|
20850 |
|
20851 |
|
20852 |
|
20853 |
|
20854 |
|
20855 | _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy = _sequenceDb__WEBPACK_IMPORTED_MODULE_2__["default"];
|
20856 | var conf = {};
|
20857 | var bounds = {
|
20858 | data: {
|
20859 | startx: undefined,
|
20860 | stopx: undefined,
|
20861 | starty: undefined,
|
20862 | stopy: undefined
|
20863 | },
|
20864 | verticalPos: 0,
|
20865 | sequenceItems: [],
|
20866 | activations: [],
|
20867 | models: {
|
20868 | getHeight: function getHeight() {
|
20869 | return Math.max.apply(null, this.actors.length === 0 ? [0] : this.actors.map(function (actor) {
|
20870 | return actor.height || 0;
|
20871 | })) + (this.loops.length === 0 ? 0 : this.loops.map(function (it) {
|
20872 | return it.height || 0;
|
20873 | }).reduce(function (acc, h) {
|
20874 | return acc + h;
|
20875 | })) + (this.messages.length === 0 ? 0 : this.messages.map(function (it) {
|
20876 | return it.height || 0;
|
20877 | }).reduce(function (acc, h) {
|
20878 | return acc + h;
|
20879 | })) + (this.notes.length === 0 ? 0 : this.notes.map(function (it) {
|
20880 | return it.height || 0;
|
20881 | }).reduce(function (acc, h) {
|
20882 | return acc + h;
|
20883 | }));
|
20884 | },
|
20885 | clear: function clear() {
|
20886 | this.actors = [];
|
20887 | this.loops = [];
|
20888 | this.messages = [];
|
20889 | this.notes = [];
|
20890 | },
|
20891 | addActor: function addActor(actorModel) {
|
20892 | this.actors.push(actorModel);
|
20893 | },
|
20894 | addLoop: function addLoop(loopModel) {
|
20895 | this.loops.push(loopModel);
|
20896 | },
|
20897 | addMessage: function addMessage(msgModel) {
|
20898 | this.messages.push(msgModel);
|
20899 | },
|
20900 | addNote: function addNote(noteModel) {
|
20901 | this.notes.push(noteModel);
|
20902 | },
|
20903 | lastActor: function lastActor() {
|
20904 | return this.actors[this.actors.length - 1];
|
20905 | },
|
20906 | lastLoop: function lastLoop() {
|
20907 | return this.loops[this.loops.length - 1];
|
20908 | },
|
20909 | lastMessage: function lastMessage() {
|
20910 | return this.messages[this.messages.length - 1];
|
20911 | },
|
20912 | lastNote: function lastNote() {
|
20913 | return this.notes[this.notes.length - 1];
|
20914 | },
|
20915 | actors: [],
|
20916 | loops: [],
|
20917 | messages: [],
|
20918 | notes: []
|
20919 | },
|
20920 | init: function init() {
|
20921 | this.sequenceItems = [];
|
20922 | this.activations = [];
|
20923 | this.models.clear();
|
20924 | this.data = {
|
20925 | startx: undefined,
|
20926 | stopx: undefined,
|
20927 | starty: undefined,
|
20928 | stopy: undefined
|
20929 | };
|
20930 | this.verticalPos = 0;
|
20931 | setConf(_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getConfig());
|
20932 | },
|
20933 | updateVal: function updateVal(obj, key, val, fun) {
|
20934 | if (typeof obj[key] === 'undefined') {
|
20935 | obj[key] = val;
|
20936 | } else {
|
20937 | obj[key] = fun(val, obj[key]);
|
20938 | }
|
20939 | },
|
20940 | updateBounds: function updateBounds(startx, starty, stopx, stopy) {
|
20941 | var _self = this;
|
20942 |
|
20943 | var cnt = 0;
|
20944 |
|
20945 | function updateFn(type) {
|
20946 | return function updateItemBounds(item) {
|
20947 | cnt++; // The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
|
20948 |
|
20949 | var n = _self.sequenceItems.length - cnt + 1;
|
20950 |
|
20951 | _self.updateVal(item, 'starty', starty - n * conf.boxMargin, Math.min);
|
20952 |
|
20953 | _self.updateVal(item, 'stopy', stopy + n * conf.boxMargin, Math.max);
|
20954 |
|
20955 | _self.updateVal(bounds.data, 'startx', startx - n * conf.boxMargin, Math.min);
|
20956 |
|
20957 | _self.updateVal(bounds.data, 'stopx', stopx + n * conf.boxMargin, Math.max);
|
20958 |
|
20959 | if (!(type === 'activation')) {
|
20960 | _self.updateVal(item, 'startx', startx - n * conf.boxMargin, Math.min);
|
20961 |
|
20962 | _self.updateVal(item, 'stopx', stopx + n * conf.boxMargin, Math.max);
|
20963 |
|
20964 | _self.updateVal(bounds.data, 'starty', starty - n * conf.boxMargin, Math.min);
|
20965 |
|
20966 | _self.updateVal(bounds.data, 'stopy', stopy + n * conf.boxMargin, Math.max);
|
20967 | }
|
20968 | };
|
20969 | }
|
20970 |
|
20971 | this.sequenceItems.forEach(updateFn());
|
20972 | this.activations.forEach(updateFn('activation'));
|
20973 | },
|
20974 | insert: function insert(startx, starty, stopx, stopy) {
|
20975 | var _startx = Math.min(startx, stopx);
|
20976 |
|
20977 | var _stopx = Math.max(startx, stopx);
|
20978 |
|
20979 | var _starty = Math.min(starty, stopy);
|
20980 |
|
20981 | var _stopy = Math.max(starty, stopy);
|
20982 |
|
20983 | this.updateVal(bounds.data, 'startx', _startx, Math.min);
|
20984 | this.updateVal(bounds.data, 'starty', _starty, Math.min);
|
20985 | this.updateVal(bounds.data, 'stopx', _stopx, Math.max);
|
20986 | this.updateVal(bounds.data, 'stopy', _stopy, Math.max);
|
20987 | this.updateBounds(_startx, _starty, _stopx, _stopy);
|
20988 | },
|
20989 | newActivation: function newActivation(message, diagram, actors) {
|
20990 | var actorRect = actors[message.from.actor];
|
20991 | var stackedSize = actorActivations(message.from.actor).length || 0;
|
20992 | var x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
|
20993 | this.activations.push({
|
20994 | startx: x,
|
20995 | starty: this.verticalPos + 2,
|
20996 | stopx: x + conf.activationWidth,
|
20997 | stopy: undefined,
|
20998 | actor: message.from.actor,
|
20999 | anchored: _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].anchorElement(diagram)
|
21000 | });
|
21001 | },
|
21002 | endActivation: function endActivation(message) {
|
21003 | // find most recent activation for given actor
|
21004 | var lastActorActivationIdx = this.activations.map(function (activation) {
|
21005 | return activation.actor;
|
21006 | }).lastIndexOf(message.from.actor);
|
21007 | return this.activations.splice(lastActorActivationIdx, 1)[0];
|
21008 | },
|
21009 | createLoop: function createLoop() {
|
21010 | var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
21011 | message: undefined,
|
21012 | wrap: false,
|
21013 | width: undefined
|
21014 | };
|
21015 | var fill = arguments.length > 1 ? arguments[1] : undefined;
|
21016 | return {
|
21017 | startx: undefined,
|
21018 | starty: this.verticalPos,
|
21019 | stopx: undefined,
|
21020 | stopy: undefined,
|
21021 | title: title.message,
|
21022 | wrap: title.wrap,
|
21023 | width: title.width,
|
21024 | height: 0,
|
21025 | fill: fill
|
21026 | };
|
21027 | },
|
21028 | newLoop: function newLoop() {
|
21029 | var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
21030 | message: undefined,
|
21031 | wrap: false,
|
21032 | width: undefined
|
21033 | };
|
21034 | var fill = arguments.length > 1 ? arguments[1] : undefined;
|
21035 | this.sequenceItems.push(this.createLoop(title, fill));
|
21036 | },
|
21037 | endLoop: function endLoop() {
|
21038 | return this.sequenceItems.pop();
|
21039 | },
|
21040 | addSectionToLoop: function addSectionToLoop(message) {
|
21041 | var loop = this.sequenceItems.pop();
|
21042 | loop.sections = loop.sections || [];
|
21043 | loop.sectionTitles = loop.sectionTitles || [];
|
21044 | loop.sections.push({
|
21045 | y: bounds.getVerticalPos(),
|
21046 | height: 0
|
21047 | });
|
21048 | loop.sectionTitles.push(message);
|
21049 | this.sequenceItems.push(loop);
|
21050 | },
|
21051 | bumpVerticalPos: function bumpVerticalPos(bump) {
|
21052 | this.verticalPos = this.verticalPos + bump;
|
21053 | this.data.stopy = this.verticalPos;
|
21054 | },
|
21055 | getVerticalPos: function getVerticalPos() {
|
21056 | return this.verticalPos;
|
21057 | },
|
21058 | getBounds: function getBounds() {
|
21059 | return {
|
21060 | bounds: this.data,
|
21061 | models: this.models
|
21062 | };
|
21063 | }
|
21064 | };
|
21065 | /**
|
21066 | * Draws an note in the diagram with the attached line
|
21067 | * @param elem - The diagram to draw to.
|
21068 | * @param noteModel:{x: number, y: number, message: string, width: number} - startx: x axis start position, verticalPos: y axis position, messsage: the message to be shown, width: Set this with a custom width to override the default configured width.
|
21069 | */
|
21070 |
|
21071 | var drawNote = function drawNote(elem, noteModel) {
|
21072 | bounds.bumpVerticalPos(conf.boxMargin);
|
21073 | noteModel.height = conf.boxMargin;
|
21074 | noteModel.starty = bounds.getVerticalPos();
|
21075 | var rect = _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].getNoteRect();
|
21076 | rect.x = noteModel.startx;
|
21077 | rect.y = noteModel.starty;
|
21078 | rect.width = noteModel.width || conf.width;
|
21079 | rect.class = 'note';
|
21080 | var g = elem.append('g');
|
21081 | var rectElem = _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawRect(g, rect);
|
21082 | var textObj = _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].getTextObj();
|
21083 | textObj.x = noteModel.startx;
|
21084 | textObj.y = noteModel.starty;
|
21085 | textObj.width = rect.width;
|
21086 | textObj.dy = '1em';
|
21087 | textObj.text = noteModel.message;
|
21088 | textObj.class = 'noteText';
|
21089 | textObj.fontFamily = conf.noteFontFamily;
|
21090 | textObj.fontSize = conf.noteFontSize;
|
21091 | textObj.fontWeight = conf.noteFontWeight;
|
21092 | textObj.anchor = conf.noteAlign;
|
21093 | textObj.textMargin = conf.noteMargin;
|
21094 | textObj.valign = conf.noteAlign;
|
21095 | var textElem = (0,_svgDraw__WEBPACK_IMPORTED_MODULE_3__.drawText)(g, textObj);
|
21096 | var textHeight = Math.round(textElem.map(function (te) {
|
21097 | return (te._groups || te)[0][0].getBBox().height;
|
21098 | }).reduce(function (acc, curr) {
|
21099 | return acc + curr;
|
21100 | }));
|
21101 | rectElem.attr('height', textHeight + 2 * conf.noteMargin);
|
21102 | noteModel.height += textHeight + 2 * conf.noteMargin;
|
21103 | bounds.bumpVerticalPos(textHeight + 2 * conf.noteMargin);
|
21104 | noteModel.stopy = noteModel.starty + textHeight + 2 * conf.noteMargin;
|
21105 | noteModel.stopx = noteModel.startx + rect.width;
|
21106 | bounds.insert(noteModel.startx, noteModel.starty, noteModel.stopx, noteModel.stopy);
|
21107 | bounds.models.addNote(noteModel);
|
21108 | };
|
21109 |
|
21110 | var messageFont = function messageFont(cnf) {
|
21111 | return {
|
21112 | fontFamily: cnf.messageFontFamily,
|
21113 | fontSize: cnf.messageFontSize,
|
21114 | fontWeight: cnf.messageFontWeight
|
21115 | };
|
21116 | };
|
21117 |
|
21118 | var noteFont = function noteFont(cnf) {
|
21119 | return {
|
21120 | fontFamily: cnf.noteFontFamily,
|
21121 | fontSize: cnf.noteFontSize,
|
21122 | fontWeight: cnf.noteFontWeight
|
21123 | };
|
21124 | };
|
21125 |
|
21126 | var actorFont = function actorFont(cnf) {
|
21127 | return {
|
21128 | fontFamily: cnf.actorFontFamily,
|
21129 | fontSize: cnf.actorFontSize,
|
21130 | fontWeight: cnf.actorFontWeight
|
21131 | };
|
21132 | };
|
21133 | /**
|
21134 | * Draws a message
|
21135 | * @param g - the parent of the message element
|
21136 | * @param msgModel - the model containing fields describing a message
|
21137 | */
|
21138 |
|
21139 |
|
21140 | var drawMessage = function drawMessage(g, msgModel) {
|
21141 | bounds.bumpVerticalPos(10);
|
21142 | var startx = msgModel.startx,
|
21143 | stopx = msgModel.stopx,
|
21144 | starty = msgModel.starty,
|
21145 | message = msgModel.message,
|
21146 | type = msgModel.type,
|
21147 | sequenceIndex = msgModel.sequenceIndex;
|
21148 | var lines = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].splitBreaks(message).length;
|
21149 | var textDims = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(message, messageFont(conf));
|
21150 | var lineHeight = textDims.height / lines;
|
21151 | msgModel.height += lineHeight;
|
21152 | bounds.bumpVerticalPos(lineHeight);
|
21153 | var textObj = _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].getTextObj();
|
21154 | textObj.x = startx;
|
21155 | textObj.y = starty + 10;
|
21156 | textObj.width = stopx - startx;
|
21157 | textObj.class = 'messageText';
|
21158 | textObj.dy = '1em';
|
21159 | textObj.text = message;
|
21160 | textObj.fontFamily = conf.messageFontFamily;
|
21161 | textObj.fontSize = conf.messageFontSize;
|
21162 | textObj.fontWeight = conf.messageFontWeight;
|
21163 | textObj.anchor = conf.messageAlign;
|
21164 | textObj.valign = conf.messageAlign;
|
21165 | textObj.textMargin = conf.wrapPadding;
|
21166 | textObj.tspan = false;
|
21167 | (0,_svgDraw__WEBPACK_IMPORTED_MODULE_3__.drawText)(g, textObj);
|
21168 | var totalOffset = textDims.height - 10;
|
21169 | var textWidth = textDims.width;
|
21170 | var line, lineStarty;
|
21171 |
|
21172 | if (startx === stopx) {
|
21173 | lineStarty = bounds.getVerticalPos() + totalOffset;
|
21174 |
|
21175 | if (conf.rightAngles) {
|
21176 | line = g.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));
|
21177 | } else {
|
21178 | totalOffset += conf.boxMargin;
|
21179 | lineStarty = bounds.getVerticalPos() + totalOffset;
|
21180 | line = g.append('path').attr('d', 'M ' + startx + ',' + lineStarty + ' C ' + (startx + 60) + ',' + (lineStarty - 10) + ' ' + (startx + 60) + ',' + (lineStarty + 30) + ' ' + startx + ',' + (lineStarty + 20));
|
21181 | }
|
21182 |
|
21183 | totalOffset += 30;
|
21184 | var dx = Math.max(textWidth / 2, conf.width / 2);
|
21185 | bounds.insert(startx - dx, bounds.getVerticalPos() - 10 + totalOffset, stopx + dx, bounds.getVerticalPos() + 30 + totalOffset);
|
21186 | } else {
|
21187 | totalOffset += conf.boxMargin;
|
21188 | lineStarty = bounds.getVerticalPos() + totalOffset;
|
21189 | line = g.append('line');
|
21190 | line.attr('x1', startx);
|
21191 | line.attr('y1', lineStarty);
|
21192 | line.attr('x2', stopx);
|
21193 | line.attr('y2', lineStarty);
|
21194 | bounds.insert(startx, lineStarty - 10, stopx, lineStarty);
|
21195 | } // Make an SVG Container
|
21196 | // Draw the line
|
21197 |
|
21198 |
|
21199 | if (type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_CROSS || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_POINT || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_OPEN) {
|
21200 | line.style('stroke-dasharray', '3, 3');
|
21201 | line.attr('class', 'messageLine1');
|
21202 | } else {
|
21203 | line.attr('class', 'messageLine0');
|
21204 | }
|
21205 |
|
21206 | var url = '';
|
21207 |
|
21208 | if (conf.arrowMarkerAbsolute) {
|
21209 | url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
|
21210 | url = url.replace(/\(/g, '\\(');
|
21211 | url = url.replace(/\)/g, '\\)');
|
21212 | }
|
21213 |
|
21214 | line.attr('stroke-width', 2);
|
21215 | line.attr('stroke', 'none'); // handled by theme/css anyway
|
21216 |
|
21217 | line.style('fill', 'none'); // remove any fill colour
|
21218 |
|
21219 | if (type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED) {
|
21220 | line.attr('marker-end', 'url(' + url + '#arrowhead)');
|
21221 | }
|
21222 |
|
21223 | if (type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_POINT || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_POINT) {
|
21224 | line.attr('marker-end', 'url(' + url + '#filled-head)');
|
21225 | }
|
21226 |
|
21227 | if (type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_CROSS || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_CROSS) {
|
21228 | line.attr('marker-end', 'url(' + url + '#crosshead)');
|
21229 | } // add node number
|
21230 |
|
21231 |
|
21232 | if (_sequenceDb__WEBPACK_IMPORTED_MODULE_2__["default"].showSequenceNumbers() || conf.showSequenceNumbers) {
|
21233 | line.attr('marker-start', 'url(' + url + '#sequencenumber)');
|
21234 | g.append('text').attr('x', startx).attr('y', lineStarty + 4).attr('font-family', 'sans-serif').attr('font-size', '12px').attr('text-anchor', 'middle').attr('textLength', '16px').attr('class', 'sequenceNumber').text(sequenceIndex);
|
21235 | }
|
21236 |
|
21237 | bounds.bumpVerticalPos(totalOffset);
|
21238 | msgModel.height += totalOffset;
|
21239 | msgModel.stopy = msgModel.starty + msgModel.height;
|
21240 | bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
|
21241 | };
|
21242 |
|
21243 | var drawActors = function drawActors(diagram, actors, actorKeys, verticalPos) {
|
21244 | // Draw the actors
|
21245 | var prevWidth = 0;
|
21246 | var prevMargin = 0;
|
21247 | var maxHeight = 0;
|
21248 |
|
21249 | for (var i = 0; i < actorKeys.length; i++) {
|
21250 | var actor = actors[actorKeys[i]]; // Add some rendering data to the object
|
21251 |
|
21252 | actor.width = actor.width || conf.width;
|
21253 | actor.height = Math.max(actor.height || conf.height, conf.height);
|
21254 | actor.margin = actor.margin || conf.actorMargin;
|
21255 | actor.x = prevWidth + prevMargin;
|
21256 | actor.y = verticalPos; // Draw the box with the attached line
|
21257 |
|
21258 | var height = _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawActor(diagram, actor, conf);
|
21259 | maxHeight = Math.max(maxHeight, height);
|
21260 | bounds.insert(actor.x, verticalPos, actor.x + actor.width, actor.height);
|
21261 | prevWidth += actor.width;
|
21262 | prevMargin += actor.margin;
|
21263 | bounds.models.addActor(actor);
|
21264 | } // Add a margin between the actor boxes and the first arrow
|
21265 |
|
21266 |
|
21267 | bounds.bumpVerticalPos(maxHeight);
|
21268 | };
|
21269 | var drawActorsPopup = function drawActorsPopup(diagram, actors, actorKeys) {
|
21270 | var maxHeight = 0;
|
21271 | var maxWidth = 0;
|
21272 |
|
21273 | for (var i = 0; i < actorKeys.length; i++) {
|
21274 | var actor = actors[actorKeys[i]];
|
21275 | var minMenuWidth = getRequiredPopupWidth(actor);
|
21276 | var menuDimensions = _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawPopup(diagram, actor, minMenuWidth, conf, conf.forceMenus);
|
21277 |
|
21278 | if (menuDimensions.height > maxHeight) {
|
21279 | maxHeight = menuDimensions.height;
|
21280 | }
|
21281 |
|
21282 | if (menuDimensions.width + actor.x > maxWidth) {
|
21283 | maxWidth = menuDimensions.width + actor.x;
|
21284 | }
|
21285 | }
|
21286 |
|
21287 | return {
|
21288 | maxHeight: maxHeight,
|
21289 | maxWidth: maxWidth
|
21290 | };
|
21291 | };
|
21292 | var setConf = function setConf(cnf) {
|
21293 | (0,_utils__WEBPACK_IMPORTED_MODULE_5__.assignWithDepth)(conf, cnf);
|
21294 |
|
21295 | if (cnf.fontFamily) {
|
21296 | conf.actorFontFamily = conf.noteFontFamily = conf.messageFontFamily = cnf.fontFamily;
|
21297 | }
|
21298 |
|
21299 | if (cnf.fontSize) {
|
21300 | conf.actorFontSize = conf.noteFontSize = conf.messageFontSize = cnf.fontSize;
|
21301 | }
|
21302 |
|
21303 | if (cnf.fontWeight) {
|
21304 | conf.actorFontWeight = conf.noteFontWeight = conf.messageFontWeight = cnf.fontWeight;
|
21305 | }
|
21306 | };
|
21307 |
|
21308 | var actorActivations = function actorActivations(actor) {
|
21309 | return bounds.activations.filter(function (activation) {
|
21310 | return activation.actor === actor;
|
21311 | });
|
21312 | };
|
21313 |
|
21314 | var activationBounds = function activationBounds(actor, actors) {
|
21315 | // handle multiple stacked activations for same actor
|
21316 | var actorObj = actors[actor];
|
21317 | var activations = actorActivations(actor);
|
21318 | var left = activations.reduce(function (acc, activation) {
|
21319 | return Math.min(acc, activation.startx);
|
21320 | }, actorObj.x + actorObj.width / 2);
|
21321 | var right = activations.reduce(function (acc, activation) {
|
21322 | return Math.max(acc, activation.stopx);
|
21323 | }, actorObj.x + actorObj.width / 2);
|
21324 | return [left, right];
|
21325 | };
|
21326 |
|
21327 | function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoopFn) {
|
21328 | bounds.bumpVerticalPos(preMargin);
|
21329 | var heightAdjust = postMargin;
|
21330 |
|
21331 | if (msg.id && msg.message && loopWidths[msg.id]) {
|
21332 | var loopWidth = loopWidths[msg.id].width;
|
21333 | var textConf = messageFont(conf);
|
21334 | msg.message = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].wrapLabel("[".concat(msg.message, "]"), loopWidth - 2 * conf.wrapPadding, textConf);
|
21335 | msg.width = loopWidth;
|
21336 | msg.wrap = true; // const lines = common.splitBreaks(msg.message).length;
|
21337 |
|
21338 | var textDims = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(msg.message, textConf);
|
21339 | var totalOffset = Math.max(textDims.height, conf.labelBoxHeight);
|
21340 | heightAdjust = postMargin + totalOffset;
|
21341 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug("".concat(totalOffset, " - ").concat(msg.message));
|
21342 | }
|
21343 |
|
21344 | addLoopFn(msg);
|
21345 | bounds.bumpVerticalPos(heightAdjust);
|
21346 | }
|
21347 | /**
|
21348 | * Draws a sequenceDiagram in the tag with id: id based on the graph definition in text.
|
21349 | * @param text
|
21350 | * @param id
|
21351 | */
|
21352 |
|
21353 |
|
21354 | var draw = function draw(text, id) {
|
21355 | conf = _config__WEBPACK_IMPORTED_MODULE_7__.getConfig().sequence;
|
21356 | _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.clear();
|
21357 | _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.setWrap(conf.wrap);
|
21358 | _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.parse(text + '\n');
|
21359 | bounds.init();
|
21360 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug("C:".concat(JSON.stringify(conf, null, 2)));
|
21361 | var diagram = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id=\"".concat(id, "\"]")); // Fetch data from the parsing
|
21362 |
|
21363 | var actors = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getActors();
|
21364 | var actorKeys = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getActorKeys();
|
21365 | var messages = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getMessages();
|
21366 | var title = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getTitle();
|
21367 | var maxMessageWidthPerActor = getMaxMessageWidthPerActor(actors, messages);
|
21368 | conf.height = calculateActorMargins(actors, maxMessageWidthPerActor);
|
21369 | _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].insertComputerIcon(diagram);
|
21370 | _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].insertDatabaseIcon(diagram);
|
21371 | _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].insertClockIcon(diagram);
|
21372 | drawActors(diagram, actors, actorKeys, 0);
|
21373 | var loopWidths = calculateLoopBounds(messages, actors, maxMessageWidthPerActor); // The arrow head definition is attached to the svg once
|
21374 |
|
21375 | _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].insertArrowHead(diagram);
|
21376 | _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].insertArrowCrossHead(diagram);
|
21377 | _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].insertArrowFilledHead(diagram);
|
21378 | _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].insertSequenceNumber(diagram);
|
21379 |
|
21380 | function activeEnd(msg, verticalPos) {
|
21381 | var activationData = bounds.endActivation(msg);
|
21382 |
|
21383 | if (activationData.starty + 18 > verticalPos) {
|
21384 | activationData.starty = verticalPos - 6;
|
21385 | verticalPos += 12;
|
21386 | }
|
21387 |
|
21388 | _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawActivation(diagram, activationData, verticalPos, conf, actorActivations(msg.from.actor).length);
|
21389 | bounds.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos);
|
21390 | } // Draw the messages/signals
|
21391 |
|
21392 |
|
21393 | var sequenceIndex = 1;
|
21394 | messages.forEach(function (msg) {
|
21395 | var loopModel, noteModel, msgModel;
|
21396 |
|
21397 | switch (msg.type) {
|
21398 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.NOTE:
|
21399 | noteModel = msg.noteModel;
|
21400 | drawNote(diagram, noteModel);
|
21401 | break;
|
21402 |
|
21403 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ACTIVE_START:
|
21404 | bounds.newActivation(msg, diagram, actors);
|
21405 | break;
|
21406 |
|
21407 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ACTIVE_END:
|
21408 | activeEnd(msg, bounds.getVerticalPos());
|
21409 | break;
|
21410 |
|
21411 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.LOOP_START:
|
21412 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
|
21413 | return bounds.newLoop(message);
|
21414 | });
|
21415 | break;
|
21416 |
|
21417 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.LOOP_END:
|
21418 | loopModel = bounds.endLoop();
|
21419 | _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawLoop(diagram, loopModel, 'loop', conf);
|
21420 | bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
|
21421 | bounds.models.addLoop(loopModel);
|
21422 | break;
|
21423 |
|
21424 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.RECT_START:
|
21425 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin, function (message) {
|
21426 | return bounds.newLoop(undefined, message.message);
|
21427 | });
|
21428 | break;
|
21429 |
|
21430 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.RECT_END:
|
21431 | loopModel = bounds.endLoop();
|
21432 | _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawBackgroundRect(diagram, loopModel);
|
21433 | bounds.models.addLoop(loopModel);
|
21434 | bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
|
21435 | break;
|
21436 |
|
21437 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.OPT_START:
|
21438 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
|
21439 | return bounds.newLoop(message);
|
21440 | });
|
21441 | break;
|
21442 |
|
21443 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.OPT_END:
|
21444 | loopModel = bounds.endLoop();
|
21445 | _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawLoop(diagram, loopModel, 'opt', conf);
|
21446 | bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
|
21447 | bounds.models.addLoop(loopModel);
|
21448 | break;
|
21449 |
|
21450 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ALT_START:
|
21451 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
|
21452 | return bounds.newLoop(message);
|
21453 | });
|
21454 | break;
|
21455 |
|
21456 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ALT_ELSE:
|
21457 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin + conf.boxTextMargin, conf.boxMargin, function (message) {
|
21458 | return bounds.addSectionToLoop(message);
|
21459 | });
|
21460 | break;
|
21461 |
|
21462 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ALT_END:
|
21463 | loopModel = bounds.endLoop();
|
21464 | _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawLoop(diagram, loopModel, 'alt', conf);
|
21465 | bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
|
21466 | bounds.models.addLoop(loopModel);
|
21467 | break;
|
21468 |
|
21469 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.PAR_START:
|
21470 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
|
21471 | return bounds.newLoop(message);
|
21472 | });
|
21473 | break;
|
21474 |
|
21475 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.PAR_AND:
|
21476 | adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin + conf.boxTextMargin, conf.boxMargin, function (message) {
|
21477 | return bounds.addSectionToLoop(message);
|
21478 | });
|
21479 | break;
|
21480 |
|
21481 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.PAR_END:
|
21482 | loopModel = bounds.endLoop();
|
21483 | _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawLoop(diagram, loopModel, 'par', conf);
|
21484 | bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
|
21485 | bounds.models.addLoop(loopModel);
|
21486 | break;
|
21487 |
|
21488 | default:
|
21489 | try {
|
21490 | // lastMsg = msg
|
21491 | msgModel = msg.msgModel;
|
21492 | msgModel.starty = bounds.getVerticalPos();
|
21493 | msgModel.sequenceIndex = sequenceIndex;
|
21494 | drawMessage(diagram, msgModel);
|
21495 | bounds.models.addMessage(msgModel);
|
21496 | } catch (e) {
|
21497 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.error('error while drawing message', e);
|
21498 | }
|
21499 |
|
21500 | } // Increment sequence counter if msg.type is a line (and not another event like activation or note, etc)
|
21501 |
|
21502 |
|
21503 | if ([_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_OPEN, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_OPEN, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_CROSS, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_CROSS, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_POINT, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_POINT].includes(msg.type)) {
|
21504 | sequenceIndex++;
|
21505 | }
|
21506 | });
|
21507 |
|
21508 | if (conf.mirrorActors) {
|
21509 | // Draw actors below diagram
|
21510 | bounds.bumpVerticalPos(conf.boxMargin * 2);
|
21511 | drawActors(diagram, actors, actorKeys, bounds.getVerticalPos());
|
21512 | bounds.bumpVerticalPos(conf.boxMargin);
|
21513 | (0,_svgDraw__WEBPACK_IMPORTED_MODULE_3__.fixLifeLineHeights)(diagram, bounds.getVerticalPos());
|
21514 | } // only draw popups for the top row of actors.
|
21515 |
|
21516 |
|
21517 | var requiredBoxSize = drawActorsPopup(diagram, actors, actorKeys);
|
21518 |
|
21519 | var _bounds$getBounds = bounds.getBounds(),
|
21520 | box = _bounds$getBounds.bounds; // Adjust line height of actor lines now that the height of the diagram is known
|
21521 |
|
21522 |
|
21523 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('For line height fix Querying: #' + id + ' .actor-line');
|
21524 | var actorLines = (0,d3__WEBPACK_IMPORTED_MODULE_0__.selectAll)('#' + id + ' .actor-line');
|
21525 | actorLines.attr('y2', box.stopy); // Make sure the height of the diagram supports long menus.
|
21526 |
|
21527 | var boxHeight = box.stopy - box.starty;
|
21528 |
|
21529 | if (boxHeight < requiredBoxSize.maxHeight) {
|
21530 | boxHeight = requiredBoxSize.maxHeight;
|
21531 | }
|
21532 |
|
21533 | var height = boxHeight + 2 * conf.diagramMarginY;
|
21534 |
|
21535 | if (conf.mirrorActors) {
|
21536 | height = height - conf.boxMargin + conf.bottomMarginAdj;
|
21537 | } // Make sure the width of the diagram supports wide menus.
|
21538 |
|
21539 |
|
21540 | var boxWidth = box.stopx - box.startx;
|
21541 |
|
21542 | if (boxWidth < requiredBoxSize.maxWidth) {
|
21543 | boxWidth = requiredBoxSize.maxWidth;
|
21544 | }
|
21545 |
|
21546 | var width = boxWidth + 2 * conf.diagramMarginX;
|
21547 |
|
21548 | if (title) {
|
21549 | diagram.append('text').text(title).attr('x', (box.stopx - box.startx) / 2 - 2 * conf.diagramMarginX).attr('y', -25);
|
21550 | }
|
21551 |
|
21552 | (0,_utils__WEBPACK_IMPORTED_MODULE_5__.configureSvgSize)(diagram, height, width, conf.useMaxWidth);
|
21553 | var extraVertForTitle = title ? 40 : 0;
|
21554 | diagram.attr('viewBox', box.startx - conf.diagramMarginX + ' -' + (conf.diagramMarginY + extraVertForTitle) + ' ' + width + ' ' + (height + extraVertForTitle));
|
21555 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug("models:", bounds.models);
|
21556 | };
|
21557 | /**
|
21558 | * Retrieves the max message width of each actor, supports signals (messages, loops)
|
21559 | * and notes.
|
21560 | *
|
21561 | * It will enumerate each given message, and will determine its text width, in relation
|
21562 | * to the actor it originates from, and destined to.
|
21563 | *
|
21564 | * @param actors - The actors map
|
21565 | * @param messages - A list of message objects to iterate
|
21566 | */
|
21567 |
|
21568 | var getMaxMessageWidthPerActor = function getMaxMessageWidthPerActor(actors, messages) {
|
21569 | var maxMessageWidthPerActor = {};
|
21570 | messages.forEach(function (msg) {
|
21571 | if (actors[msg.to] && actors[msg.from]) {
|
21572 | var actor = actors[msg.to]; // If this is the first actor, and the message is left of it, no need to calculate the margin
|
21573 |
|
21574 | if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.PLACEMENT.LEFTOF && !actor.prevActor) {
|
21575 | return;
|
21576 | } // If this is the last actor, and the message is right of it, no need to calculate the margin
|
21577 |
|
21578 |
|
21579 | if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.PLACEMENT.RIGHTOF && !actor.nextActor) {
|
21580 | return;
|
21581 | }
|
21582 |
|
21583 | var isNote = msg.placement !== undefined;
|
21584 | var isMessage = !isNote;
|
21585 | var textFont = isNote ? noteFont(conf) : messageFont(conf);
|
21586 | var wrappedMessage = msg.wrap ? _utils__WEBPACK_IMPORTED_MODULE_5__["default"].wrapLabel(msg.message, conf.width - 2 * conf.wrapPadding, textFont) : msg.message;
|
21587 | var messageDimensions = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(wrappedMessage, textFont);
|
21588 | var messageWidth = messageDimensions.width + 2 * conf.wrapPadding;
|
21589 | /*
|
21590 | * The following scenarios should be supported:
|
21591 | *
|
21592 | * - There's a message (non-note) between fromActor and toActor
|
21593 | * - If fromActor is on the right and toActor is on the left, we should
|
21594 | * define the toActor's margin
|
21595 | * - If fromActor is on the left and toActor is on the right, we should
|
21596 | * define the fromActor's margin
|
21597 | * - There's a note, in which case fromActor == toActor
|
21598 | * - If the note is to the left of the actor, we should define the previous actor
|
21599 | * margin
|
21600 | * - If the note is on the actor, we should define both the previous and next actor
|
21601 | * margins, each being the half of the note size
|
21602 | * - If the note is on the right of the actor, we should define the current actor
|
21603 | * margin
|
21604 | */
|
21605 |
|
21606 | if (isMessage && msg.from === actor.nextActor) {
|
21607 | maxMessageWidthPerActor[msg.to] = Math.max(maxMessageWidthPerActor[msg.to] || 0, messageWidth);
|
21608 | } else if (isMessage && msg.from === actor.prevActor) {
|
21609 | maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth);
|
21610 | } else if (isMessage && msg.from === msg.to) {
|
21611 | maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth / 2);
|
21612 | maxMessageWidthPerActor[msg.to] = Math.max(maxMessageWidthPerActor[msg.to] || 0, messageWidth / 2);
|
21613 | } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.PLACEMENT.RIGHTOF) {
|
21614 | maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth);
|
21615 | } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.PLACEMENT.LEFTOF) {
|
21616 | maxMessageWidthPerActor[actor.prevActor] = Math.max(maxMessageWidthPerActor[actor.prevActor] || 0, messageWidth);
|
21617 | } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.PLACEMENT.OVER) {
|
21618 | if (actor.prevActor) {
|
21619 | maxMessageWidthPerActor[actor.prevActor] = Math.max(maxMessageWidthPerActor[actor.prevActor] || 0, messageWidth / 2);
|
21620 | }
|
21621 |
|
21622 | if (actor.nextActor) {
|
21623 | maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth / 2);
|
21624 | }
|
21625 | }
|
21626 | }
|
21627 | });
|
21628 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('maxMessageWidthPerActor:', maxMessageWidthPerActor);
|
21629 | return maxMessageWidthPerActor;
|
21630 | };
|
21631 |
|
21632 | var getRequiredPopupWidth = function getRequiredPopupWidth(actor) {
|
21633 | var requiredPopupWidth = 0;
|
21634 | var textFont = actorFont(conf);
|
21635 |
|
21636 | for (var key in actor.links) {
|
21637 | var labelDimensions = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(key, textFont);
|
21638 | var labelWidth = labelDimensions.width + 2 * conf.wrapPadding + 2 * conf.boxMargin;
|
21639 |
|
21640 | if (requiredPopupWidth < labelWidth) {
|
21641 | requiredPopupWidth = labelWidth;
|
21642 | }
|
21643 | }
|
21644 |
|
21645 | return requiredPopupWidth;
|
21646 | };
|
21647 | /**
|
21648 | * This will calculate the optimal margin for each given actor, for a given
|
21649 | * actor->messageWidth map.
|
21650 | *
|
21651 | * An actor's margin is determined by the width of the actor, the width of the
|
21652 | * largest message that originates from it, and the configured conf.actorMargin.
|
21653 | *
|
21654 | * @param actors - The actors map to calculate margins for
|
21655 | * @param actorToMessageWidth - A map of actor key -> max message width it holds
|
21656 | */
|
21657 |
|
21658 |
|
21659 | var calculateActorMargins = function calculateActorMargins(actors, actorToMessageWidth) {
|
21660 | var maxHeight = 0;
|
21661 | Object.keys(actors).forEach(function (prop) {
|
21662 | var actor = actors[prop];
|
21663 |
|
21664 | if (actor.wrap) {
|
21665 | actor.description = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].wrapLabel(actor.description, conf.width - 2 * conf.wrapPadding, actorFont(conf));
|
21666 | }
|
21667 |
|
21668 | var actDims = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(actor.description, actorFont(conf));
|
21669 | actor.width = actor.wrap ? conf.width : Math.max(conf.width, actDims.width + 2 * conf.wrapPadding);
|
21670 | actor.height = actor.wrap ? Math.max(actDims.height, conf.height) : conf.height;
|
21671 | maxHeight = Math.max(maxHeight, actor.height);
|
21672 | });
|
21673 |
|
21674 | for (var actorKey in actorToMessageWidth) {
|
21675 | var actor = actors[actorKey];
|
21676 |
|
21677 | if (!actor) {
|
21678 | continue;
|
21679 | }
|
21680 |
|
21681 | var nextActor = actors[actor.nextActor]; // No need to space out an actor that doesn't have a next link
|
21682 |
|
21683 | if (!nextActor) {
|
21684 | continue;
|
21685 | }
|
21686 |
|
21687 | var messageWidth = actorToMessageWidth[actorKey];
|
21688 | var actorWidth = messageWidth + conf.actorMargin - actor.width / 2 - nextActor.width / 2;
|
21689 | actor.margin = Math.max(actorWidth, conf.actorMargin);
|
21690 | }
|
21691 |
|
21692 | return Math.max(maxHeight, conf.height);
|
21693 | };
|
21694 |
|
21695 | var buildNoteModel = function buildNoteModel(msg, actors) {
|
21696 | var startx = actors[msg.from].x;
|
21697 | var stopx = actors[msg.to].x;
|
21698 | var shouldWrap = msg.wrap && msg.message;
|
21699 | var textDimensions = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(shouldWrap ? _utils__WEBPACK_IMPORTED_MODULE_5__["default"].wrapLabel(msg.message, conf.width, noteFont(conf)) : msg.message, noteFont(conf));
|
21700 | var noteModel = {
|
21701 | width: shouldWrap ? conf.width : Math.max(conf.width, textDimensions.width + 2 * conf.noteMargin),
|
21702 | height: 0,
|
21703 | startx: actors[msg.from].x,
|
21704 | stopx: 0,
|
21705 | starty: 0,
|
21706 | stopy: 0,
|
21707 | message: msg.message
|
21708 | };
|
21709 |
|
21710 | if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.PLACEMENT.RIGHTOF) {
|
21711 | 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);
|
21712 | noteModel.startx = startx + (actors[msg.from].width + conf.actorMargin) / 2;
|
21713 | } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.PLACEMENT.LEFTOF) {
|
21714 | 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);
|
21715 | noteModel.startx = startx - noteModel.width + (actors[msg.from].width - conf.actorMargin) / 2;
|
21716 | } else if (msg.to === msg.from) {
|
21717 | textDimensions = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(shouldWrap ? _utils__WEBPACK_IMPORTED_MODULE_5__["default"].wrapLabel(msg.message, Math.max(conf.width, actors[msg.from].width), noteFont(conf)) : msg.message, noteFont(conf));
|
21718 | noteModel.width = shouldWrap ? Math.max(conf.width, actors[msg.from].width) : Math.max(actors[msg.from].width, conf.width, textDimensions.width + 2 * conf.noteMargin);
|
21719 | noteModel.startx = startx + (actors[msg.from].width - noteModel.width) / 2;
|
21720 | } else {
|
21721 | noteModel.width = Math.abs(startx + actors[msg.from].width / 2 - (stopx + actors[msg.to].width / 2)) + conf.actorMargin;
|
21722 | noteModel.startx = startx < stopx ? startx + actors[msg.from].width / 2 - conf.actorMargin / 2 : stopx + actors[msg.to].width / 2 - conf.actorMargin / 2;
|
21723 | }
|
21724 |
|
21725 | if (shouldWrap) {
|
21726 | noteModel.message = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].wrapLabel(msg.message, noteModel.width - 2 * conf.wrapPadding, noteFont(conf));
|
21727 | }
|
21728 |
|
21729 | _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, "]"));
|
21730 | return noteModel;
|
21731 | };
|
21732 |
|
21733 | var buildMessageModel = function buildMessageModel(msg, actors) {
|
21734 | var process = false;
|
21735 |
|
21736 | if ([_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_OPEN, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_OPEN, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_CROSS, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_CROSS, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_POINT, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_POINT].includes(msg.type)) {
|
21737 | process = true;
|
21738 | }
|
21739 |
|
21740 | if (!process) {
|
21741 | return {};
|
21742 | }
|
21743 |
|
21744 | var fromBounds = activationBounds(msg.from, actors);
|
21745 | var toBounds = activationBounds(msg.to, actors);
|
21746 | var fromIdx = fromBounds[0] <= toBounds[0] ? 1 : 0;
|
21747 | var toIdx = fromBounds[0] < toBounds[0] ? 0 : 1;
|
21748 | var allBounds = fromBounds.concat(toBounds);
|
21749 | var boundedWidth = Math.abs(toBounds[toIdx] - fromBounds[fromIdx]);
|
21750 |
|
21751 | if (msg.wrap && msg.message) {
|
21752 | msg.message = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].wrapLabel(msg.message, Math.max(boundedWidth + 2 * conf.wrapPadding, conf.width), messageFont(conf));
|
21753 | }
|
21754 |
|
21755 | var msgDims = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(msg.message, messageFont(conf));
|
21756 | return {
|
21757 | width: Math.max(msg.wrap ? 0 : msgDims.width + 2 * conf.wrapPadding, boundedWidth + 2 * conf.wrapPadding, conf.width),
|
21758 | height: 0,
|
21759 | startx: fromBounds[fromIdx],
|
21760 | stopx: toBounds[toIdx],
|
21761 | starty: 0,
|
21762 | stopy: 0,
|
21763 | message: msg.message,
|
21764 | type: msg.type,
|
21765 | wrap: msg.wrap,
|
21766 | fromBounds: Math.min.apply(null, allBounds),
|
21767 | toBounds: Math.max.apply(null, allBounds)
|
21768 | };
|
21769 | };
|
21770 |
|
21771 | var calculateLoopBounds = function calculateLoopBounds(messages, actors) {
|
21772 | var loops = {};
|
21773 | var stack = [];
|
21774 | var current, noteModel, msgModel;
|
21775 | messages.forEach(function (msg) {
|
21776 | msg.id = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].random({
|
21777 | length: 10
|
21778 | });
|
21779 |
|
21780 | switch (msg.type) {
|
21781 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.LOOP_START:
|
21782 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ALT_START:
|
21783 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.OPT_START:
|
21784 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.PAR_START:
|
21785 | stack.push({
|
21786 | id: msg.id,
|
21787 | msg: msg.message,
|
21788 | from: Number.MAX_SAFE_INTEGER,
|
21789 | to: Number.MIN_SAFE_INTEGER,
|
21790 | width: 0
|
21791 | });
|
21792 | break;
|
21793 |
|
21794 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ALT_ELSE:
|
21795 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.PAR_AND:
|
21796 | if (msg.message) {
|
21797 | current = stack.pop();
|
21798 | loops[current.id] = current;
|
21799 | loops[msg.id] = current;
|
21800 | stack.push(current);
|
21801 | }
|
21802 |
|
21803 | break;
|
21804 |
|
21805 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.LOOP_END:
|
21806 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ALT_END:
|
21807 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.OPT_END:
|
21808 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.PAR_END:
|
21809 | current = stack.pop();
|
21810 | loops[current.id] = current;
|
21811 | break;
|
21812 |
|
21813 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ACTIVE_START:
|
21814 | {
|
21815 | var actorRect = actors[msg.from ? msg.from.actor : msg.to.actor];
|
21816 | var stackedSize = actorActivations(msg.from ? msg.from.actor : msg.to.actor).length;
|
21817 | var x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
|
21818 | var toAdd = {
|
21819 | startx: x,
|
21820 | stopx: x + conf.activationWidth,
|
21821 | actor: msg.from.actor,
|
21822 | enabled: true
|
21823 | };
|
21824 | bounds.activations.push(toAdd);
|
21825 | }
|
21826 | break;
|
21827 |
|
21828 | case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ACTIVE_END:
|
21829 | {
|
21830 | var lastActorActivationIdx = bounds.activations.map(function (a) {
|
21831 | return a.actor;
|
21832 | }).lastIndexOf(msg.from.actor);
|
21833 | delete bounds.activations.splice(lastActorActivationIdx, 1)[0];
|
21834 | }
|
21835 | break;
|
21836 | }
|
21837 |
|
21838 | var isNote = msg.placement !== undefined;
|
21839 |
|
21840 | if (isNote) {
|
21841 | noteModel = buildNoteModel(msg, actors);
|
21842 | msg.noteModel = noteModel;
|
21843 | stack.forEach(function (stk) {
|
21844 | current = stk;
|
21845 | current.from = Math.min(current.from, noteModel.startx);
|
21846 | current.to = Math.max(current.to, noteModel.startx + noteModel.width);
|
21847 | current.width = Math.max(current.width, Math.abs(current.from - current.to)) - conf.labelBoxWidth;
|
21848 | });
|
21849 | } else {
|
21850 | msgModel = buildMessageModel(msg, actors);
|
21851 | msg.msgModel = msgModel;
|
21852 |
|
21853 | if (msgModel.startx && msgModel.stopx && stack.length > 0) {
|
21854 | stack.forEach(function (stk) {
|
21855 | current = stk;
|
21856 |
|
21857 | if (msgModel.startx === msgModel.stopx) {
|
21858 | var from = actors[msg.from];
|
21859 | var to = actors[msg.to];
|
21860 | current.from = Math.min(from.x - msgModel.width / 2, from.x - from.width / 2, current.from);
|
21861 | current.to = Math.max(to.x + msgModel.width / 2, to.x + from.width / 2, current.to);
|
21862 | current.width = Math.max(current.width, Math.abs(current.to - current.from)) - conf.labelBoxWidth;
|
21863 | } else {
|
21864 | current.from = Math.min(msgModel.startx, current.from);
|
21865 | current.to = Math.max(msgModel.stopx, current.to);
|
21866 | current.width = Math.max(current.width, msgModel.width) - conf.labelBoxWidth;
|
21867 | }
|
21868 | });
|
21869 | }
|
21870 | }
|
21871 | });
|
21872 | bounds.activations = [];
|
21873 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Loop type widths:', loops);
|
21874 | return loops;
|
21875 | };
|
21876 |
|
21877 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
21878 | bounds: bounds,
|
21879 | drawActors: drawActors,
|
21880 | drawActorsPopup: drawActorsPopup,
|
21881 | setConf: setConf,
|
21882 | draw: draw
|
21883 | });
|
21884 |
|
21885 | /***/ }),
|
21886 |
|
21887 | /***/ "./src/diagrams/sequence/styles.js":
|
21888 | /*!*****************************************!*\
|
21889 | !*** ./src/diagrams/sequence/styles.js ***!
|
21890 | \*****************************************/
|
21891 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
21892 |
|
21893 | "use strict";
|
21894 | __webpack_require__.r(__webpack_exports__);
|
21895 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
21896 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
21897 | /* harmony export */ });
|
21898 | var getStyles = function getStyles(options) {
|
21899 | 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");
|
21900 | };
|
21901 |
|
21902 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
21903 |
|
21904 | /***/ }),
|
21905 |
|
21906 | /***/ "./src/diagrams/sequence/svgDraw.js":
|
21907 | /*!******************************************!*\
|
21908 | !*** ./src/diagrams/sequence/svgDraw.js ***!
|
21909 | \******************************************/
|
21910 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
21911 |
|
21912 | "use strict";
|
21913 | __webpack_require__.r(__webpack_exports__);
|
21914 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
21915 | /* harmony export */ "drawRect": () => (/* binding */ drawRect),
|
21916 | /* harmony export */ "drawPopup": () => (/* binding */ drawPopup),
|
21917 | /* harmony export */ "drawImage": () => (/* binding */ drawImage),
|
21918 | /* harmony export */ "drawEmbeddedImage": () => (/* binding */ drawEmbeddedImage),
|
21919 | /* harmony export */ "popupMenu": () => (/* binding */ popupMenu),
|
21920 | /* harmony export */ "popdownMenu": () => (/* binding */ popdownMenu),
|
21921 | /* harmony export */ "drawText": () => (/* binding */ drawText),
|
21922 | /* harmony export */ "drawLabel": () => (/* binding */ drawLabel),
|
21923 | /* harmony export */ "fixLifeLineHeights": () => (/* binding */ fixLifeLineHeights),
|
21924 | /* harmony export */ "drawActor": () => (/* binding */ drawActor),
|
21925 | /* harmony export */ "anchorElement": () => (/* binding */ anchorElement),
|
21926 | /* harmony export */ "drawActivation": () => (/* binding */ drawActivation),
|
21927 | /* harmony export */ "drawLoop": () => (/* binding */ drawLoop),
|
21928 | /* harmony export */ "drawBackgroundRect": () => (/* binding */ drawBackgroundRect),
|
21929 | /* harmony export */ "insertDatabaseIcon": () => (/* binding */ insertDatabaseIcon),
|
21930 | /* harmony export */ "insertComputerIcon": () => (/* binding */ insertComputerIcon),
|
21931 | /* harmony export */ "insertClockIcon": () => (/* binding */ insertClockIcon),
|
21932 | /* harmony export */ "insertArrowHead": () => (/* binding */ insertArrowHead),
|
21933 | /* harmony export */ "insertArrowFilledHead": () => (/* binding */ insertArrowFilledHead),
|
21934 | /* harmony export */ "insertSequenceNumber": () => (/* binding */ insertSequenceNumber),
|
21935 | /* harmony export */ "insertArrowCrossHead": () => (/* binding */ insertArrowCrossHead),
|
21936 | /* harmony export */ "getTextObj": () => (/* binding */ getTextObj),
|
21937 | /* harmony export */ "getNoteRect": () => (/* binding */ getNoteRect),
|
21938 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
21939 | /* harmony export */ });
|
21940 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
21941 | /* harmony import */ var _interactionDb__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../interactionDb */ "./src/interactionDb.js");
|
21942 |
|
21943 |
|
21944 | var drawRect = function drawRect(elem, rectData) {
|
21945 | var rectElem = elem.append('rect');
|
21946 | rectElem.attr('x', rectData.x);
|
21947 | rectElem.attr('y', rectData.y);
|
21948 | rectElem.attr('fill', rectData.fill);
|
21949 | rectElem.attr('stroke', rectData.stroke);
|
21950 | rectElem.attr('width', rectData.width);
|
21951 | rectElem.attr('height', rectData.height);
|
21952 | rectElem.attr('rx', rectData.rx);
|
21953 | rectElem.attr('ry', rectData.ry);
|
21954 |
|
21955 | if (typeof rectData.class !== 'undefined') {
|
21956 | rectElem.attr('class', rectData.class);
|
21957 | }
|
21958 |
|
21959 | return rectElem;
|
21960 | };
|
21961 |
|
21962 | var sanitizeUrl = function sanitizeUrl(s) {
|
21963 | return s.replace(/&/g, '&').replace(/</g, '<').replace(/javascript:/g, '');
|
21964 | };
|
21965 |
|
21966 | var addPopupInteraction = function addPopupInteraction(id, actorCnt) {
|
21967 | (0,_interactionDb__WEBPACK_IMPORTED_MODULE_0__.addFunction)(function () {
|
21968 | var arr = document.querySelectorAll(id);
|
21969 | arr[0].addEventListener('mouseover', function () {
|
21970 | popupMenuUpFunc('actor' + actorCnt + '_popup');
|
21971 | });
|
21972 | arr[0].addEventListener('mouseout', function () {
|
21973 | popupMenuDownFunc('actor' + actorCnt + '_popup');
|
21974 | });
|
21975 | });
|
21976 | };
|
21977 |
|
21978 | var drawPopup = function drawPopup(elem, actor, minMenuWidth, textAttrs, forceMenus) {
|
21979 | if (actor.links === undefined || actor.links === null || Object.keys(actor.links).length === 0) {
|
21980 | return {
|
21981 | height: 0,
|
21982 | width: 0
|
21983 | };
|
21984 | }
|
21985 |
|
21986 | var links = actor.links;
|
21987 | var actorCnt = actor.actorCnt;
|
21988 | var rectData = actor.rectData;
|
21989 | var displayValue = 'none';
|
21990 |
|
21991 | if (forceMenus) {
|
21992 | displayValue = 'block !important';
|
21993 | }
|
21994 |
|
21995 | var g = elem.append('g');
|
21996 | g.attr('id', 'actor' + actorCnt + '_popup');
|
21997 | g.attr('class', 'actorPopupMenu');
|
21998 | g.attr('display', displayValue);
|
21999 | addPopupInteraction('#actor' + actorCnt + '_popup', actorCnt);
|
22000 | var actorClass = '';
|
22001 |
|
22002 | if (typeof rectData.class !== 'undefined') {
|
22003 | actorClass = ' ' + rectData.class;
|
22004 | }
|
22005 |
|
22006 | var menuWidth = rectData.width > minMenuWidth ? rectData.width : minMenuWidth;
|
22007 | var rectElem = g.append('rect');
|
22008 | rectElem.attr('class', 'actorPopupMenuPanel' + actorClass);
|
22009 | rectElem.attr('x', rectData.x);
|
22010 | rectElem.attr('y', rectData.height);
|
22011 | rectElem.attr('fill', rectData.fill);
|
22012 | rectElem.attr('stroke', rectData.stroke);
|
22013 | rectElem.attr('width', menuWidth);
|
22014 | rectElem.attr('height', rectData.height);
|
22015 | rectElem.attr('rx', rectData.rx);
|
22016 | rectElem.attr('ry', rectData.ry);
|
22017 |
|
22018 | if (links != null) {
|
22019 | var linkY = 20;
|
22020 |
|
22021 | for (var key in links) {
|
22022 | var linkElem = g.append('a');
|
22023 | var sanitizedLink = sanitizeUrl(links[key]);
|
22024 | linkElem.attr('xlink:href', sanitizedLink);
|
22025 | linkElem.attr('target', '_blank');
|
22026 |
|
22027 | _drawMenuItemTextCandidateFunc(textAttrs)(key, linkElem, rectData.x + 10, rectData.height + linkY, menuWidth, 20, {
|
22028 | class: 'actor'
|
22029 | }, textAttrs);
|
22030 |
|
22031 | linkY += 30;
|
22032 | }
|
22033 | }
|
22034 |
|
22035 | rectElem.attr('height', linkY);
|
22036 | return {
|
22037 | height: rectData.height + linkY,
|
22038 | width: menuWidth
|
22039 | };
|
22040 | };
|
22041 | var drawImage = function drawImage(elem, x, y, link) {
|
22042 | var imageElem = elem.append('image');
|
22043 | imageElem.attr('x', x);
|
22044 | imageElem.attr('y', y);
|
22045 | var sanitizedLink = sanitizeUrl(link);
|
22046 | imageElem.attr('xlink:href', sanitizedLink);
|
22047 | };
|
22048 | var drawEmbeddedImage = function drawEmbeddedImage(elem, x, y, link) {
|
22049 | var imageElem = elem.append('use');
|
22050 | imageElem.attr('x', x);
|
22051 | imageElem.attr('y', y);
|
22052 | var sanitizedLink = sanitizeUrl(link);
|
22053 | imageElem.attr('xlink:href', '#' + sanitizedLink);
|
22054 | };
|
22055 | var popupMenu = function popupMenu(popid) {
|
22056 | return "var pu = document.getElementById('" + popid + "'); if (pu != null) { pu.style.display = 'block'; }";
|
22057 | };
|
22058 | var popdownMenu = function popdownMenu(popid) {
|
22059 | return "var pu = document.getElementById('" + popid + "'); if (pu != null) { pu.style.display = 'none'; }";
|
22060 | };
|
22061 |
|
22062 | var popupMenuUpFunc = function popupMenuUpFunc(popupId) {
|
22063 | var pu = document.getElementById(popupId);
|
22064 |
|
22065 | if (pu != null) {
|
22066 | pu.style.display = 'block';
|
22067 | }
|
22068 | };
|
22069 |
|
22070 | var popupMenuDownFunc = function popupMenuDownFunc(popupId) {
|
22071 | var pu = document.getElementById(popupId);
|
22072 |
|
22073 | if (pu != null) {
|
22074 | pu.style.display = 'none';
|
22075 | }
|
22076 | };
|
22077 |
|
22078 | var drawText = function drawText(elem, textData) {
|
22079 | var prevTextHeight = 0,
|
22080 | textHeight = 0;
|
22081 | var lines = textData.text.split(_common_common__WEBPACK_IMPORTED_MODULE_1__["default"].lineBreakRegex);
|
22082 | var textElems = [];
|
22083 | var dy = 0;
|
22084 |
|
22085 | var yfunc = function yfunc() {
|
22086 | return textData.y;
|
22087 | };
|
22088 |
|
22089 | if (typeof textData.valign !== 'undefined' && typeof textData.textMargin !== 'undefined' && textData.textMargin > 0) {
|
22090 | switch (textData.valign) {
|
22091 | case 'top':
|
22092 | case 'start':
|
22093 | yfunc = function yfunc() {
|
22094 | return Math.round(textData.y + textData.textMargin);
|
22095 | };
|
22096 |
|
22097 | break;
|
22098 |
|
22099 | case 'middle':
|
22100 | case 'center':
|
22101 | yfunc = function yfunc() {
|
22102 | return Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2);
|
22103 | };
|
22104 |
|
22105 | break;
|
22106 |
|
22107 | case 'bottom':
|
22108 | case 'end':
|
22109 | yfunc = function yfunc() {
|
22110 | return Math.round(textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin);
|
22111 | };
|
22112 |
|
22113 | break;
|
22114 | }
|
22115 | }
|
22116 |
|
22117 | if (typeof textData.anchor !== 'undefined' && typeof textData.textMargin !== 'undefined' && typeof textData.width !== 'undefined') {
|
22118 | switch (textData.anchor) {
|
22119 | case 'left':
|
22120 | case 'start':
|
22121 | textData.x = Math.round(textData.x + textData.textMargin);
|
22122 | textData.anchor = 'start';
|
22123 | textData.dominantBaseline = 'text-after-edge';
|
22124 | textData.alignmentBaseline = 'middle';
|
22125 | break;
|
22126 |
|
22127 | case 'middle':
|
22128 | case 'center':
|
22129 | textData.x = Math.round(textData.x + textData.width / 2);
|
22130 | textData.anchor = 'middle';
|
22131 | textData.dominantBaseline = 'middle';
|
22132 | textData.alignmentBaseline = 'middle';
|
22133 | break;
|
22134 |
|
22135 | case 'right':
|
22136 | case 'end':
|
22137 | textData.x = Math.round(textData.x + textData.width - textData.textMargin);
|
22138 | textData.anchor = 'end';
|
22139 | textData.dominantBaseline = 'text-before-edge';
|
22140 | textData.alignmentBaseline = 'middle';
|
22141 | break;
|
22142 | }
|
22143 | }
|
22144 |
|
22145 | for (var i = 0; i < lines.length; i++) {
|
22146 | var line = lines[i];
|
22147 |
|
22148 | if (typeof textData.textMargin !== 'undefined' && textData.textMargin === 0 && typeof textData.fontSize !== 'undefined') {
|
22149 | dy = i * textData.fontSize;
|
22150 | }
|
22151 |
|
22152 | var textElem = elem.append('text');
|
22153 | textElem.attr('x', textData.x);
|
22154 | textElem.attr('y', yfunc());
|
22155 |
|
22156 | if (typeof textData.anchor !== 'undefined') {
|
22157 | textElem.attr('text-anchor', textData.anchor).attr('dominant-baseline', textData.dominantBaseline).attr('alignment-baseline', textData.alignmentBaseline);
|
22158 | }
|
22159 |
|
22160 | if (typeof textData.fontFamily !== 'undefined') {
|
22161 | textElem.style('font-family', textData.fontFamily);
|
22162 | }
|
22163 |
|
22164 | if (typeof textData.fontSize !== 'undefined') {
|
22165 | textElem.style('font-size', textData.fontSize);
|
22166 | }
|
22167 |
|
22168 | if (typeof textData.fontWeight !== 'undefined') {
|
22169 | textElem.style('font-weight', textData.fontWeight);
|
22170 | }
|
22171 |
|
22172 | if (typeof textData.fill !== 'undefined') {
|
22173 | textElem.attr('fill', textData.fill);
|
22174 | }
|
22175 |
|
22176 | if (typeof textData.class !== 'undefined') {
|
22177 | textElem.attr('class', textData.class);
|
22178 | }
|
22179 |
|
22180 | if (typeof textData.dy !== 'undefined') {
|
22181 | textElem.attr('dy', textData.dy);
|
22182 | } else if (dy !== 0) {
|
22183 | textElem.attr('dy', dy);
|
22184 | }
|
22185 |
|
22186 | if (textData.tspan) {
|
22187 | var span = textElem.append('tspan');
|
22188 | span.attr('x', textData.x);
|
22189 |
|
22190 | if (typeof textData.fill !== 'undefined') {
|
22191 | span.attr('fill', textData.fill);
|
22192 | }
|
22193 |
|
22194 | span.text(line);
|
22195 | } else {
|
22196 | textElem.text(line);
|
22197 | }
|
22198 |
|
22199 | if (typeof textData.valign !== 'undefined' && typeof textData.textMargin !== 'undefined' && textData.textMargin > 0) {
|
22200 | textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
|
22201 | prevTextHeight = textHeight;
|
22202 | }
|
22203 |
|
22204 | textElems.push(textElem);
|
22205 | }
|
22206 |
|
22207 | return textElems;
|
22208 | };
|
22209 | var drawLabel = function drawLabel(elem, txtObject) {
|
22210 | function genPoints(x, y, width, height, cut) {
|
22211 | return x + ',' + y + ' ' + (x + width) + ',' + y + ' ' + (x + width) + ',' + (y + height - cut) + ' ' + (x + width - cut * 1.2) + ',' + (y + height) + ' ' + x + ',' + (y + height);
|
22212 | }
|
22213 |
|
22214 | var polygon = elem.append('polygon');
|
22215 | polygon.attr('points', genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7));
|
22216 | polygon.attr('class', 'labelBox');
|
22217 | txtObject.y = txtObject.y + txtObject.height / 2;
|
22218 | drawText(elem, txtObject);
|
22219 | return polygon;
|
22220 | };
|
22221 | var actorCnt = -1;
|
22222 | var fixLifeLineHeights = function fixLifeLineHeights(diagram, bounds) {
|
22223 | if (!diagram.selectAll) return;
|
22224 | diagram.selectAll('.actor-line').attr('class', '200').attr('y2', bounds - 55);
|
22225 | };
|
22226 | /**
|
22227 | * Draws an actor in the diagram with the attached line
|
22228 | * @param elem - The diagram we'll draw to.
|
22229 | * @param actor - The actor to draw.
|
22230 | * @param conf - drawText implementation discriminator object
|
22231 | */
|
22232 |
|
22233 | var drawActorTypeParticipant = function drawActorTypeParticipant(elem, actor, conf) {
|
22234 | var center = actor.x + actor.width / 2;
|
22235 | var boxpluslineGroup = elem.append('g');
|
22236 | var g = boxpluslineGroup;
|
22237 |
|
22238 | if (actor.y === 0) {
|
22239 | actorCnt++;
|
22240 | 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');
|
22241 | g = boxpluslineGroup.append('g');
|
22242 | actor.actorCnt = actorCnt;
|
22243 |
|
22244 | if (actor.links != null) {
|
22245 | g.attr('id', 'root-' + actorCnt);
|
22246 | addPopupInteraction('#root-' + actorCnt, actorCnt);
|
22247 | }
|
22248 | }
|
22249 |
|
22250 | var rect = getNoteRect();
|
22251 | var cssclass = 'actor';
|
22252 |
|
22253 | if (actor.properties != null && actor.properties['class']) {
|
22254 | cssclass = actor.properties['class'];
|
22255 | } else {
|
22256 | rect.fill = '#eaeaea';
|
22257 | }
|
22258 |
|
22259 | rect.x = actor.x;
|
22260 | rect.y = actor.y;
|
22261 | rect.width = actor.width;
|
22262 | rect.height = actor.height;
|
22263 | rect.class = cssclass;
|
22264 | rect.rx = 3;
|
22265 | rect.ry = 3;
|
22266 | var rectElem = drawRect(g, rect);
|
22267 | actor.rectData = rect;
|
22268 |
|
22269 | if (actor.properties != null && actor.properties['icon']) {
|
22270 | var iconSrc = actor.properties['icon'].trim();
|
22271 |
|
22272 | if (iconSrc.charAt(0) === '@') {
|
22273 | drawEmbeddedImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc.substr(1));
|
22274 | } else {
|
22275 | drawImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc);
|
22276 | }
|
22277 | }
|
22278 |
|
22279 | _drawTextCandidateFunc(conf)(actor.description, g, rect.x, rect.y, rect.width, rect.height, {
|
22280 | class: 'actor'
|
22281 | }, conf);
|
22282 |
|
22283 | var height = actor.height;
|
22284 |
|
22285 | if (rectElem.node) {
|
22286 | var bounds = rectElem.node().getBBox();
|
22287 | actor.height = bounds.height;
|
22288 | height = bounds.height;
|
22289 | }
|
22290 |
|
22291 | return height;
|
22292 | };
|
22293 |
|
22294 | var drawActorTypeActor = function drawActorTypeActor(elem, actor, conf) {
|
22295 | var center = actor.x + actor.width / 2;
|
22296 |
|
22297 | if (actor.y === 0) {
|
22298 | actorCnt++;
|
22299 | 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');
|
22300 | }
|
22301 |
|
22302 | var actElem = elem.append('g');
|
22303 | actElem.attr('class', 'actor-man');
|
22304 | var rect = getNoteRect();
|
22305 | rect.x = actor.x;
|
22306 | rect.y = actor.y;
|
22307 | rect.fill = '#eaeaea';
|
22308 | rect.width = actor.width;
|
22309 | rect.height = actor.height;
|
22310 | rect.class = 'actor';
|
22311 | rect.rx = 3;
|
22312 | rect.ry = 3; // drawRect(actElem, rect);
|
22313 |
|
22314 | 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);
|
22315 | 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);
|
22316 | actElem.append('line').attr('x1', center - 18).attr('y1', actor.y + 60).attr('x2', center).attr('y2', actor.y + 45);
|
22317 | actElem.append('line').attr('x1', center).attr('y1', actor.y + 45).attr('x2', center + 16).attr('y2', actor.y + 60);
|
22318 | var circle = actElem.append('circle');
|
22319 | circle.attr('cx', actor.x + actor.width / 2);
|
22320 | circle.attr('cy', actor.y + 10);
|
22321 | circle.attr('r', 15);
|
22322 | circle.attr('width', actor.width);
|
22323 | circle.attr('height', actor.height);
|
22324 | var bounds = actElem.node().getBBox();
|
22325 | actor.height = bounds.height;
|
22326 |
|
22327 | _drawTextCandidateFunc(conf)(actor.description, actElem, rect.x, rect.y + 35, rect.width, rect.height, {
|
22328 | class: 'actor'
|
22329 | }, conf);
|
22330 |
|
22331 | return actor.height;
|
22332 | };
|
22333 |
|
22334 | var drawActor = function drawActor(elem, actor, conf) {
|
22335 | switch (actor.type) {
|
22336 | case 'actor':
|
22337 | return drawActorTypeActor(elem, actor, conf);
|
22338 |
|
22339 | case 'participant':
|
22340 | return drawActorTypeParticipant(elem, actor, conf);
|
22341 | }
|
22342 | };
|
22343 | var anchorElement = function anchorElement(elem) {
|
22344 | return elem.append('g');
|
22345 | };
|
22346 | /**
|
22347 | * Draws an activation in the diagram
|
22348 | * @param elem - element to append activation rect.
|
22349 | * @param bounds - activation box bounds.
|
22350 | * @param verticalPos - precise y cooridnate of bottom activation box edge.
|
22351 | * @param conf - sequence diagram config object.
|
22352 | * @param actorActivations - number of activations on the actor.
|
22353 | */
|
22354 |
|
22355 | var drawActivation = function drawActivation(elem, bounds, verticalPos, conf, actorActivations) {
|
22356 | var rect = getNoteRect();
|
22357 | var g = bounds.anchored;
|
22358 | rect.x = bounds.startx;
|
22359 | rect.y = bounds.starty;
|
22360 | rect.class = 'activation' + actorActivations % 3; // Will evaluate to 0, 1 or 2
|
22361 |
|
22362 | rect.width = bounds.stopx - bounds.startx;
|
22363 | rect.height = verticalPos - bounds.starty;
|
22364 | drawRect(g, rect);
|
22365 | };
|
22366 | /**
|
22367 | * Draws a loop in the diagram
|
22368 | * @param elem - elemenet to append the loop to.
|
22369 | * @param loopModel - loopModel of the given loop.
|
22370 | * @param labelText - Text within the loop.
|
22371 | * @param conf - diagrom configuration
|
22372 | */
|
22373 |
|
22374 | var drawLoop = function drawLoop(elem, loopModel, labelText, conf) {
|
22375 | var boxMargin = conf.boxMargin,
|
22376 | boxTextMargin = conf.boxTextMargin,
|
22377 | labelBoxHeight = conf.labelBoxHeight,
|
22378 | labelBoxWidth = conf.labelBoxWidth,
|
22379 | fontFamily = conf.messageFontFamily,
|
22380 | fontSize = conf.messageFontSize,
|
22381 | fontWeight = conf.messageFontWeight;
|
22382 | var g = elem.append('g');
|
22383 |
|
22384 | var drawLoopLine = function drawLoopLine(startx, starty, stopx, stopy) {
|
22385 | return g.append('line').attr('x1', startx).attr('y1', starty).attr('x2', stopx).attr('y2', stopy).attr('class', 'loopLine');
|
22386 | };
|
22387 |
|
22388 | drawLoopLine(loopModel.startx, loopModel.starty, loopModel.stopx, loopModel.starty);
|
22389 | drawLoopLine(loopModel.stopx, loopModel.starty, loopModel.stopx, loopModel.stopy);
|
22390 | drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy);
|
22391 | drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy);
|
22392 |
|
22393 | if (typeof loopModel.sections !== 'undefined') {
|
22394 | loopModel.sections.forEach(function (item) {
|
22395 | drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style('stroke-dasharray', '3, 3');
|
22396 | });
|
22397 | }
|
22398 |
|
22399 | var txt = getTextObj();
|
22400 | txt.text = labelText;
|
22401 | txt.x = loopModel.startx;
|
22402 | txt.y = loopModel.starty;
|
22403 | txt.fontFamily = fontFamily;
|
22404 | txt.fontSize = fontSize;
|
22405 | txt.fontWeight = fontWeight;
|
22406 | txt.anchor = 'middle';
|
22407 | txt.valign = 'middle';
|
22408 | txt.tspan = false;
|
22409 | txt.width = labelBoxWidth || 50;
|
22410 | txt.height = labelBoxHeight || 20;
|
22411 | txt.textMargin = boxTextMargin;
|
22412 | txt.class = 'labelText';
|
22413 | drawLabel(g, txt);
|
22414 | txt = getTextObj();
|
22415 | txt.text = loopModel.title;
|
22416 | txt.x = loopModel.startx + labelBoxWidth / 2 + (loopModel.stopx - loopModel.startx) / 2;
|
22417 | txt.y = loopModel.starty + boxMargin + boxTextMargin;
|
22418 | txt.anchor = 'middle';
|
22419 | txt.valign = 'middle';
|
22420 | txt.textMargin = boxTextMargin;
|
22421 | txt.class = 'loopText';
|
22422 | txt.fontFamily = fontFamily;
|
22423 | txt.fontSize = fontSize;
|
22424 | txt.fontWeight = fontWeight;
|
22425 | txt.wrap = true;
|
22426 | var textElem = drawText(g, txt);
|
22427 |
|
22428 | if (typeof loopModel.sectionTitles !== 'undefined') {
|
22429 | loopModel.sectionTitles.forEach(function (item, idx) {
|
22430 | if (item.message) {
|
22431 | txt.text = item.message;
|
22432 | txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2;
|
22433 | txt.y = loopModel.sections[idx].y + boxMargin + boxTextMargin;
|
22434 | txt.class = 'loopText';
|
22435 | txt.anchor = 'middle';
|
22436 | txt.valign = 'middle';
|
22437 | txt.tspan = false;
|
22438 | txt.fontFamily = fontFamily;
|
22439 | txt.fontSize = fontSize;
|
22440 | txt.fontWeight = fontWeight;
|
22441 | txt.wrap = loopModel.wrap;
|
22442 | textElem = drawText(g, txt);
|
22443 | var sectionHeight = Math.round(textElem.map(function (te) {
|
22444 | return (te._groups || te)[0][0].getBBox().height;
|
22445 | }).reduce(function (acc, curr) {
|
22446 | return acc + curr;
|
22447 | }));
|
22448 | loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin);
|
22449 | }
|
22450 | });
|
22451 | }
|
22452 |
|
22453 | loopModel.height = Math.round(loopModel.stopy - loopModel.starty);
|
22454 | return g;
|
22455 | };
|
22456 | /**
|
22457 | * Draws a background rectangle
|
22458 | * @param elem diagram (reference for bounds)
|
22459 | * @param bounds shape of the rectangle
|
22460 | */
|
22461 |
|
22462 | var drawBackgroundRect = function drawBackgroundRect(elem, bounds) {
|
22463 | var rectElem = drawRect(elem, {
|
22464 | x: bounds.startx,
|
22465 | y: bounds.starty,
|
22466 | width: bounds.stopx - bounds.startx,
|
22467 | height: bounds.stopy - bounds.starty,
|
22468 | fill: bounds.fill,
|
22469 | class: 'rect'
|
22470 | });
|
22471 | rectElem.lower();
|
22472 | };
|
22473 | var insertDatabaseIcon = function insertDatabaseIcon(elem) {
|
22474 | 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');
|
22475 | };
|
22476 | var insertComputerIcon = function insertComputerIcon(elem) {
|
22477 | 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');
|
22478 | };
|
22479 | var insertClockIcon = function insertClockIcon(elem) {
|
22480 | 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');
|
22481 | };
|
22482 | /**
|
22483 | * Setup arrow head and define the marker. The result is appended to the svg.
|
22484 | */
|
22485 |
|
22486 | var insertArrowHead = function insertArrowHead(elem) {
|
22487 | 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
|
22488 | };
|
22489 | /**
|
22490 | * Setup arrow head and define the marker. The result is appended to the svg.
|
22491 | */
|
22492 |
|
22493 | var insertArrowFilledHead = function insertArrowFilledHead(elem) {
|
22494 | 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');
|
22495 | };
|
22496 | /**
|
22497 | * Setup node number. The result is appended to the svg.
|
22498 | */
|
22499 |
|
22500 | var insertSequenceNumber = function insertSequenceNumber(elem) {
|
22501 | 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');
|
22502 | };
|
22503 | /**
|
22504 | * Setup arrow head and define the marker. The result is appended to the svg.
|
22505 | */
|
22506 |
|
22507 | var insertArrowCrossHead = function insertArrowCrossHead(elem) {
|
22508 | var defs = elem.append('defs');
|
22509 | 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
|
22510 |
|
22511 | 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
|
22512 |
|
22513 | 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
|
22514 | };
|
22515 | var getTextObj = function getTextObj() {
|
22516 | return {
|
22517 | x: 0,
|
22518 | y: 0,
|
22519 | fill: undefined,
|
22520 | anchor: undefined,
|
22521 | style: '#666',
|
22522 | width: undefined,
|
22523 | height: undefined,
|
22524 | textMargin: 0,
|
22525 | rx: 0,
|
22526 | ry: 0,
|
22527 | tspan: true,
|
22528 | valign: undefined
|
22529 | };
|
22530 | };
|
22531 | var getNoteRect = function getNoteRect() {
|
22532 | return {
|
22533 | x: 0,
|
22534 | y: 0,
|
22535 | fill: '#EDF2AE',
|
22536 | stroke: '#666',
|
22537 | width: 100,
|
22538 | anchor: 'start',
|
22539 | height: 100,
|
22540 | rx: 0,
|
22541 | ry: 0
|
22542 | };
|
22543 | };
|
22544 |
|
22545 | var _drawTextCandidateFunc = function () {
|
22546 | function byText(content, g, x, y, width, height, textAttrs) {
|
22547 | var text = g.append('text').attr('x', x + width / 2).attr('y', y + height / 2 + 5).style('text-anchor', 'middle').text(content);
|
22548 |
|
22549 | _setTextAttrs(text, textAttrs);
|
22550 | }
|
22551 |
|
22552 | function byTspan(content, g, x, y, width, height, textAttrs, conf) {
|
22553 | var actorFontSize = conf.actorFontSize,
|
22554 | actorFontFamily = conf.actorFontFamily,
|
22555 | actorFontWeight = conf.actorFontWeight;
|
22556 | var lines = content.split(_common_common__WEBPACK_IMPORTED_MODULE_1__["default"].lineBreakRegex);
|
22557 |
|
22558 | for (var i = 0; i < lines.length; i++) {
|
22559 | var dy = i * actorFontSize - actorFontSize * (lines.length - 1) / 2;
|
22560 | 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);
|
22561 | text.append('tspan').attr('x', x + width / 2).attr('dy', dy).text(lines[i]);
|
22562 | text.attr('y', y + height / 2.0).attr('dominant-baseline', 'central').attr('alignment-baseline', 'central');
|
22563 |
|
22564 | _setTextAttrs(text, textAttrs);
|
22565 | }
|
22566 | }
|
22567 |
|
22568 | function byFo(content, g, x, y, width, height, textAttrs, conf) {
|
22569 | var s = g.append('switch');
|
22570 | var f = s.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height);
|
22571 | var text = f.append('xhtml:div').style('display', 'table').style('height', '100%').style('width', '100%');
|
22572 | text.append('div').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle').text(content);
|
22573 | byTspan(content, s, x, y, width, height, textAttrs, conf);
|
22574 |
|
22575 | _setTextAttrs(text, textAttrs);
|
22576 | }
|
22577 |
|
22578 | function _setTextAttrs(toText, fromTextAttrsDict) {
|
22579 | for (var key in fromTextAttrsDict) {
|
22580 | if (fromTextAttrsDict.hasOwnProperty(key)) {
|
22581 | // eslint-disable-line
|
22582 | toText.attr(key, fromTextAttrsDict[key]);
|
22583 | }
|
22584 | }
|
22585 | }
|
22586 |
|
22587 | return function (conf) {
|
22588 | return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
|
22589 | };
|
22590 | }();
|
22591 |
|
22592 | var _drawMenuItemTextCandidateFunc = function () {
|
22593 | function byText(content, g, x, y, width, height, textAttrs) {
|
22594 | var text = g.append('text').attr('x', x).attr('y', y).style('text-anchor', 'start').text(content);
|
22595 |
|
22596 | _setTextAttrs(text, textAttrs);
|
22597 | }
|
22598 |
|
22599 | function byTspan(content, g, x, y, width, height, textAttrs, conf) {
|
22600 | var actorFontSize = conf.actorFontSize,
|
22601 | actorFontFamily = conf.actorFontFamily,
|
22602 | actorFontWeight = conf.actorFontWeight;
|
22603 | var lines = content.split(_common_common__WEBPACK_IMPORTED_MODULE_1__["default"].lineBreakRegex);
|
22604 |
|
22605 | for (var i = 0; i < lines.length; i++) {
|
22606 | var dy = i * actorFontSize - actorFontSize * (lines.length - 1) / 2;
|
22607 | 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);
|
22608 | text.append('tspan').attr('x', x).attr('dy', dy).text(lines[i]);
|
22609 | text.attr('y', y + height / 2.0).attr('dominant-baseline', 'central').attr('alignment-baseline', 'central');
|
22610 |
|
22611 | _setTextAttrs(text, textAttrs);
|
22612 | }
|
22613 | }
|
22614 |
|
22615 | function byFo(content, g, x, y, width, height, textAttrs, conf) {
|
22616 | var s = g.append('switch');
|
22617 | var f = s.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height);
|
22618 | var text = f.append('xhtml:div').style('display', 'table').style('height', '100%').style('width', '100%');
|
22619 | text.append('div').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle').text(content);
|
22620 | byTspan(content, s, x, y, width, height, textAttrs, conf);
|
22621 |
|
22622 | _setTextAttrs(text, textAttrs);
|
22623 | }
|
22624 |
|
22625 | function _setTextAttrs(toText, fromTextAttrsDict) {
|
22626 | for (var key in fromTextAttrsDict) {
|
22627 | if (fromTextAttrsDict.hasOwnProperty(key)) {
|
22628 | // eslint-disable-line
|
22629 | toText.attr(key, fromTextAttrsDict[key]);
|
22630 | }
|
22631 | }
|
22632 | }
|
22633 |
|
22634 | return function (conf) {
|
22635 | return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
|
22636 | };
|
22637 | }();
|
22638 |
|
22639 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
22640 | drawRect: drawRect,
|
22641 | drawText: drawText,
|
22642 | drawLabel: drawLabel,
|
22643 | drawActor: drawActor,
|
22644 | drawPopup: drawPopup,
|
22645 | drawImage: drawImage,
|
22646 | drawEmbeddedImage: drawEmbeddedImage,
|
22647 | anchorElement: anchorElement,
|
22648 | drawActivation: drawActivation,
|
22649 | drawLoop: drawLoop,
|
22650 | drawBackgroundRect: drawBackgroundRect,
|
22651 | insertArrowHead: insertArrowHead,
|
22652 | insertArrowFilledHead: insertArrowFilledHead,
|
22653 | insertSequenceNumber: insertSequenceNumber,
|
22654 | insertArrowCrossHead: insertArrowCrossHead,
|
22655 | insertDatabaseIcon: insertDatabaseIcon,
|
22656 | insertComputerIcon: insertComputerIcon,
|
22657 | insertClockIcon: insertClockIcon,
|
22658 | getTextObj: getTextObj,
|
22659 | getNoteRect: getNoteRect,
|
22660 | popupMenu: popupMenu,
|
22661 | popdownMenu: popdownMenu,
|
22662 | fixLifeLineHeights: fixLifeLineHeights
|
22663 | });
|
22664 |
|
22665 | /***/ }),
|
22666 |
|
22667 | /***/ "./src/diagrams/state/id-cache.js":
|
22668 | /*!****************************************!*\
|
22669 | !*** ./src/diagrams/state/id-cache.js ***!
|
22670 | \****************************************/
|
22671 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
22672 |
|
22673 | "use strict";
|
22674 | __webpack_require__.r(__webpack_exports__);
|
22675 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
22676 | /* harmony export */ "set": () => (/* binding */ set),
|
22677 | /* harmony export */ "get": () => (/* binding */ get),
|
22678 | /* harmony export */ "keys": () => (/* binding */ keys),
|
22679 | /* harmony export */ "size": () => (/* binding */ size),
|
22680 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
22681 | /* harmony export */ });
|
22682 | var idCache = {};
|
22683 | var set = function set(key, val) {
|
22684 | idCache[key] = val;
|
22685 | };
|
22686 | var get = function get(k) {
|
22687 | return idCache[k];
|
22688 | };
|
22689 | var keys = function keys() {
|
22690 | return Object.keys(idCache);
|
22691 | };
|
22692 | var size = function size() {
|
22693 | return keys().length;
|
22694 | };
|
22695 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
22696 | get: get,
|
22697 | set: set,
|
22698 | keys: keys,
|
22699 | size: size
|
22700 | });
|
22701 |
|
22702 | /***/ }),
|
22703 |
|
22704 | /***/ "./src/diagrams/state/shapes.js":
|
22705 | /*!**************************************!*\
|
22706 | !*** ./src/diagrams/state/shapes.js ***!
|
22707 | \**************************************/
|
22708 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
22709 |
|
22710 | "use strict";
|
22711 | __webpack_require__.r(__webpack_exports__);
|
22712 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
22713 | /* harmony export */ "drawStartState": () => (/* binding */ drawStartState),
|
22714 | /* harmony export */ "drawDivider": () => (/* binding */ drawDivider),
|
22715 | /* harmony export */ "drawSimpleState": () => (/* binding */ drawSimpleState),
|
22716 | /* harmony export */ "drawDescrState": () => (/* binding */ drawDescrState),
|
22717 | /* harmony export */ "addTitleAndBox": () => (/* binding */ addTitleAndBox),
|
22718 | /* harmony export */ "drawText": () => (/* binding */ drawText),
|
22719 | /* harmony export */ "drawNote": () => (/* binding */ drawNote),
|
22720 | /* harmony export */ "drawState": () => (/* binding */ drawState),
|
22721 | /* harmony export */ "drawEdge": () => (/* binding */ drawEdge)
|
22722 | /* harmony export */ });
|
22723 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
22724 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
22725 | /* harmony import */ var _id_cache_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./id-cache.js */ "./src/diagrams/state/id-cache.js");
|
22726 | /* harmony import */ var _stateDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateDb */ "./src/diagrams/state/stateDb.js");
|
22727 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
22728 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
22729 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
22730 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
22731 | 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; } } }; }
|
22732 |
|
22733 | 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); }
|
22734 |
|
22735 | 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; }
|
22736 |
|
22737 |
|
22738 |
|
22739 |
|
22740 |
|
22741 |
|
22742 |
|
22743 | // let conf;
|
22744 |
|
22745 | /**
|
22746 | * Draws a start state as a black circle
|
22747 | */
|
22748 |
|
22749 | var drawStartState = function drawStartState(g) {
|
22750 | return g.append('circle') // .style('stroke', 'black')
|
22751 | // .style('fill', 'black')
|
22752 | .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);
|
22753 | };
|
22754 | /**
|
22755 | * Draws a start state as a black circle
|
22756 | */
|
22757 |
|
22758 | var drawDivider = function drawDivider(g) {
|
22759 | 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);
|
22760 | };
|
22761 | /**
|
22762 | * Draws a an end state as a black circle
|
22763 | */
|
22764 |
|
22765 | var drawSimpleState = function drawSimpleState(g, stateDef) {
|
22766 | 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);
|
22767 | var classBox = state.node().getBBox();
|
22768 | 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);
|
22769 | return state;
|
22770 | };
|
22771 | /**
|
22772 | * Draws a state with descriptions
|
22773 | * @param {*} g
|
22774 | * @param {*} stateDef
|
22775 | */
|
22776 |
|
22777 | var drawDescrState = function drawDescrState(g, stateDef) {
|
22778 | var addTspan = function addTspan(textEl, txt, isFirst) {
|
22779 | var tSpan = textEl.append('tspan').attr('x', 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).text(txt);
|
22780 |
|
22781 | if (!isFirst) {
|
22782 | tSpan.attr('dy', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight);
|
22783 | }
|
22784 | };
|
22785 |
|
22786 | 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]);
|
22787 | var titleBox = title.node().getBBox();
|
22788 | var titleHeight = titleBox.height;
|
22789 | var description = g.append('text') // text label for the x axis
|
22790 | .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');
|
22791 | var isFirst = true;
|
22792 | var isSecond = true;
|
22793 | stateDef.descriptions.forEach(function (descr) {
|
22794 | if (!isFirst) {
|
22795 | addTspan(description, descr, isSecond);
|
22796 | isSecond = false;
|
22797 | }
|
22798 |
|
22799 | isFirst = false;
|
22800 | });
|
22801 | var descrLine = g.append('line') // text label for the x axis
|
22802 | .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');
|
22803 | var descrBox = description.node().getBBox();
|
22804 | var width = Math.max(descrBox.width, titleBox.width);
|
22805 | descrLine.attr('x2', width + 3 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding); // const classBox = title.node().getBBox();
|
22806 |
|
22807 | 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);
|
22808 | return g;
|
22809 | };
|
22810 | /**
|
22811 | * Adds the creates a box around the existing content and adds a
|
22812 | * panel for the id on top of the content.
|
22813 | */
|
22814 |
|
22815 | /**
|
22816 | * Function that creates an title row and a frame around a substate for a composit state diagram.
|
22817 | * The function returns a new d3 svg object with updated width and height properties;
|
22818 | * @param {*} g The d3 svg object for the substate to framed
|
22819 | * @param {*} stateDef The info about the
|
22820 | */
|
22821 |
|
22822 | var addTitleAndBox = function addTitleAndBox(g, stateDef, altBkg) {
|
22823 | var pad = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding;
|
22824 | var dblPad = 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding;
|
22825 | var orgBox = g.node().getBBox();
|
22826 | var orgWidth = orgBox.width;
|
22827 | var orgX = orgBox.x;
|
22828 | 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);
|
22829 | var titleBox = title.node().getBBox();
|
22830 | var titleWidth = titleBox.width + dblPad;
|
22831 | var width = Math.max(titleWidth, orgWidth); // + dblPad;
|
22832 |
|
22833 | if (width === orgWidth) {
|
22834 | width = width + dblPad;
|
22835 | }
|
22836 |
|
22837 | var startX; // const lineY = 1 - getConfig().state.textHeight;
|
22838 | // const descrLine = g
|
22839 | // .append('line') // text label for the x axis
|
22840 | // .attr('x1', 0)
|
22841 | // .attr('y1', lineY)
|
22842 | // .attr('y2', lineY)
|
22843 | // .attr('class', 'descr-divider');
|
22844 |
|
22845 | var graphBox = g.node().getBBox(); // descrLine.attr('x2', graphBox.width + getConfig().state.padding);
|
22846 |
|
22847 | if (stateDef.doc) {// cnsole.warn(
|
22848 | // stateDef.id,
|
22849 | // 'orgX: ',
|
22850 | // orgX,
|
22851 | // 'width: ',
|
22852 | // width,
|
22853 | // 'titleWidth: ',
|
22854 | // titleWidth,
|
22855 | // 'orgWidth: ',
|
22856 | // orgWidth,
|
22857 | // 'width',
|
22858 | // width
|
22859 | // );
|
22860 | }
|
22861 |
|
22862 | startX = orgX - pad;
|
22863 |
|
22864 | if (titleWidth > orgWidth) {
|
22865 | startX = (orgWidth - width) / 2 + pad;
|
22866 | }
|
22867 |
|
22868 | if (Math.abs(orgX - graphBox.x) < pad) {
|
22869 | if (titleWidth > orgWidth) {
|
22870 | startX = orgX - (titleWidth - orgWidth) / 2;
|
22871 | }
|
22872 | }
|
22873 |
|
22874 | var lineY = 1 - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight; // White color
|
22875 |
|
22876 | 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');
|
22877 | title.attr('x', startX + pad);
|
22878 | if (titleWidth <= orgWidth) title.attr('x', orgX + (width - dblPad) / 2 - titleWidth / 2 + pad); // Title background
|
22879 |
|
22880 | 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
|
22881 | .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
|
22882 |
|
22883 | 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);
|
22884 | return g;
|
22885 | };
|
22886 |
|
22887 | var drawEndState = function drawEndState(g) {
|
22888 | g.append('circle') // .style('stroke', 'black')
|
22889 | // .style('fill', 'white')
|
22890 | .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);
|
22891 | return g.append('circle') // .style('stroke', 'black')
|
22892 | // .style('fill', 'black')
|
22893 | .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);
|
22894 | };
|
22895 |
|
22896 | var drawForkJoinState = function drawForkJoinState(g, stateDef) {
|
22897 | var width = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.forkWidth;
|
22898 | var height = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.forkHeight;
|
22899 |
|
22900 | if (stateDef.parentId) {
|
22901 | var tmp = width;
|
22902 | width = height;
|
22903 | height = tmp;
|
22904 | }
|
22905 |
|
22906 | 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);
|
22907 | };
|
22908 |
|
22909 | var drawText = function drawText(elem, textData) {
|
22910 | // Remove and ignore br:s
|
22911 | var nText = textData.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_2__["default"].lineBreakRegex, ' ');
|
22912 | var textElem = elem.append('text');
|
22913 | textElem.attr('x', textData.x);
|
22914 | textElem.attr('y', textData.y);
|
22915 | textElem.style('text-anchor', textData.anchor);
|
22916 | textElem.attr('fill', textData.fill);
|
22917 |
|
22918 | if (typeof textData.class !== 'undefined') {
|
22919 | textElem.attr('class', textData.class);
|
22920 | }
|
22921 |
|
22922 | var span = textElem.append('tspan');
|
22923 | span.attr('x', textData.x + textData.textMargin * 2);
|
22924 | span.attr('fill', textData.fill);
|
22925 | span.text(nText);
|
22926 | return textElem;
|
22927 | };
|
22928 |
|
22929 | var _drawLongText = function _drawLongText(_text, x, y, g) {
|
22930 | var textHeight = 0;
|
22931 | var textElem = g.append('text');
|
22932 | textElem.style('text-anchor', 'start');
|
22933 | textElem.attr('class', 'noteText');
|
22934 |
|
22935 | var text = _text.replace(/\r\n/g, '<br/>');
|
22936 |
|
22937 | text = text.replace(/\n/g, '<br/>');
|
22938 | var lines = text.split(_common_common__WEBPACK_IMPORTED_MODULE_2__["default"].lineBreakRegex);
|
22939 | var tHeight = 1.25 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin;
|
22940 |
|
22941 | var _iterator = _createForOfIteratorHelper(lines),
|
22942 | _step;
|
22943 |
|
22944 | try {
|
22945 | for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
22946 | var _line = _step.value;
|
22947 |
|
22948 | var txt = _line.trim();
|
22949 |
|
22950 | if (txt.length > 0) {
|
22951 | var span = textElem.append('tspan');
|
22952 | span.text(txt);
|
22953 |
|
22954 | if (tHeight === 0) {
|
22955 | var textBounds = span.node().getBBox();
|
22956 | tHeight += textBounds.height;
|
22957 | }
|
22958 |
|
22959 | textHeight += tHeight;
|
22960 | span.attr('x', x + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin);
|
22961 | span.attr('y', y + textHeight + 1.25 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin);
|
22962 | }
|
22963 | }
|
22964 | } catch (err) {
|
22965 | _iterator.e(err);
|
22966 | } finally {
|
22967 | _iterator.f();
|
22968 | }
|
22969 |
|
22970 | return {
|
22971 | textWidth: textElem.node().getBBox().width,
|
22972 | textHeight: textHeight
|
22973 | };
|
22974 | };
|
22975 | /**
|
22976 | * Draws a note to the diagram
|
22977 | * @param text - The text of the given note.
|
22978 | * @param g - The element the note is attached to.
|
22979 | */
|
22980 |
|
22981 |
|
22982 | var drawNote = function drawNote(text, g) {
|
22983 | g.attr('class', 'state-note');
|
22984 | var note = g.append('rect').attr('x', 0).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding);
|
22985 | var rectElem = g.append('g');
|
22986 |
|
22987 | var _drawLongText2 = _drawLongText(text, 0, 0, rectElem),
|
22988 | textWidth = _drawLongText2.textWidth,
|
22989 | textHeight = _drawLongText2.textHeight;
|
22990 |
|
22991 | note.attr('height', textHeight + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin);
|
22992 | note.attr('width', textWidth + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin * 2);
|
22993 | return note;
|
22994 | };
|
22995 | /**
|
22996 | * Starting point for drawing a state. The function finds out the specifics
|
22997 | * about the state and renders with approprtiate function.
|
22998 | * @param {*} elem
|
22999 | * @param {*} stateDef
|
23000 | */
|
23001 |
|
23002 | var drawState = function drawState(elem, stateDef) {
|
23003 | var id = stateDef.id;
|
23004 | var stateInfo = {
|
23005 | id: id,
|
23006 | label: stateDef.id,
|
23007 | width: 0,
|
23008 | height: 0
|
23009 | };
|
23010 | var g = elem.append('g').attr('id', id).attr('class', 'stateGroup');
|
23011 | if (stateDef.type === 'start') drawStartState(g);
|
23012 | if (stateDef.type === 'end') drawEndState(g);
|
23013 | if (stateDef.type === 'fork' || stateDef.type === 'join') drawForkJoinState(g, stateDef);
|
23014 | if (stateDef.type === 'note') drawNote(stateDef.note.text, g);
|
23015 | if (stateDef.type === 'divider') drawDivider(g);
|
23016 | if (stateDef.type === 'default' && stateDef.descriptions.length === 0) drawSimpleState(g, stateDef);
|
23017 | if (stateDef.type === 'default' && stateDef.descriptions.length > 0) drawDescrState(g, stateDef);
|
23018 | var stateBox = g.node().getBBox();
|
23019 | stateInfo.width = stateBox.width + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding;
|
23020 | stateInfo.height = stateBox.height + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding;
|
23021 | _id_cache_js__WEBPACK_IMPORTED_MODULE_3__["default"].set(id, stateInfo); // stateCnt++;
|
23022 |
|
23023 | return stateInfo;
|
23024 | };
|
23025 | var edgeCount = 0;
|
23026 | var drawEdge = function drawEdge(elem, path, relation) {
|
23027 | var getRelationType = function getRelationType(type) {
|
23028 | switch (type) {
|
23029 | case _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.AGGREGATION:
|
23030 | return 'aggregation';
|
23031 |
|
23032 | case _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.EXTENSION:
|
23033 | return 'extension';
|
23034 |
|
23035 | case _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.COMPOSITION:
|
23036 | return 'composition';
|
23037 |
|
23038 | case _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.DEPENDENCY:
|
23039 | return 'dependency';
|
23040 | }
|
23041 | };
|
23042 |
|
23043 | path.points = path.points.filter(function (p) {
|
23044 | return !Number.isNaN(p.y);
|
23045 | }); // The data for our line
|
23046 |
|
23047 | var lineData = path.points; // This is the accessor function we talked about above
|
23048 |
|
23049 | var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) {
|
23050 | return d.x;
|
23051 | }).y(function (d) {
|
23052 | return d.y;
|
23053 | }).curve(d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis);
|
23054 | var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', 'edge' + edgeCount).attr('class', 'transition');
|
23055 | var url = '';
|
23056 |
|
23057 | if ((0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.arrowMarkerAbsolute) {
|
23058 | url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
|
23059 | url = url.replace(/\(/g, '\\(');
|
23060 | url = url.replace(/\)/g, '\\)');
|
23061 | }
|
23062 |
|
23063 | svgPath.attr('marker-end', 'url(' + url + '#' + getRelationType(_stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.DEPENDENCY) + 'End' + ')');
|
23064 |
|
23065 | if (typeof relation.title !== 'undefined') {
|
23066 | var label = elem.append('g').attr('class', 'stateLabel');
|
23067 |
|
23068 | var _utils$calcLabelPosit = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcLabelPosition(path.points),
|
23069 | x = _utils$calcLabelPosit.x,
|
23070 | y = _utils$calcLabelPosit.y;
|
23071 |
|
23072 | var rows = _common_common__WEBPACK_IMPORTED_MODULE_2__["default"].getRows(relation.title);
|
23073 | var titleHeight = 0;
|
23074 | var titleRows = [];
|
23075 | var maxWidth = 0;
|
23076 | var minX = 0;
|
23077 |
|
23078 | for (var i = 0; i <= rows.length; i++) {
|
23079 | var title = label.append('text').attr('text-anchor', 'middle').text(rows[i]).attr('x', x).attr('y', y + titleHeight);
|
23080 | var boundstmp = title.node().getBBox();
|
23081 | maxWidth = Math.max(maxWidth, boundstmp.width);
|
23082 | minX = Math.min(minX, boundstmp.x);
|
23083 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info(boundstmp.x, x, y + titleHeight);
|
23084 |
|
23085 | if (titleHeight === 0) {
|
23086 | var titleBox = title.node().getBBox();
|
23087 | titleHeight = titleBox.height;
|
23088 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('Title height', titleHeight, y);
|
23089 | }
|
23090 |
|
23091 | titleRows.push(title);
|
23092 | }
|
23093 |
|
23094 | var boxHeight = titleHeight * rows.length;
|
23095 |
|
23096 | if (rows.length > 1) {
|
23097 | var heightAdj = (rows.length - 1) * titleHeight * 0.5;
|
23098 | titleRows.forEach(function (title, i) {
|
23099 | return title.attr('y', y + i * titleHeight - heightAdj);
|
23100 | });
|
23101 | boxHeight = titleHeight * rows.length;
|
23102 | }
|
23103 |
|
23104 | var bounds = label.node().getBBox();
|
23105 | 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);
|
23106 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.info(bounds); //label.attr('transform', '0 -' + (bounds.y / 2));
|
23107 | // Debug points
|
23108 | // path.points.forEach(point => {
|
23109 | // g.append('circle')
|
23110 | // .style('stroke', 'red')
|
23111 | // .style('fill', 'red')
|
23112 | // .attr('r', 1)
|
23113 | // .attr('cx', point.x)
|
23114 | // .attr('cy', point.y);
|
23115 | // });
|
23116 | // g.append('circle')
|
23117 | // .style('stroke', 'blue')
|
23118 | // .style('fill', 'blue')
|
23119 | // .attr('r', 1)
|
23120 | // .attr('cx', x)
|
23121 | // .attr('cy', y);
|
23122 | }
|
23123 |
|
23124 | edgeCount++;
|
23125 | };
|
23126 |
|
23127 | /***/ }),
|
23128 |
|
23129 | /***/ "./src/diagrams/state/stateDb.js":
|
23130 | /*!***************************************!*\
|
23131 | !*** ./src/diagrams/state/stateDb.js ***!
|
23132 | \***************************************/
|
23133 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
23134 |
|
23135 | "use strict";
|
23136 | __webpack_require__.r(__webpack_exports__);
|
23137 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
23138 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
23139 | /* harmony export */ "addState": () => (/* binding */ addState),
|
23140 | /* harmony export */ "clear": () => (/* binding */ clear),
|
23141 | /* harmony export */ "getState": () => (/* binding */ getState),
|
23142 | /* harmony export */ "getStates": () => (/* binding */ getStates),
|
23143 | /* harmony export */ "logDocuments": () => (/* binding */ logDocuments),
|
23144 | /* harmony export */ "getRelations": () => (/* binding */ getRelations),
|
23145 | /* harmony export */ "addRelation": () => (/* binding */ addRelation),
|
23146 | /* harmony export */ "cleanupLabel": () => (/* binding */ cleanupLabel),
|
23147 | /* harmony export */ "lineType": () => (/* binding */ lineType),
|
23148 | /* harmony export */ "relationType": () => (/* binding */ relationType),
|
23149 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
23150 | /* harmony export */ });
|
23151 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
23152 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
23153 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
23154 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
23155 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
23156 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
23157 |
|
23158 |
|
23159 |
|
23160 |
|
23161 |
|
23162 |
|
23163 |
|
23164 | var clone = function clone(o) {
|
23165 | return JSON.parse(JSON.stringify(o));
|
23166 | };
|
23167 |
|
23168 | var rootDoc = [];
|
23169 | var parseDirective = function parseDirective(statement, context, type) {
|
23170 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
|
23171 | };
|
23172 |
|
23173 | var setRootDoc = function setRootDoc(o) {
|
23174 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Setting root doc', o); // rootDoc = { id: 'root', doc: o };
|
23175 |
|
23176 | rootDoc = o;
|
23177 | };
|
23178 |
|
23179 | var getRootDoc = function getRootDoc() {
|
23180 | return rootDoc;
|
23181 | };
|
23182 |
|
23183 | var docTranslator = function docTranslator(parent, node, first) {
|
23184 | if (node.stmt === 'relation') {
|
23185 | docTranslator(parent, node.state1, true);
|
23186 | docTranslator(parent, node.state2, false);
|
23187 | } else {
|
23188 | if (node.stmt === 'state') {
|
23189 | if (node.id === '[*]') {
|
23190 | node.id = first ? parent.id + '_start' : parent.id + '_end';
|
23191 | node.start = first;
|
23192 | }
|
23193 | }
|
23194 |
|
23195 | if (node.doc) {
|
23196 | var doc = []; // Check for concurrency
|
23197 |
|
23198 | var i = 0;
|
23199 | var currentDoc = [];
|
23200 |
|
23201 | for (i = 0; i < node.doc.length; i++) {
|
23202 | if (node.doc[i].type === 'divider') {
|
23203 | // debugger;
|
23204 | var newNode = clone(node.doc[i]);
|
23205 | newNode.doc = clone(currentDoc);
|
23206 | doc.push(newNode);
|
23207 | currentDoc = [];
|
23208 | } else {
|
23209 | currentDoc.push(node.doc[i]);
|
23210 | }
|
23211 | } // If any divider was encountered
|
23212 |
|
23213 |
|
23214 | if (doc.length > 0 && currentDoc.length > 0) {
|
23215 | var _newNode = {
|
23216 | stmt: 'state',
|
23217 | id: (0,_utils__WEBPACK_IMPORTED_MODULE_2__.generateId)(),
|
23218 | type: 'divider',
|
23219 | doc: clone(currentDoc)
|
23220 | };
|
23221 | doc.push(clone(_newNode));
|
23222 | node.doc = doc;
|
23223 | }
|
23224 |
|
23225 | node.doc.forEach(function (docNode) {
|
23226 | return docTranslator(node, docNode, true);
|
23227 | });
|
23228 | }
|
23229 | }
|
23230 | };
|
23231 |
|
23232 | var getRootDocV2 = function getRootDocV2() {
|
23233 | docTranslator({
|
23234 | id: 'root'
|
23235 | }, {
|
23236 | id: 'root',
|
23237 | doc: rootDoc
|
23238 | }, true);
|
23239 | return {
|
23240 | id: 'root',
|
23241 | doc: rootDoc
|
23242 | }; // Here
|
23243 | };
|
23244 |
|
23245 | var extract = function extract(_doc) {
|
23246 | // const res = { states: [], relations: [] };
|
23247 | var doc;
|
23248 |
|
23249 | if (_doc.doc) {
|
23250 | doc = _doc.doc;
|
23251 | } else {
|
23252 | doc = _doc;
|
23253 | } // let doc = root.doc;
|
23254 | // if (!doc) {
|
23255 | // doc = root;
|
23256 | // }
|
23257 |
|
23258 |
|
23259 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info(doc);
|
23260 | clear();
|
23261 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Extract', doc);
|
23262 | doc.forEach(function (item) {
|
23263 | if (item.stmt === 'state') {
|
23264 | addState(item.id, item.type, item.doc, item.description, item.note);
|
23265 | }
|
23266 |
|
23267 | if (item.stmt === 'relation') {
|
23268 | addRelation(item.state1.id, item.state2.id, item.description);
|
23269 | }
|
23270 | });
|
23271 | };
|
23272 |
|
23273 | var newDoc = function newDoc() {
|
23274 | return {
|
23275 | relations: [],
|
23276 | states: {},
|
23277 | documents: {}
|
23278 | };
|
23279 | };
|
23280 |
|
23281 | var documents = {
|
23282 | root: newDoc()
|
23283 | };
|
23284 | var currentDocument = documents.root;
|
23285 | var startCnt = 0;
|
23286 | var endCnt = 0; // eslint-disable-line
|
23287 | // let stateCnt = 0;
|
23288 |
|
23289 | /**
|
23290 | * Function called by parser when a node definition has been found.
|
23291 | * @param id
|
23292 | * @param text
|
23293 | * @param type
|
23294 | * @param style
|
23295 | */
|
23296 |
|
23297 | var addState = function addState(id, type, doc, descr, note) {
|
23298 | if (typeof currentDocument.states[id] === 'undefined') {
|
23299 | currentDocument.states[id] = {
|
23300 | id: id,
|
23301 | descriptions: [],
|
23302 | type: type,
|
23303 | doc: doc,
|
23304 | note: note
|
23305 | };
|
23306 | } else {
|
23307 | if (!currentDocument.states[id].doc) {
|
23308 | currentDocument.states[id].doc = doc;
|
23309 | }
|
23310 |
|
23311 | if (!currentDocument.states[id].type) {
|
23312 | currentDocument.states[id].type = type;
|
23313 | }
|
23314 | }
|
23315 |
|
23316 | if (descr) {
|
23317 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Adding state ', id, descr);
|
23318 | if (typeof descr === 'string') addDescription(id, descr.trim());
|
23319 |
|
23320 | if (_typeof(descr) === 'object') {
|
23321 | descr.forEach(function (des) {
|
23322 | return addDescription(id, des.trim());
|
23323 | });
|
23324 | }
|
23325 | }
|
23326 |
|
23327 | if (note) {
|
23328 | currentDocument.states[id].note = note;
|
23329 | currentDocument.states[id].note.text = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(currentDocument.states[id].note.text, _config__WEBPACK_IMPORTED_MODULE_4__.getConfig());
|
23330 | }
|
23331 | };
|
23332 | var clear = function clear() {
|
23333 | documents = {
|
23334 | root: newDoc()
|
23335 | };
|
23336 | currentDocument = documents.root;
|
23337 | currentDocument = documents.root;
|
23338 | startCnt = 0;
|
23339 | endCnt = 0; // eslint-disable-line
|
23340 |
|
23341 | classes = [];
|
23342 | };
|
23343 | var getState = function getState(id) {
|
23344 | return currentDocument.states[id];
|
23345 | };
|
23346 | var getStates = function getStates() {
|
23347 | return currentDocument.states;
|
23348 | };
|
23349 | var logDocuments = function logDocuments() {
|
23350 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Documents = ', documents);
|
23351 | };
|
23352 | var getRelations = function getRelations() {
|
23353 | return currentDocument.relations;
|
23354 | };
|
23355 | var addRelation = function addRelation(_id1, _id2, title) {
|
23356 | var id1 = _id1;
|
23357 | var id2 = _id2;
|
23358 | var type1 = 'default';
|
23359 | var type2 = 'default';
|
23360 |
|
23361 | if (_id1 === '[*]') {
|
23362 | startCnt++;
|
23363 | id1 = 'start' + startCnt;
|
23364 | type1 = 'start';
|
23365 | }
|
23366 |
|
23367 | if (_id2 === '[*]') {
|
23368 | endCnt++;
|
23369 | id2 = 'end' + startCnt;
|
23370 | type2 = 'end';
|
23371 | }
|
23372 |
|
23373 | addState(id1, type1);
|
23374 | addState(id2, type2);
|
23375 | currentDocument.relations.push({
|
23376 | id1: id1,
|
23377 | id2: id2,
|
23378 | title: _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(title, _config__WEBPACK_IMPORTED_MODULE_4__.getConfig())
|
23379 | });
|
23380 | };
|
23381 |
|
23382 | var addDescription = function addDescription(id, _descr) {
|
23383 | var theState = currentDocument.states[id];
|
23384 | var descr = _descr;
|
23385 |
|
23386 | if (descr[0] === ':') {
|
23387 | descr = descr.substr(1).trim();
|
23388 | }
|
23389 |
|
23390 | theState.descriptions.push(_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(descr, _config__WEBPACK_IMPORTED_MODULE_4__.getConfig()));
|
23391 | };
|
23392 |
|
23393 | var cleanupLabel = function cleanupLabel(label) {
|
23394 | if (label.substring(0, 1) === ':') {
|
23395 | return label.substr(2).trim();
|
23396 | } else {
|
23397 | return label.trim();
|
23398 | }
|
23399 | };
|
23400 | var lineType = {
|
23401 | LINE: 0,
|
23402 | DOTTED_LINE: 1
|
23403 | };
|
23404 | var dividerCnt = 0;
|
23405 |
|
23406 | var getDividerId = function getDividerId() {
|
23407 | dividerCnt++;
|
23408 | return 'divider-id-' + dividerCnt;
|
23409 | };
|
23410 |
|
23411 | var classes = [];
|
23412 |
|
23413 | var getClasses = function getClasses() {
|
23414 | return classes;
|
23415 | };
|
23416 |
|
23417 | var direction = 'TB';
|
23418 |
|
23419 | var getDirection = function getDirection() {
|
23420 | return direction;
|
23421 | };
|
23422 |
|
23423 | var setDirection = function setDirection(dir) {
|
23424 | direction = dir;
|
23425 | };
|
23426 |
|
23427 | var relationType = {
|
23428 | AGGREGATION: 0,
|
23429 | EXTENSION: 1,
|
23430 | COMPOSITION: 2,
|
23431 | DEPENDENCY: 3
|
23432 | };
|
23433 |
|
23434 | var trimColon = function trimColon(str) {
|
23435 | return str && str[0] === ':' ? str.substr(1).trim() : str.trim();
|
23436 | };
|
23437 |
|
23438 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
23439 | parseDirective: parseDirective,
|
23440 | getConfig: function getConfig() {
|
23441 | return _config__WEBPACK_IMPORTED_MODULE_4__.getConfig().state;
|
23442 | },
|
23443 | addState: addState,
|
23444 | clear: clear,
|
23445 | getState: getState,
|
23446 | getStates: getStates,
|
23447 | getRelations: getRelations,
|
23448 | getClasses: getClasses,
|
23449 | getDirection: getDirection,
|
23450 | addRelation: addRelation,
|
23451 | getDividerId: getDividerId,
|
23452 | setDirection: setDirection,
|
23453 | // addDescription,
|
23454 | cleanupLabel: cleanupLabel,
|
23455 | lineType: lineType,
|
23456 | relationType: relationType,
|
23457 | logDocuments: logDocuments,
|
23458 | getRootDoc: getRootDoc,
|
23459 | setRootDoc: setRootDoc,
|
23460 | getRootDocV2: getRootDocV2,
|
23461 | extract: extract,
|
23462 | trimColon: trimColon
|
23463 | });
|
23464 |
|
23465 | /***/ }),
|
23466 |
|
23467 | /***/ "./src/diagrams/state/stateRenderer-v2.js":
|
23468 | /*!************************************************!*\
|
23469 | !*** ./src/diagrams/state/stateRenderer-v2.js ***!
|
23470 | \************************************************/
|
23471 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
23472 |
|
23473 | "use strict";
|
23474 | __webpack_require__.r(__webpack_exports__);
|
23475 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
23476 | /* harmony export */ "setConf": () => (/* binding */ setConf),
|
23477 | /* harmony export */ "getClasses": () => (/* binding */ getClasses),
|
23478 | /* harmony export */ "draw": () => (/* binding */ draw),
|
23479 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
23480 | /* harmony export */ });
|
23481 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
|
23482 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
|
23483 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
|
23484 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
|
23485 | /* harmony import */ var _stateDb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stateDb */ "./src/diagrams/state/stateDb.js");
|
23486 | /* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./parser/stateDiagram */ "./src/diagrams/state/parser/stateDiagram.jison");
|
23487 | /* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_4__);
|
23488 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
23489 | /* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
|
23490 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
23491 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
23492 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
23493 |
|
23494 |
|
23495 |
|
23496 |
|
23497 |
|
23498 |
|
23499 |
|
23500 |
|
23501 |
|
23502 | var conf = {};
|
23503 | var setConf = function setConf(cnf) {
|
23504 | var keys = Object.keys(cnf);
|
23505 |
|
23506 | for (var i = 0; i < keys.length; i++) {
|
23507 | conf[keys[i]] = cnf[keys[i]];
|
23508 | }
|
23509 | };
|
23510 | var nodeDb = {};
|
23511 | /**
|
23512 | * Returns the all the styles from classDef statements in the graph definition.
|
23513 | * @returns {object} classDef styles
|
23514 | */
|
23515 |
|
23516 | var getClasses = function getClasses(text) {
|
23517 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Extracting classes');
|
23518 | _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].clear();
|
23519 | var parser = (_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_4___default().parser);
|
23520 | parser.yy = _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"]; // Parse the graph definition
|
23521 |
|
23522 | parser.parse(text);
|
23523 | return _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].getClasses();
|
23524 | };
|
23525 |
|
23526 | var setupNode = function setupNode(g, parent, node, altFlag) {
|
23527 | // Add the node
|
23528 | if (node.id !== 'root') {
|
23529 | var shape = 'rect';
|
23530 |
|
23531 | if (node.start === true) {
|
23532 | shape = 'start';
|
23533 | }
|
23534 |
|
23535 | if (node.start === false) {
|
23536 | shape = 'end';
|
23537 | }
|
23538 |
|
23539 | if (node.type !== 'default') {
|
23540 | shape = node.type;
|
23541 | }
|
23542 |
|
23543 | if (!nodeDb[node.id]) {
|
23544 | nodeDb[node.id] = {
|
23545 | id: node.id,
|
23546 | shape: shape,
|
23547 | description: _common_common__WEBPACK_IMPORTED_MODULE_5__["default"].sanitizeText(node.id, (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)()),
|
23548 | classes: 'statediagram-state'
|
23549 | };
|
23550 | } // Build of the array of description strings accordinging
|
23551 |
|
23552 |
|
23553 | if (node.description) {
|
23554 | if (Array.isArray(nodeDb[node.id].description)) {
|
23555 | // There already is an array of strings,add to it
|
23556 | nodeDb[node.id].shape = 'rectWithTitle';
|
23557 | nodeDb[node.id].description.push(node.description);
|
23558 | } else {
|
23559 | if (nodeDb[node.id].description.length > 0) {
|
23560 | // if there is a description already transformit to an array
|
23561 | nodeDb[node.id].shape = 'rectWithTitle';
|
23562 |
|
23563 | if (nodeDb[node.id].description === node.id) {
|
23564 | // If the previous description was the is, remove it
|
23565 | nodeDb[node.id].description = [node.description];
|
23566 | } else {
|
23567 | nodeDb[node.id].description = [nodeDb[node.id].description, node.description];
|
23568 | }
|
23569 | } else {
|
23570 | nodeDb[node.id].shape = 'rect';
|
23571 | nodeDb[node.id].description = node.description;
|
23572 | }
|
23573 | }
|
23574 | } // Save data for description and group so that for instance a statement without description overwrites
|
23575 | // one with description
|
23576 | // group
|
23577 |
|
23578 |
|
23579 | if (!nodeDb[node.id].type && node.doc) {
|
23580 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Setting cluster for ', node.id, getDir(node));
|
23581 | nodeDb[node.id].type = 'group';
|
23582 | nodeDb[node.id].dir = getDir(node);
|
23583 | nodeDb[node.id].shape = node.type === 'divider' ? 'divider' : 'roundedWithTitle';
|
23584 | nodeDb[node.id].classes = nodeDb[node.id].classes + ' ' + (altFlag ? 'statediagram-cluster statediagram-cluster-alt' : 'statediagram-cluster');
|
23585 | }
|
23586 |
|
23587 | var nodeData = {
|
23588 | labelStyle: '',
|
23589 | shape: nodeDb[node.id].shape,
|
23590 | labelText: nodeDb[node.id].description,
|
23591 | // typeof nodeDb[node.id].description === 'object'
|
23592 | // ? nodeDb[node.id].description[0]
|
23593 | // : nodeDb[node.id].description,
|
23594 | classes: nodeDb[node.id].classes,
|
23595 | //classStr,
|
23596 | style: '',
|
23597 | //styles.style,
|
23598 | id: node.id,
|
23599 | dir: nodeDb[node.id].dir,
|
23600 | domId: 'state-' + node.id + '-' + cnt,
|
23601 | type: nodeDb[node.id].type,
|
23602 | padding: 15 //getConfig().flowchart.padding
|
23603 |
|
23604 | };
|
23605 |
|
23606 | if (node.note) {
|
23607 | // Todo: set random id
|
23608 | var noteData = {
|
23609 | labelStyle: '',
|
23610 | shape: 'note',
|
23611 | labelText: node.note.text,
|
23612 | classes: 'statediagram-note',
|
23613 | //classStr,
|
23614 | style: '',
|
23615 | //styles.style,
|
23616 | id: node.id + '----note-' + cnt,
|
23617 | domId: 'state-' + node.id + '----note-' + cnt,
|
23618 | type: nodeDb[node.id].type,
|
23619 | padding: 15 //getConfig().flowchart.padding
|
23620 |
|
23621 | };
|
23622 | var groupData = {
|
23623 | labelStyle: '',
|
23624 | shape: 'noteGroup',
|
23625 | labelText: node.note.text,
|
23626 | classes: nodeDb[node.id].classes,
|
23627 | //classStr,
|
23628 | style: '',
|
23629 | //styles.style,
|
23630 | id: node.id + '----parent',
|
23631 | domId: 'state-' + node.id + '----parent-' + cnt,
|
23632 | type: 'group',
|
23633 | padding: 0 //getConfig().flowchart.padding
|
23634 |
|
23635 | };
|
23636 | cnt++;
|
23637 | g.setNode(node.id + '----parent', groupData);
|
23638 | g.setNode(noteData.id, noteData);
|
23639 | g.setNode(node.id, nodeData);
|
23640 | g.setParent(node.id, node.id + '----parent');
|
23641 | g.setParent(noteData.id, node.id + '----parent');
|
23642 | var from = node.id;
|
23643 | var to = noteData.id;
|
23644 |
|
23645 | if (node.note.position === 'left of') {
|
23646 | from = noteData.id;
|
23647 | to = node.id;
|
23648 | }
|
23649 |
|
23650 | g.setEdge(from, to, {
|
23651 | arrowhead: 'none',
|
23652 | arrowType: '',
|
23653 | style: 'fill:none',
|
23654 | labelStyle: '',
|
23655 | classes: 'transition note-edge',
|
23656 | arrowheadStyle: 'fill: #333',
|
23657 | labelpos: 'c',
|
23658 | labelType: 'text',
|
23659 | thickness: 'normal'
|
23660 | });
|
23661 | } else {
|
23662 | g.setNode(node.id, nodeData);
|
23663 | }
|
23664 | }
|
23665 |
|
23666 | if (parent) {
|
23667 | if (parent.id !== 'root') {
|
23668 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Setting node ', node.id, ' to be child of its parent ', parent.id);
|
23669 | g.setParent(node.id, parent.id);
|
23670 | }
|
23671 | }
|
23672 |
|
23673 | if (node.doc) {
|
23674 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Adding nodes children ');
|
23675 | setupDoc(g, node, node.doc, !altFlag);
|
23676 | }
|
23677 | };
|
23678 |
|
23679 | var cnt = 0;
|
23680 |
|
23681 | var setupDoc = function setupDoc(g, parent, doc, altFlag) {
|
23682 | // cnt = 0;
|
23683 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('items', doc);
|
23684 | doc.forEach(function (item) {
|
23685 | if (item.stmt === 'state' || item.stmt === 'default') {
|
23686 | setupNode(g, parent, item, altFlag);
|
23687 | } else if (item.stmt === 'relation') {
|
23688 | setupNode(g, parent, item.state1, altFlag);
|
23689 | setupNode(g, parent, item.state2, altFlag);
|
23690 | var edgeData = {
|
23691 | id: 'edge' + cnt,
|
23692 | arrowhead: 'normal',
|
23693 | arrowTypeEnd: 'arrow_barb',
|
23694 | style: 'fill:none',
|
23695 | labelStyle: '',
|
23696 | label: item.description,
|
23697 | arrowheadStyle: 'fill: #333',
|
23698 | labelpos: 'c',
|
23699 | labelType: 'text',
|
23700 | thickness: 'normal',
|
23701 | classes: 'transition'
|
23702 | };
|
23703 | var startId = item.state1.id;
|
23704 | var endId = item.state2.id;
|
23705 | g.setEdge(startId, endId, edgeData, cnt);
|
23706 | cnt++;
|
23707 | }
|
23708 | });
|
23709 | };
|
23710 |
|
23711 | var getDir = function getDir(nodes, defaultDir) {
|
23712 | var dir = defaultDir || 'TB';
|
23713 |
|
23714 | if (nodes.doc) {
|
23715 | for (var i = 0; i < nodes.doc.length; i++) {
|
23716 | var node = nodes.doc[i];
|
23717 |
|
23718 | if (node.stmt === 'dir') {
|
23719 | dir = node.value;
|
23720 | }
|
23721 | }
|
23722 | }
|
23723 |
|
23724 | return dir;
|
23725 | };
|
23726 | /**
|
23727 | * Draws a flowchart in the tag with id: id based on the graph definition in text.
|
23728 | * @param text
|
23729 | * @param id
|
23730 | */
|
23731 |
|
23732 |
|
23733 | var draw = function draw(text, id) {
|
23734 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Drawing state diagram (v2)', id);
|
23735 | _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].clear();
|
23736 | nodeDb = {};
|
23737 | var parser = (_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_4___default().parser);
|
23738 | parser.yy = _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"]; // Parse the graph definition
|
23739 |
|
23740 | parser.parse(text); // Fetch the default direction, use TD if none was found
|
23741 |
|
23742 | var dir = _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].getDirection();
|
23743 |
|
23744 | if (typeof dir === 'undefined') {
|
23745 | dir = 'LR';
|
23746 | }
|
23747 |
|
23748 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().state;
|
23749 | var nodeSpacing = conf.nodeSpacing || 50;
|
23750 | var rankSpacing = conf.rankSpacing || 50;
|
23751 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info(_stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].getRootDocV2());
|
23752 | _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].extract(_stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].getRootDocV2());
|
23753 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info(_stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].getRootDocV2()); // Create the input mermaid.graph
|
23754 |
|
23755 | var g = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
|
23756 | multigraph: true,
|
23757 | compound: true
|
23758 | }).setGraph({
|
23759 | rankdir: getDir(_stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].getRootDocV2()),
|
23760 | nodesep: nodeSpacing,
|
23761 | ranksep: rankSpacing,
|
23762 | marginx: 8,
|
23763 | marginy: 8
|
23764 | }).setDefaultEdgeLabel(function () {
|
23765 | return {};
|
23766 | });
|
23767 | setupNode(g, undefined, _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].getRootDocV2(), true); // Set up an SVG group so that we can translate the final graph.
|
23768 |
|
23769 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)("[id=\"".concat(id, "\"]")); // Run the renderer. This is what draws the final graph.
|
23770 |
|
23771 | var element = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#' + id + ' g');
|
23772 | (0,_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_7__.render)(element, g, ['barb'], 'statediagram', id);
|
23773 | var padding = 8;
|
23774 | var bounds = svg.node().getBBox();
|
23775 | var width = bounds.width + padding * 2;
|
23776 | var height = bounds.height + padding * 2; // Zoom in a bit
|
23777 |
|
23778 | svg.attr('class', 'statediagram');
|
23779 | var svgBounds = svg.node().getBBox();
|
23780 | (0,_utils__WEBPACK_IMPORTED_MODULE_8__.configureSvgSize)(svg, height, width * 1.75, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
|
23781 |
|
23782 | var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
|
23783 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug("viewBox ".concat(vBox));
|
23784 | svg.attr('viewBox', vBox); // Add label rects for non html labels
|
23785 | // if (!evaluate(conf.htmlLabels) || true) {
|
23786 |
|
23787 | var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
23788 |
|
23789 | for (var k = 0; k < labels.length; k++) {
|
23790 | var label = labels[k]; // Get dimensions of label
|
23791 |
|
23792 | var dim = label.getBBox();
|
23793 | var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
|
23794 | rect.setAttribute('rx', 0);
|
23795 | rect.setAttribute('ry', 0);
|
23796 | rect.setAttribute('width', dim.width);
|
23797 | rect.setAttribute('height', dim.height);
|
23798 | label.insertBefore(rect, label.firstChild); // }
|
23799 | }
|
23800 | };
|
23801 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
23802 | setConf: setConf,
|
23803 | getClasses: getClasses,
|
23804 | draw: draw
|
23805 | });
|
23806 |
|
23807 | /***/ }),
|
23808 |
|
23809 | /***/ "./src/diagrams/state/stateRenderer.js":
|
23810 | /*!*********************************************!*\
|
23811 | !*** ./src/diagrams/state/stateRenderer.js ***!
|
23812 | \*********************************************/
|
23813 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
23814 |
|
23815 | "use strict";
|
23816 | __webpack_require__.r(__webpack_exports__);
|
23817 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
23818 | /* harmony export */ "setConf": () => (/* binding */ setConf),
|
23819 | /* harmony export */ "draw": () => (/* binding */ draw),
|
23820 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
23821 | /* harmony export */ });
|
23822 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
23823 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
23824 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
|
23825 | /* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
|
23826 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
|
23827 | /* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
|
23828 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
|
23829 | /* harmony import */ var _stateDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateDb */ "./src/diagrams/state/stateDb.js");
|
23830 | /* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
|
23831 | /* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/stateDiagram */ "./src/diagrams/state/parser/stateDiagram.jison");
|
23832 | /* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3__);
|
23833 | /* harmony import */ var _shapes__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./shapes */ "./src/diagrams/state/shapes.js");
|
23834 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
23835 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
23836 |
|
23837 |
|
23838 |
|
23839 |
|
23840 |
|
23841 |
|
23842 | // import idCache from './id-cache';
|
23843 |
|
23844 |
|
23845 |
|
23846 |
|
23847 | _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"]; // TODO Move conf object to main conf in mermaidAPI
|
23848 |
|
23849 | var conf;
|
23850 | var transformationLog = {};
|
23851 | var setConf = function setConf() {}; // Todo optimize
|
23852 |
|
23853 | /**
|
23854 | * Setup arrow head and define the marker. The result is appended to the svg.
|
23855 | */
|
23856 |
|
23857 | var insertMarkers = function insertMarkers(elem) {
|
23858 | 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');
|
23859 | };
|
23860 | /**
|
23861 | * Draws a flowchart in the tag with id: id based on the graph definition in text.
|
23862 | * @param text
|
23863 | * @param id
|
23864 | */
|
23865 |
|
23866 |
|
23867 | var draw = function draw(text, id) {
|
23868 | conf = (0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().state;
|
23869 | _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy.clear();
|
23870 | _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.parse(text);
|
23871 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Rendering diagram ' + text); // Fetch the default direction, use TD if none was found
|
23872 |
|
23873 | var diagram = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id='".concat(id, "']"));
|
23874 | insertMarkers(diagram); // Layout graph, Create a new directed graph
|
23875 |
|
23876 | var graph = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
|
23877 | multigraph: true,
|
23878 | compound: true,
|
23879 | // acyclicer: 'greedy',
|
23880 | rankdir: 'RL' // ranksep: '20'
|
23881 |
|
23882 | }); // Default to assigning a new object as a label for each new edge.
|
23883 |
|
23884 | graph.setDefaultEdgeLabel(function () {
|
23885 | return {};
|
23886 | });
|
23887 | var rootDoc = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRootDoc();
|
23888 | renderDoc(rootDoc, diagram, undefined, false);
|
23889 | var padding = conf.padding;
|
23890 | var bounds = diagram.node().getBBox();
|
23891 | var width = bounds.width + padding * 2;
|
23892 | var height = bounds.height + padding * 2; // zoom in a bit
|
23893 |
|
23894 | var svgWidth = width * 1.75;
|
23895 | (0,_utils__WEBPACK_IMPORTED_MODULE_7__.configureSvgSize)(diagram, height, svgWidth, conf.useMaxWidth);
|
23896 | diagram.attr('viewBox', "".concat(bounds.x - conf.padding, " ").concat(bounds.y - conf.padding, " ") + width + ' ' + height);
|
23897 | };
|
23898 |
|
23899 | var getLabelWidth = function getLabelWidth(text) {
|
23900 | return text ? text.length * conf.fontSizeFactor : 1;
|
23901 | };
|
23902 |
|
23903 | var renderDoc = function renderDoc(doc, diagram, parentId, altBkg) {
|
23904 | // // Layout graph, Create a new directed graph
|
23905 | var graph = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
|
23906 | compound: true,
|
23907 | multigraph: true
|
23908 | });
|
23909 | var i;
|
23910 | var edgeFreeDoc = true;
|
23911 |
|
23912 | for (i = 0; i < doc.length; i++) {
|
23913 | if (doc[i].stmt === 'relation') {
|
23914 | edgeFreeDoc = false;
|
23915 | break;
|
23916 | }
|
23917 | } // Set an object for the graph label
|
23918 |
|
23919 |
|
23920 | if (parentId) graph.setGraph({
|
23921 | rankdir: 'LR',
|
23922 | multigraph: true,
|
23923 | compound: true,
|
23924 | // acyclicer: 'greedy',
|
23925 | ranker: 'tight-tree',
|
23926 | ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
|
23927 | nodeSep: edgeFreeDoc ? 1 : 50,
|
23928 | isMultiGraph: true // ranksep: 5,
|
23929 | // nodesep: 1
|
23930 |
|
23931 | });else {
|
23932 | graph.setGraph({
|
23933 | rankdir: 'TB',
|
23934 | multigraph: true,
|
23935 | compound: true,
|
23936 | // isCompound: true,
|
23937 | // acyclicer: 'greedy',
|
23938 | // ranker: 'longest-path'
|
23939 | ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
|
23940 | nodeSep: edgeFreeDoc ? 1 : 50,
|
23941 | ranker: 'tight-tree',
|
23942 | // ranker: 'network-simplex'
|
23943 | isMultiGraph: true
|
23944 | });
|
23945 | } // Default to assigning a new object as a label for each new edge.
|
23946 |
|
23947 | graph.setDefaultEdgeLabel(function () {
|
23948 | return {};
|
23949 | });
|
23950 | _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].extract(doc);
|
23951 | var states = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].getStates();
|
23952 | var relations = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
|
23953 | var keys = Object.keys(states);
|
23954 | var first = true;
|
23955 |
|
23956 | for (var _i = 0; _i < keys.length; _i++) {
|
23957 | var stateDef = states[keys[_i]];
|
23958 |
|
23959 | if (parentId) {
|
23960 | stateDef.parentId = parentId;
|
23961 | }
|
23962 |
|
23963 | var node = void 0;
|
23964 |
|
23965 | if (stateDef.doc) {
|
23966 | var sub = diagram.append('g').attr('id', stateDef.id).attr('class', 'stateGroup');
|
23967 | node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg);
|
23968 |
|
23969 | if (first) {
|
23970 | // first = false;
|
23971 | sub = (0,_shapes__WEBPACK_IMPORTED_MODULE_8__.addTitleAndBox)(sub, stateDef, altBkg);
|
23972 | var boxBounds = sub.node().getBBox();
|
23973 | node.width = boxBounds.width;
|
23974 | node.height = boxBounds.height + conf.padding / 2;
|
23975 | transformationLog[stateDef.id] = {
|
23976 | y: conf.compositTitleSize
|
23977 | };
|
23978 | } else {
|
23979 | // sub = addIdAndBox(sub, stateDef);
|
23980 | var _boxBounds = sub.node().getBBox();
|
23981 |
|
23982 | node.width = _boxBounds.width;
|
23983 | node.height = _boxBounds.height; // transformationLog[stateDef.id] = { y: conf.compositTitleSize };
|
23984 | }
|
23985 | } else {
|
23986 | node = (0,_shapes__WEBPACK_IMPORTED_MODULE_8__.drawState)(diagram, stateDef, graph);
|
23987 | }
|
23988 |
|
23989 | if (stateDef.note) {
|
23990 | // Draw note note
|
23991 | var noteDef = {
|
23992 | descriptions: [],
|
23993 | id: stateDef.id + '-note',
|
23994 | note: stateDef.note,
|
23995 | type: 'note'
|
23996 | };
|
23997 | var note = (0,_shapes__WEBPACK_IMPORTED_MODULE_8__.drawState)(diagram, noteDef, graph); // graph.setNode(node.id, node);
|
23998 |
|
23999 | if (stateDef.note.position === 'left of') {
|
24000 | graph.setNode(node.id + '-note', note);
|
24001 | graph.setNode(node.id, node);
|
24002 | } else {
|
24003 | graph.setNode(node.id, node);
|
24004 | graph.setNode(node.id + '-note', note);
|
24005 | } // graph.setNode(node.id);
|
24006 |
|
24007 |
|
24008 | graph.setParent(node.id, node.id + '-group');
|
24009 | graph.setParent(node.id + '-note', node.id + '-group');
|
24010 | } else {
|
24011 | // Add nodes to the graph. The first argument is the node id. The second is
|
24012 | // metadata about the node. In this case we're going to add labels to each of
|
24013 | // our nodes.
|
24014 | graph.setNode(node.id, node);
|
24015 | }
|
24016 | }
|
24017 |
|
24018 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Count=', graph.nodeCount(), graph);
|
24019 | var cnt = 0;
|
24020 | relations.forEach(function (relation) {
|
24021 | cnt++;
|
24022 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Setting edge', relation);
|
24023 | graph.setEdge(relation.id1, relation.id2, {
|
24024 | relation: relation,
|
24025 | width: getLabelWidth(relation.title),
|
24026 | height: conf.labelHeight * _common_common__WEBPACK_IMPORTED_MODULE_9__["default"].getRows(relation.title).length,
|
24027 | labelpos: 'c'
|
24028 | }, 'id' + cnt);
|
24029 | });
|
24030 | dagre__WEBPACK_IMPORTED_MODULE_1___default().layout(graph);
|
24031 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Graph after layout', graph.nodes());
|
24032 | var svgElem = diagram.node();
|
24033 | graph.nodes().forEach(function (v) {
|
24034 | if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
|
24035 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.warn('Node ' + v + ': ' + JSON.stringify(graph.node(v)));
|
24036 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.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) + ' )');
|
24037 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + svgElem.id + ' #' + v).attr('data-x-shift', graph.node(v).x - graph.node(v).width / 2);
|
24038 | var dividers = document.querySelectorAll('#' + svgElem.id + ' #' + v + ' .divider');
|
24039 | dividers.forEach(function (divider) {
|
24040 | var parent = divider.parentElement;
|
24041 | var pWidth = 0;
|
24042 | var pShift = 0;
|
24043 |
|
24044 | if (parent) {
|
24045 | if (parent.parentElement) pWidth = parent.parentElement.getBBox().width;
|
24046 | pShift = parseInt(parent.getAttribute('data-x-shift'), 10);
|
24047 |
|
24048 | if (Number.isNaN(pShift)) {
|
24049 | pShift = 0;
|
24050 | }
|
24051 | }
|
24052 |
|
24053 | divider.setAttribute('x1', 0 - pShift + 8);
|
24054 | divider.setAttribute('x2', pWidth - pShift - 8);
|
24055 | });
|
24056 | } else {
|
24057 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('No Node ' + v + ': ' + JSON.stringify(graph.node(v)));
|
24058 | }
|
24059 | });
|
24060 | var stateBox = svgElem.getBBox();
|
24061 | graph.edges().forEach(function (e) {
|
24062 | if (typeof e !== 'undefined' && typeof graph.edge(e) !== 'undefined') {
|
24063 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));
|
24064 | (0,_shapes__WEBPACK_IMPORTED_MODULE_8__.drawEdge)(diagram, graph.edge(e), graph.edge(e).relation);
|
24065 | }
|
24066 | });
|
24067 | stateBox = svgElem.getBBox();
|
24068 | var stateInfo = {
|
24069 | id: parentId ? parentId : 'root',
|
24070 | label: parentId ? parentId : 'root',
|
24071 | width: 0,
|
24072 | height: 0
|
24073 | };
|
24074 | stateInfo.width = stateBox.width + 2 * conf.padding;
|
24075 | stateInfo.height = stateBox.height + 2 * conf.padding;
|
24076 | _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Doc rendered', stateInfo, graph);
|
24077 | return stateInfo;
|
24078 | };
|
24079 |
|
24080 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
24081 | setConf: setConf,
|
24082 | draw: draw
|
24083 | });
|
24084 |
|
24085 | /***/ }),
|
24086 |
|
24087 | /***/ "./src/diagrams/state/styles.js":
|
24088 | /*!**************************************!*\
|
24089 | !*** ./src/diagrams/state/styles.js ***!
|
24090 | \**************************************/
|
24091 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
24092 |
|
24093 | "use strict";
|
24094 | __webpack_require__.r(__webpack_exports__);
|
24095 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
24096 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
24097 | /* harmony export */ });
|
24098 | var getStyles = function getStyles(options) {
|
24099 | 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");
|
24100 | };
|
24101 |
|
24102 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
24103 |
|
24104 | /***/ }),
|
24105 |
|
24106 | /***/ "./src/diagrams/user-journey/journeyDb.js":
|
24107 | /*!************************************************!*\
|
24108 | !*** ./src/diagrams/user-journey/journeyDb.js ***!
|
24109 | \************************************************/
|
24110 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
24111 |
|
24112 | "use strict";
|
24113 | __webpack_require__.r(__webpack_exports__);
|
24114 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
24115 | /* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
|
24116 | /* harmony export */ "clear": () => (/* binding */ clear),
|
24117 | /* harmony export */ "setTitle": () => (/* binding */ setTitle),
|
24118 | /* harmony export */ "getTitle": () => (/* binding */ getTitle),
|
24119 | /* harmony export */ "addSection": () => (/* binding */ addSection),
|
24120 | /* harmony export */ "getSections": () => (/* binding */ getSections),
|
24121 | /* harmony export */ "getTasks": () => (/* binding */ getTasks),
|
24122 | /* harmony export */ "addTask": () => (/* binding */ addTask),
|
24123 | /* harmony export */ "addTaskOrg": () => (/* binding */ addTaskOrg),
|
24124 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
24125 | /* harmony export */ });
|
24126 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
|
24127 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
24128 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
24129 |
|
24130 | 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."); }
|
24131 |
|
24132 | 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); }
|
24133 |
|
24134 | function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
24135 |
|
24136 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
24137 |
|
24138 | 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; }
|
24139 |
|
24140 |
|
24141 |
|
24142 | var title = '';
|
24143 | var currentSection = '';
|
24144 | var sections = [];
|
24145 | var tasks = [];
|
24146 | var rawTasks = [];
|
24147 | var parseDirective = function parseDirective(statement, context, type) {
|
24148 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
|
24149 | };
|
24150 | var clear = function clear() {
|
24151 | sections.length = 0;
|
24152 | tasks.length = 0;
|
24153 | currentSection = '';
|
24154 | title = '';
|
24155 | rawTasks.length = 0;
|
24156 | };
|
24157 | var setTitle = function setTitle(txt) {
|
24158 | title = txt;
|
24159 | };
|
24160 | var getTitle = function getTitle() {
|
24161 | return title;
|
24162 | };
|
24163 | var addSection = function addSection(txt) {
|
24164 | currentSection = txt;
|
24165 | sections.push(txt);
|
24166 | };
|
24167 | var getSections = function getSections() {
|
24168 | return sections;
|
24169 | };
|
24170 | var getTasks = function getTasks() {
|
24171 | var allItemsProcessed = compileTasks();
|
24172 | var maxDepth = 100;
|
24173 | var iterationCount = 0;
|
24174 |
|
24175 | while (!allItemsProcessed && iterationCount < maxDepth) {
|
24176 | allItemsProcessed = compileTasks();
|
24177 | iterationCount++;
|
24178 | }
|
24179 |
|
24180 | tasks.push.apply(tasks, rawTasks);
|
24181 | return tasks;
|
24182 | };
|
24183 |
|
24184 | var updateActors = function updateActors() {
|
24185 | var tempActors = [];
|
24186 | tasks.forEach(function (task) {
|
24187 | if (task.people) {
|
24188 | tempActors.push.apply(tempActors, _toConsumableArray(task.people));
|
24189 | }
|
24190 | });
|
24191 | var unique = new Set(tempActors);
|
24192 | return _toConsumableArray(unique).sort();
|
24193 | };
|
24194 |
|
24195 | var addTask = function addTask(descr, taskData) {
|
24196 | var pieces = taskData.substr(1).split(':');
|
24197 | var score = 0;
|
24198 | var peeps = [];
|
24199 |
|
24200 | if (pieces.length === 1) {
|
24201 | score = Number(pieces[0]);
|
24202 | peeps = [];
|
24203 | } else {
|
24204 | score = Number(pieces[0]);
|
24205 | peeps = pieces[1].split(',');
|
24206 | }
|
24207 |
|
24208 | var peopleList = peeps.map(function (s) {
|
24209 | return s.trim();
|
24210 | });
|
24211 | var rawTask = {
|
24212 | section: currentSection,
|
24213 | type: currentSection,
|
24214 | people: peopleList,
|
24215 | task: descr,
|
24216 | score: score
|
24217 | };
|
24218 | rawTasks.push(rawTask);
|
24219 | };
|
24220 | var addTaskOrg = function addTaskOrg(descr) {
|
24221 | var newTask = {
|
24222 | section: currentSection,
|
24223 | type: currentSection,
|
24224 | description: descr,
|
24225 | task: descr,
|
24226 | classes: []
|
24227 | };
|
24228 | tasks.push(newTask);
|
24229 | };
|
24230 |
|
24231 | var compileTasks = function compileTasks() {
|
24232 | var compileTask = function compileTask(pos) {
|
24233 | return rawTasks[pos].processed;
|
24234 | };
|
24235 |
|
24236 | var allProcessed = true;
|
24237 |
|
24238 | for (var i = 0; i < rawTasks.length; i++) {
|
24239 | compileTask(i);
|
24240 | allProcessed = allProcessed && rawTasks[i].processed;
|
24241 | }
|
24242 |
|
24243 | return allProcessed;
|
24244 | };
|
24245 |
|
24246 | var getActors = function getActors() {
|
24247 | return updateActors();
|
24248 | };
|
24249 |
|
24250 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
24251 | parseDirective: parseDirective,
|
24252 | getConfig: function getConfig() {
|
24253 | return _config__WEBPACK_IMPORTED_MODULE_1__.getConfig().journey;
|
24254 | },
|
24255 | clear: clear,
|
24256 | setTitle: setTitle,
|
24257 | getTitle: getTitle,
|
24258 | addSection: addSection,
|
24259 | getSections: getSections,
|
24260 | getTasks: getTasks,
|
24261 | addTask: addTask,
|
24262 | addTaskOrg: addTaskOrg,
|
24263 | getActors: getActors
|
24264 | });
|
24265 |
|
24266 | /***/ }),
|
24267 |
|
24268 | /***/ "./src/diagrams/user-journey/journeyRenderer.js":
|
24269 | /*!******************************************************!*\
|
24270 | !*** ./src/diagrams/user-journey/journeyRenderer.js ***!
|
24271 | \******************************************************/
|
24272 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
24273 |
|
24274 | "use strict";
|
24275 | __webpack_require__.r(__webpack_exports__);
|
24276 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
24277 | /* harmony export */ "setConf": () => (/* binding */ setConf),
|
24278 | /* harmony export */ "draw": () => (/* binding */ draw),
|
24279 | /* harmony export */ "bounds": () => (/* binding */ bounds),
|
24280 | /* harmony export */ "drawTasks": () => (/* binding */ drawTasks),
|
24281 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
24282 | /* harmony export */ });
|
24283 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
24284 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
24285 | /* harmony import */ var _parser_journey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parser/journey */ "./src/diagrams/user-journey/parser/journey.jison");
|
24286 | /* harmony import */ var _parser_journey__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_parser_journey__WEBPACK_IMPORTED_MODULE_1__);
|
24287 | /* harmony import */ var _journeyDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./journeyDb */ "./src/diagrams/user-journey/journeyDb.js");
|
24288 | /* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/user-journey/svgDraw.js");
|
24289 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
|
24290 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
|
24291 |
|
24292 |
|
24293 |
|
24294 |
|
24295 |
|
24296 |
|
24297 | _parser_journey__WEBPACK_IMPORTED_MODULE_1__.parser.yy = _journeyDb__WEBPACK_IMPORTED_MODULE_2__["default"];
|
24298 | var setConf = function setConf(cnf) {
|
24299 | var keys = Object.keys(cnf);
|
24300 | keys.forEach(function (key) {
|
24301 | conf[key] = cnf[key];
|
24302 | });
|
24303 | };
|
24304 | var actors = {};
|
24305 |
|
24306 | function drawActorLegend(diagram) {
|
24307 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().journey; // Draw the actors
|
24308 |
|
24309 | var yPos = 60;
|
24310 | Object.keys(actors).forEach(function (person) {
|
24311 | var colour = actors[person].color;
|
24312 | var circleData = {
|
24313 | cx: 20,
|
24314 | cy: yPos,
|
24315 | r: 7,
|
24316 | fill: colour,
|
24317 | stroke: '#000',
|
24318 | pos: actors[person].position
|
24319 | };
|
24320 | _svgDraw__WEBPACK_IMPORTED_MODULE_4__["default"].drawCircle(diagram, circleData);
|
24321 | var labelData = {
|
24322 | x: 40,
|
24323 | y: yPos + 7,
|
24324 | fill: '#666',
|
24325 | text: person,
|
24326 | textMargin: conf.boxTextMargin | 5
|
24327 | };
|
24328 | _svgDraw__WEBPACK_IMPORTED_MODULE_4__["default"].drawText(diagram, labelData);
|
24329 | yPos += 20;
|
24330 | });
|
24331 | }
|
24332 |
|
24333 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().journey;
|
24334 | var LEFT_MARGIN = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().journey.leftMargin;
|
24335 | var draw = function draw(text, id) {
|
24336 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().journey;
|
24337 | _parser_journey__WEBPACK_IMPORTED_MODULE_1__.parser.yy.clear();
|
24338 | _parser_journey__WEBPACK_IMPORTED_MODULE_1__.parser.parse(text + '\n');
|
24339 | bounds.init();
|
24340 | var diagram = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + id);
|
24341 | diagram.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink');
|
24342 | _svgDraw__WEBPACK_IMPORTED_MODULE_4__["default"].initGraphics(diagram);
|
24343 | var tasks = _parser_journey__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getTasks();
|
24344 | var title = _parser_journey__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getTitle();
|
24345 | var actorNames = _parser_journey__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getActors();
|
24346 |
|
24347 | for (var member in actors) {
|
24348 | delete actors[member];
|
24349 | }
|
24350 |
|
24351 | var actorPos = 0;
|
24352 | actorNames.forEach(function (actorName) {
|
24353 | actors[actorName] = {
|
24354 | color: conf.actorColours[actorPos % conf.actorColours.length],
|
24355 | position: actorPos
|
24356 | };
|
24357 | actorPos++;
|
24358 | });
|
24359 | drawActorLegend(diagram);
|
24360 | bounds.insert(0, 0, LEFT_MARGIN, Object.keys(actors).length * 50);
|
24361 | drawTasks(diagram, tasks, 0);
|
24362 | var box = bounds.getBounds();
|
24363 |
|
24364 | if (title) {
|
24365 | diagram.append('text').text(title).attr('x', LEFT_MARGIN).attr('font-size', '4ex').attr('font-weight', 'bold').attr('y', 25);
|
24366 | }
|
24367 |
|
24368 | var height = box.stopy - box.starty + 2 * conf.diagramMarginY;
|
24369 | var width = LEFT_MARGIN + box.stopx + 2 * conf.diagramMarginX;
|
24370 | (0,_utils__WEBPACK_IMPORTED_MODULE_5__.configureSvgSize)(diagram, height, width, conf.useMaxWidth); // Draw activity line
|
24371 |
|
24372 | diagram.append('line').attr('x1', LEFT_MARGIN).attr('y1', conf.height * 4) // One section head + one task + margins
|
24373 | .attr('x2', width - LEFT_MARGIN - 4) // Subtract stroke width so arrow point is retained
|
24374 | .attr('y2', conf.height * 4).attr('stroke-width', 4).attr('stroke', 'black').attr('marker-end', 'url(#arrowhead)');
|
24375 | var extraVertForTitle = title ? 70 : 0;
|
24376 | diagram.attr('viewBox', "".concat(box.startx, " -25 ").concat(width, " ").concat(height + extraVertForTitle));
|
24377 | diagram.attr('preserveAspectRatio', 'xMinYMin meet');
|
24378 | diagram.attr('height', height + extraVertForTitle + 25);
|
24379 | };
|
24380 | var bounds = {
|
24381 | data: {
|
24382 | startx: undefined,
|
24383 | stopx: undefined,
|
24384 | starty: undefined,
|
24385 | stopy: undefined
|
24386 | },
|
24387 | verticalPos: 0,
|
24388 | sequenceItems: [],
|
24389 | init: function init() {
|
24390 | this.sequenceItems = [];
|
24391 | this.data = {
|
24392 | startx: undefined,
|
24393 | stopx: undefined,
|
24394 | starty: undefined,
|
24395 | stopy: undefined
|
24396 | };
|
24397 | this.verticalPos = 0;
|
24398 | },
|
24399 | updateVal: function updateVal(obj, key, val, fun) {
|
24400 | if (typeof obj[key] === 'undefined') {
|
24401 | obj[key] = val;
|
24402 | } else {
|
24403 | obj[key] = fun(val, obj[key]);
|
24404 | }
|
24405 | },
|
24406 | updateBounds: function updateBounds(startx, starty, stopx, stopy) {
|
24407 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().journey;
|
24408 |
|
24409 | var _self = this;
|
24410 |
|
24411 | var cnt = 0;
|
24412 |
|
24413 | function updateFn(type) {
|
24414 | return function updateItemBounds(item) {
|
24415 | cnt++; // The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
|
24416 |
|
24417 | var n = _self.sequenceItems.length - cnt + 1;
|
24418 |
|
24419 | _self.updateVal(item, 'starty', starty - n * conf.boxMargin, Math.min);
|
24420 |
|
24421 | _self.updateVal(item, 'stopy', stopy + n * conf.boxMargin, Math.max);
|
24422 |
|
24423 | _self.updateVal(bounds.data, 'startx', startx - n * conf.boxMargin, Math.min);
|
24424 |
|
24425 | _self.updateVal(bounds.data, 'stopx', stopx + n * conf.boxMargin, Math.max);
|
24426 |
|
24427 | if (!(type === 'activation')) {
|
24428 | _self.updateVal(item, 'startx', startx - n * conf.boxMargin, Math.min);
|
24429 |
|
24430 | _self.updateVal(item, 'stopx', stopx + n * conf.boxMargin, Math.max);
|
24431 |
|
24432 | _self.updateVal(bounds.data, 'starty', starty - n * conf.boxMargin, Math.min);
|
24433 |
|
24434 | _self.updateVal(bounds.data, 'stopy', stopy + n * conf.boxMargin, Math.max);
|
24435 | }
|
24436 | };
|
24437 | }
|
24438 |
|
24439 | this.sequenceItems.forEach(updateFn());
|
24440 | },
|
24441 | insert: function insert(startx, starty, stopx, stopy) {
|
24442 | var _startx = Math.min(startx, stopx);
|
24443 |
|
24444 | var _stopx = Math.max(startx, stopx);
|
24445 |
|
24446 | var _starty = Math.min(starty, stopy);
|
24447 |
|
24448 | var _stopy = Math.max(starty, stopy);
|
24449 |
|
24450 | this.updateVal(bounds.data, 'startx', _startx, Math.min);
|
24451 | this.updateVal(bounds.data, 'starty', _starty, Math.min);
|
24452 | this.updateVal(bounds.data, 'stopx', _stopx, Math.max);
|
24453 | this.updateVal(bounds.data, 'stopy', _stopy, Math.max);
|
24454 | this.updateBounds(_startx, _starty, _stopx, _stopy);
|
24455 | },
|
24456 | bumpVerticalPos: function bumpVerticalPos(bump) {
|
24457 | this.verticalPos = this.verticalPos + bump;
|
24458 | this.data.stopy = this.verticalPos;
|
24459 | },
|
24460 | getVerticalPos: function getVerticalPos() {
|
24461 | return this.verticalPos;
|
24462 | },
|
24463 | getBounds: function getBounds() {
|
24464 | return this.data;
|
24465 | }
|
24466 | };
|
24467 | var fills = conf.sectionFills;
|
24468 | var textColours = conf.sectionColours;
|
24469 | var drawTasks = function drawTasks(diagram, tasks, verticalPos) {
|
24470 | var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().journey;
|
24471 | var lastSection = '';
|
24472 | var sectionVHeight = conf.height * 2 + conf.diagramMarginY;
|
24473 | var taskPos = verticalPos + sectionVHeight;
|
24474 | var sectionNumber = 0;
|
24475 | var fill = '#CCC';
|
24476 | var colour = 'black';
|
24477 | var num = 0; // Draw the tasks
|
24478 |
|
24479 | for (var i = 0; i < tasks.length; i++) {
|
24480 | var task = tasks[i];
|
24481 |
|
24482 | if (lastSection !== task.section) {
|
24483 | fill = fills[sectionNumber % fills.length];
|
24484 | num = sectionNumber % fills.length;
|
24485 | colour = textColours[sectionNumber % textColours.length];
|
24486 | var section = {
|
24487 | x: i * conf.taskMargin + i * conf.width + LEFT_MARGIN,
|
24488 | y: 50,
|
24489 | text: task.section,
|
24490 | fill: fill,
|
24491 | num: num,
|
24492 | colour: colour
|
24493 | };
|
24494 | _svgDraw__WEBPACK_IMPORTED_MODULE_4__["default"].drawSection(diagram, section, conf);
|
24495 | lastSection = task.section;
|
24496 | sectionNumber++;
|
24497 | } // Collect the actors involved in the task
|
24498 |
|
24499 |
|
24500 | var taskActors = task.people.reduce(function (acc, actorName) {
|
24501 | if (actors[actorName]) {
|
24502 | acc[actorName] = actors[actorName];
|
24503 | }
|
24504 |
|
24505 | return acc;
|
24506 | }, {}); // Add some rendering data to the object
|
24507 |
|
24508 | task.x = i * conf.taskMargin + i * conf.width + LEFT_MARGIN;
|
24509 | task.y = taskPos;
|
24510 | task.width = conf.diagramMarginX;
|
24511 | task.height = conf.diagramMarginY;
|
24512 | task.colour = colour;
|
24513 | task.fill = fill;
|
24514 | task.num = num;
|
24515 | task.actors = taskActors; // Draw the box with the attached line
|
24516 |
|
24517 | _svgDraw__WEBPACK_IMPORTED_MODULE_4__["default"].drawTask(diagram, task, conf);
|
24518 | bounds.insert(task.x, task.y, task.x + task.width + conf.taskMargin, 300 + 5 * 30); // stopy is the length of the descenders.
|
24519 | }
|
24520 | };
|
24521 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
24522 | setConf: setConf,
|
24523 | draw: draw
|
24524 | });
|
24525 |
|
24526 | /***/ }),
|
24527 |
|
24528 | /***/ "./src/diagrams/user-journey/styles.js":
|
24529 | /*!*********************************************!*\
|
24530 | !*** ./src/diagrams/user-journey/styles.js ***!
|
24531 | \*********************************************/
|
24532 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
24533 |
|
24534 | "use strict";
|
24535 | __webpack_require__.r(__webpack_exports__);
|
24536 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
24537 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
24538 | /* harmony export */ });
|
24539 | var getStyles = function getStyles(options) {
|
24540 | 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");
|
24541 | };
|
24542 |
|
24543 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
24544 |
|
24545 | /***/ }),
|
24546 |
|
24547 | /***/ "./src/diagrams/user-journey/svgDraw.js":
|
24548 | /*!**********************************************!*\
|
24549 | !*** ./src/diagrams/user-journey/svgDraw.js ***!
|
24550 | \**********************************************/
|
24551 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
24552 |
|
24553 | "use strict";
|
24554 | __webpack_require__.r(__webpack_exports__);
|
24555 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
24556 | /* harmony export */ "drawRect": () => (/* binding */ drawRect),
|
24557 | /* harmony export */ "drawFace": () => (/* binding */ drawFace),
|
24558 | /* harmony export */ "drawCircle": () => (/* binding */ drawCircle),
|
24559 | /* harmony export */ "drawText": () => (/* binding */ drawText),
|
24560 | /* harmony export */ "drawLabel": () => (/* binding */ drawLabel),
|
24561 | /* harmony export */ "drawSection": () => (/* binding */ drawSection),
|
24562 | /* harmony export */ "drawTask": () => (/* binding */ drawTask),
|
24563 | /* harmony export */ "drawBackgroundRect": () => (/* binding */ drawBackgroundRect),
|
24564 | /* harmony export */ "getTextObj": () => (/* binding */ getTextObj),
|
24565 | /* harmony export */ "getNoteRect": () => (/* binding */ getNoteRect),
|
24566 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
24567 | /* harmony export */ });
|
24568 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
24569 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
24570 |
|
24571 | var drawRect = function drawRect(elem, rectData) {
|
24572 | var rectElem = elem.append('rect');
|
24573 | rectElem.attr('x', rectData.x);
|
24574 | rectElem.attr('y', rectData.y);
|
24575 | rectElem.attr('fill', rectData.fill);
|
24576 | rectElem.attr('stroke', rectData.stroke);
|
24577 | rectElem.attr('width', rectData.width);
|
24578 | rectElem.attr('height', rectData.height);
|
24579 | rectElem.attr('rx', rectData.rx);
|
24580 | rectElem.attr('ry', rectData.ry);
|
24581 |
|
24582 | if (typeof rectData.class !== 'undefined') {
|
24583 | rectElem.attr('class', rectData.class);
|
24584 | }
|
24585 |
|
24586 | return rectElem;
|
24587 | };
|
24588 | var drawFace = function drawFace(element, faceData) {
|
24589 | var radius = 15;
|
24590 | 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');
|
24591 | var face = element.append('g'); //left eye
|
24592 |
|
24593 | 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
|
24594 |
|
24595 | 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');
|
24596 |
|
24597 | function smile(face) {
|
24598 | 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
|
24599 |
|
24600 | face.append('path').attr('class', 'mouth').attr('d', arc).attr('transform', 'translate(' + faceData.cx + ',' + (faceData.cy + 2) + ')');
|
24601 | }
|
24602 |
|
24603 | function sad(face) {
|
24604 | 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
|
24605 |
|
24606 | face.append('path').attr('class', 'mouth').attr('d', arc).attr('transform', 'translate(' + faceData.cx + ',' + (faceData.cy + 7) + ')');
|
24607 | }
|
24608 |
|
24609 | function ambivalent(face) {
|
24610 | 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');
|
24611 | }
|
24612 |
|
24613 | if (faceData.score > 3) {
|
24614 | smile(face);
|
24615 | } else if (faceData.score < 3) {
|
24616 | sad(face);
|
24617 | } else {
|
24618 | ambivalent(face);
|
24619 | }
|
24620 |
|
24621 | return circleElement;
|
24622 | };
|
24623 | var drawCircle = function drawCircle(element, circleData) {
|
24624 | var circleElement = element.append('circle');
|
24625 | circleElement.attr('cx', circleData.cx);
|
24626 | circleElement.attr('cy', circleData.cy);
|
24627 | circleElement.attr('class', 'actor-' + circleData.pos);
|
24628 | circleElement.attr('fill', circleData.fill);
|
24629 | circleElement.attr('stroke', circleData.stroke);
|
24630 | circleElement.attr('r', circleData.r);
|
24631 |
|
24632 | if (typeof circleElement.class !== 'undefined') {
|
24633 | circleElement.attr('class', circleElement.class);
|
24634 | }
|
24635 |
|
24636 | if (typeof circleData.title !== 'undefined') {
|
24637 | circleElement.append('title').text(circleData.title);
|
24638 | }
|
24639 |
|
24640 | return circleElement;
|
24641 | };
|
24642 | var drawText = function drawText(elem, textData) {
|
24643 | // Remove and ignore br:s
|
24644 | var nText = textData.text.replace(/<br\s*\/?>/gi, ' ');
|
24645 | var textElem = elem.append('text');
|
24646 | textElem.attr('x', textData.x);
|
24647 | textElem.attr('y', textData.y);
|
24648 | textElem.attr('class', 'legend');
|
24649 | textElem.style('text-anchor', textData.anchor);
|
24650 |
|
24651 | if (typeof textData.class !== 'undefined') {
|
24652 | textElem.attr('class', textData.class);
|
24653 | }
|
24654 |
|
24655 | var span = textElem.append('tspan');
|
24656 | span.attr('x', textData.x + textData.textMargin * 2);
|
24657 | span.text(nText);
|
24658 | return textElem;
|
24659 | };
|
24660 | var drawLabel = function drawLabel(elem, txtObject) {
|
24661 | function genPoints(x, y, width, height, cut) {
|
24662 | return x + ',' + y + ' ' + (x + width) + ',' + y + ' ' + (x + width) + ',' + (y + height - cut) + ' ' + (x + width - cut * 1.2) + ',' + (y + height) + ' ' + x + ',' + (y + height);
|
24663 | }
|
24664 |
|
24665 | var polygon = elem.append('polygon');
|
24666 | polygon.attr('points', genPoints(txtObject.x, txtObject.y, 50, 20, 7));
|
24667 | polygon.attr('class', 'labelBox');
|
24668 | txtObject.y = txtObject.y + txtObject.labelMargin;
|
24669 | txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
|
24670 | drawText(elem, txtObject);
|
24671 | };
|
24672 | var drawSection = function drawSection(elem, section, conf) {
|
24673 | var g = elem.append('g');
|
24674 | var rect = getNoteRect();
|
24675 | rect.x = section.x;
|
24676 | rect.y = section.y;
|
24677 | rect.fill = section.fill;
|
24678 | rect.width = conf.width;
|
24679 | rect.height = conf.height;
|
24680 | rect.class = 'journey-section section-type-' + section.num;
|
24681 | rect.rx = 3;
|
24682 | rect.ry = 3;
|
24683 | drawRect(g, rect);
|
24684 |
|
24685 | _drawTextCandidateFunc(conf)(section.text, g, rect.x, rect.y, rect.width, rect.height, {
|
24686 | class: 'journey-section section-type-' + section.num
|
24687 | }, conf, section.colour);
|
24688 | };
|
24689 | var taskCount = -1;
|
24690 | /**
|
24691 | * Draws an actor in the diagram with the attaced line
|
24692 | * @param elem The HTML element
|
24693 | * @param task The task to render
|
24694 | * @param conf The global configuration
|
24695 | */
|
24696 |
|
24697 | var drawTask = function drawTask(elem, task, conf) {
|
24698 | var center = task.x + conf.width / 2;
|
24699 | var g = elem.append('g');
|
24700 | taskCount++;
|
24701 | var maxHeight = 300 + 5 * 30;
|
24702 | 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');
|
24703 | drawFace(g, {
|
24704 | cx: center,
|
24705 | cy: 300 + (5 - task.score) * 30,
|
24706 | score: task.score
|
24707 | });
|
24708 | var rect = getNoteRect();
|
24709 | rect.x = task.x;
|
24710 | rect.y = task.y;
|
24711 | rect.fill = task.fill;
|
24712 | rect.width = conf.width;
|
24713 | rect.height = conf.height;
|
24714 | rect.class = 'task task-type-' + task.num;
|
24715 | rect.rx = 3;
|
24716 | rect.ry = 3;
|
24717 | drawRect(g, rect);
|
24718 | var xPos = task.x + 14;
|
24719 | task.people.forEach(function (person) {
|
24720 | var colour = task.actors[person].color;
|
24721 | var circle = {
|
24722 | cx: xPos,
|
24723 | cy: task.y,
|
24724 | r: 7,
|
24725 | fill: colour,
|
24726 | stroke: '#000',
|
24727 | title: person,
|
24728 | pos: task.actors[person].position
|
24729 | };
|
24730 | drawCircle(g, circle);
|
24731 | xPos += 10;
|
24732 | });
|
24733 |
|
24734 | _drawTextCandidateFunc(conf)(task.task, g, rect.x, rect.y, rect.width, rect.height, {
|
24735 | class: 'task'
|
24736 | }, conf, task.colour);
|
24737 | };
|
24738 | /**
|
24739 | * Draws a background rectangle
|
24740 | * @param elem The html element
|
24741 | * @param bounds The bounds of the drawing
|
24742 | */
|
24743 |
|
24744 | var drawBackgroundRect = function drawBackgroundRect(elem, bounds) {
|
24745 | var rectElem = drawRect(elem, {
|
24746 | x: bounds.startx,
|
24747 | y: bounds.starty,
|
24748 | width: bounds.stopx - bounds.startx,
|
24749 | height: bounds.stopy - bounds.starty,
|
24750 | fill: bounds.fill,
|
24751 | class: 'rect'
|
24752 | });
|
24753 | rectElem.lower();
|
24754 | };
|
24755 | var getTextObj = function getTextObj() {
|
24756 | return {
|
24757 | x: 0,
|
24758 | y: 0,
|
24759 | fill: undefined,
|
24760 | 'text-anchor': 'start',
|
24761 | width: 100,
|
24762 | height: 100,
|
24763 | textMargin: 0,
|
24764 | rx: 0,
|
24765 | ry: 0
|
24766 | };
|
24767 | };
|
24768 | var getNoteRect = function getNoteRect() {
|
24769 | return {
|
24770 | x: 0,
|
24771 | y: 0,
|
24772 | width: 100,
|
24773 | anchor: 'start',
|
24774 | height: 100,
|
24775 | rx: 0,
|
24776 | ry: 0
|
24777 | };
|
24778 | };
|
24779 |
|
24780 | var _drawTextCandidateFunc = function () {
|
24781 | function byText(content, g, x, y, width, height, textAttrs, colour) {
|
24782 | 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);
|
24783 |
|
24784 | _setTextAttrs(text, textAttrs);
|
24785 | }
|
24786 |
|
24787 | function byTspan(content, g, x, y, width, height, textAttrs, conf, colour) {
|
24788 | var taskFontSize = conf.taskFontSize,
|
24789 | taskFontFamily = conf.taskFontFamily;
|
24790 | var lines = content.split(/<br\s*\/?>/gi);
|
24791 |
|
24792 | for (var i = 0; i < lines.length; i++) {
|
24793 | var dy = i * taskFontSize - taskFontSize * (lines.length - 1) / 2;
|
24794 | 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);
|
24795 | text.append('tspan').attr('x', x + width / 2).attr('dy', dy).text(lines[i]);
|
24796 | text.attr('y', y + height / 2.0).attr('dominant-baseline', 'central').attr('alignment-baseline', 'central');
|
24797 |
|
24798 | _setTextAttrs(text, textAttrs);
|
24799 | }
|
24800 | }
|
24801 |
|
24802 | function byFo(content, g, x, y, width, height, textAttrs, conf) {
|
24803 | var body = g.append('switch');
|
24804 | var f = body.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height).attr('position', 'fixed');
|
24805 | var text = f.append('xhtml:div').style('display', 'table').style('height', '100%').style('width', '100%');
|
24806 | text.append('div').attr('class', 'label').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle') // .style('color', colour)
|
24807 | .text(content);
|
24808 | byTspan(content, body, x, y, width, height, textAttrs, conf);
|
24809 |
|
24810 | _setTextAttrs(text, textAttrs);
|
24811 | }
|
24812 |
|
24813 | function _setTextAttrs(toText, fromTextAttrsDict) {
|
24814 | for (var key in fromTextAttrsDict) {
|
24815 | if (key in fromTextAttrsDict) {
|
24816 | // eslint-disable-line
|
24817 | // noinspection JSUnfilteredForInLoop
|
24818 | toText.attr(key, fromTextAttrsDict[key]);
|
24819 | }
|
24820 | }
|
24821 | }
|
24822 |
|
24823 | return function (conf) {
|
24824 | return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
|
24825 | };
|
24826 | }();
|
24827 |
|
24828 | var initGraphics = function initGraphics(graphics) {
|
24829 | 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
|
24830 | };
|
24831 |
|
24832 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
24833 | drawRect: drawRect,
|
24834 | drawCircle: drawCircle,
|
24835 | drawSection: drawSection,
|
24836 | drawText: drawText,
|
24837 | drawLabel: drawLabel,
|
24838 | drawTask: drawTask,
|
24839 | drawBackgroundRect: drawBackgroundRect,
|
24840 | getTextObj: getTextObj,
|
24841 | getNoteRect: getNoteRect,
|
24842 | initGraphics: initGraphics
|
24843 | });
|
24844 |
|
24845 | /***/ }),
|
24846 |
|
24847 | /***/ "./src/errorRenderer.js":
|
24848 | /*!******************************!*\
|
24849 | !*** ./src/errorRenderer.js ***!
|
24850 | \******************************/
|
24851 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
24852 |
|
24853 | "use strict";
|
24854 | __webpack_require__.r(__webpack_exports__);
|
24855 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
24856 | /* harmony export */ "setConf": () => (/* binding */ setConf),
|
24857 | /* harmony export */ "draw": () => (/* binding */ draw),
|
24858 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
24859 | /* harmony export */ });
|
24860 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
24861 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
24862 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
|
24863 | /**
|
24864 | * Created by knut on 14-12-11.
|
24865 | */
|
24866 |
|
24867 |
|
24868 | var conf = {};
|
24869 | var setConf = function setConf(cnf) {
|
24870 | var keys = Object.keys(cnf);
|
24871 | keys.forEach(function (key) {
|
24872 | conf[key] = cnf[key];
|
24873 | });
|
24874 | };
|
24875 | /**
|
24876 | * Draws a an info picture in the tag with id: id based on the graph definition in text.
|
24877 | * @param text
|
24878 | * @param id
|
24879 | */
|
24880 |
|
24881 | var draw = function draw(id, ver) {
|
24882 | try {
|
24883 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Renering svg for syntax error\n');
|
24884 | var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + id);
|
24885 | var g = svg.append('g');
|
24886 | 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');
|
24887 | 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');
|
24888 | 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');
|
24889 | 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');
|
24890 | 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');
|
24891 | 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');
|
24892 | g.append('text') // text label for the x axis
|
24893 | .attr('class', 'error-text').attr('x', 1240).attr('y', 250).attr('font-size', '150px').style('text-anchor', 'middle').text('Syntax error in graph');
|
24894 | g.append('text') // text label for the x axis
|
24895 | .attr('class', 'error-text').attr('x', 1050).attr('y', 400).attr('font-size', '100px').style('text-anchor', 'middle').text('mermaid version ' + ver);
|
24896 | svg.attr('height', 100);
|
24897 | svg.attr('width', 400);
|
24898 | svg.attr('viewBox', '768 0 512 512');
|
24899 | } catch (e) {
|
24900 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('Error while rendering info diagram');
|
24901 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.error(e.message);
|
24902 | }
|
24903 | };
|
24904 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
24905 | setConf: setConf,
|
24906 | draw: draw
|
24907 | });
|
24908 |
|
24909 | /***/ }),
|
24910 |
|
24911 | /***/ "./src/interactionDb.js":
|
24912 | /*!******************************!*\
|
24913 | !*** ./src/interactionDb.js ***!
|
24914 | \******************************/
|
24915 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
24916 |
|
24917 | "use strict";
|
24918 | __webpack_require__.r(__webpack_exports__);
|
24919 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
24920 | /* harmony export */ "addFunction": () => (/* binding */ addFunction),
|
24921 | /* harmony export */ "attachFunctions": () => (/* binding */ attachFunctions)
|
24922 | /* harmony export */ });
|
24923 | var interactionFunctions = [];
|
24924 | var addFunction = function addFunction(func) {
|
24925 | interactionFunctions.push(func);
|
24926 | };
|
24927 | var attachFunctions = function attachFunctions() {
|
24928 | interactionFunctions.forEach(function (f) {
|
24929 | f();
|
24930 | });
|
24931 | interactionFunctions = [];
|
24932 | };
|
24933 |
|
24934 | /***/ }),
|
24935 |
|
24936 | /***/ "./src/logger.js":
|
24937 | /*!***********************!*\
|
24938 | !*** ./src/logger.js ***!
|
24939 | \***********************/
|
24940 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
24941 |
|
24942 | "use strict";
|
24943 | __webpack_require__.r(__webpack_exports__);
|
24944 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
24945 | /* harmony export */ "LEVELS": () => (/* binding */ LEVELS),
|
24946 | /* harmony export */ "log": () => (/* binding */ log),
|
24947 | /* harmony export */ "setLogLevel": () => (/* binding */ setLogLevel)
|
24948 | /* harmony export */ });
|
24949 | /* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment-mini */ "moment-mini");
|
24950 | /* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_mini__WEBPACK_IMPORTED_MODULE_0__);
|
24951 |
|
24952 | var LEVELS = {
|
24953 | debug: 1,
|
24954 | info: 2,
|
24955 | warn: 3,
|
24956 | error: 4,
|
24957 | fatal: 5
|
24958 | };
|
24959 | var log = {
|
24960 | debug: function debug() {},
|
24961 | info: function info() {},
|
24962 | warn: function warn() {},
|
24963 | error: function error() {},
|
24964 | fatal: function fatal() {}
|
24965 | };
|
24966 | var setLogLevel = function setLogLevel() {
|
24967 | var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'fatal';
|
24968 |
|
24969 | if (isNaN(level)) {
|
24970 | level = level.toLowerCase();
|
24971 |
|
24972 | if (LEVELS[level] !== undefined) {
|
24973 | level = LEVELS[level];
|
24974 | }
|
24975 | }
|
24976 |
|
24977 | log.trace = function () {};
|
24978 |
|
24979 | log.debug = function () {};
|
24980 |
|
24981 | log.info = function () {};
|
24982 |
|
24983 | log.warn = function () {};
|
24984 |
|
24985 | log.error = function () {};
|
24986 |
|
24987 | log.fatal = function () {};
|
24988 |
|
24989 | if (level <= LEVELS.fatal) {
|
24990 | log.fatal = console.error ? console.error.bind(console, format('FATAL'), 'color: orange') : console.log.bind(console, '\x1b[35m', format('FATAL'));
|
24991 | }
|
24992 |
|
24993 | if (level <= LEVELS.error) {
|
24994 | log.error = console.error ? console.error.bind(console, format('ERROR'), 'color: orange') : console.log.bind(console, '\x1b[31m', format('ERROR'));
|
24995 | }
|
24996 |
|
24997 | if (level <= LEVELS.warn) {
|
24998 | log.warn = console.warn ? console.warn.bind(console, format('WARN'), 'color: orange') : console.log.bind(console, "\x1B[33m", format('WARN'));
|
24999 | }
|
25000 |
|
25001 | if (level <= LEVELS.info) {
|
25002 | log.info = console.info // ? console.info.bind(console, '\x1b[34m', format('INFO'), 'color: blue')
|
25003 | ? console.info.bind(console, format('INFO'), 'color: lightblue') : console.log.bind(console, '\x1b[34m', format('INFO'));
|
25004 | }
|
25005 |
|
25006 | if (level <= LEVELS.debug) {
|
25007 | log.debug = console.debug ? console.debug.bind(console, format('DEBUG'), 'color: lightgreen') : console.log.bind(console, '\x1b[32m', format('DEBUG'));
|
25008 | }
|
25009 | };
|
25010 |
|
25011 | var format = function format(level) {
|
25012 | var time = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()().format('ss.SSS');
|
25013 | return "%c".concat(time, " : ").concat(level, " : ");
|
25014 | };
|
25015 |
|
25016 | /***/ }),
|
25017 |
|
25018 | /***/ "./src/mermaid.js":
|
25019 | /*!************************!*\
|
25020 | !*** ./src/mermaid.js ***!
|
25021 | \************************/
|
25022 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
25023 |
|
25024 | "use strict";
|
25025 | __webpack_require__.r(__webpack_exports__);
|
25026 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
25027 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
25028 | /* harmony export */ });
|
25029 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
|
25030 | /* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mermaidAPI */ "./src/mermaidAPI.js");
|
25031 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
|
25032 | /**
|
25033 | * Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid functionality and to render
|
25034 | * the diagrams to svg code.
|
25035 | */
|
25036 |
|
25037 |
|
25038 |
|
25039 | /**
|
25040 | * ## init
|
25041 | * Function that goes through the document to find the chart definitions in there and render them.
|
25042 | *
|
25043 | * The function tags the processed attributes with the attribute data-processed and ignores found elements with the
|
25044 | * attribute already set. This way the init function can be triggered several times.
|
25045 | *
|
25046 | * Optionally, `init` can accept in the second argument one of the following:
|
25047 | * - a DOM Node
|
25048 | * - an array of DOM nodes (as would come from a jQuery selector)
|
25049 | * - a W3C selector, a la `.mermaid`
|
25050 | *
|
25051 | * ```mermaid
|
25052 | * graph LR;
|
25053 | * a(Find elements)-->b{Processed}
|
25054 | * b-->|Yes|c(Leave element)
|
25055 | * b-->|No |d(Transform)
|
25056 | * ```
|
25057 | * Renders the mermaid diagrams
|
25058 | * @param nodes a css selector or an array of nodes
|
25059 | */
|
25060 |
|
25061 | var init = function init() {
|
25062 | var _this = this;
|
25063 |
|
25064 | var conf = _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].getConfig(); // console.log('Starting rendering diagrams (init) - mermaid.init', conf);
|
25065 |
|
25066 | var nodes;
|
25067 |
|
25068 | if (arguments.length >= 2) {
|
25069 | /*! sequence config was passed as #1 */
|
25070 | if (typeof arguments[0] !== 'undefined') {
|
25071 | mermaid.sequenceConfig = arguments[0];
|
25072 | }
|
25073 |
|
25074 | nodes = arguments[1];
|
25075 | } else {
|
25076 | nodes = arguments[0];
|
25077 | } // if last argument is a function this is the callback function
|
25078 |
|
25079 |
|
25080 | var callback;
|
25081 |
|
25082 | if (typeof arguments[arguments.length - 1] === 'function') {
|
25083 | callback = arguments[arguments.length - 1];
|
25084 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Callback function found');
|
25085 | } else {
|
25086 | if (typeof conf.mermaid !== 'undefined') {
|
25087 | if (typeof conf.mermaid.callback === 'function') {
|
25088 | callback = conf.mermaid.callback;
|
25089 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Callback function found');
|
25090 | } else {
|
25091 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('No Callback function found');
|
25092 | }
|
25093 | }
|
25094 | }
|
25095 |
|
25096 | 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
|
25097 |
|
25098 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Start On Load before: ' + mermaid.startOnLoad);
|
25099 |
|
25100 | if (typeof mermaid.startOnLoad !== 'undefined') {
|
25101 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Start On Load inner: ' + mermaid.startOnLoad);
|
25102 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].updateSiteConfig({
|
25103 | startOnLoad: mermaid.startOnLoad
|
25104 | });
|
25105 | }
|
25106 |
|
25107 | if (typeof mermaid.ganttConfig !== 'undefined') {
|
25108 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].updateSiteConfig({
|
25109 | gantt: mermaid.ganttConfig
|
25110 | });
|
25111 | }
|
25112 |
|
25113 | var idGeneratior = new _utils__WEBPACK_IMPORTED_MODULE_2__["default"].initIdGeneratior(conf.deterministicIds, conf.deterministicIDSeed);
|
25114 | var txt;
|
25115 |
|
25116 | var _loop = function _loop(i) {
|
25117 | var element = nodes[i];
|
25118 | /*! Check if previously processed */
|
25119 |
|
25120 | if (!element.getAttribute('data-processed')) {
|
25121 | element.setAttribute('data-processed', true);
|
25122 | } else {
|
25123 | return "continue";
|
25124 | }
|
25125 |
|
25126 | var id = "mermaid-".concat(idGeneratior.next()); // Fetch the graph definition including tags
|
25127 |
|
25128 | txt = element.innerHTML; // transforms the html to pure text
|
25129 |
|
25130 | txt = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].entityDecode(txt).trim().replace(/<br\s*\/?>/gi, '<br/>');
|
25131 | var init = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].detectInit(txt);
|
25132 |
|
25133 | if (init) {
|
25134 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Detected early reinit: ', init);
|
25135 | }
|
25136 |
|
25137 | try {
|
25138 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].render(id, txt, function (svgCode, bindFunctions) {
|
25139 | element.innerHTML = svgCode;
|
25140 |
|
25141 | if (typeof callback !== 'undefined') {
|
25142 | callback(id);
|
25143 | }
|
25144 |
|
25145 | if (bindFunctions) bindFunctions(element);
|
25146 | }, element);
|
25147 | } catch (e) {
|
25148 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Syntax Error rendering');
|
25149 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn(e);
|
25150 |
|
25151 | if (_this.parseError) {
|
25152 | _this.parseError(e);
|
25153 | }
|
25154 | }
|
25155 | };
|
25156 |
|
25157 | for (var i = 0; i < nodes.length; i++) {
|
25158 | var _ret = _loop(i);
|
25159 |
|
25160 | if (_ret === "continue") continue;
|
25161 | }
|
25162 | };
|
25163 |
|
25164 | var initialize = function initialize(config) {
|
25165 | // mermaidAPI.reset();
|
25166 | if (typeof config.mermaid !== 'undefined') {
|
25167 | if (typeof config.mermaid.startOnLoad !== 'undefined') {
|
25168 | mermaid.startOnLoad = config.mermaid.startOnLoad;
|
25169 | }
|
25170 |
|
25171 | if (typeof config.mermaid.htmlLabels !== 'undefined') {
|
25172 | mermaid.htmlLabels = config.mermaid.htmlLabels === 'false' || config.mermaid.htmlLabels === false ? false : true;
|
25173 | }
|
25174 | }
|
25175 |
|
25176 | _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].initialize(config); // mermaidAPI.reset();
|
25177 | };
|
25178 | /**
|
25179 | * ##contentLoaded
|
25180 | * Callback function that is called when page is loaded. This functions fetches configuration for mermaid rendering and
|
25181 | * calls init for rendering the mermaid diagrams on the page.
|
25182 | */
|
25183 |
|
25184 |
|
25185 | var contentLoaded = function contentLoaded() {
|
25186 | var config;
|
25187 |
|
25188 | if (mermaid.startOnLoad) {
|
25189 | // No config found, do check API config
|
25190 | config = _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].getConfig();
|
25191 |
|
25192 | if (config.startOnLoad) {
|
25193 | mermaid.init();
|
25194 | }
|
25195 | } else {
|
25196 | if (typeof mermaid.startOnLoad === 'undefined') {
|
25197 | _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('In start, no config');
|
25198 | config = _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].getConfig();
|
25199 |
|
25200 | if (config.startOnLoad) {
|
25201 | mermaid.init();
|
25202 | }
|
25203 | }
|
25204 | }
|
25205 | };
|
25206 |
|
25207 | if (typeof document !== 'undefined') {
|
25208 | /*!
|
25209 | * Wait for document loaded before starting the execution
|
25210 | */
|
25211 | window.addEventListener('load', function () {
|
25212 | contentLoaded();
|
25213 | }, false);
|
25214 | }
|
25215 |
|
25216 | var mermaid = {
|
25217 | startOnLoad: true,
|
25218 | htmlLabels: true,
|
25219 | mermaidAPI: _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"],
|
25220 | parse: _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parse,
|
25221 | render: _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].render,
|
25222 | init: init,
|
25223 | initialize: initialize,
|
25224 | contentLoaded: contentLoaded
|
25225 | };
|
25226 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (mermaid);
|
25227 |
|
25228 | /***/ }),
|
25229 |
|
25230 | /***/ "./src/mermaidAPI.js":
|
25231 | /*!***************************!*\
|
25232 | !*** ./src/mermaidAPI.js ***!
|
25233 | \***************************/
|
25234 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
25235 |
|
25236 | "use strict";
|
25237 | __webpack_require__.r(__webpack_exports__);
|
25238 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
25239 | /* harmony export */ "encodeEntities": () => (/* binding */ encodeEntities),
|
25240 | /* harmony export */ "decodeEntities": () => (/* binding */ decodeEntities),
|
25241 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
25242 | /* harmony export */ });
|
25243 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
|
25244 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
|
25245 | /* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! stylis */ "stylis");
|
25246 | /* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(stylis__WEBPACK_IMPORTED_MODULE_1__);
|
25247 | /* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ../package.json */ "./package.json");
|
25248 | /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./config */ "./src/config.js");
|
25249 | /* harmony import */ var _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./diagrams/class/classDb */ "./src/diagrams/class/classDb.js");
|
25250 | /* harmony import */ var _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./diagrams/class/classRenderer */ "./src/diagrams/class/classRenderer.js");
|
25251 | /* harmony import */ var _diagrams_class_classRenderer_v2__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./diagrams/class/classRenderer-v2 */ "./src/diagrams/class/classRenderer-v2.js");
|
25252 | /* harmony import */ var _diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./diagrams/class/parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison");
|
25253 | /* harmony import */ var _diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_13__);
|
25254 | /* harmony import */ var _diagrams_er_erDb__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./diagrams/er/erDb */ "./src/diagrams/er/erDb.js");
|
25255 | /* harmony import */ var _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./diagrams/er/erRenderer */ "./src/diagrams/er/erRenderer.js");
|
25256 | /* harmony import */ var _diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./diagrams/er/parser/erDiagram */ "./src/diagrams/er/parser/erDiagram.jison");
|
25257 | /* harmony import */ var _diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(_diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_21__);
|
25258 | /* harmony import */ var _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./diagrams/flowchart/flowDb */ "./src/diagrams/flowchart/flowDb.js");
|
25259 | /* harmony import */ var _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./diagrams/flowchart/flowRenderer */ "./src/diagrams/flowchart/flowRenderer.js");
|
25260 | /* harmony import */ var _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./diagrams/flowchart/flowRenderer-v2 */ "./src/diagrams/flowchart/flowRenderer-v2.js");
|
25261 | /* harmony import */ var _diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./diagrams/flowchart/parser/flow */ "./src/diagrams/flowchart/parser/flow.jison");
|
25262 | /* harmony import */ var _diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_8__);
|
25263 | /* harmony import */ var _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./diagrams/gantt/ganttDb */ "./src/diagrams/gantt/ganttDb.js");
|
25264 | /* harmony import */ var _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./diagrams/gantt/ganttRenderer */ "./src/diagrams/gantt/ganttRenderer.js");
|
25265 | /* harmony import */ var _diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./diagrams/gantt/parser/gantt */ "./src/diagrams/gantt/parser/gantt.jison");
|
25266 | /* harmony import */ var _diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_11__);
|
25267 | /* harmony import */ var _diagrams_git_gitGraphAst__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./diagrams/git/gitGraphAst */ "./src/diagrams/git/gitGraphAst.js");
|
25268 | /* harmony import */ var _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./diagrams/git/gitGraphRenderer */ "./src/diagrams/git/gitGraphRenderer.js");
|
25269 | /* harmony import */ var _diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./diagrams/git/parser/gitGraph */ "./src/diagrams/git/parser/gitGraph.jison");
|
25270 | /* harmony import */ var _diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_5__);
|
25271 | /* harmony import */ var _diagrams_info_infoDb__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./diagrams/info/infoDb */ "./src/diagrams/info/infoDb.js");
|
25272 | /* harmony import */ var _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./diagrams/info/infoRenderer */ "./src/diagrams/info/infoRenderer.js");
|
25273 | /* harmony import */ var _diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./diagrams/info/parser/info */ "./src/diagrams/info/parser/info.jison");
|
25274 | /* harmony import */ var _diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_17__);
|
25275 | /* harmony import */ var _diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./diagrams/pie/parser/pie */ "./src/diagrams/pie/parser/pie.jison");
|
25276 | /* harmony import */ var _diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_19___default = /*#__PURE__*/__webpack_require__.n(_diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_19__);
|
25277 | /* harmony import */ var _diagrams_pie_pieDb__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./diagrams/pie/pieDb */ "./src/diagrams/pie/pieDb.js");
|
25278 | /* harmony import */ var _diagrams_pie_pieRenderer__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./diagrams/pie/pieRenderer */ "./src/diagrams/pie/pieRenderer.js");
|
25279 | /* harmony import */ var _diagrams_requirement_parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./diagrams/requirement/parser/requirementDiagram */ "./src/diagrams/requirement/parser/requirementDiagram.jison");
|
25280 | /* harmony import */ var _diagrams_requirement_parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_25___default = /*#__PURE__*/__webpack_require__.n(_diagrams_requirement_parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_25__);
|
25281 | /* harmony import */ var _diagrams_requirement_requirementDb__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./diagrams/requirement/requirementDb */ "./src/diagrams/requirement/requirementDb.js");
|
25282 | /* harmony import */ var _diagrams_requirement_requirementRenderer__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./diagrams/requirement/requirementRenderer */ "./src/diagrams/requirement/requirementRenderer.js");
|
25283 | /* harmony import */ var _diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./diagrams/sequence/parser/sequenceDiagram */ "./src/diagrams/sequence/parser/sequenceDiagram.jison");
|
25284 | /* harmony import */ var _diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_9__);
|
25285 | /* harmony import */ var _diagrams_sequence_sequenceDb__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./diagrams/sequence/sequenceDb */ "./src/diagrams/sequence/sequenceDb.js");
|
25286 | /* harmony import */ var _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./diagrams/sequence/sequenceRenderer */ "./src/diagrams/sequence/sequenceRenderer.js");
|
25287 | /* harmony import */ var _diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./diagrams/state/parser/stateDiagram */ "./src/diagrams/state/parser/stateDiagram.jison");
|
25288 | /* harmony import */ var _diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_15__);
|
25289 | /* harmony import */ var _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./diagrams/state/stateDb */ "./src/diagrams/state/stateDb.js");
|
25290 | /* harmony import */ var _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./diagrams/state/stateRenderer */ "./src/diagrams/state/stateRenderer.js");
|
25291 | /* harmony import */ var _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./diagrams/state/stateRenderer-v2 */ "./src/diagrams/state/stateRenderer-v2.js");
|
25292 | /* harmony import */ var _diagrams_user_journey_journeyDb__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./diagrams/user-journey/journeyDb */ "./src/diagrams/user-journey/journeyDb.js");
|
25293 | /* harmony import */ var _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./diagrams/user-journey/journeyRenderer */ "./src/diagrams/user-journey/journeyRenderer.js");
|
25294 | /* harmony import */ var _diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./diagrams/user-journey/parser/journey */ "./src/diagrams/user-journey/parser/journey.jison");
|
25295 | /* harmony import */ var _diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_23___default = /*#__PURE__*/__webpack_require__.n(_diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_23__);
|
25296 | /* harmony import */ var _errorRenderer__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./errorRenderer */ "./src/errorRenderer.js");
|
25297 | /* harmony import */ var _interactionDb__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./interactionDb */ "./src/interactionDb.js");
|
25298 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
|
25299 | /* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./styles */ "./src/styles.js");
|
25300 | /* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
|
25301 | /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
|
25302 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
25303 |
|
25304 | /**
|
25305 | *Edit this Page[![N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/src/mermaidAPI.js)
|
25306 | *
|
25307 | *This is the API to be used when optionally handling the integration with the web page, instead of using the default integration provided by mermaid.js.
|
25308 | *
|
25309 | *
|
25310 | * The core of this api is the [**render**](Setup.md?id=render) function which, given a graph
|
25311 | * definition as text, renders the graph/diagram and returns an svg element for the graph.
|
25312 | *
|
25313 | * It is is then up to the user of the API to make use of the svg, either insert it somewhere in the page or do something completely different.
|
25314 | *
|
25315 | * In addition to the render function, a number of behavioral configuration options are available.
|
25316 | *
|
25317 | * @name mermaidAPI
|
25318 | */
|
25319 |
|
25320 |
|
25321 |
|
25322 |
|
25323 |
|
25324 |
|
25325 |
|
25326 |
|
25327 |
|
25328 |
|
25329 |
|
25330 |
|
25331 |
|
25332 |
|
25333 |
|
25334 |
|
25335 |
|
25336 |
|
25337 |
|
25338 |
|
25339 |
|
25340 |
|
25341 |
|
25342 |
|
25343 |
|
25344 |
|
25345 |
|
25346 |
|
25347 |
|
25348 |
|
25349 |
|
25350 |
|
25351 |
|
25352 |
|
25353 |
|
25354 |
|
25355 |
|
25356 |
|
25357 |
|
25358 |
|
25359 |
|
25360 | // import * as configApi from './config';
|
25361 | // // , {
|
25362 | // // setConfig,
|
25363 | // // configApi.getConfig,
|
25364 | // // configApi.updateSiteConfig,
|
25365 | // // configApi.setSiteConfig,
|
25366 | // // configApi.getSiteConfig,
|
25367 | // // configApi.defaultConfig
|
25368 | // // }
|
25369 |
|
25370 |
|
25371 |
|
25372 |
|
25373 |
|
25374 |
|
25375 | function parse(text) {
|
25376 | var cnf = _config__WEBPACK_IMPORTED_MODULE_2__.getConfig();
|
25377 | var graphInit = _utils__WEBPACK_IMPORTED_MODULE_3__["default"].detectInit(text, cnf);
|
25378 |
|
25379 | if (graphInit) {
|
25380 | reinitialize(graphInit);
|
25381 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('reinit ', graphInit);
|
25382 | }
|
25383 |
|
25384 | var graphType = _utils__WEBPACK_IMPORTED_MODULE_3__["default"].detectType(text, cnf);
|
25385 | var parser;
|
25386 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Type ' + graphType);
|
25387 |
|
25388 | switch (graphType) {
|
25389 | case 'git':
|
25390 | parser = (_diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_5___default());
|
25391 | parser.parser.yy = _diagrams_git_gitGraphAst__WEBPACK_IMPORTED_MODULE_6__["default"];
|
25392 | break;
|
25393 |
|
25394 | case 'flowchart':
|
25395 | _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_7__["default"].clear();
|
25396 | parser = (_diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_8___default());
|
25397 | parser.parser.yy = _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_7__["default"];
|
25398 | break;
|
25399 |
|
25400 | case 'flowchart-v2':
|
25401 | _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_7__["default"].clear();
|
25402 | parser = (_diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_8___default());
|
25403 | parser.parser.yy = _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_7__["default"];
|
25404 | break;
|
25405 |
|
25406 | case 'sequence':
|
25407 | parser = (_diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_9___default());
|
25408 | parser.parser.yy = _diagrams_sequence_sequenceDb__WEBPACK_IMPORTED_MODULE_10__["default"];
|
25409 | break;
|
25410 |
|
25411 | case 'gantt':
|
25412 | parser = (_diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_11___default());
|
25413 | parser.parser.yy = _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_12__["default"];
|
25414 | break;
|
25415 |
|
25416 | case 'class':
|
25417 | parser = (_diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_13___default());
|
25418 | parser.parser.yy = _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_14__["default"];
|
25419 | break;
|
25420 |
|
25421 | case 'classDiagram':
|
25422 | parser = (_diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_13___default());
|
25423 | parser.parser.yy = _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_14__["default"];
|
25424 | break;
|
25425 |
|
25426 | case 'state':
|
25427 | parser = (_diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_15___default());
|
25428 | parser.parser.yy = _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_16__["default"];
|
25429 | break;
|
25430 |
|
25431 | case 'stateDiagram':
|
25432 | parser = (_diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_15___default());
|
25433 | parser.parser.yy = _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_16__["default"];
|
25434 | break;
|
25435 |
|
25436 | case 'info':
|
25437 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('info info info');
|
25438 | parser = (_diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_17___default());
|
25439 | parser.parser.yy = _diagrams_info_infoDb__WEBPACK_IMPORTED_MODULE_18__["default"];
|
25440 | break;
|
25441 |
|
25442 | case 'pie':
|
25443 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('pie');
|
25444 | parser = (_diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_19___default());
|
25445 | parser.parser.yy = _diagrams_pie_pieDb__WEBPACK_IMPORTED_MODULE_20__["default"];
|
25446 | break;
|
25447 |
|
25448 | case 'er':
|
25449 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('er');
|
25450 | parser = (_diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_21___default());
|
25451 | parser.parser.yy = _diagrams_er_erDb__WEBPACK_IMPORTED_MODULE_22__["default"];
|
25452 | break;
|
25453 |
|
25454 | case 'journey':
|
25455 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Journey');
|
25456 | parser = (_diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_23___default());
|
25457 | parser.parser.yy = _diagrams_user_journey_journeyDb__WEBPACK_IMPORTED_MODULE_24__["default"];
|
25458 | break;
|
25459 |
|
25460 | case 'requirement':
|
25461 | case 'requirementDiagram':
|
25462 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('RequirementDiagram');
|
25463 | parser = (_diagrams_requirement_parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_25___default());
|
25464 | parser.parser.yy = _diagrams_requirement_requirementDb__WEBPACK_IMPORTED_MODULE_26__["default"];
|
25465 | break;
|
25466 | }
|
25467 |
|
25468 | parser.parser.yy.graphType = graphType;
|
25469 |
|
25470 | parser.parser.yy.parseError = function (str, hash) {
|
25471 | var error = {
|
25472 | str: str,
|
25473 | hash: hash
|
25474 | };
|
25475 | throw error;
|
25476 | };
|
25477 |
|
25478 | parser.parse(text);
|
25479 | return parser;
|
25480 | }
|
25481 |
|
25482 | var encodeEntities = function encodeEntities(text) {
|
25483 | var txt = text;
|
25484 | txt = txt.replace(/style.*:\S*#.*;/g, function (s) {
|
25485 | var innerTxt = s.substring(0, s.length - 1);
|
25486 | return innerTxt;
|
25487 | });
|
25488 | txt = txt.replace(/classDef.*:\S*#.*;/g, function (s) {
|
25489 | var innerTxt = s.substring(0, s.length - 1);
|
25490 | return innerTxt;
|
25491 | });
|
25492 | txt = txt.replace(/#\w+;/g, function (s) {
|
25493 | var innerTxt = s.substring(1, s.length - 1);
|
25494 | var isInt = /^\+?\d+$/.test(innerTxt);
|
25495 |
|
25496 | if (isInt) {
|
25497 | return 'fl°°' + innerTxt + '¶ß';
|
25498 | } else {
|
25499 | return 'fl°' + innerTxt + '¶ß';
|
25500 | }
|
25501 | });
|
25502 | return txt;
|
25503 | };
|
25504 | var decodeEntities = function decodeEntities(text) {
|
25505 | var txt = text;
|
25506 | txt = txt.replace(/fl°°/g, function () {
|
25507 | return '&#';
|
25508 | });
|
25509 | txt = txt.replace(/fl°/g, function () {
|
25510 | return '&';
|
25511 | });
|
25512 | txt = txt.replace(/¶ß/g, function () {
|
25513 | return ';';
|
25514 | });
|
25515 | return txt;
|
25516 | };
|
25517 | /**
|
25518 | * Function that renders an svg with a graph from a chart definition. Usage example below.
|
25519 | *
|
25520 | * ```js
|
25521 | * mermaidAPI.initialize({
|
25522 | * startOnLoad:true
|
25523 | * });
|
25524 | * $(function(){
|
25525 | * const graphDefinition = 'graph TB\na-->b';
|
25526 | * const cb = function(svgGraph){
|
25527 | * console.log(svgGraph);
|
25528 | * };
|
25529 | * mermaidAPI.render('id1',graphDefinition,cb);
|
25530 | * });
|
25531 | *```
|
25532 | * @param id the id of the element to be rendered
|
25533 | * @param _txt the graph definition
|
25534 | * @param cb callback which is called after rendering is finished with the svg code as inparam.
|
25535 | * @param container selector to element in which a div with the graph temporarily will be inserted. In one is
|
25536 | * provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is
|
25537 | * completed.
|
25538 | */
|
25539 |
|
25540 | var render = function render(id, _txt, cb, container) {
|
25541 | _config__WEBPACK_IMPORTED_MODULE_2__.reset();
|
25542 | var txt = _txt;
|
25543 | var graphInit = _utils__WEBPACK_IMPORTED_MODULE_3__["default"].detectInit(txt);
|
25544 |
|
25545 | if (graphInit) {
|
25546 | _config__WEBPACK_IMPORTED_MODULE_2__.addDirective(graphInit);
|
25547 | } // else {
|
25548 | // configApi.reset();
|
25549 | // const siteConfig = configApi.getSiteConfig();
|
25550 | // configApi.addDirective(siteConfig);
|
25551 | // }
|
25552 | // console.warn('Render fetching config');
|
25553 |
|
25554 |
|
25555 | var cnf = _config__WEBPACK_IMPORTED_MODULE_2__.getConfig(); // Check the maximum allowed text size
|
25556 |
|
25557 | if (_txt.length > cnf.maxTextSize) {
|
25558 | txt = 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';
|
25559 | }
|
25560 |
|
25561 | if (typeof container !== 'undefined') {
|
25562 | container.innerHTML = '';
|
25563 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(container).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').append('g');
|
25564 | } else {
|
25565 | var existingSvg = document.getElementById(id);
|
25566 |
|
25567 | if (existingSvg) {
|
25568 | existingSvg.remove();
|
25569 | }
|
25570 |
|
25571 | var _element = document.querySelector('#' + 'd' + id);
|
25572 |
|
25573 | if (_element) {
|
25574 | _element.remove();
|
25575 | }
|
25576 |
|
25577 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body').append('div').attr('id', 'd' + id).append('svg').attr('id', id).attr('width', '100%').attr('xmlns', 'http://www.w3.org/2000/svg').append('g');
|
25578 | }
|
25579 |
|
25580 | window.txt = txt;
|
25581 | txt = encodeEntities(txt);
|
25582 | var element = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#d' + id).node();
|
25583 | var graphType = _utils__WEBPACK_IMPORTED_MODULE_3__["default"].detectType(txt, cnf); // insert inline style into svg
|
25584 |
|
25585 | var svg = element.firstChild;
|
25586 | var firstChild = svg.firstChild;
|
25587 | var userStyles = ''; // user provided theme CSS
|
25588 |
|
25589 | if (cnf.themeCSS !== undefined) {
|
25590 | userStyles += "\n".concat(cnf.themeCSS);
|
25591 | } // user provided theme CSS
|
25592 |
|
25593 |
|
25594 | if (cnf.fontFamily !== undefined) {
|
25595 | userStyles += "\n:root { --mermaid-font-family: ".concat(cnf.fontFamily, "}");
|
25596 | } // user provided theme CSS
|
25597 |
|
25598 |
|
25599 | if (cnf.altFontFamily !== undefined) {
|
25600 | userStyles += "\n:root { --mermaid-alt-font-family: ".concat(cnf.altFontFamily, "}");
|
25601 | } // classDef
|
25602 |
|
25603 |
|
25604 | if (graphType === 'flowchart' || graphType === 'flowchart-v2' || graphType === 'graph') {
|
25605 | var classes = _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_27__["default"].getClasses(txt);
|
25606 | var htmlLabels = cnf.htmlLabels || cnf.flowchart.htmlLabels;
|
25607 |
|
25608 | for (var className in classes) {
|
25609 | if (htmlLabels) {
|
25610 | userStyles += "\n.".concat(className, " > * { ").concat(classes[className].styles.join(' !important; '), " !important; }");
|
25611 | userStyles += "\n.".concat(className, " span { ").concat(classes[className].styles.join(' !important; '), " !important; }");
|
25612 | } else {
|
25613 | userStyles += "\n.".concat(className, " path { ").concat(classes[className].styles.join(' !important; '), " !important; }");
|
25614 | userStyles += "\n.".concat(className, " rect { ").concat(classes[className].styles.join(' !important; '), " !important; }");
|
25615 | userStyles += "\n.".concat(className, " polygon { ").concat(classes[className].styles.join(' !important; '), " !important; }");
|
25616 | userStyles += "\n.".concat(className, " ellipse { ").concat(classes[className].styles.join(' !important; '), " !important; }");
|
25617 | userStyles += "\n.".concat(className, " circle { ").concat(classes[className].styles.join(' !important; '), " !important; }");
|
25618 |
|
25619 | if (classes[className].textStyles) {
|
25620 | userStyles += "\n.".concat(className, " tspan { ").concat(classes[className].textStyles.join(' !important; '), " !important; }");
|
25621 | }
|
25622 | }
|
25623 | }
|
25624 | } // log.warn(cnf.themeVariables);
|
25625 |
|
25626 |
|
25627 | var stylis = function stylis(selector, styles) {
|
25628 | 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);
|
25629 | };
|
25630 |
|
25631 | var rules = stylis("#".concat(id), (0,_styles__WEBPACK_IMPORTED_MODULE_28__["default"])(graphType, userStyles, cnf.themeVariables));
|
25632 | var style1 = document.createElement('style');
|
25633 | style1.innerHTML = "#".concat(id, " ") + rules;
|
25634 | svg.insertBefore(style1, firstChild); // Verify that the generated svgs are ok before removing this
|
25635 | // const style2 = document.createElement('style');
|
25636 | // const cs = window.getComputedStyle(svg);
|
25637 | // style2.innerHTML = `#d${id} * {
|
25638 | // color: ${cs.color};
|
25639 | // // font: ${cs.font};
|
25640 | // // font-family: Arial;
|
25641 | // // font-size: 24px;
|
25642 | // }`;
|
25643 | // svg.insertBefore(style2, firstChild);
|
25644 |
|
25645 | try {
|
25646 | switch (graphType) {
|
25647 | case 'git':
|
25648 | cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
25649 | _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_29__["default"].setConf(cnf.git);
|
25650 | _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_29__["default"].draw(txt, id, false);
|
25651 | break;
|
25652 |
|
25653 | case 'flowchart':
|
25654 | cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
25655 | _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_27__["default"].setConf(cnf.flowchart);
|
25656 | _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_27__["default"].draw(txt, id, false);
|
25657 | break;
|
25658 |
|
25659 | case 'flowchart-v2':
|
25660 | cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
25661 | _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_30__["default"].setConf(cnf.flowchart);
|
25662 | _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_30__["default"].draw(txt, id, false);
|
25663 | break;
|
25664 |
|
25665 | case 'sequence':
|
25666 | cnf.sequence.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
25667 |
|
25668 | if (cnf.sequenceDiagram) {
|
25669 | // backwards compatibility
|
25670 | _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_31__["default"].setConf(Object.assign(cnf.sequence, cnf.sequenceDiagram));
|
25671 | console.error('`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.');
|
25672 | } else {
|
25673 | _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_31__["default"].setConf(cnf.sequence);
|
25674 | }
|
25675 |
|
25676 | _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_31__["default"].draw(txt, id);
|
25677 | break;
|
25678 |
|
25679 | case 'gantt':
|
25680 | cnf.gantt.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
25681 | _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_32__["default"].setConf(cnf.gantt);
|
25682 | _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_32__["default"].draw(txt, id);
|
25683 | break;
|
25684 |
|
25685 | case 'class':
|
25686 | cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
25687 | _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_33__["default"].setConf(cnf.class);
|
25688 | _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_33__["default"].draw(txt, id);
|
25689 | break;
|
25690 |
|
25691 | case 'classDiagram':
|
25692 | cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
25693 | _diagrams_class_classRenderer_v2__WEBPACK_IMPORTED_MODULE_34__["default"].setConf(cnf.class);
|
25694 | _diagrams_class_classRenderer_v2__WEBPACK_IMPORTED_MODULE_34__["default"].draw(txt, id);
|
25695 | break;
|
25696 |
|
25697 | case 'state':
|
25698 | cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
25699 | _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_35__["default"].setConf(cnf.state);
|
25700 | _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_35__["default"].draw(txt, id);
|
25701 | break;
|
25702 |
|
25703 | case 'stateDiagram':
|
25704 | cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
25705 | _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_36__["default"].setConf(cnf.state);
|
25706 | _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_36__["default"].draw(txt, id);
|
25707 | break;
|
25708 |
|
25709 | case 'info':
|
25710 | cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
25711 | _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_37__["default"].setConf(cnf.class);
|
25712 | _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_37__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_38__.version);
|
25713 | break;
|
25714 |
|
25715 | case 'pie':
|
25716 | //cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
25717 | //pieRenderer.setConf(cnf.pie);
|
25718 | _diagrams_pie_pieRenderer__WEBPACK_IMPORTED_MODULE_39__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_38__.version);
|
25719 | break;
|
25720 |
|
25721 | case 'er':
|
25722 | _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_40__["default"].setConf(cnf.er);
|
25723 | _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_40__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_38__.version);
|
25724 | break;
|
25725 |
|
25726 | case 'journey':
|
25727 | _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_41__["default"].setConf(cnf.journey);
|
25728 | _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_41__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_38__.version);
|
25729 | break;
|
25730 |
|
25731 | case 'requirement':
|
25732 | _diagrams_requirement_requirementRenderer__WEBPACK_IMPORTED_MODULE_42__["default"].setConf(cnf.requirement);
|
25733 | _diagrams_requirement_requirementRenderer__WEBPACK_IMPORTED_MODULE_42__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_38__.version);
|
25734 | break;
|
25735 | }
|
25736 | } catch (e) {
|
25737 | // errorRenderer.setConf(cnf.class);
|
25738 | _errorRenderer__WEBPACK_IMPORTED_MODULE_43__["default"].draw(id, _package_json__WEBPACK_IMPORTED_MODULE_38__.version);
|
25739 | throw e;
|
25740 | }
|
25741 |
|
25742 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id=\"".concat(id, "\"]")).selectAll('foreignobject > *').attr('xmlns', 'http://www.w3.org/1999/xhtml'); // if (cnf.arrowMarkerAbsolute) {
|
25743 | // url =
|
25744 | // window.location.protocol +
|
25745 | // '//' +
|
25746 | // window.location.host +
|
25747 | // window.location.pathname +
|
25748 | // window.location.search;
|
25749 | // url = url.replace(/\(/g, '\\(');
|
25750 | // url = url.replace(/\)/g, '\\)');
|
25751 | // }
|
25752 | // Fix for when the base tag is used
|
25753 |
|
25754 | var svgCode = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#d' + id).node().innerHTML;
|
25755 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('cnf.arrowMarkerAbsolute', cnf.arrowMarkerAbsolute);
|
25756 |
|
25757 | if (!cnf.arrowMarkerAbsolute || cnf.arrowMarkerAbsolute === 'false') {
|
25758 | svgCode = svgCode.replace(/marker-end="url\(.*?#/g, 'marker-end="url(#', 'g');
|
25759 | }
|
25760 |
|
25761 | svgCode = decodeEntities(svgCode); // Fix for when the br tag is used
|
25762 |
|
25763 | svgCode = svgCode.replace(/<br>/g, '<br/>');
|
25764 |
|
25765 | if (typeof cb !== 'undefined') {
|
25766 | switch (graphType) {
|
25767 | case 'flowchart':
|
25768 | case 'flowchart-v2':
|
25769 | cb(svgCode, _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_7__["default"].bindFunctions);
|
25770 | break;
|
25771 |
|
25772 | case 'gantt':
|
25773 | cb(svgCode, _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_12__["default"].bindFunctions);
|
25774 | break;
|
25775 |
|
25776 | case 'class':
|
25777 | case 'classDiagram':
|
25778 | cb(svgCode, _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_14__["default"].bindFunctions);
|
25779 | break;
|
25780 |
|
25781 | default:
|
25782 | cb(svgCode);
|
25783 | }
|
25784 | } else {
|
25785 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('CB = undefined!');
|
25786 | }
|
25787 |
|
25788 | (0,_interactionDb__WEBPACK_IMPORTED_MODULE_44__.attachFunctions)();
|
25789 | var node = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#d' + id).node();
|
25790 |
|
25791 | if (node !== null && typeof node.remove === 'function') {
|
25792 | (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#d' + id).node().remove();
|
25793 | }
|
25794 |
|
25795 | return svgCode;
|
25796 | };
|
25797 |
|
25798 | var currentDirective = {};
|
25799 |
|
25800 | var parseDirective = function parseDirective(p, statement, context, type) {
|
25801 | try {
|
25802 | if (statement !== undefined) {
|
25803 | statement = statement.trim();
|
25804 |
|
25805 | switch (context) {
|
25806 | case 'open_directive':
|
25807 | currentDirective = {};
|
25808 | break;
|
25809 |
|
25810 | case 'type_directive':
|
25811 | currentDirective.type = statement.toLowerCase();
|
25812 | break;
|
25813 |
|
25814 | case 'arg_directive':
|
25815 | currentDirective.args = JSON.parse(statement);
|
25816 | break;
|
25817 |
|
25818 | case 'close_directive':
|
25819 | handleDirective(p, currentDirective, type);
|
25820 | currentDirective = null;
|
25821 | break;
|
25822 | }
|
25823 | }
|
25824 | } catch (error) {
|
25825 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.error("Error while rendering sequenceDiagram directive: ".concat(statement, " jison context: ").concat(context));
|
25826 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.error(error.message);
|
25827 | }
|
25828 | };
|
25829 |
|
25830 | var handleDirective = function handleDirective(p, directive, type) {
|
25831 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug("Directive type=".concat(directive.type, " with args:"), directive.args);
|
25832 |
|
25833 | switch (directive.type) {
|
25834 | case 'init':
|
25835 | case 'initialize':
|
25836 | {
|
25837 | ['config'].forEach(function (prop) {
|
25838 | if (typeof directive.args[prop] !== 'undefined') {
|
25839 | if (type === 'flowchart-v2') {
|
25840 | type = 'flowchart';
|
25841 | }
|
25842 |
|
25843 | directive.args[type] = directive.args[prop];
|
25844 | delete directive.args[prop];
|
25845 | }
|
25846 | });
|
25847 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('sanitize in handleDirective', directive.args);
|
25848 | (0,_utils__WEBPACK_IMPORTED_MODULE_3__.directiveSanitizer)(directive.args);
|
25849 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('sanitize in handleDirective (done)', directive.args);
|
25850 | reinitialize(directive.args);
|
25851 | _config__WEBPACK_IMPORTED_MODULE_2__.addDirective(directive.args);
|
25852 | break;
|
25853 | }
|
25854 |
|
25855 | case 'wrap':
|
25856 | case 'nowrap':
|
25857 | if (p && p['setWrap']) {
|
25858 | p.setWrap(directive.type === 'wrap');
|
25859 | }
|
25860 |
|
25861 | break;
|
25862 |
|
25863 | default:
|
25864 | _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("Unhandled directive: source: '%%{".concat(directive.type, ": ").concat(JSON.stringify(directive.args ? directive.args : {}), "}%%"), directive);
|
25865 | break;
|
25866 | }
|
25867 | };
|
25868 |
|
25869 | function updateRendererConfigs(conf) {
|
25870 | // Todo remove, all diagrams should get config on demoand from the config object, no need for this
|
25871 | _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_29__["default"].setConf(conf.git);
|
25872 | _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_27__["default"].setConf(conf.flowchart);
|
25873 | _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_30__["default"].setConf(conf.flowchart);
|
25874 |
|
25875 | if (typeof conf['sequenceDiagram'] !== 'undefined') {
|
25876 | _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_31__["default"].setConf((0,_utils__WEBPACK_IMPORTED_MODULE_3__.assignWithDepth)(conf.sequence, conf['sequenceDiagram']));
|
25877 | }
|
25878 |
|
25879 | _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_31__["default"].setConf(conf.sequence);
|
25880 | _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_32__["default"].setConf(conf.gantt);
|
25881 | _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_33__["default"].setConf(conf.class);
|
25882 | _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_35__["default"].setConf(conf.state);
|
25883 | _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_36__["default"].setConf(conf.state);
|
25884 | _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_37__["default"].setConf(conf.class); // pieRenderer.setConf(conf.class);
|
25885 |
|
25886 | _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_40__["default"].setConf(conf.er);
|
25887 | _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_41__["default"].setConf(conf.journey);
|
25888 | _diagrams_requirement_requirementRenderer__WEBPACK_IMPORTED_MODULE_42__["default"].setConf(conf.requirement);
|
25889 | _errorRenderer__WEBPACK_IMPORTED_MODULE_43__["default"].setConf(conf.class);
|
25890 | }
|
25891 |
|
25892 | function reinitialize() {// `mermaidAPI.reinitialize: v${pkg.version}`,
|
25893 | // JSON.stringify(options),
|
25894 | // options.themeVariables.primaryColor;
|
25895 | // // if (options.theme && theme[options.theme]) {
|
25896 | // // options.themeVariables = theme[options.theme].getThemeVariables(options.themeVariables);
|
25897 | // // }
|
25898 | // // Set default options
|
25899 | // const config =
|
25900 | // typeof options === 'object' ? configApi.setConfig(options) : configApi.getSiteConfig();
|
25901 | // updateRendererConfigs(config);
|
25902 | // setLogLevel(config.logLevel);
|
25903 | // log.debug('mermaidAPI.reinitialize: ', config);
|
25904 | }
|
25905 |
|
25906 | function initialize(options) {
|
25907 | // console.warn(`mermaidAPI.initialize: v${pkg.version} `, options);
|
25908 | // Handle legacy location of font-family configuration
|
25909 | if (options && options.fontFamily) {
|
25910 | if (!options.themeVariables) {
|
25911 | options.themeVariables = {
|
25912 | fontFamily: options.fontFamily
|
25913 | };
|
25914 | } else {
|
25915 | if (!options.themeVariables.fontFamily) {
|
25916 | options.themeVariables = {
|
25917 | fontFamily: options.fontFamily
|
25918 | };
|
25919 | }
|
25920 | }
|
25921 | } // Set default options
|
25922 |
|
25923 |
|
25924 | _config__WEBPACK_IMPORTED_MODULE_2__.saveConfigFromInitilize(options);
|
25925 |
|
25926 | if (options && options.theme && _themes__WEBPACK_IMPORTED_MODULE_45__["default"][options.theme]) {
|
25927 | // Todo merge with user options
|
25928 | options.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_45__["default"][options.theme].getThemeVariables(options.themeVariables);
|
25929 | } else {
|
25930 | if (options) options.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_45__["default"]["default"].getThemeVariables(options.themeVariables);
|
25931 | }
|
25932 |
|
25933 | var config = _typeof(options) === 'object' ? _config__WEBPACK_IMPORTED_MODULE_2__.setSiteConfig(options) : _config__WEBPACK_IMPORTED_MODULE_2__.getSiteConfig();
|
25934 | updateRendererConfigs(config);
|
25935 | (0,_logger__WEBPACK_IMPORTED_MODULE_4__.setLogLevel)(config.logLevel); // log.debug('mermaidAPI.initialize: ', config);
|
25936 | }
|
25937 |
|
25938 | var mermaidAPI = Object.freeze({
|
25939 | render: render,
|
25940 | parse: parse,
|
25941 | parseDirective: parseDirective,
|
25942 | initialize: initialize,
|
25943 | reinitialize: reinitialize,
|
25944 | getConfig: _config__WEBPACK_IMPORTED_MODULE_2__.getConfig,
|
25945 | setConfig: _config__WEBPACK_IMPORTED_MODULE_2__.setConfig,
|
25946 | getSiteConfig: _config__WEBPACK_IMPORTED_MODULE_2__.getSiteConfig,
|
25947 | updateSiteConfig: _config__WEBPACK_IMPORTED_MODULE_2__.updateSiteConfig,
|
25948 | reset: function reset() {
|
25949 | // console.warn('reset');
|
25950 | _config__WEBPACK_IMPORTED_MODULE_2__.reset(); // const siteConfig = configApi.getSiteConfig();
|
25951 | // updateRendererConfigs(siteConfig);
|
25952 | },
|
25953 | globalReset: function globalReset() {
|
25954 | _config__WEBPACK_IMPORTED_MODULE_2__.reset(_config__WEBPACK_IMPORTED_MODULE_2__.defaultConfig);
|
25955 | updateRendererConfigs(_config__WEBPACK_IMPORTED_MODULE_2__.getConfig());
|
25956 | },
|
25957 | defaultConfig: _config__WEBPACK_IMPORTED_MODULE_2__.defaultConfig
|
25958 | });
|
25959 | (0,_logger__WEBPACK_IMPORTED_MODULE_4__.setLogLevel)(_config__WEBPACK_IMPORTED_MODULE_2__.getConfig().logLevel);
|
25960 | _config__WEBPACK_IMPORTED_MODULE_2__.reset(_config__WEBPACK_IMPORTED_MODULE_2__.getConfig());
|
25961 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (mermaidAPI);
|
25962 | /**
|
25963 | * ## mermaidAPI configuration defaults
|
25964 | *
|
25965 | * ```html
|
25966 | * <script>
|
25967 | * var config = {
|
25968 | * theme:'default',
|
25969 | * logLevel:'fatal',
|
25970 | * securityLevel:'strict',
|
25971 | * startOnLoad:true,
|
25972 | * arrowMarkerAbsolute:false,
|
25973 | *
|
25974 | * er:{
|
25975 | * diagramPadding:20,
|
25976 | * layoutDirection:'TB',
|
25977 | * minEntityWidth:100,
|
25978 | * minEntityHeight:75,
|
25979 | * entityPadding:15,
|
25980 | * stroke:'gray',
|
25981 | * fill:'honeydew',
|
25982 | * fontSize:12,
|
25983 | * useMaxWidth:true,
|
25984 | * },
|
25985 | * flowchart:{
|
25986 | * diagramPadding:8,
|
25987 | * htmlLabels:true,
|
25988 | * curve:'basis',
|
25989 | * },
|
25990 | * sequence:{
|
25991 | * diagramMarginX:50,
|
25992 | * diagramMarginY:10,
|
25993 | * actorMargin:50,
|
25994 | * width:150,
|
25995 | * height:65,
|
25996 | * boxMargin:10,
|
25997 | * boxTextMargin:5,
|
25998 | * noteMargin:10,
|
25999 | * messageMargin:35,
|
26000 | * messageAlign:'center',
|
26001 | * mirrorActors:true,
|
26002 | * bottomMarginAdj:1,
|
26003 | * useMaxWidth:true,
|
26004 | * rightAngles:false,
|
26005 | * showSequenceNumbers:false,
|
26006 | * },
|
26007 | * gantt:{
|
26008 | * titleTopMargin:25,
|
26009 | * barHeight:20,
|
26010 | * barGap:4,
|
26011 | * topPadding:50,
|
26012 | * leftPadding:75,
|
26013 | * gridLineStartPadding:35,
|
26014 | * fontSize:11,
|
26015 | * fontFamily:'"Open-Sans", "sans-serif"',
|
26016 | * numberSectionStyles:4,
|
26017 | * axisFormat:'%Y-%m-%d',
|
26018 | * topAxis:false,
|
26019 | * }
|
26020 | * };
|
26021 | * mermaid.initialize(config);
|
26022 | * </script>
|
26023 | * ```
|
26024 | */
|
26025 |
|
26026 | /***/ }),
|
26027 |
|
26028 | /***/ "./src/styles.js":
|
26029 | /*!***********************!*\
|
26030 | !*** ./src/styles.js ***!
|
26031 | \***********************/
|
26032 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26033 |
|
26034 | "use strict";
|
26035 | __webpack_require__.r(__webpack_exports__);
|
26036 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26037 | /* harmony export */ "calcThemeVariables": () => (/* binding */ calcThemeVariables),
|
26038 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
26039 | /* harmony export */ });
|
26040 | /* harmony import */ var _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./diagrams/class/styles */ "./src/diagrams/class/styles.js");
|
26041 | /* harmony import */ var _diagrams_er_styles__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./diagrams/er/styles */ "./src/diagrams/er/styles.js");
|
26042 | /* harmony import */ var _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./diagrams/flowchart/styles */ "./src/diagrams/flowchart/styles.js");
|
26043 | /* harmony import */ var _diagrams_gantt_styles__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./diagrams/gantt/styles */ "./src/diagrams/gantt/styles.js");
|
26044 | /* harmony import */ var _diagrams_git_styles__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./diagrams/git/styles */ "./src/diagrams/git/styles.js");
|
26045 | /* harmony import */ var _diagrams_info_styles__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./diagrams/info/styles */ "./src/diagrams/info/styles.js");
|
26046 | /* harmony import */ var _diagrams_pie_styles__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./diagrams/pie/styles */ "./src/diagrams/pie/styles.js");
|
26047 | /* harmony import */ var _diagrams_requirement_styles__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./diagrams/requirement/styles */ "./src/diagrams/requirement/styles.js");
|
26048 | /* harmony import */ var _diagrams_sequence_styles__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./diagrams/sequence/styles */ "./src/diagrams/sequence/styles.js");
|
26049 | /* harmony import */ var _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./diagrams/state/styles */ "./src/diagrams/state/styles.js");
|
26050 | /* harmony import */ var _diagrams_user_journey_styles__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./diagrams/user-journey/styles */ "./src/diagrams/user-journey/styles.js");
|
26051 |
|
26052 |
|
26053 |
|
26054 |
|
26055 |
|
26056 |
|
26057 |
|
26058 |
|
26059 |
|
26060 |
|
26061 |
|
26062 | var themes = {
|
26063 | flowchart: _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_0__["default"],
|
26064 | 'flowchart-v2': _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_0__["default"],
|
26065 | sequence: _diagrams_sequence_styles__WEBPACK_IMPORTED_MODULE_1__["default"],
|
26066 | gantt: _diagrams_gantt_styles__WEBPACK_IMPORTED_MODULE_2__["default"],
|
26067 | classDiagram: _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__["default"],
|
26068 | 'classDiagram-v2': _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__["default"],
|
26069 | class: _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__["default"],
|
26070 | stateDiagram: _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_4__["default"],
|
26071 | state: _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_4__["default"],
|
26072 | git: _diagrams_git_styles__WEBPACK_IMPORTED_MODULE_5__["default"],
|
26073 | info: _diagrams_info_styles__WEBPACK_IMPORTED_MODULE_6__["default"],
|
26074 | pie: _diagrams_pie_styles__WEBPACK_IMPORTED_MODULE_7__["default"],
|
26075 | er: _diagrams_er_styles__WEBPACK_IMPORTED_MODULE_8__["default"],
|
26076 | journey: _diagrams_user_journey_styles__WEBPACK_IMPORTED_MODULE_9__["default"],
|
26077 | requirement: _diagrams_requirement_styles__WEBPACK_IMPORTED_MODULE_10__["default"]
|
26078 | };
|
26079 | var calcThemeVariables = function calcThemeVariables(theme, userOverRides) {
|
26080 | return theme.calcColors(userOverRides);
|
26081 | };
|
26082 |
|
26083 | var getStyles = function getStyles(type, userStyles, options) {
|
26084 | //console.warn('options in styles: ', options);
|
26085 | 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");
|
26086 | };
|
26087 |
|
26088 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
|
26089 |
|
26090 | /***/ }),
|
26091 |
|
26092 | /***/ "./src/themes/index.js":
|
26093 | /*!*****************************!*\
|
26094 | !*** ./src/themes/index.js ***!
|
26095 | \*****************************/
|
26096 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26097 |
|
26098 | "use strict";
|
26099 | __webpack_require__.r(__webpack_exports__);
|
26100 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26101 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
26102 | /* harmony export */ });
|
26103 | /* harmony import */ var _theme_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./theme-base */ "./src/themes/theme-base.js");
|
26104 | /* harmony import */ var _theme_dark__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-dark */ "./src/themes/theme-dark.js");
|
26105 | /* harmony import */ var _theme_default__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./theme-default */ "./src/themes/theme-default.js");
|
26106 | /* harmony import */ var _theme_forest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./theme-forest */ "./src/themes/theme-forest.js");
|
26107 | /* harmony import */ var _theme_neutral__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./theme-neutral */ "./src/themes/theme-neutral.js");
|
26108 |
|
26109 |
|
26110 |
|
26111 |
|
26112 |
|
26113 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
26114 | base: {
|
26115 | getThemeVariables: _theme_base__WEBPACK_IMPORTED_MODULE_0__.getThemeVariables
|
26116 | },
|
26117 | dark: {
|
26118 | getThemeVariables: _theme_dark__WEBPACK_IMPORTED_MODULE_1__.getThemeVariables
|
26119 | },
|
26120 | default: {
|
26121 | getThemeVariables: _theme_default__WEBPACK_IMPORTED_MODULE_2__.getThemeVariables
|
26122 | },
|
26123 | forest: {
|
26124 | getThemeVariables: _theme_forest__WEBPACK_IMPORTED_MODULE_3__.getThemeVariables
|
26125 | },
|
26126 | neutral: {
|
26127 | getThemeVariables: _theme_neutral__WEBPACK_IMPORTED_MODULE_4__.getThemeVariables
|
26128 | }
|
26129 | });
|
26130 |
|
26131 | /***/ }),
|
26132 |
|
26133 | /***/ "./src/themes/theme-base.js":
|
26134 | /*!**********************************!*\
|
26135 | !*** ./src/themes/theme-base.js ***!
|
26136 | \**********************************/
|
26137 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26138 |
|
26139 | "use strict";
|
26140 | __webpack_require__.r(__webpack_exports__);
|
26141 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26142 | /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
|
26143 | /* harmony export */ });
|
26144 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
|
26145 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
|
26146 | /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
|
26147 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
26148 |
|
26149 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
26150 |
|
26151 | 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); } }
|
26152 |
|
26153 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
26154 |
|
26155 |
|
26156 |
|
26157 |
|
26158 | var Theme = /*#__PURE__*/function () {
|
26159 | function Theme() {
|
26160 | _classCallCheck(this, Theme);
|
26161 |
|
26162 | /** # Base variables */
|
26163 |
|
26164 | /** * background - used to know what the background color is of the diagram. This is used for deducing colors for istance line color. Defaulr value is #f4f4f4. */
|
26165 | this.background = '#f4f4f4';
|
26166 | this.darkMode = false; // this.background = '#0c0c0c';
|
26167 | // this.darkMode = true;
|
26168 |
|
26169 | this.primaryColor = '#fff4dd'; // this.background = '#0c0c0c';
|
26170 | // this.primaryColor = '#1f1f00';
|
26171 |
|
26172 | this.noteBkgColor = '#fff5ad';
|
26173 | this.noteTextColor = '#333'; // dark
|
26174 | // this.primaryColor = '#034694';
|
26175 | // this.primaryColor = '#f2ee7e';
|
26176 | // this.primaryColor = '#9f33be';
|
26177 | // this.primaryColor = '#f0fff0';
|
26178 | // this.primaryColor = '#fa255e';
|
26179 | // this.primaryColor = '#ECECFF';
|
26180 | // this.secondaryColor = '#c39ea0';
|
26181 | // this.tertiaryColor = '#f8e5e5';
|
26182 | // this.secondaryColor = '#dfdfde';
|
26183 | // this.tertiaryColor = '#CCCCFF';
|
26184 |
|
26185 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
26186 | this.fontSize = '16px'; // this.updateColors();
|
26187 | }
|
26188 |
|
26189 | _createClass(Theme, [{
|
26190 | key: "updateColors",
|
26191 | value: function updateColors() {
|
26192 | // The || is to make sure that if the variable has been defiend by a user override that value is to be used
|
26193 |
|
26194 | /* Main */
|
26195 | this.primaryTextColor = this.primaryTextColor || (this.darkMode ? '#ddd' : '#333'); // invert(this.primaryColor);
|
26196 |
|
26197 | this.secondaryColor = this.secondaryColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26198 | h: -120
|
26199 | });
|
26200 | this.tertiaryColor = this.tertiaryColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26201 | h: 180,
|
26202 | l: 5
|
26203 | });
|
26204 | this.primaryBorderColor = this.primaryBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode);
|
26205 | this.secondaryBorderColor = this.secondaryBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
|
26206 | this.tertiaryBorderColor = this.tertiaryBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode);
|
26207 | this.noteBorderColor = this.noteBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.noteBkgColor, this.darkMode);
|
26208 | this.noteBkgColor = this.noteBkgColor || '#fff5ad';
|
26209 | this.noteTextColor = this.noteTextColor || '#333';
|
26210 | this.secondaryTextColor = this.secondaryTextColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
|
26211 | this.tertiaryTextColor = this.tertiaryTextColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.tertiaryColor);
|
26212 | this.lineColor = this.lineColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
26213 | this.textColor = this.textColor || this.primaryTextColor;
|
26214 | /* Flowchart variables */
|
26215 |
|
26216 | this.nodeBkg = this.nodeBkg || this.primaryColor;
|
26217 | this.mainBkg = this.mainBkg || this.primaryColor;
|
26218 | this.nodeBorder = this.nodeBorder || this.primaryBorderColor;
|
26219 | this.clusterBkg = this.clusterBkg || this.tertiaryColor;
|
26220 | this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
|
26221 | this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
|
26222 | this.titleColor = this.titleColor || this.tertiaryTextColor;
|
26223 | this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.secondaryColor, 30) : this.secondaryColor);
|
26224 | this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
|
26225 | /* Sequence Diagram variables */
|
26226 | // this.actorBorder = lighten(this.border1, 0.5);
|
26227 |
|
26228 | this.actorBorder = this.actorBorder || this.primaryBorderColor;
|
26229 | this.actorBkg = this.actorBkg || this.mainBkg;
|
26230 | this.actorTextColor = this.actorTextColor || this.primaryTextColor;
|
26231 | this.actorLineColor = this.actorLineColor || 'grey';
|
26232 | this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
|
26233 | this.signalColor = this.signalColor || this.textColor;
|
26234 | this.signalTextColor = this.signalTextColor || this.textColor;
|
26235 | this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
|
26236 | this.labelTextColor = this.labelTextColor || this.actorTextColor;
|
26237 | this.loopTextColor = this.loopTextColor || this.actorTextColor;
|
26238 | this.activationBorderColor = this.activationBorderColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.secondaryColor, 10);
|
26239 | this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
|
26240 | this.sequenceNumberColor = this.sequenceNumberColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.lineColor);
|
26241 | /* Gantt chart variables */
|
26242 |
|
26243 | this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;
|
26244 | this.altSectionBkgColor = this.altSectionBkgColor || 'white';
|
26245 | this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;
|
26246 | this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;
|
26247 | this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
|
26248 | this.taskBkgColor = this.taskBkgColor || this.primaryColor;
|
26249 | this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;
|
26250 | this.activeTaskBkgColor = this.activeTaskBkgColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.primaryColor, 23);
|
26251 | this.gridColor = this.gridColor || 'lightgrey';
|
26252 | this.doneTaskBkgColor = this.doneTaskBkgColor || 'lightgrey';
|
26253 | this.doneTaskBorderColor = this.doneTaskBorderColor || 'grey';
|
26254 | this.critBorderColor = this.critBorderColor || '#ff8888';
|
26255 | this.critBkgColor = this.critBkgColor || 'red';
|
26256 | this.todayLineColor = this.todayLineColor || 'red';
|
26257 | this.taskTextColor = this.taskTextColor || this.textColor;
|
26258 | this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
|
26259 | this.taskTextLightColor = this.taskTextLightColor || this.textColor;
|
26260 | this.taskTextColor = this.taskTextColor || this.primaryTextColor;
|
26261 | this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
|
26262 | this.taskTextClickableColor = this.taskTextClickableColor || '#003163';
|
26263 | /* state colors */
|
26264 |
|
26265 | this.transitionColor = this.transitionColor || this.lineColor;
|
26266 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
26267 | /* The color of the text tables of the tstates*/
|
26268 |
|
26269 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
26270 | this.stateBkg = this.stateBkg || this.mainBkg;
|
26271 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
26272 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
26273 | this.altBackground = this.altBackground || this.tertiaryColor;
|
26274 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
26275 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
26276 | this.innerEndBackground = this.nodeBorder;
|
26277 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
26278 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
26279 | this.transitionColor = this.transitionColor || this.lineColor;
|
26280 | this.specialStateColor = this.lineColor;
|
26281 | /* class */
|
26282 |
|
26283 | this.classText = this.classText || this.textColor;
|
26284 | /* user-journey */
|
26285 |
|
26286 | this.fillType0 = this.fillType0 || this.primaryColor;
|
26287 | this.fillType1 = this.fillType1 || this.secondaryColor;
|
26288 | this.fillType2 = this.fillType2 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26289 | h: 64
|
26290 | });
|
26291 | this.fillType3 = this.fillType3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
26292 | h: 64
|
26293 | });
|
26294 | this.fillType4 = this.fillType4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26295 | h: -64
|
26296 | });
|
26297 | this.fillType5 = this.fillType5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
26298 | h: -64
|
26299 | });
|
26300 | this.fillType6 = this.fillType6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26301 | h: 128
|
26302 | });
|
26303 | this.fillType7 = this.fillType7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
26304 | h: 128
|
26305 | });
|
26306 | /* pie */
|
26307 |
|
26308 | this.pie1 = this.pie1 || this.primaryColor;
|
26309 | this.pie2 = this.pie2 || this.secondaryColor;
|
26310 | this.pie3 = this.pie3 || this.tertiaryColor;
|
26311 | this.pie4 = this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26312 | l: -10
|
26313 | });
|
26314 | this.pie5 = this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
26315 | l: -10
|
26316 | });
|
26317 | this.pie6 = this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.tertiaryColor, {
|
26318 | l: -10
|
26319 | });
|
26320 | this.pie7 = this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26321 | h: +60,
|
26322 | l: -10
|
26323 | });
|
26324 | this.pie8 = this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26325 | h: -60,
|
26326 | l: -10
|
26327 | });
|
26328 | this.pie9 = this.pie9 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26329 | h: 120,
|
26330 | l: 0
|
26331 | });
|
26332 | this.pie10 = this.pie10 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26333 | h: +60,
|
26334 | l: -20
|
26335 | });
|
26336 | this.pie11 = this.pie11 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26337 | h: -60,
|
26338 | l: -20
|
26339 | });
|
26340 | this.pie12 = this.pie12 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26341 | h: 120,
|
26342 | l: -10
|
26343 | });
|
26344 | this.pieTitleTextSize = this.pieTitleTextSize || '25px';
|
26345 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
26346 | this.pieSectionTextSize = this.pieSectionTextSize || '17px';
|
26347 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
26348 | this.pieLegendTextSize = this.pieLegendTextSize || '17px';
|
26349 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
26350 | this.pieStrokeColor = this.pieStrokeColor || 'black';
|
26351 | this.pieStrokeWidth = this.pieStrokeWidth || '2px';
|
26352 | this.pieOpacity = this.pieOpacity || '0.7';
|
26353 | /* requirement-diagram */
|
26354 |
|
26355 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
26356 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
26357 | this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
|
26358 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
26359 | this.relationColor = this.relationColor || this.lineColor;
|
26360 | this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.secondaryColor, 30) : this.secondaryColor);
|
26361 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
26362 | }
|
26363 | }, {
|
26364 | key: "calculate",
|
26365 | value: function calculate(overrides) {
|
26366 | var _this = this;
|
26367 |
|
26368 | if (_typeof(overrides) !== 'object') {
|
26369 | // Calculate colors form base colors
|
26370 | this.updateColors();
|
26371 | return;
|
26372 | }
|
26373 |
|
26374 | var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
|
26375 |
|
26376 | keys.forEach(function (k) {
|
26377 | _this[k] = overrides[k];
|
26378 | }); // Calculate colors form base colors
|
26379 |
|
26380 | this.updateColors(); // Copy values from overrides again in case of an override of derived value
|
26381 |
|
26382 | keys.forEach(function (k) {
|
26383 | _this[k] = overrides[k];
|
26384 | });
|
26385 | }
|
26386 | }]);
|
26387 |
|
26388 | return Theme;
|
26389 | }();
|
26390 |
|
26391 | var getThemeVariables = function getThemeVariables(userOverrides) {
|
26392 | var theme = new Theme();
|
26393 | theme.calculate(userOverrides);
|
26394 | return theme;
|
26395 | };
|
26396 |
|
26397 | /***/ }),
|
26398 |
|
26399 | /***/ "./src/themes/theme-dark.js":
|
26400 | /*!**********************************!*\
|
26401 | !*** ./src/themes/theme-dark.js ***!
|
26402 | \**********************************/
|
26403 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26404 |
|
26405 | "use strict";
|
26406 | __webpack_require__.r(__webpack_exports__);
|
26407 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26408 | /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
|
26409 | /* harmony export */ });
|
26410 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
|
26411 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
|
26412 | /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
|
26413 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
26414 |
|
26415 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
26416 |
|
26417 | 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); } }
|
26418 |
|
26419 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
26420 |
|
26421 |
|
26422 |
|
26423 |
|
26424 | var Theme = /*#__PURE__*/function () {
|
26425 | function Theme() {
|
26426 | _classCallCheck(this, Theme);
|
26427 |
|
26428 | this.background = '#333';
|
26429 | this.primaryColor = '#1f2020';
|
26430 | this.secondaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.primaryColor, 16);
|
26431 | this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26432 | h: -160
|
26433 | });
|
26434 | this.primaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode);
|
26435 | this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
|
26436 | this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode);
|
26437 | this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
|
26438 | this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
|
26439 | this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.tertiaryColor);
|
26440 | this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
26441 | this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
26442 | this.mainBkg = '#1f2020';
|
26443 | this.secondBkg = 'calculated';
|
26444 | this.mainContrastColor = 'lightgrey';
|
26445 | this.darkTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)((0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)('#323D47'), 10);
|
26446 | this.lineColor = 'calculated';
|
26447 | this.border1 = '#81B1DB';
|
26448 | this.border2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.rgba)(255, 255, 255, 0.25);
|
26449 | this.arrowheadColor = 'calculated';
|
26450 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
26451 | this.fontSize = '16px';
|
26452 | this.labelBackground = '#181818';
|
26453 | this.textColor = '#ccc';
|
26454 | /* Flowchart variables */
|
26455 |
|
26456 | this.nodeBkg = 'calculated';
|
26457 | this.nodeBorder = 'calculated';
|
26458 | this.clusterBkg = 'calculated';
|
26459 | this.clusterBorder = 'calculated';
|
26460 | this.defaultLinkColor = 'calculated';
|
26461 | this.titleColor = '#F9FFFE';
|
26462 | this.edgeLabelBackground = 'calculated';
|
26463 | /* Sequence Diagram variables */
|
26464 |
|
26465 | this.actorBorder = 'calculated';
|
26466 | this.actorBkg = 'calculated';
|
26467 | this.actorTextColor = 'calculated';
|
26468 | this.actorLineColor = 'calculated';
|
26469 | this.signalColor = 'calculated';
|
26470 | this.signalTextColor = 'calculated';
|
26471 | this.labelBoxBkgColor = 'calculated';
|
26472 | this.labelBoxBorderColor = 'calculated';
|
26473 | this.labelTextColor = 'calculated';
|
26474 | this.loopTextColor = 'calculated';
|
26475 | this.noteBorderColor = 'calculated';
|
26476 | this.noteBkgColor = '#fff5ad';
|
26477 | this.noteTextColor = 'calculated';
|
26478 | this.activationBorderColor = 'calculated';
|
26479 | this.activationBkgColor = 'calculated';
|
26480 | this.sequenceNumberColor = 'black';
|
26481 | /* Gantt chart variables */
|
26482 |
|
26483 | this.sectionBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)('#EAE8D9', 30);
|
26484 | this.altSectionBkgColor = 'calculated';
|
26485 | this.sectionBkgColor2 = '#EAE8D9';
|
26486 | this.taskBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.rgba)(255, 255, 255, 70);
|
26487 | this.taskBkgColor = 'calculated';
|
26488 | this.taskTextColor = 'calculated';
|
26489 | this.taskTextLightColor = 'calculated';
|
26490 | this.taskTextOutsideColor = 'calculated';
|
26491 | this.taskTextClickableColor = '#003163';
|
26492 | this.activeTaskBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.rgba)(255, 255, 255, 50);
|
26493 | this.activeTaskBkgColor = '#81B1DB';
|
26494 | this.gridColor = 'calculated';
|
26495 | this.doneTaskBkgColor = 'calculated';
|
26496 | this.doneTaskBorderColor = 'grey';
|
26497 | this.critBorderColor = '#E83737';
|
26498 | this.critBkgColor = '#E83737';
|
26499 | this.taskTextDarkColor = 'calculated';
|
26500 | this.todayLineColor = '#DB5757';
|
26501 | /* state colors */
|
26502 |
|
26503 | this.labelColor = 'calculated';
|
26504 | this.errorBkgColor = '#a44141';
|
26505 | this.errorTextColor = '#ddd';
|
26506 | }
|
26507 |
|
26508 | _createClass(Theme, [{
|
26509 | key: "updateColors",
|
26510 | value: function updateColors() {
|
26511 | this.secondBkg = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.mainBkg, 16);
|
26512 | this.lineColor = this.mainContrastColor;
|
26513 | this.arrowheadColor = this.mainContrastColor;
|
26514 | /* Flowchart variables */
|
26515 |
|
26516 | this.nodeBkg = this.mainBkg;
|
26517 | this.nodeBorder = this.border1;
|
26518 | this.clusterBkg = this.secondBkg;
|
26519 | this.clusterBorder = this.border2;
|
26520 | this.defaultLinkColor = this.lineColor;
|
26521 | this.edgeLabelBackground = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.labelBackground, 25);
|
26522 | /* Sequence Diagram variables */
|
26523 |
|
26524 | this.actorBorder = this.border1;
|
26525 | this.actorBkg = this.mainBkg;
|
26526 | this.actorTextColor = this.mainContrastColor;
|
26527 | this.actorLineColor = this.mainContrastColor;
|
26528 | this.signalColor = this.mainContrastColor;
|
26529 | this.signalTextColor = this.mainContrastColor;
|
26530 | this.labelBoxBkgColor = this.actorBkg;
|
26531 | this.labelBoxBorderColor = this.actorBorder;
|
26532 | this.labelTextColor = this.mainContrastColor;
|
26533 | this.loopTextColor = this.mainContrastColor;
|
26534 | this.noteBorderColor = this.secondaryBorderColor;
|
26535 | this.noteBkgColor = this.secondBkg;
|
26536 | this.noteTextColor = this.secondaryTextColor;
|
26537 | this.activationBorderColor = this.border1;
|
26538 | this.activationBkgColor = this.secondBkg;
|
26539 | /* Gantt chart variables */
|
26540 |
|
26541 | this.altSectionBkgColor = this.background;
|
26542 | this.taskBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.mainBkg, 23);
|
26543 | this.taskTextColor = this.darkTextColor;
|
26544 | this.taskTextLightColor = this.mainContrastColor;
|
26545 | this.taskTextOutsideColor = this.taskTextLightColor;
|
26546 | this.gridColor = this.mainContrastColor;
|
26547 | this.doneTaskBkgColor = this.mainContrastColor;
|
26548 | this.taskTextDarkColor = this.darkTextColor;
|
26549 | /* state colors */
|
26550 |
|
26551 | this.transitionColor = this.transitionColor || this.lineColor;
|
26552 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
26553 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
26554 | this.stateBkg = this.stateBkg || this.mainBkg;
|
26555 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
26556 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
26557 | this.altBackground = this.altBackground || '#555';
|
26558 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
26559 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
26560 | this.innerEndBackground = this.primaryBorderColor;
|
26561 | this.specialStateColor = '#f4f4f4'; // this.lineColor;
|
26562 |
|
26563 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
26564 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
26565 | this.fillType0 = this.primaryColor;
|
26566 | this.fillType1 = this.secondaryColor;
|
26567 | this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26568 | h: 64
|
26569 | });
|
26570 | this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
26571 | h: 64
|
26572 | });
|
26573 | this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26574 | h: -64
|
26575 | });
|
26576 | this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
26577 | h: -64
|
26578 | });
|
26579 | this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26580 | h: 128
|
26581 | });
|
26582 | this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
26583 | h: 128
|
26584 | });
|
26585 | /* pie */
|
26586 |
|
26587 | this.pie1 = this.pie1 || '#0b0000';
|
26588 | this.pie2 = this.pie2 || '#4d1037';
|
26589 | this.pie3 = this.pie3 || '#3f5258';
|
26590 | this.pie4 = this.pie4 || '#4f2f1b';
|
26591 | this.pie5 = this.pie5 || '#6e0a0a';
|
26592 | this.pie6 = this.pie6 || '#3b0048';
|
26593 | this.pie7 = this.pie7 || '#995a01';
|
26594 | this.pie8 = this.pie8 || '#154706';
|
26595 | this.pie9 = this.pie9 || '#161722';
|
26596 | this.pie10 = this.pie10 || '#00296f';
|
26597 | this.pie11 = this.pie11 || '#01629c';
|
26598 | this.pie12 = this.pie12 || '#010029';
|
26599 | this.pieTitleTextSize = this.pieTitleTextSize || '25px';
|
26600 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
26601 | this.pieSectionTextSize = this.pieSectionTextSize || '17px';
|
26602 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
26603 | this.pieLegendTextSize = this.pieLegendTextSize || '17px';
|
26604 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
26605 | this.pieStrokeColor = this.pieStrokeColor || 'black';
|
26606 | this.pieStrokeWidth = this.pieStrokeWidth || '2px';
|
26607 | this.pieOpacity = this.pieOpacity || '0.7';
|
26608 | /* class */
|
26609 |
|
26610 | this.classText = this.primaryTextColor;
|
26611 | /* requirement-diagram */
|
26612 |
|
26613 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
26614 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
26615 | this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
|
26616 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
26617 | this.relationColor = this.relationColor || this.lineColor;
|
26618 | this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.secondaryColor, 30) : this.secondaryColor);
|
26619 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
26620 | }
|
26621 | }, {
|
26622 | key: "calculate",
|
26623 | value: function calculate(overrides) {
|
26624 | var _this = this;
|
26625 |
|
26626 | if (_typeof(overrides) !== 'object') {
|
26627 | // Calculate colors form base colors
|
26628 | this.updateColors();
|
26629 | return;
|
26630 | }
|
26631 |
|
26632 | var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
|
26633 |
|
26634 | keys.forEach(function (k) {
|
26635 | _this[k] = overrides[k];
|
26636 | }); // Calculate colors form base colors
|
26637 |
|
26638 | this.updateColors(); // Copy values from overrides again in case of an override of derived value
|
26639 |
|
26640 | keys.forEach(function (k) {
|
26641 | _this[k] = overrides[k];
|
26642 | });
|
26643 | }
|
26644 | }]);
|
26645 |
|
26646 | return Theme;
|
26647 | }();
|
26648 |
|
26649 | var getThemeVariables = function getThemeVariables(userOverrides) {
|
26650 | var theme = new Theme();
|
26651 | theme.calculate(userOverrides);
|
26652 | return theme;
|
26653 | };
|
26654 |
|
26655 | /***/ }),
|
26656 |
|
26657 | /***/ "./src/themes/theme-default.js":
|
26658 | /*!*************************************!*\
|
26659 | !*** ./src/themes/theme-default.js ***!
|
26660 | \*************************************/
|
26661 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26662 |
|
26663 | "use strict";
|
26664 | __webpack_require__.r(__webpack_exports__);
|
26665 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26666 | /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
|
26667 | /* harmony export */ });
|
26668 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
|
26669 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
|
26670 | /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
|
26671 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
26672 |
|
26673 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
26674 |
|
26675 | 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); } }
|
26676 |
|
26677 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
26678 |
|
26679 |
|
26680 |
|
26681 |
|
26682 | var Theme = /*#__PURE__*/function () {
|
26683 | function Theme() {
|
26684 | _classCallCheck(this, Theme);
|
26685 |
|
26686 | /* Base variables */
|
26687 | this.background = '#f4f4f4';
|
26688 | this.primaryColor = '#ECECFF';
|
26689 | this.secondaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26690 | h: 120
|
26691 | });
|
26692 | this.secondaryColor = '#ffffde';
|
26693 | this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26694 | h: -160
|
26695 | });
|
26696 | this.primaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode);
|
26697 | this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
|
26698 | this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode); // this.noteBorderColor = mkBorder(this.noteBkgColor, this.darkMode);
|
26699 |
|
26700 | this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
|
26701 | this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
|
26702 | this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.tertiaryColor);
|
26703 | this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
26704 | this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
26705 | this.background = 'white';
|
26706 | this.mainBkg = '#ECECFF';
|
26707 | this.secondBkg = '#ffffde';
|
26708 | this.lineColor = '#333333';
|
26709 | this.border1 = '#9370DB';
|
26710 | this.border2 = '#aaaa33';
|
26711 | this.arrowheadColor = '#333333';
|
26712 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
26713 | this.fontSize = '16px';
|
26714 | this.labelBackground = '#e8e8e8';
|
26715 | this.textColor = '#333';
|
26716 | /* Flowchart variables */
|
26717 |
|
26718 | this.nodeBkg = 'calculated';
|
26719 | this.nodeBorder = 'calculated';
|
26720 | this.clusterBkg = 'calculated';
|
26721 | this.clusterBorder = 'calculated';
|
26722 | this.defaultLinkColor = 'calculated';
|
26723 | this.titleColor = 'calculated';
|
26724 | this.edgeLabelBackground = 'calculated';
|
26725 | /* Sequence Diagram variables */
|
26726 |
|
26727 | this.actorBorder = 'calculated';
|
26728 | this.actorBkg = 'calculated';
|
26729 | this.actorTextColor = 'black';
|
26730 | this.actorLineColor = 'grey';
|
26731 | this.signalColor = 'calculated';
|
26732 | this.signalTextColor = 'calculated';
|
26733 | this.labelBoxBkgColor = 'calculated';
|
26734 | this.labelBoxBorderColor = 'calculated';
|
26735 | this.labelTextColor = 'calculated';
|
26736 | this.loopTextColor = 'calculated';
|
26737 | this.noteBorderColor = 'calculated';
|
26738 | this.noteBkgColor = '#fff5ad';
|
26739 | this.noteTextColor = 'calculated';
|
26740 | this.activationBorderColor = '#666';
|
26741 | this.activationBkgColor = '#f4f4f4';
|
26742 | this.sequenceNumberColor = 'white';
|
26743 | /* Gantt chart variables */
|
26744 |
|
26745 | this.sectionBkgColor = 'calculated';
|
26746 | this.altSectionBkgColor = 'calculated';
|
26747 | this.sectionBkgColor2 = 'calculated';
|
26748 | this.taskBorderColor = 'calculated';
|
26749 | this.taskBkgColor = 'calculated';
|
26750 | this.taskTextLightColor = 'calculated';
|
26751 | this.taskTextColor = this.taskTextLightColor;
|
26752 | this.taskTextDarkColor = 'calculated';
|
26753 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
26754 | this.taskTextClickableColor = 'calculated';
|
26755 | this.activeTaskBorderColor = 'calculated';
|
26756 | this.activeTaskBkgColor = 'calculated';
|
26757 | this.gridColor = 'calculated';
|
26758 | this.doneTaskBkgColor = 'calculated';
|
26759 | this.doneTaskBorderColor = 'calculated';
|
26760 | this.critBorderColor = 'calculated';
|
26761 | this.critBkgColor = 'calculated';
|
26762 | this.todayLineColor = 'calculated';
|
26763 | this.sectionBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.rgba)(102, 102, 255, 0.49);
|
26764 | this.altSectionBkgColor = 'white';
|
26765 | this.sectionBkgColor2 = '#fff400';
|
26766 | this.taskBorderColor = '#534fbc';
|
26767 | this.taskBkgColor = '#8a90dd';
|
26768 | this.taskTextLightColor = 'white';
|
26769 | this.taskTextColor = 'calculated';
|
26770 | this.taskTextDarkColor = 'black';
|
26771 | this.taskTextOutsideColor = 'calculated';
|
26772 | this.taskTextClickableColor = '#003163';
|
26773 | this.activeTaskBorderColor = '#534fbc';
|
26774 | this.activeTaskBkgColor = '#bfc7ff';
|
26775 | this.gridColor = 'lightgrey';
|
26776 | this.doneTaskBkgColor = 'lightgrey';
|
26777 | this.doneTaskBorderColor = 'grey';
|
26778 | this.critBorderColor = '#ff8888';
|
26779 | this.critBkgColor = 'red';
|
26780 | this.todayLineColor = 'red';
|
26781 | /* state colors */
|
26782 |
|
26783 | this.labelColor = 'black';
|
26784 | this.errorBkgColor = '#552222';
|
26785 | this.errorTextColor = '#552222';
|
26786 | this.updateColors();
|
26787 | }
|
26788 |
|
26789 | _createClass(Theme, [{
|
26790 | key: "updateColors",
|
26791 | value: function updateColors() {
|
26792 | /* Flowchart variables */
|
26793 | this.nodeBkg = this.mainBkg;
|
26794 | this.nodeBorder = this.border1; // border 1
|
26795 |
|
26796 | this.clusterBkg = this.secondBkg;
|
26797 | this.clusterBorder = this.border2;
|
26798 | this.defaultLinkColor = this.lineColor;
|
26799 | this.titleColor = this.textColor;
|
26800 | this.edgeLabelBackground = this.labelBackground;
|
26801 | /* Sequence Diagram variables */
|
26802 | // this.actorBorder = lighten(this.border1, 0.5);
|
26803 |
|
26804 | this.actorBorder = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.border1, 23);
|
26805 | this.actorBkg = this.mainBkg;
|
26806 | this.labelBoxBkgColor = this.actorBkg;
|
26807 | this.signalColor = this.textColor;
|
26808 | this.signalTextColor = this.textColor;
|
26809 | this.labelBoxBorderColor = this.actorBorder;
|
26810 | this.labelTextColor = this.actorTextColor;
|
26811 | this.loopTextColor = this.actorTextColor;
|
26812 | this.noteBorderColor = this.border2;
|
26813 | this.noteTextColor = this.actorTextColor;
|
26814 | /* Gantt chart variables */
|
26815 |
|
26816 | this.taskTextColor = this.taskTextLightColor;
|
26817 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
26818 | /* state colors */
|
26819 |
|
26820 | this.transitionColor = this.transitionColor || this.lineColor;
|
26821 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
26822 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
26823 | this.stateBkg = this.stateBkg || this.mainBkg;
|
26824 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
26825 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
26826 | this.altBackground = this.altBackground || '#f0f0f0';
|
26827 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
26828 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
26829 | this.innerEndBackground = this.nodeBorder;
|
26830 | this.specialStateColor = this.lineColor;
|
26831 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
26832 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
26833 | this.transitionColor = this.transitionColor || this.lineColor;
|
26834 | /* class */
|
26835 |
|
26836 | this.classText = this.primaryTextColor;
|
26837 | /* journey */
|
26838 |
|
26839 | this.fillType0 = this.primaryColor;
|
26840 | this.fillType1 = this.secondaryColor;
|
26841 | this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26842 | h: 64
|
26843 | });
|
26844 | this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
26845 | h: 64
|
26846 | });
|
26847 | this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26848 | h: -64
|
26849 | });
|
26850 | this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
26851 | h: -64
|
26852 | });
|
26853 | this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26854 | h: 128
|
26855 | });
|
26856 | this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
26857 | h: 128
|
26858 | });
|
26859 | /* pie */
|
26860 |
|
26861 | this.pie1 = this.pie1 || this.primaryColor;
|
26862 | this.pie2 = this.pie2 || this.secondaryColor;
|
26863 | this.pie3 = this.pie3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.tertiaryColor, {
|
26864 | l: -40
|
26865 | });
|
26866 | this.pie4 = this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26867 | l: -10
|
26868 | });
|
26869 | this.pie5 = this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
26870 | l: -30
|
26871 | });
|
26872 | this.pie6 = this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.tertiaryColor, {
|
26873 | l: -20
|
26874 | });
|
26875 | this.pie7 = this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26876 | h: +60,
|
26877 | l: -20
|
26878 | });
|
26879 | this.pie8 = this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26880 | h: -60,
|
26881 | l: -40
|
26882 | });
|
26883 | this.pie9 = this.pie9 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26884 | h: 120,
|
26885 | l: -40
|
26886 | });
|
26887 | this.pie10 = this.pie10 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26888 | h: +60,
|
26889 | l: -40
|
26890 | });
|
26891 | this.pie11 = this.pie11 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26892 | h: -90,
|
26893 | l: -40
|
26894 | });
|
26895 | this.pie12 = this.pie12 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
26896 | h: 120,
|
26897 | l: -30
|
26898 | });
|
26899 | this.pieTitleTextSize = this.pieTitleTextSize || '25px';
|
26900 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
26901 | this.pieSectionTextSize = this.pieSectionTextSize || '17px';
|
26902 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
26903 | this.pieLegendTextSize = this.pieLegendTextSize || '17px';
|
26904 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
26905 | this.pieStrokeColor = this.pieStrokeColor || 'black';
|
26906 | this.pieStrokeWidth = this.pieStrokeWidth || '2px';
|
26907 | this.pieOpacity = this.pieOpacity || '0.7';
|
26908 | /* requirement-diagram */
|
26909 |
|
26910 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
26911 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
26912 | this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
|
26913 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
26914 | this.relationColor = this.relationColor || this.lineColor;
|
26915 | this.relationLabelBackground = this.relationLabelBackground || this.labelBackground;
|
26916 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
26917 | }
|
26918 | }, {
|
26919 | key: "calculate",
|
26920 | value: function calculate(overrides) {
|
26921 | var _this = this;
|
26922 |
|
26923 | if (_typeof(overrides) !== 'object') {
|
26924 | // Calculate colors form base colors
|
26925 | this.updateColors();
|
26926 | return;
|
26927 | }
|
26928 |
|
26929 | var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
|
26930 |
|
26931 | keys.forEach(function (k) {
|
26932 | _this[k] = overrides[k];
|
26933 | }); // Calculate colors form base colors
|
26934 |
|
26935 | this.updateColors(); // Copy values from overrides again in case of an override of derived value
|
26936 |
|
26937 | keys.forEach(function (k) {
|
26938 | _this[k] = overrides[k];
|
26939 | });
|
26940 | }
|
26941 | }]);
|
26942 |
|
26943 | return Theme;
|
26944 | }();
|
26945 |
|
26946 | var getThemeVariables = function getThemeVariables(userOverrides) {
|
26947 | var theme = new Theme();
|
26948 | theme.calculate(userOverrides);
|
26949 | return theme;
|
26950 | };
|
26951 |
|
26952 | /***/ }),
|
26953 |
|
26954 | /***/ "./src/themes/theme-forest.js":
|
26955 | /*!************************************!*\
|
26956 | !*** ./src/themes/theme-forest.js ***!
|
26957 | \************************************/
|
26958 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
26959 |
|
26960 | "use strict";
|
26961 | __webpack_require__.r(__webpack_exports__);
|
26962 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
26963 | /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
|
26964 | /* harmony export */ });
|
26965 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
|
26966 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
|
26967 | /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
|
26968 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
26969 |
|
26970 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
26971 |
|
26972 | 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); } }
|
26973 |
|
26974 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
26975 |
|
26976 |
|
26977 |
|
26978 |
|
26979 | var Theme = /*#__PURE__*/function () {
|
26980 | function Theme() {
|
26981 | _classCallCheck(this, Theme);
|
26982 |
|
26983 | /* Base vales */
|
26984 | this.background = '#f4f4f4';
|
26985 | this.primaryColor = '#cde498';
|
26986 | this.secondaryColor = '#cdffb2';
|
26987 | this.background = 'white';
|
26988 | this.mainBkg = '#cde498';
|
26989 | this.secondBkg = '#cdffb2';
|
26990 | this.lineColor = 'green';
|
26991 | this.border1 = '#13540c';
|
26992 | this.border2 = '#6eaa49';
|
26993 | this.arrowheadColor = 'green';
|
26994 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
26995 | this.fontSize = '16px';
|
26996 | this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)('#cde498', 10);
|
26997 | this.primaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode);
|
26998 | this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
|
26999 | this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode);
|
27000 | this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
|
27001 | this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
|
27002 | this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
|
27003 | this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
27004 | this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
27005 | /* Flowchart variables */
|
27006 |
|
27007 | this.nodeBkg = 'calculated';
|
27008 | this.nodeBorder = 'calculated';
|
27009 | this.clusterBkg = 'calculated';
|
27010 | this.clusterBorder = 'calculated';
|
27011 | this.defaultLinkColor = 'calculated';
|
27012 | this.titleColor = '#333';
|
27013 | this.edgeLabelBackground = '#e8e8e8';
|
27014 | /* Sequence Diagram variables */
|
27015 |
|
27016 | this.actorBorder = 'calculated';
|
27017 | this.actorBkg = 'calculated';
|
27018 | this.actorTextColor = 'black';
|
27019 | this.actorLineColor = 'grey';
|
27020 | this.signalColor = '#333';
|
27021 | this.signalTextColor = '#333';
|
27022 | this.labelBoxBkgColor = 'calculated';
|
27023 | this.labelBoxBorderColor = '#326932';
|
27024 | this.labelTextColor = 'calculated';
|
27025 | this.loopTextColor = 'calculated';
|
27026 | this.noteBorderColor = 'calculated';
|
27027 | this.noteBkgColor = '#fff5ad';
|
27028 | this.noteTextColor = 'calculated';
|
27029 | this.activationBorderColor = '#666';
|
27030 | this.activationBkgColor = '#f4f4f4';
|
27031 | this.sequenceNumberColor = 'white';
|
27032 | /* Gantt chart variables */
|
27033 |
|
27034 | this.sectionBkgColor = '#6eaa49';
|
27035 | this.altSectionBkgColor = 'white';
|
27036 | this.sectionBkgColor2 = '#6eaa49';
|
27037 | this.taskBorderColor = 'calculated';
|
27038 | this.taskBkgColor = '#487e3a';
|
27039 | this.taskTextLightColor = 'white';
|
27040 | this.taskTextColor = 'calculated';
|
27041 | this.taskTextDarkColor = 'black';
|
27042 | this.taskTextOutsideColor = 'calculated';
|
27043 | this.taskTextClickableColor = '#003163';
|
27044 | this.activeTaskBorderColor = 'calculated';
|
27045 | this.activeTaskBkgColor = 'calculated';
|
27046 | this.gridColor = 'lightgrey';
|
27047 | this.doneTaskBkgColor = 'lightgrey';
|
27048 | this.doneTaskBorderColor = 'grey';
|
27049 | this.critBorderColor = '#ff8888';
|
27050 | this.critBkgColor = 'red';
|
27051 | this.todayLineColor = 'red';
|
27052 | /* state colors */
|
27053 |
|
27054 | this.labelColor = 'black';
|
27055 | this.errorBkgColor = '#552222';
|
27056 | this.errorTextColor = '#552222';
|
27057 | }
|
27058 |
|
27059 | _createClass(Theme, [{
|
27060 | key: "updateColors",
|
27061 | value: function updateColors() {
|
27062 | /* Flowchart variables */
|
27063 | this.nodeBkg = this.mainBkg;
|
27064 | this.nodeBorder = this.border1;
|
27065 | this.clusterBkg = this.secondBkg;
|
27066 | this.clusterBorder = this.border2;
|
27067 | this.defaultLinkColor = this.lineColor;
|
27068 | /* Sequence Diagram variables */
|
27069 |
|
27070 | this.actorBorder = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.mainBkg, 20);
|
27071 | this.actorBkg = this.mainBkg;
|
27072 | this.labelBoxBkgColor = this.actorBkg;
|
27073 | this.labelTextColor = this.actorTextColor;
|
27074 | this.loopTextColor = this.actorTextColor;
|
27075 | this.noteBorderColor = this.border2;
|
27076 | this.noteTextColor = this.actorTextColor;
|
27077 | /* Gantt chart variables */
|
27078 |
|
27079 | this.taskBorderColor = this.border1;
|
27080 | this.taskTextColor = this.taskTextLightColor;
|
27081 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
27082 | this.activeTaskBorderColor = this.taskBorderColor;
|
27083 | this.activeTaskBkgColor = this.mainBkg;
|
27084 | /* state colors */
|
27085 |
|
27086 | this.transitionColor = this.transitionColor || this.lineColor;
|
27087 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
27088 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
27089 | this.stateBkg = this.stateBkg || this.mainBkg;
|
27090 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
27091 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
27092 | this.altBackground = this.altBackground || '#f0f0f0';
|
27093 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
27094 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
27095 | this.innerEndBackground = this.primaryBorderColor;
|
27096 | this.specialStateColor = this.lineColor;
|
27097 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
27098 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
27099 | this.transitionColor = this.transitionColor || this.lineColor;
|
27100 | /* class */
|
27101 |
|
27102 | this.classText = this.primaryTextColor;
|
27103 | /* journey */
|
27104 |
|
27105 | this.fillType0 = this.primaryColor;
|
27106 | this.fillType1 = this.secondaryColor;
|
27107 | this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
27108 | h: 64
|
27109 | });
|
27110 | this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
27111 | h: 64
|
27112 | });
|
27113 | this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
27114 | h: -64
|
27115 | });
|
27116 | this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
27117 | h: -64
|
27118 | });
|
27119 | this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
27120 | h: 128
|
27121 | });
|
27122 | this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
27123 | h: 128
|
27124 | });
|
27125 | /* pie */
|
27126 |
|
27127 | this.pie1 = this.pie1 || this.primaryColor;
|
27128 | this.pie2 = this.pie2 || this.secondaryColor;
|
27129 | this.pie3 = this.pie3 || this.tertiaryColor;
|
27130 | this.pie4 = this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
27131 | l: -30
|
27132 | });
|
27133 | this.pie5 = this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
27134 | l: -30
|
27135 | });
|
27136 | this.pie6 = this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.tertiaryColor, {
|
27137 | h: +40,
|
27138 | l: -40
|
27139 | });
|
27140 | this.pie7 = this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
27141 | h: +60,
|
27142 | l: -10
|
27143 | });
|
27144 | this.pie8 = this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
27145 | h: -60,
|
27146 | l: -10
|
27147 | });
|
27148 | this.pie9 = this.pie9 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
27149 | h: 120,
|
27150 | l: 0
|
27151 | });
|
27152 | this.pie10 = this.pie10 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
27153 | h: +60,
|
27154 | l: -50
|
27155 | });
|
27156 | this.pie11 = this.pie11 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
27157 | h: -60,
|
27158 | l: -50
|
27159 | });
|
27160 | this.pie12 = this.pie12 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
27161 | h: 120,
|
27162 | l: -50
|
27163 | });
|
27164 | this.pieTitleTextSize = this.pieTitleTextSize || '25px';
|
27165 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
27166 | this.pieSectionTextSize = this.pieSectionTextSize || '17px';
|
27167 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
27168 | this.pieLegendTextSize = this.pieLegendTextSize || '17px';
|
27169 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
27170 | this.pieStrokeColor = this.pieStrokeColor || 'black';
|
27171 | this.pieStrokeWidth = this.pieStrokeWidth || '2px';
|
27172 | this.pieOpacity = this.pieOpacity || '0.7';
|
27173 | /* requirement-diagram */
|
27174 |
|
27175 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
27176 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
27177 | this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
|
27178 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
27179 | this.relationColor = this.relationColor || this.lineColor;
|
27180 | this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
|
27181 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
27182 | }
|
27183 | }, {
|
27184 | key: "calculate",
|
27185 | value: function calculate(overrides) {
|
27186 | var _this = this;
|
27187 |
|
27188 | if (_typeof(overrides) !== 'object') {
|
27189 | // Calculate colors form base colors
|
27190 | this.updateColors();
|
27191 | return;
|
27192 | }
|
27193 |
|
27194 | var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
|
27195 |
|
27196 | keys.forEach(function (k) {
|
27197 | _this[k] = overrides[k];
|
27198 | }); // Calculate colors form base colors
|
27199 |
|
27200 | this.updateColors(); // Copy values from overrides again in case of an override of derived value
|
27201 |
|
27202 | keys.forEach(function (k) {
|
27203 | _this[k] = overrides[k];
|
27204 | });
|
27205 | }
|
27206 | }]);
|
27207 |
|
27208 | return Theme;
|
27209 | }();
|
27210 |
|
27211 | var getThemeVariables = function getThemeVariables(userOverrides) {
|
27212 | var theme = new Theme();
|
27213 | theme.calculate(userOverrides);
|
27214 | return theme;
|
27215 | };
|
27216 |
|
27217 | /***/ }),
|
27218 |
|
27219 | /***/ "./src/themes/theme-helpers.js":
|
27220 | /*!*************************************!*\
|
27221 | !*** ./src/themes/theme-helpers.js ***!
|
27222 | \*************************************/
|
27223 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
27224 |
|
27225 | "use strict";
|
27226 | __webpack_require__.r(__webpack_exports__);
|
27227 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
27228 | /* harmony export */ "mkBorder": () => (/* binding */ mkBorder)
|
27229 | /* harmony export */ });
|
27230 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
|
27231 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
|
27232 |
|
27233 | var mkBorder = function mkBorder(col, darkMode) {
|
27234 | return darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(col, {
|
27235 | s: -40,
|
27236 | l: 10
|
27237 | }) : (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(col, {
|
27238 | s: -40,
|
27239 | l: -10
|
27240 | });
|
27241 | };
|
27242 |
|
27243 | /***/ }),
|
27244 |
|
27245 | /***/ "./src/themes/theme-neutral.js":
|
27246 | /*!*************************************!*\
|
27247 | !*** ./src/themes/theme-neutral.js ***!
|
27248 | \*************************************/
|
27249 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
27250 |
|
27251 | "use strict";
|
27252 | __webpack_require__.r(__webpack_exports__);
|
27253 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
27254 | /* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
|
27255 | /* harmony export */ });
|
27256 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
|
27257 | /* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
|
27258 | /* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
|
27259 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
27260 |
|
27261 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
27262 |
|
27263 | 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); } }
|
27264 |
|
27265 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
27266 |
|
27267 |
|
27268 | // const Color = require ( 'khroma/dist/color' ).default
|
27269 | // Color.format.hex.stringify(Color.parse('hsl(210, 66.6666666667%, 95%)')); // => "#EAF2FB"
|
27270 |
|
27271 | var Theme = /*#__PURE__*/function () {
|
27272 | function Theme() {
|
27273 | _classCallCheck(this, Theme);
|
27274 |
|
27275 | this.primaryColor = '#eee';
|
27276 | this.contrast = '#707070';
|
27277 | this.secondaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.contrast, 55);
|
27278 | this.background = '#ffffff'; // this.secondaryColor = adjust(this.primaryColor, { h: 120 });
|
27279 |
|
27280 | this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
27281 | h: -160
|
27282 | });
|
27283 | this.primaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode);
|
27284 | this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
|
27285 | this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode); // this.noteBorderColor = mkBorder(this.noteBkgColor, this.darkMode);
|
27286 |
|
27287 | this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
|
27288 | this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
|
27289 | this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.tertiaryColor);
|
27290 | this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
|
27291 | this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background); // this.altBackground = lighten(this.contrast, 55);
|
27292 |
|
27293 | this.mainBkg = '#eee';
|
27294 | this.secondBkg = 'calculated';
|
27295 | this.lineColor = '#666';
|
27296 | this.border1 = '#999';
|
27297 | this.border2 = 'calculated';
|
27298 | this.note = '#ffa';
|
27299 | this.text = '#333';
|
27300 | this.critical = '#d42';
|
27301 | this.done = '#bbb';
|
27302 | this.arrowheadColor = '#333333';
|
27303 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
27304 | this.fontSize = '16px';
|
27305 | /* Flowchart variables */
|
27306 |
|
27307 | this.nodeBkg = 'calculated';
|
27308 | this.nodeBorder = 'calculated';
|
27309 | this.clusterBkg = 'calculated';
|
27310 | this.clusterBorder = 'calculated';
|
27311 | this.defaultLinkColor = 'calculated';
|
27312 | this.titleColor = 'calculated';
|
27313 | this.edgeLabelBackground = 'white';
|
27314 | /* Sequence Diagram variables */
|
27315 |
|
27316 | this.actorBorder = 'calculated';
|
27317 | this.actorBkg = 'calculated';
|
27318 | this.actorTextColor = 'calculated';
|
27319 | this.actorLineColor = 'calculated';
|
27320 | this.signalColor = 'calculated';
|
27321 | this.signalTextColor = 'calculated';
|
27322 | this.labelBoxBkgColor = 'calculated';
|
27323 | this.labelBoxBorderColor = 'calculated';
|
27324 | this.labelTextColor = 'calculated';
|
27325 | this.loopTextColor = 'calculated';
|
27326 | this.noteBorderColor = 'calculated';
|
27327 | this.noteBkgColor = 'calculated';
|
27328 | this.noteTextColor = 'calculated';
|
27329 | this.activationBorderColor = '#666';
|
27330 | this.activationBkgColor = '#f4f4f4';
|
27331 | this.sequenceNumberColor = 'white';
|
27332 | /* Gantt chart variables */
|
27333 |
|
27334 | this.sectionBkgColor = 'calculated';
|
27335 | this.altSectionBkgColor = 'white';
|
27336 | this.sectionBkgColor2 = 'calculated';
|
27337 | this.taskBorderColor = 'calculated';
|
27338 | this.taskBkgColor = 'calculated';
|
27339 | this.taskTextLightColor = 'white';
|
27340 | this.taskTextColor = 'calculated';
|
27341 | this.taskTextDarkColor = 'calculated';
|
27342 | this.taskTextOutsideColor = 'calculated';
|
27343 | this.taskTextClickableColor = '#003163';
|
27344 | this.activeTaskBorderColor = 'calculated';
|
27345 | this.activeTaskBkgColor = 'calculated';
|
27346 | this.gridColor = 'calculated';
|
27347 | this.doneTaskBkgColor = 'calculated';
|
27348 | this.doneTaskBorderColor = 'calculated';
|
27349 | this.critBkgColor = 'calculated';
|
27350 | this.critBorderColor = 'calculated';
|
27351 | this.todayLineColor = 'calculated';
|
27352 | /* state colors */
|
27353 |
|
27354 | this.labelColor = 'black';
|
27355 | this.errorBkgColor = '#552222';
|
27356 | this.errorTextColor = '#552222';
|
27357 | }
|
27358 |
|
27359 | _createClass(Theme, [{
|
27360 | key: "updateColors",
|
27361 | value: function updateColors() {
|
27362 | this.secondBkg = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.contrast, 55);
|
27363 | this.border2 = this.contrast;
|
27364 | /* Flowchart variables */
|
27365 |
|
27366 | this.nodeBkg = this.mainBkg;
|
27367 | this.nodeBorder = this.border1;
|
27368 | this.clusterBkg = this.secondBkg;
|
27369 | this.clusterBorder = this.border2;
|
27370 | this.defaultLinkColor = this.lineColor;
|
27371 | this.titleColor = this.text;
|
27372 | /* Sequence Diagram variables */
|
27373 |
|
27374 | this.actorBorder = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.border1, 23);
|
27375 | this.actorBkg = this.mainBkg;
|
27376 | this.actorTextColor = this.text;
|
27377 | this.actorLineColor = this.lineColor;
|
27378 | this.signalColor = this.text;
|
27379 | this.signalTextColor = this.text;
|
27380 | this.labelBoxBkgColor = this.actorBkg;
|
27381 | this.labelBoxBorderColor = this.actorBorder;
|
27382 | this.labelTextColor = this.text;
|
27383 | this.loopTextColor = this.text;
|
27384 | this.noteBorderColor = '#999';
|
27385 | this.noteBkgColor = '#666';
|
27386 | this.noteTextColor = '#fff';
|
27387 | /* Gantt chart variables */
|
27388 |
|
27389 | this.sectionBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.contrast, 30);
|
27390 | this.sectionBkgColor2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.contrast, 30);
|
27391 | this.taskBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.contrast, 10);
|
27392 | this.taskBkgColor = this.contrast;
|
27393 | this.taskTextColor = this.taskTextLightColor;
|
27394 | this.taskTextDarkColor = this.text;
|
27395 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
27396 | this.activeTaskBorderColor = this.taskBorderColor;
|
27397 | this.activeTaskBkgColor = this.mainBkg;
|
27398 | this.gridColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.border1, 30);
|
27399 | this.doneTaskBkgColor = this.done;
|
27400 | this.doneTaskBorderColor = this.lineColor;
|
27401 | this.critBkgColor = this.critical;
|
27402 | this.critBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.critBkgColor, 10);
|
27403 | this.todayLineColor = this.critBkgColor;
|
27404 | /* state colors */
|
27405 |
|
27406 | this.transitionColor = this.transitionColor || '#000';
|
27407 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
27408 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
27409 | this.stateBkg = this.stateBkg || this.mainBkg;
|
27410 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
27411 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
27412 | this.altBackground = this.altBackground || '#f4f4f4';
|
27413 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
27414 | this.stateBorder = this.stateBorder || '#000';
|
27415 | this.innerEndBackground = this.primaryBorderColor;
|
27416 | this.specialStateColor = '#222';
|
27417 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
27418 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
27419 | /* class */
|
27420 |
|
27421 | this.classText = this.primaryTextColor;
|
27422 | /* journey */
|
27423 |
|
27424 | this.fillType0 = this.primaryColor;
|
27425 | this.fillType1 = this.secondaryColor;
|
27426 | this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
27427 | h: 64
|
27428 | });
|
27429 | this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
27430 | h: 64
|
27431 | });
|
27432 | this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
27433 | h: -64
|
27434 | });
|
27435 | this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
27436 | h: -64
|
27437 | });
|
27438 | this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
|
27439 | h: 128
|
27440 | });
|
27441 | this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
|
27442 | h: 128
|
27443 | }); // /* pie */
|
27444 |
|
27445 | this.pie1 = this.pie1 || '#F4F4F4';
|
27446 | this.pie2 = this.pie2 || '#555';
|
27447 | this.pie3 = this.pie3 || '#BBB';
|
27448 | this.pie4 = this.pie4 || '#777';
|
27449 | this.pie5 = this.pie5 || '#999';
|
27450 | this.pie6 = this.pie6 || '#DDD';
|
27451 | this.pie7 = this.pie7 || '#FFF';
|
27452 | this.pie8 = this.pie8 || '#DDD';
|
27453 | this.pie9 = this.pie9 || '#BBB';
|
27454 | this.pie10 = this.pie10 || '#999';
|
27455 | this.pie11 = this.pie11 || '#777';
|
27456 | this.pie12 = this.pie12 || '#555';
|
27457 | this.pieTitleTextSize = this.pieTitleTextSize || '25px';
|
27458 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
27459 | this.pieSectionTextSize = this.pieSectionTextSize || '17px';
|
27460 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
27461 | this.pieLegendTextSize = this.pieLegendTextSize || '17px';
|
27462 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
27463 | this.pieStrokeColor = this.pieStrokeColor || 'black';
|
27464 | this.pieStrokeWidth = this.pieStrokeWidth || '2px';
|
27465 | this.pieOpacity = this.pieOpacity || '0.7'; // this.pie1 = this.pie1 || '#212529';
|
27466 | // this.pie2 = this.pie2 || '#343A40';
|
27467 | // this.pie3 = this.pie3 || '#495057';
|
27468 | // this.pie4 = this.pie4 || '#6C757D';
|
27469 | // this.pie5 = this.pie5 || adjust(this.secondaryColor, { l: -10 });
|
27470 | // this.pie6 = this.pie6 || adjust(this.tertiaryColor, { l: -10 });
|
27471 | // this.pie7 = this.pie7 || adjust(this.primaryColor, { h: +60, l: -10 });
|
27472 | // this.pie8 = this.pie8 || adjust(this.primaryColor, { h: -60, l: -10 });
|
27473 | // this.pie9 = this.pie9 || adjust(this.primaryColor, { h: 120, l: 0 });
|
27474 | // this.pie10 = this.pie10 || adjust(this.primaryColor, { h: +60, l: -20 });
|
27475 | // this.pie11 = this.pie11 || adjust(this.primaryColor, { h: -60, l: -20 });
|
27476 | // this.pie12 = this.pie12 || adjust(this.primaryColor, { h: 120, l: -10 });
|
27477 |
|
27478 | /* requirement-diagram */
|
27479 |
|
27480 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
27481 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
27482 | this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
|
27483 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
27484 | this.relationColor = this.relationColor || this.lineColor;
|
27485 | this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
|
27486 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
27487 | }
|
27488 | }, {
|
27489 | key: "calculate",
|
27490 | value: function calculate(overrides) {
|
27491 | var _this = this;
|
27492 |
|
27493 | if (_typeof(overrides) !== 'object') {
|
27494 | // Calculate colors form base colors
|
27495 | this.updateColors();
|
27496 | return;
|
27497 | }
|
27498 |
|
27499 | var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
|
27500 |
|
27501 | keys.forEach(function (k) {
|
27502 | _this[k] = overrides[k];
|
27503 | }); // Calculate colors form base colors
|
27504 |
|
27505 | this.updateColors(); // Copy values from overrides again in case of an override of derived value
|
27506 |
|
27507 | keys.forEach(function (k) {
|
27508 | _this[k] = overrides[k];
|
27509 | });
|
27510 | }
|
27511 | }]);
|
27512 |
|
27513 | return Theme;
|
27514 | }();
|
27515 |
|
27516 | var getThemeVariables = function getThemeVariables(userOverrides) {
|
27517 | var theme = new Theme();
|
27518 | theme.calculate(userOverrides);
|
27519 | return theme;
|
27520 | };
|
27521 |
|
27522 | /***/ }),
|
27523 |
|
27524 | /***/ "./src/utils.js":
|
27525 | /*!**********************!*\
|
27526 | !*** ./src/utils.js ***!
|
27527 | \**********************/
|
27528 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
27529 |
|
27530 | "use strict";
|
27531 | __webpack_require__.r(__webpack_exports__);
|
27532 | /* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
27533 | /* harmony export */ "detectInit": () => (/* binding */ detectInit),
|
27534 | /* harmony export */ "detectDirective": () => (/* binding */ detectDirective),
|
27535 | /* harmony export */ "detectType": () => (/* binding */ detectType),
|
27536 | /* harmony export */ "isSubstringInArray": () => (/* binding */ isSubstringInArray),
|
27537 | /* harmony export */ "interpolateToCurve": () => (/* binding */ interpolateToCurve),
|
27538 | /* harmony export */ "formatUrl": () => (/* binding */ formatUrl),
|
27539 | /* harmony export */ "runFunc": () => (/* binding */ runFunc),
|
27540 | /* harmony export */ "getStylesFromArray": () => (/* binding */ getStylesFromArray),
|
27541 | /* harmony export */ "generateId": () => (/* binding */ generateId),
|
27542 | /* harmony export */ "random": () => (/* binding */ random),
|
27543 | /* harmony export */ "assignWithDepth": () => (/* binding */ assignWithDepth),
|
27544 | /* harmony export */ "getTextObj": () => (/* binding */ getTextObj),
|
27545 | /* harmony export */ "drawSimpleText": () => (/* binding */ drawSimpleText),
|
27546 | /* harmony export */ "wrapLabel": () => (/* binding */ wrapLabel),
|
27547 | /* harmony export */ "calculateTextHeight": () => (/* binding */ calculateTextHeight),
|
27548 | /* harmony export */ "calculateTextWidth": () => (/* binding */ calculateTextWidth),
|
27549 | /* harmony export */ "calculateTextDimensions": () => (/* binding */ calculateTextDimensions),
|
27550 | /* harmony export */ "calculateSvgSizeAttrs": () => (/* binding */ calculateSvgSizeAttrs),
|
27551 | /* harmony export */ "configureSvgSize": () => (/* binding */ configureSvgSize),
|
27552 | /* harmony export */ "initIdGeneratior": () => (/* binding */ initIdGeneratior),
|
27553 | /* harmony export */ "entityDecode": () => (/* binding */ entityDecode),
|
27554 | /* harmony export */ "directiveSanitizer": () => (/* binding */ directiveSanitizer),
|
27555 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
27556 | /* harmony export */ });
|
27557 | /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @braintree/sanitize-url */ "@braintree/sanitize-url");
|
27558 | /* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__);
|
27559 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
|
27560 | /* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
|
27561 | /* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./diagrams/common/common */ "./src/diagrams/common/common.js");
|
27562 | /* harmony import */ var _defaultConfig__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./defaultConfig */ "./src/defaultConfig.js");
|
27563 | /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
|
27564 | var _this = undefined;
|
27565 |
|
27566 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
27567 |
|
27568 | 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); } }
|
27569 |
|
27570 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
27571 |
|
27572 | 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; } } }; }
|
27573 |
|
27574 | function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
27575 |
|
27576 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
27577 |
|
27578 | 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."); }
|
27579 |
|
27580 | 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); }
|
27581 |
|
27582 | function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
27583 |
|
27584 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
27585 |
|
27586 | 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; }
|
27587 |
|
27588 |
|
27589 |
|
27590 |
|
27591 |
|
27592 | // Effectively an enum of the supported curve types, accessible by name
|
27593 |
|
27594 | var d3CurveTypes = {
|
27595 | curveBasis: d3__WEBPACK_IMPORTED_MODULE_1__.curveBasis,
|
27596 | curveBasisClosed: d3__WEBPACK_IMPORTED_MODULE_1__.curveBasisClosed,
|
27597 | curveBasisOpen: d3__WEBPACK_IMPORTED_MODULE_1__.curveBasisOpen,
|
27598 | curveLinear: d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear,
|
27599 | curveLinearClosed: d3__WEBPACK_IMPORTED_MODULE_1__.curveLinearClosed,
|
27600 | curveMonotoneX: d3__WEBPACK_IMPORTED_MODULE_1__.curveMonotoneX,
|
27601 | curveMonotoneY: d3__WEBPACK_IMPORTED_MODULE_1__.curveMonotoneY,
|
27602 | curveNatural: d3__WEBPACK_IMPORTED_MODULE_1__.curveNatural,
|
27603 | curveStep: d3__WEBPACK_IMPORTED_MODULE_1__.curveStep,
|
27604 | curveStepAfter: d3__WEBPACK_IMPORTED_MODULE_1__.curveStepAfter,
|
27605 | curveStepBefore: d3__WEBPACK_IMPORTED_MODULE_1__.curveStepBefore
|
27606 | };
|
27607 | var directive = /[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
|
27608 | var directiveWithoutOpen = /\s*(?:(?:(\w+)(?=:):|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
|
27609 | var anyComment = /\s*%%.*\n/gm;
|
27610 | /**
|
27611 | * @function detectInit
|
27612 | * Detects the init config object from the text
|
27613 | * ```mermaid
|
27614 | * %%{init: {"theme": "debug", "logLevel": 1 }}%%
|
27615 | * graph LR
|
27616 | * a-->b
|
27617 | * b-->c
|
27618 | * c-->d
|
27619 | * d-->e
|
27620 | * e-->f
|
27621 | * f-->g
|
27622 | * g-->h
|
27623 | * ```
|
27624 | * or
|
27625 | * ```mermaid
|
27626 | * %%{initialize: {"theme": "dark", logLevel: "debug" }}%%
|
27627 | * graph LR
|
27628 | * a-->b
|
27629 | * b-->c
|
27630 | * c-->d
|
27631 | * d-->e
|
27632 | * e-->f
|
27633 | * f-->g
|
27634 | * g-->h
|
27635 | * ```
|
27636 | *
|
27637 | * @param {string} text The text defining the graph
|
27638 | * @returns {object} the json object representing the init passed to mermaid.initialize()
|
27639 | */
|
27640 |
|
27641 | var detectInit = function detectInit(text, cnf) {
|
27642 | var inits = detectDirective(text, /(?:init\b)|(?:initialize\b)/);
|
27643 | var results = {};
|
27644 |
|
27645 | if (Array.isArray(inits)) {
|
27646 | var args = inits.map(function (init) {
|
27647 | return init.args;
|
27648 | });
|
27649 | directiveSanitizer(args);
|
27650 | results = assignWithDepth(results, _toConsumableArray(args));
|
27651 | } else {
|
27652 | results = inits.args;
|
27653 | }
|
27654 |
|
27655 | if (results) {
|
27656 | var type = detectType(text, cnf);
|
27657 | ['config'].forEach(function (prop) {
|
27658 | if (typeof results[prop] !== 'undefined') {
|
27659 | if (type === 'flowchart-v2') {
|
27660 | type = 'flowchart';
|
27661 | }
|
27662 |
|
27663 | results[type] = results[prop];
|
27664 | delete results[prop];
|
27665 | }
|
27666 | });
|
27667 | } // Todo: refactor this, these results are never used
|
27668 |
|
27669 |
|
27670 | return results;
|
27671 | };
|
27672 | /**
|
27673 | * @function detectDirective
|
27674 | * Detects the directive from the text. Text can be single line or multiline. If type is null or omitted
|
27675 | * the first directive encountered in text will be returned
|
27676 | * ```mermaid
|
27677 | * graph LR
|
27678 | * %%{somedirective}%%
|
27679 | * a-->b
|
27680 | * b-->c
|
27681 | * c-->d
|
27682 | * d-->e
|
27683 | * e-->f
|
27684 | * f-->g
|
27685 | * g-->h
|
27686 | * ```
|
27687 | *
|
27688 | * @param {string} text The text defining the graph
|
27689 | * @param {string|RegExp} type The directive to return (default: null)
|
27690 | * @returns {object | Array} An object or Array representing the directive(s): { type: string, args: object|null } matched by the input type
|
27691 | * if a single directive was found, that directive object will be returned.
|
27692 | */
|
27693 |
|
27694 | var detectDirective = function detectDirective(text) {
|
27695 | var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
27696 |
|
27697 | try {
|
27698 | var commentWithoutDirectives = new RegExp("[%]{2}(?![{]".concat(directiveWithoutOpen.source, ")(?=[}][%]{2}).*\n"), 'ig');
|
27699 | text = text.trim().replace(commentWithoutDirectives, '').replace(/'/gm, '"');
|
27700 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug("Detecting diagram directive".concat(type !== null ? ' type:' + type : '', " based on the text:").concat(text));
|
27701 | var match,
|
27702 | result = [];
|
27703 |
|
27704 | while ((match = directive.exec(text)) !== null) {
|
27705 | // This is necessary to avoid infinite loops with zero-width matches
|
27706 | if (match.index === directive.lastIndex) {
|
27707 | directive.lastIndex++;
|
27708 | }
|
27709 |
|
27710 | if (match && !type || type && match[1] && match[1].match(type) || type && match[2] && match[2].match(type)) {
|
27711 | var _type = match[1] ? match[1] : match[2];
|
27712 |
|
27713 | var args = match[3] ? match[3].trim() : match[4] ? JSON.parse(match[4].trim()) : null;
|
27714 | result.push({
|
27715 | type: _type,
|
27716 | args: args
|
27717 | });
|
27718 | }
|
27719 | }
|
27720 |
|
27721 | if (result.length === 0) {
|
27722 | result.push({
|
27723 | type: text,
|
27724 | args: null
|
27725 | });
|
27726 | }
|
27727 |
|
27728 | return result.length === 1 ? result[0] : result;
|
27729 | } catch (error) {
|
27730 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.error("ERROR: ".concat(error.message, " - Unable to parse directive\n ").concat(type !== null ? ' type:' + type : '', " based on the text:").concat(text));
|
27731 | return {
|
27732 | type: null,
|
27733 | args: null
|
27734 | };
|
27735 | }
|
27736 | };
|
27737 | /**
|
27738 | * @function detectType
|
27739 | * Detects the type of the graph text. Takes into consideration the possible existence of an %%init
|
27740 | * directive
|
27741 | * ```mermaid
|
27742 | * %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%%
|
27743 | * graph LR
|
27744 | * a-->b
|
27745 | * b-->c
|
27746 | * c-->d
|
27747 | * d-->e
|
27748 | * e-->f
|
27749 | * f-->g
|
27750 | * g-->h
|
27751 | * ```
|
27752 | *
|
27753 | * @param {string} text The text defining the graph
|
27754 | * @returns {string} A graph definition key
|
27755 | */
|
27756 |
|
27757 | var detectType = function detectType(text, cnf) {
|
27758 | text = text.replace(directive, '').replace(anyComment, '\n');
|
27759 |
|
27760 | if (text.match(/^\s*sequenceDiagram/)) {
|
27761 | return 'sequence';
|
27762 | }
|
27763 |
|
27764 | if (text.match(/^\s*gantt/)) {
|
27765 | return 'gantt';
|
27766 | }
|
27767 |
|
27768 | if (text.match(/^\s*classDiagram-v2/)) {
|
27769 | return 'classDiagram';
|
27770 | }
|
27771 |
|
27772 | if (text.match(/^\s*classDiagram/)) {
|
27773 | if (cnf && cnf.class && cnf.class.defaultRenderer === 'dagre-wrapper') return 'classDiagram';
|
27774 | return 'class';
|
27775 | }
|
27776 |
|
27777 | if (text.match(/^\s*stateDiagram-v2/)) {
|
27778 | return 'stateDiagram';
|
27779 | }
|
27780 |
|
27781 | if (text.match(/^\s*stateDiagram/)) {
|
27782 | if (cnf && cnf.class && cnf.state.defaultRenderer === 'dagre-wrapper') return 'stateDiagram';
|
27783 | return 'state';
|
27784 | }
|
27785 |
|
27786 | if (text.match(/^\s*gitGraph/)) {
|
27787 | return 'git';
|
27788 | }
|
27789 |
|
27790 | if (text.match(/^\s*flowchart/)) {
|
27791 | return 'flowchart-v2';
|
27792 | }
|
27793 |
|
27794 | if (text.match(/^\s*info/)) {
|
27795 | return 'info';
|
27796 | }
|
27797 |
|
27798 | if (text.match(/^\s*pie/)) {
|
27799 | return 'pie';
|
27800 | }
|
27801 |
|
27802 | if (text.match(/^\s*erDiagram/)) {
|
27803 | return 'er';
|
27804 | }
|
27805 |
|
27806 | if (text.match(/^\s*journey/)) {
|
27807 | return 'journey';
|
27808 | }
|
27809 |
|
27810 | if (text.match(/^\s*requirement/) || text.match(/^\s*requirementDiagram/)) {
|
27811 | return 'requirement';
|
27812 | }
|
27813 |
|
27814 | if (cnf && cnf.flowchart && cnf.flowchart.defaultRenderer === 'dagre-wrapper') return 'flowchart-v2';
|
27815 | return 'flowchart';
|
27816 | };
|
27817 |
|
27818 | var memoize = function memoize(fn, resolver) {
|
27819 | var cache = {};
|
27820 | return function () {
|
27821 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
27822 | args[_key] = arguments[_key];
|
27823 | }
|
27824 |
|
27825 | var n = resolver ? resolver.apply(_this, args) : args[0];
|
27826 |
|
27827 | if (n in cache) {
|
27828 | return cache[n];
|
27829 | } else {
|
27830 | var result = fn.apply(void 0, args);
|
27831 | cache[n] = result;
|
27832 | return result;
|
27833 | }
|
27834 | };
|
27835 | };
|
27836 | /**
|
27837 | * @function isSubstringInArray
|
27838 | * Detects whether a substring in present in a given array
|
27839 | * @param {string} str The substring to detect
|
27840 | * @param {array} arr The array to search
|
27841 | * @returns {number} the array index containing the substring or -1 if not present
|
27842 | **/
|
27843 |
|
27844 |
|
27845 | var isSubstringInArray = function isSubstringInArray(str, arr) {
|
27846 | for (var i = 0; i < arr.length; i++) {
|
27847 | if (arr[i].match(str)) return i;
|
27848 | }
|
27849 |
|
27850 | return -1;
|
27851 | };
|
27852 | var interpolateToCurve = function interpolateToCurve(interpolate, defaultCurve) {
|
27853 | if (!interpolate) {
|
27854 | return defaultCurve;
|
27855 | }
|
27856 |
|
27857 | var curveName = "curve".concat(interpolate.charAt(0).toUpperCase() + interpolate.slice(1));
|
27858 | return d3CurveTypes[curveName] || defaultCurve;
|
27859 | };
|
27860 | var formatUrl = function formatUrl(linkStr, config) {
|
27861 | var url = linkStr.trim();
|
27862 |
|
27863 | if (url) {
|
27864 | if (config.securityLevel !== 'loose') {
|
27865 | return (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__.sanitizeUrl)(url);
|
27866 | }
|
27867 |
|
27868 | return url;
|
27869 | }
|
27870 | };
|
27871 | var runFunc = function runFunc(functionName) {
|
27872 | var _obj;
|
27873 |
|
27874 | var arrPaths = functionName.split('.');
|
27875 | var len = arrPaths.length - 1;
|
27876 | var fnName = arrPaths[len];
|
27877 | var obj = window;
|
27878 |
|
27879 | for (var i = 0; i < len; i++) {
|
27880 | obj = obj[arrPaths[i]];
|
27881 | if (!obj) return;
|
27882 | }
|
27883 |
|
27884 | for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
27885 | params[_key2 - 1] = arguments[_key2];
|
27886 | }
|
27887 |
|
27888 | (_obj = obj)[fnName].apply(_obj, params);
|
27889 | };
|
27890 |
|
27891 | var distance = function distance(p1, p2) {
|
27892 | return p1 && p2 ? Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)) : 0;
|
27893 | };
|
27894 |
|
27895 | var traverseEdge = function traverseEdge(points) {
|
27896 | var prevPoint;
|
27897 | var totalDistance = 0;
|
27898 | points.forEach(function (point) {
|
27899 | totalDistance += distance(point, prevPoint);
|
27900 | prevPoint = point;
|
27901 | }); // Traverse half of total distance along points
|
27902 |
|
27903 | var remainingDistance = totalDistance / 2;
|
27904 | var center = undefined;
|
27905 | prevPoint = undefined;
|
27906 | points.forEach(function (point) {
|
27907 | if (prevPoint && !center) {
|
27908 | var vectorDistance = distance(point, prevPoint);
|
27909 |
|
27910 | if (vectorDistance < remainingDistance) {
|
27911 | remainingDistance -= vectorDistance;
|
27912 | } else {
|
27913 | // The point is remainingDistance from prevPoint in the vector between prevPoint and point
|
27914 | // Calculate the coordinates
|
27915 | var distanceRatio = remainingDistance / vectorDistance;
|
27916 | if (distanceRatio <= 0) center = prevPoint;
|
27917 | if (distanceRatio >= 1) center = {
|
27918 | x: point.x,
|
27919 | y: point.y
|
27920 | };
|
27921 |
|
27922 | if (distanceRatio > 0 && distanceRatio < 1) {
|
27923 | center = {
|
27924 | x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
|
27925 | y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y
|
27926 | };
|
27927 | }
|
27928 | }
|
27929 | }
|
27930 |
|
27931 | prevPoint = point;
|
27932 | });
|
27933 | return center;
|
27934 | };
|
27935 |
|
27936 | var calcLabelPosition = function calcLabelPosition(points) {
|
27937 | return traverseEdge(points);
|
27938 | };
|
27939 |
|
27940 | var calcCardinalityPosition = function calcCardinalityPosition(isRelationTypePresent, points, initialPosition) {
|
27941 | var prevPoint;
|
27942 | var totalDistance = 0; // eslint-disable-line
|
27943 |
|
27944 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('our points', points);
|
27945 |
|
27946 | if (points[0] !== initialPosition) {
|
27947 | points = points.reverse();
|
27948 | }
|
27949 |
|
27950 | points.forEach(function (point) {
|
27951 | totalDistance += distance(point, prevPoint);
|
27952 | prevPoint = point;
|
27953 | }); // Traverse only 25 total distance along points to find cardinality point
|
27954 |
|
27955 | var distanceToCardinalityPoint = 25;
|
27956 | var remainingDistance = distanceToCardinalityPoint;
|
27957 | var center;
|
27958 | prevPoint = undefined;
|
27959 | points.forEach(function (point) {
|
27960 | if (prevPoint && !center) {
|
27961 | var vectorDistance = distance(point, prevPoint);
|
27962 |
|
27963 | if (vectorDistance < remainingDistance) {
|
27964 | remainingDistance -= vectorDistance;
|
27965 | } else {
|
27966 | // The point is remainingDistance from prevPoint in the vector between prevPoint and point
|
27967 | // Calculate the coordinates
|
27968 | var distanceRatio = remainingDistance / vectorDistance;
|
27969 | if (distanceRatio <= 0) center = prevPoint;
|
27970 | if (distanceRatio >= 1) center = {
|
27971 | x: point.x,
|
27972 | y: point.y
|
27973 | };
|
27974 |
|
27975 | if (distanceRatio > 0 && distanceRatio < 1) {
|
27976 | center = {
|
27977 | x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
|
27978 | y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y
|
27979 | };
|
27980 | }
|
27981 | }
|
27982 | }
|
27983 |
|
27984 | prevPoint = point;
|
27985 | }); // if relation is present (Arrows will be added), change cardinality point off-set distance (d)
|
27986 |
|
27987 | var d = isRelationTypePresent ? 10 : 5; //Calculate Angle for x and y axis
|
27988 |
|
27989 | var angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
|
27990 | var cardinalityPosition = {
|
27991 | x: 0,
|
27992 | y: 0
|
27993 | }; //Calculation cardinality position using angle, center point on the line/curve but pendicular and with offset-distance
|
27994 |
|
27995 | cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
|
27996 | cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
|
27997 | return cardinalityPosition;
|
27998 | };
|
27999 | /**
|
28000 | * position ['start_left', 'start_right', 'end_left', 'end_right']
|
28001 | */
|
28002 |
|
28003 |
|
28004 | var calcTerminalLabelPosition = function calcTerminalLabelPosition(terminalMarkerSize, position, _points) {
|
28005 | // Todo looking to faster cloning method
|
28006 | var points = JSON.parse(JSON.stringify(_points));
|
28007 | var prevPoint;
|
28008 | var totalDistance = 0; // eslint-disable-line
|
28009 |
|
28010 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('our points', points);
|
28011 |
|
28012 | if (position !== 'start_left' && position !== 'start_right') {
|
28013 | points = points.reverse();
|
28014 | }
|
28015 |
|
28016 | points.forEach(function (point) {
|
28017 | totalDistance += distance(point, prevPoint);
|
28018 | prevPoint = point;
|
28019 | }); // Traverse only 25 total distance along points to find cardinality point
|
28020 |
|
28021 | var distanceToCardinalityPoint = 25 + terminalMarkerSize;
|
28022 | var remainingDistance = distanceToCardinalityPoint;
|
28023 | var center;
|
28024 | prevPoint = undefined;
|
28025 | points.forEach(function (point) {
|
28026 | if (prevPoint && !center) {
|
28027 | var vectorDistance = distance(point, prevPoint);
|
28028 |
|
28029 | if (vectorDistance < remainingDistance) {
|
28030 | remainingDistance -= vectorDistance;
|
28031 | } else {
|
28032 | // The point is remainingDistance from prevPoint in the vector between prevPoint and point
|
28033 | // Calculate the coordinates
|
28034 | var distanceRatio = remainingDistance / vectorDistance;
|
28035 | if (distanceRatio <= 0) center = prevPoint;
|
28036 | if (distanceRatio >= 1) center = {
|
28037 | x: point.x,
|
28038 | y: point.y
|
28039 | };
|
28040 |
|
28041 | if (distanceRatio > 0 && distanceRatio < 1) {
|
28042 | center = {
|
28043 | x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
|
28044 | y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y
|
28045 | };
|
28046 | }
|
28047 | }
|
28048 | }
|
28049 |
|
28050 | prevPoint = point;
|
28051 | }); // if relation is present (Arrows will be added), change cardinality point off-set distance (d)
|
28052 |
|
28053 | var d = 10 + terminalMarkerSize * 0.5; //Calculate Angle for x and y axis
|
28054 |
|
28055 | var angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
|
28056 | var cardinalityPosition = {
|
28057 | x: 0,
|
28058 | y: 0
|
28059 | }; //Calculation cardinality position using angle, center point on the line/curve but pendicular and with offset-distance
|
28060 |
|
28061 | cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
|
28062 | cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
|
28063 |
|
28064 | if (position === 'start_left') {
|
28065 | cardinalityPosition.x = Math.sin(angle + Math.PI) * d + (points[0].x + center.x) / 2;
|
28066 | cardinalityPosition.y = -Math.cos(angle + Math.PI) * d + (points[0].y + center.y) / 2;
|
28067 | }
|
28068 |
|
28069 | if (position === 'end_right') {
|
28070 | cardinalityPosition.x = Math.sin(angle - Math.PI) * d + (points[0].x + center.x) / 2 - 5;
|
28071 | cardinalityPosition.y = -Math.cos(angle - Math.PI) * d + (points[0].y + center.y) / 2 - 5;
|
28072 | }
|
28073 |
|
28074 | if (position === 'end_left') {
|
28075 | cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2 - 5;
|
28076 | cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2 - 5;
|
28077 | }
|
28078 |
|
28079 | return cardinalityPosition;
|
28080 | };
|
28081 |
|
28082 | var getStylesFromArray = function getStylesFromArray(arr) {
|
28083 | var style = '';
|
28084 | var labelStyle = '';
|
28085 |
|
28086 | for (var i = 0; i < arr.length; i++) {
|
28087 | if (typeof arr[i] !== 'undefined') {
|
28088 | // add text properties to label style definition
|
28089 | if (arr[i].startsWith('color:') || arr[i].startsWith('text-align:')) {
|
28090 | labelStyle = labelStyle + arr[i] + ';';
|
28091 | } else {
|
28092 | style = style + arr[i] + ';';
|
28093 | }
|
28094 | }
|
28095 | }
|
28096 |
|
28097 | return {
|
28098 | style: style,
|
28099 | labelStyle: labelStyle
|
28100 | };
|
28101 | };
|
28102 | var cnt = 0;
|
28103 | var generateId = function generateId() {
|
28104 | cnt++;
|
28105 | return 'id-' + Math.random().toString(36).substr(2, 12) + '-' + cnt;
|
28106 | };
|
28107 |
|
28108 | function makeid(length) {
|
28109 | var result = '';
|
28110 | var characters = '0123456789abcdef';
|
28111 | var charactersLength = characters.length;
|
28112 |
|
28113 | for (var i = 0; i < length; i++) {
|
28114 | result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
28115 | }
|
28116 |
|
28117 | return result;
|
28118 | }
|
28119 |
|
28120 | var random = function random(options) {
|
28121 | return makeid(options.length);
|
28122 | };
|
28123 | /**
|
28124 | * @function assignWithDepth
|
28125 | * Extends the functionality of {@link ObjectConstructor.assign} with the ability to merge arbitrary-depth objects
|
28126 | * For each key in src with path `k` (recursively) performs an Object.assign(dst[`k`], src[`k`]) with
|
28127 | * a slight change from the typical handling of undefined for dst[`k`]: instead of raising an error,
|
28128 | * dst[`k`] is auto-initialized to {} and effectively merged with src[`k`]
|
28129 | * <p>
|
28130 | * Additionally, dissimilar types will not clobber unless the config.clobber parameter === true. Example:
|
28131 | * ```
|
28132 | * let config_0 = { foo: { bar: 'bar' }, bar: 'foo' };
|
28133 | * let config_1 = { foo: 'foo', bar: 'bar' };
|
28134 | * let result = assignWithDepth(config_0, config_1);
|
28135 | * console.log(result);
|
28136 | * //-> result: { foo: { bar: 'bar' }, bar: 'bar' }
|
28137 | * ```
|
28138 | * <p>
|
28139 | * Traditional Object.assign would have clobbered foo in config_0 with foo in config_1.
|
28140 | * <p>
|
28141 | * If src is a destructured array of objects and dst is not an array, assignWithDepth will apply each element of src to dst
|
28142 | * in order.
|
28143 | * @param dst:any - the destination of the merge
|
28144 | * @param src:any - the source object(s) to merge into destination
|
28145 | * @param config:{ depth: number, clobber: boolean } - depth: depth to traverse within src and dst for merging -
|
28146 | * clobber: should dissimilar types clobber (default: { depth: 2, clobber: false })
|
28147 | * @returns {*}
|
28148 | */
|
28149 |
|
28150 | var assignWithDepth = function assignWithDepth(dst, src, config) {
|
28151 | var _Object$assign = Object.assign({
|
28152 | depth: 2,
|
28153 | clobber: false
|
28154 | }, config),
|
28155 | depth = _Object$assign.depth,
|
28156 | clobber = _Object$assign.clobber;
|
28157 |
|
28158 | if (Array.isArray(src) && !Array.isArray(dst)) {
|
28159 | src.forEach(function (s) {
|
28160 | return assignWithDepth(dst, s, config);
|
28161 | });
|
28162 | return dst;
|
28163 | } else if (Array.isArray(src) && Array.isArray(dst)) {
|
28164 | src.forEach(function (s) {
|
28165 | if (dst.indexOf(s) === -1) {
|
28166 | dst.push(s);
|
28167 | }
|
28168 | });
|
28169 | return dst;
|
28170 | }
|
28171 |
|
28172 | if (typeof dst === 'undefined' || depth <= 0) {
|
28173 | if (dst !== undefined && dst !== null && _typeof(dst) === 'object' && _typeof(src) === 'object') {
|
28174 | return Object.assign(dst, src);
|
28175 | } else {
|
28176 | return src;
|
28177 | }
|
28178 | }
|
28179 |
|
28180 | if (typeof src !== 'undefined' && _typeof(dst) === 'object' && _typeof(src) === 'object') {
|
28181 | Object.keys(src).forEach(function (key) {
|
28182 | if (_typeof(src[key]) === 'object' && (dst[key] === undefined || _typeof(dst[key]) === 'object')) {
|
28183 | if (dst[key] === undefined) {
|
28184 | dst[key] = Array.isArray(src[key]) ? [] : {};
|
28185 | }
|
28186 |
|
28187 | dst[key] = assignWithDepth(dst[key], src[key], {
|
28188 | depth: depth - 1,
|
28189 | clobber: clobber
|
28190 | });
|
28191 | } else if (clobber || _typeof(dst[key]) !== 'object' && _typeof(src[key]) !== 'object') {
|
28192 | dst[key] = src[key];
|
28193 | }
|
28194 | });
|
28195 | }
|
28196 |
|
28197 | return dst;
|
28198 | };
|
28199 | var getTextObj = function getTextObj() {
|
28200 | return {
|
28201 | x: 0,
|
28202 | y: 0,
|
28203 | fill: undefined,
|
28204 | anchor: 'start',
|
28205 | style: '#666',
|
28206 | width: 100,
|
28207 | height: 100,
|
28208 | textMargin: 0,
|
28209 | rx: 0,
|
28210 | ry: 0,
|
28211 | valign: undefined
|
28212 | };
|
28213 | };
|
28214 | var drawSimpleText = function drawSimpleText(elem, textData) {
|
28215 | // Remove and ignore br:s
|
28216 | var nText = textData.text.replace(_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex, ' ');
|
28217 | var textElem = elem.append('text');
|
28218 | textElem.attr('x', textData.x);
|
28219 | textElem.attr('y', textData.y);
|
28220 | textElem.style('text-anchor', textData.anchor);
|
28221 | textElem.style('font-family', textData.fontFamily);
|
28222 | textElem.style('font-size', textData.fontSize);
|
28223 | textElem.style('font-weight', textData.fontWeight);
|
28224 | textElem.attr('fill', textData.fill);
|
28225 |
|
28226 | if (typeof textData.class !== 'undefined') {
|
28227 | textElem.attr('class', textData.class);
|
28228 | }
|
28229 |
|
28230 | var span = textElem.append('tspan');
|
28231 | span.attr('x', textData.x + textData.textMargin * 2);
|
28232 | span.attr('fill', textData.fill);
|
28233 | span.text(nText);
|
28234 | return textElem;
|
28235 | };
|
28236 | var wrapLabel = memoize(function (label, maxWidth, config) {
|
28237 | if (!label) {
|
28238 | return label;
|
28239 | }
|
28240 |
|
28241 | config = Object.assign({
|
28242 | fontSize: 12,
|
28243 | fontWeight: 400,
|
28244 | fontFamily: 'Arial',
|
28245 | joinWith: '<br/>'
|
28246 | }, config);
|
28247 |
|
28248 | if (_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex.test(label)) {
|
28249 | return label;
|
28250 | }
|
28251 |
|
28252 | var words = label.split(' ');
|
28253 | var completedLines = [];
|
28254 | var nextLine = '';
|
28255 | words.forEach(function (word, index) {
|
28256 | var wordLength = calculateTextWidth("".concat(word, " "), config);
|
28257 | var nextLineLength = calculateTextWidth(nextLine, config);
|
28258 |
|
28259 | if (wordLength > maxWidth) {
|
28260 | var _breakString = breakString(word, maxWidth, '-', config),
|
28261 | hyphenatedStrings = _breakString.hyphenatedStrings,
|
28262 | remainingWord = _breakString.remainingWord;
|
28263 |
|
28264 | completedLines.push.apply(completedLines, [nextLine].concat(_toConsumableArray(hyphenatedStrings)));
|
28265 | nextLine = remainingWord;
|
28266 | } else if (nextLineLength + wordLength >= maxWidth) {
|
28267 | completedLines.push(nextLine);
|
28268 | nextLine = word;
|
28269 | } else {
|
28270 | nextLine = [nextLine, word].filter(Boolean).join(' ');
|
28271 | }
|
28272 |
|
28273 | var currentWord = index + 1;
|
28274 | var isLastWord = currentWord === words.length;
|
28275 |
|
28276 | if (isLastWord) {
|
28277 | completedLines.push(nextLine);
|
28278 | }
|
28279 | });
|
28280 | return completedLines.filter(function (line) {
|
28281 | return line !== '';
|
28282 | }).join(config.joinWith);
|
28283 | }, function (label, maxWidth, config) {
|
28284 | return "".concat(label, "-").concat(maxWidth, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily, "-").concat(config.joinWith);
|
28285 | });
|
28286 | var breakString = memoize(function (word, maxWidth) {
|
28287 | var hyphenCharacter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '-';
|
28288 | var config = arguments.length > 3 ? arguments[3] : undefined;
|
28289 | config = Object.assign({
|
28290 | fontSize: 12,
|
28291 | fontWeight: 400,
|
28292 | fontFamily: 'Arial',
|
28293 | margin: 0
|
28294 | }, config);
|
28295 | var characters = word.split('');
|
28296 | var lines = [];
|
28297 | var currentLine = '';
|
28298 | characters.forEach(function (character, index) {
|
28299 | var nextLine = "".concat(currentLine).concat(character);
|
28300 | var lineWidth = calculateTextWidth(nextLine, config);
|
28301 |
|
28302 | if (lineWidth >= maxWidth) {
|
28303 | var currentCharacter = index + 1;
|
28304 | var isLastLine = characters.length === currentCharacter;
|
28305 | var hyphenatedNextLine = "".concat(nextLine).concat(hyphenCharacter);
|
28306 | lines.push(isLastLine ? nextLine : hyphenatedNextLine);
|
28307 | currentLine = '';
|
28308 | } else {
|
28309 | currentLine = nextLine;
|
28310 | }
|
28311 | });
|
28312 | return {
|
28313 | hyphenatedStrings: lines,
|
28314 | remainingWord: currentLine
|
28315 | };
|
28316 | }, function (word, maxWidth) {
|
28317 | var hyphenCharacter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '-';
|
28318 | var config = arguments.length > 3 ? arguments[3] : undefined;
|
28319 | return "".concat(word, "-").concat(maxWidth, "-").concat(hyphenCharacter, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily);
|
28320 | });
|
28321 | /**
|
28322 | * This calculates the text's height, taking into account the wrap breaks and
|
28323 | * both the statically configured height, width, and the length of the text (in pixels).
|
28324 | *
|
28325 | * If the wrapped text text has greater height, we extend the height, so it's
|
28326 | * value won't overflow.
|
28327 | *
|
28328 | * @return - The height for the given text
|
28329 | * @param text the text to measure
|
28330 | * @param config - the config for fontSize, fontFamily, and fontWeight all impacting the resulting size
|
28331 | */
|
28332 |
|
28333 | var calculateTextHeight = function calculateTextHeight(text, config) {
|
28334 | config = Object.assign({
|
28335 | fontSize: 12,
|
28336 | fontWeight: 400,
|
28337 | fontFamily: 'Arial',
|
28338 | margin: 15
|
28339 | }, config);
|
28340 | return calculateTextDimensions(text, config).height;
|
28341 | };
|
28342 | /**
|
28343 | * This calculates the width of the given text, font size and family.
|
28344 | *
|
28345 | * @return - The width for the given text
|
28346 | * @param text - The text to calculate the width of
|
28347 | * @param config - the config for fontSize, fontFamily, and fontWeight all impacting the resulting size
|
28348 | */
|
28349 |
|
28350 | var calculateTextWidth = function calculateTextWidth(text, config) {
|
28351 | config = Object.assign({
|
28352 | fontSize: 12,
|
28353 | fontWeight: 400,
|
28354 | fontFamily: 'Arial'
|
28355 | }, config);
|
28356 | return calculateTextDimensions(text, config).width;
|
28357 | };
|
28358 | /**
|
28359 | * This calculates the dimensions of the given text, font size, font family, font weight, and margins.
|
28360 | *
|
28361 | * @return - The width for the given text
|
28362 | * @param text - The text to calculate the width of
|
28363 | * @param config - the config for fontSize, fontFamily, fontWeight, and margin all impacting the resulting size
|
28364 | */
|
28365 |
|
28366 | var calculateTextDimensions = memoize(function (text, config) {
|
28367 | config = Object.assign({
|
28368 | fontSize: 12,
|
28369 | fontWeight: 400,
|
28370 | fontFamily: 'Arial'
|
28371 | }, config);
|
28372 | var _config = config,
|
28373 | fontSize = _config.fontSize,
|
28374 | fontFamily = _config.fontFamily,
|
28375 | fontWeight = _config.fontWeight;
|
28376 |
|
28377 | if (!text) {
|
28378 | return {
|
28379 | width: 0,
|
28380 | height: 0
|
28381 | };
|
28382 | } // We can't really know if the user supplied font family will render on the user agent;
|
28383 | // thus, we'll take the max width between the user supplied font family, and a default
|
28384 | // of sans-serif.
|
28385 |
|
28386 |
|
28387 | var fontFamilies = ['sans-serif', fontFamily];
|
28388 | var lines = text.split(_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex);
|
28389 | var dims = [];
|
28390 | 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
|
28391 | // for any reason, do not continue.
|
28392 |
|
28393 | if (!body.remove) {
|
28394 | return {
|
28395 | width: 0,
|
28396 | height: 0,
|
28397 | lineHeight: 0
|
28398 | };
|
28399 | }
|
28400 |
|
28401 | var g = body.append('svg');
|
28402 |
|
28403 | for (var _i = 0, _fontFamilies = fontFamilies; _i < _fontFamilies.length; _i++) {
|
28404 | var _fontFamily = _fontFamilies[_i];
|
28405 | var cheight = 0;
|
28406 | var dim = {
|
28407 | width: 0,
|
28408 | height: 0,
|
28409 | lineHeight: 0
|
28410 | };
|
28411 |
|
28412 | var _iterator = _createForOfIteratorHelper(lines),
|
28413 | _step;
|
28414 |
|
28415 | try {
|
28416 | for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
28417 | var line = _step.value;
|
28418 | var textObj = getTextObj();
|
28419 | textObj.text = line;
|
28420 | var textElem = drawSimpleText(g, textObj).style('font-size', fontSize).style('font-weight', fontWeight).style('font-family', _fontFamily);
|
28421 | var bBox = (textElem._groups || textElem)[0][0].getBBox();
|
28422 | dim.width = Math.round(Math.max(dim.width, bBox.width));
|
28423 | cheight = Math.round(bBox.height);
|
28424 | dim.height += cheight;
|
28425 | dim.lineHeight = Math.round(Math.max(dim.lineHeight, cheight));
|
28426 | }
|
28427 | } catch (err) {
|
28428 | _iterator.e(err);
|
28429 | } finally {
|
28430 | _iterator.f();
|
28431 | }
|
28432 |
|
28433 | dims.push(dim);
|
28434 | }
|
28435 |
|
28436 | g.remove();
|
28437 | 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;
|
28438 | return dims[index];
|
28439 | }, function (text, config) {
|
28440 | return "".concat(text, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily);
|
28441 | });
|
28442 |
|
28443 | var d3Attrs = function d3Attrs(d3Elem, attrs) {
|
28444 | var _iterator2 = _createForOfIteratorHelper(attrs),
|
28445 | _step2;
|
28446 |
|
28447 | try {
|
28448 | for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
28449 | var attr = _step2.value;
|
28450 | d3Elem.attr(attr[0], attr[1]);
|
28451 | }
|
28452 | } catch (err) {
|
28453 | _iterator2.e(err);
|
28454 | } finally {
|
28455 | _iterator2.f();
|
28456 | }
|
28457 | };
|
28458 |
|
28459 | var calculateSvgSizeAttrs = function calculateSvgSizeAttrs(height, width, useMaxWidth) {
|
28460 | var attrs = new Map();
|
28461 | attrs.set('height', height);
|
28462 |
|
28463 | if (useMaxWidth) {
|
28464 | attrs.set('width', '100%');
|
28465 | attrs.set('style', "max-width: ".concat(width, "px;"));
|
28466 | } else {
|
28467 | attrs.set('width', width);
|
28468 | }
|
28469 |
|
28470 | return attrs;
|
28471 | };
|
28472 | var configureSvgSize = function configureSvgSize(svgElem, height, width, useMaxWidth) {
|
28473 | var attrs = calculateSvgSizeAttrs(height, width, useMaxWidth);
|
28474 | d3Attrs(svgElem, attrs);
|
28475 | };
|
28476 | var initIdGeneratior = /*#__PURE__*/function () {
|
28477 | function iterator(deterministic, seed) {
|
28478 | _classCallCheck(this, iterator);
|
28479 |
|
28480 | this.deterministic = deterministic;
|
28481 | this.seed = seed;
|
28482 | this.count = seed ? seed.length : 0;
|
28483 | }
|
28484 |
|
28485 | _createClass(iterator, [{
|
28486 | key: "next",
|
28487 | value: function next() {
|
28488 | if (!this.deterministic) return Date.now();
|
28489 | return this.count++;
|
28490 | }
|
28491 | }]);
|
28492 |
|
28493 | return iterator;
|
28494 | }(); // Source https://github.com/shrpne/entity-decode/blob/master/browser.js
|
28495 |
|
28496 | var decoder;
|
28497 | var entityDecode = function entityDecode(html) {
|
28498 | decoder = decoder || document.createElement('div'); // Escape HTML before decoding for HTML Entities
|
28499 |
|
28500 | html = escape(html).replace(/%26/g, '&').replace(/%23/g, '#').replace(/%3B/g, ';'); // decoding
|
28501 |
|
28502 | decoder.innerHTML = html;
|
28503 | return unescape(decoder.textContent);
|
28504 | };
|
28505 | var directiveSanitizer = function directiveSanitizer(args) {
|
28506 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('directiveSanitizer called with', args);
|
28507 |
|
28508 | if (_typeof(args) === 'object') {
|
28509 | // check for array
|
28510 | if (args.length) {
|
28511 | args.forEach(function (arg) {
|
28512 | return directiveSanitizer(arg);
|
28513 | });
|
28514 | } else {
|
28515 | // This is an object
|
28516 | Object.keys(args).forEach(function (key) {
|
28517 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('Checking key', key);
|
28518 |
|
28519 | if (key.indexOf('__') === 0) {
|
28520 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting __ option', key);
|
28521 | delete args[key];
|
28522 | }
|
28523 |
|
28524 | if (key.indexOf('proto') >= 0) {
|
28525 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting proto option', key);
|
28526 | delete args[key];
|
28527 | }
|
28528 |
|
28529 | if (key.indexOf('constr') >= 0) {
|
28530 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting constr option', key);
|
28531 | delete args[key];
|
28532 | }
|
28533 |
|
28534 | if (_defaultConfig__WEBPACK_IMPORTED_MODULE_4__.configKeys.indexOf(key) < 0) {
|
28535 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting option', key);
|
28536 | delete args[key];
|
28537 | } else {
|
28538 | if (_typeof(args[key]) === 'object') {
|
28539 | _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting object', key);
|
28540 | directiveSanitizer(args[key]);
|
28541 | }
|
28542 | }
|
28543 | });
|
28544 | }
|
28545 | }
|
28546 | };
|
28547 | /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
28548 | assignWithDepth: assignWithDepth,
|
28549 | wrapLabel: wrapLabel,
|
28550 | calculateTextHeight: calculateTextHeight,
|
28551 | calculateTextWidth: calculateTextWidth,
|
28552 | calculateTextDimensions: calculateTextDimensions,
|
28553 | calculateSvgSizeAttrs: calculateSvgSizeAttrs,
|
28554 | configureSvgSize: configureSvgSize,
|
28555 | detectInit: detectInit,
|
28556 | detectDirective: detectDirective,
|
28557 | detectType: detectType,
|
28558 | isSubstringInArray: isSubstringInArray,
|
28559 | interpolateToCurve: interpolateToCurve,
|
28560 | calcLabelPosition: calcLabelPosition,
|
28561 | calcCardinalityPosition: calcCardinalityPosition,
|
28562 | calcTerminalLabelPosition: calcTerminalLabelPosition,
|
28563 | formatUrl: formatUrl,
|
28564 | getStylesFromArray: getStylesFromArray,
|
28565 | generateId: generateId,
|
28566 | random: random,
|
28567 | memoize: memoize,
|
28568 | runFunc: runFunc,
|
28569 | entityDecode: entityDecode,
|
28570 | initIdGeneratior: initIdGeneratior,
|
28571 | directiveSanitizer: directiveSanitizer
|
28572 | });
|
28573 |
|
28574 | /***/ }),
|
28575 |
|
28576 | /***/ "./node_modules/path-browserify/index.js":
|
28577 | /*!***********************************************!*\
|
28578 | !*** ./node_modules/path-browserify/index.js ***!
|
28579 | \***********************************************/
|
28580 | /***/ ((module) => {
|
28581 |
|
28582 | "use strict";
|
28583 | // 'path' module extracted from Node.js v8.11.1 (only the posix part)
|
28584 | // transplited with Babel
|
28585 |
|
28586 | // Copyright Joyent, Inc. and other Node contributors.
|
28587 | //
|
28588 | // Permission is hereby granted, free of charge, to any person obtaining a
|
28589 | // copy of this software and associated documentation files (the
|
28590 | // "Software"), to deal in the Software without restriction, including
|
28591 | // without limitation the rights to use, copy, modify, merge, publish,
|
28592 | // distribute, sublicense, and/or sell copies of the Software, and to permit
|
28593 | // persons to whom the Software is furnished to do so, subject to the
|
28594 | // following conditions:
|
28595 | //
|
28596 | // The above copyright notice and this permission notice shall be included
|
28597 | // in all copies or substantial portions of the Software.
|
28598 | //
|
28599 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
28600 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
28601 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
28602 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
28603 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
28604 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
28605 | // USE OR OTHER DEALINGS IN THE SOFTWARE.
|
28606 |
|
28607 |
|
28608 |
|
28609 | function assertPath(path) {
|
28610 | if (typeof path !== 'string') {
|
28611 | throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));
|
28612 | }
|
28613 | }
|
28614 |
|
28615 | // Resolves . and .. elements in a path with directory names
|
28616 | function normalizeStringPosix(path, allowAboveRoot) {
|
28617 | var res = '';
|
28618 | var lastSegmentLength = 0;
|
28619 | var lastSlash = -1;
|
28620 | var dots = 0;
|
28621 | var code;
|
28622 | for (var i = 0; i <= path.length; ++i) {
|
28623 | if (i < path.length)
|
28624 | code = path.charCodeAt(i);
|
28625 | else if (code === 47 /*/*/)
|
28626 | break;
|
28627 | else
|
28628 | code = 47 /*/*/;
|
28629 | if (code === 47 /*/*/) {
|
28630 | if (lastSlash === i - 1 || dots === 1) {
|
28631 | // NOOP
|
28632 | } else if (lastSlash !== i - 1 && dots === 2) {
|
28633 | if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {
|
28634 | if (res.length > 2) {
|
28635 | var lastSlashIndex = res.lastIndexOf('/');
|
28636 | if (lastSlashIndex !== res.length - 1) {
|
28637 | if (lastSlashIndex === -1) {
|
28638 | res = '';
|
28639 | lastSegmentLength = 0;
|
28640 | } else {
|
28641 | res = res.slice(0, lastSlashIndex);
|
28642 | lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
|
28643 | }
|
28644 | lastSlash = i;
|
28645 | dots = 0;
|
28646 | continue;
|
28647 | }
|
28648 | } else if (res.length === 2 || res.length === 1) {
|
28649 | res = '';
|
28650 | lastSegmentLength = 0;
|
28651 | lastSlash = i;
|
28652 | dots = 0;
|
28653 | continue;
|
28654 | }
|
28655 | }
|
28656 | if (allowAboveRoot) {
|
28657 | if (res.length > 0)
|
28658 | res += '/..';
|
28659 | else
|
28660 | res = '..';
|
28661 | lastSegmentLength = 2;
|
28662 | }
|
28663 | } else {
|
28664 | if (res.length > 0)
|
28665 | res += '/' + path.slice(lastSlash + 1, i);
|
28666 | else
|
28667 | res = path.slice(lastSlash + 1, i);
|
28668 | lastSegmentLength = i - lastSlash - 1;
|
28669 | }
|
28670 | lastSlash = i;
|
28671 | dots = 0;
|
28672 | } else if (code === 46 /*.*/ && dots !== -1) {
|
28673 | ++dots;
|
28674 | } else {
|
28675 | dots = -1;
|
28676 | }
|
28677 | }
|
28678 | return res;
|
28679 | }
|
28680 |
|
28681 | function _format(sep, pathObject) {
|
28682 | var dir = pathObject.dir || pathObject.root;
|
28683 | var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');
|
28684 | if (!dir) {
|
28685 | return base;
|
28686 | }
|
28687 | if (dir === pathObject.root) {
|
28688 | return dir + base;
|
28689 | }
|
28690 | return dir + sep + base;
|
28691 | }
|
28692 |
|
28693 | var posix = {
|
28694 | // path.resolve([from ...], to)
|
28695 | resolve: function resolve() {
|
28696 | var resolvedPath = '';
|
28697 | var resolvedAbsolute = false;
|
28698 | var cwd;
|
28699 |
|
28700 | for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
28701 | var path;
|
28702 | if (i >= 0)
|
28703 | path = arguments[i];
|
28704 | else {
|
28705 | if (cwd === undefined)
|
28706 | cwd = process.cwd();
|
28707 | path = cwd;
|
28708 | }
|
28709 |
|
28710 | assertPath(path);
|
28711 |
|
28712 | // Skip empty entries
|
28713 | if (path.length === 0) {
|
28714 | continue;
|
28715 | }
|
28716 |
|
28717 | resolvedPath = path + '/' + resolvedPath;
|
28718 | resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;
|
28719 | }
|
28720 |
|
28721 | // At this point the path should be resolved to a full absolute path, but
|
28722 | // handle relative paths to be safe (might happen when process.cwd() fails)
|
28723 |
|
28724 | // Normalize the path
|
28725 | resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
|
28726 |
|
28727 | if (resolvedAbsolute) {
|
28728 | if (resolvedPath.length > 0)
|
28729 | return '/' + resolvedPath;
|
28730 | else
|
28731 | return '/';
|
28732 | } else if (resolvedPath.length > 0) {
|
28733 | return resolvedPath;
|
28734 | } else {
|
28735 | return '.';
|
28736 | }
|
28737 | },
|
28738 |
|
28739 | normalize: function normalize(path) {
|
28740 | assertPath(path);
|
28741 |
|
28742 | if (path.length === 0) return '.';
|
28743 |
|
28744 | var isAbsolute = path.charCodeAt(0) === 47 /*/*/;
|
28745 | var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;
|
28746 |
|
28747 | // Normalize the path
|
28748 | path = normalizeStringPosix(path, !isAbsolute);
|
28749 |
|
28750 | if (path.length === 0 && !isAbsolute) path = '.';
|
28751 | if (path.length > 0 && trailingSeparator) path += '/';
|
28752 |
|
28753 | if (isAbsolute) return '/' + path;
|
28754 | return path;
|
28755 | },
|
28756 |
|
28757 | isAbsolute: function isAbsolute(path) {
|
28758 | assertPath(path);
|
28759 | return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;
|
28760 | },
|
28761 |
|
28762 | join: function join() {
|
28763 | if (arguments.length === 0)
|
28764 | return '.';
|
28765 | var joined;
|
28766 | for (var i = 0; i < arguments.length; ++i) {
|
28767 | var arg = arguments[i];
|
28768 | assertPath(arg);
|
28769 | if (arg.length > 0) {
|
28770 | if (joined === undefined)
|
28771 | joined = arg;
|
28772 | else
|
28773 | joined += '/' + arg;
|
28774 | }
|
28775 | }
|
28776 | if (joined === undefined)
|
28777 | return '.';
|
28778 | return posix.normalize(joined);
|
28779 | },
|
28780 |
|
28781 | relative: function relative(from, to) {
|
28782 | assertPath(from);
|
28783 | assertPath(to);
|
28784 |
|
28785 | if (from === to) return '';
|
28786 |
|
28787 | from = posix.resolve(from);
|
28788 | to = posix.resolve(to);
|
28789 |
|
28790 | if (from === to) return '';
|
28791 |
|
28792 | // Trim any leading backslashes
|
28793 | var fromStart = 1;
|
28794 | for (; fromStart < from.length; ++fromStart) {
|
28795 | if (from.charCodeAt(fromStart) !== 47 /*/*/)
|
28796 | break;
|
28797 | }
|
28798 | var fromEnd = from.length;
|
28799 | var fromLen = fromEnd - fromStart;
|
28800 |
|
28801 | // Trim any leading backslashes
|
28802 | var toStart = 1;
|
28803 | for (; toStart < to.length; ++toStart) {
|
28804 | if (to.charCodeAt(toStart) !== 47 /*/*/)
|
28805 | break;
|
28806 | }
|
28807 | var toEnd = to.length;
|
28808 | var toLen = toEnd - toStart;
|
28809 |
|
28810 | // Compare paths to find the longest common path from root
|
28811 | var length = fromLen < toLen ? fromLen : toLen;
|
28812 | var lastCommonSep = -1;
|
28813 | var i = 0;
|
28814 | for (; i <= length; ++i) {
|
28815 | if (i === length) {
|
28816 | if (toLen > length) {
|
28817 | if (to.charCodeAt(toStart + i) === 47 /*/*/) {
|
28818 | // We get here if `from` is the exact base path for `to`.
|
28819 | // For example: from='/foo/bar'; to='/foo/bar/baz'
|
28820 | return to.slice(toStart + i + 1);
|
28821 | } else if (i === 0) {
|
28822 | // We get here if `from` is the root
|
28823 | // For example: from='/'; to='/foo'
|
28824 | return to.slice(toStart + i);
|
28825 | }
|
28826 | } else if (fromLen > length) {
|
28827 | if (from.charCodeAt(fromStart + i) === 47 /*/*/) {
|
28828 | // We get here if `to` is the exact base path for `from`.
|
28829 | // For example: from='/foo/bar/baz'; to='/foo/bar'
|
28830 | lastCommonSep = i;
|
28831 | } else if (i === 0) {
|
28832 | // We get here if `to` is the root.
|
28833 | // For example: from='/foo'; to='/'
|
28834 | lastCommonSep = 0;
|
28835 | }
|
28836 | }
|
28837 | break;
|
28838 | }
|
28839 | var fromCode = from.charCodeAt(fromStart + i);
|
28840 | var toCode = to.charCodeAt(toStart + i);
|
28841 | if (fromCode !== toCode)
|
28842 | break;
|
28843 | else if (fromCode === 47 /*/*/)
|
28844 | lastCommonSep = i;
|
28845 | }
|
28846 |
|
28847 | var out = '';
|
28848 | // Generate the relative path based on the path difference between `to`
|
28849 | // and `from`
|
28850 | for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
28851 | if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {
|
28852 | if (out.length === 0)
|
28853 | out += '..';
|
28854 | else
|
28855 | out += '/..';
|
28856 | }
|
28857 | }
|
28858 |
|
28859 | // Lastly, append the rest of the destination (`to`) path that comes after
|
28860 | // the common path parts
|
28861 | if (out.length > 0)
|
28862 | return out + to.slice(toStart + lastCommonSep);
|
28863 | else {
|
28864 | toStart += lastCommonSep;
|
28865 | if (to.charCodeAt(toStart) === 47 /*/*/)
|
28866 | ++toStart;
|
28867 | return to.slice(toStart);
|
28868 | }
|
28869 | },
|
28870 |
|
28871 | _makeLong: function _makeLong(path) {
|
28872 | return path;
|
28873 | },
|
28874 |
|
28875 | dirname: function dirname(path) {
|
28876 | assertPath(path);
|
28877 | if (path.length === 0) return '.';
|
28878 | var code = path.charCodeAt(0);
|
28879 | var hasRoot = code === 47 /*/*/;
|
28880 | var end = -1;
|
28881 | var matchedSlash = true;
|
28882 | for (var i = path.length - 1; i >= 1; --i) {
|
28883 | code = path.charCodeAt(i);
|
28884 | if (code === 47 /*/*/) {
|
28885 | if (!matchedSlash) {
|
28886 | end = i;
|
28887 | break;
|
28888 | }
|
28889 | } else {
|
28890 | // We saw the first non-path separator
|
28891 | matchedSlash = false;
|
28892 | }
|
28893 | }
|
28894 |
|
28895 | if (end === -1) return hasRoot ? '/' : '.';
|
28896 | if (hasRoot && end === 1) return '//';
|
28897 | return path.slice(0, end);
|
28898 | },
|
28899 |
|
28900 | basename: function basename(path, ext) {
|
28901 | if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string');
|
28902 | assertPath(path);
|
28903 |
|
28904 | var start = 0;
|
28905 | var end = -1;
|
28906 | var matchedSlash = true;
|
28907 | var i;
|
28908 |
|
28909 | if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
|
28910 | if (ext.length === path.length && ext === path) return '';
|
28911 | var extIdx = ext.length - 1;
|
28912 | var firstNonSlashEnd = -1;
|
28913 | for (i = path.length - 1; i >= 0; --i) {
|
28914 | var code = path.charCodeAt(i);
|
28915 | if (code === 47 /*/*/) {
|
28916 | // If we reached a path separator that was not part of a set of path
|
28917 | // separators at the end of the string, stop now
|
28918 | if (!matchedSlash) {
|
28919 | start = i + 1;
|
28920 | break;
|
28921 | }
|
28922 | } else {
|
28923 | if (firstNonSlashEnd === -1) {
|
28924 | // We saw the first non-path separator, remember this index in case
|
28925 | // we need it if the extension ends up not matching
|
28926 | matchedSlash = false;
|
28927 | firstNonSlashEnd = i + 1;
|
28928 | }
|
28929 | if (extIdx >= 0) {
|
28930 | // Try to match the explicit extension
|
28931 | if (code === ext.charCodeAt(extIdx)) {
|
28932 | if (--extIdx === -1) {
|
28933 | // We matched the extension, so mark this as the end of our path
|
28934 | // component
|
28935 | end = i;
|
28936 | }
|
28937 | } else {
|
28938 | // Extension does not match, so our result is the entire path
|
28939 | // component
|
28940 | extIdx = -1;
|
28941 | end = firstNonSlashEnd;
|
28942 | }
|
28943 | }
|
28944 | }
|
28945 | }
|
28946 |
|
28947 | if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;
|
28948 | return path.slice(start, end);
|
28949 | } else {
|
28950 | for (i = path.length - 1; i >= 0; --i) {
|
28951 | if (path.charCodeAt(i) === 47 /*/*/) {
|
28952 | // If we reached a path separator that was not part of a set of path
|
28953 | // separators at the end of the string, stop now
|
28954 | if (!matchedSlash) {
|
28955 | start = i + 1;
|
28956 | break;
|
28957 | }
|
28958 | } else if (end === -1) {
|
28959 | // We saw the first non-path separator, mark this as the end of our
|
28960 | // path component
|
28961 | matchedSlash = false;
|
28962 | end = i + 1;
|
28963 | }
|
28964 | }
|
28965 |
|
28966 | if (end === -1) return '';
|
28967 | return path.slice(start, end);
|
28968 | }
|
28969 | },
|
28970 |
|
28971 | extname: function extname(path) {
|
28972 | assertPath(path);
|
28973 | var startDot = -1;
|
28974 | var startPart = 0;
|
28975 | var end = -1;
|
28976 | var matchedSlash = true;
|
28977 | // Track the state of characters (if any) we see before our first dot and
|
28978 | // after any path separator we find
|
28979 | var preDotState = 0;
|
28980 | for (var i = path.length - 1; i >= 0; --i) {
|
28981 | var code = path.charCodeAt(i);
|
28982 | if (code === 47 /*/*/) {
|
28983 | // If we reached a path separator that was not part of a set of path
|
28984 | // separators at the end of the string, stop now
|
28985 | if (!matchedSlash) {
|
28986 | startPart = i + 1;
|
28987 | break;
|
28988 | }
|
28989 | continue;
|
28990 | }
|
28991 | if (end === -1) {
|
28992 | // We saw the first non-path separator, mark this as the end of our
|
28993 | // extension
|
28994 | matchedSlash = false;
|
28995 | end = i + 1;
|
28996 | }
|
28997 | if (code === 46 /*.*/) {
|
28998 | // If this is our first dot, mark it as the start of our extension
|
28999 | if (startDot === -1)
|
29000 | startDot = i;
|
29001 | else if (preDotState !== 1)
|
29002 | preDotState = 1;
|
29003 | } else if (startDot !== -1) {
|
29004 | // We saw a non-dot and non-path separator before our dot, so we should
|
29005 | // have a good chance at having a non-empty extension
|
29006 | preDotState = -1;
|
29007 | }
|
29008 | }
|
29009 |
|
29010 | if (startDot === -1 || end === -1 ||
|
29011 | // We saw a non-dot character immediately before the dot
|
29012 | preDotState === 0 ||
|
29013 | // The (right-most) trimmed path component is exactly '..'
|
29014 | preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
29015 | return '';
|
29016 | }
|
29017 | return path.slice(startDot, end);
|
29018 | },
|
29019 |
|
29020 | format: function format(pathObject) {
|
29021 | if (pathObject === null || typeof pathObject !== 'object') {
|
29022 | throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
29023 | }
|
29024 | return _format('/', pathObject);
|
29025 | },
|
29026 |
|
29027 | parse: function parse(path) {
|
29028 | assertPath(path);
|
29029 |
|
29030 | var ret = { root: '', dir: '', base: '', ext: '', name: '' };
|
29031 | if (path.length === 0) return ret;
|
29032 | var code = path.charCodeAt(0);
|
29033 | var isAbsolute = code === 47 /*/*/;
|
29034 | var start;
|
29035 | if (isAbsolute) {
|
29036 | ret.root = '/';
|
29037 | start = 1;
|
29038 | } else {
|
29039 | start = 0;
|
29040 | }
|
29041 | var startDot = -1;
|
29042 | var startPart = 0;
|
29043 | var end = -1;
|
29044 | var matchedSlash = true;
|
29045 | var i = path.length - 1;
|
29046 |
|
29047 | // Track the state of characters (if any) we see before our first dot and
|
29048 | // after any path separator we find
|
29049 | var preDotState = 0;
|
29050 |
|
29051 | // Get non-dir info
|
29052 | for (; i >= start; --i) {
|
29053 | code = path.charCodeAt(i);
|
29054 | if (code === 47 /*/*/) {
|
29055 | // If we reached a path separator that was not part of a set of path
|
29056 | // separators at the end of the string, stop now
|
29057 | if (!matchedSlash) {
|
29058 | startPart = i + 1;
|
29059 | break;
|
29060 | }
|
29061 | continue;
|
29062 | }
|
29063 | if (end === -1) {
|
29064 | // We saw the first non-path separator, mark this as the end of our
|
29065 | // extension
|
29066 | matchedSlash = false;
|
29067 | end = i + 1;
|
29068 | }
|
29069 | if (code === 46 /*.*/) {
|
29070 | // If this is our first dot, mark it as the start of our extension
|
29071 | if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;
|
29072 | } else if (startDot !== -1) {
|
29073 | // We saw a non-dot and non-path separator before our dot, so we should
|
29074 | // have a good chance at having a non-empty extension
|
29075 | preDotState = -1;
|
29076 | }
|
29077 | }
|
29078 |
|
29079 | if (startDot === -1 || end === -1 ||
|
29080 | // We saw a non-dot character immediately before the dot
|
29081 | preDotState === 0 ||
|
29082 | // The (right-most) trimmed path component is exactly '..'
|
29083 | preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
29084 | if (end !== -1) {
|
29085 | if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);
|
29086 | }
|
29087 | } else {
|
29088 | if (startPart === 0 && isAbsolute) {
|
29089 | ret.name = path.slice(1, startDot);
|
29090 | ret.base = path.slice(1, end);
|
29091 | } else {
|
29092 | ret.name = path.slice(startPart, startDot);
|
29093 | ret.base = path.slice(startPart, end);
|
29094 | }
|
29095 | ret.ext = path.slice(startDot, end);
|
29096 | }
|
29097 |
|
29098 | if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';
|
29099 |
|
29100 | return ret;
|
29101 | },
|
29102 |
|
29103 | sep: '/',
|
29104 | delimiter: ':',
|
29105 | win32: null,
|
29106 | posix: null
|
29107 | };
|
29108 |
|
29109 | posix.posix = posix;
|
29110 |
|
29111 | module.exports = posix;
|
29112 |
|
29113 |
|
29114 | /***/ }),
|
29115 |
|
29116 | /***/ "@braintree/sanitize-url":
|
29117 | /*!******************************************!*\
|
29118 | !*** external "@braintree/sanitize-url" ***!
|
29119 | \******************************************/
|
29120 | /***/ ((module) => {
|
29121 |
|
29122 | "use strict";
|
29123 | module.exports = require("@braintree/sanitize-url");
|
29124 |
|
29125 | /***/ }),
|
29126 |
|
29127 | /***/ "d3":
|
29128 | /*!*********************!*\
|
29129 | !*** external "d3" ***!
|
29130 | \*********************/
|
29131 | /***/ ((module) => {
|
29132 |
|
29133 | "use strict";
|
29134 | module.exports = require("d3");
|
29135 |
|
29136 | /***/ }),
|
29137 |
|
29138 | /***/ "dagre":
|
29139 | /*!************************!*\
|
29140 | !*** external "dagre" ***!
|
29141 | \************************/
|
29142 | /***/ ((module) => {
|
29143 |
|
29144 | "use strict";
|
29145 | module.exports = require("dagre");
|
29146 |
|
29147 | /***/ }),
|
29148 |
|
29149 | /***/ "dagre-d3":
|
29150 | /*!***************************!*\
|
29151 | !*** external "dagre-d3" ***!
|
29152 | \***************************/
|
29153 | /***/ ((module) => {
|
29154 |
|
29155 | "use strict";
|
29156 | module.exports = require("dagre-d3");
|
29157 |
|
29158 | /***/ }),
|
29159 |
|
29160 | /***/ "dagre-d3/lib/label/add-html-label.js":
|
29161 | /*!*******************************************************!*\
|
29162 | !*** external "dagre-d3/lib/label/add-html-label.js" ***!
|
29163 | \*******************************************************/
|
29164 | /***/ ((module) => {
|
29165 |
|
29166 | "use strict";
|
29167 | module.exports = require("dagre-d3/lib/label/add-html-label.js");
|
29168 |
|
29169 | /***/ }),
|
29170 |
|
29171 | /***/ "dompurify":
|
29172 | /*!****************************!*\
|
29173 | !*** external "dompurify" ***!
|
29174 | \****************************/
|
29175 | /***/ ((module) => {
|
29176 |
|
29177 | "use strict";
|
29178 | module.exports = require("dompurify");
|
29179 |
|
29180 | /***/ }),
|
29181 |
|
29182 | /***/ "graphlib":
|
29183 | /*!***************************!*\
|
29184 | !*** external "graphlib" ***!
|
29185 | \***************************/
|
29186 | /***/ ((module) => {
|
29187 |
|
29188 | "use strict";
|
29189 | module.exports = require("graphlib");
|
29190 |
|
29191 | /***/ }),
|
29192 |
|
29193 | /***/ "khroma":
|
29194 | /*!*************************!*\
|
29195 | !*** external "khroma" ***!
|
29196 | \*************************/
|
29197 | /***/ ((module) => {
|
29198 |
|
29199 | "use strict";
|
29200 | module.exports = require("khroma");
|
29201 |
|
29202 | /***/ }),
|
29203 |
|
29204 | /***/ "moment-mini":
|
29205 | /*!******************************!*\
|
29206 | !*** external "moment-mini" ***!
|
29207 | \******************************/
|
29208 | /***/ ((module) => {
|
29209 |
|
29210 | "use strict";
|
29211 | module.exports = require("moment-mini");
|
29212 |
|
29213 | /***/ }),
|
29214 |
|
29215 | /***/ "stylis":
|
29216 | /*!*************************!*\
|
29217 | !*** external "stylis" ***!
|
29218 | \*************************/
|
29219 | /***/ ((module) => {
|
29220 |
|
29221 | "use strict";
|
29222 | module.exports = require("stylis");
|
29223 |
|
29224 | /***/ }),
|
29225 |
|
29226 | /***/ "?35ed":
|
29227 | /*!********************!*\
|
29228 | !*** fs (ignored) ***!
|
29229 | \********************/
|
29230 | /***/ (() => {
|
29231 |
|
29232 | /* (ignored) */
|
29233 |
|
29234 | /***/ }),
|
29235 |
|
29236 | /***/ "?3c87":
|
29237 | /*!********************!*\
|
29238 | !*** fs (ignored) ***!
|
29239 | \********************/
|
29240 | /***/ (() => {
|
29241 |
|
29242 | /* (ignored) */
|
29243 |
|
29244 | /***/ }),
|
29245 |
|
29246 | /***/ "?dbae":
|
29247 | /*!********************!*\
|
29248 | !*** fs (ignored) ***!
|
29249 | \********************/
|
29250 | /***/ (() => {
|
29251 |
|
29252 | /* (ignored) */
|
29253 |
|
29254 | /***/ }),
|
29255 |
|
29256 | /***/ "?8ed1":
|
29257 | /*!********************!*\
|
29258 | !*** fs (ignored) ***!
|
29259 | \********************/
|
29260 | /***/ (() => {
|
29261 |
|
29262 | /* (ignored) */
|
29263 |
|
29264 | /***/ }),
|
29265 |
|
29266 | /***/ "?2b40":
|
29267 | /*!********************!*\
|
29268 | !*** fs (ignored) ***!
|
29269 | \********************/
|
29270 | /***/ (() => {
|
29271 |
|
29272 | /* (ignored) */
|
29273 |
|
29274 | /***/ }),
|
29275 |
|
29276 | /***/ "?c5f1":
|
29277 | /*!********************!*\
|
29278 | !*** fs (ignored) ***!
|
29279 | \********************/
|
29280 | /***/ (() => {
|
29281 |
|
29282 | /* (ignored) */
|
29283 |
|
29284 | /***/ }),
|
29285 |
|
29286 | /***/ "?a3fa":
|
29287 | /*!********************!*\
|
29288 | !*** fs (ignored) ***!
|
29289 | \********************/
|
29290 | /***/ (() => {
|
29291 |
|
29292 | /* (ignored) */
|
29293 |
|
29294 | /***/ }),
|
29295 |
|
29296 | /***/ "?ebf4":
|
29297 | /*!********************!*\
|
29298 | !*** fs (ignored) ***!
|
29299 | \********************/
|
29300 | /***/ (() => {
|
29301 |
|
29302 | /* (ignored) */
|
29303 |
|
29304 | /***/ }),
|
29305 |
|
29306 | /***/ "?e940":
|
29307 | /*!********************!*\
|
29308 | !*** fs (ignored) ***!
|
29309 | \********************/
|
29310 | /***/ (() => {
|
29311 |
|
29312 | /* (ignored) */
|
29313 |
|
29314 | /***/ }),
|
29315 |
|
29316 | /***/ "?a3b8":
|
29317 | /*!********************!*\
|
29318 | !*** fs (ignored) ***!
|
29319 | \********************/
|
29320 | /***/ (() => {
|
29321 |
|
29322 | /* (ignored) */
|
29323 |
|
29324 | /***/ }),
|
29325 |
|
29326 | /***/ "?0f62":
|
29327 | /*!********************!*\
|
29328 | !*** fs (ignored) ***!
|
29329 | \********************/
|
29330 | /***/ (() => {
|
29331 |
|
29332 | /* (ignored) */
|
29333 |
|
29334 | /***/ }),
|
29335 |
|
29336 | /***/ "./package.json":
|
29337 | /*!**********************!*\
|
29338 | !*** ./package.json ***!
|
29339 | \**********************/
|
29340 | /***/ ((module) => {
|
29341 |
|
29342 | "use strict";
|
29343 | module.exports = JSON.parse('{"name":"mermaid","version":"8.13.3","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 --progress --color","build:production":"yarn build:development --mode production --config webpack.config.prod.babel.js","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 src","e2e:depr":"yarn lint && jest e2e --config e2e/jest.config.js","cypress":"percy exec -- 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.config.e2e.js","test":"yarn lint && jest src/.*","test:watch":"jest --watch src","prepublishOnly":"yarn build && yarn test","prepare":"yarn build"},"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":"^3.1.0","d3":"^7.0.0","dagre":"^0.8.5","dagre-d3":"^0.6.4","dompurify":"2.3.3","graphlib":"^2.1.8","khroma":"^1.4.1","moment-mini":"^2.24.0","stylis":"^4.0.10"},"devDependencies":{"@babel/core":"^7.14.6","@babel/eslint-parser":"^7.14.7","@babel/preset-env":"^7.14.7","@babel/register":"^7.14.5","@percy/cli":"^1.0.0-beta.58","@percy/cypress":"^3.1.0","@percy/migrate":"^0.11.0","babel-jest":"^27.0.6","babel-loader":"^8.2.2","concurrently":"^6.2.2","coveralls":"^3.0.2","css-to-string-loader":"^0.1.3","cypress":"8.5.0","documentation":"13.2.0","eslint":"^7.30.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","husky":"^7.0.1","identity-obj-proxy":"^3.0.0","jest":"^27.0.6","jison":"^0.4.18","js-base64":"3.7.2","moment":"^2.23.0","path-browserify":"^1.0.1","prettier":"^2.3.2","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-node-externals":"^3.0.0"},"files":["dist"],"sideEffects":["**/*.css","**/*.scss"],"husky":{"hooks":{"pre-push":"yarn test"}}}');
|
29344 |
|
29345 | /***/ })
|
29346 |
|
29347 | /******/ });
|
29348 | /************************************************************************/
|
29349 | /******/ // The module cache
|
29350 | /******/ var __webpack_module_cache__ = {};
|
29351 | /******/
|
29352 | /******/ // The require function
|
29353 | /******/ function __webpack_require__(moduleId) {
|
29354 | /******/ // Check if module is in cache
|
29355 | /******/ var cachedModule = __webpack_module_cache__[moduleId];
|
29356 | /******/ if (cachedModule !== undefined) {
|
29357 | /******/ return cachedModule.exports;
|
29358 | /******/ }
|
29359 | /******/ // Create a new module (and put it into the cache)
|
29360 | /******/ var module = __webpack_module_cache__[moduleId] = {
|
29361 | /******/ id: moduleId,
|
29362 | /******/ loaded: false,
|
29363 | /******/ exports: {}
|
29364 | /******/ };
|
29365 | /******/
|
29366 | /******/ // Execute the module function
|
29367 | /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
29368 | /******/
|
29369 | /******/ // Flag the module as loaded
|
29370 | /******/ module.loaded = true;
|
29371 | /******/
|
29372 | /******/ // Return the exports of the module
|
29373 | /******/ return module.exports;
|
29374 | /******/ }
|
29375 | /******/
|
29376 | /******/ // expose the module cache
|
29377 | /******/ __webpack_require__.c = __webpack_module_cache__;
|
29378 | /******/
|
29379 | /************************************************************************/
|
29380 | /******/ /* webpack/runtime/compat get default export */
|
29381 | /******/ (() => {
|
29382 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
29383 | /******/ __webpack_require__.n = (module) => {
|
29384 | /******/ var getter = module && module.__esModule ?
|
29385 | /******/ () => (module['default']) :
|
29386 | /******/ () => (module);
|
29387 | /******/ __webpack_require__.d(getter, { a: getter });
|
29388 | /******/ return getter;
|
29389 | /******/ };
|
29390 | /******/ })();
|
29391 | /******/
|
29392 | /******/ /* webpack/runtime/define property getters */
|
29393 | /******/ (() => {
|
29394 | /******/ // define getter functions for harmony exports
|
29395 | /******/ __webpack_require__.d = (exports, definition) => {
|
29396 | /******/ for(var key in definition) {
|
29397 | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
29398 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
29399 | /******/ }
|
29400 | /******/ }
|
29401 | /******/ };
|
29402 | /******/ })();
|
29403 | /******/
|
29404 | /******/ /* webpack/runtime/hasOwnProperty shorthand */
|
29405 | /******/ (() => {
|
29406 | /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
29407 | /******/ })();
|
29408 | /******/
|
29409 | /******/ /* webpack/runtime/make namespace object */
|
29410 | /******/ (() => {
|
29411 | /******/ // define __esModule on exports
|
29412 | /******/ __webpack_require__.r = (exports) => {
|
29413 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
29414 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
29415 | /******/ }
|
29416 | /******/ Object.defineProperty(exports, '__esModule', { value: true });
|
29417 | /******/ };
|
29418 | /******/ })();
|
29419 | /******/
|
29420 | /******/ /* webpack/runtime/node module decorator */
|
29421 | /******/ (() => {
|
29422 | /******/ __webpack_require__.nmd = (module) => {
|
29423 | /******/ module.paths = [];
|
29424 | /******/ if (!module.children) module.children = [];
|
29425 | /******/ return module;
|
29426 | /******/ };
|
29427 | /******/ })();
|
29428 | /******/
|
29429 | /************************************************************************/
|
29430 | /******/
|
29431 | /******/ // module cache are used so entry inlining is disabled
|
29432 | /******/ // startup
|
29433 | /******/ // Load entry module and return exports
|
29434 | /******/ var __webpack_exports__ = __webpack_require__(__webpack_require__.s = "./src/mermaid.js");
|
29435 | /******/ __webpack_exports__ = __webpack_exports__["default"];
|
29436 | /******/
|
29437 | /******/ return __webpack_exports__;
|
29438 | /******/ })()
|
29439 | ;
|
29440 | });
|
29441 | //# sourceMappingURL=mermaid.core.js.map |
\ | No newline at end of file |