jssm 5.85.8 → 5.85.9
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/CHANGELOG.md +18 -22
- package/README.md +2 -2
- package/dist/es6/jssm.d.ts +10 -131
- package/dist/es6/jssm.js +4 -355
- package/dist/es6/jssm_compiler.d.ts +135 -0
- package/dist/es6/jssm_compiler.js +363 -0
- package/dist/es6/jssm_types.d.ts +15 -15
- package/dist/es6/version.js +1 -1
- package/dist/jssm.es5.cjs.js +1 -1
- package/dist/jssm.es5.iife.js +1 -1
- package/jssm.d.ts +10 -131
- package/jssm_compiler.d.ts +135 -0
- package/jssm_types.d.ts +15 -15
- package/package.json +1 -1
package/jssm.d.ts
CHANGED
|
@@ -1,133 +1,12 @@
|
|
|
1
1
|
declare type StateType = string;
|
|
2
2
|
import { JssmGenericState, JssmGenericConfig, JssmStateConfig, JssmTransition, JssmTransitionList, // JssmTransitionRule,
|
|
3
|
-
JssmMachineInternalState,
|
|
3
|
+
JssmMachineInternalState, JssmStateDeclaration, JssmStateStyleKeyList, JssmLayout, JssmHistory, JssmSerialization, FslDirection, FslDirections, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types';
|
|
4
4
|
import { arrow_direction, arrow_left_kind, arrow_right_kind } from './jssm_arrow';
|
|
5
|
+
import { compile, make, wrap_parse } from './jssm_compiler';
|
|
5
6
|
import { seq, unique, find_repeated, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util';
|
|
6
7
|
import * as constants from './jssm_constants';
|
|
7
8
|
declare const shapes: string[], gviz_shapes: string[], named_colors: string[];
|
|
8
9
|
import { version, build_time } from './version';
|
|
9
|
-
/*********
|
|
10
|
-
*
|
|
11
|
-
* This method wraps the parser call that comes from the peg grammar,
|
|
12
|
-
* {@link parse}. Generally neither this nor that should be used directly
|
|
13
|
-
* unless you mean to develop plugins or extensions for the machine.
|
|
14
|
-
*
|
|
15
|
-
* Parses the intermediate representation of a compiled string down to a
|
|
16
|
-
* machine configuration object. If you're using this (probably don't,) you're
|
|
17
|
-
* probably also using {@link compile} and {@link Machine.constructor}.
|
|
18
|
-
*
|
|
19
|
-
* ```typescript
|
|
20
|
-
* import { parse, compile, Machine } from 'jssm';
|
|
21
|
-
*
|
|
22
|
-
* const intermediate = wrap_parse('a -> b;', {});
|
|
23
|
-
* // [ {key:'transition', from:'a', se:{kind:'->',to:'b'}} ]
|
|
24
|
-
*
|
|
25
|
-
* const cfg = compile(intermediate);
|
|
26
|
-
* // { start_states:['a'], transitions: [{ from:'a', to:'b', kind:'legal', forced_only:false, main_path:false }] }
|
|
27
|
-
*
|
|
28
|
-
* const machine = new Machine(cfg);
|
|
29
|
-
* // Machine { _instance_name: undefined, _state: 'a', ...
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* This method is mostly for plugin and intermediate tool authors, or people
|
|
33
|
-
* who need to work with the machine's intermediate representation.
|
|
34
|
-
*
|
|
35
|
-
* # Hey!
|
|
36
|
-
*
|
|
37
|
-
* Most people looking at this want either the `sm` operator or method `from`,
|
|
38
|
-
* which perform all the steps in the chain. The library's author mostly uses
|
|
39
|
-
* operator `sm`, and mostly falls back to `.from` when needing to parse
|
|
40
|
-
* strings dynamically instead of from template literals.
|
|
41
|
-
*
|
|
42
|
-
* Operator {@link sm}:
|
|
43
|
-
*
|
|
44
|
-
* ```typescript
|
|
45
|
-
* import { sm } from 'jssm';
|
|
46
|
-
*
|
|
47
|
-
* const lswitch = sm`on <=> off;`;
|
|
48
|
-
* ```
|
|
49
|
-
*
|
|
50
|
-
* Method {@link from}:
|
|
51
|
-
*
|
|
52
|
-
* ```typescript
|
|
53
|
-
* import * as jssm from 'jssm';
|
|
54
|
-
*
|
|
55
|
-
* const toggle = jssm.from('up <=> down;');
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* `wrap_parse` itself is an internal convenience method for alting out an
|
|
59
|
-
* object as the options call. Not generally meant for external use.
|
|
60
|
-
*
|
|
61
|
-
* @param input The FSL code to be evaluated
|
|
62
|
-
*
|
|
63
|
-
* @param options Things to control about the instance
|
|
64
|
-
*
|
|
65
|
-
*/
|
|
66
|
-
declare function wrap_parse(input: string, options?: Object): any;
|
|
67
|
-
/*********
|
|
68
|
-
*
|
|
69
|
-
* Compile a machine's JSON intermediate representation to a config object. If
|
|
70
|
-
* you're using this (probably don't,) you're probably also using
|
|
71
|
-
* {@link parse} to get the IR, and the object constructor
|
|
72
|
-
* {@link Machine.construct} to turn the config object into a workable machine.
|
|
73
|
-
*
|
|
74
|
-
* ```typescript
|
|
75
|
-
* import { parse, compile, Machine } from 'jssm';
|
|
76
|
-
*
|
|
77
|
-
* const intermediate = parse('a -> b;');
|
|
78
|
-
* // [ {key:'transition', from:'a', se:{kind:'->',to:'b'}} ]
|
|
79
|
-
*
|
|
80
|
-
* const cfg = compile(intermediate);
|
|
81
|
-
* // { start_states:['a'], transitions: [{ from:'a', to:'b', kind:'legal', forced_only:false, main_path:false }] }
|
|
82
|
-
*
|
|
83
|
-
* const machine = new Machine(cfg);
|
|
84
|
-
* // Machine { _instance_name: undefined, _state: 'a', ...
|
|
85
|
-
* ```
|
|
86
|
-
*
|
|
87
|
-
* This method is mostly for plugin and intermediate tool authors, or people
|
|
88
|
-
* who need to work with the machine's intermediate representation.
|
|
89
|
-
*
|
|
90
|
-
* # Hey!
|
|
91
|
-
*
|
|
92
|
-
* Most people looking at this want either the `sm` operator or method `from`,
|
|
93
|
-
* which perform all the steps in the chain. The library's author mostly uses
|
|
94
|
-
* operator `sm`, and mostly falls back to `.from` when needing to parse
|
|
95
|
-
* strings dynamically instead of from template literals.
|
|
96
|
-
*
|
|
97
|
-
* Operator {@link sm}:
|
|
98
|
-
*
|
|
99
|
-
* ```typescript
|
|
100
|
-
* import { sm } from 'jssm';
|
|
101
|
-
*
|
|
102
|
-
* const lswitch = sm`on <=> off;`;
|
|
103
|
-
* ```
|
|
104
|
-
*
|
|
105
|
-
* Method {@link from}:
|
|
106
|
-
*
|
|
107
|
-
* ```typescript
|
|
108
|
-
* import * as jssm from 'jssm';
|
|
109
|
-
*
|
|
110
|
-
* const toggle = jssm.from('up <=> down;');
|
|
111
|
-
* ```
|
|
112
|
-
*
|
|
113
|
-
* @typeparam mDT The type of the machine data member; usually omitted
|
|
114
|
-
*
|
|
115
|
-
* @param tree The parse tree to be boiled down into a machine config
|
|
116
|
-
*
|
|
117
|
-
*/
|
|
118
|
-
declare function compile<mDT>(tree: JssmParseTree): JssmGenericConfig<mDT>;
|
|
119
|
-
/*********
|
|
120
|
-
*
|
|
121
|
-
* An internal convenience wrapper for parsing then compiling a machine string.
|
|
122
|
-
* Not generally meant for external use. Please see {@link compile} or
|
|
123
|
-
* {@link sm}.
|
|
124
|
-
*
|
|
125
|
-
* @typeparam mDT The type of the machine data member; usually omitted
|
|
126
|
-
*
|
|
127
|
-
* @param plan The FSL code to be evaluated and built into a machine config
|
|
128
|
-
*
|
|
129
|
-
*/
|
|
130
|
-
declare function make<mDT>(plan: string): JssmGenericConfig<mDT>;
|
|
131
10
|
/*********
|
|
132
11
|
*
|
|
133
12
|
* An internal method meant to take a series of declarations and fold them into
|
|
@@ -142,7 +21,7 @@ declare function state_style_condense(jssk: JssmStateStyleKeyList): JssmStateCon
|
|
|
142
21
|
declare class Machine<mDT> {
|
|
143
22
|
_state: StateType;
|
|
144
23
|
_states: Map<StateType, JssmGenericState>;
|
|
145
|
-
_edges: Array<JssmTransition<mDT>>;
|
|
24
|
+
_edges: Array<JssmTransition<StateType, mDT>>;
|
|
146
25
|
_edge_map: Map<StateType, Map<StateType, number>>;
|
|
147
26
|
_named_transitions: Map<StateType, number>;
|
|
148
27
|
_actions: Map<StateType, Map<StateType, number>>;
|
|
@@ -217,7 +96,7 @@ declare class Machine<mDT> {
|
|
|
217
96
|
_start_state_style: JssmStateConfig;
|
|
218
97
|
_end_state_style: JssmStateConfig;
|
|
219
98
|
_state_labels: Map<string, string>;
|
|
220
|
-
constructor({ start_states, end_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, property_definition, state_property, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name, history, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config }: JssmGenericConfig<mDT>);
|
|
99
|
+
constructor({ start_states, end_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, property_definition, state_property, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name, history, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config }: JssmGenericConfig<StateType, mDT>);
|
|
221
100
|
/********
|
|
222
101
|
*
|
|
223
102
|
* Internal method for fabricating states. Not meant for external use.
|
|
@@ -598,7 +477,7 @@ declare class Machine<mDT> {
|
|
|
598
477
|
* @typeparam mDT The type of the machine data member; usually omitted
|
|
599
478
|
*
|
|
600
479
|
*/
|
|
601
|
-
list_edges(): Array<JssmTransition<mDT>>;
|
|
480
|
+
list_edges(): Array<JssmTransition<StateType, mDT>>;
|
|
602
481
|
list_named_transitions(): Map<StateType, number>;
|
|
603
482
|
list_actions(): Array<StateType>;
|
|
604
483
|
get uses_actions(): boolean;
|
|
@@ -607,7 +486,7 @@ declare class Machine<mDT> {
|
|
|
607
486
|
set themes(to: FslTheme | FslTheme[]);
|
|
608
487
|
flow(): FslDirection;
|
|
609
488
|
get_transition_by_state_names(from: StateType, to: StateType): number;
|
|
610
|
-
lookup_transition_for(from: StateType, to: StateType): JssmTransition<mDT>;
|
|
489
|
+
lookup_transition_for(from: StateType, to: StateType): JssmTransition<StateType, mDT>;
|
|
611
490
|
/********
|
|
612
491
|
*
|
|
613
492
|
* List all transitions attached to the current state, sorted by entrance and
|
|
@@ -669,7 +548,7 @@ declare class Machine<mDT> {
|
|
|
669
548
|
*
|
|
670
549
|
*/
|
|
671
550
|
list_exits(whichState?: StateType): Array<StateType>;
|
|
672
|
-
probable_exits_for(whichState: StateType): Array<JssmTransition<mDT>>;
|
|
551
|
+
probable_exits_for(whichState: StateType): Array<JssmTransition<StateType, mDT>>;
|
|
673
552
|
probabilistic_transition(): boolean;
|
|
674
553
|
probabilistic_walk(n: number): Array<StateType>;
|
|
675
554
|
probabilistic_histo_walk(n: number): Map<StateType, number>;
|
|
@@ -762,7 +641,7 @@ declare class Machine<mDT> {
|
|
|
762
641
|
post_hook_any_transition(handler: HookHandler<mDT>): Machine<mDT>;
|
|
763
642
|
post_hook_entry(to: string, handler: HookHandler<mDT>): Machine<mDT>;
|
|
764
643
|
post_hook_exit(from: string, handler: HookHandler<mDT>): Machine<mDT>;
|
|
765
|
-
edges_between(from: string, to: string): JssmTransition<mDT>[];
|
|
644
|
+
edges_between(from: string, to: string): JssmTransition<StateType, mDT>[];
|
|
766
645
|
transition_impl(newStateOrAction: StateType, newData: mDT | undefined, wasForced: boolean, wasAction: boolean): boolean;
|
|
767
646
|
/*********
|
|
768
647
|
*
|
|
@@ -1130,7 +1009,7 @@ declare class Machine<mDT> {
|
|
|
1130
1009
|
*/
|
|
1131
1010
|
force_transition(newState: StateType, newData?: mDT): boolean;
|
|
1132
1011
|
current_action_for(action: StateType): number;
|
|
1133
|
-
current_action_edge_for(action: StateType): JssmTransition<mDT>;
|
|
1012
|
+
current_action_edge_for(action: StateType): JssmTransition<StateType, mDT>;
|
|
1134
1013
|
valid_action(action: StateType, _newData?: mDT): boolean;
|
|
1135
1014
|
valid_transition(newState: StateType, _newData?: mDT): boolean;
|
|
1136
1015
|
valid_force_transition(newState: StateType, _newData?: mDT): boolean;
|
|
@@ -1183,7 +1062,7 @@ declare function sm<mDT>(template_strings: TemplateStringsArray, ...remainder: a
|
|
|
1183
1062
|
* @param ExtraConstructorFields Extra non-code configuration to pass at creation time
|
|
1184
1063
|
*
|
|
1185
1064
|
*/
|
|
1186
|
-
declare function from<mDT>(MachineAsString: string, ExtraConstructorFields?: Partial<JssmGenericConfig<mDT>> | undefined): Machine<mDT>;
|
|
1065
|
+
declare function from<mDT>(MachineAsString: string, ExtraConstructorFields?: Partial<JssmGenericConfig<StateType, mDT>> | undefined): Machine<mDT>;
|
|
1187
1066
|
declare function is_hook_complex_result<mDT>(hr: unknown): hr is HookComplexResult<mDT>;
|
|
1188
1067
|
declare function is_hook_rejection<mDT>(hr: HookResult<mDT>): boolean;
|
|
1189
1068
|
declare function abstract_hook_step<mDT>(maybe_hook: HookHandler<mDT> | undefined, hook_args: HookContext<mDT>): HookComplexResult<mDT>;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { JssmTransition, JssmCompileSe, JssmParseTree, JssmGenericConfig } from './jssm_types';
|
|
2
|
+
/*********
|
|
3
|
+
*
|
|
4
|
+
* Internal method meant to perform factory assembly of an edge. Not meant for
|
|
5
|
+
* external use.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*
|
|
9
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
declare function makeTransition<StateType, mDT>(this_se: JssmCompileSe<StateType, mDT>, from: StateType, to: StateType, isRight: boolean, _wasList?: Array<StateType>, _wasIndex?: number): JssmTransition<StateType, mDT>;
|
|
13
|
+
/*********
|
|
14
|
+
*
|
|
15
|
+
* This method wraps the parser call that comes from the peg grammar,
|
|
16
|
+
* {@link parse}. Generally neither this nor that should be used directly
|
|
17
|
+
* unless you mean to develop plugins or extensions for the machine.
|
|
18
|
+
*
|
|
19
|
+
* Parses the intermediate representation of a compiled string down to a
|
|
20
|
+
* machine configuration object. If you're using this (probably don't,) you're
|
|
21
|
+
* probably also using {@link compile} and {@link Machine.constructor}.
|
|
22
|
+
*
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { parse, compile, Machine } from 'jssm';
|
|
25
|
+
*
|
|
26
|
+
* const intermediate = wrap_parse('a -> b;', {});
|
|
27
|
+
* // [ {key:'transition', from:'a', se:{kind:'->',to:'b'}} ]
|
|
28
|
+
*
|
|
29
|
+
* const cfg = compile(intermediate);
|
|
30
|
+
* // { start_states:['a'], transitions: [{ from:'a', to:'b', kind:'legal', forced_only:false, main_path:false }] }
|
|
31
|
+
*
|
|
32
|
+
* const machine = new Machine(cfg);
|
|
33
|
+
* // Machine { _instance_name: undefined, _state: 'a', ...
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* This method is mostly for plugin and intermediate tool authors, or people
|
|
37
|
+
* who need to work with the machine's intermediate representation.
|
|
38
|
+
*
|
|
39
|
+
* # Hey!
|
|
40
|
+
*
|
|
41
|
+
* Most people looking at this want either the `sm` operator or method `from`,
|
|
42
|
+
* which perform all the steps in the chain. The library's author mostly uses
|
|
43
|
+
* operator `sm`, and mostly falls back to `.from` when needing to parse
|
|
44
|
+
* strings dynamically instead of from template literals.
|
|
45
|
+
*
|
|
46
|
+
* Operator {@link sm}:
|
|
47
|
+
*
|
|
48
|
+
* ```typescript
|
|
49
|
+
* import { sm } from 'jssm';
|
|
50
|
+
*
|
|
51
|
+
* const lswitch = sm`on <=> off;`;
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* Method {@link from}:
|
|
55
|
+
*
|
|
56
|
+
* ```typescript
|
|
57
|
+
* import * as jssm from 'jssm';
|
|
58
|
+
*
|
|
59
|
+
* const toggle = jssm.from('up <=> down;');
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* `wrap_parse` itself is an internal convenience method for alting out an
|
|
63
|
+
* object as the options call. Not generally meant for external use.
|
|
64
|
+
*
|
|
65
|
+
* @param input The FSL code to be evaluated
|
|
66
|
+
*
|
|
67
|
+
* @param options Things to control about the instance
|
|
68
|
+
*
|
|
69
|
+
*/
|
|
70
|
+
declare function wrap_parse(input: string, options?: Object): any;
|
|
71
|
+
/*********
|
|
72
|
+
*
|
|
73
|
+
* Compile a machine's JSON intermediate representation to a config object. If
|
|
74
|
+
* you're using this (probably don't,) you're probably also using
|
|
75
|
+
* {@link parse} to get the IR, and the object constructor
|
|
76
|
+
* {@link Machine.construct} to turn the config object into a workable machine.
|
|
77
|
+
*
|
|
78
|
+
* ```typescript
|
|
79
|
+
* import { parse, compile, Machine } from 'jssm';
|
|
80
|
+
*
|
|
81
|
+
* const intermediate = parse('a -> b;');
|
|
82
|
+
* // [ {key:'transition', from:'a', se:{kind:'->',to:'b'}} ]
|
|
83
|
+
*
|
|
84
|
+
* const cfg = compile(intermediate);
|
|
85
|
+
* // { start_states:['a'], transitions: [{ from:'a', to:'b', kind:'legal', forced_only:false, main_path:false }] }
|
|
86
|
+
*
|
|
87
|
+
* const machine = new Machine(cfg);
|
|
88
|
+
* // Machine { _instance_name: undefined, _state: 'a', ...
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* This method is mostly for plugin and intermediate tool authors, or people
|
|
92
|
+
* who need to work with the machine's intermediate representation.
|
|
93
|
+
*
|
|
94
|
+
* # Hey!
|
|
95
|
+
*
|
|
96
|
+
* Most people looking at this want either the `sm` operator or method `from`,
|
|
97
|
+
* which perform all the steps in the chain. The library's author mostly uses
|
|
98
|
+
* operator `sm`, and mostly falls back to `.from` when needing to parse
|
|
99
|
+
* strings dynamically instead of from template literals.
|
|
100
|
+
*
|
|
101
|
+
* Operator {@link sm}:
|
|
102
|
+
*
|
|
103
|
+
* ```typescript
|
|
104
|
+
* import { sm } from 'jssm';
|
|
105
|
+
*
|
|
106
|
+
* const lswitch = sm`on <=> off;`;
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* Method {@link from}:
|
|
110
|
+
*
|
|
111
|
+
* ```typescript
|
|
112
|
+
* import * as jssm from 'jssm';
|
|
113
|
+
*
|
|
114
|
+
* const toggle = jssm.from('up <=> down;');
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
118
|
+
*
|
|
119
|
+
* @param tree The parse tree to be boiled down into a machine config
|
|
120
|
+
*
|
|
121
|
+
*/
|
|
122
|
+
declare function compile<StateType, mDT>(tree: JssmParseTree<StateType, mDT>): JssmGenericConfig<StateType, mDT>;
|
|
123
|
+
/*********
|
|
124
|
+
*
|
|
125
|
+
* An internal convenience wrapper for parsing then compiling a machine string.
|
|
126
|
+
* Not generally meant for external use. Please see {@link compile} or
|
|
127
|
+
* {@link sm}.
|
|
128
|
+
*
|
|
129
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
130
|
+
*
|
|
131
|
+
* @param plan The FSL code to be evaluated and built into a machine config
|
|
132
|
+
*
|
|
133
|
+
*/
|
|
134
|
+
declare function make<StateType, mDT>(plan: string): JssmGenericConfig<StateType, mDT>;
|
|
135
|
+
export { compile, make, makeTransition, wrap_parse };
|
package/jssm_types.d.ts
CHANGED
|
@@ -44,10 +44,10 @@ declare type JssmPropertyDefinition = {
|
|
|
44
44
|
};
|
|
45
45
|
declare type JssmTransitionPermitter<DataType> = (OldState: StateType, NewState: StateType, OldData: DataType, NewData: DataType) => boolean;
|
|
46
46
|
declare type JssmTransitionPermitterMaybeArray<DataType> = JssmTransitionPermitter<DataType> | Array<JssmTransitionPermitter<DataType>>;
|
|
47
|
-
declare type JssmTransition<DataType> = {
|
|
47
|
+
declare type JssmTransition<StateType, DataType> = {
|
|
48
48
|
from: StateType;
|
|
49
49
|
to: StateType;
|
|
50
|
-
name?:
|
|
50
|
+
name?: StateType;
|
|
51
51
|
action?: StateType;
|
|
52
52
|
check?: JssmTransitionPermitterMaybeArray<DataType>;
|
|
53
53
|
probability?: number;
|
|
@@ -55,7 +55,7 @@ declare type JssmTransition<DataType> = {
|
|
|
55
55
|
forced_only: boolean;
|
|
56
56
|
main_path: boolean;
|
|
57
57
|
};
|
|
58
|
-
declare type JssmTransitions<DataType> = JssmTransition<DataType>[];
|
|
58
|
+
declare type JssmTransitions<StateType, DataType> = JssmTransition<StateType, DataType>[];
|
|
59
59
|
declare type JssmTransitionList = {
|
|
60
60
|
entrances: Array<StateType>;
|
|
61
61
|
exits: Array<StateType>;
|
|
@@ -79,7 +79,7 @@ declare type JssmMachineInternalState<DataType> = {
|
|
|
79
79
|
edge_map: Map<StateType, Map<StateType, number>>;
|
|
80
80
|
actions: Map<StateType, Map<StateType, number>>;
|
|
81
81
|
reverse_actions: Map<StateType, Map<StateType, number>>;
|
|
82
|
-
edges: Array<JssmTransition<DataType>>;
|
|
82
|
+
edges: Array<JssmTransition<StateType, DataType>>;
|
|
83
83
|
};
|
|
84
84
|
declare type JssmStatePermitter<DataType> = (OldState: StateType, NewState: StateType, OldData: DataType, NewData: DataType) => boolean;
|
|
85
85
|
declare type JssmStatePermitterMaybeArray<DataType> = JssmStatePermitter<DataType> | Array<JssmStatePermitter<DataType>>;
|
|
@@ -88,7 +88,7 @@ declare type JssmGenericMachine<DataType> = {
|
|
|
88
88
|
state: StateType;
|
|
89
89
|
data?: DataType;
|
|
90
90
|
nodes?: Array<StateType>;
|
|
91
|
-
transitions: JssmTransitions<DataType>;
|
|
91
|
+
transitions: JssmTransitions<StateType, DataType>;
|
|
92
92
|
check?: JssmStatePermitterMaybeArray<DataType>;
|
|
93
93
|
min_transitions?: number;
|
|
94
94
|
max_transitions?: number;
|
|
@@ -173,10 +173,10 @@ declare type JssmBaseTheme = {
|
|
|
173
173
|
title: undefined;
|
|
174
174
|
};
|
|
175
175
|
declare type JssmTheme = Partial<JssmBaseTheme>;
|
|
176
|
-
declare type JssmGenericConfig<DataType> = {
|
|
176
|
+
declare type JssmGenericConfig<StateType, DataType> = {
|
|
177
177
|
graph_layout?: JssmLayout;
|
|
178
178
|
complete?: Array<StateType>;
|
|
179
|
-
transitions: JssmTransitions<DataType>;
|
|
179
|
+
transitions: JssmTransitions<StateType, DataType>;
|
|
180
180
|
theme?: FslTheme[];
|
|
181
181
|
flow?: FslDirection;
|
|
182
182
|
name?: string;
|
|
@@ -217,22 +217,22 @@ declare type JssmGenericConfig<DataType> = {
|
|
|
217
217
|
default_terminal_state_config?: JssmStateStyleKeyList;
|
|
218
218
|
default_active_state_config?: JssmStateStyleKeyList;
|
|
219
219
|
};
|
|
220
|
-
declare type JssmCompileRule = {
|
|
220
|
+
declare type JssmCompileRule<StateType> = {
|
|
221
221
|
agg_as: string;
|
|
222
222
|
val: any;
|
|
223
223
|
};
|
|
224
|
-
declare type JssmCompileSe = {
|
|
224
|
+
declare type JssmCompileSe<StateType, mDT> = {
|
|
225
225
|
to: StateType;
|
|
226
|
-
se: JssmCompileSe
|
|
226
|
+
se: JssmCompileSe<StateType, mDT>;
|
|
227
227
|
kind: JssmArrow;
|
|
228
228
|
l_action?: StateType;
|
|
229
229
|
r_action?: StateType;
|
|
230
230
|
l_probability: number;
|
|
231
231
|
r_probability: number;
|
|
232
232
|
};
|
|
233
|
-
declare type JssmCompileSeStart<DataType> = {
|
|
234
|
-
from:
|
|
235
|
-
se: JssmCompileSe
|
|
233
|
+
declare type JssmCompileSeStart<StateType, DataType> = {
|
|
234
|
+
from: StateType;
|
|
235
|
+
se: JssmCompileSe<StateType, DataType>;
|
|
236
236
|
key: string;
|
|
237
237
|
value?: string | number;
|
|
238
238
|
name?: string;
|
|
@@ -240,8 +240,8 @@ declare type JssmCompileSeStart<DataType> = {
|
|
|
240
240
|
default_value?: any;
|
|
241
241
|
required?: boolean;
|
|
242
242
|
};
|
|
243
|
-
declare type JssmParseTree = Array<JssmCompileSeStart<StateType>>;
|
|
244
|
-
declare type JssmParseFunctionType = (string: any) => JssmParseTree
|
|
243
|
+
declare type JssmParseTree<StateType, mDT> = Array<JssmCompileSeStart<StateType, mDT>>;
|
|
244
|
+
declare type JssmParseFunctionType<StateType, mDT> = (string: any) => JssmParseTree<StateType, mDT>;
|
|
245
245
|
declare type BasicHookDescription<mDT> = {
|
|
246
246
|
kind: 'hook';
|
|
247
247
|
from: string;
|