@statewalker/fsm-charts 0.2.5 → 0.2.7
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/README.md +213 -1
- package/dist/StateChart-cXyVRcs-.d.ts +94 -0
- package/dist/StateChart-cXyVRcs-.d.ts.map +1 -0
- package/dist/StateChartIndex-BK2315qj.d.ts +142 -0
- package/dist/StateChartIndex-BK2315qj.d.ts.map +1 -0
- package/dist/StateChartIndex-BOIrc_nq.js +355 -0
- package/dist/StateChartIndex-BOIrc_nq.js.map +1 -0
- package/dist/buildStatechartsPanel-BX7e0GzA.js +494 -0
- package/dist/buildStatechartsPanel-BX7e0GzA.js.map +1 -0
- package/dist/buildStatechartsPanel-hCtZbdiF.d.ts +79 -0
- package/dist/buildStatechartsPanel-hCtZbdiF.d.ts.map +1 -0
- package/dist/defineProperty-C0rC37pP.js +39 -0
- package/dist/description-panels-DI2MNlbK.js +184 -0
- package/dist/description-panels-DI2MNlbK.js.map +1 -0
- package/dist/getLabelDimensions-BY0q7j3D.d.ts +79 -0
- package/dist/getLabelDimensions-BY0q7j3D.d.ts.map +1 -0
- package/dist/getPadding-Cw0e7G2v.js +25 -0
- package/dist/getPadding-Cw0e7G2v.js.map +1 -0
- package/dist/index-config.d.ts +3 -12
- package/dist/index-config.js +2 -2
- package/dist/index-dom.d.ts +2 -49
- package/dist/index-dom.js +2 -2
- package/dist/index-html.d.ts +3 -2
- package/dist/index-html.js +2 -3
- package/dist/index-layout.d.ts +3 -77
- package/dist/index-layout.js +2 -3
- package/dist/index-runtime.d.ts +3 -141
- package/dist/index-runtime.js +2 -2
- package/dist/index.d.ts +11 -10
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -7
- package/dist/layout-Dp671N6q.js +2465 -0
- package/dist/layout-Dp671N6q.js.map +1 -0
- package/dist/newTreeBuilder-CvtLDjGj.d.ts +54 -0
- package/dist/newTreeBuilder-CvtLDjGj.d.ts.map +1 -0
- package/dist/toFsmStateConfig-DlJkyZni.js +135 -0
- package/dist/toFsmStateConfig-DlJkyZni.js.map +1 -0
- package/dist/toFsmStateConfig-DmOlTRjv.d.ts +15 -0
- package/dist/toFsmStateConfig-DmOlTRjv.d.ts.map +1 -0
- package/package.json +52 -27
- package/src/config/concatTransitionsToString.ts +2 -2
- package/src/config/splitTransitionString.ts +1 -3
- package/src/config/toFsmStateConfig.ts +2 -9
- package/src/dom/buildSections.ts +3 -11
- package/src/dom/description-panels.ts +2 -4
- package/src/dom/getStatesDescriptions.ts +3 -9
- package/src/html/buildStatechartStyles.ts +4 -14
- package/src/html/buildStatechartSvg.ts +2 -14
- package/src/html/buildStatechartsPanel.ts +1 -3
- package/src/layout/buildCharts.ts +1 -2
- package/src/layout/buildFlatCharts.ts +6 -8
- package/src/layout/getGraphParamsProvider.ts +3 -12
- package/src/runtime/RuntimeStatechartApi.ts +10 -32
- package/src/runtime/StateChartIndex.ts +6 -23
- package/src/types/GraphParamsProvider.ts +1 -4
- package/src/utils/BasisCurve.ts +5 -14
- package/src/utils/domToText.ts +2 -6
- package/src/utils/getPadding.ts +1 -2
- package/src/utils/newId.ts +2 -1
- package/src/utils/newRegistry.ts +12 -12
- package/src/utils/serializeAttrs.ts +3 -13
- package/src/utils/serializeCss.ts +1 -5
- package/src/utils/serializeStyle.ts +1 -4
- package/src/utils/toKebabCase.ts +1 -4
- package/dist/StateChart-BYBjTmC2.d.ts +0 -82
- package/dist/chunk-2LFUT2C6.js +0 -2691
- package/dist/chunk-ARZYBFNA.js +0 -133
- package/dist/chunk-CR2M4445.js +0 -608
- package/dist/chunk-FIQDLBWD.js +0 -9
- package/dist/chunk-GW2Z65BN.js +0 -429
- package/dist/chunk-PKBMQBKP.js +0 -5
- package/dist/chunk-RZ4FP6JB.js +0 -233
- package/dist/index-html-BBQqYoST.d.ts +0 -75
- package/src/full/index.ts +0 -1
- package/src/full/toFsmStateCharts.ts +0 -119
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { t as _defineProperty } from "./defineProperty-C0rC37pP.js";
|
|
2
|
+
//#region src/runtime/RuntimeStatechartApi.ts
|
|
3
|
+
var RuntimeStatechartApi = class {
|
|
4
|
+
constructor({ element, statechart }) {
|
|
5
|
+
_defineProperty(this, "element", void 0);
|
|
6
|
+
_defineProperty(this, "statechart", void 0);
|
|
7
|
+
_defineProperty(this, "_listenersCounter", 0);
|
|
8
|
+
_defineProperty(this, "_transitionsClickListeners", {});
|
|
9
|
+
_defineProperty(this, "_statesClickListeners", {});
|
|
10
|
+
_defineProperty(this, "_registry", {});
|
|
11
|
+
this.element = element;
|
|
12
|
+
this.statechart = statechart;
|
|
13
|
+
this._bindListeners();
|
|
14
|
+
}
|
|
15
|
+
close() {
|
|
16
|
+
for (const r of Object.values(this._registry)) r?.();
|
|
17
|
+
this._registry = {};
|
|
18
|
+
this._transitionsClickListeners = {};
|
|
19
|
+
this._statesClickListeners = {};
|
|
20
|
+
}
|
|
21
|
+
onStateClick(listener) {
|
|
22
|
+
return this._addListener(this._statesClickListeners, listener);
|
|
23
|
+
}
|
|
24
|
+
onTransitionClick(listener) {
|
|
25
|
+
return this._addListener(this._transitionsClickListeners, listener);
|
|
26
|
+
}
|
|
27
|
+
openStatePanels() {
|
|
28
|
+
this._setStatePanelStatus(`details[data-state-id]`, true);
|
|
29
|
+
}
|
|
30
|
+
closeStatePanels() {
|
|
31
|
+
this._setStatePanelStatus(`details[data-state-id]`, false);
|
|
32
|
+
}
|
|
33
|
+
isStatePanelOpen(stateId) {
|
|
34
|
+
const elm = this.element.querySelector(`details[data-state-id="${stateId}"]`);
|
|
35
|
+
return elm && !!elm.open;
|
|
36
|
+
}
|
|
37
|
+
toggleState(...stateIds) {
|
|
38
|
+
const lastId = stateIds[stateIds.length - 1];
|
|
39
|
+
const selected = this.isStateSelected(lastId);
|
|
40
|
+
this.deselectStates();
|
|
41
|
+
this.closeStatePanels();
|
|
42
|
+
this.activateStates(...stateIds);
|
|
43
|
+
if (selected) {
|
|
44
|
+
this.deselectState(lastId);
|
|
45
|
+
this.closeStatePanel(lastId);
|
|
46
|
+
}
|
|
47
|
+
return !selected;
|
|
48
|
+
}
|
|
49
|
+
activateStates(...stateIds) {
|
|
50
|
+
for (let i = 0; i < stateIds.length; i++) {
|
|
51
|
+
const id = stateIds[i];
|
|
52
|
+
this.openStatePanel(id);
|
|
53
|
+
this.selectState(id);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
focusStates(...stateIds) {
|
|
57
|
+
for (let i = 0; i < stateIds.length; i++) {
|
|
58
|
+
const stateId = stateIds[i];
|
|
59
|
+
for (const tagName of ["details", "g"]) this.element.querySelector(`${tagName}[data-state-id="${stateId}"]`)?.scrollIntoView();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
setStateDescription(stateId, description) {
|
|
63
|
+
const descriptionContainer = this.element.querySelector(`details[data-state-id="${stateId}"] .state-details__description`);
|
|
64
|
+
if (descriptionContainer) {
|
|
65
|
+
descriptionContainer.innerHTML = "";
|
|
66
|
+
descriptionContainer.append(description ?? "");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
closeStatePanel(stateId) {
|
|
70
|
+
this._setStatePanelStatus(`details[data-state-id="${stateId}"]`, false);
|
|
71
|
+
}
|
|
72
|
+
openStatePanel(stateId) {
|
|
73
|
+
this._setStatePanelStatus(`details[data-state-id="${stateId}"]`, true);
|
|
74
|
+
}
|
|
75
|
+
deselectTransitions(modifier = "selected") {
|
|
76
|
+
this._removeTransitionsModifier("[data-transition-id]", modifier);
|
|
77
|
+
}
|
|
78
|
+
deselectTransition(id, modifier = "selected") {
|
|
79
|
+
this._removeTransitionsModifier(`[data-transition-id="${id}"]`, modifier);
|
|
80
|
+
}
|
|
81
|
+
selectTransition(id, modifier = "selected") {
|
|
82
|
+
this._addTransitionsModifier(`[data-transition-id="${id}"]`, modifier);
|
|
83
|
+
}
|
|
84
|
+
toggleTransition(id, modifier = "selected") {
|
|
85
|
+
const selected = this.isTransitionSelected(id, modifier);
|
|
86
|
+
this.deselectTransitions();
|
|
87
|
+
if (!selected) this.selectTransition(id, modifier);
|
|
88
|
+
}
|
|
89
|
+
isTransitionSelected(id, modifier = "selected") {
|
|
90
|
+
const elm = this.element.querySelector(`[data-transition-id="${id}"]`);
|
|
91
|
+
const stateModifier = `transition--${modifier}`;
|
|
92
|
+
return !!elm?.classList.contains(stateModifier);
|
|
93
|
+
}
|
|
94
|
+
deselectStates(modifier = "selected") {
|
|
95
|
+
this._removeStateModifier("[data-state-id]", modifier);
|
|
96
|
+
}
|
|
97
|
+
isStateSelected(id, modifier = "selected") {
|
|
98
|
+
const elm = this.element.querySelector(`[data-state-id="${id}"]`);
|
|
99
|
+
const stateModifier = `state--${modifier}`;
|
|
100
|
+
return !!elm?.classList.contains(stateModifier);
|
|
101
|
+
}
|
|
102
|
+
deselectState(id, modifier = "selected") {
|
|
103
|
+
this._removeStateModifier(`[data-state-id="${id}"]`, modifier);
|
|
104
|
+
}
|
|
105
|
+
selectState(id, modifier = "selected") {
|
|
106
|
+
this._addStateModifier(`[data-state-id="${id}"]`, modifier);
|
|
107
|
+
}
|
|
108
|
+
_addListener(index, listener) {
|
|
109
|
+
const id = this._listenersCounter++;
|
|
110
|
+
index[id] = listener;
|
|
111
|
+
return () => {
|
|
112
|
+
delete index[id];
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
_bindListeners() {
|
|
116
|
+
const bindListeners = (index, dataField, eventType) => {
|
|
117
|
+
function newEventListener(index, elm) {
|
|
118
|
+
return (ev) => {
|
|
119
|
+
ev.preventDefault();
|
|
120
|
+
ev.stopPropagation();
|
|
121
|
+
let id = elm.getAttribute(dataField);
|
|
122
|
+
if (!id) id = elm.closest(`[${dataField}]`)?.getAttribute(dataField);
|
|
123
|
+
if (id) for (const listener of Object.values(index)) listener(id);
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
[...this.element.querySelectorAll(`[${dataField}]`)].forEach((elm) => {
|
|
127
|
+
const eventListener = newEventListener(index, elm);
|
|
128
|
+
elm.addEventListener(eventType, eventListener);
|
|
129
|
+
this._addListener(this._registry, () => elm.removeEventListener(eventType, eventListener));
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
bindListeners(this._statesClickListeners, "data-state-id", "click");
|
|
133
|
+
bindListeners(this._transitionsClickListeners, "data-transition-id", "click");
|
|
134
|
+
}
|
|
135
|
+
_setStatePanelStatus(selector, open) {
|
|
136
|
+
[...this.element.querySelectorAll(selector)].forEach((elm) => {
|
|
137
|
+
if (open) elm.setAttribute("open", "open");
|
|
138
|
+
else elm.removeAttribute("open");
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
_addStateModifier(cssSelector, modifier = "selected") {
|
|
142
|
+
this._applyStateModifier(cssSelector, modifier, (elm, cls) => elm?.classList.add(cls));
|
|
143
|
+
}
|
|
144
|
+
_removeStateModifier(cssSelector, modifier = "selected") {
|
|
145
|
+
this._applyStateModifier(cssSelector, modifier, (elm, cls) => elm?.classList.remove(cls));
|
|
146
|
+
}
|
|
147
|
+
_applyStateModifier(cssSelector, modifier = "selected", apply) {
|
|
148
|
+
const detailsModifier = `state-details--${modifier}`;
|
|
149
|
+
const stateLabelsModifier = `state-details__label--${modifier}`;
|
|
150
|
+
const stateModifier = `state--${modifier}`;
|
|
151
|
+
[...this.element.querySelectorAll(cssSelector)].forEach((elm) => {
|
|
152
|
+
if (elm.tagName.toLowerCase() === "details") {
|
|
153
|
+
apply(elm, detailsModifier);
|
|
154
|
+
const labelElm = elm.querySelector(".state-details__label");
|
|
155
|
+
if (labelElm) apply(labelElm, stateLabelsModifier);
|
|
156
|
+
} else apply(elm, stateModifier);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
_addTransitionsModifier(cssSelector, modifier = "selected") {
|
|
160
|
+
this._applyTransitionsModifier(cssSelector, modifier, (elm, cls) => elm?.classList.add(cls));
|
|
161
|
+
}
|
|
162
|
+
_removeTransitionsModifier(cssSelector, modifier = "selected") {
|
|
163
|
+
this._applyTransitionsModifier(cssSelector, modifier, (elm, cls) => elm?.classList.remove(cls));
|
|
164
|
+
}
|
|
165
|
+
_applyTransitionsModifier(cssSelector, modifier = "selected", apply) {
|
|
166
|
+
const transitionModifier = `transition--${modifier}`;
|
|
167
|
+
const transitionLineModifier = `transition__line--${modifier}`;
|
|
168
|
+
const transitionBoxModifier = `transition__box--${modifier}`;
|
|
169
|
+
const transitionLabelModifier = `transition__label--${modifier}`;
|
|
170
|
+
[...this.element.querySelectorAll(cssSelector)].forEach((elm) => {
|
|
171
|
+
apply(elm, transitionModifier);
|
|
172
|
+
apply(elm.querySelector(".transition__line"), transitionLineModifier);
|
|
173
|
+
apply(elm.querySelector(".transition__box"), transitionBoxModifier);
|
|
174
|
+
apply(elm.querySelector(".transition__label"), transitionLabelModifier);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/runtime/StateChartIndex.ts
|
|
180
|
+
var StateChartIndex = class {
|
|
181
|
+
constructor({ statechart, initialStateKey = "<initial>", finalStateKey = "<final>" }) {
|
|
182
|
+
_defineProperty(this, "statechart", void 0);
|
|
183
|
+
_defineProperty(this, "_chartsIndex", {});
|
|
184
|
+
_defineProperty(this, "_nodesIndex", {});
|
|
185
|
+
_defineProperty(this, "_nodesParentsIndex", {});
|
|
186
|
+
_defineProperty(this, "_edgeIndex", {});
|
|
187
|
+
_defineProperty(this, "_edgesParentsIndex", {});
|
|
188
|
+
_defineProperty(this, "initialStateKey", void 0);
|
|
189
|
+
_defineProperty(this, "finalStateKey", void 0);
|
|
190
|
+
this.statechart = statechart;
|
|
191
|
+
this.initialStateKey = initialStateKey;
|
|
192
|
+
this.finalStateKey = finalStateKey;
|
|
193
|
+
this._buildIndexes();
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Returns a state node or a chart by the specified identifier.
|
|
197
|
+
* @param id the id of a state node or a chart
|
|
198
|
+
* @returns a state node or a chart
|
|
199
|
+
*/
|
|
200
|
+
getNodeById(id) {
|
|
201
|
+
return this._nodesIndex[id] || this._chartsIndex[id];
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Returns a chart by the specified identifier.
|
|
205
|
+
* @param id the id of a state node or a chart
|
|
206
|
+
* @returns a state node or a chart
|
|
207
|
+
*/
|
|
208
|
+
getChartById(id) {
|
|
209
|
+
return this._chartsIndex[id];
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Returns an edge by the specified identifier.
|
|
213
|
+
* @param id the id of a graph edge
|
|
214
|
+
* @returns a graph edge
|
|
215
|
+
*/
|
|
216
|
+
getEdgeById(id) {
|
|
217
|
+
return this._edgeIndex[id];
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Returns a list of all nodes in this chart.
|
|
221
|
+
* @return a list of all nodes
|
|
222
|
+
*/
|
|
223
|
+
getAllNodes() {
|
|
224
|
+
return [.../* @__PURE__ */ new Set([...Object.values(this._chartsIndex), ...Object.values(this._nodesIndex)])];
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Returns a list of all non-empty state nodes in this chart.
|
|
228
|
+
* The result excludes nodes for initial and fina states.
|
|
229
|
+
* @return a list of all non-empty state nodes
|
|
230
|
+
*/
|
|
231
|
+
getStateNodes() {
|
|
232
|
+
return this.getAllNodes().filter((node) => node.key !== this.initialStateKey && node.key !== this.finalStateKey);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Transforms a stack of state keys to the corresponding identifiers.
|
|
236
|
+
* If a key in the stack was not found then this method returns
|
|
237
|
+
* an empty stack.
|
|
238
|
+
* @param stack a stack of state keys
|
|
239
|
+
* @returns a stack of state identifiers for the given states
|
|
240
|
+
*/
|
|
241
|
+
getStatesIds(...stack) {
|
|
242
|
+
const result = [];
|
|
243
|
+
let list = [this.statechart];
|
|
244
|
+
for (let i = 0; list?.length > 0 && i < stack.length; i++) {
|
|
245
|
+
const key = stack[i];
|
|
246
|
+
const node = list.find((node) => node.key === key);
|
|
247
|
+
if (!node) break;
|
|
248
|
+
result.push(node.id);
|
|
249
|
+
list = [...node.children || [], ...node.nodes || []];
|
|
250
|
+
}
|
|
251
|
+
return result.length === stack.length ? result : [];
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Returns graph nodes for the specified identifier.
|
|
255
|
+
* @param id the id of a node
|
|
256
|
+
* @returns a stack of nodes
|
|
257
|
+
*/
|
|
258
|
+
getStackByStateId(id) {
|
|
259
|
+
if (!id) return [];
|
|
260
|
+
const node = this._chartsIndex[id] || this._nodesIndex[id];
|
|
261
|
+
if (!node) return [];
|
|
262
|
+
const parentId = this._nodesParentsIndex[id];
|
|
263
|
+
if (parentId) {
|
|
264
|
+
const parentStack = this.getStackByStateId(parentId);
|
|
265
|
+
if (!parentStack.length) return [];
|
|
266
|
+
parentStack.push(node);
|
|
267
|
+
return parentStack;
|
|
268
|
+
} else return [node];
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Returns an edge object corresponding to the transition from the state
|
|
272
|
+
* @param stateId identifier of the source state
|
|
273
|
+
* @param event an event triggering the transition
|
|
274
|
+
* @returns graph edge
|
|
275
|
+
*/
|
|
276
|
+
getTransition(stateId, event) {
|
|
277
|
+
const stack = this.getStackByStateId(stateId);
|
|
278
|
+
const state = stack.pop();
|
|
279
|
+
if (!state || !stack.length) return;
|
|
280
|
+
return stack[stack.length - 1].edges.find((t) => t.from === state.key && t.event === event);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Returns a list of edge objects corresponding to all transitions from the state
|
|
284
|
+
* @param stateId identifier of the source state
|
|
285
|
+
* @returns a list of graph edges
|
|
286
|
+
*/
|
|
287
|
+
getTransitions(stateId) {
|
|
288
|
+
const stack = this.getStackByStateId(stateId);
|
|
289
|
+
const state = stack.pop();
|
|
290
|
+
if (!state || !stack.length) return [];
|
|
291
|
+
return stack[stack.length - 1].edges.filter((t) => t.from === state.key);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Returns a graph node corresponding to the specified state id.
|
|
295
|
+
* @param stateId identifier of the state
|
|
296
|
+
* @returns graph node
|
|
297
|
+
* @see getStateChart
|
|
298
|
+
*/
|
|
299
|
+
getStateNode(stateId) {
|
|
300
|
+
return stateId ? this._nodesIndex[stateId] : void 0;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Returns a chart corresponding to the specified state id.
|
|
304
|
+
* @param stateId identifier of the state
|
|
305
|
+
* @returns graph node
|
|
306
|
+
* @see getStateNode
|
|
307
|
+
*/
|
|
308
|
+
getStateChart(stateId) {
|
|
309
|
+
return stateId ? this._chartsIndex[stateId] : void 0;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Returns ids of the previous and next state for the specified transition
|
|
313
|
+
* @param transition a graph edge instance defining transition
|
|
314
|
+
* @returns an array with two identifiers - [sourceStateId, targetStateId] - the source state id and target state id
|
|
315
|
+
*/
|
|
316
|
+
getTransitionStateIds(transition) {
|
|
317
|
+
const result = [void 0, void 0];
|
|
318
|
+
if (!transition) return result;
|
|
319
|
+
const parentId = this._edgesParentsIndex[transition.id];
|
|
320
|
+
if (!parentId) return result;
|
|
321
|
+
const parent = this._chartsIndex[parentId];
|
|
322
|
+
if (!parent) return result;
|
|
323
|
+
parent.nodes.forEach((node) => {
|
|
324
|
+
if (node.key === transition.from) result[0] = node.id;
|
|
325
|
+
if (node.key === transition.to) result[1] = node.id;
|
|
326
|
+
});
|
|
327
|
+
return result;
|
|
328
|
+
}
|
|
329
|
+
_buildIndexes() {
|
|
330
|
+
const addToIndex = (chart) => {
|
|
331
|
+
const chartId = chart.id;
|
|
332
|
+
this._chartsIndex[chartId] = chart;
|
|
333
|
+
if (!(chartId in this._nodesIndex)) this._nodesIndex[chartId] = chart;
|
|
334
|
+
chart.nodes.forEach((node) => {
|
|
335
|
+
const nodeId = node.id;
|
|
336
|
+
this._nodesIndex[nodeId] = node;
|
|
337
|
+
this._nodesParentsIndex[nodeId] = chartId;
|
|
338
|
+
});
|
|
339
|
+
chart.edges.forEach((edge) => {
|
|
340
|
+
const edgeId = edge.id;
|
|
341
|
+
this._edgeIndex[edgeId] = edge;
|
|
342
|
+
this._edgesParentsIndex[edgeId] = chartId;
|
|
343
|
+
});
|
|
344
|
+
(chart.children || []).forEach((child) => {
|
|
345
|
+
this._nodesParentsIndex[child.id] = chartId;
|
|
346
|
+
addToIndex(child);
|
|
347
|
+
});
|
|
348
|
+
};
|
|
349
|
+
addToIndex(this.statechart);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
//#endregion
|
|
353
|
+
export { RuntimeStatechartApi as n, StateChartIndex as t };
|
|
354
|
+
|
|
355
|
+
//# sourceMappingURL=StateChartIndex-BOIrc_nq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateChartIndex-BOIrc_nq.js","names":[],"sources":["../src/runtime/RuntimeStatechartApi.ts","../src/runtime/StateChartIndex.ts"],"sourcesContent":["import type { StateChart } from \"../types/index.js\";\n\nexport type RuntimeListener = (id: string) => void;\nexport class RuntimeStatechartApi {\n element: HTMLElement;\n statechart: StateChart;\n _listenersCounter: number = 0;\n _transitionsClickListeners: Record<number, RuntimeListener> = {};\n _statesClickListeners: Record<number, RuntimeListener> = {};\n _registry: Record<number, () => void> = {};\n\n constructor({\n element,\n statechart,\n }: {\n element: HTMLElement;\n statechart: StateChart;\n }) {\n this.element = element;\n this.statechart = statechart;\n this._bindListeners();\n }\n\n close() {\n for (const r of Object.values(this._registry)) r?.();\n this._registry = {};\n this._transitionsClickListeners = {};\n this._statesClickListeners = {};\n }\n\n onStateClick(listener: RuntimeListener) {\n return this._addListener(this._statesClickListeners, listener);\n }\n onTransitionClick(listener: RuntimeListener) {\n return this._addListener(this._transitionsClickListeners, listener);\n }\n\n openStatePanels() {\n this._setStatePanelStatus(`details[data-state-id]`, true);\n }\n closeStatePanels() {\n this._setStatePanelStatus(`details[data-state-id]`, false);\n }\n isStatePanelOpen(stateId: string) {\n const elm = this.element.querySelector(\n `details[data-state-id=\"${stateId}\"]`,\n ) as HTMLDetailsElement;\n return elm && !!elm.open;\n }\n\n toggleState(...stateIds: string[]) {\n const lastId = stateIds[stateIds.length - 1];\n const selected = this.isStateSelected(lastId);\n this.deselectStates();\n this.closeStatePanels();\n this.activateStates(...stateIds);\n if (selected) {\n this.deselectState(lastId);\n this.closeStatePanel(lastId);\n }\n return !selected;\n }\n\n activateStates(...stateIds: string[]) {\n for (let i = 0; i < stateIds.length; i++) {\n const id = stateIds[i];\n this.openStatePanel(id);\n this.selectState(id);\n }\n }\n\n focusStates(...stateIds: string[]) {\n for (let i = 0; i < stateIds.length; i++) {\n const stateId = stateIds[i];\n for (const tagName of [\"details\", \"g\"]) {\n const elm = this.element.querySelector(`${tagName}[data-state-id=\"${stateId}\"]`);\n elm?.scrollIntoView();\n }\n }\n }\n\n setStateDescription(stateId: string, description: Node | string | undefined) {\n const descriptionContainer = this.element.querySelector(\n `details[data-state-id=\"${stateId}\"] .state-details__description`,\n );\n if (descriptionContainer) {\n descriptionContainer.innerHTML = \"\";\n descriptionContainer.append(description ?? \"\");\n }\n }\n\n closeStatePanel(stateId: string) {\n this._setStatePanelStatus(`details[data-state-id=\"${stateId}\"]`, false);\n }\n openStatePanel(stateId: string) {\n this._setStatePanelStatus(`details[data-state-id=\"${stateId}\"]`, true);\n }\n\n deselectTransitions(modifier = \"selected\") {\n this._removeTransitionsModifier(\"[data-transition-id]\", modifier);\n }\n deselectTransition(id: string, modifier: string = \"selected\") {\n this._removeTransitionsModifier(`[data-transition-id=\"${id}\"]`, modifier);\n }\n selectTransition(id: string, modifier: string = \"selected\") {\n this._addTransitionsModifier(`[data-transition-id=\"${id}\"]`, modifier);\n }\n toggleTransition(id: string, modifier: string = \"selected\") {\n const selected = this.isTransitionSelected(id, modifier);\n this.deselectTransitions();\n if (!selected) {\n this.selectTransition(id, modifier);\n }\n // if (!selected) this.deselectTransition(id, modifier);\n // else this.selectTransition(id, modifier);\n }\n isTransitionSelected(id: string, modifier: string = \"selected\") {\n const elm = this.element.querySelector(`[data-transition-id=\"${id}\"]`);\n const stateModifier = `transition--${modifier}`;\n return !!elm?.classList.contains(stateModifier);\n }\n\n deselectStates(modifier: string = \"selected\") {\n this._removeStateModifier(\"[data-state-id]\", modifier);\n }\n isStateSelected(id: string, modifier: string = \"selected\") {\n const elm = this.element.querySelector(`[data-state-id=\"${id}\"]`);\n const stateModifier = `state--${modifier}`;\n return !!elm?.classList.contains(stateModifier);\n }\n deselectState(id: string, modifier: string = \"selected\") {\n this._removeStateModifier(`[data-state-id=\"${id}\"]`, modifier);\n }\n selectState(id: string, modifier: string = \"selected\") {\n this._addStateModifier(`[data-state-id=\"${id}\"]`, modifier);\n }\n\n // Internal methods\n\n _addListener<T = Function>(index: Record<string, T>, listener: T) {\n const id = this._listenersCounter++;\n index[id] = listener;\n return () => {\n delete index[id];\n };\n }\n\n _bindListeners() {\n const bindListeners = (\n index: Record<string, RuntimeListener>,\n dataField: string,\n eventType: string,\n ) => {\n function newEventListener(index: Record<string, RuntimeListener>, elm: Element) {\n return (ev: Event) => {\n ev.preventDefault();\n ev.stopPropagation();\n let id: string | null | undefined = elm.getAttribute(dataField);\n if (!id) {\n id = elm.closest(`[${dataField}]`)?.getAttribute(dataField);\n }\n if (id) {\n for (const listener of Object.values(index)) {\n listener(id);\n }\n }\n };\n }\n [...this.element.querySelectorAll(`[${dataField}]`)].forEach((elm) => {\n const eventListener = newEventListener(index, elm);\n elm.addEventListener(eventType, eventListener);\n this._addListener(this._registry, () => elm.removeEventListener(eventType, eventListener));\n });\n };\n bindListeners(this._statesClickListeners, \"data-state-id\", \"click\");\n bindListeners(this._transitionsClickListeners, \"data-transition-id\", \"click\");\n }\n\n _setStatePanelStatus(selector: string, open: boolean) {\n [...this.element.querySelectorAll(selector)].forEach((elm) => {\n if (open) elm.setAttribute(\"open\", \"open\");\n else elm.removeAttribute(\"open\");\n });\n }\n\n _addStateModifier(cssSelector: string, modifier: string = \"selected\") {\n this._applyStateModifier(cssSelector, modifier, (elm, cls) => elm?.classList.add(cls));\n }\n _removeStateModifier(cssSelector: string, modifier: string = \"selected\") {\n this._applyStateModifier(cssSelector, modifier, (elm, cls) => elm?.classList.remove(cls));\n }\n _applyStateModifier(\n cssSelector: string,\n modifier: string = \"selected\",\n apply: (elm: Element | null, className: string) => void,\n ) {\n const detailsModifier = `state-details--${modifier}`;\n const stateLabelsModifier = `state-details__label--${modifier}`;\n const stateModifier = `state--${modifier}`;\n [...this.element.querySelectorAll(cssSelector)].forEach((elm) => {\n if (elm.tagName.toLowerCase() === \"details\") {\n apply(elm, detailsModifier);\n const labelElm = elm.querySelector(\".state-details__label\");\n if (labelElm) apply(labelElm, stateLabelsModifier);\n } else {\n apply(elm, stateModifier);\n }\n });\n }\n\n _addTransitionsModifier(cssSelector: string, modifier: string = \"selected\") {\n this._applyTransitionsModifier(cssSelector, modifier, (elm, cls) => elm?.classList.add(cls));\n }\n _removeTransitionsModifier(cssSelector: string, modifier: string = \"selected\") {\n this._applyTransitionsModifier(cssSelector, modifier, (elm, cls) => elm?.classList.remove(cls));\n }\n _applyTransitionsModifier(\n cssSelector: string,\n modifier: string = \"selected\",\n apply: (elm: Element | null, className: string) => void,\n ) {\n const transitionModifier = `transition--${modifier}`;\n const transitionLineModifier = `transition__line--${modifier}`;\n const transitionBoxModifier = `transition__box--${modifier}`;\n const transitionLabelModifier = `transition__label--${modifier}`;\n [...this.element.querySelectorAll(cssSelector)].forEach((elm) => {\n apply(elm, transitionModifier);\n apply(elm.querySelector(\".transition__line\"), transitionLineModifier);\n apply(elm.querySelector(\".transition__box\"), transitionBoxModifier);\n apply(elm.querySelector(\".transition__label\"), transitionLabelModifier);\n });\n }\n}\n","import type { StateChart, StateGraphEdge, StateGraphNode } from \"../types/index.js\";\n\nexport class StateChartIndex {\n statechart: StateChart;\n _chartsIndex: Record<string, StateChart> = {};\n _nodesIndex: Record<string, StateGraphNode> = {};\n _nodesParentsIndex: Record<string, string> = {};\n _edgeIndex: Record<string, StateGraphEdge> = {};\n _edgesParentsIndex: Record<string, string> = {};\n initialStateKey: string;\n finalStateKey: string;\n\n constructor({\n statechart,\n initialStateKey = \"<initial>\",\n finalStateKey = \"<final>\",\n }: {\n statechart: StateChart;\n initialStateKey?: string;\n finalStateKey?: string;\n }) {\n this.statechart = statechart;\n this.initialStateKey = initialStateKey;\n this.finalStateKey = finalStateKey;\n\n this._buildIndexes();\n }\n\n /**\n * Returns a state node or a chart by the specified identifier.\n * @param id the id of a state node or a chart\n * @returns a state node or a chart\n */\n getNodeById(id: string): StateGraphNode | undefined {\n return this._nodesIndex[id] || this._chartsIndex[id];\n }\n\n /**\n * Returns a chart by the specified identifier.\n * @param id the id of a state node or a chart\n * @returns a state node or a chart\n */\n getChartById(id: string): StateChart | undefined {\n return this._chartsIndex[id];\n }\n\n /**\n * Returns an edge by the specified identifier.\n * @param id the id of a graph edge\n * @returns a graph edge\n */\n getEdgeById(id: string): StateGraphEdge | undefined {\n return this._edgeIndex[id];\n }\n\n /**\n * Returns a list of all nodes in this chart.\n * @return a list of all nodes\n */\n getAllNodes(): StateGraphNode[] {\n return [...new Set([...Object.values(this._chartsIndex), ...Object.values(this._nodesIndex)])];\n }\n\n /**\n * Returns a list of all non-empty state nodes in this chart.\n * The result excludes nodes for initial and fina states.\n * @return a list of all non-empty state nodes\n */\n getStateNodes(): StateGraphNode[] {\n return this.getAllNodes().filter(\n (node) => node.key !== this.initialStateKey && node.key !== this.finalStateKey,\n );\n }\n\n /**\n * Transforms a stack of state keys to the corresponding identifiers.\n * If a key in the stack was not found then this method returns\n * an empty stack.\n * @param stack a stack of state keys\n * @returns a stack of state identifiers for the given states\n */\n getStatesIds(...stack: string[]): string[] {\n const result = [];\n let list = [this.statechart] as (StateChart | StateGraphNode)[];\n for (let i = 0; list?.length > 0 && i < stack.length; i++) {\n const key = stack[i];\n const node = list.find((node) => node.key === key);\n if (!node) break;\n result.push(node.id);\n list = [...(node.children || []), ...(node.nodes || [])];\n }\n return result.length === stack.length ? result : [];\n }\n\n /**\n * Returns graph nodes for the specified identifier.\n * @param id the id of a node\n * @returns a stack of nodes\n */\n getStackByStateId(id?: string): StateGraphNode[] {\n if (!id) return [];\n const node = this._chartsIndex[id] || this._nodesIndex[id];\n if (!node) return [];\n const parentId = this._nodesParentsIndex[id];\n if (parentId) {\n const parentStack = this.getStackByStateId(parentId);\n if (!parentStack.length) return [];\n parentStack.push(node);\n return parentStack;\n } else {\n return [node];\n }\n }\n\n /**\n * Returns an edge object corresponding to the transition from the state\n * @param stateId identifier of the source state\n * @param event an event triggering the transition\n * @returns graph edge\n */\n getTransition(stateId?: string, event?: string): StateGraphEdge | undefined {\n const stack = this.getStackByStateId(stateId);\n const state = stack.pop();\n if (!state || !stack.length) return;\n const parent = stack[stack.length - 1];\n const t = parent.edges.find((t: StateGraphEdge) => t.from === state.key && t.event === event);\n return t;\n }\n\n /**\n * Returns a list of edge objects corresponding to all transitions from the state\n * @param stateId identifier of the source state\n * @returns a list of graph edges\n */\n getTransitions(stateId?: string): StateGraphEdge[] {\n const stack = this.getStackByStateId(stateId);\n const state = stack.pop();\n if (!state || !stack.length) return [];\n const parent = stack[stack.length - 1];\n return parent.edges.filter((t: StateGraphEdge) => t.from === state.key);\n }\n\n /**\n * Returns a graph node corresponding to the specified state id.\n * @param stateId identifier of the state\n * @returns graph node\n * @see getStateChart\n */\n getStateNode(stateId?: string): StateGraphNode | undefined {\n return stateId ? this._nodesIndex[stateId] : undefined;\n }\n\n /**\n * Returns a chart corresponding to the specified state id.\n * @param stateId identifier of the state\n * @returns graph node\n * @see getStateNode\n */\n getStateChart(stateId?: string): StateChart | undefined {\n return stateId ? this._chartsIndex[stateId] : undefined;\n }\n\n /**\n * Returns ids of the previous and next state for the specified transition\n * @param transition a graph edge instance defining transition\n * @returns an array with two identifiers - [sourceStateId, targetStateId] - the source state id and target state id\n */\n getTransitionStateIds(transition?: StateGraphEdge): [string | undefined, string | undefined] {\n const result: [string | undefined, string | undefined] = [undefined, undefined];\n if (!transition) return result;\n const parentId = this._edgesParentsIndex[transition.id];\n if (!parentId) return result;\n const parent = this._chartsIndex[parentId];\n if (!parent) return result;\n parent.nodes.forEach((node: StateGraphNode) => {\n if (node.key === transition.from) {\n result[0] = node.id;\n }\n if (node.key === transition.to) {\n result[1] = node.id;\n }\n });\n return result;\n }\n\n // ----------------------------------------------------------\n // Internal methods\n _buildIndexes() {\n const addToIndex = (chart: StateChart) => {\n const chartId = chart.id;\n this._chartsIndex[chartId] = chart;\n if (!(chartId in this._nodesIndex)) {\n this._nodesIndex[chartId] = chart;\n }\n chart.nodes.forEach((node) => {\n const nodeId = node.id;\n this._nodesIndex[nodeId] = node;\n this._nodesParentsIndex[nodeId] = chartId;\n });\n chart.edges.forEach((edge) => {\n const edgeId = edge.id;\n this._edgeIndex[edgeId] = edge;\n this._edgesParentsIndex[edgeId] = chartId;\n });\n (chart.children || []).forEach((child) => {\n this._nodesParentsIndex[child.id] = chartId;\n addToIndex(child);\n });\n };\n addToIndex(this.statechart);\n }\n}\n"],"mappings":";;AAGA,IAAa,uBAAb,MAAkC;CAQhC,YAAY,EACV,SACA,cAIC;EAbH,gBAAA,MAAA,WAAA,KAAA,CAAA;EACA,gBAAA,MAAA,cAAA,KAAA,CAAA;EACA,gBAAA,MAAA,qBAA4B,CAAA;EAC5B,gBAAA,MAAA,8BAA8D,CAAC,CAAA;EAC/D,gBAAA,MAAA,yBAAyD,CAAC,CAAA;EAC1D,gBAAA,MAAA,aAAwC,CAAC,CAAA;EASvC,KAAK,UAAU;EACf,KAAK,aAAa;EAClB,KAAK,eAAe;CACtB;CAEA,QAAQ;EACN,KAAK,MAAM,KAAK,OAAO,OAAO,KAAK,SAAS,GAAG,IAAI;EACnD,KAAK,YAAY,CAAC;EAClB,KAAK,6BAA6B,CAAC;EACnC,KAAK,wBAAwB,CAAC;CAChC;CAEA,aAAa,UAA2B;EACtC,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