@statewalker/fsm-charts 0.1.0 → 0.1.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.
|
@@ -73,6 +73,19 @@ var StateChartIndex = class {
|
|
|
73
73
|
);
|
|
74
74
|
return t;
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Returns a list of edge objects corresponding to all transitions from the state
|
|
78
|
+
* @param stateId identifier of the source state
|
|
79
|
+
* @returns a list of graph edges
|
|
80
|
+
*/
|
|
81
|
+
getTransitions(stateId) {
|
|
82
|
+
const stack = this.getStackByStateId(stateId);
|
|
83
|
+
const state = stack.pop();
|
|
84
|
+
if (!state || !stack.length)
|
|
85
|
+
return [];
|
|
86
|
+
const parent = stack[stack.length - 1];
|
|
87
|
+
return parent.edges.filter((t) => t.from === state.key);
|
|
88
|
+
}
|
|
76
89
|
/**
|
|
77
90
|
* Returns a graph node corresponding to the specified state id.
|
|
78
91
|
* @param stateId identifier of the state
|
package/dist/index-runtime.d.ts
CHANGED
|
@@ -32,6 +32,12 @@ declare class StateChartIndex {
|
|
|
32
32
|
* @returns graph edge
|
|
33
33
|
*/
|
|
34
34
|
getTransition(stateId?: string, event?: string): StateGraphEdge | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Returns a list of edge objects corresponding to all transitions from the state
|
|
37
|
+
* @param stateId identifier of the source state
|
|
38
|
+
* @returns a list of graph edges
|
|
39
|
+
*/
|
|
40
|
+
getTransitions(stateId?: string): StateGraphEdge[];
|
|
35
41
|
/**
|
|
36
42
|
* Returns a graph node corresponding to the specified state id.
|
|
37
43
|
* @param stateId identifier of the state
|
package/dist/index-runtime.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { StateChartIndex } from './chunk-
|
|
1
|
+
export { StateChartIndex } from './chunk-EU64L34M.js';
|
|
2
2
|
import './chunk-XEO3YXBM.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { buildCharts, buildFlatCharts, getGraphParamsProvider, getLabelDimensions } from './chunk-ZSGS37QH.js';
|
|
2
2
|
export { buildStatechartCss, buildStatechartStyles, buildStatechartSvg, buildStatechartsPanel, serializeCss, toKebabCase } from './chunk-YYNW6Q2T.js';
|
|
3
3
|
import './chunk-NXWOFQMO.js';
|
|
4
|
-
export { StateChartIndex } from './chunk-
|
|
4
|
+
export { StateChartIndex } from './chunk-EU64L34M.js';
|
|
5
5
|
import './chunk-XEO3YXBM.js';
|
package/package.json
CHANGED
|
@@ -75,6 +75,19 @@ export class StateChartIndex {
|
|
|
75
75
|
return t;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Returns a list of edge objects corresponding to all transitions from the state
|
|
80
|
+
* @param stateId identifier of the source state
|
|
81
|
+
* @returns a list of graph edges
|
|
82
|
+
*/
|
|
83
|
+
getTransitions(stateId?: string): StateGraphEdge[] {
|
|
84
|
+
const stack = this.getStackByStateId(stateId);
|
|
85
|
+
const state = stack.pop();
|
|
86
|
+
if (!state || !stack.length) return [];
|
|
87
|
+
const parent = stack[stack.length - 1];
|
|
88
|
+
return parent.edges.filter((t: StateGraphEdge) => t.from === state.key);
|
|
89
|
+
}
|
|
90
|
+
|
|
78
91
|
/**
|
|
79
92
|
* Returns a graph node corresponding to the specified state id.
|
|
80
93
|
* @param stateId identifier of the state
|