state-machine-cat 9.2.5 → 10.0.0
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/commonjs/bundle.js +66 -66
- package/package.json +299 -53
- package/src/cli/attributes-parser.mjs +17 -14
- package/src/options.mjs +2 -7
- package/src/parse/scxml/index.mjs +5 -6
- package/src/parse/scxml/normalize-machine.mjs +5 -6
- package/src/parse/smcat/smcat-parser.mjs +182 -145
- package/src/render/dot/index.mjs +2 -2
- package/src/render/dot/state-transformers.mjs +3 -5
- package/src/render/index-node.mjs +1 -1
- package/src/render/index.mjs +1 -1
- package/src/render/smcat/index.js +3 -3
- package/src/transform/desugar.mjs +6 -6
- package/src/version.mjs +1 -1
- package/types/state-machine-cat.d.ts +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _get from "lodash.get";
|
|
2
1
|
import utl from "./utl.mjs";
|
|
3
2
|
|
|
4
3
|
function isType(pString) {
|
|
@@ -55,10 +54,9 @@ function flattenNote(pState) {
|
|
|
55
54
|
|
|
56
55
|
function recolor(pNodeAttributes) {
|
|
57
56
|
return (pState) => {
|
|
58
|
-
const lNodeColor =
|
|
59
|
-
(
|
|
60
|
-
|
|
61
|
-
);
|
|
57
|
+
const lNodeColor = (pNodeAttributes || []).find(
|
|
58
|
+
(pAttribute) => pAttribute.name === "color"
|
|
59
|
+
)?.value;
|
|
62
60
|
|
|
63
61
|
if (
|
|
64
62
|
lNodeColor &&
|
package/src/render/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const Handlebars = require("handlebars/dist/handlebars.runtime.js");
|
|
2
|
-
const
|
|
2
|
+
const cloneDeep = require("lodash/cloneDeep.js");
|
|
3
3
|
|
|
4
4
|
// eslint-disable-next-line import/no-unassigned-import
|
|
5
5
|
require("./smcat.template.js");
|
|
@@ -89,7 +89,7 @@ Handlebars.registerHelper("quotifyActions", (pItem) =>
|
|
|
89
89
|
module.exports = function renderSmcat(pAST) {
|
|
90
90
|
return Handlebars.templates["smcat.template.hbs"]({
|
|
91
91
|
...pAST,
|
|
92
|
-
states: transformStates(
|
|
93
|
-
transitions: transformTransitions(
|
|
92
|
+
states: transformStates(cloneDeep(pAST.states)),
|
|
93
|
+
transitions: transformTransitions(cloneDeep(pAST.transitions || [])),
|
|
94
94
|
});
|
|
95
95
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable security/detect-object-injection */
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import cloneDeep from "lodash/cloneDeep.js";
|
|
3
|
+
import reject from "lodash/reject.js";
|
|
4
4
|
import StateMachineModel from "../state-machine-model.mjs";
|
|
5
5
|
import utl from "./utl.mjs";
|
|
6
6
|
|
|
@@ -70,7 +70,7 @@ function deSugarPseudoStates(
|
|
|
70
70
|
pPseudoStateNames,
|
|
71
71
|
pOutgoingTransitionMap
|
|
72
72
|
) {
|
|
73
|
-
const lMachine =
|
|
73
|
+
const lMachine = cloneDeep(pMachine);
|
|
74
74
|
|
|
75
75
|
if (lMachine.transitions && pPseudoStateNames.length > 0) {
|
|
76
76
|
lMachine.transitions = fuseTransitions(
|
|
@@ -97,10 +97,10 @@ function deSugarPseudoStates(
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
function removeStatesCascading(pMachine, pStateNames) {
|
|
100
|
-
const lMachine =
|
|
100
|
+
const lMachine = cloneDeep(pMachine);
|
|
101
101
|
|
|
102
102
|
if (lMachine.transitions) {
|
|
103
|
-
lMachine.transitions =
|
|
103
|
+
lMachine.transitions = reject(lMachine.transitions, (pTransition) =>
|
|
104
104
|
pStateNames.some(
|
|
105
105
|
(pJunctionStateName) =>
|
|
106
106
|
pJunctionStateName === pTransition.from ||
|
|
@@ -109,7 +109,7 @@ function removeStatesCascading(pMachine, pStateNames) {
|
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
lMachine.states =
|
|
112
|
+
lMachine.states = reject(lMachine.states, (pState) =>
|
|
113
113
|
pStateNames.includes(pState.name)
|
|
114
114
|
).map((pState) =>
|
|
115
115
|
pState.statemachine
|
package/src/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "
|
|
1
|
+
export const version = "10.0.0";
|
|
@@ -252,7 +252,7 @@ export interface IRenderOptions {
|
|
|
252
252
|
* See below for the complete list.
|
|
253
253
|
* @return the string with the rendered content if
|
|
254
254
|
* no error was found
|
|
255
|
-
* @throws
|
|
255
|
+
* @throws {Error} If an error occurred and no callback
|
|
256
256
|
* function was passed: the error
|
|
257
257
|
*
|
|
258
258
|
* Options: see https://github.com/sverweij/state-machine-cat/docs/api.md
|