state-machine-cat 12.0.16 → 12.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/actions.mjs +1 -1
- package/dist/cli/normalize.mjs +2 -2
- package/dist/index.mjs +5 -4
- package/dist/options.mjs +2 -2
- package/dist/parse/parser-helpers.mjs +13 -5
- package/dist/parse/smcat/smcat-parser.mjs +3 -1
- package/dist/parse/smcat-ast.schema.mjs +3 -0
- package/dist/render/dot/attributebuilder.mjs +20 -14
- package/dist/render/dot/index.mjs +244 -145
- package/dist/render/dot/utl.mjs +82 -11
- package/dist/render/index-node.mjs +1 -0
- package/dist/render/scjson/make-valid-event-names.mjs +1 -1
- package/dist/render/smcat.mjs +5 -6
- package/dist/state-machine-model.mjs +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +3 -8
- package/types/state-machine-cat.d.mts +4 -0
- package/dist/render/dot/counter.mjs +0 -16
- package/dist/render/dot/dot.states.template.cjs +0 -1
- package/dist/render/dot/dot.template.cjs +0 -1
- package/dist/render/dot/render-dot-from-ast.mjs +0 -44
- package/dist/render/dot/state-transformers.mjs +0 -123
- package/dist/render/dot/transition-transformers.mjs +0 -47
package/dist/cli/actions.mjs
CHANGED
|
@@ -64,7 +64,7 @@ export function transform(pOptions) {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
export function formatError(pError) {
|
|
67
|
-
if (
|
|
67
|
+
if (pError.location) {
|
|
68
68
|
return `\n syntax error on line ${pError.location.start.line}, column ${pError.location.start.column}:\n ${pError.message}\n\n`;
|
|
69
69
|
}
|
|
70
70
|
return pError.message;
|
package/dist/cli/normalize.mjs
CHANGED
|
@@ -49,7 +49,7 @@ function deriveOutputFromInput(pInputFrom, pOutputType) {
|
|
|
49
49
|
.concat(lExtension);
|
|
50
50
|
}
|
|
51
51
|
function determineOutputTo(pOutputTo, pInputFrom, pOutputType) {
|
|
52
|
-
return pOutputTo
|
|
52
|
+
return pOutputTo ?? deriveOutputFromInput(pInputFrom, pOutputType);
|
|
53
53
|
}
|
|
54
54
|
function determineInputType(pInputFrom, pInputType) {
|
|
55
55
|
if (pInputType) {
|
|
@@ -80,7 +80,7 @@ function determineParameter(pOptions, pParameter) {
|
|
|
80
80
|
: options.getAllowedValues()[pParameter].default;
|
|
81
81
|
}
|
|
82
82
|
function determineDotAttributes(pOptions, pDotAttributes) {
|
|
83
|
-
return
|
|
83
|
+
return pOptions?.[pDotAttributes] &&
|
|
84
84
|
typeof pOptions[pDotAttributes] === "string"
|
|
85
85
|
? parseAttributes(pOptions[pDotAttributes])
|
|
86
86
|
: [];
|
package/dist/index.mjs
CHANGED
|
@@ -4,11 +4,12 @@ import desugar from "./transform/desugar.mjs";
|
|
|
4
4
|
import getRenderFunction from "./render/index.mjs";
|
|
5
5
|
import { version as _version } from "./version.mjs";
|
|
6
6
|
export function render(pScript, pOptions) {
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
7
|
+
const lOptions = pOptions ?? {};
|
|
8
|
+
const lStateMachine = parse.getAST(pScript, lOptions);
|
|
9
|
+
const lDesugar = options.getOptionValue(lOptions, "desugar");
|
|
10
|
+
return getRenderFunction(options.getOptionValue(lOptions, "outputType"))(
|
|
10
11
|
lDesugar ? desugar(lStateMachine) : lStateMachine,
|
|
11
|
-
|
|
12
|
+
lOptions,
|
|
12
13
|
);
|
|
13
14
|
}
|
|
14
15
|
export const version = _version;
|
package/dist/options.mjs
CHANGED
|
@@ -49,10 +49,10 @@ const ALLOWED_VALUES = Object.freeze({
|
|
|
49
49
|
values: [{ name: true }, { name: false }],
|
|
50
50
|
},
|
|
51
51
|
});
|
|
52
|
-
function getOptionValue(pOptions, pOptionName) {
|
|
52
|
+
export function getOptionValue(pOptions, pOptionName) {
|
|
53
53
|
return pOptions?.[pOptionName] ?? ALLOWED_VALUES[pOptionName].default;
|
|
54
54
|
}
|
|
55
|
-
function getAllowedValues() {
|
|
55
|
+
export function getAllowedValues() {
|
|
56
56
|
return ALLOWED_VALUES;
|
|
57
57
|
}
|
|
58
58
|
export default {
|
|
@@ -2,6 +2,7 @@ import StateMachineModel from "../state-machine-model.mjs";
|
|
|
2
2
|
const TRIGGER_RE_AS_A_STRING =
|
|
3
3
|
"^(entry|activity|exit)\\s*/\\s*([^\\n$]*)(\\n|$)";
|
|
4
4
|
const TRIGGER_RE = new RegExp(TRIGGER_RE_AS_A_STRING);
|
|
5
|
+
let gTransitionIdHwm = 0;
|
|
5
6
|
function stateExists(pKnownStateNames, pName) {
|
|
6
7
|
return pKnownStateNames.includes(pName);
|
|
7
8
|
}
|
|
@@ -60,9 +61,8 @@ function getAlreadyDeclaredStates(pStateMachine) {
|
|
|
60
61
|
);
|
|
61
62
|
}
|
|
62
63
|
function extractUndeclaredStates(pStateMachine, pKnownStateNames) {
|
|
63
|
-
pKnownStateNames =
|
|
64
|
-
|
|
65
|
-
: getAlreadyDeclaredStates(pStateMachine);
|
|
64
|
+
pKnownStateNames =
|
|
65
|
+
pKnownStateNames ?? getAlreadyDeclaredStates(pStateMachine);
|
|
66
66
|
pStateMachine.states = pStateMachine?.states ?? [];
|
|
67
67
|
const lTransitions = pStateMachine?.transitions ?? [];
|
|
68
68
|
pStateMachine.states.filter(isComposite).forEach((pState) => {
|
|
@@ -135,7 +135,7 @@ function uniq(pArray, pEqualFunction) {
|
|
|
135
135
|
function parseTransitionExpression(pString) {
|
|
136
136
|
const lTransitionExpressionRe = /([^[/]+)?(\[[^\]]+\])?[^/]*(\/.+)?/;
|
|
137
137
|
const lReturnValue = {};
|
|
138
|
-
const lMatchResult =
|
|
138
|
+
const lMatchResult = lTransitionExpressionRe.exec(pString);
|
|
139
139
|
const lEventPos = 1;
|
|
140
140
|
const lConditionPos = 2;
|
|
141
141
|
const lActionPos = 3;
|
|
@@ -161,7 +161,7 @@ function setIfNotEmpty(pObject, pProperty, pValue) {
|
|
|
161
161
|
setIf(pObject, pProperty, pValue, (pX) => pX && pX.length > 0);
|
|
162
162
|
}
|
|
163
163
|
function extractAction(pActivityCandidate) {
|
|
164
|
-
const lMatch =
|
|
164
|
+
const lMatch = TRIGGER_RE.exec(pActivityCandidate);
|
|
165
165
|
const lTypePos = 1;
|
|
166
166
|
const lBodyPos = 2;
|
|
167
167
|
if (lMatch) {
|
|
@@ -181,6 +181,12 @@ function extractActions(pString) {
|
|
|
181
181
|
.map((pActivityCandidate) => pActivityCandidate.trim())
|
|
182
182
|
.map(extractAction);
|
|
183
183
|
}
|
|
184
|
+
function nextTransitionId() {
|
|
185
|
+
return ++gTransitionIdHwm;
|
|
186
|
+
}
|
|
187
|
+
function resetTransitionId() {
|
|
188
|
+
gTransitionIdHwm = 0;
|
|
189
|
+
}
|
|
184
190
|
export default {
|
|
185
191
|
initState,
|
|
186
192
|
extractUndeclaredStates,
|
|
@@ -192,4 +198,6 @@ export default {
|
|
|
192
198
|
extractActions,
|
|
193
199
|
setIf,
|
|
194
200
|
setIfNotEmpty,
|
|
201
|
+
nextTransitionId,
|
|
202
|
+
resetTransitionId,
|
|
195
203
|
};
|
|
@@ -321,6 +321,7 @@ function peg$parse(input, options) {
|
|
|
321
321
|
var peg$e78 = peg$classExpectation(["\r", "\n"], true, false);
|
|
322
322
|
var peg$e79 = peg$otherExpectation("comment");
|
|
323
323
|
var peg$f0 = function (statemachine) {
|
|
324
|
+
parserHelpers.resetTransitionId();
|
|
324
325
|
statemachine.states = parserHelpers.extractUndeclaredStates(statemachine);
|
|
325
326
|
return parserHelpers.classifyForkJoins(statemachine);
|
|
326
327
|
};
|
|
@@ -375,7 +376,7 @@ function peg$parse(input, options) {
|
|
|
375
376
|
);
|
|
376
377
|
parserHelpers.setIf(lState, "statemachine", statemachine);
|
|
377
378
|
parserHelpers.setIfNotEmpty(lState, "note", notes);
|
|
378
|
-
if (
|
|
379
|
+
if (actions) {
|
|
379
380
|
parserHelpers.setIfNotEmpty(
|
|
380
381
|
lState,
|
|
381
382
|
"actions",
|
|
@@ -430,6 +431,7 @@ function peg$parse(input, options) {
|
|
|
430
431
|
),
|
|
431
432
|
);
|
|
432
433
|
parserHelpers.setIfNotEmpty(trans, "note", notes);
|
|
434
|
+
trans.id = parserHelpers.nextTransitionId();
|
|
433
435
|
return trans;
|
|
434
436
|
};
|
|
435
437
|
var peg$f20 = function (from_, to) {
|
|
@@ -36,19 +36,25 @@ const EDGE_ATTRIBUTES = [
|
|
|
36
36
|
function toNameValueString(pAttribute) {
|
|
37
37
|
return `${pAttribute.name}=${pAttribute.value}`;
|
|
38
38
|
}
|
|
39
|
+
export function buildGraphAttributes(pEngine, pDirection, pDotGraphAttributes) {
|
|
40
|
+
return GENERIC_GRAPH_ATTRIBUTES.concat(GRAPH_ATTRIBUTES[pEngine] || [])
|
|
41
|
+
.concat(DIRECTION_ATTRIBUTES[pDirection] || [])
|
|
42
|
+
.concat(pDotGraphAttributes || [])
|
|
43
|
+
.map(toNameValueString)
|
|
44
|
+
.join(" ");
|
|
45
|
+
}
|
|
46
|
+
export function buildNodeAttributes(pDotNodeAttributes) {
|
|
47
|
+
return NODE_ATTRIBUTES.concat(pDotNodeAttributes || [])
|
|
48
|
+
.map(toNameValueString)
|
|
49
|
+
.join(" ");
|
|
50
|
+
}
|
|
51
|
+
export function buildEdgeAttributes(pDotEdgeAttributes) {
|
|
52
|
+
return EDGE_ATTRIBUTES.concat(pDotEdgeAttributes || [])
|
|
53
|
+
.map(toNameValueString)
|
|
54
|
+
.join(" ");
|
|
55
|
+
}
|
|
39
56
|
export default {
|
|
40
|
-
buildGraphAttributes
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
.concat(pDotGraphAttributes || [])
|
|
44
|
-
.map(toNameValueString)
|
|
45
|
-
.join(" "),
|
|
46
|
-
buildNodeAttributes: (pDotNodeAttributes) =>
|
|
47
|
-
NODE_ATTRIBUTES.concat(pDotNodeAttributes || [])
|
|
48
|
-
.map(toNameValueString)
|
|
49
|
-
.join(" "),
|
|
50
|
-
buildEdgeAttributes: (pDotEdgeAttributes) =>
|
|
51
|
-
EDGE_ATTRIBUTES.concat(pDotEdgeAttributes || [])
|
|
52
|
-
.map(toNameValueString)
|
|
53
|
-
.join(" "),
|
|
57
|
+
buildGraphAttributes,
|
|
58
|
+
buildNodeAttributes,
|
|
59
|
+
buildEdgeAttributes,
|
|
54
60
|
};
|
|
@@ -1,152 +1,251 @@
|
|
|
1
|
-
import
|
|
1
|
+
import he from "he";
|
|
2
|
+
import { getOptionValue } from "../../options.mjs";
|
|
2
3
|
import StateMachineModel from "../../state-machine-model.mjs";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
4
|
+
import {
|
|
5
|
+
buildGraphAttributes,
|
|
6
|
+
buildNodeAttributes,
|
|
7
|
+
buildEdgeAttributes,
|
|
8
|
+
} from "./attributebuilder.mjs";
|
|
9
|
+
import {
|
|
10
|
+
escapeLabelString,
|
|
11
|
+
formatActionType,
|
|
12
|
+
getTransitionPorts,
|
|
13
|
+
isCompositeSelf,
|
|
14
|
+
isVertical,
|
|
15
|
+
noteToLabel,
|
|
16
|
+
normalizeState,
|
|
17
|
+
stateNote,
|
|
18
|
+
} from "./utl.mjs";
|
|
19
|
+
function initial(pState, pIndent) {
|
|
20
|
+
const lActiveAttribute = pState.active ? " penwidth=3.0" : "";
|
|
21
|
+
return `${pIndent} "${pState.name}" [shape=circle style=filled class="${pState.class}" color="${pState.color}" fillcolor="${pState.color}" fixedsize=true height=0.15 label=""${lActiveAttribute}]${pState.noteText}`;
|
|
22
|
+
}
|
|
23
|
+
function regularStateActions(pActions, pIndent) {
|
|
24
|
+
return pActions
|
|
25
|
+
.map((pAction) =>
|
|
26
|
+
he.escape(`${formatActionType(pAction.type)}${pAction.body}`),
|
|
27
|
+
)
|
|
28
|
+
.map((pActionString, pIndex) => {
|
|
29
|
+
let lReturnValue = `<tr><td align="left" cellpadding="2">${pActionString}</td></tr>`;
|
|
30
|
+
if (pIndex === 0) {
|
|
31
|
+
lReturnValue = `<hr/>${lReturnValue}`;
|
|
32
|
+
}
|
|
33
|
+
return `\n${pIndent} ${lReturnValue}`;
|
|
34
|
+
})
|
|
35
|
+
.join("");
|
|
36
|
+
}
|
|
37
|
+
function compositeStateActions(pActions, pIndent) {
|
|
38
|
+
return pActions
|
|
39
|
+
.map((pAction) =>
|
|
40
|
+
he.escape(`${formatActionType(pAction.type)}${pAction.body}`),
|
|
41
|
+
)
|
|
42
|
+
.map((pActionString, pIndex) => {
|
|
43
|
+
let lReturnValue = `<tr><td align="left">${pActionString}</td></tr>`;
|
|
44
|
+
if (pIndex === 0) {
|
|
45
|
+
lReturnValue = `<hr/>${lReturnValue}`;
|
|
46
|
+
}
|
|
47
|
+
return `\n${pIndent} ${lReturnValue}`;
|
|
48
|
+
})
|
|
49
|
+
.join("");
|
|
50
|
+
}
|
|
51
|
+
function atomicRegular(pState, pIndent) {
|
|
52
|
+
const lActiveAttribute = pState.active ? " peripheries=1 style=rounded" : "";
|
|
53
|
+
const lCellPadding = (pState.actions?.length ?? 0) > 0 ? 2 : 7;
|
|
54
|
+
const lActions = regularStateActions(pState?.actions ?? [], pIndent);
|
|
55
|
+
const lLabel = pState.active ? `<i>${pState.label}</i>` : pState.label;
|
|
56
|
+
const lLabelTag = `
|
|
57
|
+
${pIndent} <table align="center" cellborder="0" border="2" style="rounded" width="48">
|
|
58
|
+
${pIndent} <tr><td width="48" cellpadding="${lCellPadding}">${lLabel}</td></tr>${lActions}
|
|
59
|
+
${pIndent} </table>`;
|
|
60
|
+
return `${pIndent} "${pState.name}" [margin=0 class="${pState.class}" label= <${lLabelTag}
|
|
61
|
+
${pIndent} >${pState.colorAttribute}${pState.fontColorAttribute}${lActiveAttribute}]${pState.noteText}`;
|
|
62
|
+
}
|
|
63
|
+
function compositeRegular(pState, pIndent, pOptions, pModel) {
|
|
64
|
+
const lPenWidth = pState.isParallelArea
|
|
65
|
+
? "1.0"
|
|
66
|
+
: pState.active
|
|
67
|
+
? "3.0"
|
|
68
|
+
: "2.0";
|
|
69
|
+
const lStyle = pState.isParallelArea ? "dashed" : "rounded";
|
|
70
|
+
const lActions = compositeStateActions(pState?.actions ?? [], pIndent);
|
|
71
|
+
const lLabel = pState.active ? `<i>${pState.label}</i>` : pState.label;
|
|
72
|
+
const lLabelTag = `${pIndent} <table cellborder="0" border="0">
|
|
73
|
+
${pIndent} <tr><td>${lLabel}</td></tr>${lActions}
|
|
74
|
+
${pIndent} </table>`;
|
|
75
|
+
const lSelfTransitionHelperPoints = pModel
|
|
76
|
+
.findExternalSelfTransitions(pState.name)
|
|
77
|
+
.map(
|
|
78
|
+
(pTransition) =>
|
|
79
|
+
`${pIndent} "self_tr_${pTransition.from}_${pTransition.to}_${pTransition.id}" [shape=point style=invis width=0 height=0 fixedsize=true]\n`,
|
|
80
|
+
)
|
|
81
|
+
.join("");
|
|
82
|
+
return `${lSelfTransitionHelperPoints}${pIndent} subgraph "cluster_${pState.name}" {
|
|
83
|
+
${pIndent} class="${pState.class}" label= <
|
|
84
|
+
${lLabelTag}
|
|
85
|
+
${pIndent} > style=${lStyle} penwidth=${lPenWidth}${pState.colorAttribute}${pState.fontColorAttribute}
|
|
86
|
+
${pIndent} "${pState.name}" [shape=point style=invis margin=0 width=0 height=0 fixedsize=true]
|
|
87
|
+
${states(pState?.statemachine?.states ?? [], `${pIndent} `, pOptions, pModel)}
|
|
88
|
+
${pIndent} }${pState.noteText}`;
|
|
89
|
+
}
|
|
90
|
+
function regular(pState, pIndent, pOptions, pModel) {
|
|
91
|
+
if (pState.statemachine) {
|
|
92
|
+
return compositeRegular(pState, pIndent, pOptions, pModel);
|
|
93
|
+
}
|
|
94
|
+
return atomicRegular(pState, pIndent);
|
|
95
|
+
}
|
|
96
|
+
function history(pState, pIndent) {
|
|
97
|
+
const lActiveAttribute = pState.active ? " peripheries=2 penwidth=3.0" : "";
|
|
98
|
+
return `${pIndent} "${pState.name}" [shape=circle class="${pState.class}" label="H"${pState.colorAttribute}${pState.fontColorAttribute}${lActiveAttribute}]${pState.noteText}`;
|
|
99
|
+
}
|
|
100
|
+
function deepHistory(pState, pIndent) {
|
|
101
|
+
const lActiveAttribute = pState.active ? " peripheries=2 penwidth=3.0" : "";
|
|
102
|
+
return `${pIndent} "${pState.name}" [shape=circle class="${pState.class}" label="H*"${pState.colorAttribute}${pState.fontColorAttribute}${lActiveAttribute}]${pState.noteText}`;
|
|
103
|
+
}
|
|
104
|
+
function choiceActions(pActions, pActive) {
|
|
105
|
+
return pActions
|
|
106
|
+
.map((pAction) => {
|
|
107
|
+
let lReturnValue = he.escape(
|
|
108
|
+
`${formatActionType(pAction.type)}${pAction.body}`,
|
|
33
109
|
);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
.map(stateTransformers.setLabel)
|
|
37
|
-
.map(stateTransformers.nameNote)
|
|
38
|
-
.map(stateTransformers.classifyState)
|
|
39
|
-
.map(stateTransformers.escapeStateStrings)
|
|
40
|
-
.map(stateTransformers.flattenNote)
|
|
41
|
-
.map(stateTransformers.flattenActions)
|
|
42
|
-
.map(stateTransformers.flagParallelChildren)
|
|
43
|
-
.map(stateTransformers.tipForkJoinStates(pDirection))
|
|
44
|
-
.map(stateTransformers.recolor(pNodeAttributes))
|
|
45
|
-
.map(addExternalSelfTransitions(pStateMachineModel));
|
|
46
|
-
}
|
|
47
|
-
function splitStates(pStateMachine) {
|
|
48
|
-
pStateMachine.initialStates = pStateMachine.states.filter(
|
|
49
|
-
stateTransformers.isType("initial"),
|
|
50
|
-
);
|
|
51
|
-
pStateMachine.regularStates = pStateMachine.states.filter(
|
|
52
|
-
(pState) =>
|
|
53
|
-
stateTransformers.isType("regular")(pState) && !pState.statemachine,
|
|
54
|
-
);
|
|
55
|
-
pStateMachine.historyStates = pStateMachine.states.filter(
|
|
56
|
-
stateTransformers.isType("history"),
|
|
57
|
-
);
|
|
58
|
-
pStateMachine.deepHistoryStates = pStateMachine.states.filter(
|
|
59
|
-
stateTransformers.isType("deephistory"),
|
|
60
|
-
);
|
|
61
|
-
pStateMachine.choiceStates = pStateMachine.states.filter(
|
|
62
|
-
stateTransformers.isType("choice"),
|
|
63
|
-
);
|
|
64
|
-
pStateMachine.forkjoinStates = pStateMachine.states.filter(
|
|
65
|
-
stateTransformers.isOneOfTypes(["fork", "join", "forkjoin"]),
|
|
66
|
-
);
|
|
67
|
-
pStateMachine.junctionStates = pStateMachine.states.filter(
|
|
68
|
-
stateTransformers.isType("junction"),
|
|
69
|
-
);
|
|
70
|
-
pStateMachine.terminateStates = pStateMachine.states.filter(
|
|
71
|
-
stateTransformers.isType("terminate"),
|
|
72
|
-
);
|
|
73
|
-
pStateMachine.finalStates = pStateMachine.states.filter(
|
|
74
|
-
stateTransformers.isType("final"),
|
|
75
|
-
);
|
|
76
|
-
pStateMachine.compositeStates = pStateMachine.states.filter(
|
|
77
|
-
(pState) => pState.statemachine,
|
|
78
|
-
);
|
|
79
|
-
return pStateMachine;
|
|
80
|
-
}
|
|
81
|
-
function addEndTypes(pStateMachineModel) {
|
|
82
|
-
return (pTransition) => {
|
|
83
|
-
if (pStateMachineModel.findStateByName(pTransition.from).statemachine) {
|
|
84
|
-
pTransition.fromComposite = true;
|
|
85
|
-
}
|
|
86
|
-
if (pStateMachineModel.findStateByName(pTransition.to).statemachine) {
|
|
87
|
-
pTransition.toComposite = true;
|
|
88
|
-
}
|
|
89
|
-
return pTransition;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
function addCompositeSelfFlag(pStateMachineModel) {
|
|
93
|
-
return (pTransition) => {
|
|
94
|
-
let lAdditionalAttributes = {};
|
|
95
|
-
if (utl.isCompositeSelf(pStateMachineModel, pTransition)) {
|
|
96
|
-
if (pStateMachineModel.findStateByName(pTransition.from).hasParent) {
|
|
97
|
-
lAdditionalAttributes = { hasParent: true, isCompositeSelf: true };
|
|
98
|
-
} else {
|
|
99
|
-
lAdditionalAttributes = { isCompositeSelf: true };
|
|
110
|
+
if (pActive) {
|
|
111
|
+
lReturnValue = `<i>${lReturnValue}</i>`;
|
|
100
112
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
function
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
return pTransition;
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
function transformTransitions(pStateMachineModel, pDirection, pCounter) {
|
|
115
|
-
return pStateMachineModel.flattenedTransitions
|
|
116
|
-
.map(nameTransition(pCounter))
|
|
117
|
-
.map(transitionTransformers.escapeTransitionStrings)
|
|
118
|
-
.map(transitionTransformers.classifyTransition)
|
|
119
|
-
.map(stateTransformers.flattenNote)
|
|
120
|
-
.map(addEndTypes(pStateMachineModel))
|
|
121
|
-
.map(addCompositeSelfFlag(pStateMachineModel))
|
|
122
|
-
.map(transitionTransformers.addPorts(pDirection));
|
|
123
|
-
}
|
|
124
|
-
export default (pStateMachine, pOptions) => {
|
|
125
|
-
pOptions = pOptions || {};
|
|
126
|
-
let lStateMachine = structuredClone(pStateMachine);
|
|
127
|
-
const lStateMachineModel = new StateMachineModel(lStateMachine);
|
|
128
|
-
lStateMachine.transitions = transformTransitions(
|
|
129
|
-
lStateMachineModel,
|
|
130
|
-
pOptions.direction,
|
|
131
|
-
new Counter(),
|
|
132
|
-
);
|
|
133
|
-
lStateMachine.states = transformStates(
|
|
134
|
-
lStateMachine.states,
|
|
135
|
-
pOptions.direction,
|
|
136
|
-
pOptions.dotNodeAttrs,
|
|
137
|
-
lStateMachineModel,
|
|
113
|
+
return lReturnValue;
|
|
114
|
+
})
|
|
115
|
+
.join("\\n");
|
|
116
|
+
}
|
|
117
|
+
function choice(pState, pIndent) {
|
|
118
|
+
const lActiveAttribute = pState.active ? "penwidth=3.0 " : "";
|
|
119
|
+
const lActions = choiceActions(
|
|
120
|
+
pState?.actions ?? [],
|
|
121
|
+
pState?.active ?? false,
|
|
138
122
|
);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
123
|
+
const lLabelTag = lActions;
|
|
124
|
+
const lDiamond = `${pIndent} "${pState.name}" [shape=diamond fixedsize=true width=0.35 height=0.35 fontsize=10 label=" " class="${pState.class}"${pState.colorAttribute}${lActiveAttribute}]`;
|
|
125
|
+
const lLabelConstruct = `${pIndent} "${pState.name}" -> "${pState.name}" [color="#FFFFFF01" fontcolor="${pState.color}" class="${pState.class}" label=<${lLabelTag}>]`;
|
|
126
|
+
return `${lDiamond}\n${lLabelConstruct}${pState.noteText}`;
|
|
127
|
+
}
|
|
128
|
+
function forkjoin(pState, pIndent, pOptions) {
|
|
129
|
+
const lActiveAttribute = pState.active ? "penwidth=3.0 " : "";
|
|
130
|
+
const lDirection = getOptionValue(pOptions, "direction");
|
|
131
|
+
const lSizingExtras = isVertical(lDirection) ? " height=0.1" : " width=0.1";
|
|
132
|
+
return `${pIndent} "${pState.name}" [shape=rect fixedsize=true label=" " style=filled class="${pState.class}" color="${pState.color}" fillcolor="${pState.color}"${lActiveAttribute}${lSizingExtras}]${pState.noteText}`;
|
|
133
|
+
}
|
|
134
|
+
function junction(pState, pIndent) {
|
|
135
|
+
const lActiveAttribute = pState.active ? " penwidth=3.0" : "";
|
|
136
|
+
const lNote = stateNote(pState, pIndent);
|
|
137
|
+
return `${pIndent} "${pState.name}" [shape=circle fixedsize=true height=0.15 label="" style=filled class="${pState.class}" color="${pState.color}" fillcolor="${pState.color}"${lActiveAttribute}]${lNote}`;
|
|
138
|
+
}
|
|
139
|
+
function terminate(pState, pIndent) {
|
|
140
|
+
const lLabelTag = `
|
|
141
|
+
${pIndent} <table align="center" cellborder="0" border="0">
|
|
142
|
+
${pIndent} <tr><td cellpadding="0"><font color="${pState.color}" point-size="20">X</font></td></tr>
|
|
143
|
+
${pIndent} <tr><td cellpadding="0"><font color="${pState.color}">${pState.label}</font></td></tr>
|
|
144
|
+
${pIndent} </table>`;
|
|
145
|
+
return `${pIndent} "${pState.name}" [label= <${lLabelTag}
|
|
146
|
+
${pIndent} > class="${pState.class}"]${pState.noteText}`;
|
|
147
|
+
}
|
|
148
|
+
function final(pState, pIndent) {
|
|
149
|
+
const lActiveAttribute = pState.active ? " peripheries=2 penwidth=3.0" : "";
|
|
150
|
+
return `${pIndent} "${pState.name}" [shape=circle style=filled class="${pState.class}" color="${pState.color}" fillcolor="${pState.color}" fixedsize=true height=0.15 peripheries=2 label=""${lActiveAttribute}]${pState.noteText}`;
|
|
151
|
+
}
|
|
152
|
+
const STATE_TYPE2FUNCTION = new Map([
|
|
153
|
+
["initial", initial],
|
|
154
|
+
["regular", regular],
|
|
155
|
+
["history", history],
|
|
156
|
+
["deephistory", deepHistory],
|
|
157
|
+
["choice", choice],
|
|
158
|
+
["fork", forkjoin],
|
|
159
|
+
["forkjoin", forkjoin],
|
|
160
|
+
["join", forkjoin],
|
|
161
|
+
["junction", junction],
|
|
162
|
+
["terminate", terminate],
|
|
163
|
+
["final", final],
|
|
164
|
+
]);
|
|
165
|
+
function state(pState, pIndent, pOptions, pModel) {
|
|
166
|
+
const lState = normalizeState(pState, pOptions, pIndent);
|
|
167
|
+
return (
|
|
168
|
+
(STATE_TYPE2FUNCTION.get(pState.type) ?? regular)(
|
|
169
|
+
lState,
|
|
170
|
+
pIndent,
|
|
171
|
+
pOptions,
|
|
172
|
+
pModel,
|
|
173
|
+
) + "\n"
|
|
144
174
|
);
|
|
145
|
-
|
|
146
|
-
|
|
175
|
+
}
|
|
176
|
+
function states(pStates, pIndent, pOptions, pModel) {
|
|
177
|
+
return pStates
|
|
178
|
+
.map((pState) => state(pState, pIndent, pOptions, pModel))
|
|
179
|
+
.join("");
|
|
180
|
+
}
|
|
181
|
+
function transition(pTransition, pIndent, pOptions, pModel) {
|
|
182
|
+
const lLabel = `${escapeLabelString(pTransition.label ?? " ")}`;
|
|
183
|
+
const lColorAttribute = pTransition.color
|
|
184
|
+
? ` color="${pTransition.color}"`
|
|
185
|
+
: "";
|
|
186
|
+
const lFontColorAttribute = pTransition.color
|
|
187
|
+
? ` fontcolor="${pTransition.color}"`
|
|
188
|
+
: "";
|
|
189
|
+
const lPenWidth = pTransition.width ? ` penwidth=${pTransition.width}` : "";
|
|
190
|
+
const lClass = pTransition.class
|
|
191
|
+
? `transition${pTransition.type ? " " + pTransition.type + " " : " "}${pTransition.class}`
|
|
192
|
+
: `transition${pTransition.type ? " " + pTransition.type : ""}`;
|
|
193
|
+
const lTail = pModel.findStateByName(pTransition.from)?.statemachine
|
|
194
|
+
? ` ltail="cluster_${pTransition.from}"`
|
|
195
|
+
: "";
|
|
196
|
+
const lHead = pModel.findStateByName(pTransition.to)?.statemachine
|
|
197
|
+
? ` lhead="cluster_${pTransition.to}"`
|
|
198
|
+
: "";
|
|
199
|
+
const lTransitionName = `tr_${pTransition.from}_${pTransition.to}_${pTransition.id}`;
|
|
200
|
+
if (pTransition.note) {
|
|
201
|
+
const lNoteName = `note_${lTransitionName}`;
|
|
202
|
+
const lNoteNodeName = `i_${lNoteName}`;
|
|
203
|
+
const lNoteNode = `\n${pIndent} "${lNoteNodeName}" [shape=point style=invis margin=0 width=0 height=0 fixedsize=true]`;
|
|
204
|
+
const lTransitionFrom = `\n${pIndent} "${pTransition.from}" -> "${lNoteNodeName}" [arrowhead=none${lTail}${lColorAttribute}]`;
|
|
205
|
+
const lTransitionTo = `\n${pIndent} "${lNoteNodeName}" -> "${pTransition.to}" [label="${lLabel}"${lHead}${lColorAttribute}${lFontColorAttribute}]`;
|
|
206
|
+
const lLineToNote = `\n${pIndent} "${lNoteNodeName}" -> "${lNoteName}" [style=dashed arrowtail=none arrowhead=none weight=0]`;
|
|
207
|
+
const lNote = `\n${pIndent} "${lNoteName}" [label="${noteToLabel(pTransition.note)}" shape=note fontsize=10 color=black fontcolor=black fillcolor="#ffffcc" penwidth=1.0]`;
|
|
208
|
+
return lNoteNode + lTransitionFrom + lTransitionTo + lLineToNote + lNote;
|
|
209
|
+
}
|
|
210
|
+
if (isCompositeSelf(pModel, pTransition)) {
|
|
211
|
+
const { lTailPorts, lHeadPorts } = getTransitionPorts(
|
|
212
|
+
pOptions,
|
|
213
|
+
pModel,
|
|
214
|
+
pTransition,
|
|
215
|
+
);
|
|
216
|
+
const lTransitionFrom = `\n${pIndent} "${pTransition.from}" -> "self_tr_${pTransition.from}_${pTransition.to}_${pTransition.id}" [label="${lLabel}" arrowhead=none class="${lClass}"${lTailPorts}${lTail}${lColorAttribute}${lFontColorAttribute}]`;
|
|
217
|
+
const lTransitionTo = `\n${pIndent} "self_tr_${pTransition.from}_${pTransition.to}_${pTransition.id}" -> "${pTransition.to}" [class="${lClass}"${lHead}${lHeadPorts}${lColorAttribute}${lPenWidth}]`;
|
|
218
|
+
return lTransitionFrom + lTransitionTo;
|
|
219
|
+
}
|
|
220
|
+
return `\n${pIndent} "${pTransition.from}" -> "${pTransition.to}" [label="${lLabel}" class="${lClass}"${lTail}${lHead}${lColorAttribute}${lFontColorAttribute}${lPenWidth}]`;
|
|
221
|
+
}
|
|
222
|
+
function transitions(pTransitions, pIndent, pOptions, pModel) {
|
|
223
|
+
return pTransitions
|
|
224
|
+
.map((pTransition) => transition(pTransition, pIndent, pOptions, pModel))
|
|
225
|
+
.join("");
|
|
226
|
+
}
|
|
227
|
+
export default function renderDot(pStateMachine, pOptions = {}, pIndent = "") {
|
|
228
|
+
const lGraphAttributes = buildGraphAttributes(
|
|
229
|
+
getOptionValue(pOptions, "engine"),
|
|
230
|
+
getOptionValue(pOptions, "direction"),
|
|
231
|
+
pOptions?.dotGraphAttrs || [],
|
|
147
232
|
);
|
|
148
|
-
|
|
149
|
-
|
|
233
|
+
const lNodeAttributes = buildNodeAttributes(pOptions.dotNodeAttrs || []);
|
|
234
|
+
const lEdgeAttributes = buildEdgeAttributes(pOptions.dotEdgeAttrs || []);
|
|
235
|
+
const lModel = new StateMachineModel(pStateMachine);
|
|
236
|
+
const lStates = states(pStateMachine.states, pIndent, pOptions, lModel);
|
|
237
|
+
const lTransitions = transitions(
|
|
238
|
+
lModel.flattenedTransitions,
|
|
239
|
+
pIndent,
|
|
240
|
+
pOptions,
|
|
241
|
+
lModel,
|
|
150
242
|
);
|
|
151
|
-
return
|
|
152
|
-
}
|
|
243
|
+
return `digraph "state transitions" {
|
|
244
|
+
${lGraphAttributes}
|
|
245
|
+
node [${lNodeAttributes}]
|
|
246
|
+
edge [${lEdgeAttributes}]
|
|
247
|
+
|
|
248
|
+
${lStates}${lTransitions}
|
|
249
|
+
}
|
|
250
|
+
`;
|
|
251
|
+
}
|
package/dist/render/dot/utl.mjs
CHANGED
|
@@ -1,31 +1,102 @@
|
|
|
1
|
-
|
|
1
|
+
import he from "he";
|
|
2
|
+
import { getOptionValue } from "../../options.mjs";
|
|
3
|
+
function getStateColor(pState, pNodeAttributes) {
|
|
4
|
+
const lNodeColor = (pNodeAttributes || []).find(
|
|
5
|
+
(pAttribute) => pAttribute.name === "color",
|
|
6
|
+
)?.value;
|
|
7
|
+
if (
|
|
8
|
+
lNodeColor &&
|
|
9
|
+
!pState.color &&
|
|
10
|
+
[
|
|
11
|
+
"initial",
|
|
12
|
+
"fork",
|
|
13
|
+
"join",
|
|
14
|
+
"junction",
|
|
15
|
+
"forkjoin",
|
|
16
|
+
"terminate",
|
|
17
|
+
"final",
|
|
18
|
+
].includes(pState.type)
|
|
19
|
+
) {
|
|
20
|
+
return lNodeColor;
|
|
21
|
+
}
|
|
22
|
+
return pState.color ?? "black";
|
|
23
|
+
}
|
|
24
|
+
export function escapeString(pString) {
|
|
2
25
|
return pString
|
|
3
26
|
.replace(/\\/g, "\\\\")
|
|
4
27
|
.replace(/\n\s*/g, "\\l")
|
|
5
28
|
.replace(/"/g, '\\"')
|
|
6
29
|
.concat("\\l");
|
|
7
30
|
}
|
|
8
|
-
function escapeLabelString(pString) {
|
|
31
|
+
export function escapeLabelString(pString) {
|
|
9
32
|
return pString
|
|
10
33
|
.replace(/\\/g, "\\\\")
|
|
11
34
|
.replace(/\n\s*/g, " \\l")
|
|
12
35
|
.replace(/"/g, '\\"')
|
|
13
36
|
.concat(" \\l");
|
|
14
37
|
}
|
|
15
|
-
function isVertical(pDirection) {
|
|
38
|
+
export function isVertical(pDirection) {
|
|
16
39
|
const lDirection = pDirection || "top-down";
|
|
17
40
|
return lDirection === "top-down" || lDirection === "bottom-top";
|
|
18
41
|
}
|
|
19
|
-
function isCompositeSelf(pStateMachineModel, pTransition) {
|
|
42
|
+
export function isCompositeSelf(pStateMachineModel, pTransition) {
|
|
20
43
|
return (
|
|
21
44
|
pTransition.from === pTransition.to &&
|
|
22
45
|
pStateMachineModel.findStateByName(pTransition.from).statemachine &&
|
|
23
|
-
|
|
46
|
+
pTransition.type !== "internal"
|
|
24
47
|
);
|
|
25
48
|
}
|
|
26
|
-
export
|
|
27
|
-
escapeString
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
49
|
+
export function noteToLabel(pNote) {
|
|
50
|
+
return pNote.map(escapeString).join("");
|
|
51
|
+
}
|
|
52
|
+
export function stateNote(pState, pIndent) {
|
|
53
|
+
if (pState.note) {
|
|
54
|
+
const lNoteName = `note_${pState.name}`;
|
|
55
|
+
let lReturnValue = `\n${pIndent} "${lNoteName}" [color=black fontcolor=black label="${noteToLabel(pState.note)}" shape=note fontsize=10 fillcolor="#ffffcc" penwidth=1.0]`;
|
|
56
|
+
lReturnValue += `\n${pIndent} "${pState.name}" -> "${lNoteName}" [style=dashed arrowtail=none arrowhead=none]`;
|
|
57
|
+
return lReturnValue;
|
|
58
|
+
}
|
|
59
|
+
return "";
|
|
60
|
+
}
|
|
61
|
+
export function normalizeState(pState, pOptions, pIndent) {
|
|
62
|
+
const lReturnValue = structuredClone(pState);
|
|
63
|
+
lReturnValue.colorAttribute = pState.color ? ` color="${pState.color}"` : "";
|
|
64
|
+
lReturnValue.fontColorAttribute = pState.color
|
|
65
|
+
? ` fontcolor="${pState.color}"`
|
|
66
|
+
: "";
|
|
67
|
+
lReturnValue.color = getStateColor(pState, pOptions.dotNodeAttrs);
|
|
68
|
+
lReturnValue.class = pState.class
|
|
69
|
+
? `state ${pState.type} ${pState.class}`
|
|
70
|
+
: `state ${pState.type}`;
|
|
71
|
+
lReturnValue.label = he.escape(pState.label ?? pState.name);
|
|
72
|
+
lReturnValue.noteText = stateNote(pState, pIndent);
|
|
73
|
+
if (
|
|
74
|
+
!pState.isParallelArea &&
|
|
75
|
+
pState.type === "parallel" &&
|
|
76
|
+
(pState.statemachine?.states ?? []).length > 0
|
|
77
|
+
) {
|
|
78
|
+
lReturnValue.statemachine.states = pState.statemachine.states.map(
|
|
79
|
+
(pChildState) => ({
|
|
80
|
+
...pChildState,
|
|
81
|
+
isParallelArea: pChildState.type === "regular",
|
|
82
|
+
}),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
return lReturnValue;
|
|
86
|
+
}
|
|
87
|
+
export function formatActionType(pString) {
|
|
88
|
+
return pString === "activity" ? "" : `${pString}/ `;
|
|
89
|
+
}
|
|
90
|
+
export function getTransitionPorts(pOptions, pModel, pTransition) {
|
|
91
|
+
let lTailPorts = ' tailport="n" headport="n"';
|
|
92
|
+
let lHeadPorts = ' tailport="n"';
|
|
93
|
+
const lDirection = getOptionValue(pOptions, "direction");
|
|
94
|
+
if (isVertical(lDirection)) {
|
|
95
|
+
lTailPorts = ' tailport="e" headport="e"';
|
|
96
|
+
lHeadPorts = ' tailport="w"';
|
|
97
|
+
} else if (pModel.findStateByName(pTransition.from).hasParent) {
|
|
98
|
+
lTailPorts = ' tailport="n" headport="n"';
|
|
99
|
+
lHeadPorts = ' tailport="s"';
|
|
100
|
+
}
|
|
101
|
+
return { lTailPorts, lHeadPorts };
|
|
102
|
+
}
|
|
@@ -18,7 +18,7 @@ function makeValidEventName(pCandidateEventName) {
|
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
export default (pCandidateEventNames) => {
|
|
21
|
-
const lCandidateEventNames = pCandidateEventNames
|
|
21
|
+
const lCandidateEventNames = pCandidateEventNames ?? "";
|
|
22
22
|
if (lCandidateEventNames.length === 0) {
|
|
23
23
|
return "empty";
|
|
24
24
|
}
|
package/dist/render/smcat.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const NAME_QUOTABLE =
|
|
2
|
-
const ACTIONS_QUOTABLE =
|
|
3
|
-
const LABEL_QUOTABLE =
|
|
1
|
+
const NAME_QUOTABLE = /[;,{[ ]/;
|
|
2
|
+
const ACTIONS_QUOTABLE = /[;,{}]/;
|
|
3
|
+
const LABEL_QUOTABLE = /[;{]/;
|
|
4
4
|
const RENDERABLE_STATE_ATTRIBUTES = [
|
|
5
5
|
"label",
|
|
6
6
|
"type",
|
|
@@ -99,9 +99,8 @@ function transition(pTransition, pIndent = "") {
|
|
|
99
99
|
}
|
|
100
100
|
function transitions(pTransitions, pIndent = "") {
|
|
101
101
|
return pTransitions
|
|
102
|
-
.map((pTransition) => transition(pTransition, pIndent))
|
|
103
|
-
.join("
|
|
104
|
-
.concat(pTransitions.length > 0 ? ";\n" : "");
|
|
102
|
+
.map((pTransition) => `${transition(pTransition, pIndent)};\n`)
|
|
103
|
+
.join("");
|
|
105
104
|
}
|
|
106
105
|
export default function renderSmcat(
|
|
107
106
|
pStateMachine,
|
|
@@ -21,7 +21,7 @@ function flattenStates(pStates, pHasParent = false) {
|
|
|
21
21
|
function flattenTransitions(pStateMachine) {
|
|
22
22
|
let lTransitions = [];
|
|
23
23
|
if (Object.hasOwn(pStateMachine, "transitions")) {
|
|
24
|
-
lTransitions = pStateMachine.transitions;
|
|
24
|
+
lTransitions = structuredClone(pStateMachine.transitions);
|
|
25
25
|
}
|
|
26
26
|
if (Object.hasOwn(pStateMachine, "states")) {
|
|
27
27
|
pStateMachine.states
|
package/dist/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "12.0.
|
|
1
|
+
export const version = "12.0.18";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "state-machine-cat",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.18",
|
|
4
4
|
"description": "write beautiful state charts",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -16,10 +16,6 @@
|
|
|
16
16
|
"imports": {
|
|
17
17
|
"#*": "./src/*"
|
|
18
18
|
},
|
|
19
|
-
"sideEffects": [
|
|
20
|
-
"dist/render/dot/dot.states.template.cjs",
|
|
21
|
-
"dist/render/dot/dot.template.cjs"
|
|
22
|
-
],
|
|
23
19
|
"files": [
|
|
24
20
|
"dist/",
|
|
25
21
|
"types/",
|
|
@@ -44,10 +40,9 @@
|
|
|
44
40
|
"state-machine-cat": "dist/cli/main.mjs"
|
|
45
41
|
},
|
|
46
42
|
"dependencies": {
|
|
47
|
-
"@hpcc-js/wasm-graphviz": "1.
|
|
43
|
+
"@hpcc-js/wasm-graphviz": "1.7.0",
|
|
48
44
|
"ajv": "8.17.1",
|
|
49
|
-
"fast-xml-parser": "4.5.
|
|
50
|
-
"handlebars": "4.7.8",
|
|
45
|
+
"fast-xml-parser": "4.5.1",
|
|
51
46
|
"he": "1.2.0",
|
|
52
47
|
"semver": "^7.6.2",
|
|
53
48
|
"traverse": "0.6.8"
|
|
@@ -91,6 +91,10 @@ export interface ITransition {
|
|
|
91
91
|
* The name of the IState the transition is to
|
|
92
92
|
*/
|
|
93
93
|
to: string;
|
|
94
|
+
/**
|
|
95
|
+
* The id of the transition. Unique within the root state machine.
|
|
96
|
+
*/
|
|
97
|
+
id: number;
|
|
94
98
|
/**
|
|
95
99
|
* A display label to represent this transition. Parsers can parse this
|
|
96
100
|
* label into events conditions and actions.
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export default class Counter {
|
|
2
|
-
COUNTER = 0;
|
|
3
|
-
constructor() {
|
|
4
|
-
this.reset();
|
|
5
|
-
}
|
|
6
|
-
reset() {
|
|
7
|
-
this.COUNTER = 0;
|
|
8
|
-
}
|
|
9
|
-
next() {
|
|
10
|
-
return ++this.COUNTER;
|
|
11
|
-
}
|
|
12
|
-
nextAsString() {
|
|
13
|
-
const lBase = 10;
|
|
14
|
-
return this.next().toString(lBase);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Handlebars=require("handlebars/dist/handlebars.runtime"),template=Handlebars.template,templates=Handlebars.templates=Handlebars.templates||{};templates["dot.states.template.hbs"]=template({1:function(l,n,e,a,t){var o=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]},r="",c=null!=(c=o(e,"nestedExternalSelfTransitions")||(null!=n?o(n,"nestedExternalSelfTransitions"):n))?c:l.hooks.helperMissing,t={name:"nestedExternalSelfTransitions",hash:{},fn:l.program(2,t,0),inverse:l.noop,data:t,loc:{start:{line:2,column:2},end:{line:4,column:36}}},c="function"==typeof c?c.call(null!=n?n:l.nullContext||{},t):c;return null!=(c=o(e,"nestedExternalSelfTransitions")?c:l.hooks.blockHelperMissing.call(n,c,t))&&(r+=c),r},2:function(l,n,e,a,t){return' "self_'+(null!=(l=l.lambda(n,n))?l:"")+'" [shape=point style=invis width=0 height=0 fixedsize=true]\n'},4:function(l,n,e,a,t){var o,r,c=null!=n?n:l.nullContext||{},i=l.hooks.helperMissing,u="function",s=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return' "'+(null!=(o=typeof(r=null!=(r=s(e,"name")||(null!=n?s(n,"name"):n))?r:i)==u?r.call(c,{name:"name",hash:{},data:t,loc:{start:{line:7,column:3},end:{line:7,column:13}}}):r)?o:"")+'" [shape=circle style=filled class="'+(null!=(o=typeof(r=null!=(r=s(e,"class")||(null!=n?s(n,"class"):n))?r:i)==u?r.call(c,{name:"class",hash:{},data:t,loc:{start:{line:7,column:49},end:{line:7,column:60}}}):r)?o:"")+'" '+(null!=(o=s(e,"if").call(c,null!=n?s(n,"color"):n,{name:"if",hash:{},fn:l.program(5,t,0),inverse:l.program(7,t,0),data:t,loc:{start:{line:7,column:62},end:{line:7,column:150}}}))?o:"")+(null!=(o=s(e,"if").call(c,null!=n?s(n,"active"):n,{name:"if",hash:{},fn:l.program(9,t,0),inverse:l.noop,data:t,loc:{start:{line:7,column:150},end:{line:7,column:184}}}))?o:"")+'fixedsize=true height=0.15 label=""]\n'},5:function(l,n,e,a,t){var o,r,c=null!=n?n:l.nullContext||{},i=l.hooks.helperMissing,u="function",l=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return'color="'+(null!=(o=typeof(r=null!=(r=l(e,"color")||(null!=n?l(n,"color"):n))?r:i)==u?r.call(c,{name:"color",hash:{},data:t,loc:{start:{line:7,column:82},end:{line:7,column:93}}}):r)?o:"")+'" fillcolor="'+(null!=(o=typeof(r=null!=(r=l(e,"color")||(null!=n?l(n,"color"):n))?r:i)==u?r.call(c,{name:"color",hash:{},data:t,loc:{start:{line:7,column:106},end:{line:7,column:117}}}):r)?o:"")+'" '},7:function(l,n,e,a,t){return"fillcolor=black "},9:function(l,n,e,a,t){return"penwidth=3.0 "},11:function(l,n,e,a,t){var o=null!=n?n:l.nullContext||{},r=l.hooks.helperMissing,c="function",i=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]},u=' "'+(null!=(m=typeof(s=null!=(s=i(e,"name")||(null!=n?i(n,"name"):n))?s:r)==c?s.call(o,{name:"name",hash:{},data:t,loc:{start:{line:10,column:3},end:{line:10,column:13}}}):s)?m:"")+'" [margin=0 class="'+(null!=(m=typeof(s=null!=(s=i(e,"class")||(null!=n?i(n,"class"):n))?s:r)==c?s.call(o,{name:"class",hash:{},data:t,loc:{start:{line:10,column:32},end:{line:10,column:43}}}):s)?m:"")+'" '+(null!=(m=i(e,"if").call(o,null!=n?i(n,"color"):n,{name:"if",hash:{},fn:l.program(12,t,0),inverse:l.noop,data:t,loc:{start:{line:10,column:45},end:{line:10,column:85}}}))?m:"")+(null!=(m=i(e,"if").call(o,null!=n?i(n,"active"):n,{name:"if",hash:{},fn:l.program(14,t,0),inverse:l.noop,data:t,loc:{start:{line:10,column:85},end:{line:10,column:134}}}))?m:"")+'label= < \n <table align="center" cellborder="0" border="2" style="rounded" width="48">\n <tr><td width="48"'+(null!=(m=i(e,"if").call(o,null!=n?i(n,"actionStrings"):n,{name:"if",hash:{},fn:l.program(16,t,0),inverse:l.program(18,t,0),data:t,loc:{start:{line:12,column:24},end:{line:12,column:92}}}))?m:"")+">"+(null!=(m=i(e,"if").call(o,null!=n?i(n,"active"):n,{name:"if",hash:{},fn:l.program(20,t,0),inverse:l.program(22,t,0),data:t,loc:{start:{line:12,column:93},end:{line:12,column:147}}}))?m:"")+"</td></tr>\n",s=null!=(s=i(e,"actionStrings")||(null!=n?i(n,"actionStrings"):n))?s:r,r={name:"actionStrings",hash:{},fn:l.program(24,t,0),inverse:l.noop,data:t,loc:{start:{line:13,column:6},end:{line:16,column:24}}},m=typeof s==c?s.call(o,r):s;return null!=(m=i(e,"actionStrings")?m:l.hooks.blockHelperMissing.call(n,m,r))&&(u+=m),u+" </table>\n >]\n"},12:function(l,n,e,a,t){var o=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return'color="'+(null!=(o="function"==typeof(e=null!=(e=o(e,"color")||(null!=n?o(n,"color"):n))?e:l.hooks.helperMissing)?e.call(null!=n?n:l.nullContext||{},{name:"color",hash:{},data:t,loc:{start:{line:10,column:65},end:{line:10,column:76}}}):e)?o:"")+'" '},14:function(l,n,e,a,t){return"peripheries=1 style=rounded "},16:function(l,n,e,a,t){return' cellpadding="2"'},18:function(l,n,e,a,t){return' cellpadding="7"'},20:function(l,n,e,a,t){var o=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return"<i>"+l.escapeExpression("function"==typeof(e=null!=(e=o(e,"label")||(null!=n?o(n,"label"):n))?e:l.hooks.helperMissing)?e.call(null!=n?n:l.nullContext||{},{name:"label",hash:{},data:t,loc:{start:{line:12,column:110},end:{line:12,column:119}}}):e)+"</i>"},22:function(l,n,e,a,t){var o=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return l.escapeExpression("function"==typeof(e=null!=(e=o(e,"label")||(null!=n?o(n,"label"):n))?e:l.hooks.helperMissing)?e.call(null!=n?n:l.nullContext||{},{name:"label",hash:{},data:t,loc:{start:{line:12,column:131},end:{line:12,column:140}}}):e)},24:function(l,n,e,a,t){var o=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return" "+(null!=(e=o(e,"if").call(null!=n?n:l.nullContext||{},t&&o(t,"first"),{name:"if",hash:{},fn:l.program(25,t,0),inverse:l.noop,data:t,loc:{start:{line:14,column:8},end:{line:14,column:34}}}))?e:"")+'\n <tr><td align="left" cellpadding="2">'+l.escapeExpression(l.lambda(n,n))+"</td></tr>\n"},25:function(l,n,e,a,t){return"<hr/>"},27:function(l,n,e,a,t){var o,r,c=null!=n?n:l.nullContext||{},i=l.hooks.helperMissing,u="function",s=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return' "'+(null!=(o=typeof(r=null!=(r=s(e,"name")||(null!=n?s(n,"name"):n))?r:i)==u?r.call(c,{name:"name",hash:{},data:t,loc:{start:{line:21,column:3},end:{line:21,column:13}}}):r)?o:"")+'" [shape=circle class="'+(null!=(o=typeof(r=null!=(r=s(e,"class")||(null!=n?s(n,"class"):n))?r:i)==u?r.call(c,{name:"class",hash:{},data:t,loc:{start:{line:21,column:36},end:{line:21,column:47}}}):r)?o:"")+'" '+(null!=(o=s(e,"if").call(c,null!=n?s(n,"color"):n,{name:"if",hash:{},fn:l.program(12,t,0),inverse:l.noop,data:t,loc:{start:{line:21,column:49},end:{line:21,column:89}}}))?o:"")+(null!=(o=s(e,"if").call(c,null!=n?s(n,"active"):n,{name:"if",hash:{},fn:l.program(9,t,0),inverse:l.noop,data:t,loc:{start:{line:21,column:89},end:{line:21,column:123}}}))?o:"")+'label="H"]\n'},29:function(l,n,e,a,t){var o,r,c=null!=n?n:l.nullContext||{},i=l.hooks.helperMissing,u="function",s=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return' "'+(null!=(o=typeof(r=null!=(r=s(e,"name")||(null!=n?s(n,"name"):n))?r:i)==u?r.call(c,{name:"name",hash:{},data:t,loc:{start:{line:24,column:3},end:{line:24,column:13}}}):r)?o:"")+'" [shape=circle class="'+(null!=(o=typeof(r=null!=(r=s(e,"class")||(null!=n?s(n,"class"):n))?r:i)==u?r.call(c,{name:"class",hash:{},data:t,loc:{start:{line:24,column:36},end:{line:24,column:47}}}):r)?o:"")+'" '+(null!=(o=s(e,"if").call(c,null!=n?s(n,"color"):n,{name:"if",hash:{},fn:l.program(12,t,0),inverse:l.noop,data:t,loc:{start:{line:24,column:49},end:{line:24,column:89}}}))?o:"")+(null!=(o=s(e,"if").call(c,null!=n?s(n,"active"):n,{name:"if",hash:{},fn:l.program(9,t,0),inverse:l.noop,data:t,loc:{start:{line:24,column:89},end:{line:24,column:123}}}))?o:"")+'label="H*"]\n'},31:function(l,n,e,a,t,o,r){var c=null!=n?n:l.nullContext||{},i=l.hooks.helperMissing,u="function",s=l.hooks.blockHelperMissing,m=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]},p=' "'+(null!=(d=typeof(f=null!=(f=m(e,"name")||(null!=n?m(n,"name"):n))?f:i)==u?f.call(c,{name:"name",hash:{},data:t,loc:{start:{line:27,column:3},end:{line:27,column:13}}}):f)?d:"")+'" [shape=diamond fixedsize=true width=0.35 height=0.35 fontsize=10 class="'+(null!=(d=typeof(f=null!=(f=m(e,"class")||(null!=n?m(n,"class"):n))?f:i)==u?f.call(c,{name:"class",hash:{},data:t,loc:{start:{line:27,column:87},end:{line:27,column:98}}}):f)?d:"")+'" '+(null!=(d=m(e,"if").call(c,null!=n?m(n,"color"):n,{name:"if",hash:{},fn:l.program(12,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:27,column:100},end:{line:27,column:140}}}))?d:"")+(null!=(d=m(e,"if").call(c,null!=n?m(n,"active"):n,{name:"if",hash:{},fn:l.program(9,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:27,column:140},end:{line:27,column:174}}}))?d:"")+'label=" "]\n "'+(null!=(d=typeof(f=null!=(f=m(e,"name")||(null!=n?m(n,"name"):n))?f:i)==u?f.call(c,{name:"name",hash:{},data:t,loc:{start:{line:28,column:3},end:{line:28,column:13}}}):f)?d:"")+'" -> "'+(null!=(d=typeof(f=null!=(f=m(e,"name")||(null!=n?m(n,"name"):n))?f:i)==u?f.call(c,{name:"name",hash:{},data:t,loc:{start:{line:28,column:19},end:{line:28,column:29}}}):f)?d:"")+'" [label=<',f=null!=(f=m(e,"actionStrings")||(null!=n?m(n,"actionStrings"):n))?f:i,h={name:"actionStrings",hash:{},fn:l.program(32,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:28,column:39},end:{line:28,column:156}}},d=typeof f==u?f.call(c,h):f;return null!=(d=m(e,"actionStrings")?d:s.call(n,d,h))&&(p+=d),p+='> color="#FFFFFF01"',f=null!=(f=m(e,"color")||(null!=n?m(n,"color"):n))?f:i,h={name:"color",hash:{},fn:l.program(41,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:28,column:175},end:{line:28,column:215}}},d=typeof f==u?f.call(c,h):f,null!=(d=m(e,"color")?d:s.call(n,d,h))&&(p+=d),p+' class="'+(null!=(d=typeof(f=null!=(f=m(e,"class")||(null!=n?m(n,"class"):n))?f:i)==u?f.call(c,{name:"class",hash:{},data:t,loc:{start:{line:28,column:223},end:{line:28,column:234}}}):f)?d:"")+'"];\n'},32:function(l,n,e,a,t,o,r){var c,n=null!=n?n:l.nullContext||{},i=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return(null!=(c=i(e,"if").call(n,t&&i(t,"first"),{name:"if",hash:{},fn:l.program(33,t,0,o,r),inverse:l.program(35,t,0,o,r),data:t,loc:{start:{line:28,column:57},end:{line:28,column:88}}}))?c:"")+(null!=(c=i(e,"if").call(n,null!=r[1]?i(r[1],"active"):r[1],{name:"if",hash:{},fn:l.program(37,t,0,o,r),inverse:l.program(39,t,0,o,r),data:t,loc:{start:{line:28,column:88},end:{line:28,column:137}}}))?c:"")},33:function(l,n,e,a,t){return""},35:function(l,n,e,a,t){return"\\n"},37:function(l,n,e,a,t){return"<i>"+l.escapeExpression(l.lambda(n,n))+"</i>"},39:function(l,n,e,a,t){return l.escapeExpression(l.lambda(n,n))},41:function(l,n,e,a,t){return' fontcolor="'+(null!=(l=l.lambda(n,n))?l:"")+'"'},43:function(l,n,e,a,t){var o,r,c=null!=n?n:l.nullContext||{},i=l.hooks.helperMissing,u="function",s=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return' "'+(null!=(o=typeof(r=null!=(r=s(e,"name")||(null!=n?s(n,"name"):n))?r:i)==u?r.call(c,{name:"name",hash:{},data:t,loc:{start:{line:31,column:3},end:{line:31,column:13}}}):r)?o:"")+'" [shape=rect class="'+(null!=(o=typeof(r=null!=(r=s(e,"class")||(null!=n?s(n,"class"):n))?r:i)==u?r.call(c,{name:"class",hash:{},data:t,loc:{start:{line:31,column:34},end:{line:31,column:45}}}):r)?o:"")+'" '+(null!=(o=s(e,"if").call(c,null!=n?s(n,"color"):n,{name:"if",hash:{},fn:l.program(5,t,0),inverse:l.program(7,t,0),data:t,loc:{start:{line:31,column:47},end:{line:31,column:135}}}))?o:"")+(null!=(o=s(e,"if").call(c,null!=n?s(n,"active"):n,{name:"if",hash:{},fn:l.program(9,t,0),inverse:l.noop,data:t,loc:{start:{line:31,column:135},end:{line:31,column:169}}}))?o:"")+'label=" " fixedsize=true style=filled '+(null!=(o=typeof(r=null!=(r=s(e,"sizingExtras")||(null!=n?s(n,"sizingExtras"):n))?r:i)==u?r.call(c,{name:"sizingExtras",hash:{},data:t,loc:{start:{line:31,column:207},end:{line:31,column:225}}}):r)?o:"")+"]\n"},45:function(l,n,e,a,t){var o,r,c=null!=n?n:l.nullContext||{},i=l.hooks.helperMissing,u="function",s=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return' "'+(null!=(o=typeof(r=null!=(r=s(e,"name")||(null!=n?s(n,"name"):n))?r:i)==u?r.call(c,{name:"name",hash:{},data:t,loc:{start:{line:37,column:3},end:{line:37,column:13}}}):r)?o:"")+'" [label= < \n <table align="center" cellborder="0" border="0">\n <tr><td cellpadding="0"><font '+(null!=(o=s(e,"if").call(c,null!=n?s(n,"color"):n,{name:"if",hash:{},fn:l.program(12,t,0),inverse:l.noop,data:t,loc:{start:{line:39,column:38},end:{line:39,column:78}}}))?o:"")+'point-size="20">X</font></td></tr>\n <tr><td cellpadding="0"><font '+(null!=(o=s(e,"if").call(c,null!=n?s(n,"color"):n,{name:"if",hash:{},fn:l.program(46,t,0),inverse:l.noop,data:t,loc:{start:{line:40,column:38},end:{line:40,column:77}}}))?o:"")+">"+l.escapeExpression(typeof(r=null!=(r=s(e,"label")||(null!=n?s(n,"label"):n))?r:i)==u?r.call(c,{name:"label",hash:{},data:t,loc:{start:{line:40,column:78},end:{line:40,column:87}}}):r)+'</font></td></tr>\n </table>\n > class="'+(null!=(o=typeof(r=null!=(r=s(e,"class")||(null!=n?s(n,"class"):n))?r:i)==u?r.call(c,{name:"class",hash:{},data:t,loc:{start:{line:42,column:13},end:{line:42,column:24}}}):r)?o:"")+'"]\n'},46:function(l,n,e,a,t){var o=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return'color="'+(null!=(o="function"==typeof(e=null!=(e=o(e,"color")||(null!=n?o(n,"color"):n))?e:l.hooks.helperMissing)?e.call(null!=n?n:l.nullContext||{},{name:"color",hash:{},data:t,loc:{start:{line:40,column:58},end:{line:40,column:69}}}):e)?o:"")+'"'},48:function(l,n,e,a,t){var o,r,c=null!=n?n:l.nullContext||{},i=l.hooks.helperMissing,u="function",s=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return' "'+(null!=(o=typeof(r=null!=(r=s(e,"name")||(null!=n?s(n,"name"):n))?r:i)==u?r.call(c,{name:"name",hash:{},data:t,loc:{start:{line:45,column:3},end:{line:45,column:13}}}):r)?o:"")+'" [shape=circle style=filled class="'+(null!=(o=typeof(r=null!=(r=s(e,"class")||(null!=n?s(n,"class"):n))?r:i)==u?r.call(c,{name:"class",hash:{},data:t,loc:{start:{line:45,column:49},end:{line:45,column:60}}}):r)?o:"")+'" '+(null!=(o=s(e,"if").call(c,null!=n?s(n,"color"):n,{name:"if",hash:{},fn:l.program(5,t,0),inverse:l.program(7,t,0),data:t,loc:{start:{line:45,column:62},end:{line:45,column:150}}}))?o:"")+"fixedsize=true height=0.15 peripheries=2 "+(null!=(o=s(e,"if").call(c,null!=n?s(n,"active"):n,{name:"if",hash:{},fn:l.program(9,t,0),inverse:l.noop,data:t,loc:{start:{line:45,column:191},end:{line:45,column:225}}}))?o:"")+'label=""]\n'},50:function(l,n,e,a,t){var o=null!=n?n:l.nullContext||{},r=l.hooks.helperMissing,c="function",i=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]},u=' subgraph "cluster_'+(null!=(p=typeof(s=null!=(s=i(e,"name")||(null!=n?i(n,"name"):n))?s:r)==c?s.call(o,{name:"name",hash:{},data:t,loc:{start:{line:48,column:20},end:{line:48,column:30}}}):s)?p:"")+'" {\n class="'+(null!=(p=typeof(s=null!=(s=i(e,"class")||(null!=n?i(n,"class"):n))?s:r)==c?s.call(o,{name:"class",hash:{},data:t,loc:{start:{line:49,column:11},end:{line:49,column:22}}}):s)?p:"")+'" '+(null!=(p=i(e,"if").call(o,null!=n?i(n,"color"):n,{name:"if",hash:{},fn:l.program(12,t,0),inverse:l.noop,data:t,loc:{start:{line:49,column:24},end:{line:49,column:64}}}))?p:"")+'label= <\n <table cellborder="0" border="0">\n <tr><td>'+(null!=(p=i(e,"if").call(o,null!=n?i(n,"active"):n,{name:"if",hash:{},fn:l.program(20,t,0),inverse:l.program(22,t,0),data:t,loc:{start:{line:51,column:14},end:{line:51,column:68}}}))?p:"")+"</td></tr>\n",s=null!=(s=i(e,"actionStrings")||(null!=n?i(n,"actionStrings"):n))?s:r,m={name:"actionStrings",hash:{},fn:l.program(51,t,0),inverse:l.noop,data:t,loc:{start:{line:52,column:6},end:{line:55,column:24}}},p=typeof s==c?s.call(o,m):s;return null!=(p=i(e,"actionStrings")?p:l.hooks.blockHelperMissing.call(n,p,m))&&(u+=p),u+" </table>\n > "+(null!=(p=i(e,"if").call(o,null!=n?i(n,"parentIsParallel"):n,{name:"if",hash:{},fn:l.program(53,t,0),inverse:l.program(55,t,0),data:t,loc:{start:{line:57,column:6},end:{line:57,column:137}}}))?p:"")+'\n "'+(null!=(p=typeof(s=null!=(s=i(e,"name")||(null!=n?i(n,"name"):n))?s:r)==c?s.call(o,{name:"name",hash:{},data:t,loc:{start:{line:58,column:5},end:{line:58,column:15}}}):s)?p:"")+'" [shape=point style=invis margin=0 width=0 height=0 fixedsize=true]\n '+(null!=(p=(i(e,"stateSection")||n&&i(n,"stateSection")||r).call(o,null!=n?i(n,"statemachine"):n,{name:"stateSection",hash:{},fn:l.program(33,t,0),inverse:l.noop,data:t,loc:{start:{line:59,column:4},end:{line:59,column:51}}}))?p:"")+"\n }\n"},51:function(l,n,e,a,t){var o=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return" "+(null!=(e=o(e,"if").call(null!=n?n:l.nullContext||{},t&&o(t,"first"),{name:"if",hash:{},fn:l.program(25,t,0),inverse:l.noop,data:t,loc:{start:{line:53,column:8},end:{line:53,column:34}}}))?e:"")+'\n <tr><td align="left">'+l.escapeExpression(l.lambda(n,n))+"</td></tr>\n"},53:function(l,n,e,a,t){return'style="dashed" penwidth=1'},55:function(l,n,e,a,t){var o=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return"style=rounded "+(null!=(e=o(e,"if").call(null!=n?n:l.nullContext||{},null!=n?o(n,"active"):n,{name:"if",hash:{},fn:l.program(56,t,0),inverse:l.program(58,t,0),data:t,loc:{start:{line:57,column:77},end:{line:57,column:130}}}))?e:"")},56:function(l,n,e,a,t){return"penwidth=3.0"},58:function(l,n,e,a,t){return"penwidth=2.0"},60:function(l,n,e,a,t,o,r){var c=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]},i="",u=null!=(u=c(e,"noteName")||(null!=n?c(n,"noteName"):n))?u:l.hooks.helperMissing,o={name:"noteName",hash:{},fn:l.program(61,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:63,column:4},end:{line:66,column:17}}},r="function"==typeof u?u.call(null!=n?n:l.nullContext||{},o):u;return null!=(r=c(e,"noteName")?r:l.hooks.blockHelperMissing.call(n,r,o))&&(i+=r),i},61:function(l,n,e,a,t,o,r){var c,i=l.lambda,l=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return' "'+(null!=(c=i(n,n))?c:"")+'" [color=black fontcolor=black label="'+(null!=(c=i(null!=r[1]?l(r[1],"noteFlattened"):r[1],n))?c:"")+'" shape=note fontsize=10 fillcolor="#ffffcc" penwidth=1.0]\n "'+(null!=(c=i(null!=r[1]?l(r[1],"name"):r[1],n))?c:"")+'" -> "'+(null!=(c=i(n,n))?c:"")+'" [style=dashed arrowtail=none arrowhead=none]\n'},compiler:[8,">= 4.3.0"],main:function(l,n,e,a,t,o,r){var c=null!=n?n:l.nullContext||{},i=l.hooks.helperMissing,u="function",s=l.hooks.blockHelperMissing,m=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]},p="",f=null!=(f=m(e,"compositeStates")||(null!=n?m(n,"compositeStates"):n))?f:i,h={name:"compositeStates",hash:{},fn:l.program(1,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:1,column:0},end:{line:5,column:20}}},d=typeof f==u?f.call(c,h):f;return null!=(d=m(e,"compositeStates")?d:s.call(n,d,h))&&(p+=d),f=null!=(f=m(e,"initialStates")||(null!=n?m(n,"initialStates"):n))?f:i,h={name:"initialStates",hash:{},fn:l.program(4,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:6,column:0},end:{line:8,column:18}}},d=typeof f==u?f.call(c,h):f,null!=(d=m(e,"initialStates")?d:s.call(n,d,h))&&(p+=d),f=null!=(f=m(e,"regularStates")||(null!=n?m(n,"regularStates"):n))?f:i,h={name:"regularStates",hash:{},fn:l.program(11,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:9,column:0},end:{line:19,column:18}}},d=typeof f==u?f.call(c,h):f,null!=(d=m(e,"regularStates")?d:s.call(n,d,h))&&(p+=d),f=null!=(f=m(e,"historyStates")||(null!=n?m(n,"historyStates"):n))?f:i,h={name:"historyStates",hash:{},fn:l.program(27,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:20,column:0},end:{line:22,column:18}}},d=typeof f==u?f.call(c,h):f,null!=(d=m(e,"historyStates")?d:s.call(n,d,h))&&(p+=d),f=null!=(f=m(e,"deepHistoryStates")||(null!=n?m(n,"deepHistoryStates"):n))?f:i,h={name:"deepHistoryStates",hash:{},fn:l.program(29,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:23,column:0},end:{line:25,column:22}}},d=typeof f==u?f.call(c,h):f,null!=(d=m(e,"deepHistoryStates")?d:s.call(n,d,h))&&(p+=d),f=null!=(f=m(e,"choiceStates")||(null!=n?m(n,"choiceStates"):n))?f:i,h={name:"choiceStates",hash:{},fn:l.program(31,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:26,column:0},end:{line:29,column:17}}},d=typeof f==u?f.call(c,h):f,null!=(d=m(e,"choiceStates")?d:s.call(n,d,h))&&(p+=d),f=null!=(f=m(e,"forkjoinStates")||(null!=n?m(n,"forkjoinStates"):n))?f:i,h={name:"forkjoinStates",hash:{},fn:l.program(43,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:30,column:0},end:{line:32,column:19}}},d=typeof f==u?f.call(c,h):f,null!=(d=m(e,"forkjoinStates")?d:s.call(n,d,h))&&(p+=d),f=null!=(f=m(e,"junctionStates")||(null!=n?m(n,"junctionStates"):n))?f:i,h={name:"junctionStates",hash:{},fn:l.program(4,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:33,column:0},end:{line:35,column:19}}},d=typeof f==u?f.call(c,h):f,null!=(d=m(e,"junctionStates")?d:s.call(n,d,h))&&(p+=d),f=null!=(f=m(e,"terminateStates")||(null!=n?m(n,"terminateStates"):n))?f:i,h={name:"terminateStates",hash:{},fn:l.program(45,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:36,column:0},end:{line:43,column:20}}},d=typeof f==u?f.call(c,h):f,null!=(d=m(e,"terminateStates")?d:s.call(n,d,h))&&(p+=d),f=null!=(f=m(e,"finalStates")||(null!=n?m(n,"finalStates"):n))?f:i,h={name:"finalStates",hash:{},fn:l.program(48,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:44,column:0},end:{line:46,column:16}}},d=typeof f==u?f.call(c,h):f,null!=(d=m(e,"finalStates")?d:s.call(n,d,h))&&(p+=d),f=null!=(f=m(e,"compositeStates")||(null!=n?m(n,"compositeStates"):n))?f:i,h={name:"compositeStates",hash:{},fn:l.program(50,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:47,column:0},end:{line:61,column:20}}},d=typeof f==u?f.call(c,h):f,null!=(d=m(e,"compositeStates")?d:s.call(n,d,h))&&(p+=d),f=null!=(f=m(e,"states")||(null!=n?m(n,"states"):n))?f:i,h={name:"states",hash:{},fn:l.program(60,t,0,o,r),inverse:l.noop,data:t,loc:{start:{line:62,column:0},end:{line:67,column:11}}},d=typeof f==u?f.call(c,h):f,null!=(d=m(e,"states")?d:s.call(n,d,h))&&(p+=d),p},useData:!0,useDepths:!0});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Handlebars=require("handlebars/dist/handlebars.runtime"),template=Handlebars.template,templates=Handlebars.templates=Handlebars.templates||{};templates["dot.template.hbs"]=template({1:function(l,n,o,e,a,t,r){var u=null!=n?n:l.nullContext||{},c=l.hooks.helperMissing,s="function",i=l.hooks.blockHelperMissing,m=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]},p="",f=null!=(f=m(o,"noteName")||(null!=n?m(n,"noteName"):n))?f:c,h={name:"noteName",hash:{},fn:l.noop,inverse:l.program(2,a,0,t,r),data:a,loc:{start:{line:9,column:2},end:{line:26,column:15}}},d=typeof f==s?f.call(u,h):f;return null!=(d=m(o,"noteName")?d:i.call(n,d,h))&&(p+=d),f=null!=(f=m(o,"noteName")||(null!=n?m(n,"noteName"):n))?f:c,h={name:"noteName",hash:{},fn:l.program(19,a,0,t,r),inverse:l.noop,data:a,loc:{start:{line:27,column:2},end:{line:37,column:15}}},d=typeof f==s?f.call(u,h):f,null!=(d=m(o,"noteName")?d:i.call(n,d,h))&&(p+=d),p},2:function(l,n,o,e,a){var t=null!=n?n:l.nullContext||{},r=l.hooks.helperMissing,u="function",c=l.hooks.blockHelperMissing,s=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]},i="",m=null!=(m=s(o,"isCompositeSelf")||(null!=n?s(n,"isCompositeSelf"):n))?m:r,p={name:"isCompositeSelf",hash:{},fn:l.noop,inverse:l.program(3,a,0),data:a,loc:{start:{line:10,column:4},end:{line:16,column:24}}},f=typeof m==u?m.call(t,p):m;return null!=(f=s(o,"isCompositeSelf")?f:c.call(n,f,p))&&(i+=f),m=null!=(m=s(o,"isCompositeSelf")||(null!=n?s(n,"isCompositeSelf"):n))?m:r,p={name:"isCompositeSelf",hash:{},fn:l.program(14,a,0),inverse:l.noop,data:a,loc:{start:{line:17,column:4},end:{line:25,column:24}}},f=typeof m==u?m.call(t,p):m,null!=(f=s(o,"isCompositeSelf")?f:c.call(n,f,p))&&(i+=f),i},3:function(l,n,o,e,a){var t=null!=n?n:l.nullContext||{},r=l.hooks.helperMissing,u="function",c=l.hooks.blockHelperMissing,s=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]},i=' "'+(null!=(f=typeof(m=null!=(m=s(o,"from")||(null!=n?s(n,"from"):n))?m:r)==u?m.call(t,{name:"from",hash:{},data:a,loc:{start:{line:11,column:5},end:{line:11,column:15}}}):m)?f:"")+'" -> "'+(null!=(f=typeof(m=null!=(m=s(o,"to")||(null!=n?s(n,"to"):n))?m:r)==u?m.call(t,{name:"to",hash:{},data:a,loc:{start:{line:11,column:21},end:{line:11,column:29}}}):m)?f:"")+'" [label="',m=null!=(m=s(o,"label")||(null!=n?s(n,"label"):n))?m:r,p={name:"label",hash:{},fn:l.noop,inverse:l.program(4,a,0),data:a,loc:{start:{line:11,column:39},end:{line:11,column:60}}},f=typeof m==u?m.call(t,p):m;return null!=(f=s(o,"label")?f:c.call(n,f,p))&&(i+=f),i+=(null!=(f=typeof(m=null!=(m=s(o,"label")||(null!=n?s(n,"label"):n))?m:r)==u?m.call(t,{name:"label",hash:{},data:a,loc:{start:{line:11,column:60},end:{line:11,column:71}}}):m)?f:"")+'"',m=null!=(m=s(o,"fromComposite")||(null!=n?s(n,"fromComposite"):n))?m:r,p={name:"fromComposite",hash:{},fn:l.program(6,a,0),inverse:l.noop,data:a,loc:{start:{line:12,column:28},end:{line:12,column:92}}},f=typeof m==u?m.call(t,p):m,null!=(f=s(o,"fromComposite")?f:c.call(n,f,p))&&(i+=f),m=null!=(m=s(o,"toComposite")||(null!=n?s(n,"toComposite"):n))?m:r,p={name:"toComposite",hash:{},fn:l.program(8,a,0),inverse:l.noop,data:a,loc:{start:{line:13,column:28},end:{line:13,column:86}}},f=typeof m==u?m.call(t,p):m,null!=(f=s(o,"toComposite")?f:c.call(n,f,p))&&(i+=f),m=null!=(m=s(o,"color")||(null!=n?s(n,"color"):n))?m:r,p={name:"color",hash:{},fn:l.program(10,a,0),inverse:l.noop,data:a,loc:{start:{line:14,column:28},end:{line:14,column:85}}},f=typeof m==u?m.call(t,p):m,null!=(f=s(o,"color")?f:c.call(n,f,p))&&(i+=f),m=null!=(m=s(o,"width")||(null!=n?s(n,"width"):n))?m:r,p={name:"width",hash:{},fn:l.program(12,a,0),inverse:l.noop,data:a,loc:{start:{line:15,column:28},end:{line:15,column:68}}},f=typeof m==u?m.call(t,p):m,null!=(f=s(o,"width")?f:c.call(n,f,p))&&(i+=f),i+' class="'+(null!=(f=typeof(m=null!=(m=s(o,"class")||(null!=n?s(n,"class"):n))?m:r)==u?m.call(t,{name:"class",hash:{},data:a,loc:{start:{line:15,column:76},end:{line:15,column:87}}}):m)?f:"")+'"]\n'},4:function(l,n,o,e,a){return" "},6:function(l,n,o,e,a){var t=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return' ltail="cluster_'+(null!=(t="function"==typeof(o=null!=(o=t(o,"from")||(null!=n?t(n,"from"):n))?o:l.hooks.helperMissing)?o.call(null!=n?n:l.nullContext||{},{name:"from",hash:{},data:a,loc:{start:{line:12,column:63},end:{line:12,column:73}}}):o)?t:"")+'"'},8:function(l,n,o,e,a){var t=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return' lhead="cluster_'+(null!=(t="function"==typeof(o=null!=(o=t(o,"to")||(null!=n?t(n,"to"):n))?o:l.hooks.helperMissing)?o.call(null!=n?n:l.nullContext||{},{name:"to",hash:{},data:a,loc:{start:{line:13,column:61},end:{line:13,column:69}}}):o)?t:"")+'"'},10:function(l,n,o,e,a){var t,l=l.lambda;return' color="'+(null!=(t=l(n,n))?t:"")+'" fontcolor="'+(null!=(t=l(n,n))?t:"")+'"'},12:function(l,n,o,e,a){return' penwidth="'+(null!=(l=l.lambda(n,n))?l:"")+'"'},14:function(l,n,o,e,a){var t=null!=n?n:l.nullContext||{},r=l.hooks.helperMissing,u="function",c=l.hooks.blockHelperMissing,s=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]},i=' "'+(null!=(f=typeof(m=null!=(m=s(o,"from")||(null!=n?s(n,"from"):n))?m:r)==u?m.call(t,{name:"from",hash:{},data:a,loc:{start:{line:18,column:7},end:{line:18,column:17}}}):m)?f:"")+'" -> "self_'+(null!=(f=typeof(m=null!=(m=s(o,"name")||(null!=n?s(n,"name"):n))?m:r)==u?m.call(t,{name:"name",hash:{},data:a,loc:{start:{line:18,column:28},end:{line:18,column:38}}}):m)?f:"")+'" [label="',m=null!=(m=s(o,"label")||(null!=n?s(n,"label"):n))?m:r,p={name:"label",hash:{},fn:l.noop,inverse:l.program(4,a,0),data:a,loc:{start:{line:18,column:48},end:{line:18,column:69}}},f=typeof m==u?m.call(t,p):m;return null!=(f=s(o,"label")?f:c.call(n,f,p))&&(i+=f),i+=(null!=(f=typeof(m=null!=(m=s(o,"label")||(null!=n?s(n,"label"):n))?m:r)==u?m.call(t,{name:"label",hash:{},data:a,loc:{start:{line:18,column:69},end:{line:18,column:80}}}):m)?f:"")+'" arrowhead=none',m=null!=(m=s(o,"tailportflags")||(null!=n?s(n,"tailportflags"):n))?m:r,p={name:"tailportflags",hash:{},fn:l.program(15,a,0),inverse:l.noop,data:a,loc:{start:{line:19,column:28},end:{line:19,column:73}}},f=typeof m==u?m.call(t,p):m,null!=(f=s(o,"tailportflags")?f:c.call(n,f,p))&&(i+=f),i+=' ltail="cluster_'+(null!=(f=typeof(m=null!=(m=s(o,"from")||(null!=n?s(n,"from"):n))?m:r)==u?m.call(t,{name:"from",hash:{},data:a,loc:{start:{line:19,column:89},end:{line:19,column:99}}}):m)?f:"")+'"',m=null!=(m=s(o,"color")||(null!=n?s(n,"color"):n))?m:r,p={name:"color",hash:{},fn:l.program(10,a,0),inverse:l.noop,data:a,loc:{start:{line:20,column:28},end:{line:20,column:85}}},f=typeof m==u?m.call(t,p):m,null!=(f=s(o,"color")?f:c.call(n,f,p))&&(i+=f),i+=' class="'+(null!=(f=typeof(m=null!=(m=s(o,"class")||(null!=n?s(n,"class"):n))?m:r)==u?m.call(t,{name:"class",hash:{},data:a,loc:{start:{line:20,column:93},end:{line:20,column:104}}}):m)?f:"")+'"]\n "self_'+(null!=(f=typeof(m=null!=(m=s(o,"name")||(null!=n?s(n,"name"):n))?m:r)==u?m.call(t,{name:"name",hash:{},data:a,loc:{start:{line:21,column:12},end:{line:21,column:22}}}):m)?f:"")+'" -> "'+(null!=(f=typeof(m=null!=(m=s(o,"from")||(null!=n?s(n,"from"):n))?m:r)==u?m.call(t,{name:"from",hash:{},data:a,loc:{start:{line:21,column:28},end:{line:21,column:38}}}):m)?f:"")+'" [lhead="cluster_'+(null!=(f=typeof(m=null!=(m=s(o,"from")||(null!=n?s(n,"from"):n))?m:r)==u?m.call(t,{name:"from",hash:{},data:a,loc:{start:{line:21,column:56},end:{line:21,column:66}}}):m)?f:"")+'"',m=null!=(m=s(o,"headportflags")||(null!=n?s(n,"headportflags"):n))?m:r,p={name:"headportflags",hash:{},fn:l.program(15,a,0),inverse:l.noop,data:a,loc:{start:{line:22,column:28},end:{line:22,column:73}}},f=typeof m==u?m.call(t,p):m,null!=(f=s(o,"headportflags")?f:c.call(n,f,p))&&(i+=f),m=null!=(m=s(o,"color")||(null!=n?s(n,"color"):n))?m:r,p={name:"color",hash:{},fn:l.program(17,a,0),inverse:l.noop,data:a,loc:{start:{line:23,column:28},end:{line:23,column:65}}},f=typeof m==u?m.call(t,p):m,null!=(f=s(o,"color")?f:c.call(n,f,p))&&(i+=f),m=null!=(m=s(o,"width")||(null!=n?s(n,"width"):n))?m:r,p={name:"width",hash:{},fn:l.program(12,a,0),inverse:l.noop,data:a,loc:{start:{line:24,column:28},end:{line:24,column:68}}},f=typeof m==u?m.call(t,p):m,null!=(f=s(o,"width")?f:c.call(n,f,p))&&(i+=f),i+' class="'+(null!=(f=typeof(m=null!=(m=s(o,"class")||(null!=n?s(n,"class"):n))?m:r)==u?m.call(t,{name:"class",hash:{},data:a,loc:{start:{line:24,column:76},end:{line:24,column:87}}}):m)?f:"")+'"]\n'},15:function(l,n,o,e,a){return" "+(null!=(l=l.lambda(n,n))?l:"")},17:function(l,n,o,e,a){return' color="'+(null!=(l=l.lambda(n,n))?l:"")+'"'},19:function(l,n,o,e,a,t,r){var u,c=l.lambda,s=l.hooks.blockHelperMissing,i=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return' "i_'+(null!=(u=c(n,n))?u:"")+'" [shape=point style=invis margin=0 width=0 height=0 fixedsize=true]\n "'+(null!=(u=c(null!=r[1]?i(r[1],"from"):r[1],n))?u:"")+'" -> "i_'+(null!=(u=c(n,n))?u:"")+'" [arrowhead=none'+(null!=(u=s.call(n,c(null!=r[1]?i(r[1],"fromComposite"):r[1],n),{name:"../fromComposite",hash:{},fn:l.program(20,a,0,t,r),inverse:l.noop,data:a,loc:{start:{line:30,column:32},end:{line:30,column:105}}}))?u:"")+(null!=(u=s.call(n,c(null!=r[1]?i(r[1],"color"):r[1],n),{name:"../color",hash:{},fn:l.program(17,a,0,t,r),inverse:l.noop,data:a,loc:{start:{line:31,column:32},end:{line:31,column:75}}}))?u:"")+']\n "i_'+(null!=(u=c(n,n))?u:"")+'" -> "'+(null!=(u=c(null!=r[1]?i(r[1],"to"):r[1],n))?u:"")+'" [label="'+(null!=(u=s.call(n,c(null!=r[1]?i(r[1],"label"):r[1],n),{name:"../label",hash:{},fn:l.noop,inverse:l.program(4,a,0,t,r),data:a,loc:{start:{line:32,column:43},end:{line:32,column:70}}}))?u:"")+(null!=(u=c(null!=r[1]?i(r[1],"label"):r[1],n))?u:"")+'"'+(null!=(u=s.call(n,c(null!=r[1]?i(r[1],"toComposite"):r[1],n),{name:"../toComposite",hash:{},fn:l.program(22,a,0,t,r),inverse:l.noop,data:a,loc:{start:{line:33,column:32},end:{line:33,column:99}}}))?u:"")+(null!=(u=s.call(n,c(null!=r[1]?i(r[1],"color"):r[1],n),{name:"../color",hash:{},fn:l.program(10,a,0,t,r),inverse:l.noop,data:a,loc:{start:{line:34,column:32},end:{line:34,column:95}}}))?u:"")+']\n "i_'+(null!=(u=c(n,n))?u:"")+'" -> "'+(null!=(u=c(n,n))?u:"")+'" [style=dashed arrowtail=none arrowhead=none weight=0]\n "'+(null!=(u=c(n,n))?u:"")+'" [label="'+(null!=(u=c(null!=r[1]?i(r[1],"noteFlattened"):r[1],n))?u:"")+'" shape=note fontsize=10 color=black fontcolor=black fillcolor="#ffffcc" penwidth=1.0]\n'},20:function(l,n,o,e,a,t,r){var u=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return' ltail="cluster_'+(null!=(l=l.lambda(null!=r[1]?u(r[1],"from"):r[1],n))?l:"")+'"'},22:function(l,n,o,e,a,t,r){var u=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]};return' lhead="cluster_'+(null!=(l=l.lambda(null!=r[1]?u(r[1],"to"):r[1],n))?l:"")+'"'},compiler:[8,">= 4.3.0"],main:function(l,n,o,e,a,t,r){var u=null!=n?n:l.nullContext||{},c=l.hooks.helperMissing,s="function",i=l.lookupProperty||function(l,n){if(Object.prototype.hasOwnProperty.call(l,n))return l[n]},e='digraph "state transitions" {\n '+(null!=(p=typeof(m=null!=(m=i(o,"graphAttributes")||(null!=n?i(n,"graphAttributes"):n))?m:c)==s?m.call(u,{name:"graphAttributes",hash:{},data:a,loc:{start:{line:2,column:2},end:{line:2,column:23}}}):m)?p:"")+"\n node ["+(null!=(p=typeof(m=null!=(m=i(o,"nodeAttributes")||(null!=n?i(n,"nodeAttributes"):n))?m:c)==s?m.call(u,{name:"nodeAttributes",hash:{},data:a,loc:{start:{line:3,column:8},end:{line:3,column:28}}}):m)?p:"")+"]\n edge ["+(null!=(p=typeof(m=null!=(m=i(o,"edgeAttributes")||(null!=n?i(n,"edgeAttributes"):n))?m:c)==s?m.call(u,{name:"edgeAttributes",hash:{},data:a,loc:{start:{line:4,column:8},end:{line:4,column:28}}}):m)?p:"")+"]\n\n"+(null!=(p=l.invokePartial(i(e,"dot.states.template.hbs"),n,{name:"dot.states.template.hbs",data:a,indent:" ",helpers:o,partials:e,decorators:l.decorators}))?p:"")+"\n",m=null!=(m=i(o,"transitions")||(null!=n?i(n,"transitions"):n))?m:c,c={name:"transitions",hash:{},fn:l.program(1,a,0,t,r),inverse:l.noop,data:a,loc:{start:{line:8,column:2},end:{line:38,column:18}}},p=typeof m==s?m.call(u,c):m;return null!=(p=i(o,"transitions")?p:l.hooks.blockHelperMissing.call(n,p,c))&&(e+=p),e+"}\n"},usePartial:!0,useData:!0,useDepths:!0});
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import Handlebars from "handlebars/dist/handlebars.runtime.js";
|
|
2
|
-
await import("./dot.template.cjs");
|
|
3
|
-
await import("./dot.states.template.cjs");
|
|
4
|
-
Handlebars.registerPartial(
|
|
5
|
-
"dot.states.template.hbs",
|
|
6
|
-
Handlebars.templates["dot.states.template.hbs"],
|
|
7
|
-
);
|
|
8
|
-
Handlebars.registerHelper("stateSection", (pStateMachine) =>
|
|
9
|
-
Handlebars.templates["dot.states.template.hbs"](splitStates(pStateMachine)),
|
|
10
|
-
);
|
|
11
|
-
function isType(pString) {
|
|
12
|
-
return (pState) => pState.type === pString;
|
|
13
|
-
}
|
|
14
|
-
function isOneOfTypes(pStringArray) {
|
|
15
|
-
return (pState) => pStringArray.includes(pState.type);
|
|
16
|
-
}
|
|
17
|
-
function splitStates(pStateMachine) {
|
|
18
|
-
pStateMachine.initialStates = pStateMachine.states.filter(isType("initial"));
|
|
19
|
-
pStateMachine.regularStates = pStateMachine.states.filter(
|
|
20
|
-
(pState) => isType("regular")(pState) && !pState.statemachine,
|
|
21
|
-
);
|
|
22
|
-
pStateMachine.historyStates = pStateMachine.states.filter(isType("history"));
|
|
23
|
-
pStateMachine.deepHistoryStates = pStateMachine.states.filter(
|
|
24
|
-
isType("deephistory"),
|
|
25
|
-
);
|
|
26
|
-
pStateMachine.choiceStates = pStateMachine.states.filter(isType("choice"));
|
|
27
|
-
pStateMachine.forkjoinStates = pStateMachine.states.filter(
|
|
28
|
-
isOneOfTypes(["fork", "join", "forkjoin"]),
|
|
29
|
-
);
|
|
30
|
-
pStateMachine.junctionStates = pStateMachine.states.filter(
|
|
31
|
-
isType("junction"),
|
|
32
|
-
);
|
|
33
|
-
pStateMachine.terminateStates = pStateMachine.states.filter(
|
|
34
|
-
isType("terminate"),
|
|
35
|
-
);
|
|
36
|
-
pStateMachine.finalStates = pStateMachine.states.filter(isType("final"));
|
|
37
|
-
pStateMachine.compositeStates = pStateMachine.states.filter(
|
|
38
|
-
(pState) => pState.statemachine,
|
|
39
|
-
);
|
|
40
|
-
return pStateMachine;
|
|
41
|
-
}
|
|
42
|
-
export default function renderDotFromAST(pStateMachine) {
|
|
43
|
-
return Handlebars.templates["dot.template.hbs"](pStateMachine);
|
|
44
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import utl from "./utl.mjs";
|
|
2
|
-
function isType(pString) {
|
|
3
|
-
return (pState) => pState.type === pString;
|
|
4
|
-
}
|
|
5
|
-
function isOneOfTypes(pStringArray) {
|
|
6
|
-
return (pState) => pStringArray.includes(pState.type);
|
|
7
|
-
}
|
|
8
|
-
function setLabel(pState) {
|
|
9
|
-
const lState = structuredClone(pState);
|
|
10
|
-
lState.label = pState.label || pState.name;
|
|
11
|
-
return lState;
|
|
12
|
-
}
|
|
13
|
-
function nameNote(pState) {
|
|
14
|
-
if (pState.note) {
|
|
15
|
-
return {
|
|
16
|
-
noteName: `note_${pState.name}`,
|
|
17
|
-
...pState,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
return pState;
|
|
21
|
-
}
|
|
22
|
-
function classifyState(pState) {
|
|
23
|
-
const lState = { ...pState };
|
|
24
|
-
const lClasses = ["state", pState.type];
|
|
25
|
-
if (pState.class) {
|
|
26
|
-
lClasses.push(pState.class.trim().replace(/[ ]{2,}/g, " "));
|
|
27
|
-
}
|
|
28
|
-
lState.class = lClasses.join(" ");
|
|
29
|
-
return lState;
|
|
30
|
-
}
|
|
31
|
-
function formatActionType(pString) {
|
|
32
|
-
return pString === "activity" ? "" : `${pString}/ `;
|
|
33
|
-
}
|
|
34
|
-
function flattenActions(pState) {
|
|
35
|
-
if (pState.actions) {
|
|
36
|
-
return {
|
|
37
|
-
...pState,
|
|
38
|
-
actionStrings: pState.actions.map(
|
|
39
|
-
(pAction) => `${formatActionType(pAction.type)}${pAction.body}`,
|
|
40
|
-
),
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
return pState;
|
|
44
|
-
}
|
|
45
|
-
function flattenNote(pState) {
|
|
46
|
-
if (pState.note) {
|
|
47
|
-
return {
|
|
48
|
-
...pState,
|
|
49
|
-
noteFlattened: pState.note.join(""),
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
return pState;
|
|
53
|
-
}
|
|
54
|
-
function recolor(pNodeAttributes) {
|
|
55
|
-
return (pState) => {
|
|
56
|
-
const lNodeColor = (pNodeAttributes || []).find(
|
|
57
|
-
(pAttribute) => pAttribute.name === "color",
|
|
58
|
-
)?.value;
|
|
59
|
-
if (
|
|
60
|
-
lNodeColor &&
|
|
61
|
-
!pState.color &&
|
|
62
|
-
isOneOfTypes([
|
|
63
|
-
"initial",
|
|
64
|
-
"fork",
|
|
65
|
-
"join",
|
|
66
|
-
"junction",
|
|
67
|
-
"forkjoin",
|
|
68
|
-
"final",
|
|
69
|
-
])(pState)
|
|
70
|
-
) {
|
|
71
|
-
pState.color = lNodeColor;
|
|
72
|
-
}
|
|
73
|
-
return pState;
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
function escapeStateStrings(pState) {
|
|
77
|
-
if (pState.note) {
|
|
78
|
-
return {
|
|
79
|
-
...pState,
|
|
80
|
-
note: pState.note.map(utl.escapeString),
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
return pState;
|
|
84
|
-
}
|
|
85
|
-
function tipForkJoinStates(pDirection) {
|
|
86
|
-
return (pState) => {
|
|
87
|
-
if (isOneOfTypes(["fork", "join", "forkjoin"])(pState)) {
|
|
88
|
-
return {
|
|
89
|
-
sizingExtras: utl.isVertical(pDirection) ? "height=0.1" : "width=0.1",
|
|
90
|
-
...pState,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
return pState;
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function flagParallelChildren(pState) {
|
|
97
|
-
if (
|
|
98
|
-
pState.type === "parallel" &&
|
|
99
|
-
pState.statemachine &&
|
|
100
|
-
pState.statemachine.states
|
|
101
|
-
) {
|
|
102
|
-
pState.statemachine.states = pState.statemachine.states.map(
|
|
103
|
-
(pChildState) =>
|
|
104
|
-
isType("regular")(pChildState)
|
|
105
|
-
? { ...pChildState, parentIsParallel: true }
|
|
106
|
-
: pChildState,
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
return pState;
|
|
110
|
-
}
|
|
111
|
-
export default {
|
|
112
|
-
isType,
|
|
113
|
-
isOneOfTypes,
|
|
114
|
-
setLabel,
|
|
115
|
-
classifyState,
|
|
116
|
-
nameNote,
|
|
117
|
-
flattenActions,
|
|
118
|
-
flattenNote,
|
|
119
|
-
recolor,
|
|
120
|
-
escapeStateStrings,
|
|
121
|
-
tipForkJoinStates,
|
|
122
|
-
flagParallelChildren,
|
|
123
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import utl from "./utl.mjs";
|
|
2
|
-
function escapeTransitionStrings(pTransition) {
|
|
3
|
-
const lTransition = { ...pTransition };
|
|
4
|
-
if (lTransition.note) {
|
|
5
|
-
lTransition.note = lTransition.note.map(utl.escapeString);
|
|
6
|
-
}
|
|
7
|
-
if (lTransition.label) {
|
|
8
|
-
lTransition.label = utl.escapeLabelString(lTransition.label);
|
|
9
|
-
}
|
|
10
|
-
return lTransition;
|
|
11
|
-
}
|
|
12
|
-
function addPorts(pDirection) {
|
|
13
|
-
return (pTransition) => {
|
|
14
|
-
let lAdditionalAttributes = {};
|
|
15
|
-
if (pTransition.isCompositeSelf) {
|
|
16
|
-
if (utl.isVertical(pDirection)) {
|
|
17
|
-
lAdditionalAttributes = {
|
|
18
|
-
tailportflags: `tailport="e" headport="e"`,
|
|
19
|
-
headportflags: `tailport="w"`,
|
|
20
|
-
};
|
|
21
|
-
} else if (pTransition.hasParent) {
|
|
22
|
-
lAdditionalAttributes = {
|
|
23
|
-
tailportflags: `tailport="n" headport="n"`,
|
|
24
|
-
headportflags: `tailport="s"`,
|
|
25
|
-
};
|
|
26
|
-
} else {
|
|
27
|
-
lAdditionalAttributes = {
|
|
28
|
-
tailportflags: `tailport="s" headport="s"`,
|
|
29
|
-
headportflags: `tailport="n"`,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return { ...pTransition, ...lAdditionalAttributes };
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function classifyTransition(pTransition) {
|
|
37
|
-
const lClasses = ["transition"];
|
|
38
|
-
if (pTransition.type) {
|
|
39
|
-
lClasses.push(pTransition.type);
|
|
40
|
-
}
|
|
41
|
-
if (pTransition.class) {
|
|
42
|
-
lClasses.push(pTransition.class.trim().replace(/[ ]{2,}/g, " "));
|
|
43
|
-
}
|
|
44
|
-
pTransition.class = lClasses.join(" ");
|
|
45
|
-
return pTransition;
|
|
46
|
-
}
|
|
47
|
-
export default { escapeTransitionStrings, addPorts, classifyTransition };
|