jssm 5.159.2 → 5.161.0
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 +6 -6
- package/dist/cdn/instance.js +2 -2
- package/dist/cdn/viz.js +2 -2
- package/dist/cli/fsl-export-system-prompt.cjs +1 -1
- package/dist/cli/fsl-render.cjs +1 -1
- package/dist/cli/fsl.cjs +1 -1
- package/dist/cli/lib.cjs +1 -1
- package/dist/cli/lib.mjs +1 -1
- package/dist/deno/README.md +6 -6
- package/dist/deno/fsl_fence_render.d.ts +0 -10
- package/dist/deno/fsl_markdown_fence.d.ts +3 -3
- package/dist/deno/jssm.d.ts +2 -2
- package/dist/deno/jssm.js +1 -1
- package/dist/deno/jssm_types.d.ts +138 -138
- package/dist/deno/jssm_viz.d.ts +3 -3
- package/dist/fence/fence.js +31906 -31893
- package/dist/jssm.es5.cjs +1 -1
- package/dist/jssm.es5.iife.js +1 -1
- package/dist/jssm.es6.mjs +1 -1
- package/dist/jssm_viz.cjs +1 -1
- package/dist/jssm_viz.iife.cjs +1 -1
- package/dist/jssm_viz.mjs +1 -1
- package/dist/wc/instance.js +5 -0
- package/dist/wc/widgets.js +3 -0
- package/jssm.cli.d.cts +4 -4
- package/jssm.cli.d.ts +4 -4
- package/jssm.es5.d.cts +131 -131
- package/jssm.es6.d.ts +131 -131
- package/jssm.fence.d.ts +122 -132
- package/jssm_viz.es5.d.cts +125 -125
- package/jssm_viz.es6.d.ts +125 -125
- package/package.json +5 -5
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { circular_buffer } from 'circular_buffer_js';
|
|
2
|
-
|
|
2
|
+
type StateType = string;
|
|
3
3
|
/** Composite type indicating success as part of a result. */
|
|
4
|
-
|
|
4
|
+
type JssmSuccess = {
|
|
5
5
|
success: true;
|
|
6
6
|
};
|
|
7
7
|
/** Composite type indicating an error, and the reason for it, as part of a result. */
|
|
8
|
-
|
|
8
|
+
type JssmFailure = {
|
|
9
9
|
success: false;
|
|
10
10
|
error: any;
|
|
11
11
|
};
|
|
12
12
|
/** Composite type indicating that a result isn't finished yet. */
|
|
13
|
-
|
|
13
|
+
type JssmIncomplete = {
|
|
14
14
|
success: 'incomplete';
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
@@ -18,69 +18,69 @@ declare type JssmIncomplete = {
|
|
|
18
18
|
* success, failure (with an `error`), or incomplete. Used as the return
|
|
19
19
|
* shape for operations that may need to report partial progress.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
type JssmResult = JssmSuccess | JssmFailure | JssmIncomplete;
|
|
22
22
|
/**
|
|
23
23
|
* A color value accepted by jssm-viz for state and arrow styling. Currently
|
|
24
24
|
* any string, validated downstream by Graphviz / the named-colors list.
|
|
25
25
|
* Intended to be narrowed to `#RRGGBB` / `#RRGGBBAA` and CSS named colors
|
|
26
26
|
* in a future release.
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
type JssmColor = string;
|
|
29
29
|
/**
|
|
30
30
|
* Two-state policy flag: a feature is either `'required'` or `'disallowed'`.
|
|
31
31
|
* Used by machine configuration where the option must take a definite stance.
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
type JssmPermitted = 'required' | 'disallowed';
|
|
34
34
|
/**
|
|
35
35
|
* Three-state policy flag: `'required'`, `'disallowed'`, or `'optional'`.
|
|
36
36
|
* Used by machine configuration where a default-permissive middle ground
|
|
37
37
|
* is meaningful (for example, the `actions` config key).
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
type JssmPermittedOpt = 'required' | 'disallowed' | 'optional';
|
|
40
40
|
/**
|
|
41
41
|
* The set of ASCII arrow tokens recognized by the FSL grammar. Each arrow
|
|
42
42
|
* encodes a direction (one-way left/right, or two-way) and a "kind" for
|
|
43
43
|
* each direction (`-` legal, `=` main path, `~` forced-only). See the
|
|
44
44
|
* Language Reference docs for the full semantic table.
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>';
|
|
47
47
|
/**
|
|
48
48
|
* A type teaching Typescript the various supported shapes for nodes, mostly inherited from GraphViz
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
type JssmShape = "box" | "polygon" | "ellipse" | "oval" | "circle" | "point" | "egg" | "triangle" | "plaintext" | "plain" | "diamond" | "trapezium" | "parallelogram" | "house" | "pentagon" | "hexagon" | "septagon" | "octagon" | "doublecircle" | "doubleoctagon" | "tripleoctagon" | "invtriangle" | "invtrapezium" | "invhouse" | "Mdiamond" | "Msquare" | "Mcircle" | "rect" | "rectangle" | "square" | "star" | "none" | "underline" | "cylinder" | "note" | "tab" | "folder" | "box3d" | "component" | "promoter" | "cds" | "terminator" | "utr" | "primersite" | "restrictionsite" | "fivepoverhang" | "threepoverhang" | "noverhang" | "assembly" | "signature" | "insulator" | "ribosite" | "rnastab" | "proteasesite" | "proteinstab" | "rpromoter" | "rarrow" | "larrow" | "lpromoter" | "record";
|
|
51
51
|
/**
|
|
52
52
|
* Direction polarity of an arrow: pointing only `'left'`, only `'right'`,
|
|
53
53
|
* or `'both'` (a bidirectional arrow).
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
type JssmArrowDirection = 'left' | 'right' | 'both';
|
|
56
56
|
/**
|
|
57
57
|
* Semantic category of an arrow's transition. `'legal'` is a normal
|
|
58
58
|
* transition, `'main'` is part of the machine's primary path, `'forced'`
|
|
59
59
|
* may only be taken via {@link Machine.force_transition}, and `'none'`
|
|
60
60
|
* means no transition exists in that direction.
|
|
61
61
|
*/
|
|
62
|
-
|
|
62
|
+
type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced';
|
|
63
63
|
/**
|
|
64
64
|
* Graphviz layout engine selector. Controls how jssm-viz lays out the
|
|
65
65
|
* rendered diagram; `'dot'` is the default and most useful for state
|
|
66
66
|
* machines. See the Graphviz documentation for the differences.
|
|
67
67
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
type JssmLayout = 'dot' | 'circo' | 'twopi' | 'fdp' | 'neato';
|
|
69
|
+
type JssmCorner = 'regular' | 'rounded' | 'lined';
|
|
70
|
+
type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
|
|
71
71
|
/**
|
|
72
72
|
* Tristate flag for whether a property may be overridden at runtime.
|
|
73
73
|
* `true` permits overrides, `false` forbids them, and `undefined` defers
|
|
74
74
|
* the decision to the surrounding configuration's default.
|
|
75
75
|
*/
|
|
76
|
-
|
|
76
|
+
type JssmAllowsOverride = true | false | undefined;
|
|
77
77
|
/**
|
|
78
78
|
* Controls whether the state graph may contain disconnected components
|
|
79
79
|
* (islands). `true` permits islands (default), `false` requires a single
|
|
80
80
|
* connected component, and `'with_start'` permits islands only when every
|
|
81
81
|
* component contains at least one start state.
|
|
82
82
|
*/
|
|
83
|
-
|
|
83
|
+
type JssmAllowIslands = true | false | 'with_start';
|
|
84
84
|
/**
|
|
85
85
|
* Structured render-size hint for a machine visualization, set by the FSL
|
|
86
86
|
* `default_size` directive. All three forms are optional in the sense that
|
|
@@ -94,7 +94,7 @@ declare type JssmAllowIslands = true | false | 'with_start';
|
|
|
94
94
|
*
|
|
95
95
|
* @see Machine.default_size
|
|
96
96
|
*/
|
|
97
|
-
|
|
97
|
+
type JssmDefaultSize = {
|
|
98
98
|
width?: number;
|
|
99
99
|
height?: number;
|
|
100
100
|
};
|
|
@@ -108,7 +108,7 @@ declare const FslDirections: readonly ["up", "right", "down", "left"];
|
|
|
108
108
|
* String literal type of the four supported FSL flow directions. This is
|
|
109
109
|
* the type of the `flow` config key on a machine.
|
|
110
110
|
*/
|
|
111
|
-
|
|
111
|
+
type FslDirection = typeof FslDirections[number];
|
|
112
112
|
/**
|
|
113
113
|
* Runtime-iterable list of the built-in theme names that ship with jssm-viz.
|
|
114
114
|
* Use this when you need to enumerate themes; for the type itself see
|
|
@@ -120,7 +120,7 @@ declare const FslThemes: readonly ["default", "ocean", "modern", "plain", "bold"
|
|
|
120
120
|
* type of the `theme` config key (which accepts an array so that themes
|
|
121
121
|
* can be layered).
|
|
122
122
|
*/
|
|
123
|
-
|
|
123
|
+
type FslTheme = typeof FslThemes[number];
|
|
124
124
|
/**
|
|
125
125
|
* Persistable snapshot of a Machine produced by {@link Machine.serialize}
|
|
126
126
|
* and consumed by {@link deserialize}. Carries the current state, the
|
|
@@ -129,7 +129,7 @@ declare type FslTheme = typeof FslThemes[number];
|
|
|
129
129
|
*
|
|
130
130
|
* @typeParam DataType - The type of the user-supplied data payload (`mDT`).
|
|
131
131
|
*/
|
|
132
|
-
|
|
132
|
+
type JssmSerialization<DataType> = {
|
|
133
133
|
jssm_version: string;
|
|
134
134
|
timestamp: number;
|
|
135
135
|
comment?: string | undefined;
|
|
@@ -154,7 +154,7 @@ declare type JssmSerialization<DataType> = {
|
|
|
154
154
|
* @see JssmGroupMemberRef
|
|
155
155
|
* @see JssmGroupRegistry
|
|
156
156
|
*/
|
|
157
|
-
|
|
157
|
+
type JssmGroupRef = {
|
|
158
158
|
key: 'group_ref';
|
|
159
159
|
name: string;
|
|
160
160
|
};
|
|
@@ -177,7 +177,7 @@ declare type JssmGroupRef = {
|
|
|
177
177
|
* @see JssmGroupRef
|
|
178
178
|
* @see JssmGroupRegistry
|
|
179
179
|
*/
|
|
180
|
-
|
|
180
|
+
type JssmGroupMemberRef = {
|
|
181
181
|
kind: 'state';
|
|
182
182
|
name: string;
|
|
183
183
|
} | {
|
|
@@ -203,7 +203,7 @@ declare type JssmGroupMemberRef = {
|
|
|
203
203
|
*
|
|
204
204
|
* @see JssmGroupMemberRef
|
|
205
205
|
*/
|
|
206
|
-
|
|
206
|
+
type JssmGroupRegistry = Map<string, JssmGroupMemberRef[]>;
|
|
207
207
|
/**
|
|
208
208
|
* A parsed FSL boundary-hook declaration — the `on <enter|exit> <subject> do
|
|
209
209
|
* '<action>';` form. `event` is the boundary crossing the hook listens for,
|
|
@@ -223,7 +223,7 @@ declare type JssmGroupRegistry = Map<string, JssmGroupMemberRef[]>;
|
|
|
223
223
|
* @see JssmGroupRef
|
|
224
224
|
* @see JssmGroupHooks
|
|
225
225
|
*/
|
|
226
|
-
|
|
226
|
+
type JssmHookDeclaration = {
|
|
227
227
|
key: 'hook_decl';
|
|
228
228
|
event: 'enter' | 'exit';
|
|
229
229
|
subject: JssmGroupRef | string;
|
|
@@ -238,7 +238,7 @@ declare type JssmHookDeclaration = {
|
|
|
238
238
|
*
|
|
239
239
|
* @see JssmHookDeclaration
|
|
240
240
|
*/
|
|
241
|
-
|
|
241
|
+
type JssmBoundaryHooks = {
|
|
242
242
|
onEnter?: string;
|
|
243
243
|
onExit?: string;
|
|
244
244
|
};
|
|
@@ -249,7 +249,7 @@ declare type JssmBoundaryHooks = {
|
|
|
249
249
|
*
|
|
250
250
|
* @see JssmHookDeclaration
|
|
251
251
|
*/
|
|
252
|
-
|
|
252
|
+
type JssmGroupHooks = Map<string, JssmBoundaryHooks>;
|
|
253
253
|
/**
|
|
254
254
|
* Maps each plain state name that has at least one boundary hook to its
|
|
255
255
|
* merged {@link JssmBoundaryHooks}. The state-subject analogue of
|
|
@@ -257,7 +257,7 @@ declare type JssmGroupHooks = Map<string, JssmBoundaryHooks>;
|
|
|
257
257
|
*
|
|
258
258
|
* @see JssmHookDeclaration
|
|
259
259
|
*/
|
|
260
|
-
|
|
260
|
+
type JssmStateHooks = Map<string, JssmBoundaryHooks>;
|
|
261
261
|
/**
|
|
262
262
|
* Declaration of a named property that a machine's states may carry.
|
|
263
263
|
* Set `required: true` to force every state to define the property, or
|
|
@@ -270,15 +270,15 @@ declare type JssmStateHooks = Map<string, JssmBoundaryHooks>;
|
|
|
270
270
|
* may carry only the serialized `name`, and global property definitions
|
|
271
271
|
* never set them.
|
|
272
272
|
*/
|
|
273
|
-
|
|
273
|
+
type JssmPropertyDefinition = {
|
|
274
274
|
name: string;
|
|
275
275
|
default_value?: any;
|
|
276
276
|
required?: boolean;
|
|
277
277
|
property?: string;
|
|
278
278
|
state?: string;
|
|
279
279
|
};
|
|
280
|
-
|
|
281
|
-
|
|
280
|
+
type JssmTransitionPermitter<DataType> = (OldState: StateType, NewState: StateType, OldData: DataType, NewData: DataType) => boolean;
|
|
281
|
+
type JssmTransitionPermitterMaybeArray<DataType> = JssmTransitionPermitter<DataType> | Array<JssmTransitionPermitter<DataType>>;
|
|
282
282
|
/**
|
|
283
283
|
* A single directed transition (edge) within a state machine. Captures
|
|
284
284
|
* both the topology (`from` / `to`), the FSL semantics (`kind`,
|
|
@@ -290,7 +290,7 @@ declare type JssmTransitionPermitterMaybeArray<DataType> = JssmTransitionPermitt
|
|
|
290
290
|
* @typeParam StateType - The state-name type (usually `string`).
|
|
291
291
|
* @typeParam DataType - The machine's data payload type (`mDT`).
|
|
292
292
|
*/
|
|
293
|
-
|
|
293
|
+
type JssmTransition<StateType, DataType> = {
|
|
294
294
|
from: StateType;
|
|
295
295
|
to: StateType;
|
|
296
296
|
after_time?: number;
|
|
@@ -304,12 +304,12 @@ declare type JssmTransition<StateType, DataType> = {
|
|
|
304
304
|
main_path: boolean;
|
|
305
305
|
};
|
|
306
306
|
/** A list of {@link JssmTransition}s — the edge set of a machine. */
|
|
307
|
-
|
|
307
|
+
type JssmTransitions<StateType, DataType> = JssmTransition<StateType, DataType>[];
|
|
308
308
|
/**
|
|
309
309
|
* The set of states that can immediately precede or follow a given state.
|
|
310
310
|
* Returned by jssm helpers that report a state's connectivity in the graph.
|
|
311
311
|
*/
|
|
312
|
-
|
|
312
|
+
type JssmTransitionList = {
|
|
313
313
|
entrances: Array<StateType>;
|
|
314
314
|
exits: Array<StateType>;
|
|
315
315
|
};
|
|
@@ -318,7 +318,7 @@ declare type JssmTransitionList = {
|
|
|
318
318
|
* the parse stream, rather than a literal state name. See
|
|
319
319
|
* {@link JssmTransitionRule}.
|
|
320
320
|
*/
|
|
321
|
-
|
|
321
|
+
type JssmTransitionCycle = {
|
|
322
322
|
key: 'cycle';
|
|
323
323
|
value: StateType;
|
|
324
324
|
};
|
|
@@ -326,13 +326,13 @@ declare type JssmTransitionCycle = {
|
|
|
326
326
|
* An entry produced while parsing a transition rule: either a literal
|
|
327
327
|
* state name (`StateType`) or a {@link JssmTransitionCycle} marker.
|
|
328
328
|
*/
|
|
329
|
-
|
|
329
|
+
type JssmTransitionRule = StateType | JssmTransitionCycle;
|
|
330
330
|
/**
|
|
331
331
|
* Topology record for one node in a compiled machine: its name, the set of
|
|
332
332
|
* states it can be reached from, the set of states it can transition to,
|
|
333
333
|
* and whether reaching it constitutes "completing" the machine.
|
|
334
334
|
*/
|
|
335
|
-
|
|
335
|
+
type JssmGenericState = {
|
|
336
336
|
from: Array<StateType>;
|
|
337
337
|
name: StateType;
|
|
338
338
|
to: Array<StateType>;
|
|
@@ -345,7 +345,7 @@ declare type JssmGenericState = {
|
|
|
345
345
|
* `internal_state_impl_version` field exists so that consumers can detect
|
|
346
346
|
* shape changes if this representation evolves.
|
|
347
347
|
*/
|
|
348
|
-
|
|
348
|
+
type JssmMachineInternalState<DataType> = {
|
|
349
349
|
internal_state_impl_version: 1;
|
|
350
350
|
state: StateType;
|
|
351
351
|
states: Map<StateType, JssmGenericState>;
|
|
@@ -355,14 +355,14 @@ declare type JssmMachineInternalState<DataType> = {
|
|
|
355
355
|
reverse_actions: Map<StateType, Map<StateType, number>>;
|
|
356
356
|
edges: Array<JssmTransition<StateType, DataType>>;
|
|
357
357
|
};
|
|
358
|
-
|
|
359
|
-
|
|
358
|
+
type JssmStatePermitter<DataType> = (OldState: StateType, NewState: StateType, OldData: DataType, NewData: DataType) => boolean;
|
|
359
|
+
type JssmStatePermitterMaybeArray<DataType> = JssmStatePermitter<DataType> | Array<JssmStatePermitter<DataType>>;
|
|
360
360
|
/**
|
|
361
361
|
* Minimal machine description used internally and accepted by some
|
|
362
362
|
* lower-level constructors. Most callers should use the richer
|
|
363
363
|
* {@link JssmGenericConfig} instead.
|
|
364
364
|
*/
|
|
365
|
-
|
|
365
|
+
type JssmGenericMachine<DataType> = {
|
|
366
366
|
name?: string;
|
|
367
367
|
state: StateType;
|
|
368
368
|
data?: DataType;
|
|
@@ -387,12 +387,12 @@ declare type JssmGenericMachine<DataType> = {
|
|
|
387
387
|
* // end: { offset: 7, line: 1, column: 8 } }
|
|
388
388
|
* ```
|
|
389
389
|
*/
|
|
390
|
-
|
|
390
|
+
type FslSourcePoint = {
|
|
391
391
|
offset: number;
|
|
392
392
|
line: number;
|
|
393
393
|
column: number;
|
|
394
394
|
};
|
|
395
|
-
|
|
395
|
+
type FslSourceLocation = {
|
|
396
396
|
start: FslSourcePoint;
|
|
397
397
|
end: FslSourcePoint;
|
|
398
398
|
};
|
|
@@ -401,7 +401,7 @@ declare type FslSourceLocation = {
|
|
|
401
401
|
* raw form produced by the parser before being condensed into a
|
|
402
402
|
* {@link JssmStateDeclaration}.
|
|
403
403
|
*/
|
|
404
|
-
|
|
404
|
+
type JssmStateDeclarationRule = {
|
|
405
405
|
key: string;
|
|
406
406
|
value: any;
|
|
407
407
|
name?: string;
|
|
@@ -413,7 +413,7 @@ declare type JssmStateDeclarationRule = {
|
|
|
413
413
|
* rule list (`declarations`) and the well-known styling fields jssm-viz
|
|
414
414
|
* understands. Returned by {@link Machine.state_declaration}.
|
|
415
415
|
*/
|
|
416
|
-
|
|
416
|
+
type JssmStateDeclaration = {
|
|
417
417
|
declarations: Array<JssmStateDeclarationRule>;
|
|
418
418
|
shape?: JssmShape;
|
|
419
419
|
color?: JssmColor;
|
|
@@ -436,44 +436,44 @@ declare type JssmStateDeclaration = {
|
|
|
436
436
|
* optional. Used as the value type for theme entries and for default
|
|
437
437
|
* state configuration where most fields will be inherited or merged.
|
|
438
438
|
*/
|
|
439
|
-
|
|
440
|
-
|
|
439
|
+
type JssmStateConfig = Partial<JssmStateDeclaration>;
|
|
440
|
+
type JssmStateStyleShape = {
|
|
441
441
|
key: 'shape';
|
|
442
442
|
value: JssmShape;
|
|
443
443
|
};
|
|
444
|
-
|
|
444
|
+
type JssmStateStyleColor = {
|
|
445
445
|
key: 'color';
|
|
446
446
|
value: JssmColor;
|
|
447
447
|
};
|
|
448
|
-
|
|
448
|
+
type JssmStateStyleTextColor = {
|
|
449
449
|
key: 'text-color';
|
|
450
450
|
value: JssmColor;
|
|
451
451
|
};
|
|
452
|
-
|
|
452
|
+
type JssmStateStyleCorners = {
|
|
453
453
|
key: 'corners';
|
|
454
454
|
value: JssmCorner;
|
|
455
455
|
};
|
|
456
|
-
|
|
456
|
+
type JssmStateStyleLineStyle = {
|
|
457
457
|
key: 'line-style';
|
|
458
458
|
value: JssmLineStyle;
|
|
459
459
|
};
|
|
460
|
-
|
|
460
|
+
type JssmStateStyleStateLabel = {
|
|
461
461
|
key: 'state-label';
|
|
462
462
|
value: string;
|
|
463
463
|
};
|
|
464
|
-
|
|
464
|
+
type JssmStateStyleBackgroundColor = {
|
|
465
465
|
key: 'background-color';
|
|
466
466
|
value: JssmColor;
|
|
467
467
|
};
|
|
468
|
-
|
|
468
|
+
type JssmStateStyleBorderColor = {
|
|
469
469
|
key: 'border-color';
|
|
470
470
|
value: JssmColor;
|
|
471
471
|
};
|
|
472
|
-
|
|
472
|
+
type JssmStateStyleImage = {
|
|
473
473
|
key: 'image';
|
|
474
474
|
value: string;
|
|
475
475
|
};
|
|
476
|
-
|
|
476
|
+
type JssmStateStyleUrl = {
|
|
477
477
|
key: 'url';
|
|
478
478
|
value: string;
|
|
479
479
|
};
|
|
@@ -482,13 +482,13 @@ declare type JssmStateStyleUrl = {
|
|
|
482
482
|
* a state's style configuration. The `key` discriminator selects which
|
|
483
483
|
* member, and the `value` is typed accordingly.
|
|
484
484
|
*/
|
|
485
|
-
|
|
485
|
+
type JssmStateStyleKey = JssmStateStyleShape | JssmStateStyleColor | JssmStateStyleTextColor | JssmStateStyleCorners | JssmStateStyleLineStyle | JssmStateStyleBackgroundColor | JssmStateStyleStateLabel | JssmStateStyleBorderColor | JssmStateStyleImage | JssmStateStyleUrl;
|
|
486
486
|
/**
|
|
487
487
|
* An ordered list of {@link JssmStateStyleKey} entries. Used by the
|
|
488
488
|
* `default_*_state_config` machine config options to provide a fallback
|
|
489
489
|
* style stack.
|
|
490
490
|
*/
|
|
491
|
-
|
|
491
|
+
type JssmStateStyleKeyList = JssmStateStyleKey[];
|
|
492
492
|
/**
|
|
493
493
|
* The graph-wide default edge colour style item, produced by the
|
|
494
494
|
* `edge-color`/`edge_color` line inside a `transition: {}` (or `graph: {}`)
|
|
@@ -496,7 +496,7 @@ declare type JssmStateStyleKeyList = JssmStateStyleKey[];
|
|
|
496
496
|
* applies to edges rather than nodes, and because it carries the legacy
|
|
497
497
|
* `graph_default_edge_color` key the grammar emits.
|
|
498
498
|
*/
|
|
499
|
-
|
|
499
|
+
type JssmGraphDefaultEdgeColor = {
|
|
500
500
|
key: 'graph_default_edge_color';
|
|
501
501
|
value: JssmColor;
|
|
502
502
|
};
|
|
@@ -508,7 +508,7 @@ declare type JssmGraphDefaultEdgeColor = {
|
|
|
508
508
|
*
|
|
509
509
|
* @see JssmTransitionConfig
|
|
510
510
|
*/
|
|
511
|
-
|
|
511
|
+
type JssmTransitionStyleKey = JssmStateStyleKey | JssmGraphDefaultEdgeColor;
|
|
512
512
|
/**
|
|
513
513
|
* The compiled value of a `transition: {}` config block: an ordered list of
|
|
514
514
|
* edge-default style items. V1 mirrors the state-style shape used by
|
|
@@ -523,7 +523,7 @@ declare type JssmTransitionStyleKey = JssmStateStyleKey | JssmGraphDefaultEdgeCo
|
|
|
523
523
|
*
|
|
524
524
|
* @see JssmGraphConfig
|
|
525
525
|
*/
|
|
526
|
-
|
|
526
|
+
type JssmTransitionConfig = JssmTransitionStyleKey[];
|
|
527
527
|
/**
|
|
528
528
|
* Graph-scope default-config style items folded from the deprecated
|
|
529
529
|
* top-level graph keywords (`graph_layout`, `graph_bg_color`,
|
|
@@ -531,7 +531,7 @@ declare type JssmTransitionConfig = JssmTransitionStyleKey[];
|
|
|
531
531
|
* default) into the consolidated `graph: {}` config. Each carries the
|
|
532
532
|
* legacy parse key so downstream consumers can disambiguate.
|
|
533
533
|
*/
|
|
534
|
-
|
|
534
|
+
type JssmGraphAliasKey = {
|
|
535
535
|
key: 'graph_layout';
|
|
536
536
|
value: JssmLayout;
|
|
537
537
|
} | {
|
|
@@ -555,7 +555,7 @@ declare type JssmGraphAliasKey = {
|
|
|
555
555
|
*
|
|
556
556
|
* @see JssmGraphConfig
|
|
557
557
|
*/
|
|
558
|
-
|
|
558
|
+
type JssmGraphStyleKey = JssmStateStyleKey | JssmGraphAliasKey;
|
|
559
559
|
/**
|
|
560
560
|
* The compiled value of a `graph: {}` config block: an ordered list of
|
|
561
561
|
* graph-default style items. The compiler folds the deprecated top-level
|
|
@@ -572,7 +572,7 @@ declare type JssmGraphStyleKey = JssmStateStyleKey | JssmGraphAliasKey;
|
|
|
572
572
|
*
|
|
573
573
|
* @see JssmTransitionConfig
|
|
574
574
|
*/
|
|
575
|
-
|
|
575
|
+
type JssmGraphConfig = JssmGraphStyleKey[];
|
|
576
576
|
/**
|
|
577
577
|
* Complete shape of a jssm-viz theme. A theme provides a style block for
|
|
578
578
|
* each kind of state (`state`, `hooked`, `start`, `end`, `terminal`) as
|
|
@@ -584,7 +584,7 @@ declare type JssmGraphConfig = JssmGraphStyleKey[];
|
|
|
584
584
|
* Most user-defined themes should be typed as {@link JssmTheme} (the
|
|
585
585
|
* `Partial` of this) so that omitted fields fall back to the base theme.
|
|
586
586
|
*/
|
|
587
|
-
|
|
587
|
+
type JssmBaseTheme = {
|
|
588
588
|
name: string;
|
|
589
589
|
state: JssmStateConfig;
|
|
590
590
|
hooked: JssmStateConfig;
|
|
@@ -608,7 +608,7 @@ declare type JssmBaseTheme = {
|
|
|
608
608
|
* every field is optional so themes can be layered: omitted slots fall
|
|
609
609
|
* through to the underlying base theme.
|
|
610
610
|
*/
|
|
611
|
-
|
|
611
|
+
type JssmTheme = Partial<JssmBaseTheme>;
|
|
612
612
|
/**
|
|
613
613
|
* Full configuration object accepted by the {@link Machine} constructor and
|
|
614
614
|
* by {@link from}. Carries the transition list and the optional knobs
|
|
@@ -627,28 +627,28 @@ declare type JssmTheme = Partial<JssmBaseTheme>;
|
|
|
627
627
|
* (fsl#1334), read by the all-widgets web control: a stochastic run-count
|
|
628
628
|
* and the panels the machine requests under `request` panel mode.
|
|
629
629
|
*/
|
|
630
|
-
|
|
630
|
+
type JssmEditorConfig = {
|
|
631
631
|
stochastic_run_count?: number;
|
|
632
632
|
panels?: Array<string>;
|
|
633
633
|
};
|
|
634
634
|
/** Which stochastic view a run batch produces. */
|
|
635
|
-
|
|
635
|
+
type JssmStochasticMode = 'montecarlo' | 'steady_state';
|
|
636
636
|
/** Options for {@link Machine.stochastic_summary} / {@link Machine.stochastic_runs}. */
|
|
637
|
-
|
|
637
|
+
type JssmStochasticOptions = {
|
|
638
638
|
mode?: JssmStochasticMode;
|
|
639
639
|
runs?: number;
|
|
640
640
|
max_steps?: number;
|
|
641
641
|
seed?: number;
|
|
642
642
|
};
|
|
643
643
|
/** One walk's result, yielded by {@link Machine.stochastic_runs}. */
|
|
644
|
-
|
|
644
|
+
type JssmStochasticRun = {
|
|
645
645
|
states: Array<string>;
|
|
646
646
|
edges: Array<string>;
|
|
647
647
|
length: number;
|
|
648
648
|
terminated: boolean;
|
|
649
649
|
};
|
|
650
650
|
/** Aggregate statistics over a stochastic run batch. */
|
|
651
|
-
|
|
651
|
+
type JssmStochasticSummary = {
|
|
652
652
|
mode: JssmStochasticMode;
|
|
653
653
|
runs: number;
|
|
654
654
|
seed: number;
|
|
@@ -659,7 +659,7 @@ declare type JssmStochasticSummary = {
|
|
|
659
659
|
terminal_reached?: number;
|
|
660
660
|
capped?: number;
|
|
661
661
|
};
|
|
662
|
-
|
|
662
|
+
type JssmGenericConfig<StateType, DataType> = {
|
|
663
663
|
graph_layout?: JssmLayout;
|
|
664
664
|
complete?: Array<StateType>;
|
|
665
665
|
transitions: JssmTransitions<StateType, DataType>;
|
|
@@ -765,7 +765,7 @@ declare type JssmGenericConfig<StateType, DataType> = {
|
|
|
765
765
|
*
|
|
766
766
|
* @internal
|
|
767
767
|
*/
|
|
768
|
-
|
|
768
|
+
type JssmCompileRule<StateType> = {
|
|
769
769
|
agg_as: string;
|
|
770
770
|
val: any;
|
|
771
771
|
};
|
|
@@ -778,7 +778,7 @@ declare type JssmCompileRule<StateType> = {
|
|
|
778
778
|
*
|
|
779
779
|
* @internal
|
|
780
780
|
*/
|
|
781
|
-
|
|
781
|
+
type JssmCompileSe<StateType, mDT> = {
|
|
782
782
|
to: StateType;
|
|
783
783
|
se?: JssmCompileSe<StateType, mDT>;
|
|
784
784
|
kind: JssmArrow;
|
|
@@ -802,7 +802,7 @@ declare type JssmCompileSe<StateType, mDT> = {
|
|
|
802
802
|
*
|
|
803
803
|
* @internal
|
|
804
804
|
*/
|
|
805
|
-
|
|
805
|
+
type JssmCompileSeStart<StateType, DataType> = {
|
|
806
806
|
from: StateType;
|
|
807
807
|
se: JssmCompileSe<StateType, DataType>;
|
|
808
808
|
key: string;
|
|
@@ -823,127 +823,127 @@ declare type JssmCompileSeStart<StateType, DataType> = {
|
|
|
823
823
|
*
|
|
824
824
|
* @internal
|
|
825
825
|
*/
|
|
826
|
-
|
|
826
|
+
type JssmParseTree<StateType, mDT> = Array<JssmCompileSeStart<StateType, mDT>>;
|
|
827
827
|
/**
|
|
828
828
|
* Signature of an FSL parse function: takes a source string and returns a
|
|
829
829
|
* {@link JssmParseTree}. Used to type the parser export so consumers can
|
|
830
830
|
* swap in alternative parser implementations.
|
|
831
831
|
*/
|
|
832
|
-
|
|
833
|
-
|
|
832
|
+
type JssmParseFunctionType<StateType, mDT> = (string: any) => JssmParseTree<StateType, mDT>;
|
|
833
|
+
type BasicHookDescription<mDT> = {
|
|
834
834
|
kind: 'hook';
|
|
835
835
|
from: string;
|
|
836
836
|
to: string;
|
|
837
837
|
handler: HookHandler<mDT>;
|
|
838
838
|
};
|
|
839
|
-
|
|
839
|
+
type HookDescriptionWithAction<mDT> = {
|
|
840
840
|
kind: 'named';
|
|
841
841
|
from: string;
|
|
842
842
|
to: string;
|
|
843
843
|
action: string;
|
|
844
844
|
handler: HookHandler<mDT>;
|
|
845
845
|
};
|
|
846
|
-
|
|
846
|
+
type StandardTransitionHook<mDT> = {
|
|
847
847
|
kind: 'standard transition';
|
|
848
848
|
handler: HookHandler<mDT>;
|
|
849
849
|
};
|
|
850
|
-
|
|
850
|
+
type MainTransitionHook<mDT> = {
|
|
851
851
|
kind: 'main transition';
|
|
852
852
|
handler: HookHandler<mDT>;
|
|
853
853
|
};
|
|
854
|
-
|
|
854
|
+
type ForcedTransitionHook<mDT> = {
|
|
855
855
|
kind: 'forced transition';
|
|
856
856
|
handler: HookHandler<mDT>;
|
|
857
857
|
};
|
|
858
|
-
|
|
858
|
+
type AnyTransitionHook<mDT> = {
|
|
859
859
|
kind: 'any transition';
|
|
860
860
|
handler: HookHandler<mDT>;
|
|
861
861
|
};
|
|
862
|
-
|
|
862
|
+
type GlobalActionHook<mDT> = {
|
|
863
863
|
kind: 'global action';
|
|
864
864
|
action: string;
|
|
865
865
|
handler: HookHandler<mDT>;
|
|
866
866
|
};
|
|
867
|
-
|
|
867
|
+
type AnyActionHook<mDT> = {
|
|
868
868
|
kind: 'any action';
|
|
869
869
|
handler: HookHandler<mDT>;
|
|
870
870
|
};
|
|
871
|
-
|
|
871
|
+
type EntryHook<mDT> = {
|
|
872
872
|
kind: 'entry';
|
|
873
873
|
to: string;
|
|
874
874
|
handler: HookHandler<mDT>;
|
|
875
875
|
};
|
|
876
|
-
|
|
876
|
+
type ExitHook<mDT> = {
|
|
877
877
|
kind: 'exit';
|
|
878
878
|
from: string;
|
|
879
879
|
handler: HookHandler<mDT>;
|
|
880
880
|
};
|
|
881
|
-
|
|
881
|
+
type AfterHook<mDT> = {
|
|
882
882
|
kind: 'after';
|
|
883
883
|
from: string;
|
|
884
884
|
handler: HookHandler<mDT>;
|
|
885
885
|
};
|
|
886
|
-
|
|
886
|
+
type PostBasicHookDescription<mDT> = {
|
|
887
887
|
kind: 'post hook';
|
|
888
888
|
from: string;
|
|
889
889
|
to: string;
|
|
890
890
|
handler: PostHookHandler<mDT>;
|
|
891
891
|
};
|
|
892
|
-
|
|
892
|
+
type PostHookDescriptionWithAction<mDT> = {
|
|
893
893
|
kind: 'post named';
|
|
894
894
|
from: string;
|
|
895
895
|
to: string;
|
|
896
896
|
action: string;
|
|
897
897
|
handler: PostHookHandler<mDT>;
|
|
898
898
|
};
|
|
899
|
-
|
|
899
|
+
type PostStandardTransitionHook<mDT> = {
|
|
900
900
|
kind: 'post standard transition';
|
|
901
901
|
handler: PostHookHandler<mDT>;
|
|
902
902
|
};
|
|
903
|
-
|
|
903
|
+
type PostMainTransitionHook<mDT> = {
|
|
904
904
|
kind: 'post main transition';
|
|
905
905
|
handler: PostHookHandler<mDT>;
|
|
906
906
|
};
|
|
907
|
-
|
|
907
|
+
type PostForcedTransitionHook<mDT> = {
|
|
908
908
|
kind: 'post forced transition';
|
|
909
909
|
handler: PostHookHandler<mDT>;
|
|
910
910
|
};
|
|
911
|
-
|
|
911
|
+
type PostAnyTransitionHook<mDT> = {
|
|
912
912
|
kind: 'post any transition';
|
|
913
913
|
handler: PostHookHandler<mDT>;
|
|
914
914
|
};
|
|
915
|
-
|
|
915
|
+
type PostGlobalActionHook<mDT> = {
|
|
916
916
|
kind: 'post global action';
|
|
917
917
|
action: string;
|
|
918
918
|
handler: PostHookHandler<mDT>;
|
|
919
919
|
};
|
|
920
|
-
|
|
920
|
+
type PostAnyActionHook<mDT> = {
|
|
921
921
|
kind: 'post any action';
|
|
922
922
|
handler: PostHookHandler<mDT>;
|
|
923
923
|
};
|
|
924
|
-
|
|
924
|
+
type PostEntryHook<mDT> = {
|
|
925
925
|
kind: 'post entry';
|
|
926
926
|
to: string;
|
|
927
927
|
handler: PostHookHandler<mDT>;
|
|
928
928
|
};
|
|
929
|
-
|
|
929
|
+
type PostExitHook<mDT> = {
|
|
930
930
|
kind: 'post exit';
|
|
931
931
|
from: string;
|
|
932
932
|
handler: PostHookHandler<mDT>;
|
|
933
933
|
};
|
|
934
|
-
|
|
934
|
+
type PreEverythingHook<mDT> = {
|
|
935
935
|
kind: 'pre everything';
|
|
936
936
|
handler: EverythingHookHandler<mDT>;
|
|
937
937
|
};
|
|
938
|
-
|
|
938
|
+
type EverythingHook<mDT> = {
|
|
939
939
|
kind: 'everything';
|
|
940
940
|
handler: EverythingHookHandler<mDT>;
|
|
941
941
|
};
|
|
942
|
-
|
|
942
|
+
type PrePostEverythingHook<mDT> = {
|
|
943
943
|
kind: 'pre post everything';
|
|
944
944
|
handler: PostEverythingHookHandler<mDT>;
|
|
945
945
|
};
|
|
946
|
-
|
|
946
|
+
type PostEverythingHook<mDT> = {
|
|
947
947
|
kind: 'post everything';
|
|
948
948
|
handler: PostEverythingHookHandler<mDT>;
|
|
949
949
|
};
|
|
@@ -961,13 +961,13 @@ declare type PostEverythingHook<mDT> = {
|
|
|
961
961
|
* variants (`'post *'`) cannot veto and are invoked only after a
|
|
962
962
|
* successful transition.
|
|
963
963
|
*/
|
|
964
|
-
|
|
964
|
+
type HookDescription<mDT> = BasicHookDescription<mDT> | HookDescriptionWithAction<mDT> | GlobalActionHook<mDT> | AnyActionHook<mDT> | StandardTransitionHook<mDT> | MainTransitionHook<mDT> | ForcedTransitionHook<mDT> | AnyTransitionHook<mDT> | EntryHook<mDT> | ExitHook<mDT> | AfterHook<mDT> | PostBasicHookDescription<mDT> | PostHookDescriptionWithAction<mDT> | PostGlobalActionHook<mDT> | PostAnyActionHook<mDT> | PostStandardTransitionHook<mDT> | PostMainTransitionHook<mDT> | PostForcedTransitionHook<mDT> | PostAnyTransitionHook<mDT> | PostEntryHook<mDT> | PostExitHook<mDT> | PreEverythingHook<mDT> | EverythingHook<mDT> | PrePostEverythingHook<mDT> | PostEverythingHook<mDT>;
|
|
965
965
|
/**
|
|
966
966
|
* Whether an observational hook runs in the pre-transition phase (where it
|
|
967
967
|
* may veto/mutate the transition) or the post-transition phase (a pure
|
|
968
968
|
* observer that runs only after a successful transition commits).
|
|
969
969
|
*/
|
|
970
|
-
|
|
970
|
+
type HookPhase = 'pre' | 'post';
|
|
971
971
|
/**
|
|
972
972
|
* Coarse classification of *what* a hook observes, used to bucket every hook
|
|
973
973
|
* kind into the uniform registry. `'edge'` hooks watch a `from→to`
|
|
@@ -977,7 +977,7 @@ declare type HookPhase = 'pre' | 'post';
|
|
|
977
977
|
* transition or every action (the `any-*`, transition-class, and `everything`
|
|
978
978
|
* observers); `'group'` hooks watch a named state group's enter/exit boundary.
|
|
979
979
|
*/
|
|
980
|
-
|
|
980
|
+
type HookTargetScope = 'edge' | 'state' | 'action' | 'global' | 'group';
|
|
981
981
|
/**
|
|
982
982
|
* Normalized description of the target a registry entry is bound to. Exactly
|
|
983
983
|
* one scope variant applies; the present fields depend on the scope:
|
|
@@ -988,7 +988,7 @@ declare type HookTargetScope = 'edge' | 'state' | 'action' | 'global' | 'group';
|
|
|
988
988
|
* - `'global'` carries no further keys (it matches everything),
|
|
989
989
|
* - `'group'` carries `group` (a named state group with a boundary hook).
|
|
990
990
|
*/
|
|
991
|
-
|
|
991
|
+
type HookTarget = {
|
|
992
992
|
scope: 'edge';
|
|
993
993
|
from: StateType;
|
|
994
994
|
to: StateType;
|
|
@@ -1012,7 +1012,7 @@ declare type HookTarget = {
|
|
|
1012
1012
|
* covers only the programmatically-registered observational hooks), so the
|
|
1013
1013
|
* registry widens its `kind` field with them.
|
|
1014
1014
|
*/
|
|
1015
|
-
|
|
1015
|
+
type HookBoundaryKind = 'group enter' | 'group exit' | 'state enter' | 'state exit';
|
|
1016
1016
|
/**
|
|
1017
1017
|
* One row of the generated uniform observational-hook registry. `kind` is
|
|
1018
1018
|
* either an original {@link HookDescription} discriminator (e.g. `'entry'`,
|
|
@@ -1021,7 +1021,7 @@ declare type HookBoundaryKind = 'group enter' | 'group exit' | 'state enter' | '
|
|
|
1021
1021
|
* normalized {@link HookTarget} it is bound to. The triple
|
|
1022
1022
|
* `(kind, target, phase)` is the registry key the spec calls for.
|
|
1023
1023
|
*/
|
|
1024
|
-
|
|
1024
|
+
type HookRegistryEntry = {
|
|
1025
1025
|
kind: HookDescription<unknown>['kind'] | HookBoundaryKind;
|
|
1026
1026
|
phase: HookPhase;
|
|
1027
1027
|
target: HookTarget;
|
|
@@ -1034,7 +1034,7 @@ declare type HookRegistryEntry = {
|
|
|
1034
1034
|
* mirrors the spec's `hooks_on(state)` / `hooks_on(from→to)` /
|
|
1035
1035
|
* `hooks_on(action)` / `hooks_on(&group)` set with one parameter shape.
|
|
1036
1036
|
*/
|
|
1037
|
-
|
|
1037
|
+
type HookQuery = StateType | {
|
|
1038
1038
|
from: StateType;
|
|
1039
1039
|
to: StateType;
|
|
1040
1040
|
action?: string;
|
|
@@ -1051,7 +1051,7 @@ declare type HookQuery = StateType | {
|
|
|
1051
1051
|
* `data` overrides the data observed by other hooks in the same chain,
|
|
1052
1052
|
* and `next_data` overrides the data committed after the transition.
|
|
1053
1053
|
*/
|
|
1054
|
-
|
|
1054
|
+
type HookComplexResult<mDT> = {
|
|
1055
1055
|
pass: boolean;
|
|
1056
1056
|
state?: StateType;
|
|
1057
1057
|
data?: mDT;
|
|
@@ -1063,7 +1063,7 @@ declare type HookComplexResult<mDT> = {
|
|
|
1063
1063
|
* a {@link HookComplexResult} that additionally rewrites the next state
|
|
1064
1064
|
* and/or the next data payload.
|
|
1065
1065
|
*/
|
|
1066
|
-
|
|
1066
|
+
type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>;
|
|
1067
1067
|
/**
|
|
1068
1068
|
* Context object passed to every {@link HookHandler}. `data` is the
|
|
1069
1069
|
* data payload as it stands before the transition, and `next_data` is
|
|
@@ -1071,7 +1071,7 @@ declare type HookResult<mDT> = true | false | undefined | void | HookComplexResu
|
|
|
1071
1071
|
* handlers may inspect or mutate the latter via a
|
|
1072
1072
|
* {@link HookComplexResult} return value.
|
|
1073
1073
|
*/
|
|
1074
|
-
|
|
1074
|
+
type HookContext<mDT> = {
|
|
1075
1075
|
data: mDT;
|
|
1076
1076
|
next_data: mDT;
|
|
1077
1077
|
};
|
|
@@ -1081,7 +1081,7 @@ declare type HookContext<mDT> = {
|
|
|
1081
1081
|
* {@link HookContext} with `hook_name`, which identifies which specific
|
|
1082
1082
|
* hook fired so a single handler can route on it.
|
|
1083
1083
|
*/
|
|
1084
|
-
|
|
1084
|
+
type EverythingHookContext<mDT> = HookContext<mDT> & {
|
|
1085
1085
|
hook_name: string;
|
|
1086
1086
|
};
|
|
1087
1087
|
/**
|
|
@@ -1091,31 +1091,31 @@ declare type EverythingHookContext<mDT> = HookContext<mDT> & {
|
|
|
1091
1091
|
* result allows it, and a {@link HookComplexResult} can additionally
|
|
1092
1092
|
* rewrite the next state or next data.
|
|
1093
1093
|
*/
|
|
1094
|
-
|
|
1094
|
+
type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult<mDT>;
|
|
1095
1095
|
/**
|
|
1096
1096
|
* Signature of a post-transition hook handler. Invoked after a successful
|
|
1097
1097
|
* transition has been committed; the return value is ignored (the
|
|
1098
1098
|
* transition cannot be undone).
|
|
1099
1099
|
*/
|
|
1100
|
-
|
|
1100
|
+
type PostHookHandler<mDT> = (hook_context: HookContext<mDT>) => void;
|
|
1101
1101
|
/**
|
|
1102
1102
|
* Signature of an "everything" pre-transition hook handler. Like
|
|
1103
1103
|
* {@link HookHandler} but receives an {@link EverythingHookContext} so the
|
|
1104
1104
|
* handler can dispatch on `hook_name`.
|
|
1105
1105
|
*/
|
|
1106
|
-
|
|
1106
|
+
type EverythingHookHandler<mDT> = (hook_context: EverythingHookContext<mDT>) => HookResult<mDT>;
|
|
1107
1107
|
/**
|
|
1108
1108
|
* Signature of an "everything" post-transition hook handler. Like
|
|
1109
1109
|
* {@link PostHookHandler} but receives an {@link EverythingHookContext}.
|
|
1110
1110
|
* The return value is ignored.
|
|
1111
1111
|
*/
|
|
1112
|
-
|
|
1112
|
+
type PostEverythingHookHandler<mDT> = (hook_context: EverythingHookContext<mDT>) => void;
|
|
1113
1113
|
/**
|
|
1114
1114
|
* Extra diagnostic information attached to a {@link JssmError} when it
|
|
1115
1115
|
* carries machine-relative context — most often the state name a caller
|
|
1116
1116
|
* asked about when the error was raised.
|
|
1117
1117
|
*/
|
|
1118
|
-
|
|
1118
|
+
type JssmErrorExtendedInfo = {
|
|
1119
1119
|
requested_state?: StateType | undefined;
|
|
1120
1120
|
source_location?: FslSourceLocation;
|
|
1121
1121
|
};
|
|
@@ -1124,14 +1124,14 @@ declare type JssmErrorExtendedInfo = {
|
|
|
1124
1124
|
* observed in each. Backed by `circular_buffer_js`, so the oldest entry
|
|
1125
1125
|
* is dropped silently once the configured capacity is exceeded.
|
|
1126
1126
|
*/
|
|
1127
|
-
|
|
1127
|
+
type JssmHistory<mDT> = circular_buffer<[StateType, mDT]>;
|
|
1128
1128
|
/**
|
|
1129
1129
|
* Pluggable random-number-generator function shape. Must return a value
|
|
1130
1130
|
* in `[0, 1)` exactly as `Math.random` does. Supplied via the
|
|
1131
1131
|
* `rng_seed`-aware machine configuration so that stochastic models can be
|
|
1132
1132
|
* made reproducible.
|
|
1133
1133
|
*/
|
|
1134
|
-
|
|
1134
|
+
type JssmRng = () => number;
|
|
1135
1135
|
/**
|
|
1136
1136
|
* All event names that {@link Machine.on} accepts. These are observation
|
|
1137
1137
|
* events fired by the machine in addition to (not in place of) the hook
|
|
@@ -1139,14 +1139,14 @@ declare type JssmRng = () => number;
|
|
|
1139
1139
|
*
|
|
1140
1140
|
* @see Machine.on
|
|
1141
1141
|
*/
|
|
1142
|
-
|
|
1142
|
+
type JssmEventName = 'transition' | 'rejection' | 'action' | 'entry' | 'exit' | 'terminal' | 'complete' | 'error' | 'data-change' | 'override' | 'timeout' | 'hook-registration' | 'hook-removal';
|
|
1143
1143
|
/**
|
|
1144
1144
|
* Detail payload fired with a `transition` event. Carries the resolved
|
|
1145
1145
|
* source and target, the action name (if the transition was driven by an
|
|
1146
1146
|
* action), the data observed before and after the change, the edge kind,
|
|
1147
1147
|
* and whether the call was a forced transition.
|
|
1148
1148
|
*/
|
|
1149
|
-
|
|
1149
|
+
type JssmTransitionEventDetail<mDT> = {
|
|
1150
1150
|
from: StateType;
|
|
1151
1151
|
to: StateType;
|
|
1152
1152
|
action?: StateType;
|
|
@@ -1161,7 +1161,7 @@ declare type JssmTransitionEventDetail<mDT> = {
|
|
|
1161
1161
|
* and why. `reason` is `'invalid'` when no edge existed, `'hook'` when
|
|
1162
1162
|
* a hook handler vetoed; `hook_name` is set when `reason` is `'hook'`.
|
|
1163
1163
|
*/
|
|
1164
|
-
|
|
1164
|
+
type JssmRejectionEventDetail<mDT> = {
|
|
1165
1165
|
from: StateType;
|
|
1166
1166
|
to: StateType;
|
|
1167
1167
|
action?: StateType;
|
|
@@ -1175,7 +1175,7 @@ declare type JssmRejectionEventDetail<mDT> = {
|
|
|
1175
1175
|
* Detail payload fired with an `action` event. Fires when an action is
|
|
1176
1176
|
* attempted, before transition validation runs.
|
|
1177
1177
|
*/
|
|
1178
|
-
|
|
1178
|
+
type JssmActionEventDetail<mDT> = {
|
|
1179
1179
|
action: StateType;
|
|
1180
1180
|
from: StateType;
|
|
1181
1181
|
to?: StateType;
|
|
@@ -1187,7 +1187,7 @@ declare type JssmActionEventDetail<mDT> = {
|
|
|
1187
1187
|
* state. `from` is the predecessor state, if any. `action` is the
|
|
1188
1188
|
* action that drove the entry, if any.
|
|
1189
1189
|
*/
|
|
1190
|
-
|
|
1190
|
+
type JssmEntryEventDetail<mDT> = {
|
|
1191
1191
|
state: StateType;
|
|
1192
1192
|
from?: StateType;
|
|
1193
1193
|
action?: StateType;
|
|
@@ -1198,7 +1198,7 @@ declare type JssmEntryEventDetail<mDT> = {
|
|
|
1198
1198
|
* state. `to` is the next state, if any. `action` is the action that
|
|
1199
1199
|
* drove the exit, if any.
|
|
1200
1200
|
*/
|
|
1201
|
-
|
|
1201
|
+
type JssmExitEventDetail<mDT> = {
|
|
1202
1202
|
state: StateType;
|
|
1203
1203
|
to?: StateType;
|
|
1204
1204
|
action?: StateType;
|
|
@@ -1208,7 +1208,7 @@ declare type JssmExitEventDetail<mDT> = {
|
|
|
1208
1208
|
* Detail payload fired with a `terminal` event. Indicates that the
|
|
1209
1209
|
* machine has reached a state with no outgoing edges.
|
|
1210
1210
|
*/
|
|
1211
|
-
|
|
1211
|
+
type JssmTerminalEventDetail<mDT> = {
|
|
1212
1212
|
state: StateType;
|
|
1213
1213
|
data: mDT;
|
|
1214
1214
|
};
|
|
@@ -1216,7 +1216,7 @@ declare type JssmTerminalEventDetail<mDT> = {
|
|
|
1216
1216
|
* Detail payload fired with a `complete` event. Indicates that the
|
|
1217
1217
|
* machine has reached a FSL `complete` state.
|
|
1218
1218
|
*/
|
|
1219
|
-
|
|
1219
|
+
type JssmCompleteEventDetail<mDT> = {
|
|
1220
1220
|
state: StateType;
|
|
1221
1221
|
data: mDT;
|
|
1222
1222
|
};
|
|
@@ -1226,7 +1226,7 @@ declare type JssmCompleteEventDetail<mDT> = {
|
|
|
1226
1226
|
* identify the event whose handler threw, and `handler` is the offending
|
|
1227
1227
|
* function so consumers can correlate / blame.
|
|
1228
1228
|
*/
|
|
1229
|
-
|
|
1229
|
+
type JssmErrorEventDetail = {
|
|
1230
1230
|
error: unknown;
|
|
1231
1231
|
source_event: JssmEventName;
|
|
1232
1232
|
source_detail: unknown;
|
|
@@ -1237,7 +1237,7 @@ declare type JssmErrorEventDetail = {
|
|
|
1237
1237
|
* machine's data payload is replaced. `old_data` is the value before the
|
|
1238
1238
|
* change; `new_data` is the value after.
|
|
1239
1239
|
*/
|
|
1240
|
-
|
|
1240
|
+
type JssmDataChangeEventDetail<mDT> = {
|
|
1241
1241
|
from?: StateType;
|
|
1242
1242
|
to?: StateType;
|
|
1243
1243
|
action?: StateType;
|
|
@@ -1249,7 +1249,7 @@ declare type JssmDataChangeEventDetail<mDT> = {
|
|
|
1249
1249
|
* Detail payload fired with an `override` event. Distinguishes a forced
|
|
1250
1250
|
* state replacement from a normal transition.
|
|
1251
1251
|
*/
|
|
1252
|
-
|
|
1252
|
+
type JssmOverrideEventDetail<mDT> = {
|
|
1253
1253
|
from: StateType;
|
|
1254
1254
|
to: StateType;
|
|
1255
1255
|
old_data: mDT;
|
|
@@ -1259,7 +1259,7 @@ declare type JssmOverrideEventDetail<mDT> = {
|
|
|
1259
1259
|
* Detail payload fired with a `timeout` event. Fires when a configured
|
|
1260
1260
|
* `after` clause causes an automatic transition.
|
|
1261
1261
|
*/
|
|
1262
|
-
|
|
1262
|
+
type JssmTimeoutEventDetail = {
|
|
1263
1263
|
from: StateType;
|
|
1264
1264
|
to: StateType;
|
|
1265
1265
|
after_time: number;
|
|
@@ -1269,7 +1269,7 @@ declare type JssmTimeoutEventDetail = {
|
|
|
1269
1269
|
* Mirrors the {@link HookDescription} so inspector tools can mirror the
|
|
1270
1270
|
* current hook set.
|
|
1271
1271
|
*/
|
|
1272
|
-
|
|
1272
|
+
type JssmHookLifecycleEventDetail<mDT> = {
|
|
1273
1273
|
description: HookDescription<mDT>;
|
|
1274
1274
|
};
|
|
1275
1275
|
/**
|
|
@@ -1277,7 +1277,7 @@ declare type JssmHookLifecycleEventDetail<mDT> = {
|
|
|
1277
1277
|
* payload. Drives the discriminated-union typing of {@link Machine.on},
|
|
1278
1278
|
* so `e.action` and friends only exist where they're meaningful.
|
|
1279
1279
|
*/
|
|
1280
|
-
|
|
1280
|
+
type JssmEventDetailMap<mDT> = {
|
|
1281
1281
|
'transition': JssmTransitionEventDetail<mDT>;
|
|
1282
1282
|
'rejection': JssmRejectionEventDetail<mDT>;
|
|
1283
1283
|
'action': JssmActionEventDetail<mDT>;
|
|
@@ -1298,7 +1298,7 @@ declare type JssmEventDetailMap<mDT> = {
|
|
|
1298
1298
|
* filter entry fire the handler. Events that don't list a filter key in
|
|
1299
1299
|
* v1 take no filter properties.
|
|
1300
1300
|
*/
|
|
1301
|
-
|
|
1301
|
+
type JssmEventFilterMap<mDT> = {
|
|
1302
1302
|
'transition': {
|
|
1303
1303
|
from?: StateType;
|
|
1304
1304
|
to?: StateType;
|
|
@@ -1326,17 +1326,17 @@ declare type JssmEventFilterMap<mDT> = {
|
|
|
1326
1326
|
* @typeparam mDT The type of the machine data member.
|
|
1327
1327
|
* @typeparam Ev The event name.
|
|
1328
1328
|
*/
|
|
1329
|
-
|
|
1329
|
+
type JssmEventFilter<mDT, Ev extends JssmEventName> = JssmEventFilterMap<mDT>[Ev];
|
|
1330
1330
|
/**
|
|
1331
1331
|
* Per-event handler signature. Receives a detail object typed by event
|
|
1332
1332
|
* name, so `e.action` (etc.) only exist where they're meaningful.
|
|
1333
1333
|
* @typeparam mDT The type of the machine data member.
|
|
1334
1334
|
* @typeparam Ev The event name.
|
|
1335
1335
|
*/
|
|
1336
|
-
|
|
1336
|
+
type JssmEventHandler<mDT, Ev extends JssmEventName> = (detail: JssmEventDetailMap<mDT>[Ev]) => void;
|
|
1337
1337
|
/**
|
|
1338
1338
|
* Function returned by {@link Machine.on} and {@link Machine.once} that
|
|
1339
1339
|
* removes the subscription. Calling it more than once is a no-op.
|
|
1340
1340
|
*/
|
|
1341
|
-
|
|
1341
|
+
type JssmUnsubscribe = () => void;
|
|
1342
1342
|
export { JssmColor, JssmShape, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmEditorConfig, JssmStochasticMode, JssmStochasticOptions, JssmStochasticRun, JssmStochasticSummary, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmStateConfig, JssmStateStyleKey, JssmStateStyleKeyList, JssmGraphDefaultEdgeColor, JssmTransitionStyleKey, JssmTransitionConfig, JssmGraphAliasKey, JssmGraphStyleKey, JssmGraphConfig, JssmBaseTheme, JssmTheme, JssmLayout, JssmHistory, JssmSerialization, JssmPropertyDefinition, JssmAllowsOverride, JssmAllowIslands, JssmDefaultSize, JssmGroupRef, JssmGroupMemberRef, JssmGroupRegistry, JssmHookDeclaration, JssmBoundaryHooks, JssmGroupHooks, JssmStateHooks, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirections, FslDirection, FslThemes, FslTheme, FslSourcePoint, FslSourceLocation, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult, EverythingHookContext, EverythingHookHandler, PostEverythingHookHandler, HookPhase, HookTargetScope, HookTarget, HookBoundaryKind, HookRegistryEntry, HookQuery, JssmEventName, JssmEventDetailMap, JssmEventFilterMap, JssmEventFilter, JssmEventHandler, JssmUnsubscribe, JssmTransitionEventDetail, JssmRejectionEventDetail, JssmActionEventDetail, JssmEntryEventDetail, JssmExitEventDetail, JssmTerminalEventDetail, JssmCompleteEventDetail, JssmErrorEventDetail, JssmDataChangeEventDetail, JssmOverrideEventDetail, JssmTimeoutEventDetail, JssmHookLifecycleEventDetail, JssmRng };
|