jssm 5.112.3 → 5.113.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 +3 -3
- package/dist/deno/README.md +347 -0
- package/dist/deno/jssm.js +1 -0
- package/dist/{es6 → deno}/jssm_constants.d.ts +5 -0
- package/dist/{es6 → deno}/jssm_types.d.ts +298 -5
- 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/jssm.es5.d.cts +241 -2
- package/jssm.es6.d.ts +241 -2
- package/jssm_viz.es5.d.cts +216 -2
- package/jssm_viz.es6.d.ts +216 -2
- package/package.json +18 -2
- package/.clocignore +0 -1
- package/.codeclimate.yml +0 -22
- package/.editorconfig +0 -12
- package/.eslintrc +0 -20
- package/.gitattributes +0 -17
- package/.log-progress.json +0 -9
- package/.nycrc +0 -6
- package/.travis.yml +0 -9
- package/CHANGELOG.md +0 -263
- package/CLAUDE.md +0 -11
- package/dist/es6/fsl_parser.js +0 -1
- package/dist/es6/jssm.js +0 -3320
- package/dist/es6/jssm_arrow.js +0 -211
- package/dist/es6/jssm_compiler.js +0 -380
- package/dist/es6/jssm_constants.js +0 -121
- package/dist/es6/jssm_error.js +0 -47
- package/dist/es6/jssm_theme.js +0 -24
- package/dist/es6/jssm_types.js +0 -3
- package/dist/es6/jssm_util.js +0 -337
- package/dist/es6/jssm_viz.js +0 -560
- package/dist/es6/jssm_viz_colors.js +0 -63
- package/dist/es6/themes/jssm_base_stylesheet.d.ts +0 -11
- package/dist/es6/themes/jssm_base_stylesheet.js +0 -58
- package/dist/es6/themes/jssm_theme_bold.d.ts +0 -11
- package/dist/es6/themes/jssm_theme_bold.js +0 -58
- package/dist/es6/themes/jssm_theme_default.d.ts +0 -11
- package/dist/es6/themes/jssm_theme_default.js +0 -58
- package/dist/es6/themes/jssm_theme_modern.d.ts +0 -11
- package/dist/es6/themes/jssm_theme_modern.js +0 -58
- package/dist/es6/themes/jssm_theme_ocean.d.ts +0 -11
- package/dist/es6/themes/jssm_theme_ocean.js +0 -56
- package/dist/es6/themes/jssm_theme_plain.d.ts +0 -11
- package/dist/es6/themes/jssm_theme_plain.js +0 -70
- package/dist/es6/version.js +0 -2
- package/dist/jssm.es5.nonmin.cjs +0 -24506
- package/dist/jssm.es6.nonmin.cjs +0 -24473
- package/dist/jssm_viz.es5.iife.nonmin.cjs +0 -24679
- package/dist/jssm_viz.es5.nonmin.cjs +0 -24674
- package/dist/jssm_viz.es6.nonmin.cjs +0 -24661
- package/jest-dragon.config.cjs +0 -36
- package/jest-spec.config.cjs +0 -36
- package/jest-stoch.config.cjs +0 -36
- package/jest-unicode.config.cjs +0 -36
- package/log-progress.data.json +0 -28
- package/rollup.config.deno.js +0 -44
- package/rollup.config.es5.js +0 -52
- package/rollup.config.es6.js +0 -55
- package/rollup.config.viz.es5.js +0 -46
- package/rollup.config.viz.es6.js +0 -46
- package/rollup.config.viz.iife.js +0 -36
- package/tutorial_learn_testing.md +0 -168
- package/typedoc-options.cjs +0 -69
- /package/dist/{es6 → deno}/fsl_parser.d.ts +0 -0
- /package/dist/{es6 → deno}/jssm.d.ts +0 -0
- /package/dist/{es6 → deno}/jssm_arrow.d.ts +0 -0
- /package/dist/{es6 → deno}/jssm_compiler.d.ts +0 -0
- /package/dist/{es6 → deno}/jssm_error.d.ts +0 -0
- /package/dist/{es6 → deno}/jssm_theme.d.ts +0 -0
- /package/dist/{es6 → deno}/jssm_util.d.ts +0 -0
- /package/dist/{es6 → deno}/jssm_viz.d.ts +0 -0
- /package/dist/{es6 → deno}/jssm_viz_colors.d.ts +0 -0
- /package/dist/{es6 → deno}/version.d.ts +0 -0
package/jssm.es5.d.cts
CHANGED
|
@@ -1,23 +1,87 @@
|
|
|
1
1
|
import { circular_buffer } from 'circular_buffer_js';
|
|
2
2
|
|
|
3
|
-
declare type StateType$1 = string;
|
|
3
|
+
declare type StateType$1 = string;
|
|
4
|
+
/**
|
|
5
|
+
* A color value accepted by jssm-viz for state and arrow styling. Currently
|
|
6
|
+
* any string, validated downstream by Graphviz / the named-colors list.
|
|
7
|
+
* Intended to be narrowed to `#RRGGBB` / `#RRGGBBAA` and CSS named colors
|
|
8
|
+
* in a future release.
|
|
9
|
+
*/
|
|
4
10
|
declare type JssmColor = string;
|
|
11
|
+
/**
|
|
12
|
+
* Three-state policy flag: `'required'`, `'disallowed'`, or `'optional'`.
|
|
13
|
+
* Used by machine configuration where a default-permissive middle ground
|
|
14
|
+
* is meaningful (for example, the `actions` config key).
|
|
15
|
+
*/
|
|
5
16
|
declare type JssmPermittedOpt = 'required' | 'disallowed' | 'optional';
|
|
17
|
+
/**
|
|
18
|
+
* The set of ASCII arrow tokens recognized by the FSL grammar. Each arrow
|
|
19
|
+
* encodes a direction (one-way left/right, or two-way) and a "kind" for
|
|
20
|
+
* each direction (`-` legal, `=` main path, `~` forced-only). See the
|
|
21
|
+
* Language Reference docs for the full semantic table.
|
|
22
|
+
*/
|
|
6
23
|
declare type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>';
|
|
7
24
|
/**
|
|
8
25
|
* A type teaching Typescript the various supported shapes for nodes, mostly inherited from GraphViz
|
|
9
26
|
*/
|
|
10
27
|
declare 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";
|
|
28
|
+
/**
|
|
29
|
+
* Direction polarity of an arrow: pointing only `'left'`, only `'right'`,
|
|
30
|
+
* or `'both'` (a bidirectional arrow).
|
|
31
|
+
*/
|
|
11
32
|
declare type JssmArrowDirection = 'left' | 'right' | 'both';
|
|
33
|
+
/**
|
|
34
|
+
* Semantic category of an arrow's transition. `'legal'` is a normal
|
|
35
|
+
* transition, `'main'` is part of the machine's primary path, `'forced'`
|
|
36
|
+
* may only be taken via {@link Machine.force_transition}, and `'none'`
|
|
37
|
+
* means no transition exists in that direction.
|
|
38
|
+
*/
|
|
12
39
|
declare type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced';
|
|
40
|
+
/**
|
|
41
|
+
* Graphviz layout engine selector. Controls how jssm-viz lays out the
|
|
42
|
+
* rendered diagram; `'dot'` is the default and most useful for state
|
|
43
|
+
* machines. See the Graphviz documentation for the differences.
|
|
44
|
+
*/
|
|
13
45
|
declare type JssmLayout = 'dot' | 'circo' | 'twopi' | 'fdp' | 'neato';
|
|
14
46
|
declare type JssmCorner = 'regular' | 'rounded' | 'lined';
|
|
15
47
|
declare type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
|
|
48
|
+
/**
|
|
49
|
+
* Tristate flag for whether a property may be overridden at runtime.
|
|
50
|
+
* `true` permits overrides, `false` forbids them, and `undefined` defers
|
|
51
|
+
* the decision to the surrounding configuration's default.
|
|
52
|
+
*/
|
|
16
53
|
declare type JssmAllowsOverride = true | false | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Runtime-iterable list of valid `flow` directions for FSL diagrams.
|
|
56
|
+
* Use this when you need to enumerate directions; for the type itself
|
|
57
|
+
* see {@link FslDirection}.
|
|
58
|
+
*/
|
|
17
59
|
declare const FslDirections: readonly ["up", "right", "down", "left"];
|
|
60
|
+
/**
|
|
61
|
+
* String literal type of the four supported FSL flow directions. This is
|
|
62
|
+
* the type of the `flow` config key on a machine.
|
|
63
|
+
*/
|
|
18
64
|
declare type FslDirection = typeof FslDirections[number];
|
|
65
|
+
/**
|
|
66
|
+
* Runtime-iterable list of the built-in theme names that ship with jssm-viz.
|
|
67
|
+
* Use this when you need to enumerate themes; for the type itself see
|
|
68
|
+
* {@link FslTheme}.
|
|
69
|
+
*/
|
|
19
70
|
declare const FslThemes: readonly ["default", "ocean", "modern", "plain", "bold"];
|
|
71
|
+
/**
|
|
72
|
+
* String literal type of the built-in theme names. This is the element
|
|
73
|
+
* type of the `theme` config key (which accepts an array so that themes
|
|
74
|
+
* can be layered).
|
|
75
|
+
*/
|
|
20
76
|
declare type FslTheme = typeof FslThemes[number];
|
|
77
|
+
/**
|
|
78
|
+
* Persistable snapshot of a Machine produced by {@link Machine.serialize}
|
|
79
|
+
* and consumed by {@link deserialize}. Carries the current state, the
|
|
80
|
+
* associated machine data, the recent history (subject to the configured
|
|
81
|
+
* capacity), and metadata to detect version-skew on rehydration.
|
|
82
|
+
*
|
|
83
|
+
* @typeParam DataType - The type of the user-supplied data payload (`mDT`).
|
|
84
|
+
*/
|
|
21
85
|
declare type JssmSerialization<DataType> = {
|
|
22
86
|
jssm_version: string;
|
|
23
87
|
timestamp: number;
|
|
@@ -27,6 +91,11 @@ declare type JssmSerialization<DataType> = {
|
|
|
27
91
|
history_capacity: number;
|
|
28
92
|
data: DataType;
|
|
29
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* Declaration of a named property that a machine's states may carry.
|
|
96
|
+
* Set `required: true` to force every state to define the property, or
|
|
97
|
+
* provide `default_value` to fall back when the state does not specify it.
|
|
98
|
+
*/
|
|
30
99
|
declare type JssmPropertyDefinition = {
|
|
31
100
|
name: string;
|
|
32
101
|
default_value?: any;
|
|
@@ -34,6 +103,17 @@ declare type JssmPropertyDefinition = {
|
|
|
34
103
|
};
|
|
35
104
|
declare type JssmTransitionPermitter<DataType> = (OldState: StateType$1, NewState: StateType$1, OldData: DataType, NewData: DataType) => boolean;
|
|
36
105
|
declare type JssmTransitionPermitterMaybeArray<DataType> = JssmTransitionPermitter<DataType> | Array<JssmTransitionPermitter<DataType>>;
|
|
106
|
+
/**
|
|
107
|
+
* A single directed transition (edge) within a state machine. Captures
|
|
108
|
+
* both the topology (`from` / `to`), the FSL semantics (`kind`,
|
|
109
|
+
* `forced_only`, `main_path`), and any optional metadata such as a
|
|
110
|
+
* per-edge `name`, an action label, a guard `check`, a transition
|
|
111
|
+
* `probability` for stochastic models, and an `after_time` for timed
|
|
112
|
+
* transitions.
|
|
113
|
+
*
|
|
114
|
+
* @typeParam StateType - The state-name type (usually `string`).
|
|
115
|
+
* @typeParam DataType - The machine's data payload type (`mDT`).
|
|
116
|
+
*/
|
|
37
117
|
declare type JssmTransition<StateType, DataType> = {
|
|
38
118
|
from: StateType;
|
|
39
119
|
to: StateType;
|
|
@@ -47,17 +127,34 @@ declare type JssmTransition<StateType, DataType> = {
|
|
|
47
127
|
forced_only: boolean;
|
|
48
128
|
main_path: boolean;
|
|
49
129
|
};
|
|
130
|
+
/** A list of {@link JssmTransition}s — the edge set of a machine. */
|
|
50
131
|
declare type JssmTransitions<StateType, DataType> = JssmTransition<StateType, DataType>[];
|
|
132
|
+
/**
|
|
133
|
+
* The set of states that can immediately precede or follow a given state.
|
|
134
|
+
* Returned by jssm helpers that report a state's connectivity in the graph.
|
|
135
|
+
*/
|
|
51
136
|
declare type JssmTransitionList = {
|
|
52
137
|
entrances: Array<StateType$1>;
|
|
53
138
|
exits: Array<StateType$1>;
|
|
54
139
|
};
|
|
140
|
+
/**
|
|
141
|
+
* Topology record for one node in a compiled machine: its name, the set of
|
|
142
|
+
* states it can be reached from, the set of states it can transition to,
|
|
143
|
+
* and whether reaching it constitutes "completing" the machine.
|
|
144
|
+
*/
|
|
55
145
|
declare type JssmGenericState = {
|
|
56
146
|
from: Array<StateType$1>;
|
|
57
147
|
name: StateType$1;
|
|
58
148
|
to: Array<StateType$1>;
|
|
59
149
|
complete: boolean;
|
|
60
150
|
};
|
|
151
|
+
/**
|
|
152
|
+
* The full internal bookkeeping snapshot of a {@link Machine}, exposed for
|
|
153
|
+
* advanced introspection. Contains the current state, the state map, the
|
|
154
|
+
* edge map and reverse-action map, and the original edge list. The
|
|
155
|
+
* `internal_state_impl_version` field exists so that consumers can detect
|
|
156
|
+
* shape changes if this representation evolves.
|
|
157
|
+
*/
|
|
61
158
|
declare type JssmMachineInternalState<DataType> = {
|
|
62
159
|
internal_state_impl_version: 1;
|
|
63
160
|
state: StateType$1;
|
|
@@ -70,11 +167,21 @@ declare type JssmMachineInternalState<DataType> = {
|
|
|
70
167
|
};
|
|
71
168
|
declare type JssmStatePermitter<DataType> = (OldState: StateType$1, NewState: StateType$1, OldData: DataType, NewData: DataType) => boolean;
|
|
72
169
|
declare type JssmStatePermitterMaybeArray<DataType> = JssmStatePermitter<DataType> | Array<JssmStatePermitter<DataType>>;
|
|
170
|
+
/**
|
|
171
|
+
* A single key/value pair from an FSL `state X: { ... };` block, in the
|
|
172
|
+
* raw form produced by the parser before being condensed into a
|
|
173
|
+
* {@link JssmStateDeclaration}.
|
|
174
|
+
*/
|
|
73
175
|
declare type JssmStateDeclarationRule = {
|
|
74
176
|
key: string;
|
|
75
177
|
value: any;
|
|
76
178
|
name?: string;
|
|
77
179
|
};
|
|
180
|
+
/**
|
|
181
|
+
* The fully-condensed declaration for a single state, including its raw
|
|
182
|
+
* rule list (`declarations`) and the well-known styling fields jssm-viz
|
|
183
|
+
* understands. Returned by {@link Machine.state_declaration}.
|
|
184
|
+
*/
|
|
78
185
|
declare type JssmStateDeclaration = {
|
|
79
186
|
declarations: Array<JssmStateDeclarationRule>;
|
|
80
187
|
shape?: JssmShape;
|
|
@@ -92,6 +199,11 @@ declare type JssmStateDeclaration = {
|
|
|
92
199
|
value: unknown;
|
|
93
200
|
};
|
|
94
201
|
};
|
|
202
|
+
/**
|
|
203
|
+
* A loosened version of {@link JssmStateDeclaration} where every field is
|
|
204
|
+
* optional. Used as the value type for theme entries and for default
|
|
205
|
+
* state configuration where most fields will be inherited or merged.
|
|
206
|
+
*/
|
|
95
207
|
declare type JssmStateConfig = Partial<JssmStateDeclaration>;
|
|
96
208
|
declare type JssmStateStyleShape = {
|
|
97
209
|
key: 'shape';
|
|
@@ -129,8 +241,31 @@ declare type JssmStateStyleImage = {
|
|
|
129
241
|
key: 'image';
|
|
130
242
|
value: string;
|
|
131
243
|
};
|
|
244
|
+
/**
|
|
245
|
+
* Tagged union of all individual style key/value pairs that may appear in
|
|
246
|
+
* a state's style configuration. The `key` discriminator selects which
|
|
247
|
+
* member, and the `value` is typed accordingly.
|
|
248
|
+
*/
|
|
132
249
|
declare type JssmStateStyleKey = JssmStateStyleShape | JssmStateStyleColor | JssmStateStyleTextColor | JssmStateStyleCorners | JssmStateStyleLineStyle | JssmStateStyleBackgroundColor | JssmStateStyleStateLabel | JssmStateStyleBorderColor | JssmStateStyleImage;
|
|
250
|
+
/**
|
|
251
|
+
* An ordered list of {@link JssmStateStyleKey} entries. Used by the
|
|
252
|
+
* `default_*_state_config` machine config options to provide a fallback
|
|
253
|
+
* style stack.
|
|
254
|
+
*/
|
|
133
255
|
declare type JssmStateStyleKeyList = JssmStateStyleKey[];
|
|
256
|
+
/**
|
|
257
|
+
* Full configuration object accepted by the {@link Machine} constructor and
|
|
258
|
+
* by {@link from}. Carries the transition list and the optional knobs
|
|
259
|
+
* governing layout, theming, history, start/end states, property
|
|
260
|
+
* definitions, machine metadata (author, license, version, ...) and the
|
|
261
|
+
* runtime hook surfaces (`time_source`, `timeout_source`, ...).
|
|
262
|
+
*
|
|
263
|
+
* Most users never construct one of these directly — the `sm` tagged
|
|
264
|
+
* template literal and {@link from} produce one from FSL source.
|
|
265
|
+
*
|
|
266
|
+
* @typeParam StateType - The state-name type (usually `string`).
|
|
267
|
+
* @typeParam DataType - The user-supplied data payload type (`mDT`).
|
|
268
|
+
*/
|
|
134
269
|
declare type JssmGenericConfig<StateType, DataType> = {
|
|
135
270
|
graph_layout?: JssmLayout;
|
|
136
271
|
complete?: Array<StateType>;
|
|
@@ -183,6 +318,15 @@ declare type JssmGenericConfig<StateType, DataType> = {
|
|
|
183
318
|
timeout_source?: (Function: any, number: any) => number;
|
|
184
319
|
clear_timeout_source?: (number: any) => void;
|
|
185
320
|
};
|
|
321
|
+
/**
|
|
322
|
+
* Internal compiler intermediate: one link in a chained transition
|
|
323
|
+
* expression (an "s-expression" segment). Carries both directions of an
|
|
324
|
+
* arrow with optional per-direction action labels, probabilities, and
|
|
325
|
+
* after-times. The recursive `se` field allows the parser to chain
|
|
326
|
+
* arrows of the form `A -> B -> C`. Not intended for end-user code.
|
|
327
|
+
*
|
|
328
|
+
* @internal
|
|
329
|
+
*/
|
|
186
330
|
declare type JssmCompileSe<StateType, mDT> = {
|
|
187
331
|
to: StateType;
|
|
188
332
|
se?: JssmCompileSe<StateType, mDT>;
|
|
@@ -194,6 +338,15 @@ declare type JssmCompileSe<StateType, mDT> = {
|
|
|
194
338
|
l_after?: number;
|
|
195
339
|
r_after?: number;
|
|
196
340
|
};
|
|
341
|
+
/**
|
|
342
|
+
* Internal compiler intermediate: the root of a chained transition
|
|
343
|
+
* expression, anchored at a `from` state. Also doubles as the carrier
|
|
344
|
+
* for non-transition rules (state declarations, property definitions,
|
|
345
|
+
* machine metadata) via its `key`/`value`/`name`/`state` fields. Not
|
|
346
|
+
* intended for end-user code.
|
|
347
|
+
*
|
|
348
|
+
* @internal
|
|
349
|
+
*/
|
|
197
350
|
declare type JssmCompileSeStart<StateType, DataType> = {
|
|
198
351
|
from: StateType;
|
|
199
352
|
se: JssmCompileSe<StateType, DataType>;
|
|
@@ -204,6 +357,13 @@ declare type JssmCompileSeStart<StateType, DataType> = {
|
|
|
204
357
|
default_value?: any;
|
|
205
358
|
required?: boolean;
|
|
206
359
|
};
|
|
360
|
+
/**
|
|
361
|
+
* The output shape of the FSL parser: a flat array of
|
|
362
|
+
* {@link JssmCompileSeStart} entries, one per top-level rule in the
|
|
363
|
+
* source. Consumed by the compiler to build a machine configuration.
|
|
364
|
+
*
|
|
365
|
+
* @internal
|
|
366
|
+
*/
|
|
207
367
|
declare type JssmParseTree<StateType, mDT> = Array<JssmCompileSeStart<StateType, mDT>>;
|
|
208
368
|
declare type BasicHookDescription<mDT> = {
|
|
209
369
|
kind: 'hook';
|
|
@@ -322,26 +482,100 @@ declare type PostEverythingHook<mDT> = {
|
|
|
322
482
|
kind: 'post everything';
|
|
323
483
|
handler: PostEverythingHookHandler<mDT>;
|
|
324
484
|
};
|
|
485
|
+
/**
|
|
486
|
+
* Discriminated union of every kind of hook registration jssm understands,
|
|
487
|
+
* pre-transition and post-transition. The `kind` field selects the
|
|
488
|
+
* variant; remaining fields describe which transitions / states / actions
|
|
489
|
+
* the hook is bound to and supply the {@link HookHandler} or
|
|
490
|
+
* {@link PostHookHandler} to invoke.
|
|
491
|
+
*
|
|
492
|
+
* Pre-transition variants (`'hook'`, `'named'`, `'standard transition'`,
|
|
493
|
+
* `'main transition'`, `'forced transition'`, `'any transition'`,
|
|
494
|
+
* `'global action'`, `'any action'`, `'entry'`, `'exit'`, `'after'`)
|
|
495
|
+
* may return a falsy value to veto a transition. Post-transition
|
|
496
|
+
* variants (`'post *'`) cannot veto and are invoked only after a
|
|
497
|
+
* successful transition.
|
|
498
|
+
*/
|
|
325
499
|
declare 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>;
|
|
500
|
+
/**
|
|
501
|
+
* Richer hook return value used when a hook needs to do more than just
|
|
502
|
+
* accept or veto a transition. `pass` is the required accept/veto flag
|
|
503
|
+
* (kept non-optional so that returning a stray object doesn't accidentally
|
|
504
|
+
* veto everything). The optional `state` overrides the destination state,
|
|
505
|
+
* `data` overrides the data observed by other hooks in the same chain,
|
|
506
|
+
* and `next_data` overrides the data committed after the transition.
|
|
507
|
+
*/
|
|
326
508
|
declare type HookComplexResult<mDT> = {
|
|
327
509
|
pass: boolean;
|
|
328
510
|
state?: StateType$1;
|
|
329
511
|
data?: mDT;
|
|
330
512
|
next_data?: mDT;
|
|
331
513
|
};
|
|
332
|
-
|
|
514
|
+
/**
|
|
515
|
+
* Return value from a {@link HookHandler}. May be a plain boolean to
|
|
516
|
+
* accept (`true`/`undefined`/`void`) or veto (`false`) the transition, or
|
|
517
|
+
* a {@link HookComplexResult} that additionally rewrites the next state
|
|
518
|
+
* and/or the next data payload.
|
|
519
|
+
*/
|
|
520
|
+
declare type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>;
|
|
521
|
+
/**
|
|
522
|
+
* Context object passed to every {@link HookHandler}. `data` is the
|
|
523
|
+
* data payload as it stands before the transition, and `next_data` is
|
|
524
|
+
* the payload that will be committed if the transition is accepted —
|
|
525
|
+
* handlers may inspect or mutate the latter via a
|
|
526
|
+
* {@link HookComplexResult} return value.
|
|
527
|
+
*/
|
|
333
528
|
declare type HookContext<mDT> = {
|
|
334
529
|
data: mDT;
|
|
335
530
|
next_data: mDT;
|
|
336
531
|
};
|
|
532
|
+
/**
|
|
533
|
+
* Context object passed to "everything" hooks ({@link EverythingHookHandler}
|
|
534
|
+
* and {@link PostEverythingHookHandler}). Extends the usual
|
|
535
|
+
* {@link HookContext} with `hook_name`, which identifies which specific
|
|
536
|
+
* hook fired so a single handler can route on it.
|
|
537
|
+
*/
|
|
337
538
|
declare type EverythingHookContext<mDT> = HookContext<mDT> & {
|
|
338
539
|
hook_name: string;
|
|
339
540
|
};
|
|
541
|
+
/**
|
|
542
|
+
* Signature of a pre-transition hook handler. Receives the current and
|
|
543
|
+
* proposed-next data payloads via a {@link HookContext} and returns a
|
|
544
|
+
* {@link HookResult}: a falsy result vetoes the transition, a truthy
|
|
545
|
+
* result allows it, and a {@link HookComplexResult} can additionally
|
|
546
|
+
* rewrite the next state or next data.
|
|
547
|
+
*/
|
|
340
548
|
declare type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult<mDT>;
|
|
549
|
+
/**
|
|
550
|
+
* Signature of a post-transition hook handler. Invoked after a successful
|
|
551
|
+
* transition has been committed; the return value is ignored (the
|
|
552
|
+
* transition cannot be undone).
|
|
553
|
+
*/
|
|
341
554
|
declare type PostHookHandler<mDT> = (hook_context: HookContext<mDT>) => void;
|
|
555
|
+
/**
|
|
556
|
+
* Signature of an "everything" pre-transition hook handler. Like
|
|
557
|
+
* {@link HookHandler} but receives an {@link EverythingHookContext} so the
|
|
558
|
+
* handler can dispatch on `hook_name`.
|
|
559
|
+
*/
|
|
342
560
|
declare type EverythingHookHandler<mDT> = (hook_context: EverythingHookContext<mDT>) => HookResult<mDT>;
|
|
561
|
+
/**
|
|
562
|
+
* Signature of an "everything" post-transition hook handler. Like
|
|
563
|
+
* {@link PostHookHandler} but receives an {@link EverythingHookContext}.
|
|
564
|
+
* The return value is ignored.
|
|
565
|
+
*/
|
|
343
566
|
declare type PostEverythingHookHandler<mDT> = (hook_context: EverythingHookContext<mDT>) => void;
|
|
567
|
+
/**
|
|
568
|
+
* Bounded history of recently-visited states paired with the data payload
|
|
569
|
+
* observed in each. Backed by `circular_buffer_js`, so the oldest entry
|
|
570
|
+
* is dropped silently once the configured capacity is exceeded.
|
|
571
|
+
*/
|
|
344
572
|
declare type JssmHistory<mDT> = circular_buffer<[StateType$1, mDT]>;
|
|
573
|
+
/**
|
|
574
|
+
* Pluggable random-number-generator function shape. Must return a value
|
|
575
|
+
* in `[0, 1)` exactly as `Math.random` does. Supplied via the
|
|
576
|
+
* `rng_seed`-aware machine configuration so that stochastic models can be
|
|
577
|
+
* made reproducible.
|
|
578
|
+
*/
|
|
345
579
|
declare type JssmRng = () => number;
|
|
346
580
|
|
|
347
581
|
/*********
|
|
@@ -724,6 +958,11 @@ declare const EulerC = 0.5772156649015329;
|
|
|
724
958
|
*
|
|
725
959
|
*/
|
|
726
960
|
declare const gviz_shapes$1: string[];
|
|
961
|
+
/**
|
|
962
|
+
* Public alias for {@link gviz_shapes}. The list of node shapes supported
|
|
963
|
+
* by Graphviz that jssm-viz accepts in FSL `state ... : { shape: ... }`
|
|
964
|
+
* declarations.
|
|
965
|
+
*/
|
|
727
966
|
declare const shapes$1: string[];
|
|
728
967
|
/*******
|
|
729
968
|
*
|