state-machine-cat 10.1.1 → 10.1.3
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 +1 -1
- package/bin/smcat.mjs +5 -0
- package/dist/commonjs/bundle.js +64 -64
- package/package.json +33 -32
- package/src/cli/actions.mjs +9 -0
- package/src/cli/file-name-to-stream.mjs +5 -6
- package/src/cli/make-description.mjs +9 -0
- package/src/cli/normalize.mjs +79 -41
- package/src/cli/validations.mjs +27 -1
- package/src/index-node.mjs +15 -47
- package/src/index.mjs +9 -9
- package/src/options.mjs +19 -13
- package/src/parse/index.mjs +13 -0
- package/src/parse/parser-helpers.mjs +70 -6
- package/src/parse/scxml/index.mjs +40 -1
- package/src/parse/scxml/normalize-machine.mjs +1 -1
- package/src/render/dot/attributebuilder.mjs +7 -0
- package/src/render/dot/counter.mjs +13 -0
- package/src/render/dot/index.mjs +66 -28
- package/src/render/dot/render-dot-from-ast.js +37 -15
- package/src/render/dot/state-transformers.mjs +4 -2
- package/src/render/dot/utl.mjs +20 -0
- package/src/render/index-node.mjs +9 -3
- package/src/render/index.mjs +3 -3
- package/src/render/scjson/index.mjs +6 -0
- package/src/render/scjson/make-valid-xml-name.mjs +7 -1
- package/src/render/scxml/index.mjs +3 -1
- package/src/render/smcat/index.js +48 -14
- package/src/render/vector/dot-to-vector-native.mjs +1 -1
- package/src/render/vector/vector-native-dot-with-fallback.mjs +3 -2
- package/src/render/vector/vector-with-viz-js.mjs +3 -2
- package/src/state-machine-model.mjs +46 -4
- package/src/transform/desugar.mjs +67 -18
- package/src/transform/utl.mjs +8 -0
- package/src/version.mjs +2 -1
- package/types/state-machine-cat.d.ts +41 -14
|
@@ -183,13 +183,22 @@ export function getAllowedValues(): IAllowedValues;
|
|
|
183
183
|
export type InputType = "smcat" | "json" | "scxml";
|
|
184
184
|
|
|
185
185
|
export type OutputType =
|
|
186
|
-
| "
|
|
186
|
+
| "ast"
|
|
187
187
|
| "dot"
|
|
188
|
+
| "eps"
|
|
188
189
|
| "json"
|
|
189
|
-
| "
|
|
190
|
-
| "
|
|
190
|
+
| "oldeps"
|
|
191
|
+
| "oldps"
|
|
192
|
+
| "oldps2"
|
|
193
|
+
| "oldsvg"
|
|
194
|
+
| "pdf"
|
|
195
|
+
| "png"
|
|
196
|
+
| "ps"
|
|
197
|
+
| "ps2"
|
|
191
198
|
| "scjson"
|
|
192
|
-
| "scxml"
|
|
199
|
+
| "scxml"
|
|
200
|
+
| "smcat"
|
|
201
|
+
| "svg";
|
|
193
202
|
|
|
194
203
|
export type EngineType = "dot" | "circo" | "fdp" | "neato" | "osage" | "twopi";
|
|
195
204
|
|
|
@@ -204,7 +213,7 @@ export type dotAttributesType = {
|
|
|
204
213
|
value: string;
|
|
205
214
|
}[];
|
|
206
215
|
|
|
207
|
-
export interface
|
|
216
|
+
export interface IBaseRenderOptions {
|
|
208
217
|
/**
|
|
209
218
|
* How to interpret the input (defaults to 'smcat')
|
|
210
219
|
*/
|
|
@@ -222,6 +231,17 @@ export interface IRenderOptions {
|
|
|
222
231
|
* (defaults to 'top-down')
|
|
223
232
|
*/
|
|
224
233
|
direction?: DirectionType;
|
|
234
|
+
/**
|
|
235
|
+
* If true state machine cat will replace 'sugar' pseudo states
|
|
236
|
+
* (choice, forks and junctions) with their equivalent meaning
|
|
237
|
+
* (defaults to false).
|
|
238
|
+
*
|
|
239
|
+
* For details: https://github.com/sverweij/state-machine-cat/blob/master/docs/desugar.md
|
|
240
|
+
*/
|
|
241
|
+
desugar?: boolean;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface IRenderOptions extends IBaseRenderOptions {
|
|
225
245
|
/**
|
|
226
246
|
* For the 'dot' renderer: Graph attributes to the engine
|
|
227
247
|
*/
|
|
@@ -234,18 +254,25 @@ export interface IRenderOptions {
|
|
|
234
254
|
* For the 'dot' renderer: Edge attributes to the engine
|
|
235
255
|
*/
|
|
236
256
|
dotEdgeAttrs?: dotAttributesType;
|
|
237
|
-
/**
|
|
238
|
-
* If true state machine cat will replace 'sugar' pseudo states
|
|
239
|
-
* (choice, forks and junctions) with their equivalent meaning
|
|
240
|
-
* (defaults to false).
|
|
241
|
-
*
|
|
242
|
-
* For details: https://github.com/sverweij/state-machine-cat/blob/master/docs/desugar.md
|
|
243
|
-
*/
|
|
244
|
-
desugar?: boolean;
|
|
245
257
|
}
|
|
246
258
|
|
|
259
|
+
export type StringRenderFunctionType = (
|
|
260
|
+
pScript: IStateMachine,
|
|
261
|
+
pOptions: IRenderOptions
|
|
262
|
+
) => string;
|
|
263
|
+
|
|
264
|
+
export type WhateverRenderFunctionType = (
|
|
265
|
+
pScript: IStateMachine,
|
|
266
|
+
pOptions: IRenderOptions
|
|
267
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
268
|
+
) => any;
|
|
269
|
+
|
|
270
|
+
export type RenderFunctionType =
|
|
271
|
+
| StringRenderFunctionType
|
|
272
|
+
| WhateverRenderFunctionType;
|
|
273
|
+
|
|
247
274
|
/**
|
|
248
|
-
* Translates the input script to an
|
|
275
|
+
* Translates the input script to an output script.
|
|
249
276
|
*
|
|
250
277
|
* @param pScript The script to translate
|
|
251
278
|
* @param pOptions options influencing parsing & rendering.
|