2020-06-17 18:12:01 -04:00
|
|
|
import mermaidAPI from '../../mermaidAPI';
|
2020-07-29 18:38:59 +02:00
|
|
|
import * as configApi from '../../config';
|
2021-02-06 15:56:05 +05:30
|
|
|
import { log } from '../../logger';
|
2021-10-07 21:48:44 +02:00
|
|
|
import { sanitizeText } from '../common/common';
|
2017-09-10 19:41:34 +08:00
|
|
|
|
2020-04-23 17:02:37 +03:00
|
|
|
let prevActor = undefined;
|
2019-09-12 12:55:10 -07:00
|
|
|
let actors = {};
|
|
|
|
let messages = [];
|
|
|
|
const notes = [];
|
|
|
|
let title = '';
|
2022-03-17 16:18:10 +00:00
|
|
|
let description = '';
|
2020-02-16 15:26:08 +01:00
|
|
|
let sequenceNumbersEnabled = false;
|
2020-06-08 14:48:03 -04:00
|
|
|
let wrapEnabled = false;
|
2020-06-11 15:31:59 -04:00
|
|
|
|
2021-07-15 11:35:12 +02:00
|
|
|
export const parseDirective = function (statement, context, type) {
|
2020-07-27 06:50:54 -04:00
|
|
|
mermaidAPI.parseDirective(this, statement, context, type);
|
2020-06-11 15:31:59 -04:00
|
|
|
};
|
2020-04-23 17:02:37 +03:00
|
|
|
|
2021-09-16 20:43:10 +02:00
|
|
|
export const addActor = function (id, name, description, type) {
|
2017-04-16 23:48:36 +08:00
|
|
|
// Don't allow description nulling
|
2019-09-12 12:55:10 -07:00
|
|
|
const old = actors[id];
|
|
|
|
if (old && name === old.name && description == null) return;
|
2015-12-06 05:53:08 -05:00
|
|
|
|
2017-04-16 23:48:36 +08:00
|
|
|
// Don't allow null descriptions, either
|
2020-06-11 15:31:59 -04:00
|
|
|
if (description == null || description.text == null) {
|
2021-09-16 20:43:10 +02:00
|
|
|
description = { text: name, wrap: null, type };
|
|
|
|
}
|
|
|
|
if (type == null || description.text == null) {
|
|
|
|
description = { text: name, wrap: null, type };
|
2020-06-11 15:31:59 -04:00
|
|
|
}
|
2019-09-12 12:55:10 -07:00
|
|
|
|
2020-06-11 15:31:59 -04:00
|
|
|
actors[id] = {
|
|
|
|
name: name,
|
|
|
|
description: description.text,
|
2020-06-17 05:54:24 -04:00
|
|
|
wrap: (description.wrap === undefined && autoWrap()) || !!description.wrap,
|
2021-08-27 10:56:56 -07:00
|
|
|
prevActor: prevActor,
|
|
|
|
links: {},
|
|
|
|
properties: {},
|
|
|
|
actorCnt: null,
|
|
|
|
rectData: null,
|
2021-09-18 10:05:53 +02:00
|
|
|
type: type || 'participant',
|
2020-06-11 15:31:59 -04:00
|
|
|
};
|
2020-04-23 17:02:37 +03:00
|
|
|
if (prevActor && actors[prevActor]) {
|
2020-04-23 18:31:22 +03:00
|
|
|
actors[prevActor].nextActor = id;
|
2020-04-23 17:02:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
prevActor = id;
|
2019-09-12 12:55:10 -07:00
|
|
|
};
|
|
|
|
|
2021-07-15 11:35:12 +02:00
|
|
|
const activationCount = (part) => {
|
2020-06-11 15:31:59 -04:00
|
|
|
let i;
|
2020-01-15 20:27:31 +01:00
|
|
|
let count = 0;
|
|
|
|
for (i = 0; i < messages.length; i++) {
|
|
|
|
if (messages[i].type === LINETYPE.ACTIVE_START) {
|
|
|
|
if (messages[i].from.actor === part) {
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (messages[i].type === LINETYPE.ACTIVE_END) {
|
|
|
|
if (messages[i].from.actor === part) {
|
|
|
|
count--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return count;
|
|
|
|
};
|
|
|
|
|
2021-07-15 11:35:12 +02:00
|
|
|
export const addMessage = function (idFrom, idTo, message, answer) {
|
2020-06-11 15:31:59 -04:00
|
|
|
messages.push({
|
|
|
|
from: idFrom,
|
|
|
|
to: idTo,
|
|
|
|
message: message.text,
|
2020-06-17 05:54:24 -04:00
|
|
|
wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap,
|
2021-07-15 11:35:12 +02:00
|
|
|
answer: answer,
|
2020-06-11 15:31:59 -04:00
|
|
|
});
|
2019-09-12 12:55:10 -07:00
|
|
|
};
|
|
|
|
|
2021-07-15 11:35:12 +02:00
|
|
|
export const addSignal = function (
|
2020-06-17 05:54:24 -04:00
|
|
|
idFrom,
|
|
|
|
idTo,
|
|
|
|
message = { text: undefined, wrap: undefined },
|
|
|
|
messageType
|
|
|
|
) {
|
2020-01-15 20:27:31 +01:00
|
|
|
if (messageType === LINETYPE.ACTIVE_END) {
|
|
|
|
const cnt = activationCount(idFrom.actor);
|
|
|
|
if (cnt < 1) {
|
|
|
|
// Bail out as there is an activation signal from an inactive participant
|
2020-06-11 15:31:59 -04:00
|
|
|
let error = new Error('Trying to inactivate an inactive participant (' + idFrom.actor + ')');
|
2020-01-15 20:27:31 +01:00
|
|
|
error.hash = {
|
|
|
|
text: '->>-',
|
|
|
|
token: '->>-',
|
|
|
|
line: '1',
|
|
|
|
loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
2021-07-15 11:35:12 +02:00
|
|
|
expected: ["'ACTIVE_PARTICIPANT'"],
|
2020-01-15 20:27:31 +01:00
|
|
|
};
|
|
|
|
throw error;
|
|
|
|
}
|
|
|
|
}
|
2020-06-11 15:31:59 -04:00
|
|
|
messages.push({
|
|
|
|
from: idFrom,
|
|
|
|
to: idTo,
|
|
|
|
message: message.text,
|
2020-06-17 05:54:24 -04:00
|
|
|
wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap,
|
2021-07-15 11:35:12 +02:00
|
|
|
type: messageType,
|
2020-06-11 15:31:59 -04:00
|
|
|
});
|
2020-01-15 20:27:31 +01:00
|
|
|
return true;
|
2019-09-12 12:55:10 -07:00
|
|
|
};
|
|
|
|
|
2021-07-15 11:35:12 +02:00
|
|
|
export const getMessages = function () {
|
2019-09-12 12:55:10 -07:00
|
|
|
return messages;
|
|
|
|
};
|
|
|
|
|
2021-07-15 11:35:12 +02:00
|
|
|
export const getActors = function () {
|
2019-09-12 12:55:10 -07:00
|
|
|
return actors;
|
|
|
|
};
|
2021-07-15 11:35:12 +02:00
|
|
|
export const getActor = function (id) {
|
2019-09-12 12:55:10 -07:00
|
|
|
return actors[id];
|
|
|
|
};
|
2021-07-15 11:35:12 +02:00
|
|
|
export const getActorKeys = function () {
|
2019-09-12 12:55:10 -07:00
|
|
|
return Object.keys(actors);
|
|
|
|
};
|
2021-07-15 11:35:12 +02:00
|
|
|
export const getTitle = function () {
|
2019-09-12 12:55:10 -07:00
|
|
|
return title;
|
|
|
|
};
|
2021-07-15 11:35:12 +02:00
|
|
|
export const enableSequenceNumbers = function () {
|
2020-02-16 15:26:08 +01:00
|
|
|
sequenceNumbersEnabled = true;
|
|
|
|
};
|
|
|
|
export const showSequenceNumbers = () => sequenceNumbersEnabled;
|
2019-09-12 12:55:10 -07:00
|
|
|
|
2021-07-15 11:35:12 +02:00
|
|
|
export const setWrap = function (wrapSetting) {
|
2020-06-17 05:54:24 -04:00
|
|
|
wrapEnabled = wrapSetting;
|
2020-06-08 14:48:03 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
export const autoWrap = () => wrapEnabled;
|
|
|
|
|
2021-07-15 11:35:12 +02:00
|
|
|
export const clear = function () {
|
2019-09-12 12:55:10 -07:00
|
|
|
actors = {};
|
|
|
|
messages = [];
|
2022-03-11 16:32:04 +08:00
|
|
|
sequenceNumbersEnabled = false;
|
2020-06-11 15:31:59 -04:00
|
|
|
};
|
|
|
|
|
2021-07-15 11:35:12 +02:00
|
|
|
export const parseMessage = function (str) {
|
2020-06-11 15:31:59 -04:00
|
|
|
const _str = str.trim();
|
2020-07-01 07:41:18 -04:00
|
|
|
const message = {
|
2020-06-11 15:31:59 -04:00
|
|
|
text: _str.replace(/^[:]?(?:no)?wrap:/, '').trim(),
|
|
|
|
wrap:
|
2020-12-11 20:30:24 -05:00
|
|
|
_str.match(/^[:]?wrap:/) !== null
|
2020-06-11 15:31:59 -04:00
|
|
|
? true
|
|
|
|
: _str.match(/^[:]?nowrap:/) !== null
|
|
|
|
? false
|
2021-07-15 11:35:12 +02:00
|
|
|
: undefined,
|
2020-06-11 15:31:59 -04:00
|
|
|
};
|
2021-02-06 15:56:05 +05:30
|
|
|
log.debug('parseMessage:', message);
|
2020-07-01 07:41:18 -04:00
|
|
|
return message;
|
2019-09-12 12:55:10 -07:00
|
|
|
};
|
2014-12-04 17:58:05 +01:00
|
|
|
|
2017-09-10 21:23:04 +08:00
|
|
|
export const LINETYPE = {
|
2017-04-11 22:14:25 +08:00
|
|
|
SOLID: 0,
|
|
|
|
DOTTED: 1,
|
|
|
|
NOTE: 2,
|
|
|
|
SOLID_CROSS: 3,
|
|
|
|
DOTTED_CROSS: 4,
|
|
|
|
SOLID_OPEN: 5,
|
|
|
|
DOTTED_OPEN: 6,
|
|
|
|
LOOP_START: 10,
|
|
|
|
LOOP_END: 11,
|
|
|
|
ALT_START: 12,
|
|
|
|
ALT_ELSE: 13,
|
|
|
|
ALT_END: 14,
|
|
|
|
OPT_START: 15,
|
|
|
|
OPT_END: 16,
|
|
|
|
ACTIVE_START: 17,
|
|
|
|
ACTIVE_END: 18,
|
|
|
|
PAR_START: 19,
|
|
|
|
PAR_AND: 20,
|
2019-07-22 22:47:49 -07:00
|
|
|
PAR_END: 21,
|
|
|
|
RECT_START: 22,
|
2021-01-11 23:09:37 +01:00
|
|
|
RECT_END: 23,
|
|
|
|
SOLID_POINT: 24,
|
2021-07-15 11:35:12 +02:00
|
|
|
DOTTED_POINT: 25,
|
2019-09-12 12:55:10 -07:00
|
|
|
};
|
2014-12-04 17:58:05 +01:00
|
|
|
|
2017-09-10 21:23:04 +08:00
|
|
|
export const ARROWTYPE = {
|
2017-04-11 22:14:25 +08:00
|
|
|
FILLED: 0,
|
2021-07-15 11:35:12 +02:00
|
|
|
OPEN: 1,
|
2019-09-12 12:55:10 -07:00
|
|
|
};
|
2014-12-04 17:58:05 +01:00
|
|
|
|
2017-09-10 21:23:04 +08:00
|
|
|
export const PLACEMENT = {
|
2017-04-11 22:14:25 +08:00
|
|
|
LEFTOF: 0,
|
|
|
|
RIGHTOF: 1,
|
2021-07-15 11:35:12 +02:00
|
|
|
OVER: 2,
|
2019-09-12 12:55:10 -07:00
|
|
|
};
|
2014-12-04 17:58:05 +01:00
|
|
|
|
2021-07-15 11:35:12 +02:00
|
|
|
export const addNote = function (actor, placement, message) {
|
2020-06-11 15:31:59 -04:00
|
|
|
const note = {
|
|
|
|
actor: actor,
|
|
|
|
placement: placement,
|
|
|
|
message: message.text,
|
2021-07-15 11:35:12 +02:00
|
|
|
wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap,
|
2020-06-11 15:31:59 -04:00
|
|
|
};
|
2014-12-04 17:58:05 +01:00
|
|
|
|
2017-04-16 23:48:36 +08:00
|
|
|
// Coerce actor into a [to, from, ...] array
|
2019-09-12 12:55:10 -07:00
|
|
|
const actors = [].concat(actor, actor);
|
|
|
|
|
|
|
|
notes.push(note);
|
|
|
|
messages.push({
|
|
|
|
from: actors[0],
|
|
|
|
to: actors[1],
|
2020-06-11 15:31:59 -04:00
|
|
|
message: message.text,
|
2020-06-17 05:54:24 -04:00
|
|
|
wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap,
|
2019-09-12 12:55:10 -07:00
|
|
|
type: LINETYPE.NOTE,
|
2021-07-15 11:35:12 +02:00
|
|
|
placement: placement,
|
2019-09-12 12:55:10 -07:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2021-08-27 10:56:56 -07:00
|
|
|
export const addLinks = function (actorId, text) {
|
|
|
|
// find the actor
|
|
|
|
const actor = getActor(actorId);
|
|
|
|
// JSON.parse the text
|
|
|
|
try {
|
2021-10-07 21:48:44 +02:00
|
|
|
let sanitizedText = sanitizeText(text.text, configApi.getConfig());
|
2021-10-14 21:08:42 +02:00
|
|
|
sanitizedText = sanitizedText.replace(/&/g, '&');
|
|
|
|
sanitizedText = sanitizedText.replace(/=/g, '=');
|
2021-10-07 21:48:44 +02:00
|
|
|
const links = JSON.parse(sanitizedText);
|
2021-08-27 10:56:56 -07:00
|
|
|
// add the deserialized text to the actor's links field.
|
|
|
|
insertLinks(actor, links);
|
2021-09-10 16:27:07 -07:00
|
|
|
} catch (e) {
|
|
|
|
log.error('error while parsing actor link text', e);
|
2021-08-27 10:56:56 -07:00
|
|
|
}
|
2021-09-10 16:27:07 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
export const addALink = function (actorId, text) {
|
|
|
|
// find the actor
|
|
|
|
const actor = getActor(actorId);
|
|
|
|
try {
|
|
|
|
const links = {};
|
2021-10-07 21:48:44 +02:00
|
|
|
let sanitizedText = sanitizeText(text.text, configApi.getConfig());
|
|
|
|
var sep = sanitizedText.indexOf('@');
|
2021-10-14 21:08:42 +02:00
|
|
|
sanitizedText = sanitizedText.replace(/&/g, '&');
|
|
|
|
sanitizedText = sanitizedText.replace(/=/g, '=');
|
2021-10-07 21:48:44 +02:00
|
|
|
var label = sanitizedText.slice(0, sep - 1).trim();
|
|
|
|
var link = sanitizedText.slice(sep + 1).trim();
|
2021-09-10 16:27:07 -07:00
|
|
|
|
|
|
|
links[label] = link;
|
|
|
|
// add the deserialized text to the actor's links field.
|
|
|
|
insertLinks(actor, links);
|
|
|
|
} catch (e) {
|
2021-08-27 10:56:56 -07:00
|
|
|
log.error('error while parsing actor link text', e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-11-08 22:06:24 +01:00
|
|
|
/**
|
|
|
|
* @param {any} actor
|
|
|
|
* @param {any} links
|
|
|
|
*/
|
2021-08-27 10:56:56 -07:00
|
|
|
function insertLinks(actor, links) {
|
|
|
|
if (actor.links == null) {
|
|
|
|
actor.links = links;
|
2021-09-10 16:27:07 -07:00
|
|
|
} else {
|
2021-08-27 10:56:56 -07:00
|
|
|
for (let key in links) {
|
|
|
|
actor.links[key] = links[key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const addProperties = function (actorId, text) {
|
|
|
|
// find the actor
|
|
|
|
const actor = getActor(actorId);
|
|
|
|
// JSON.parse the text
|
|
|
|
try {
|
2021-10-07 21:48:44 +02:00
|
|
|
let sanitizedText = sanitizeText(text.text, configApi.getConfig());
|
|
|
|
const properties = JSON.parse(sanitizedText);
|
2021-08-27 10:56:56 -07:00
|
|
|
// add the deserialized text to the actor's property field.
|
|
|
|
insertProperties(actor, properties);
|
2021-09-10 16:27:07 -07:00
|
|
|
} catch (e) {
|
2021-08-27 10:56:56 -07:00
|
|
|
log.error('error while parsing actor properties text', e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-11-08 22:06:24 +01:00
|
|
|
/**
|
|
|
|
* @param {any} actor
|
|
|
|
* @param {any} properties
|
|
|
|
*/
|
2021-08-27 10:56:56 -07:00
|
|
|
function insertProperties(actor, properties) {
|
|
|
|
if (actor.properties == null) {
|
|
|
|
actor.properties = properties;
|
2021-09-10 16:27:07 -07:00
|
|
|
} else {
|
2021-08-27 10:56:56 -07:00
|
|
|
for (let key in properties) {
|
|
|
|
actor.properties[key] = properties[key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const addDetails = function (actorId, text) {
|
|
|
|
// find the actor
|
|
|
|
const actor = getActor(actorId);
|
|
|
|
const elem = document.getElementById(text.text);
|
|
|
|
|
|
|
|
// JSON.parse the text
|
|
|
|
try {
|
|
|
|
const text = elem.innerHTML;
|
|
|
|
const details = JSON.parse(text);
|
|
|
|
// add the deserialized text to the actor's property field.
|
2021-09-10 16:27:07 -07:00
|
|
|
if (details['properties']) {
|
|
|
|
insertProperties(actor, details['properties']);
|
2021-08-27 10:56:56 -07:00
|
|
|
}
|
|
|
|
|
2021-09-10 16:27:07 -07:00
|
|
|
if (details['links']) {
|
|
|
|
insertLinks(actor, details['links']);
|
2021-08-27 10:56:56 -07:00
|
|
|
}
|
2021-09-10 16:27:07 -07:00
|
|
|
} catch (e) {
|
2021-08-27 10:56:56 -07:00
|
|
|
log.error('error while parsing actor details text', e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getActorProperty = function (actor, key) {
|
|
|
|
if (typeof actor !== 'undefined' && typeof actor.properties !== 'undefined') {
|
|
|
|
return actor.properties[key];
|
|
|
|
}
|
|
|
|
|
|
|
|
return undefined;
|
2021-09-14 14:26:43 -07:00
|
|
|
};
|
2021-08-27 10:56:56 -07:00
|
|
|
|
2022-03-17 19:48:22 +00:00
|
|
|
export const setTitle = function (txt) {
|
|
|
|
let sanitizedText = sanitizeText(txt, configApi.getConfig());
|
|
|
|
title = sanitizedText;
|
2019-09-12 12:55:10 -07:00
|
|
|
};
|
|
|
|
|
2021-07-15 11:35:12 +02:00
|
|
|
export const apply = function (param) {
|
2017-04-11 22:14:25 +08:00
|
|
|
if (param instanceof Array) {
|
2021-07-15 11:35:12 +02:00
|
|
|
param.forEach(function (item) {
|
2019-09-12 12:55:10 -07:00
|
|
|
apply(item);
|
|
|
|
});
|
2017-04-11 22:14:25 +08:00
|
|
|
} else {
|
|
|
|
switch (param.type) {
|
2021-09-16 20:43:10 +02:00
|
|
|
case 'addParticipant':
|
|
|
|
addActor(param.actor, param.actor, param.description, 'participant');
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'addActor':
|
2021-09-16 20:43:10 +02:00
|
|
|
addActor(param.actor, param.actor, param.description, 'actor');
|
2019-09-12 12:55:10 -07:00
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'activeStart':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(param.actor, undefined, undefined, param.signalType);
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'activeEnd':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(param.actor, undefined, undefined, param.signalType);
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'addNote':
|
2019-09-12 12:55:10 -07:00
|
|
|
addNote(param.actor, param.placement, param.text);
|
|
|
|
break;
|
2021-08-27 10:56:56 -07:00
|
|
|
case 'addLinks':
|
|
|
|
addLinks(param.actor, param.text);
|
|
|
|
break;
|
2021-09-10 16:27:07 -07:00
|
|
|
case 'addALink':
|
|
|
|
addALink(param.actor, param.text);
|
|
|
|
break;
|
2021-08-27 10:56:56 -07:00
|
|
|
case 'addProperties':
|
|
|
|
addProperties(param.actor, param.text);
|
|
|
|
break;
|
|
|
|
case 'addDetails':
|
|
|
|
addDetails(param.actor, param.text);
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'addMessage':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(param.from, param.to, param.msg, param.signalType);
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'loopStart':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(undefined, undefined, param.loopText, param.signalType);
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'loopEnd':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(undefined, undefined, undefined, param.signalType);
|
|
|
|
break;
|
2019-07-22 22:47:49 -07:00
|
|
|
case 'rectStart':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(undefined, undefined, param.color, param.signalType);
|
|
|
|
break;
|
2019-07-22 22:47:49 -07:00
|
|
|
case 'rectEnd':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(undefined, undefined, undefined, param.signalType);
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'optStart':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(undefined, undefined, param.optText, param.signalType);
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'optEnd':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(undefined, undefined, undefined, param.signalType);
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'altStart':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(undefined, undefined, param.altText, param.signalType);
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'else':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(undefined, undefined, param.altText, param.signalType);
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'altEnd':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(undefined, undefined, undefined, param.signalType);
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'setTitle':
|
2019-09-12 12:55:10 -07:00
|
|
|
setTitle(param.text);
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'parStart':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(undefined, undefined, param.parText, param.signalType);
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'and':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(undefined, undefined, param.parText, param.signalType);
|
|
|
|
break;
|
2017-04-11 22:14:25 +08:00
|
|
|
case 'parEnd':
|
2019-09-12 12:55:10 -07:00
|
|
|
addSignal(undefined, undefined, undefined, param.signalType);
|
|
|
|
break;
|
2015-01-04 17:56:58 +01:00
|
|
|
}
|
2017-04-11 22:14:25 +08:00
|
|
|
}
|
2019-09-12 12:55:10 -07:00
|
|
|
};
|
2017-09-10 21:51:48 +08:00
|
|
|
|
2022-03-17 16:18:10 +00:00
|
|
|
const setAccDescription = function (description_lex) {
|
2022-03-17 19:48:22 +00:00
|
|
|
let sanitizedText = sanitizeText(description_lex, configApi.getConfig());
|
|
|
|
description = sanitizedText;
|
2022-03-17 16:18:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const getAccDescription = function () {
|
|
|
|
return description;
|
|
|
|
};
|
|
|
|
|
2017-09-10 21:51:48 +08:00
|
|
|
export default {
|
|
|
|
addActor,
|
|
|
|
addMessage,
|
|
|
|
addSignal,
|
2021-08-27 10:56:56 -07:00
|
|
|
addLinks,
|
|
|
|
addDetails,
|
|
|
|
addProperties,
|
2020-06-17 05:54:24 -04:00
|
|
|
autoWrap,
|
|
|
|
setWrap,
|
2020-02-16 15:26:08 +01:00
|
|
|
enableSequenceNumbers,
|
|
|
|
showSequenceNumbers,
|
2017-09-10 21:51:48 +08:00
|
|
|
getMessages,
|
|
|
|
getActors,
|
|
|
|
getActor,
|
|
|
|
getActorKeys,
|
2021-08-27 10:56:56 -07:00
|
|
|
getActorProperty,
|
2017-09-10 21:51:48 +08:00
|
|
|
getTitle,
|
2020-06-14 06:53:22 -04:00
|
|
|
parseDirective,
|
2020-06-26 09:26:56 -04:00
|
|
|
getConfig: () => configApi.getConfig().sequence,
|
2017-09-10 21:51:48 +08:00
|
|
|
clear,
|
2020-06-11 15:31:59 -04:00
|
|
|
parseMessage,
|
2017-09-10 21:51:48 +08:00
|
|
|
LINETYPE,
|
|
|
|
ARROWTYPE,
|
|
|
|
PLACEMENT,
|
|
|
|
addNote,
|
|
|
|
setTitle,
|
2021-07-15 11:35:12 +02:00
|
|
|
apply,
|
2022-03-17 16:18:10 +00:00
|
|
|
setAccDescription,
|
|
|
|
getAccDescription,
|
2019-09-12 12:55:10 -07:00
|
|
|
};
|