@statewalker/fsm-charts 0.1.3 → 0.1.4

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.
@@ -226,6 +226,30 @@ var StateChartIndex = class {
226
226
  this.statechart = statechart;
227
227
  this._buildIndexes();
228
228
  }
229
+ /**
230
+ * Returns a state node or a chart by the specified identifier.
231
+ * @param id the id of a state node or a chart
232
+ * @returns a state node or a chart
233
+ */
234
+ getNodeById(id) {
235
+ return this._nodesIndex[id] || this._chartsIndex[id];
236
+ }
237
+ /**
238
+ * Returns a chart by the specified identifier.
239
+ * @param id the id of a state node or a chart
240
+ * @returns a state node or a chart
241
+ */
242
+ getChartById(id) {
243
+ return this._chartsIndex[id];
244
+ }
245
+ /**
246
+ * Returns an edge by the specified identifier.
247
+ * @param id the id of a graph edge
248
+ * @returns a graph edge
249
+ */
250
+ getEdgeById(id) {
251
+ return this._edgeIndex[id];
252
+ }
229
253
  /**
230
254
  * Transforms a stack of state keys to the corresponding identifiers.
231
255
  * If a key in the stack was not found then this method returns
@@ -53,6 +53,24 @@ declare class StateChartIndex {
53
53
  constructor({ statechart }: {
54
54
  statechart: StateChart;
55
55
  });
56
+ /**
57
+ * Returns a state node or a chart by the specified identifier.
58
+ * @param id the id of a state node or a chart
59
+ * @returns a state node or a chart
60
+ */
61
+ getNodeById(id: string): StateGraphNode | undefined;
62
+ /**
63
+ * Returns a chart by the specified identifier.
64
+ * @param id the id of a state node or a chart
65
+ * @returns a state node or a chart
66
+ */
67
+ getChartById(id: string): StateChart | undefined;
68
+ /**
69
+ * Returns an edge by the specified identifier.
70
+ * @param id the id of a graph edge
71
+ * @returns a graph edge
72
+ */
73
+ getEdgeById(id: string): StateGraphEdge | undefined;
56
74
  /**
57
75
  * Transforms a stack of state keys to the corresponding identifiers.
58
76
  * If a key in the stack was not found then this method returns
@@ -1,2 +1,2 @@
1
- export { RuntimeStatechartApi, StateChartIndex } from './chunk-4KTXTN7J.js';
1
+ export { RuntimeStatechartApi, StateChartIndex } from './chunk-NXS24DZQ.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-OTGN3OYG.js';
2
2
  export { buildStatechartCss, buildStatechartStyles, buildStatechartSvg, buildStatechartsPanel, serializeCss, toKebabCase } from './chunk-YYNW6Q2T.js';
3
3
  import './chunk-NXWOFQMO.js';
4
- export { RuntimeStatechartApi, StateChartIndex } from './chunk-4KTXTN7J.js';
4
+ export { RuntimeStatechartApi, StateChartIndex } from './chunk-NXS24DZQ.js';
5
5
  import './chunk-XEO3YXBM.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statewalker/fsm-charts",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "HFSM Implementation",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/statewalker/statewalker-fsm-charts",
@@ -17,6 +17,33 @@ export class StateChartIndex {
17
17
  this._buildIndexes();
18
18
  }
19
19
 
20
+ /**
21
+ * Returns a state node or a chart by the specified identifier.
22
+ * @param id the id of a state node or a chart
23
+ * @returns a state node or a chart
24
+ */
25
+ getNodeById(id: string): StateGraphNode | undefined {
26
+ return this._nodesIndex[id] || this._chartsIndex[id];
27
+ }
28
+
29
+ /**
30
+ * Returns a chart by the specified identifier.
31
+ * @param id the id of a state node or a chart
32
+ * @returns a state node or a chart
33
+ */
34
+ getChartById(id: string): StateChart | undefined {
35
+ return this._chartsIndex[id];
36
+ }
37
+
38
+ /**
39
+ * Returns an edge by the specified identifier.
40
+ * @param id the id of a graph edge
41
+ * @returns a graph edge
42
+ */
43
+ getEdgeById(id: string): StateGraphEdge | undefined {
44
+ return this._edgeIndex[id];
45
+ }
46
+
20
47
  /**
21
48
  * Transforms a stack of state keys to the corresponding identifiers.
22
49
  * If a key in the stack was not found then this method returns