jssm 5.65.11 → 5.67.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/CHANGELOG.md +182 -0
- package/README.md +2 -0
- package/dist/es6/jssm.d.ts +164 -23
- package/dist/es6/jssm.js +178 -24
- 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 +164 -23
- package/package.json +8 -8
- package/typedoc-options.js +52 -0
package/CHANGELOG.md
CHANGED
|
@@ -1 +1,183 @@
|
|
|
1
|
+
# Changelog
|
|
1
2
|
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
874 merges; 70 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Published tags:
|
|
14
|
+
|
|
15
|
+
<a href="#5__65__14">5.65.14</a>, <a href="#5__65__12">5.65.12</a>, <a href="#5__65__11">5.65.11</a>, <a href="#5__65__10">5.65.10</a>, <a href="#5__65__9">5.65.9</a>, <a href="#5__65__8">5.65.8</a>, <a href="#5__65__7">5.65.7</a>, <a href="#5__65__5">5.65.5</a>, <a href="#5__65__4">5.65.4</a>, <a href="#5__65__3">5.65.3</a>, <a href="#5__65__2">5.65.2</a>, <a href="#5__65__1">5.65.1</a>, <a href="#5__65__0">5.65.0</a>, <a href="#5__64__2">5.64.2</a>, <a href="#5__64__1">5.64.1</a>, <a href="#5__64__0">5.64.0</a>, <a href="#5__63__0">5.63.0</a>, <a href="#5__62__0">5.62.0</a>, <a href="#5__61__4">5.61.4</a>, <a href="#5__61__3">5.61.3</a>, <a href="#5__61__2">5.61.2</a>, <a href="#5__61__1">5.61.1</a>, <a href="#5__60__4">5.60.4</a>, <a href="#5__60__3">5.60.3</a>, <a href="#5__60__0">5.60.0</a>, <a href="#5__59__1">5.59.1</a>, <a href="#5__59__0">5.59.0</a>, <a href="#5__58__1">5.58.1</a>, <a href="#5__58__0">5.58.0</a>, <a href="#5__57__1">5.57.1</a>, <a href="#5__57__0">5.57.0</a>, <a href="#5__56__2">5.56.2</a>, <a href="#5__56__1">5.56.1</a>, <a href="#5__55__0">5.55.0</a>, <a href="#5__54__0">5.54.0</a>, <a href="#5__53__0">5.53.0</a>, <a href="#5__52__0">5.52.0</a>, <a href="#5__51__0">5.51.0</a>, <a href="#5__50__0">5.50.0</a>, <a href="#5__49__0">5.49.0</a>, <a href="#5__48__0">5.48.0</a>, <a href="#5__47__0">5.47.0</a>, <a href="#5__46__0">5.46.0</a>, <a href="#5__45__2">5.45.2</a>, <a href="#5__45__0">5.45.0</a>, <a href="#5__44__0">5.44.0</a>, <a href="#5__43__2">5.43.2</a>, <a href="#v5__42__0">v5.42.0</a>, <a href="#5__42__0">5.42.0</a>, <a href="#v5__41__15">v5.41.15</a>, <a href="#5__41__15">5.41.15</a>, <a href="#v5__41__14">v5.41.14</a>, <a href="#5__41__14">5.41.14</a>, <a href="#v5__41__12">v5.41.12</a>, <a href="#5__41__12">5.41.12</a>, <a href="#v5__41__10">v5.41.10</a>, <a href="#5__41__10">5.41.10</a>, <a href="#v5__41__9">v5.41.9</a>, <a href="#5__41__9">5.41.9</a>, <a href="#v5__41__8">v5.41.8</a>, <a href="#5__41__8">5.41.8</a>, <a href="#v5__41__7">v5.41.7</a>, <a href="#v5__41__2">v5.41.2</a>, <a href="#v5__41__1">v5.41.1</a>, <a href="#v5__32__14">v5.32.14</a>, <a href="#5__14__0">5.14.0</a>, <a href="#5__12__0">5.12.0</a>, <a href="#5__11__12">5.11.12</a>, <a href="#5__11__1">5.11.1</a>, <a href="#5__11__0">5.11.0</a>
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [Untagged] - 6/6/2022 12:24:27 PM
|
|
26
|
+
|
|
27
|
+
Commit [6f51f095fc292fc44c8c02daf8d976bdec49d4f0](https://github.com/StoneCypher/jssm/commit/6f51f095fc292fc44c8c02daf8d976bdec49d4f0)
|
|
28
|
+
|
|
29
|
+
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
30
|
+
|
|
31
|
+
* Adds community page to docs; adds short changelog to address block. fixes StoneCypher/fsl#824, fixes StoneCypher/fsl#825
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## [Untagged] - 6/6/2022 11:20:01 AM
|
|
41
|
+
|
|
42
|
+
Commit [bcb1edaf59fbbd0a9fcfbb293d3ba1cfca129aa0](https://github.com/StoneCypher/jssm/commit/bcb1edaf59fbbd0a9fcfbb293d3ba1cfca129aa0)
|
|
43
|
+
|
|
44
|
+
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
45
|
+
|
|
46
|
+
Merges [d19a094, 966e56b]
|
|
47
|
+
|
|
48
|
+
* Merge branch 'main' of github.com:StoneCypher/jssm
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## [Untagged] - 6/6/2022 11:19:47 AM
|
|
58
|
+
|
|
59
|
+
Commit [d19a0949fdb44e76f946cf0f06020e9a497e8732](https://github.com/StoneCypher/jssm/commit/d19a0949fdb44e76f946cf0f06020e9a497e8732)
|
|
60
|
+
|
|
61
|
+
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
62
|
+
|
|
63
|
+
* Long and short changelogs to un-break GH releases
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
## [Untagged] - 6/2/2022 7:14:41 PM
|
|
73
|
+
|
|
74
|
+
Commit [966e56b5db15b792ee8efc648f76c279dd1c8b0c](https://github.com/StoneCypher/jssm/commit/966e56b5db15b792ee8efc648f76c279dd1c8b0c)
|
|
75
|
+
|
|
76
|
+
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
77
|
+
|
|
78
|
+
* Update README.md
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
<a name="5__65__14" />
|
|
88
|
+
|
|
89
|
+
## [5.65.14] - 5/25/2022 10:01:42 PM
|
|
90
|
+
|
|
91
|
+
Commit [1c597f900bb8daa127d1ec490f1277db0dfc822e](https://github.com/StoneCypher/jssm/commit/1c597f900bb8daa127d1ec490f1277db0dfc822e)
|
|
92
|
+
|
|
93
|
+
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
94
|
+
|
|
95
|
+
Merges [6a6f1c8, 4c2e830]
|
|
96
|
+
|
|
97
|
+
* Merge pull request #489 from StoneCypher/ImproveDocumentationLayout
|
|
98
|
+
* Improve documentation layout
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
## [Untagged] - 5/25/2022 9:57:42 PM
|
|
108
|
+
|
|
109
|
+
Commit [4c2e830a1a4cfc8f808a67a04cfb0efe7e6993c8](https://github.com/StoneCypher/jssm/commit/4c2e830a1a4cfc8f808a67a04cfb0efe7e6993c8)
|
|
110
|
+
|
|
111
|
+
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
112
|
+
|
|
113
|
+
* Needed version bump
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## [Untagged] - 5/25/2022 9:51:54 PM
|
|
123
|
+
|
|
124
|
+
Commit [6353caf50948fc5985e1603fc06673add48bc376](https://github.com/StoneCypher/jssm/commit/6353caf50948fc5985e1603fc06673add48bc376)
|
|
125
|
+
|
|
126
|
+
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
127
|
+
|
|
128
|
+
* moar dox
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
<a name="5__65__12" />
|
|
138
|
+
|
|
139
|
+
## [5.65.12] - 5/22/2022 4:28:55 PM
|
|
140
|
+
|
|
141
|
+
Commit [6a6f1c8a256f2f943c3230ec32dd32d2c2344927](https://github.com/StoneCypher/jssm/commit/6a6f1c8a256f2f943c3230ec32dd32d2c2344927)
|
|
142
|
+
|
|
143
|
+
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
144
|
+
|
|
145
|
+
Merges [e084bf4, f0f3961]
|
|
146
|
+
|
|
147
|
+
* Merge pull request #488 from StoneCypher/Doc_Action_Transition_ForceTransition
|
|
148
|
+
* Document action, transition, force_transition; fixes StoneCypher/fsl#801, StoneCypher/fsl#802, StoneCypher/fsl#803
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
## [Untagged] - 5/22/2022 4:24:24 PM
|
|
158
|
+
|
|
159
|
+
Commit [f0f3961d25dc11cfb547eca55c7e3a65b9cf3ccf](https://github.com/StoneCypher/jssm/commit/f0f3961d25dc11cfb547eca55c7e3a65b9cf3ccf)
|
|
160
|
+
|
|
161
|
+
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
162
|
+
|
|
163
|
+
* Document action, transition, force_transition; fixes StoneCypher/fsl#801, StoneCypher/fsl#802, StoneCypher/fsl#803
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
<a name="5__65__11" />
|
|
173
|
+
|
|
174
|
+
## [5.65.11] - 5/22/2022 3:54:12 PM
|
|
175
|
+
|
|
176
|
+
Commit [e084bf4a0936d419b5a9921e746a707644ad263f](https://github.com/StoneCypher/jssm/commit/e084bf4a0936d419b5a9921e746a707644ad263f)
|
|
177
|
+
|
|
178
|
+
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
179
|
+
|
|
180
|
+
Merges [a7d9fba, b2558b2]
|
|
181
|
+
|
|
182
|
+
* Merge pull request #487 from StoneCypher/Doc_ListEdges_ListTransitions_ListEntrances_ListExits
|
|
183
|
+
* Doc list edges list transitions list entrances list exits
|
package/README.md
CHANGED
|
@@ -1009,6 +1009,8 @@ If you'd like to help, it's straightforward.
|
|
|
1009
1009
|
|
|
1010
1010
|
## Code and Language
|
|
1011
1011
|
|
|
1012
|
+
[Vat Raghavan](https://github.com/MachinShin) has participated extensively in language discussion and implemented several features.
|
|
1013
|
+
|
|
1012
1014
|
[Forest Belton](https://github.com/forestbelton) has provided guidance, bugfixes, parser and language commentary.
|
|
1013
1015
|
|
|
1014
1016
|
[Jordan Harbrand](https://github.com/ljharb) suggested two interesting features and provided strong feedback on the initial tutorial draft.
|
package/dist/es6/jssm.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ import { version } from './version';
|
|
|
15
15
|
* arrow_direction('<~=>'); // 'both'
|
|
16
16
|
* ```
|
|
17
17
|
*
|
|
18
|
+
* @param arrow The arrow to be evaluated
|
|
19
|
+
*
|
|
18
20
|
*/
|
|
19
21
|
declare function arrow_direction(arrow: JssmArrow): JssmArrowDirection;
|
|
20
22
|
/*********
|
|
@@ -31,6 +33,8 @@ declare function arrow_direction(arrow: JssmArrow): JssmArrowDirection;
|
|
|
31
33
|
* arrow_left_kind('->'); // 'none'
|
|
32
34
|
* ```
|
|
33
35
|
*
|
|
36
|
+
* @param arrow The arrow to be evaluated
|
|
37
|
+
*
|
|
34
38
|
*/
|
|
35
39
|
declare function arrow_left_kind(arrow: JssmArrow): JssmArrowKind;
|
|
36
40
|
/*********
|
|
@@ -47,6 +51,8 @@ declare function arrow_left_kind(arrow: JssmArrow): JssmArrowKind;
|
|
|
47
51
|
* arrow_left_kind('<-'); // 'none'
|
|
48
52
|
* ```
|
|
49
53
|
*
|
|
54
|
+
* @param arrow The arrow to be evaluated
|
|
55
|
+
*
|
|
50
56
|
*/
|
|
51
57
|
declare function arrow_right_kind(arrow: JssmArrow): JssmArrowKind;
|
|
52
58
|
/*********
|
|
@@ -101,6 +107,10 @@ declare function arrow_right_kind(arrow: JssmArrow): JssmArrowKind;
|
|
|
101
107
|
* `wrap_parse` itself is an internal convenience method for alting out an
|
|
102
108
|
* object as the options call. Not generally meant for external use.
|
|
103
109
|
*
|
|
110
|
+
* @param input The FSL code to be evaluated
|
|
111
|
+
*
|
|
112
|
+
* @param options Things to control about the instance
|
|
113
|
+
*
|
|
104
114
|
*/
|
|
105
115
|
declare function wrap_parse(input: string, options?: Object): any;
|
|
106
116
|
/*********
|
|
@@ -149,6 +159,10 @@ declare function wrap_parse(input: string, options?: Object): any;
|
|
|
149
159
|
* const toggle = jssm.from('up <=> down;');
|
|
150
160
|
* ```
|
|
151
161
|
*
|
|
162
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
163
|
+
*
|
|
164
|
+
* @param tree The parse tree to be boiled down into a machine config
|
|
165
|
+
*
|
|
152
166
|
*/
|
|
153
167
|
declare function compile<mDT>(tree: JssmParseTree): JssmGenericConfig<mDT>;
|
|
154
168
|
/*********
|
|
@@ -157,6 +171,10 @@ declare function compile<mDT>(tree: JssmParseTree): JssmGenericConfig<mDT>;
|
|
|
157
171
|
* Not generally meant for external use. Please see {@link compile} or
|
|
158
172
|
* {@link sm}.
|
|
159
173
|
*
|
|
174
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
175
|
+
*
|
|
176
|
+
* @param plan The FSL code to be evaluated and built into a machine config
|
|
177
|
+
*
|
|
160
178
|
*/
|
|
161
179
|
declare function make<mDT>(plan: string): JssmGenericConfig<mDT>;
|
|
162
180
|
/*********
|
|
@@ -165,6 +183,8 @@ declare function make<mDT>(plan: string): JssmGenericConfig<mDT>;
|
|
|
165
183
|
* a single multi-faceted declaration, in the process of building a state. Not
|
|
166
184
|
* generally meant for external use.
|
|
167
185
|
*
|
|
186
|
+
* @internal
|
|
187
|
+
*
|
|
168
188
|
*/
|
|
169
189
|
declare function transfer_state_properties(state_decl: JssmStateDeclaration): JssmStateDeclaration;
|
|
170
190
|
declare class Machine<mDT> {
|
|
@@ -217,6 +237,8 @@ declare class Machine<mDT> {
|
|
|
217
237
|
*
|
|
218
238
|
* Internal method for fabricating states. Not meant for external use.
|
|
219
239
|
*
|
|
240
|
+
* @internal
|
|
241
|
+
*
|
|
220
242
|
*/
|
|
221
243
|
_new_state(state_config: JssmGenericState): StateType;
|
|
222
244
|
/*********
|
|
@@ -233,6 +255,8 @@ declare class Machine<mDT> {
|
|
|
233
255
|
* console.log( switch.state() ); // 'off'
|
|
234
256
|
* ```
|
|
235
257
|
*
|
|
258
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
259
|
+
*
|
|
236
260
|
*/
|
|
237
261
|
state(): StateType;
|
|
238
262
|
/********
|
|
@@ -249,6 +273,10 @@ declare class Machine<mDT> {
|
|
|
249
273
|
* console.log( final_test.state_is_final('second') ); // true
|
|
250
274
|
* ```
|
|
251
275
|
*
|
|
276
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
277
|
+
*
|
|
278
|
+
* @param whichState The name of the state to check for finality
|
|
279
|
+
*
|
|
252
280
|
*/
|
|
253
281
|
state_is_final(whichState: StateType): boolean;
|
|
254
282
|
/********
|
|
@@ -266,6 +294,8 @@ declare class Machine<mDT> {
|
|
|
266
294
|
* console.log( final_test.is_final() ); // true
|
|
267
295
|
* ```
|
|
268
296
|
*
|
|
297
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
298
|
+
*
|
|
269
299
|
*/
|
|
270
300
|
is_final(): boolean;
|
|
271
301
|
graph_layout(): string;
|
|
@@ -295,6 +325,8 @@ declare class Machine<mDT> {
|
|
|
295
325
|
* console.log( switch.states() ); // ['on', 'off']
|
|
296
326
|
* ```
|
|
297
327
|
*
|
|
328
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
329
|
+
*
|
|
298
330
|
*/
|
|
299
331
|
states(): Array<StateType>;
|
|
300
332
|
state_for(whichState: StateType): JssmGenericState;
|
|
@@ -311,6 +343,10 @@ declare class Machine<mDT> {
|
|
|
311
343
|
* console.log( switch.has_state('dance') ); // false
|
|
312
344
|
* ```
|
|
313
345
|
*
|
|
346
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
347
|
+
*
|
|
348
|
+
* @param whichState The state to be checked for extance
|
|
349
|
+
*
|
|
314
350
|
*/
|
|
315
351
|
has_state(whichState: StateType): boolean;
|
|
316
352
|
/*********
|
|
@@ -318,28 +354,32 @@ declare class Machine<mDT> {
|
|
|
318
354
|
* Lists all edges of a machine.
|
|
319
355
|
*
|
|
320
356
|
* ```typescript
|
|
357
|
+
* import { sm } from 'jssm';
|
|
358
|
+
*
|
|
321
359
|
* const lswitch = sm`on 'toggle' <=> 'toggle' off;`;
|
|
322
360
|
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
361
|
+
* lswitch.list_edges();
|
|
362
|
+
* [
|
|
363
|
+
* {
|
|
364
|
+
* from: 'on',
|
|
365
|
+
* to: 'off',
|
|
366
|
+
* kind: 'main',
|
|
367
|
+
* forced_only: false,
|
|
368
|
+
* main_path: true,
|
|
369
|
+
* action: 'toggle'
|
|
370
|
+
* },
|
|
371
|
+
* {
|
|
372
|
+
* from: 'off',
|
|
373
|
+
* to: 'on',
|
|
374
|
+
* kind: 'main',
|
|
375
|
+
* forced_only: false,
|
|
376
|
+
* main_path: true,
|
|
377
|
+
* action: 'toggle'
|
|
378
|
+
* }
|
|
379
|
+
* ]
|
|
380
|
+
* ```
|
|
381
|
+
*
|
|
382
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
343
383
|
*
|
|
344
384
|
*/
|
|
345
385
|
list_edges(): Array<JssmTransition<mDT>>;
|
|
@@ -355,11 +395,18 @@ declare class Machine<mDT> {
|
|
|
355
395
|
* exit. The order of each sublist is not defined. A node could appear in
|
|
356
396
|
* both lists.
|
|
357
397
|
*
|
|
358
|
-
*
|
|
398
|
+
* ```typescript
|
|
399
|
+
* import { sm } from 'jssm';
|
|
400
|
+
*
|
|
359
401
|
* const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
|
|
360
402
|
*
|
|
361
403
|
* light.state(); // 'red'
|
|
362
404
|
* light.list_transitions(); // { entrances: [ 'yellow', 'off' ], exits: [ 'green', 'off' ] }
|
|
405
|
+
* ```
|
|
406
|
+
*
|
|
407
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
408
|
+
*
|
|
409
|
+
* @param whichState The state whose transitions to have listed
|
|
363
410
|
*
|
|
364
411
|
*/
|
|
365
412
|
list_transitions(whichState?: StateType): JssmTransitionList;
|
|
@@ -368,11 +415,18 @@ declare class Machine<mDT> {
|
|
|
368
415
|
* List all entrances attached to the current state. Please note that the
|
|
369
416
|
* order of the list is not defined.
|
|
370
417
|
*
|
|
371
|
-
*
|
|
418
|
+
* ```typescript
|
|
419
|
+
* import { sm } from 'jssm';
|
|
420
|
+
*
|
|
372
421
|
* const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
|
|
373
422
|
*
|
|
374
423
|
* light.state(); // 'red'
|
|
375
424
|
* light.list_entrances(); // [ 'yellow', 'off' ]
|
|
425
|
+
* ```
|
|
426
|
+
*
|
|
427
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
428
|
+
*
|
|
429
|
+
* @param whichState The state whose entrances to have listed
|
|
376
430
|
*
|
|
377
431
|
*/
|
|
378
432
|
list_entrances(whichState?: StateType): Array<StateType>;
|
|
@@ -381,11 +435,18 @@ declare class Machine<mDT> {
|
|
|
381
435
|
* List all exits attached to the current state. Please note that the order
|
|
382
436
|
* of the list is not defined.
|
|
383
437
|
*
|
|
384
|
-
*
|
|
438
|
+
* ```typescript
|
|
439
|
+
* import { sm } from 'jssm';
|
|
440
|
+
*
|
|
385
441
|
* const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
|
|
386
442
|
*
|
|
387
443
|
* light.state(); // 'red'
|
|
388
444
|
* light.list_exits(); // [ 'green', 'off' ]
|
|
445
|
+
* ```
|
|
446
|
+
*
|
|
447
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
448
|
+
*
|
|
449
|
+
* @param whichState The state whose exits to have listed
|
|
389
450
|
*
|
|
390
451
|
*/
|
|
391
452
|
list_exits(whichState?: StateType): Array<StateType>;
|
|
@@ -422,6 +483,10 @@ declare class Machine<mDT> {
|
|
|
422
483
|
* console.log( machine.actions() ); // logs ['next', 'shutdown']
|
|
423
484
|
* ```
|
|
424
485
|
*
|
|
486
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
487
|
+
*
|
|
488
|
+
* @param whichState The state whose actions to have listed
|
|
489
|
+
*
|
|
425
490
|
*/
|
|
426
491
|
actions(whichState?: StateType): Array<StateType>;
|
|
427
492
|
/********
|
|
@@ -441,6 +506,10 @@ declare class Machine<mDT> {
|
|
|
441
506
|
* console.log( machine.list_states_having_action('start') ); // ['off']
|
|
442
507
|
* ```
|
|
443
508
|
*
|
|
509
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
510
|
+
*
|
|
511
|
+
* @param whichState The action to be checked for associated states
|
|
512
|
+
*
|
|
444
513
|
*/
|
|
445
514
|
list_states_having_action(whichState: StateType): Array<StateType>;
|
|
446
515
|
list_exit_actions(whichState?: StateType): Array<StateType>;
|
|
@@ -466,8 +535,68 @@ declare class Machine<mDT> {
|
|
|
466
535
|
hook_exit(from: string, handler: HookHandler): Machine<mDT>;
|
|
467
536
|
edges_between(from: string, to: string): JssmTransition<mDT>[];
|
|
468
537
|
transition_impl(newStateOrAction: StateType, newData: mDT | undefined, wasForced: boolean, wasAction: boolean): boolean;
|
|
538
|
+
/********
|
|
539
|
+
*
|
|
540
|
+
* Instruct the machine to complete an action.
|
|
541
|
+
*
|
|
542
|
+
* ```typescript
|
|
543
|
+
* const light = sm`red 'next' -> green 'next' -> yellow 'next' -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
|
|
544
|
+
*
|
|
545
|
+
* light.state(); // 'red'
|
|
546
|
+
* light.action('next'); // true
|
|
547
|
+
* light.state(); // 'green'
|
|
548
|
+
* ```
|
|
549
|
+
*
|
|
550
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
551
|
+
*
|
|
552
|
+
* @param actionName The action to engage
|
|
553
|
+
*
|
|
554
|
+
* @param newData The data change to insert during the action
|
|
555
|
+
*
|
|
556
|
+
*/
|
|
469
557
|
action(actionName: StateType, newData?: mDT): boolean;
|
|
558
|
+
/********
|
|
559
|
+
*
|
|
560
|
+
* Instruct the machine to complete a transition.
|
|
561
|
+
*
|
|
562
|
+
* ```typescript
|
|
563
|
+
* const light = sm`red -> green -> yellow -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
|
|
564
|
+
*
|
|
565
|
+
* light.state(); // 'red'
|
|
566
|
+
* light.transition('green'); // true
|
|
567
|
+
* light.state(); // 'green'
|
|
568
|
+
* ```
|
|
569
|
+
*
|
|
570
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
571
|
+
*
|
|
572
|
+
* @param newState The state to switch to
|
|
573
|
+
*
|
|
574
|
+
* @param newData The data change to insert during the transition
|
|
575
|
+
*
|
|
576
|
+
*/
|
|
470
577
|
transition(newState: StateType, newData?: mDT): boolean;
|
|
578
|
+
/********
|
|
579
|
+
*
|
|
580
|
+
* Instruct the machine to complete a forced transition (which will reject if
|
|
581
|
+
* called with a normal {@link transition} call.)
|
|
582
|
+
*
|
|
583
|
+
* ```typescript
|
|
584
|
+
* const light = sm`red -> green -> yellow -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
|
|
585
|
+
*
|
|
586
|
+
* light.state(); // 'red'
|
|
587
|
+
* light.transition('off'); // false
|
|
588
|
+
* light.state(); // 'red'
|
|
589
|
+
* light.force_transition('off'); // true
|
|
590
|
+
* light.state(); // 'off'
|
|
591
|
+
* ```
|
|
592
|
+
*
|
|
593
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
594
|
+
*
|
|
595
|
+
* @param newState The state to switch to
|
|
596
|
+
*
|
|
597
|
+
* @param newData The data change to insert during the transition
|
|
598
|
+
*
|
|
599
|
+
*/
|
|
471
600
|
force_transition(newState: StateType, newData?: mDT): boolean;
|
|
472
601
|
current_action_for(action: StateType): number;
|
|
473
602
|
current_action_edge_for(action: StateType): JssmTransition<mDT>;
|
|
@@ -493,6 +622,12 @@ declare class Machine<mDT> {
|
|
|
493
622
|
* const switch = jssm.from('on <=> off;');
|
|
494
623
|
* ```
|
|
495
624
|
*
|
|
625
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
626
|
+
*
|
|
627
|
+
* @param template_strings The assembled code
|
|
628
|
+
*
|
|
629
|
+
* @param remainder The mechanic for template argument insertion
|
|
630
|
+
*
|
|
496
631
|
*/
|
|
497
632
|
declare function sm<mDT>(template_strings: TemplateStringsArray, ...remainder: any[]): Machine<mDT>;
|
|
498
633
|
/*********
|
|
@@ -510,6 +645,12 @@ declare function sm<mDT>(template_strings: TemplateStringsArray, ...remainder: a
|
|
|
510
645
|
* const switch = jssm.from('on <=> off;');
|
|
511
646
|
* ```
|
|
512
647
|
*
|
|
648
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
649
|
+
*
|
|
650
|
+
* @param MachineAsString The FSL code to evaluate
|
|
651
|
+
*
|
|
652
|
+
* @param ExtraConstructorFields Extra non-code configuration to pass at creation time
|
|
653
|
+
*
|
|
513
654
|
*/
|
|
514
655
|
declare function from<mDT>(MachineAsString: string, ExtraConstructorFields?: Partial<JssmGenericConfig<mDT>> | undefined): Machine<mDT>;
|
|
515
656
|
export { version, transfer_state_properties, Machine, make, wrap_parse as parse, compile, sm, from, arrow_direction, arrow_left_kind, arrow_right_kind, seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, shapes, gviz_shapes, named_colors };
|