@statewalker/fsm-charts 0.1.4 → 0.1.6
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/{chunk-YYNW6Q2T.js → chunk-2BBNBZQI.js} +165 -101
- package/dist/index-html-D4UI0s_n.d.ts +75 -0
- package/dist/index-html.d.ts +1 -1
- package/dist/index-html.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +8 -1
- package/src/html/buildStatechartCss.ts +40 -4
- package/src/html/buildStatechartStyles.ts +153 -101
- package/src/index-html.ts +1 -1
- package/src/index-layout.ts +1 -1
- package/src/index-runtime.ts +1 -1
- package/src/index.ts +1 -1
- package/src/types/index.ts +10 -10
- package/src/utils/serializeAttrs.ts +6 -2
- package/src/utils/toKebabCase.ts +4 -4
- package/dist/index-html-CbDZzk2n.d.ts +0 -33
- package/src/lodash-es/_deleteme.js +0 -291
|
@@ -2,8 +2,8 @@ import { getPadding } from './chunk-NXWOFQMO.js';
|
|
|
2
2
|
import { __publicField } from './chunk-XEO3YXBM.js';
|
|
3
3
|
|
|
4
4
|
// src/utils/toKebabCase.ts
|
|
5
|
-
function
|
|
6
|
-
str = str.trim().replace(/\s+/gim, "-");
|
|
5
|
+
function toKebabCase(str) {
|
|
6
|
+
str = (str || "").trim().replace(/\s+/gim, "-");
|
|
7
7
|
str = str.replace(
|
|
8
8
|
/([^A-Z]?)([A-Z])/g,
|
|
9
9
|
(_, a, b) => a.toLowerCase() + "-" + b.toLowerCase()
|
|
@@ -32,7 +32,7 @@ function serializeCss(obj) {
|
|
|
32
32
|
if (typeof value === "object") {
|
|
33
33
|
visitStyle({ [key2]: value }, extensions, selectors);
|
|
34
34
|
} else {
|
|
35
|
-
key2 =
|
|
35
|
+
key2 = toKebabCase(key2);
|
|
36
36
|
selectorRules.push(` ${key2}: ${value};`);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -48,60 +48,138 @@ function serializeCss(obj) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// src/html/buildStatechartStyles.ts
|
|
51
|
-
|
|
51
|
+
var activeStatesStyle = {
|
|
52
|
+
backgroundColor: "white",
|
|
53
|
+
borderColor: "red",
|
|
54
|
+
borderWidth: "2px",
|
|
55
|
+
labelColor: "red"
|
|
56
|
+
};
|
|
57
|
+
var activeTransitionsStyle = {
|
|
58
|
+
backgroundColor: "#eee",
|
|
59
|
+
borderColor: "none",
|
|
60
|
+
borderWidth: "0",
|
|
61
|
+
lineColor: "red",
|
|
62
|
+
lineWidth: "1px",
|
|
63
|
+
labelColor: "red"
|
|
64
|
+
};
|
|
65
|
+
var selectedStatesStyle = {
|
|
66
|
+
backgroundColor: "white",
|
|
67
|
+
borderColor: "navy",
|
|
68
|
+
borderWidth: "2px",
|
|
69
|
+
labelColor: "navy"
|
|
70
|
+
};
|
|
71
|
+
var selectedTransitionsStyle = {
|
|
72
|
+
backgroundColor: "#eee",
|
|
73
|
+
borderColor: "none",
|
|
74
|
+
borderWidth: "0",
|
|
75
|
+
lineColor: "navy",
|
|
76
|
+
lineWidth: "1px",
|
|
77
|
+
labelColor: "navy"
|
|
78
|
+
};
|
|
79
|
+
function buildStateDetailsStyle({
|
|
80
|
+
root = ":root"
|
|
81
|
+
}) {
|
|
52
82
|
return {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
[root]: {
|
|
84
|
+
// --------------------------
|
|
85
|
+
// Panels
|
|
86
|
+
".state-details": {
|
|
87
|
+
backgroundColor: "var(--state-background-color, white)",
|
|
88
|
+
border: "var(--state-border-width, 1px) solid var(--state-border-color, currentColor)",
|
|
89
|
+
borderRadius: "0.5em",
|
|
90
|
+
padding: "0.5em"
|
|
91
|
+
},
|
|
92
|
+
".state-details__label": {
|
|
93
|
+
cursor: "pointer",
|
|
94
|
+
color: "var(--transition-label-color, currentColor)",
|
|
95
|
+
fontFamily: "var(--state-label-font-family, sans-serif)",
|
|
96
|
+
fontSize: "var(--state-label-font-size, 14px)"
|
|
97
|
+
},
|
|
98
|
+
".state-details__description": {
|
|
99
|
+
display: "flex",
|
|
100
|
+
flexDirection: "column",
|
|
101
|
+
gap: "0.5em"
|
|
102
|
+
},
|
|
103
|
+
".state-details__chart": {
|
|
104
|
+
maxWidth: "100%",
|
|
105
|
+
overflow: "auto",
|
|
106
|
+
scrollbarWidth: "thin"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function buildStateDetailsStyleWithModifier({
|
|
112
|
+
root = ":root",
|
|
113
|
+
modifier,
|
|
114
|
+
states
|
|
115
|
+
}) {
|
|
116
|
+
return {
|
|
117
|
+
[root]: {
|
|
118
|
+
//
|
|
119
|
+
".state-details": {
|
|
120
|
+
[`&.state-details--${modifier}`]: {
|
|
121
|
+
backgroundColor: `var(--state-${modifier}-background-color, ${states.backgroundColor})`,
|
|
122
|
+
border: `var(--state-${modifier}-border-width, 1px) solid var(--state-${modifier}-border-color, currentColor)`
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
".state-details__label": {
|
|
126
|
+
[`&.state-details__label--${modifier}`]: {
|
|
127
|
+
color: `var(--state-${modifier}-label-color)`
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function buildStatechartStylesWithModifier({
|
|
134
|
+
root = ":root",
|
|
135
|
+
modifier,
|
|
136
|
+
states,
|
|
137
|
+
transitions
|
|
138
|
+
}) {
|
|
139
|
+
return {
|
|
140
|
+
[root]: {
|
|
141
|
+
// --------------------------------------
|
|
142
|
+
// Default values for transitions
|
|
143
|
+
[`--transition-${modifier}-background-color`]: transitions.backgroundColor,
|
|
144
|
+
[`--transition-${modifier}-border-color`]: transitions.borderColor,
|
|
145
|
+
[`--transition-${modifier}-border-width`]: transitions.borderWidth,
|
|
146
|
+
[`--transition-${modifier}-line-color`]: transitions.lineColor,
|
|
147
|
+
[`--transition-${modifier}-line-width`]: transitions.lineWidth,
|
|
148
|
+
[`--transition-${modifier}-label-color`]: transitions.labelColor,
|
|
149
|
+
// --------------------------------------
|
|
150
|
+
// Default values for states
|
|
151
|
+
[`--state-${modifier}-background-color`]: states.backgroundColor,
|
|
152
|
+
[`--state-${modifier}-border-color`]: states.borderColor,
|
|
153
|
+
[`--state-${modifier}-border-width`]: states.borderWidth,
|
|
154
|
+
[`--state-${modifier}-label-color`]: states.labelColor,
|
|
155
|
+
".state": {
|
|
156
|
+
[`&.state--${modifier}`]: {
|
|
157
|
+
"--state-background-color": `var(--state-${modifier}-background-color)`,
|
|
158
|
+
"--state-border-color": `var(--state-${modifier}-border-color)`,
|
|
159
|
+
"--state-border-width": `var(--state-${modifier}-border-width)`,
|
|
160
|
+
"--state-label-color": `var(--state-${modifier}-label-color)`
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
".transition": {
|
|
164
|
+
[`&.transition--${modifier}`]: {
|
|
165
|
+
"--transition-background-color": `var(--transition-${modifier}-background-color)`,
|
|
166
|
+
"--transition-border-color": `var(--transition-${modifier}-border-color)`,
|
|
167
|
+
"--transition-border-width": `var(--transition-${modifier}-border-width)`,
|
|
168
|
+
"--transition-line-color": `var(--transition-${modifier}-line-color)`,
|
|
169
|
+
"--transition-line-width": `var(--transition-${modifier}-line-width)`,
|
|
170
|
+
"--transition-label-color": `var(--transition-${modifier}-label-color)`
|
|
171
|
+
}
|
|
172
|
+
}
|
|
82
173
|
}
|
|
83
174
|
};
|
|
84
175
|
}
|
|
85
176
|
function buildStatechartStyles({
|
|
86
177
|
root = ":root"
|
|
87
|
-
}
|
|
178
|
+
}) {
|
|
88
179
|
return {
|
|
89
180
|
[root]: {
|
|
90
181
|
// --------------------------------------
|
|
91
|
-
//
|
|
92
|
-
"--state-background-color": "white",
|
|
93
|
-
"--state-border-color": "silver",
|
|
94
|
-
"--state-border-width": "1px",
|
|
95
|
-
"--state-label-color": "gray",
|
|
96
|
-
"--state-label-font-size": "14px",
|
|
97
|
-
"--state-label-font-family": "sans-serif",
|
|
98
|
-
// Selected states
|
|
99
|
-
"--state-selected-background-color": "#eee",
|
|
100
|
-
"--state-selected-border-color": "red",
|
|
101
|
-
"--state-selected-border-width": "2px",
|
|
102
|
-
"--state-selected-label-color": "red",
|
|
103
|
-
// --------------------------------------
|
|
104
|
-
// Normal transitions
|
|
182
|
+
// Transitions
|
|
105
183
|
"--transition-background-color": "rgba(255,255,255,0.7)",
|
|
106
184
|
"--transition-border-color": "none",
|
|
107
185
|
"--transition-border-width": "1px",
|
|
@@ -110,26 +188,6 @@ function buildStatechartStyles({
|
|
|
110
188
|
"--transition-label-color": "gray",
|
|
111
189
|
"--transition-label-font-size": "12px",
|
|
112
190
|
"--transition-label-font-family": "sans-serif",
|
|
113
|
-
// --------------------------------------
|
|
114
|
-
// Selected transitions
|
|
115
|
-
"--transition-selected-background-color": "#eee",
|
|
116
|
-
"--transition-selected-border-color": "none",
|
|
117
|
-
"--transition-selected-border-width": "0",
|
|
118
|
-
"--transition-selected-line-color": "red",
|
|
119
|
-
"--transition-selected-line-width": "1px",
|
|
120
|
-
"--transition-selected-label-color": "red",
|
|
121
|
-
// --------------------------------------
|
|
122
|
-
// --------------------------------------
|
|
123
|
-
...buildStateDetailsStyle(),
|
|
124
|
-
".transition": {},
|
|
125
|
-
".transition--selected": {
|
|
126
|
-
"--transition-background-color": "var(--transition-selected-background-color)",
|
|
127
|
-
"--transition-border-color": "var(--transition-selected-border-color)",
|
|
128
|
-
"--transition-border-width": "var(--transition-selected-border-width)",
|
|
129
|
-
"--transition-line-color": "var(--transition-selected-line-color)",
|
|
130
|
-
"--transition-line-width": "var(--transition-selected-line-width)",
|
|
131
|
-
"--transition-label-color": "var(--transition-selected-label-color)"
|
|
132
|
-
},
|
|
133
191
|
".transition__marker": {
|
|
134
192
|
fill: "var(--transition-line-color, currentColor)",
|
|
135
193
|
stroke: "none"
|
|
@@ -151,35 +209,14 @@ function buildStatechartStyles({
|
|
|
151
209
|
fontFamily: "var(--transition-label-font-family, sans-serif)",
|
|
152
210
|
cursor: "pointer"
|
|
153
211
|
},
|
|
154
|
-
//
|
|
155
|
-
//
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
},
|
|
163
|
-
// --------------------------
|
|
164
|
-
// Panels
|
|
165
|
-
".state__details": {
|
|
166
|
-
backgroundColor: "var(--state-background-color, white)",
|
|
167
|
-
border: "var(--state-border-width, 1px) solid var(--state-border-color, currentColor)",
|
|
168
|
-
borderRadius: "0.5em",
|
|
169
|
-
padding: "0.5em"
|
|
170
|
-
},
|
|
171
|
-
".state__description": {
|
|
172
|
-
display: "flex",
|
|
173
|
-
flexDirection: "column",
|
|
174
|
-
gap: "0.5em"
|
|
175
|
-
},
|
|
176
|
-
".state__chart-container": {
|
|
177
|
-
maxWidth: "100%",
|
|
178
|
-
overflow: "auto",
|
|
179
|
-
scrollbarWidth: "thin"
|
|
180
|
-
},
|
|
181
|
-
// --------------------------
|
|
182
|
-
// Statecharts
|
|
212
|
+
// --------------------------------------
|
|
213
|
+
// Normal states
|
|
214
|
+
"--state-background-color": "white",
|
|
215
|
+
"--state-border-color": "silver",
|
|
216
|
+
"--state-border-width": "1px",
|
|
217
|
+
"--state-label-color": "gray",
|
|
218
|
+
"--state-label-font-size": "14px",
|
|
219
|
+
"--state-label-font-family": "sans-serif",
|
|
183
220
|
".state__box": {
|
|
184
221
|
fill: "var(--state-background-color, white)",
|
|
185
222
|
stroke: "var(--state-border-color, currentColor)",
|
|
@@ -216,8 +253,33 @@ function buildStatechartStyles({
|
|
|
216
253
|
|
|
217
254
|
// src/html/buildStatechartCss.ts
|
|
218
255
|
function buildStatechartCss({ prefix = "" } = {}) {
|
|
219
|
-
const
|
|
220
|
-
return
|
|
256
|
+
const root = prefix || ":root";
|
|
257
|
+
return [
|
|
258
|
+
buildStatechartStyles({ root }),
|
|
259
|
+
buildStatechartStylesWithModifier({
|
|
260
|
+
root,
|
|
261
|
+
modifier: "selected",
|
|
262
|
+
states: selectedStatesStyle,
|
|
263
|
+
transitions: selectedTransitionsStyle
|
|
264
|
+
}),
|
|
265
|
+
buildStatechartStylesWithModifier({
|
|
266
|
+
root,
|
|
267
|
+
modifier: "active",
|
|
268
|
+
states: activeStatesStyle,
|
|
269
|
+
transitions: activeTransitionsStyle
|
|
270
|
+
}),
|
|
271
|
+
buildStateDetailsStyle({ root }),
|
|
272
|
+
buildStateDetailsStyleWithModifier({
|
|
273
|
+
root,
|
|
274
|
+
modifier: "selected",
|
|
275
|
+
states: selectedStatesStyle
|
|
276
|
+
}),
|
|
277
|
+
buildStateDetailsStyleWithModifier({
|
|
278
|
+
root,
|
|
279
|
+
modifier: "active",
|
|
280
|
+
states: activeStatesStyle
|
|
281
|
+
})
|
|
282
|
+
].map(serializeCss).join("\n");
|
|
221
283
|
}
|
|
222
284
|
|
|
223
285
|
// src/utils/serializeAttrs.ts
|
|
@@ -232,7 +294,9 @@ function serializeAttrs(attrs = {}, {
|
|
|
232
294
|
if (value === void 0 || value === null || value === "")
|
|
233
295
|
continue;
|
|
234
296
|
result.push(
|
|
235
|
-
`${prefix}${escapeValue(key)}${"=" + JSON.stringify(
|
|
297
|
+
`${prefix}${escapeValue(key)}${"=" + JSON.stringify(
|
|
298
|
+
escapeValue(transform ? toKebabCase(String(value)) : value)
|
|
299
|
+
)}`
|
|
236
300
|
);
|
|
237
301
|
}
|
|
238
302
|
return result.join(" ");
|
|
@@ -536,4 +600,4 @@ function buildStatechartsPanel({
|
|
|
536
600
|
}
|
|
537
601
|
}
|
|
538
602
|
|
|
539
|
-
export { buildStatechartCss, buildStatechartStyles, buildStatechartSvg, buildStatechartsPanel,
|
|
603
|
+
export { activeStatesStyle, activeTransitionsStyle, buildStateDetailsStyle, buildStateDetailsStyleWithModifier, buildStatechartCss, buildStatechartStyles, buildStatechartStylesWithModifier, buildStatechartSvg, buildStatechartsPanel, selectedStatesStyle, selectedTransitionsStyle, serializeCss, toKebabCase };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { S as StateChart, d as TransitionsGraph } from './StateChart-PdtJDEPy.js';
|
|
2
|
+
|
|
3
|
+
declare function buildStatechartCss({ prefix }?: {
|
|
4
|
+
prefix?: string | undefined;
|
|
5
|
+
}): string;
|
|
6
|
+
|
|
7
|
+
declare function buildStatechartsPanel({ statechart, newId, println, initialStateKey, finalStateKey, }: {
|
|
8
|
+
statechart: StateChart;
|
|
9
|
+
newId: (prefix: string) => string;
|
|
10
|
+
println: (str: string) => void;
|
|
11
|
+
initialStateKey?: string;
|
|
12
|
+
finalStateKey?: string;
|
|
13
|
+
}): void;
|
|
14
|
+
|
|
15
|
+
interface CssTree extends Record<string, string | number | CssTree> {
|
|
16
|
+
}
|
|
17
|
+
declare function serializeCss(obj: CssTree): string;
|
|
18
|
+
|
|
19
|
+
declare const activeStatesStyle: {
|
|
20
|
+
backgroundColor: string;
|
|
21
|
+
borderColor: string;
|
|
22
|
+
borderWidth: string;
|
|
23
|
+
labelColor: string;
|
|
24
|
+
};
|
|
25
|
+
declare const activeTransitionsStyle: {
|
|
26
|
+
backgroundColor: string;
|
|
27
|
+
borderColor: string;
|
|
28
|
+
borderWidth: string;
|
|
29
|
+
lineColor: string;
|
|
30
|
+
lineWidth: string;
|
|
31
|
+
labelColor: string;
|
|
32
|
+
};
|
|
33
|
+
declare const selectedStatesStyle: {
|
|
34
|
+
backgroundColor: string;
|
|
35
|
+
borderColor: string;
|
|
36
|
+
borderWidth: string;
|
|
37
|
+
labelColor: string;
|
|
38
|
+
};
|
|
39
|
+
declare const selectedTransitionsStyle: {
|
|
40
|
+
backgroundColor: string;
|
|
41
|
+
borderColor: string;
|
|
42
|
+
borderWidth: string;
|
|
43
|
+
lineColor: string;
|
|
44
|
+
lineWidth: string;
|
|
45
|
+
labelColor: string;
|
|
46
|
+
};
|
|
47
|
+
declare function buildStateDetailsStyle({ root, }: {
|
|
48
|
+
root?: string;
|
|
49
|
+
}): CssTree;
|
|
50
|
+
declare function buildStateDetailsStyleWithModifier({ root, modifier, states, }: {
|
|
51
|
+
root?: string;
|
|
52
|
+
modifier: string;
|
|
53
|
+
states: Record<string, string>;
|
|
54
|
+
}): CssTree;
|
|
55
|
+
declare function buildStatechartStylesWithModifier({ root, modifier, states, transitions, }: {
|
|
56
|
+
root?: string;
|
|
57
|
+
modifier: string;
|
|
58
|
+
states: Record<string, string>;
|
|
59
|
+
transitions: Record<string, string>;
|
|
60
|
+
}): CssTree;
|
|
61
|
+
declare function buildStatechartStyles({ root, }: {
|
|
62
|
+
root?: string;
|
|
63
|
+
}): CssTree;
|
|
64
|
+
|
|
65
|
+
declare function buildStatechartSvg({ graph: { width, height, nodes, edges }, newId, stateFontSize, transitionFontSize, println, initialStateKey, finalStateKey, }: {
|
|
66
|
+
graph: TransitionsGraph;
|
|
67
|
+
newId: (prefix: string) => string;
|
|
68
|
+
println: (str: string) => void;
|
|
69
|
+
stateFontSize?: number;
|
|
70
|
+
transitionFontSize?: number;
|
|
71
|
+
initialStateKey?: string;
|
|
72
|
+
finalStateKey?: string;
|
|
73
|
+
}): void;
|
|
74
|
+
|
|
75
|
+
export { type CssTree as C, buildStatechartsPanel as a, buildStatechartCss as b, activeStatesStyle as c, activeTransitionsStyle as d, selectedTransitionsStyle as e, buildStateDetailsStyle as f, buildStateDetailsStyleWithModifier as g, buildStatechartStylesWithModifier as h, buildStatechartStyles as i, buildStatechartSvg as j, serializeCss as k, selectedStatesStyle as s };
|
package/dist/index-html.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { D as Dimensions, F as FsmStateConfig, G as GraphParamsProvider, P as Padding, a as Position, S as StateChart, b as StateGraphEdge, c as StateGraphNode, T as Transition, d as TransitionsGraph } from './StateChart-PdtJDEPy.js';
|
|
2
|
-
export { b as buildStatechartCss,
|
|
2
|
+
export { c as activeStatesStyle, d as activeTransitionsStyle, f as buildStateDetailsStyle, g as buildStateDetailsStyleWithModifier, b as buildStatechartCss, i as buildStatechartStyles, h as buildStatechartStylesWithModifier, j as buildStatechartSvg, a as buildStatechartsPanel, s as selectedStatesStyle, e as selectedTransitionsStyle } from './index-html-D4UI0s_n.js';
|
package/dist/index-html.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { buildStatechartCss, buildStatechartStyles, buildStatechartSvg, buildStatechartsPanel } from './chunk-
|
|
1
|
+
export { activeStatesStyle, activeTransitionsStyle, buildStateDetailsStyle, buildStateDetailsStyleWithModifier, buildStatechartCss, buildStatechartStyles, buildStatechartStylesWithModifier, buildStatechartSvg, buildStatechartsPanel, selectedStatesStyle, selectedTransitionsStyle } from './chunk-2BBNBZQI.js';
|
|
2
2
|
import './chunk-NXWOFQMO.js';
|
|
3
3
|
import './chunk-XEO3YXBM.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { D as Dimensions, F as FsmStateConfig, G as GraphParamsProvider, P as Padding, a as Position, S as StateChart, b as StateGraphEdge, c as StateGraphNode, T as Transition, d as TransitionsGraph } from './StateChart-PdtJDEPy.js';
|
|
2
2
|
export { buildCharts, buildFlatCharts, getGraphParamsProvider, getLabelDimensions } from './index-layout.js';
|
|
3
|
-
export { C as CssTree, b as buildStatechartCss,
|
|
3
|
+
export { C as CssTree, c as activeStatesStyle, d as activeTransitionsStyle, f as buildStateDetailsStyle, g as buildStateDetailsStyleWithModifier, b as buildStatechartCss, i as buildStatechartStyles, h as buildStatechartStylesWithModifier, j as buildStatechartSvg, a as buildStatechartsPanel, s as selectedStatesStyle, e as selectedTransitionsStyle, k as serializeCss } from './index-html-D4UI0s_n.js';
|
|
4
4
|
export { RuntimeListener, RuntimeStatechartApi, StateChartIndex } from './index-runtime.js';
|
|
5
5
|
|
|
6
|
-
declare function toKebabCase(str
|
|
6
|
+
declare function toKebabCase(str?: string): string;
|
|
7
7
|
|
|
8
8
|
export { toKebabCase };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { buildCharts, buildFlatCharts, getGraphParamsProvider, getLabelDimensions } from './chunk-OTGN3OYG.js';
|
|
2
|
-
export { buildStatechartCss, buildStatechartStyles, buildStatechartSvg, buildStatechartsPanel, serializeCss, toKebabCase } from './chunk-
|
|
2
|
+
export { activeStatesStyle, activeTransitionsStyle, buildStateDetailsStyle, buildStateDetailsStyleWithModifier, buildStatechartCss, buildStatechartStyles, buildStatechartStylesWithModifier, buildStatechartSvg, buildStatechartsPanel, selectedStatesStyle, selectedTransitionsStyle, serializeCss, toKebabCase } from './chunk-2BBNBZQI.js';
|
|
3
3
|
import './chunk-NXWOFQMO.js';
|
|
4
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
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "HFSM Implementation",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/statewalker/statewalker-fsm-charts",
|
|
@@ -21,6 +21,13 @@
|
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
|
+
"import": "./dist/index.js",
|
|
25
|
+
"require": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./src": {
|
|
28
|
+
"import": "./src"
|
|
29
|
+
},
|
|
30
|
+
"./src/index.ts": {
|
|
24
31
|
"import": "./src/index.ts"
|
|
25
32
|
}
|
|
26
33
|
},
|
|
@@ -1,7 +1,43 @@
|
|
|
1
|
-
import { serializeCss } from "../utils/serializeCss";
|
|
2
|
-
import {
|
|
1
|
+
import { serializeCss } from "../utils/serializeCss.ts";
|
|
2
|
+
import {
|
|
3
|
+
activeStatesStyle,
|
|
4
|
+
activeTransitionsStyle,
|
|
5
|
+
buildStatechartStyles,
|
|
6
|
+
buildStatechartStylesWithModifier,
|
|
7
|
+
buildStateDetailsStyle,
|
|
8
|
+
buildStateDetailsStyleWithModifier,
|
|
9
|
+
selectedStatesStyle,
|
|
10
|
+
selectedTransitionsStyle,
|
|
11
|
+
} from "./buildStatechartStyles.ts";
|
|
3
12
|
|
|
4
13
|
export function buildStatechartCss({ prefix = "" } = {}): string {
|
|
5
|
-
const
|
|
6
|
-
return
|
|
14
|
+
const root = prefix || ":root";
|
|
15
|
+
return [
|
|
16
|
+
buildStatechartStyles({ root }),
|
|
17
|
+
buildStatechartStylesWithModifier({
|
|
18
|
+
root,
|
|
19
|
+
modifier: "selected",
|
|
20
|
+
states: selectedStatesStyle,
|
|
21
|
+
transitions: selectedTransitionsStyle,
|
|
22
|
+
}),
|
|
23
|
+
buildStatechartStylesWithModifier({
|
|
24
|
+
root,
|
|
25
|
+
modifier: "active",
|
|
26
|
+
states: activeStatesStyle,
|
|
27
|
+
transitions: activeTransitionsStyle,
|
|
28
|
+
}),
|
|
29
|
+
buildStateDetailsStyle({ root }),
|
|
30
|
+
buildStateDetailsStyleWithModifier({
|
|
31
|
+
root,
|
|
32
|
+
modifier: "selected",
|
|
33
|
+
states: selectedStatesStyle,
|
|
34
|
+
}),
|
|
35
|
+
buildStateDetailsStyleWithModifier({
|
|
36
|
+
root,
|
|
37
|
+
modifier: "active",
|
|
38
|
+
states: activeStatesStyle,
|
|
39
|
+
}),
|
|
40
|
+
]
|
|
41
|
+
.map(serializeCss)
|
|
42
|
+
.join("\n");
|
|
7
43
|
}
|
|
@@ -1,63 +1,161 @@
|
|
|
1
|
-
import type { CssTree } from "../utils/serializeCss";
|
|
1
|
+
import type { CssTree } from "../utils/serializeCss.ts";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export const activeStatesStyle = {
|
|
4
|
+
backgroundColor: "white",
|
|
5
|
+
borderColor: "red",
|
|
6
|
+
borderWidth: "2px",
|
|
7
|
+
labelColor: "red",
|
|
8
|
+
};
|
|
9
|
+
export const activeTransitionsStyle = {
|
|
10
|
+
backgroundColor: "#eee",
|
|
11
|
+
borderColor: "none",
|
|
12
|
+
borderWidth: "0",
|
|
13
|
+
lineColor: "red",
|
|
14
|
+
lineWidth: "1px",
|
|
15
|
+
labelColor: "red",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const selectedStatesStyle = {
|
|
19
|
+
backgroundColor: "white",
|
|
20
|
+
borderColor: "navy",
|
|
21
|
+
borderWidth: "2px",
|
|
22
|
+
labelColor: "navy",
|
|
23
|
+
};
|
|
24
|
+
export const selectedTransitionsStyle = {
|
|
25
|
+
backgroundColor: "#eee",
|
|
26
|
+
borderColor: "none",
|
|
27
|
+
borderWidth: "0",
|
|
28
|
+
lineColor: "navy",
|
|
29
|
+
lineWidth: "1px",
|
|
30
|
+
labelColor: "navy",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export function buildStateDetailsStyle({
|
|
34
|
+
root = ":root",
|
|
35
|
+
}: {
|
|
36
|
+
root?: string;
|
|
37
|
+
}): CssTree {
|
|
4
38
|
return {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"var(--state-selected-border-width, 1px) solid var(--state-selected-border-color, currentColor)",
|
|
39
|
+
[root]: {
|
|
40
|
+
// --------------------------
|
|
41
|
+
// Panels
|
|
42
|
+
|
|
43
|
+
".state-details": {
|
|
44
|
+
backgroundColor: "var(--state-background-color, white)",
|
|
45
|
+
border:
|
|
46
|
+
"var(--state-border-width, 1px) solid var(--state-border-color, currentColor)",
|
|
47
|
+
borderRadius: "0.5em",
|
|
48
|
+
padding: "0.5em",
|
|
49
|
+
},
|
|
50
|
+
".state-details__label": {
|
|
51
|
+
cursor: "pointer",
|
|
52
|
+
color: "var(--transition-label-color, currentColor)",
|
|
53
|
+
fontFamily: "var(--state-label-font-family, sans-serif)",
|
|
54
|
+
fontSize: "var(--state-label-font-size, 14px)",
|
|
55
|
+
},
|
|
56
|
+
".state-details__description": {
|
|
57
|
+
display: "flex",
|
|
58
|
+
flexDirection: "column",
|
|
59
|
+
gap: "0.5em",
|
|
60
|
+
},
|
|
61
|
+
".state-details__chart": {
|
|
62
|
+
maxWidth: "100%",
|
|
63
|
+
overflow: "auto",
|
|
64
|
+
scrollbarWidth: "thin",
|
|
65
|
+
},
|
|
33
66
|
},
|
|
34
|
-
|
|
35
|
-
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function buildStateDetailsStyleWithModifier({
|
|
71
|
+
root = ":root",
|
|
72
|
+
modifier,
|
|
73
|
+
states,
|
|
74
|
+
}: {
|
|
75
|
+
root?: string;
|
|
76
|
+
modifier: string;
|
|
77
|
+
states: Record<string, string>;
|
|
78
|
+
}): CssTree {
|
|
79
|
+
return {
|
|
80
|
+
[root]: {
|
|
81
|
+
//
|
|
82
|
+
".state-details": {
|
|
83
|
+
[`&.state-details--${modifier}`]: {
|
|
84
|
+
backgroundColor: `var(--state-${modifier}-background-color, ${states.backgroundColor})`,
|
|
85
|
+
border: `var(--state-${modifier}-border-width, 1px) solid var(--state-${modifier}-border-color, currentColor)`,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
".state-details__label": {
|
|
89
|
+
[`&.state-details__label--${modifier}`]: {
|
|
90
|
+
color: `var(--state-${modifier}-label-color)`,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
36
93
|
},
|
|
37
94
|
};
|
|
38
95
|
}
|
|
39
|
-
|
|
96
|
+
|
|
97
|
+
export function buildStatechartStylesWithModifier({
|
|
40
98
|
root = ":root",
|
|
41
|
-
|
|
99
|
+
modifier,
|
|
100
|
+
states,
|
|
101
|
+
transitions,
|
|
102
|
+
}: {
|
|
103
|
+
root?: string;
|
|
104
|
+
modifier: string;
|
|
105
|
+
states: Record<string, string>;
|
|
106
|
+
transitions: Record<string, string>;
|
|
107
|
+
}): CssTree {
|
|
42
108
|
return {
|
|
43
109
|
[root]: {
|
|
44
110
|
// --------------------------------------
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
111
|
+
// Default values for transitions
|
|
112
|
+
[`--transition-${modifier}-background-color`]:
|
|
113
|
+
transitions.backgroundColor,
|
|
114
|
+
[`--transition-${modifier}-border-color`]: transitions.borderColor,
|
|
115
|
+
[`--transition-${modifier}-border-width`]: transitions.borderWidth,
|
|
116
|
+
[`--transition-${modifier}-line-color`]: transitions.lineColor,
|
|
117
|
+
[`--transition-${modifier}-line-width`]: transitions.lineWidth,
|
|
118
|
+
[`--transition-${modifier}-label-color`]: transitions.labelColor,
|
|
52
119
|
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
120
|
+
// --------------------------------------
|
|
121
|
+
// Default values for states
|
|
122
|
+
[`--state-${modifier}-background-color`]: states.backgroundColor,
|
|
123
|
+
[`--state-${modifier}-border-color`]: states.borderColor,
|
|
124
|
+
[`--state-${modifier}-border-width`]: states.borderWidth,
|
|
125
|
+
[`--state-${modifier}-label-color`]: states.labelColor,
|
|
126
|
+
|
|
127
|
+
".state": {
|
|
128
|
+
[`&.state--${modifier}`]: {
|
|
129
|
+
"--state-background-color": `var(--state-${modifier}-background-color)`,
|
|
130
|
+
"--state-border-color": `var(--state-${modifier}-border-color)`,
|
|
131
|
+
"--state-border-width": `var(--state-${modifier}-border-width)`,
|
|
132
|
+
"--state-label-color": `var(--state-${modifier}-label-color)`,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
".transition": {
|
|
137
|
+
[`&.transition--${modifier}`]: {
|
|
138
|
+
"--transition-background-color": `var(--transition-${modifier}-background-color)`,
|
|
139
|
+
"--transition-border-color": `var(--transition-${modifier}-border-color)`,
|
|
140
|
+
"--transition-border-width": `var(--transition-${modifier}-border-width)`,
|
|
141
|
+
"--transition-line-color": `var(--transition-${modifier}-line-color)`,
|
|
142
|
+
"--transition-line-width": `var(--transition-${modifier}-line-width)`,
|
|
143
|
+
"--transition-label-color": `var(--transition-${modifier}-label-color)`,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
58
149
|
|
|
150
|
+
export function buildStatechartStyles({
|
|
151
|
+
root = ":root",
|
|
152
|
+
}: {
|
|
153
|
+
root?: string;
|
|
154
|
+
}): CssTree {
|
|
155
|
+
return {
|
|
156
|
+
[root]: {
|
|
59
157
|
// --------------------------------------
|
|
60
|
-
//
|
|
158
|
+
// Transitions
|
|
61
159
|
"--transition-background-color": "rgba(255,255,255,0.7)",
|
|
62
160
|
"--transition-border-color": "none",
|
|
63
161
|
"--transition-border-width": "1px",
|
|
@@ -67,28 +165,6 @@ export function buildStatechartStyles({
|
|
|
67
165
|
"--transition-label-font-size": "12px",
|
|
68
166
|
"--transition-label-font-family": "sans-serif",
|
|
69
167
|
|
|
70
|
-
// --------------------------------------
|
|
71
|
-
// Selected transitions
|
|
72
|
-
"--transition-selected-background-color": "#eee",
|
|
73
|
-
"--transition-selected-border-color": "none",
|
|
74
|
-
"--transition-selected-border-width": "0",
|
|
75
|
-
"--transition-selected-line-color": "red",
|
|
76
|
-
"--transition-selected-line-width": "1px",
|
|
77
|
-
"--transition-selected-label-color": "red",
|
|
78
|
-
|
|
79
|
-
// --------------------------------------
|
|
80
|
-
// --------------------------------------
|
|
81
|
-
...buildStateDetailsStyle(),
|
|
82
|
-
".transition": {},
|
|
83
|
-
".transition--selected": {
|
|
84
|
-
"--transition-background-color":
|
|
85
|
-
"var(--transition-selected-background-color)",
|
|
86
|
-
"--transition-border-color": "var(--transition-selected-border-color)",
|
|
87
|
-
"--transition-border-width": "var(--transition-selected-border-width)",
|
|
88
|
-
"--transition-line-color": "var(--transition-selected-line-color)",
|
|
89
|
-
"--transition-line-width": "var(--transition-selected-line-width)",
|
|
90
|
-
"--transition-label-color": "var(--transition-selected-label-color)",
|
|
91
|
-
},
|
|
92
168
|
".transition__marker": {
|
|
93
169
|
fill: "var(--transition-line-color, currentColor)",
|
|
94
170
|
stroke: "none",
|
|
@@ -111,39 +187,15 @@ export function buildStatechartStyles({
|
|
|
111
187
|
cursor: "pointer",
|
|
112
188
|
},
|
|
113
189
|
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
"--state-label-color": "var(--state-selected-label-color)",
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
// --------------------------
|
|
126
|
-
// Panels
|
|
127
|
-
".state__details": {
|
|
128
|
-
backgroundColor: "var(--state-background-color, white)",
|
|
129
|
-
border:
|
|
130
|
-
"var(--state-border-width, 1px) solid var(--state-border-color, currentColor)",
|
|
131
|
-
borderRadius: "0.5em",
|
|
132
|
-
padding: "0.5em",
|
|
133
|
-
},
|
|
134
|
-
".state__description": {
|
|
135
|
-
display: "flex",
|
|
136
|
-
flexDirection: "column",
|
|
137
|
-
gap: "0.5em",
|
|
138
|
-
},
|
|
139
|
-
".state__chart-container": {
|
|
140
|
-
maxWidth: "100%",
|
|
141
|
-
overflow: "auto",
|
|
142
|
-
scrollbarWidth: "thin",
|
|
143
|
-
},
|
|
190
|
+
// --------------------------------------
|
|
191
|
+
// Normal states
|
|
192
|
+
"--state-background-color": "white",
|
|
193
|
+
"--state-border-color": "silver",
|
|
194
|
+
"--state-border-width": "1px",
|
|
195
|
+
"--state-label-color": "gray",
|
|
196
|
+
"--state-label-font-size": "14px",
|
|
197
|
+
"--state-label-font-family": "sans-serif",
|
|
144
198
|
|
|
145
|
-
// --------------------------
|
|
146
|
-
// Statecharts
|
|
147
199
|
".state__box": {
|
|
148
200
|
fill: "var(--state-background-color, white)",
|
|
149
201
|
stroke: "var(--state-border-color, currentColor)",
|
package/src/index-html.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./types/index.ts";
|
|
1
|
+
export type * from "./types/index.ts";
|
|
2
2
|
export * from "./html/index.ts";
|
package/src/index-layout.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./types/index.ts";
|
|
1
|
+
export type * from "./types/index.ts";
|
|
2
2
|
export * from "./layout/index.ts";
|
package/src/index-runtime.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./types/index.ts";
|
|
1
|
+
export type * from "./types/index.ts";
|
|
2
2
|
export * from "./runtime/index.ts";
|
package/src/index.ts
CHANGED
package/src/types/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from "./Dimensions.ts";
|
|
2
|
-
export * from "./FsmStateConfig.ts";
|
|
3
|
-
export * from "./GraphParamsProvider.ts";
|
|
4
|
-
export * from "./Padding.ts";
|
|
5
|
-
export * from "./Position.ts";
|
|
6
|
-
export * from "./StateChart.ts";
|
|
7
|
-
export * from "./StateGraphEdge.ts";
|
|
8
|
-
export * from "./StateGraphNode.ts";
|
|
9
|
-
export * from "./Transition.ts";
|
|
10
|
-
export * from "./TransitionsGraph.ts";
|
|
1
|
+
export type * from "./Dimensions.ts";
|
|
2
|
+
export type * from "./FsmStateConfig.ts";
|
|
3
|
+
export type * from "./GraphParamsProvider.ts";
|
|
4
|
+
export type * from "./Padding.ts";
|
|
5
|
+
export type * from "./Position.ts";
|
|
6
|
+
export type * from "./StateChart.ts";
|
|
7
|
+
export type * from "./StateGraphEdge.ts";
|
|
8
|
+
export type * from "./StateGraphNode.ts";
|
|
9
|
+
export type * from "./Transition.ts";
|
|
10
|
+
export type * from "./TransitionsGraph.ts";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { toKebabCase } from "./toKebabCase.ts";
|
|
2
|
+
|
|
1
3
|
export function serializeAttrs(
|
|
2
4
|
attrs: Record<string, string | number | undefined> = {},
|
|
3
5
|
{
|
|
4
6
|
prefix = "",
|
|
5
7
|
transform = false,
|
|
6
|
-
}: { prefix
|
|
8
|
+
}: { prefix?: string; transform?: boolean } = {}
|
|
7
9
|
) {
|
|
8
10
|
const result: string[] = [];
|
|
9
11
|
for (const [key, value] of Object.entries(attrs || {}).sort(([a], [b]) =>
|
|
@@ -13,7 +15,9 @@ export function serializeAttrs(
|
|
|
13
15
|
result.push(
|
|
14
16
|
`${prefix}${escapeValue(key)}${
|
|
15
17
|
"=" +
|
|
16
|
-
JSON.stringify(
|
|
18
|
+
JSON.stringify(
|
|
19
|
+
escapeValue(transform ? toKebabCase(String(value)) : value)
|
|
20
|
+
)
|
|
17
21
|
}`
|
|
18
22
|
);
|
|
19
23
|
}
|
package/src/utils/toKebabCase.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export function toKebabCase(str
|
|
1
|
+
export function toKebabCase(str?: string): string {
|
|
2
2
|
// Remove spaces:
|
|
3
|
-
str = str.trim().replace(/\s+/gim, "-");
|
|
3
|
+
str = (str || "").trim().replace(/\s+/gim, "-");
|
|
4
4
|
// Transform to kebab:
|
|
5
5
|
str = str.replace(
|
|
6
6
|
/([^A-Z]?)([A-Z])/g,
|
|
7
7
|
(_, a, b) => a.toLowerCase() + "-" + b.toLowerCase()
|
|
8
8
|
);
|
|
9
9
|
return str;
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
// return (
|
|
12
12
|
// str.match(
|
|
13
13
|
// /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g
|
|
@@ -15,4 +15,4 @@ export function toKebabCase(str: string): string {
|
|
|
15
15
|
// )
|
|
16
16
|
// .join("-")
|
|
17
17
|
// .toLowerCase();
|
|
18
|
-
}
|
|
18
|
+
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { S as StateChart, d as TransitionsGraph } from './StateChart-PdtJDEPy.js';
|
|
2
|
-
|
|
3
|
-
declare function buildStatechartCss({ prefix }?: {
|
|
4
|
-
prefix?: string | undefined;
|
|
5
|
-
}): string;
|
|
6
|
-
|
|
7
|
-
declare function buildStatechartsPanel({ statechart, newId, println, initialStateKey, finalStateKey, }: {
|
|
8
|
-
statechart: StateChart;
|
|
9
|
-
newId: (prefix: string) => string;
|
|
10
|
-
println: (str: string) => void;
|
|
11
|
-
initialStateKey?: string;
|
|
12
|
-
finalStateKey?: string;
|
|
13
|
-
}): void;
|
|
14
|
-
|
|
15
|
-
interface CssTree extends Record<string, string | number | CssTree> {
|
|
16
|
-
}
|
|
17
|
-
declare function serializeCss(obj: CssTree): string;
|
|
18
|
-
|
|
19
|
-
declare function buildStatechartStyles({ root, }?: {
|
|
20
|
-
root?: string;
|
|
21
|
-
}): CssTree;
|
|
22
|
-
|
|
23
|
-
declare function buildStatechartSvg({ graph: { width, height, nodes, edges }, newId, stateFontSize, transitionFontSize, println, initialStateKey, finalStateKey, }: {
|
|
24
|
-
graph: TransitionsGraph;
|
|
25
|
-
newId: (prefix: string) => string;
|
|
26
|
-
println: (str: string) => void;
|
|
27
|
-
stateFontSize?: number;
|
|
28
|
-
transitionFontSize?: number;
|
|
29
|
-
initialStateKey?: string;
|
|
30
|
-
finalStateKey?: string;
|
|
31
|
-
}): void;
|
|
32
|
-
|
|
33
|
-
export { type CssTree as C, buildStatechartsPanel as a, buildStatechartCss as b, buildStatechartStyles as c, buildStatechartSvg as d, serializeCss as s };
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
// export function constant(value) {
|
|
2
|
-
// return function () {
|
|
3
|
-
// return value;
|
|
4
|
-
// };
|
|
5
|
-
// }
|
|
6
|
-
// export function clone(obj) {
|
|
7
|
-
// return Object.assign({}, obj, {});
|
|
8
|
-
// // return JSON.parse(JSON.stringify(obj));
|
|
9
|
-
// }
|
|
10
|
-
|
|
11
|
-
// export const cloneDeep = clone;
|
|
12
|
-
// export function defaults(...list) {
|
|
13
|
-
// const result = {};
|
|
14
|
-
// for (const obj of list) {
|
|
15
|
-
// for (const [key, value] of Object.entries(obj)) {
|
|
16
|
-
// if (!(key in result)) {
|
|
17
|
-
// result[key] = value;
|
|
18
|
-
// }
|
|
19
|
-
// }
|
|
20
|
-
// }
|
|
21
|
-
// return result;
|
|
22
|
-
// }
|
|
23
|
-
// export function forEach(array, action) {
|
|
24
|
-
// if (Array.isArray(array)) array.forEach(action);
|
|
25
|
-
// else Object.entries(([key, value]) => action(value, key));
|
|
26
|
-
// }
|
|
27
|
-
// export const each = forEach;
|
|
28
|
-
// export function find(list, check) {
|
|
29
|
-
// const idx = list.indexOf(check);
|
|
30
|
-
// return idx >= 0 ? list[idx] : undefined;
|
|
31
|
-
// }
|
|
32
|
-
// export function filter(list, accept) {
|
|
33
|
-
// return list.filter(accept);
|
|
34
|
-
// }
|
|
35
|
-
// // export function flatten(list, accept) {
|
|
36
|
-
// // return list.flatten(accept);
|
|
37
|
-
// // }
|
|
38
|
-
// // export function forIn(obj, action) {
|
|
39
|
-
// // for (const [key, value] of Object.entries(obj)) {
|
|
40
|
-
// // if (action(value, key, obj) === false) break;
|
|
41
|
-
// // }
|
|
42
|
-
// // }
|
|
43
|
-
// // export function forOwn(obj, action) {
|
|
44
|
-
// // for (const [key, value] of Object.entries(obj)) {
|
|
45
|
-
// // if (!Object.hasOwnProperty(key)) continue;
|
|
46
|
-
// // if (action(value, key, obj) === false) break;
|
|
47
|
-
// // }
|
|
48
|
-
// // }
|
|
49
|
-
// export function has(obj, field) {
|
|
50
|
-
// return field in obj;
|
|
51
|
-
// }
|
|
52
|
-
// export function isArray(obj) {
|
|
53
|
-
// return Array.isArray(obj);
|
|
54
|
-
// }
|
|
55
|
-
// export function isEmpty(obj) {
|
|
56
|
-
// if (typeof obj !== "object") return true;
|
|
57
|
-
// if (obj === null || obj === undefined) return true;
|
|
58
|
-
// if (isArray(obj)) return obj.length === 0;
|
|
59
|
-
// return Object.keys(obj).length === 0;
|
|
60
|
-
// }
|
|
61
|
-
// export function isFunction(obj) {
|
|
62
|
-
// return typeof obj === "function";
|
|
63
|
-
// }
|
|
64
|
-
// export function isUndefined(obj) {
|
|
65
|
-
// return obj === undefined;
|
|
66
|
-
// }
|
|
67
|
-
// export function keys(obj) {
|
|
68
|
-
// return Object.keys(obj);
|
|
69
|
-
// }
|
|
70
|
-
// // export function last(array) {
|
|
71
|
-
// // const length = array == null ? 0 : array.length;
|
|
72
|
-
// // return length ? array[length - 1] : undefined;
|
|
73
|
-
// // }
|
|
74
|
-
// export function map(obj, action) {
|
|
75
|
-
// if (Array.isArray(obj)) {
|
|
76
|
-
// return obj.map(action);
|
|
77
|
-
// } else {
|
|
78
|
-
// return Object.entries(obj).map(([key, value]) => action(value, key));
|
|
79
|
-
// }
|
|
80
|
-
// }
|
|
81
|
-
// export function mapValues(obj, action) {
|
|
82
|
-
// return (Array.isArray(obj) ? obj : Object.values(obj)).map(action);
|
|
83
|
-
// }
|
|
84
|
-
// export function max(list) {
|
|
85
|
-
// let max = undefined;
|
|
86
|
-
// for (let i = 0; i < list.length; i++) {
|
|
87
|
-
// if (i === 0 || list[i] < max) {
|
|
88
|
-
// max = list[i];
|
|
89
|
-
// }
|
|
90
|
-
// }
|
|
91
|
-
// return max;
|
|
92
|
-
// }
|
|
93
|
-
// export function merge(...list) {
|
|
94
|
-
// return list.reduce((result, obj) => {
|
|
95
|
-
// for (const [key, value] of Object.entries(obj)) {
|
|
96
|
-
// result[key] = value;
|
|
97
|
-
// }
|
|
98
|
-
// return result;
|
|
99
|
-
// }, {});
|
|
100
|
-
// }
|
|
101
|
-
// export function min(list) {
|
|
102
|
-
// return minBy(list, (d) => d);
|
|
103
|
-
// }
|
|
104
|
-
// export function minBy(list, get) {
|
|
105
|
-
// let val, min;
|
|
106
|
-
// for (let i = 0; i < list.length; i++) {
|
|
107
|
-
// const value = get(list[i], i, list);
|
|
108
|
-
// if (i === 0 || value > val) {
|
|
109
|
-
// min = list[i];
|
|
110
|
-
// val = value;
|
|
111
|
-
// }
|
|
112
|
-
// }
|
|
113
|
-
// return min;
|
|
114
|
-
// }
|
|
115
|
-
// // export function now() {
|
|
116
|
-
// // return Date.now();
|
|
117
|
-
// // }
|
|
118
|
-
// export function pick(obj, keys) {
|
|
119
|
-
// return keys.reduce((result, key) => ((result[key] = obj[key]), result), {});
|
|
120
|
-
// }
|
|
121
|
-
// export function range(start, stop, step) {
|
|
122
|
-
// if (stop === undefined) {
|
|
123
|
-
// stop = start;
|
|
124
|
-
// start = 0;
|
|
125
|
-
// step = start > 0 ? 1 : -1;
|
|
126
|
-
// } else if (step === undefined) {
|
|
127
|
-
// step = stop > start ? 1 : -1;
|
|
128
|
-
// }
|
|
129
|
-
// const delta = Math.abs(stop - start);
|
|
130
|
-
// let result = [];
|
|
131
|
-
// for (let i = 0, val = start; i < delta; i++, val += step) {
|
|
132
|
-
// result.push(val);
|
|
133
|
-
// }
|
|
134
|
-
// return result;
|
|
135
|
-
// }
|
|
136
|
-
// export function reduce(list, action) {
|
|
137
|
-
// if (Array.isArray(list)) return list.reduce(action, {});
|
|
138
|
-
// else
|
|
139
|
-
// Object.entries(list).reduce(
|
|
140
|
-
// (result, [key, value]) => action(result, value, key),
|
|
141
|
-
// {}
|
|
142
|
-
// );
|
|
143
|
-
// }
|
|
144
|
-
|
|
145
|
-
// export function sortBy(list, get) {
|
|
146
|
-
// return list.sort((a, b) => {
|
|
147
|
-
// const keyA = get(a);
|
|
148
|
-
// const keyB = get(b);
|
|
149
|
-
// return keyA > keyB ? 1 : keyA === keyB ? 0 : -1;
|
|
150
|
-
// });
|
|
151
|
-
// }
|
|
152
|
-
// // export function size(list) {
|
|
153
|
-
// // return (Array.isArray(list) ? list : Object.keys(list)).length;
|
|
154
|
-
// // }
|
|
155
|
-
|
|
156
|
-
// // export const transform = reduce;
|
|
157
|
-
|
|
158
|
-
// export function values(obj) {
|
|
159
|
-
// return Array.isArray(obj) ? [...obj] : Object.values(obj);
|
|
160
|
-
// }
|
|
161
|
-
|
|
162
|
-
// let idCounter = 0;
|
|
163
|
-
// export function uniqueId(prefix) {
|
|
164
|
-
// var id = ++idCounter;
|
|
165
|
-
// return toString(prefix) + id;
|
|
166
|
-
// }
|
|
167
|
-
|
|
168
|
-
// export function union(...values) {
|
|
169
|
-
// const set = new Set();
|
|
170
|
-
// for (const val of values) {
|
|
171
|
-
// for (const item of toArray(val)) {
|
|
172
|
-
// set.add(item);
|
|
173
|
-
// }
|
|
174
|
-
// }
|
|
175
|
-
// return [...set];
|
|
176
|
-
// }
|
|
177
|
-
// function toArray(val) {
|
|
178
|
-
// return Array.isArray(val) ? val : val !== undefined ? [val] : [];
|
|
179
|
-
// }
|
|
180
|
-
// // export { default as zipObject } from "lodash/zipObject.js";
|
|
181
|
-
|
|
182
|
-
// // export { default as constant } from "lodash/constant.js";
|
|
183
|
-
// // export { default as clone } from "lodash/clone.js";
|
|
184
|
-
// // export { default as cloneDeep } from "lodash/cloneDeep.js";
|
|
185
|
-
// // export { default as defaults } from "lodash/defaults.js";
|
|
186
|
-
// // export { default as each } from "lodash/forEach.js";
|
|
187
|
-
// // export { default as forEach } from "lodash/forEach.js";
|
|
188
|
-
// // export { default as find } from "lodash/find.js";
|
|
189
|
-
// // export { default as filter } from "lodash/filter.js";
|
|
190
|
-
// // export { default as flatten } from "lodash/flatten.js";
|
|
191
|
-
// // export { default as forIn } from "lodash/forIn.js";
|
|
192
|
-
// // export { default as forOwn } from "lodash/forOwn.js";
|
|
193
|
-
// // export { default as has } from "lodash/has.js";
|
|
194
|
-
// // export { default as isArray } from "lodash/isArray.js";
|
|
195
|
-
// // export { default as isEmpty } from "lodash/isEmpty.js";
|
|
196
|
-
// // export { default as isFunction } from "lodash/isFunction.js";
|
|
197
|
-
// // export { default as isUndefined } from "lodash/isUndefined.js";
|
|
198
|
-
// // export { default as keys } from "lodash/keys.js";
|
|
199
|
-
// // export { default as last } from "lodash/last.js";
|
|
200
|
-
// // export { default as map } from "lodash/map.js";
|
|
201
|
-
// // export { default as mapValues } from "lodash/mapValues.js";
|
|
202
|
-
// // export { default as max } from "lodash/max.js";
|
|
203
|
-
// // export { default as merge } from "lodash/merge.js";
|
|
204
|
-
// // export { default as min } from "lodash/min.js";
|
|
205
|
-
// // export { default as minBy } from "lodash/minBy.js";
|
|
206
|
-
// // export { default as now } from "lodash/now.js";
|
|
207
|
-
// // export { default as pick } from "lodash/pick.js";
|
|
208
|
-
// // export { default as range } from "lodash/range.js";
|
|
209
|
-
// // export { default as reduce } from "lodash/reduce.js";
|
|
210
|
-
// // export { default as sortBy } from "lodash/sortBy.js";
|
|
211
|
-
// // export { default as size } from "lodash/size.js";
|
|
212
|
-
// // export { default as transform } from "lodash/transform.js";
|
|
213
|
-
// // export { default as values } from "lodash/values.js";
|
|
214
|
-
// // export { default as uniqueId } from "lodash/uniqueId.js";
|
|
215
|
-
// // export { default as union } from "lodash/union.js";
|
|
216
|
-
// // export { default as zipObject } from "lodash/zipObject.js";
|
|
217
|
-
|
|
218
|
-
// // ---------------------------------------
|
|
219
|
-
// // export { default as constant } from "lodash.constant";
|
|
220
|
-
// // export { default as clone } from "lodash.clone";
|
|
221
|
-
// // export { default as cloneDeep } from "lodash.clonedeep";
|
|
222
|
-
// // export { default as defaults } from "lodash.defaults";
|
|
223
|
-
// // export { default as each } from "lodash.foreach";
|
|
224
|
-
// // export { default as forEach } from "lodash.foreach";
|
|
225
|
-
// // export { default as find } from "lodash.find";
|
|
226
|
-
// // export { default as filter } from "lodash.filter";
|
|
227
|
-
// // export { default as flatten } from "lodash.flatten";
|
|
228
|
-
// // export { default as forIn } from "lodash.forin";
|
|
229
|
-
// // export { default as forOwn } from "lodash.forown";
|
|
230
|
-
// // export { default as has } from "lodash.has";
|
|
231
|
-
// // export { default as isArray } from "lodash.isarray";
|
|
232
|
-
// // export { default as isEmpty } from "lodash.isempty";
|
|
233
|
-
// // export { default as isFunction } from "lodash.isfunction";
|
|
234
|
-
// // export { default as isUndefined } from "lodash.isundefined";
|
|
235
|
-
// // export { default as keys } from "lodash.keys";
|
|
236
|
-
// // export { default as last } from "lodash.last";
|
|
237
|
-
// // export { default as map } from "lodash.map";
|
|
238
|
-
// // export { default as mapValues } from "lodash.mapvalues";
|
|
239
|
-
// // export { default as max } from "lodash.max";
|
|
240
|
-
// // export { default as merge } from "lodash.merge";
|
|
241
|
-
// // export { default as min } from "lodash.min";
|
|
242
|
-
// // export { default as minBy } from "lodash.minby";
|
|
243
|
-
// // export { default as now } from "lodash.now";
|
|
244
|
-
// // export { default as pick } from "lodash.pick";
|
|
245
|
-
// // export { default as range } from "lodash.range";
|
|
246
|
-
// // export { default as reduce } from "lodash.reduce";
|
|
247
|
-
// // export { default as sortBy } from "lodash.sortby";
|
|
248
|
-
// // export { default as size } from "lodash.size";
|
|
249
|
-
// // export { default as transform } from "lodash.transform";
|
|
250
|
-
// // export { default as values } from "lodash.values";
|
|
251
|
-
// // export { default as uniqueId } from "lodash.uniqueid";
|
|
252
|
-
// // export { default as union } from "lodash.union";
|
|
253
|
-
// // export { default as zipObject } from "lodash.zipobject";
|
|
254
|
-
|
|
255
|
-
// // export {
|
|
256
|
-
// // constant,
|
|
257
|
-
// // clone,
|
|
258
|
-
// // cloneDeep,
|
|
259
|
-
// // defaults,
|
|
260
|
-
// // each,
|
|
261
|
-
// // find,
|
|
262
|
-
// // filter,
|
|
263
|
-
// // flatten,
|
|
264
|
-
// // forEach,
|
|
265
|
-
// // forIn,
|
|
266
|
-
// // forOwn,
|
|
267
|
-
// // has,
|
|
268
|
-
// // isArray,
|
|
269
|
-
// // isEmpty,
|
|
270
|
-
// // isFunction,
|
|
271
|
-
// // isUndefined,
|
|
272
|
-
// // keys,
|
|
273
|
-
// // last,
|
|
274
|
-
// // map,
|
|
275
|
-
// // mapValues,
|
|
276
|
-
// // max,
|
|
277
|
-
// // merge,
|
|
278
|
-
// // min,
|
|
279
|
-
// // minBy,
|
|
280
|
-
// // now,
|
|
281
|
-
// // pick,
|
|
282
|
-
// // range,
|
|
283
|
-
// // reduce,
|
|
284
|
-
// // sortBy,
|
|
285
|
-
// // size,
|
|
286
|
-
// // transform,
|
|
287
|
-
// // values,
|
|
288
|
-
// // uniqueId,
|
|
289
|
-
// // union,
|
|
290
|
-
// // zipObject,
|
|
291
|
-
// // } from "lodash-es";
|