state-machine-cat 12.0.0 → 12.0.1
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.
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { cloneDeep } from "../../utl.mjs";
|
|
2
1
|
import options from "../../options.mjs";
|
|
3
2
|
import StateMachineModel from "../../state-machine-model.mjs";
|
|
4
3
|
import attributebuilder from "./attributebuilder.mjs";
|
|
@@ -94,7 +93,7 @@ function transformTransitions(pStateMachineModel, pDirection, pCounter) {
|
|
|
94
93
|
}
|
|
95
94
|
export default (pStateMachine, pOptions) => {
|
|
96
95
|
pOptions = pOptions || {};
|
|
97
|
-
let lStateMachine =
|
|
96
|
+
let lStateMachine = structuredClone(pStateMachine);
|
|
98
97
|
const lStateMachineModel = new StateMachineModel(lStateMachine);
|
|
99
98
|
lStateMachine.transitions = transformTransitions(lStateMachineModel, pOptions.direction, new Counter());
|
|
100
99
|
lStateMachine.states = transformStates(lStateMachine.states, pOptions.direction, pOptions.dotNodeAttrs, lStateMachineModel);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { cloneDeep } from "../../utl.mjs";
|
|
2
1
|
import utl from "./utl.mjs";
|
|
3
2
|
function isType(pString) {
|
|
4
3
|
return (pState) => pState.type === pString;
|
|
@@ -7,7 +6,7 @@ function isOneOfTypes(pStringArray) {
|
|
|
7
6
|
return (pState) => pStringArray.includes(pState.type);
|
|
8
7
|
}
|
|
9
8
|
function setLabel(pState) {
|
|
10
|
-
const lState =
|
|
9
|
+
const lState = structuredClone(pState);
|
|
11
10
|
lState.label = pState.label || pState.name;
|
|
12
11
|
return lState;
|
|
13
12
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import Handlebars from "handlebars/dist/handlebars.runtime.js";
|
|
2
|
-
import { cloneDeep } from "../../utl.mjs";
|
|
3
2
|
await import("./smcat.template.js");
|
|
4
3
|
const NAME_QUOTABLE = /;|,|{| |\[/;
|
|
5
4
|
const ACTIONS_QUOTABLE = /;|,|{/;
|
|
@@ -55,7 +54,7 @@ Handlebars.registerHelper("quotifyActions", (pItem) => quoteIfNecessary(ACTIONS_
|
|
|
55
54
|
export default function renderSmcat(pStateMachine) {
|
|
56
55
|
return Handlebars.templates["smcat.template.hbs"]({
|
|
57
56
|
...pStateMachine,
|
|
58
|
-
states: transformStates(
|
|
59
|
-
transitions: transformTransitions(
|
|
57
|
+
states: transformStates(structuredClone(pStateMachine.states)),
|
|
58
|
+
transitions: transformTransitions(structuredClone(pStateMachine.transitions || [])),
|
|
60
59
|
});
|
|
61
60
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { cloneDeep } from "../utl.mjs";
|
|
2
1
|
import StateMachineModel from "../state-machine-model.mjs";
|
|
3
2
|
import utl from "./utl.mjs";
|
|
4
3
|
function fuseTransitionAttribute(pIncomingThing, pOutgoingThing, pJoinChar) {
|
|
@@ -36,7 +35,7 @@ function fuseTransitions(pTransitions, pPseudoStateNames, pOutgoingTransitionMap
|
|
|
36
35
|
}, []);
|
|
37
36
|
}
|
|
38
37
|
function deSugarPseudoStates(pMachine, pPseudoStateNames, pOutgoingTransitionMap) {
|
|
39
|
-
const lMachine =
|
|
38
|
+
const lMachine = structuredClone(pMachine);
|
|
40
39
|
if (lMachine.transitions && pPseudoStateNames.length > 0) {
|
|
41
40
|
lMachine.transitions = fuseTransitions(lMachine.transitions, pPseudoStateNames, pOutgoingTransitionMap);
|
|
42
41
|
}
|
|
@@ -49,7 +48,7 @@ function deSugarPseudoStates(pMachine, pPseudoStateNames, pOutgoingTransitionMap
|
|
|
49
48
|
return lMachine;
|
|
50
49
|
}
|
|
51
50
|
function removeStatesCascading(pMachine, pStateNames) {
|
|
52
|
-
const lMachine =
|
|
51
|
+
const lMachine = structuredClone(pMachine);
|
|
53
52
|
if (lMachine.transitions) {
|
|
54
53
|
lMachine.transitions = lMachine.transitions.filter((pTransition) => !pStateNames.some((pJunctionStateName) => pJunctionStateName === pTransition.from ||
|
|
55
54
|
pJunctionStateName === pTransition.to));
|
package/dist/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "12.0.
|
|
1
|
+
export const version = "12.0.1";
|
package/package.json
CHANGED
package/dist/utl.mjs
DELETED