1 | import { c as getConfig, C as setDiagramTitle, D as getDiagramTitle, s as setAccTitle, g as getAccTitle, b as setAccDescription, a as getAccDescription, E as clear$1, j as d3select, k as configureSvgSize } from "./mermaid-dcacb631.js";
|
2 | import { d as drawRect$1, f as drawText$1, a as drawBackgroundRect$1, g as getNoteRect } from "./svgDrawCommon-d6ab583c.js";
|
3 | import { d as d3arc } from "./arc-c0f908ab.js";
|
4 | import "./path-39bad7e2.js";
|
5 | var parser = function() {
|
6 | var o = function(k, v, o2, l) {
|
7 | for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
|
8 | ;
|
9 | return o2;
|
10 | }, $V0 = [6, 8, 10, 11, 12, 14, 16, 17, 18], $V1 = [1, 9], $V2 = [1, 10], $V3 = [1, 11], $V4 = [1, 12], $V5 = [1, 13], $V6 = [1, 14];
|
11 | var parser2 = {
|
12 | trace: function trace() {
|
13 | },
|
14 | yy: {},
|
15 | symbols_: { "error": 2, "start": 3, "journey": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NEWLINE": 10, "title": 11, "acc_title": 12, "acc_title_value": 13, "acc_descr": 14, "acc_descr_value": 15, "acc_descr_multiline_value": 16, "section": 17, "taskName": 18, "taskData": 19, "$accept": 0, "$end": 1 },
|
16 | terminals_: { 2: "error", 4: "journey", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 11: "title", 12: "acc_title", 13: "acc_title_value", 14: "acc_descr", 15: "acc_descr_value", 16: "acc_descr_multiline_value", 17: "section", 18: "taskName", 19: "taskData" },
|
17 | productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2]],
|
18 | performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
|
19 | var $0 = $$.length - 1;
|
20 | switch (yystate) {
|
21 | case 1:
|
22 | return $$[$0 - 1];
|
23 | case 2:
|
24 | this.$ = [];
|
25 | break;
|
26 | case 3:
|
27 | $$[$0 - 1].push($$[$0]);
|
28 | this.$ = $$[$0 - 1];
|
29 | break;
|
30 | case 4:
|
31 | case 5:
|
32 | this.$ = $$[$0];
|
33 | break;
|
34 | case 6:
|
35 | case 7:
|
36 | this.$ = [];
|
37 | break;
|
38 | case 8:
|
39 | yy.setDiagramTitle($$[$0].substr(6));
|
40 | this.$ = $$[$0].substr(6);
|
41 | break;
|
42 | case 9:
|
43 | this.$ = $$[$0].trim();
|
44 | yy.setAccTitle(this.$);
|
45 | break;
|
46 | case 10:
|
47 | case 11:
|
48 | this.$ = $$[$0].trim();
|
49 | yy.setAccDescription(this.$);
|
50 | break;
|
51 | case 12:
|
52 | yy.addSection($$[$0].substr(8));
|
53 | this.$ = $$[$0].substr(8);
|
54 | break;
|
55 | case 13:
|
56 | yy.addTask($$[$0 - 1], $$[$0]);
|
57 | this.$ = "task";
|
58 | break;
|
59 | }
|
60 | },
|
61 | table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: $V6 }, o($V0, [2, 7], { 1: [2, 1] }), o($V0, [2, 3]), { 9: 15, 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: $V6 }, o($V0, [2, 5]), o($V0, [2, 6]), o($V0, [2, 8]), { 13: [1, 16] }, { 15: [1, 17] }, o($V0, [2, 11]), o($V0, [2, 12]), { 19: [1, 18] }, o($V0, [2, 4]), o($V0, [2, 9]), o($V0, [2, 10]), o($V0, [2, 13])],
|
62 | defaultActions: {},
|
63 | parseError: function parseError(str, hash) {
|
64 | if (hash.recoverable) {
|
65 | this.trace(str);
|
66 | } else {
|
67 | var error = new Error(str);
|
68 | error.hash = hash;
|
69 | throw error;
|
70 | }
|
71 | },
|
72 | parse: function parse(input) {
|
73 | var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
|
74 | var args = lstack.slice.call(arguments, 1);
|
75 | var lexer2 = Object.create(this.lexer);
|
76 | var sharedState = { yy: {} };
|
77 | for (var k in this.yy) {
|
78 | if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
79 | sharedState.yy[k] = this.yy[k];
|
80 | }
|
81 | }
|
82 | lexer2.setInput(input, sharedState.yy);
|
83 | sharedState.yy.lexer = lexer2;
|
84 | sharedState.yy.parser = this;
|
85 | if (typeof lexer2.yylloc == "undefined") {
|
86 | lexer2.yylloc = {};
|
87 | }
|
88 | var yyloc = lexer2.yylloc;
|
89 | lstack.push(yyloc);
|
90 | var ranges = lexer2.options && lexer2.options.ranges;
|
91 | if (typeof sharedState.yy.parseError === "function") {
|
92 | this.parseError = sharedState.yy.parseError;
|
93 | } else {
|
94 | this.parseError = Object.getPrototypeOf(this).parseError;
|
95 | }
|
96 | function lex() {
|
97 | var token;
|
98 | token = tstack.pop() || lexer2.lex() || EOF;
|
99 | if (typeof token !== "number") {
|
100 | if (token instanceof Array) {
|
101 | tstack = token;
|
102 | token = tstack.pop();
|
103 | }
|
104 | token = self.symbols_[token] || token;
|
105 | }
|
106 | return token;
|
107 | }
|
108 | var symbol, state, action, r, yyval = {}, p, len, newState, expected;
|
109 | while (true) {
|
110 | state = stack[stack.length - 1];
|
111 | if (this.defaultActions[state]) {
|
112 | action = this.defaultActions[state];
|
113 | } else {
|
114 | if (symbol === null || typeof symbol == "undefined") {
|
115 | symbol = lex();
|
116 | }
|
117 | action = table[state] && table[state][symbol];
|
118 | }
|
119 | if (typeof action === "undefined" || !action.length || !action[0]) {
|
120 | var errStr = "";
|
121 | expected = [];
|
122 | for (p in table[state]) {
|
123 | if (this.terminals_[p] && p > TERROR) {
|
124 | expected.push("'" + this.terminals_[p] + "'");
|
125 | }
|
126 | }
|
127 | if (lexer2.showPosition) {
|
128 | errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
|
129 | } else {
|
130 | errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
|
131 | }
|
132 | this.parseError(errStr, {
|
133 | text: lexer2.match,
|
134 | token: this.terminals_[symbol] || symbol,
|
135 | line: lexer2.yylineno,
|
136 | loc: yyloc,
|
137 | expected
|
138 | });
|
139 | }
|
140 | if (action[0] instanceof Array && action.length > 1) {
|
141 | throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
|
142 | }
|
143 | switch (action[0]) {
|
144 | case 1:
|
145 | stack.push(symbol);
|
146 | vstack.push(lexer2.yytext);
|
147 | lstack.push(lexer2.yylloc);
|
148 | stack.push(action[1]);
|
149 | symbol = null;
|
150 | {
|
151 | yyleng = lexer2.yyleng;
|
152 | yytext = lexer2.yytext;
|
153 | yylineno = lexer2.yylineno;
|
154 | yyloc = lexer2.yylloc;
|
155 | }
|
156 | break;
|
157 | case 2:
|
158 | len = this.productions_[action[1]][1];
|
159 | yyval.$ = vstack[vstack.length - len];
|
160 | yyval._$ = {
|
161 | first_line: lstack[lstack.length - (len || 1)].first_line,
|
162 | last_line: lstack[lstack.length - 1].last_line,
|
163 | first_column: lstack[lstack.length - (len || 1)].first_column,
|
164 | last_column: lstack[lstack.length - 1].last_column
|
165 | };
|
166 | if (ranges) {
|
167 | yyval._$.range = [
|
168 | lstack[lstack.length - (len || 1)].range[0],
|
169 | lstack[lstack.length - 1].range[1]
|
170 | ];
|
171 | }
|
172 | r = this.performAction.apply(yyval, [
|
173 | yytext,
|
174 | yyleng,
|
175 | yylineno,
|
176 | sharedState.yy,
|
177 | action[1],
|
178 | vstack,
|
179 | lstack
|
180 | ].concat(args));
|
181 | if (typeof r !== "undefined") {
|
182 | return r;
|
183 | }
|
184 | if (len) {
|
185 | stack = stack.slice(0, -1 * len * 2);
|
186 | vstack = vstack.slice(0, -1 * len);
|
187 | lstack = lstack.slice(0, -1 * len);
|
188 | }
|
189 | stack.push(this.productions_[action[1]][0]);
|
190 | vstack.push(yyval.$);
|
191 | lstack.push(yyval._$);
|
192 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
193 | stack.push(newState);
|
194 | break;
|
195 | case 3:
|
196 | return true;
|
197 | }
|
198 | }
|
199 | return true;
|
200 | }
|
201 | };
|
202 | var lexer = function() {
|
203 | var lexer2 = {
|
204 | EOF: 1,
|
205 | parseError: function parseError(str, hash) {
|
206 | if (this.yy.parser) {
|
207 | this.yy.parser.parseError(str, hash);
|
208 | } else {
|
209 | throw new Error(str);
|
210 | }
|
211 | },
|
212 |
|
213 | setInput: function(input, yy) {
|
214 | this.yy = yy || this.yy || {};
|
215 | this._input = input;
|
216 | this._more = this._backtrack = this.done = false;
|
217 | this.yylineno = this.yyleng = 0;
|
218 | this.yytext = this.matched = this.match = "";
|
219 | this.conditionStack = ["INITIAL"];
|
220 | this.yylloc = {
|
221 | first_line: 1,
|
222 | first_column: 0,
|
223 | last_line: 1,
|
224 | last_column: 0
|
225 | };
|
226 | if (this.options.ranges) {
|
227 | this.yylloc.range = [0, 0];
|
228 | }
|
229 | this.offset = 0;
|
230 | return this;
|
231 | },
|
232 |
|
233 | input: function() {
|
234 | var ch = this._input[0];
|
235 | this.yytext += ch;
|
236 | this.yyleng++;
|
237 | this.offset++;
|
238 | this.match += ch;
|
239 | this.matched += ch;
|
240 | var lines = ch.match(/(?:\r\n?|\n).*/g);
|
241 | if (lines) {
|
242 | this.yylineno++;
|
243 | this.yylloc.last_line++;
|
244 | } else {
|
245 | this.yylloc.last_column++;
|
246 | }
|
247 | if (this.options.ranges) {
|
248 | this.yylloc.range[1]++;
|
249 | }
|
250 | this._input = this._input.slice(1);
|
251 | return ch;
|
252 | },
|
253 |
|
254 | unput: function(ch) {
|
255 | var len = ch.length;
|
256 | var lines = ch.split(/(?:\r\n?|\n)/g);
|
257 | this._input = ch + this._input;
|
258 | this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
259 | this.offset -= len;
|
260 | var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
261 | this.match = this.match.substr(0, this.match.length - 1);
|
262 | this.matched = this.matched.substr(0, this.matched.length - 1);
|
263 | if (lines.length - 1) {
|
264 | this.yylineno -= lines.length - 1;
|
265 | }
|
266 | var r = this.yylloc.range;
|
267 | this.yylloc = {
|
268 | first_line: this.yylloc.first_line,
|
269 | last_line: this.yylineno + 1,
|
270 | first_column: this.yylloc.first_column,
|
271 | last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
|
272 | };
|
273 | if (this.options.ranges) {
|
274 | this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
275 | }
|
276 | this.yyleng = this.yytext.length;
|
277 | return this;
|
278 | },
|
279 |
|
280 | more: function() {
|
281 | this._more = true;
|
282 | return this;
|
283 | },
|
284 |
|
285 | reject: function() {
|
286 | if (this.options.backtrack_lexer) {
|
287 | this._backtrack = true;
|
288 | } else {
|
289 | 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(), {
|
290 | text: "",
|
291 | token: null,
|
292 | line: this.yylineno
|
293 | });
|
294 | }
|
295 | return this;
|
296 | },
|
297 |
|
298 | less: function(n) {
|
299 | this.unput(this.match.slice(n));
|
300 | },
|
301 |
|
302 | pastInput: function() {
|
303 | var past = this.matched.substr(0, this.matched.length - this.match.length);
|
304 | return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
|
305 | },
|
306 |
|
307 | upcomingInput: function() {
|
308 | var next = this.match;
|
309 | if (next.length < 20) {
|
310 | next += this._input.substr(0, 20 - next.length);
|
311 | }
|
312 | return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
|
313 | },
|
314 |
|
315 | showPosition: function() {
|
316 | var pre = this.pastInput();
|
317 | var c = new Array(pre.length + 1).join("-");
|
318 | return pre + this.upcomingInput() + "\n" + c + "^";
|
319 | },
|
320 |
|
321 | test_match: function(match, indexed_rule) {
|
322 | var token, lines, backup;
|
323 | if (this.options.backtrack_lexer) {
|
324 | backup = {
|
325 | yylineno: this.yylineno,
|
326 | yylloc: {
|
327 | first_line: this.yylloc.first_line,
|
328 | last_line: this.last_line,
|
329 | first_column: this.yylloc.first_column,
|
330 | last_column: this.yylloc.last_column
|
331 | },
|
332 | yytext: this.yytext,
|
333 | match: this.match,
|
334 | matches: this.matches,
|
335 | matched: this.matched,
|
336 | yyleng: this.yyleng,
|
337 | offset: this.offset,
|
338 | _more: this._more,
|
339 | _input: this._input,
|
340 | yy: this.yy,
|
341 | conditionStack: this.conditionStack.slice(0),
|
342 | done: this.done
|
343 | };
|
344 | if (this.options.ranges) {
|
345 | backup.yylloc.range = this.yylloc.range.slice(0);
|
346 | }
|
347 | }
|
348 | lines = match[0].match(/(?:\r\n?|\n).*/g);
|
349 | if (lines) {
|
350 | this.yylineno += lines.length;
|
351 | }
|
352 | this.yylloc = {
|
353 | first_line: this.yylloc.last_line,
|
354 | last_line: this.yylineno + 1,
|
355 | first_column: this.yylloc.last_column,
|
356 | last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
|
357 | };
|
358 | this.yytext += match[0];
|
359 | this.match += match[0];
|
360 | this.matches = match;
|
361 | this.yyleng = this.yytext.length;
|
362 | if (this.options.ranges) {
|
363 | this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
364 | }
|
365 | this._more = false;
|
366 | this._backtrack = false;
|
367 | this._input = this._input.slice(match[0].length);
|
368 | this.matched += match[0];
|
369 | token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
370 | if (this.done && this._input) {
|
371 | this.done = false;
|
372 | }
|
373 | if (token) {
|
374 | return token;
|
375 | } else if (this._backtrack) {
|
376 | for (var k in backup) {
|
377 | this[k] = backup[k];
|
378 | }
|
379 | return false;
|
380 | }
|
381 | return false;
|
382 | },
|
383 |
|
384 | next: function() {
|
385 | if (this.done) {
|
386 | return this.EOF;
|
387 | }
|
388 | if (!this._input) {
|
389 | this.done = true;
|
390 | }
|
391 | var token, match, tempMatch, index;
|
392 | if (!this._more) {
|
393 | this.yytext = "";
|
394 | this.match = "";
|
395 | }
|
396 | var rules = this._currentRules();
|
397 | for (var i = 0; i < rules.length; i++) {
|
398 | tempMatch = this._input.match(this.rules[rules[i]]);
|
399 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
400 | match = tempMatch;
|
401 | index = i;
|
402 | if (this.options.backtrack_lexer) {
|
403 | token = this.test_match(tempMatch, rules[i]);
|
404 | if (token !== false) {
|
405 | return token;
|
406 | } else if (this._backtrack) {
|
407 | match = false;
|
408 | continue;
|
409 | } else {
|
410 | return false;
|
411 | }
|
412 | } else if (!this.options.flex) {
|
413 | break;
|
414 | }
|
415 | }
|
416 | }
|
417 | if (match) {
|
418 | token = this.test_match(match, rules[index]);
|
419 | if (token !== false) {
|
420 | return token;
|
421 | }
|
422 | return false;
|
423 | }
|
424 | if (this._input === "") {
|
425 | return this.EOF;
|
426 | } else {
|
427 | return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
|
428 | text: "",
|
429 | token: null,
|
430 | line: this.yylineno
|
431 | });
|
432 | }
|
433 | },
|
434 |
|
435 | lex: function lex() {
|
436 | var r = this.next();
|
437 | if (r) {
|
438 | return r;
|
439 | } else {
|
440 | return this.lex();
|
441 | }
|
442 | },
|
443 |
|
444 | begin: function begin(condition) {
|
445 | this.conditionStack.push(condition);
|
446 | },
|
447 |
|
448 | popState: function popState() {
|
449 | var n = this.conditionStack.length - 1;
|
450 | if (n > 0) {
|
451 | return this.conditionStack.pop();
|
452 | } else {
|
453 | return this.conditionStack[0];
|
454 | }
|
455 | },
|
456 |
|
457 | _currentRules: function _currentRules() {
|
458 | if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
459 | return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
460 | } else {
|
461 | return this.conditions["INITIAL"].rules;
|
462 | }
|
463 | },
|
464 |
|
465 | topState: function topState(n) {
|
466 | n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
467 | if (n >= 0) {
|
468 | return this.conditionStack[n];
|
469 | } else {
|
470 | return "INITIAL";
|
471 | }
|
472 | },
|
473 |
|
474 | pushState: function pushState(condition) {
|
475 | this.begin(condition);
|
476 | },
|
477 |
|
478 | stateStackSize: function stateStackSize() {
|
479 | return this.conditionStack.length;
|
480 | },
|
481 | options: { "case-insensitive": true },
|
482 | performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
|
483 | switch ($avoiding_name_collisions) {
|
484 | case 0:
|
485 | break;
|
486 | case 1:
|
487 | break;
|
488 | case 2:
|
489 | return 10;
|
490 | case 3:
|
491 | break;
|
492 | case 4:
|
493 | break;
|
494 | case 5:
|
495 | return 4;
|
496 | case 6:
|
497 | return 11;
|
498 | case 7:
|
499 | this.begin("acc_title");
|
500 | return 12;
|
501 | case 8:
|
502 | this.popState();
|
503 | return "acc_title_value";
|
504 | case 9:
|
505 | this.begin("acc_descr");
|
506 | return 14;
|
507 | case 10:
|
508 | this.popState();
|
509 | return "acc_descr_value";
|
510 | case 11:
|
511 | this.begin("acc_descr_multiline");
|
512 | break;
|
513 | case 12:
|
514 | this.popState();
|
515 | break;
|
516 | case 13:
|
517 | return "acc_descr_multiline_value";
|
518 | case 14:
|
519 | return 17;
|
520 | case 15:
|
521 | return 18;
|
522 | case 16:
|
523 | return 19;
|
524 | case 17:
|
525 | return ":";
|
526 | case 18:
|
527 | return 6;
|
528 | case 19:
|
529 | return "INVALID";
|
530 | }
|
531 | },
|
532 | rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:journey\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?::[^#\n;]+)/i, /^(?::)/i, /^(?:$)/i, /^(?:.)/i],
|
533 | conditions: { "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19], "inclusive": true } }
|
534 | };
|
535 | return lexer2;
|
536 | }();
|
537 | parser2.lexer = lexer;
|
538 | function Parser() {
|
539 | this.yy = {};
|
540 | }
|
541 | Parser.prototype = parser2;
|
542 | parser2.Parser = Parser;
|
543 | return new Parser();
|
544 | }();
|
545 | parser.parser = parser;
|
546 | const parser$1 = parser;
|
547 | let currentSection = "";
|
548 | const sections = [];
|
549 | const tasks = [];
|
550 | const rawTasks = [];
|
551 | const clear = function() {
|
552 | sections.length = 0;
|
553 | tasks.length = 0;
|
554 | currentSection = "";
|
555 | rawTasks.length = 0;
|
556 | clear$1();
|
557 | };
|
558 | const addSection = function(txt) {
|
559 | currentSection = txt;
|
560 | sections.push(txt);
|
561 | };
|
562 | const getSections = function() {
|
563 | return sections;
|
564 | };
|
565 | const getTasks = function() {
|
566 | let allItemsProcessed = compileTasks();
|
567 | const maxDepth = 100;
|
568 | let iterationCount = 0;
|
569 | while (!allItemsProcessed && iterationCount < maxDepth) {
|
570 | allItemsProcessed = compileTasks();
|
571 | iterationCount++;
|
572 | }
|
573 | tasks.push(...rawTasks);
|
574 | return tasks;
|
575 | };
|
576 | const updateActors = function() {
|
577 | const tempActors = [];
|
578 | tasks.forEach((task) => {
|
579 | if (task.people) {
|
580 | tempActors.push(...task.people);
|
581 | }
|
582 | });
|
583 | const unique = new Set(tempActors);
|
584 | return [...unique].sort();
|
585 | };
|
586 | const addTask = function(descr, taskData) {
|
587 | const pieces = taskData.substr(1).split(":");
|
588 | let score = 0;
|
589 | let peeps = [];
|
590 | if (pieces.length === 1) {
|
591 | score = Number(pieces[0]);
|
592 | peeps = [];
|
593 | } else {
|
594 | score = Number(pieces[0]);
|
595 | peeps = pieces[1].split(",");
|
596 | }
|
597 | const peopleList = peeps.map((s) => s.trim());
|
598 | const rawTask = {
|
599 | section: currentSection,
|
600 | type: currentSection,
|
601 | people: peopleList,
|
602 | task: descr,
|
603 | score
|
604 | };
|
605 | rawTasks.push(rawTask);
|
606 | };
|
607 | const addTaskOrg = function(descr) {
|
608 | const newTask = {
|
609 | section: currentSection,
|
610 | type: currentSection,
|
611 | description: descr,
|
612 | task: descr,
|
613 | classes: []
|
614 | };
|
615 | tasks.push(newTask);
|
616 | };
|
617 | const compileTasks = function() {
|
618 | const compileTask = function(pos) {
|
619 | return rawTasks[pos].processed;
|
620 | };
|
621 | let allProcessed = true;
|
622 | for (const [i, rawTask] of rawTasks.entries()) {
|
623 | compileTask(i);
|
624 | allProcessed = allProcessed && rawTask.processed;
|
625 | }
|
626 | return allProcessed;
|
627 | };
|
628 | const getActors = function() {
|
629 | return updateActors();
|
630 | };
|
631 | const db = {
|
632 | getConfig: () => getConfig().journey,
|
633 | clear,
|
634 | setDiagramTitle,
|
635 | getDiagramTitle,
|
636 | setAccTitle,
|
637 | getAccTitle,
|
638 | setAccDescription,
|
639 | getAccDescription,
|
640 | addSection,
|
641 | getSections,
|
642 | getTasks,
|
643 | addTask,
|
644 | addTaskOrg,
|
645 | getActors
|
646 | };
|
647 | const getStyles = (options) => `.label {
|
648 | font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
649 | font-family: var(--mermaid-font-family);
|
650 | color: ${options.textColor};
|
651 | }
|
652 | .mouth {
|
653 | stroke: #666;
|
654 | }
|
655 |
|
656 | line {
|
657 | stroke: ${options.textColor}
|
658 | }
|
659 |
|
660 | .legend {
|
661 | fill: ${options.textColor};
|
662 | }
|
663 |
|
664 | .label text {
|
665 | fill: #333;
|
666 | }
|
667 | .label {
|
668 | color: ${options.textColor}
|
669 | }
|
670 |
|
671 | .face {
|
672 | ${options.faceColor ? `fill: ${options.faceColor}` : "fill: #FFF8DC"};
|
673 | stroke: #999;
|
674 | }
|
675 |
|
676 | .node rect,
|
677 | .node circle,
|
678 | .node ellipse,
|
679 | .node polygon,
|
680 | .node path {
|
681 | fill: ${options.mainBkg};
|
682 | stroke: ${options.nodeBorder};
|
683 | stroke-width: 1px;
|
684 | }
|
685 |
|
686 | .node .label {
|
687 | text-align: center;
|
688 | }
|
689 | .node.clickable {
|
690 | cursor: pointer;
|
691 | }
|
692 |
|
693 | .arrowheadPath {
|
694 | fill: ${options.arrowheadColor};
|
695 | }
|
696 |
|
697 | .edgePath .path {
|
698 | stroke: ${options.lineColor};
|
699 | stroke-width: 1.5px;
|
700 | }
|
701 |
|
702 | .flowchart-link {
|
703 | stroke: ${options.lineColor};
|
704 | fill: none;
|
705 | }
|
706 |
|
707 | .edgeLabel {
|
708 | background-color: ${options.edgeLabelBackground};
|
709 | rect {
|
710 | opacity: 0.5;
|
711 | }
|
712 | text-align: center;
|
713 | }
|
714 |
|
715 | .cluster rect {
|
716 | }
|
717 |
|
718 | .cluster text {
|
719 | fill: ${options.titleColor};
|
720 | }
|
721 |
|
722 | div.mermaidTooltip {
|
723 | position: absolute;
|
724 | text-align: center;
|
725 | max-width: 200px;
|
726 | padding: 2px;
|
727 | font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
728 | font-family: var(--mermaid-font-family);
|
729 | font-size: 12px;
|
730 | background: ${options.tertiaryColor};
|
731 | border: 1px solid ${options.border2};
|
732 | border-radius: 2px;
|
733 | pointer-events: none;
|
734 | z-index: 100;
|
735 | }
|
736 |
|
737 | .task-type-0, .section-type-0 {
|
738 | ${options.fillType0 ? `fill: ${options.fillType0}` : ""};
|
739 | }
|
740 | .task-type-1, .section-type-1 {
|
741 | ${options.fillType0 ? `fill: ${options.fillType1}` : ""};
|
742 | }
|
743 | .task-type-2, .section-type-2 {
|
744 | ${options.fillType0 ? `fill: ${options.fillType2}` : ""};
|
745 | }
|
746 | .task-type-3, .section-type-3 {
|
747 | ${options.fillType0 ? `fill: ${options.fillType3}` : ""};
|
748 | }
|
749 | .task-type-4, .section-type-4 {
|
750 | ${options.fillType0 ? `fill: ${options.fillType4}` : ""};
|
751 | }
|
752 | .task-type-5, .section-type-5 {
|
753 | ${options.fillType0 ? `fill: ${options.fillType5}` : ""};
|
754 | }
|
755 | .task-type-6, .section-type-6 {
|
756 | ${options.fillType0 ? `fill: ${options.fillType6}` : ""};
|
757 | }
|
758 | .task-type-7, .section-type-7 {
|
759 | ${options.fillType0 ? `fill: ${options.fillType7}` : ""};
|
760 | }
|
761 |
|
762 | .actor-0 {
|
763 | ${options.actor0 ? `fill: ${options.actor0}` : ""};
|
764 | }
|
765 | .actor-1 {
|
766 | ${options.actor1 ? `fill: ${options.actor1}` : ""};
|
767 | }
|
768 | .actor-2 {
|
769 | ${options.actor2 ? `fill: ${options.actor2}` : ""};
|
770 | }
|
771 | .actor-3 {
|
772 | ${options.actor3 ? `fill: ${options.actor3}` : ""};
|
773 | }
|
774 | .actor-4 {
|
775 | ${options.actor4 ? `fill: ${options.actor4}` : ""};
|
776 | }
|
777 | .actor-5 {
|
778 | ${options.actor5 ? `fill: ${options.actor5}` : ""};
|
779 | }
|
780 | `;
|
781 | const styles = getStyles;
|
782 | const drawRect = function(elem, rectData) {
|
783 | return drawRect$1(elem, rectData);
|
784 | };
|
785 | const drawFace = function(element, faceData) {
|
786 | const radius = 15;
|
787 | const 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");
|
788 | const face = element.append("g");
|
789 | 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");
|
790 | 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");
|
791 | function smile(face2) {
|
792 | const arc = d3arc().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
|
793 | face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 2) + ")");
|
794 | }
|
795 | function sad(face2) {
|
796 | const arc = d3arc().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
|
797 | face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 7) + ")");
|
798 | }
|
799 | function ambivalent(face2) {
|
800 | face2.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");
|
801 | }
|
802 | if (faceData.score > 3) {
|
803 | smile(face);
|
804 | } else if (faceData.score < 3) {
|
805 | sad(face);
|
806 | } else {
|
807 | ambivalent(face);
|
808 | }
|
809 | return circleElement;
|
810 | };
|
811 | const drawCircle = function(element, circleData) {
|
812 | const circleElement = element.append("circle");
|
813 | circleElement.attr("cx", circleData.cx);
|
814 | circleElement.attr("cy", circleData.cy);
|
815 | circleElement.attr("class", "actor-" + circleData.pos);
|
816 | circleElement.attr("fill", circleData.fill);
|
817 | circleElement.attr("stroke", circleData.stroke);
|
818 | circleElement.attr("r", circleData.r);
|
819 | if (circleElement.class !== void 0) {
|
820 | circleElement.attr("class", circleElement.class);
|
821 | }
|
822 | if (circleData.title !== void 0) {
|
823 | circleElement.append("title").text(circleData.title);
|
824 | }
|
825 | return circleElement;
|
826 | };
|
827 | const drawText = function(elem, textData) {
|
828 | return drawText$1(elem, textData);
|
829 | };
|
830 | const drawLabel = function(elem, txtObject) {
|
831 | function genPoints(x, y, width, height, cut) {
|
832 | return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height);
|
833 | }
|
834 | const polygon = elem.append("polygon");
|
835 | polygon.attr("points", genPoints(txtObject.x, txtObject.y, 50, 20, 7));
|
836 | polygon.attr("class", "labelBox");
|
837 | txtObject.y = txtObject.y + txtObject.labelMargin;
|
838 | txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
|
839 | drawText(elem, txtObject);
|
840 | };
|
841 | const drawSection = function(elem, section, conf2) {
|
842 | const g = elem.append("g");
|
843 | const rect = getNoteRect();
|
844 | rect.x = section.x;
|
845 | rect.y = section.y;
|
846 | rect.fill = section.fill;
|
847 | rect.width = conf2.width * section.taskCount +
|
848 | conf2.diagramMarginX * (section.taskCount - 1);
|
849 | rect.height = conf2.height;
|
850 | rect.class = "journey-section section-type-" + section.num;
|
851 | rect.rx = 3;
|
852 | rect.ry = 3;
|
853 | drawRect(g, rect);
|
854 | _drawTextCandidateFunc(conf2)(
|
855 | section.text,
|
856 | g,
|
857 | rect.x,
|
858 | rect.y,
|
859 | rect.width,
|
860 | rect.height,
|
861 | { class: "journey-section section-type-" + section.num },
|
862 | conf2,
|
863 | section.colour
|
864 | );
|
865 | };
|
866 | let taskCount = -1;
|
867 | const drawTask = function(elem, task, conf2) {
|
868 | const center = task.x + conf2.width / 2;
|
869 | const g = elem.append("g");
|
870 | taskCount++;
|
871 | const maxHeight = 300 + 5 * 30;
|
872 | 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");
|
873 | drawFace(g, {
|
874 | cx: center,
|
875 | cy: 300 + (5 - task.score) * 30,
|
876 | score: task.score
|
877 | });
|
878 | const rect = getNoteRect();
|
879 | rect.x = task.x;
|
880 | rect.y = task.y;
|
881 | rect.fill = task.fill;
|
882 | rect.width = conf2.width;
|
883 | rect.height = conf2.height;
|
884 | rect.class = "task task-type-" + task.num;
|
885 | rect.rx = 3;
|
886 | rect.ry = 3;
|
887 | drawRect(g, rect);
|
888 | let xPos = task.x + 14;
|
889 | task.people.forEach((person) => {
|
890 | const colour = task.actors[person].color;
|
891 | const circle = {
|
892 | cx: xPos,
|
893 | cy: task.y,
|
894 | r: 7,
|
895 | fill: colour,
|
896 | stroke: "#000",
|
897 | title: person,
|
898 | pos: task.actors[person].position
|
899 | };
|
900 | drawCircle(g, circle);
|
901 | xPos += 10;
|
902 | });
|
903 | _drawTextCandidateFunc(conf2)(
|
904 | task.task,
|
905 | g,
|
906 | rect.x,
|
907 | rect.y,
|
908 | rect.width,
|
909 | rect.height,
|
910 | { class: "task" },
|
911 | conf2,
|
912 | task.colour
|
913 | );
|
914 | };
|
915 | const drawBackgroundRect = function(elem, bounds2) {
|
916 | drawBackgroundRect$1(elem, bounds2);
|
917 | };
|
918 | const _drawTextCandidateFunc = function() {
|
919 | function byText(content, g, x, y, width, height, textAttrs, colour) {
|
920 | const 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);
|
921 | _setTextAttrs(text, textAttrs);
|
922 | }
|
923 | function byTspan(content, g, x, y, width, height, textAttrs, conf2, colour) {
|
924 | const { taskFontSize, taskFontFamily } = conf2;
|
925 | const lines = content.split(/<br\s*\/?>/gi);
|
926 | for (let i = 0; i < lines.length; i++) {
|
927 | const dy = i * taskFontSize - taskFontSize * (lines.length - 1) / 2;
|
928 | const 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);
|
929 | text.append("tspan").attr("x", x + width / 2).attr("dy", dy).text(lines[i]);
|
930 | text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
|
931 | _setTextAttrs(text, textAttrs);
|
932 | }
|
933 | }
|
934 | function byFo(content, g, x, y, width, height, textAttrs, conf2) {
|
935 | const body = g.append("switch");
|
936 | const f = body.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("position", "fixed");
|
937 | const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
|
938 | text.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
|
939 | byTspan(content, body, x, y, width, height, textAttrs, conf2);
|
940 | _setTextAttrs(text, textAttrs);
|
941 | }
|
942 | function _setTextAttrs(toText, fromTextAttrsDict) {
|
943 | for (const key in fromTextAttrsDict) {
|
944 | if (key in fromTextAttrsDict) {
|
945 | toText.attr(key, fromTextAttrsDict[key]);
|
946 | }
|
947 | }
|
948 | }
|
949 | return function(conf2) {
|
950 | return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
|
951 | };
|
952 | }();
|
953 | const initGraphics = function(graphics) {
|
954 | 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");
|
955 | };
|
956 | const svgDraw = {
|
957 | drawRect,
|
958 | drawCircle,
|
959 | drawSection,
|
960 | drawText,
|
961 | drawLabel,
|
962 | drawTask,
|
963 | drawBackgroundRect,
|
964 | initGraphics
|
965 | };
|
966 | const setConf = function(cnf) {
|
967 | const keys = Object.keys(cnf);
|
968 | keys.forEach(function(key) {
|
969 | conf[key] = cnf[key];
|
970 | });
|
971 | };
|
972 | const actors = {};
|
973 | function drawActorLegend(diagram2) {
|
974 | const conf2 = getConfig().journey;
|
975 | let yPos = 60;
|
976 | Object.keys(actors).forEach((person) => {
|
977 | const colour = actors[person].color;
|
978 | const circleData = {
|
979 | cx: 20,
|
980 | cy: yPos,
|
981 | r: 7,
|
982 | fill: colour,
|
983 | stroke: "#000",
|
984 | pos: actors[person].position
|
985 | };
|
986 | svgDraw.drawCircle(diagram2, circleData);
|
987 | const labelData = {
|
988 | x: 40,
|
989 | y: yPos + 7,
|
990 | fill: "#666",
|
991 | text: person,
|
992 | textMargin: conf2.boxTextMargin | 5
|
993 | };
|
994 | svgDraw.drawText(diagram2, labelData);
|
995 | yPos += 20;
|
996 | });
|
997 | }
|
998 | const conf = getConfig().journey;
|
999 | const LEFT_MARGIN = conf.leftMargin;
|
1000 | const draw = function(text, id, version, diagObj) {
|
1001 | const conf2 = getConfig().journey;
|
1002 | const securityLevel = getConfig().securityLevel;
|
1003 | let sandboxElement;
|
1004 | if (securityLevel === "sandbox") {
|
1005 | sandboxElement = d3select("#i" + id);
|
1006 | }
|
1007 | const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
|
1008 | bounds.init();
|
1009 | const diagram2 = root.select("#" + id);
|
1010 | svgDraw.initGraphics(diagram2);
|
1011 | const tasks2 = diagObj.db.getTasks();
|
1012 | const title = diagObj.db.getDiagramTitle();
|
1013 | const actorNames = diagObj.db.getActors();
|
1014 | for (const member in actors) {
|
1015 | delete actors[member];
|
1016 | }
|
1017 | let actorPos = 0;
|
1018 | actorNames.forEach((actorName) => {
|
1019 | actors[actorName] = {
|
1020 | color: conf2.actorColours[actorPos % conf2.actorColours.length],
|
1021 | position: actorPos
|
1022 | };
|
1023 | actorPos++;
|
1024 | });
|
1025 | drawActorLegend(diagram2);
|
1026 | bounds.insert(0, 0, LEFT_MARGIN, Object.keys(actors).length * 50);
|
1027 | drawTasks(diagram2, tasks2, 0);
|
1028 | const box = bounds.getBounds();
|
1029 | if (title) {
|
1030 | diagram2.append("text").text(title).attr("x", LEFT_MARGIN).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 25);
|
1031 | }
|
1032 | const height = box.stopy - box.starty + 2 * conf2.diagramMarginY;
|
1033 | const width = LEFT_MARGIN + box.stopx + 2 * conf2.diagramMarginX;
|
1034 | configureSvgSize(diagram2, height, width, conf2.useMaxWidth);
|
1035 | diagram2.append("line").attr("x1", LEFT_MARGIN).attr("y1", conf2.height * 4).attr("x2", width - LEFT_MARGIN - 4).attr("y2", conf2.height * 4).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)");
|
1036 | const extraVertForTitle = title ? 70 : 0;
|
1037 | diagram2.attr("viewBox", `${box.startx} -25 ${width} ${height + extraVertForTitle}`);
|
1038 | diagram2.attr("preserveAspectRatio", "xMinYMin meet");
|
1039 | diagram2.attr("height", height + extraVertForTitle + 25);
|
1040 | };
|
1041 | const bounds = {
|
1042 | data: {
|
1043 | startx: void 0,
|
1044 | stopx: void 0,
|
1045 | starty: void 0,
|
1046 | stopy: void 0
|
1047 | },
|
1048 | verticalPos: 0,
|
1049 | sequenceItems: [],
|
1050 | init: function() {
|
1051 | this.sequenceItems = [];
|
1052 | this.data = {
|
1053 | startx: void 0,
|
1054 | stopx: void 0,
|
1055 | starty: void 0,
|
1056 | stopy: void 0
|
1057 | };
|
1058 | this.verticalPos = 0;
|
1059 | },
|
1060 | updateVal: function(obj, key, val, fun) {
|
1061 | if (obj[key] === void 0) {
|
1062 | obj[key] = val;
|
1063 | } else {
|
1064 | obj[key] = fun(val, obj[key]);
|
1065 | }
|
1066 | },
|
1067 | updateBounds: function(startx, starty, stopx, stopy) {
|
1068 | const conf2 = getConfig().journey;
|
1069 | const _self = this;
|
1070 | let cnt = 0;
|
1071 | function updateFn(type) {
|
1072 | return function updateItemBounds(item) {
|
1073 | cnt++;
|
1074 | const n = _self.sequenceItems.length - cnt + 1;
|
1075 | _self.updateVal(item, "starty", starty - n * conf2.boxMargin, Math.min);
|
1076 | _self.updateVal(item, "stopy", stopy + n * conf2.boxMargin, Math.max);
|
1077 | _self.updateVal(bounds.data, "startx", startx - n * conf2.boxMargin, Math.min);
|
1078 | _self.updateVal(bounds.data, "stopx", stopx + n * conf2.boxMargin, Math.max);
|
1079 | if (!(type === "activation")) {
|
1080 | _self.updateVal(item, "startx", startx - n * conf2.boxMargin, Math.min);
|
1081 | _self.updateVal(item, "stopx", stopx + n * conf2.boxMargin, Math.max);
|
1082 | _self.updateVal(bounds.data, "starty", starty - n * conf2.boxMargin, Math.min);
|
1083 | _self.updateVal(bounds.data, "stopy", stopy + n * conf2.boxMargin, Math.max);
|
1084 | }
|
1085 | };
|
1086 | }
|
1087 | this.sequenceItems.forEach(updateFn());
|
1088 | },
|
1089 | insert: function(startx, starty, stopx, stopy) {
|
1090 | const _startx = Math.min(startx, stopx);
|
1091 | const _stopx = Math.max(startx, stopx);
|
1092 | const _starty = Math.min(starty, stopy);
|
1093 | const _stopy = Math.max(starty, stopy);
|
1094 | this.updateVal(bounds.data, "startx", _startx, Math.min);
|
1095 | this.updateVal(bounds.data, "starty", _starty, Math.min);
|
1096 | this.updateVal(bounds.data, "stopx", _stopx, Math.max);
|
1097 | this.updateVal(bounds.data, "stopy", _stopy, Math.max);
|
1098 | this.updateBounds(_startx, _starty, _stopx, _stopy);
|
1099 | },
|
1100 | bumpVerticalPos: function(bump) {
|
1101 | this.verticalPos = this.verticalPos + bump;
|
1102 | this.data.stopy = this.verticalPos;
|
1103 | },
|
1104 | getVerticalPos: function() {
|
1105 | return this.verticalPos;
|
1106 | },
|
1107 | getBounds: function() {
|
1108 | return this.data;
|
1109 | }
|
1110 | };
|
1111 | const fills = conf.sectionFills;
|
1112 | const textColours = conf.sectionColours;
|
1113 | const drawTasks = function(diagram2, tasks2, verticalPos) {
|
1114 | const conf2 = getConfig().journey;
|
1115 | let lastSection = "";
|
1116 | const sectionVHeight = conf2.height * 2 + conf2.diagramMarginY;
|
1117 | const taskPos = verticalPos + sectionVHeight;
|
1118 | let sectionNumber = 0;
|
1119 | let fill = "#CCC";
|
1120 | let colour = "black";
|
1121 | let num = 0;
|
1122 | for (const [i, task] of tasks2.entries()) {
|
1123 | if (lastSection !== task.section) {
|
1124 | fill = fills[sectionNumber % fills.length];
|
1125 | num = sectionNumber % fills.length;
|
1126 | colour = textColours[sectionNumber % textColours.length];
|
1127 | let taskInSectionCount = 0;
|
1128 | const currentSection2 = task.section;
|
1129 | for (let taskIndex = i; taskIndex < tasks2.length; taskIndex++) {
|
1130 | if (tasks2[taskIndex].section == currentSection2) {
|
1131 | taskInSectionCount = taskInSectionCount + 1;
|
1132 | } else {
|
1133 | break;
|
1134 | }
|
1135 | }
|
1136 | const section = {
|
1137 | x: i * conf2.taskMargin + i * conf2.width + LEFT_MARGIN,
|
1138 | y: 50,
|
1139 | text: task.section,
|
1140 | fill,
|
1141 | num,
|
1142 | colour,
|
1143 | taskCount: taskInSectionCount
|
1144 | };
|
1145 | svgDraw.drawSection(diagram2, section, conf2);
|
1146 | lastSection = task.section;
|
1147 | sectionNumber++;
|
1148 | }
|
1149 | const taskActors = task.people.reduce((acc, actorName) => {
|
1150 | if (actors[actorName]) {
|
1151 | acc[actorName] = actors[actorName];
|
1152 | }
|
1153 | return acc;
|
1154 | }, {});
|
1155 | task.x = i * conf2.taskMargin + i * conf2.width + LEFT_MARGIN;
|
1156 | task.y = taskPos;
|
1157 | task.width = conf2.diagramMarginX;
|
1158 | task.height = conf2.diagramMarginY;
|
1159 | task.colour = colour;
|
1160 | task.fill = fill;
|
1161 | task.num = num;
|
1162 | task.actors = taskActors;
|
1163 | svgDraw.drawTask(diagram2, task, conf2);
|
1164 | bounds.insert(task.x, task.y, task.x + task.width + conf2.taskMargin, 300 + 5 * 30);
|
1165 | }
|
1166 | };
|
1167 | const renderer = {
|
1168 | setConf,
|
1169 | draw
|
1170 | };
|
1171 | const diagram = {
|
1172 | parser: parser$1,
|
1173 | db,
|
1174 | renderer,
|
1175 | styles,
|
1176 | init: (cnf) => {
|
1177 | renderer.setConf(cnf.journey);
|
1178 | db.clear();
|
1179 | }
|
1180 | };
|
1181 | export {
|
1182 | diagram
|
1183 | };
|