jssm 5.71.0 → 5.72.1
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 +37 -43
- package/dist/es6/jssm.d.ts +17 -1
- package/dist/es6/jssm.js +27 -12
- 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 +17 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
919 merges; 114 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -22,15 +22,13 @@ Published tags:
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## [5.70.36] - 6/21/2022 6:53:36 PM
|
|
25
|
+
## [Untagged] - 6/24/2022 4:08:35 PM
|
|
28
26
|
|
|
29
|
-
Commit [
|
|
27
|
+
Commit [a1c43e9f65f2fd8e856a2544f7c3056b4c06d9d3](https://github.com/StoneCypher/jssm/commit/a1c43e9f65f2fd8e856a2544f7c3056b4c06d9d3)
|
|
30
28
|
|
|
31
29
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
32
30
|
|
|
33
|
-
*
|
|
31
|
+
* First steps towards being a Moore machine - initial data in constructor fixes StoneCypher/fsl#923 , can read in hooks fixes StoneCypher/fsl#924
|
|
34
32
|
|
|
35
33
|
|
|
36
34
|
|
|
@@ -39,15 +37,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
39
37
|
|
|
40
38
|
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
## [5.70.35] - 6/19/2022 10:56:41 AM
|
|
40
|
+
## [Untagged] - 6/23/2022 6:34:38 PM
|
|
45
41
|
|
|
46
|
-
Commit [
|
|
42
|
+
Commit [1dc7c24bfb651eec57fddc902f78db796f71a6c5](https://github.com/StoneCypher/jssm/commit/1dc7c24bfb651eec57fddc902f78db796f71a6c5)
|
|
47
43
|
|
|
48
44
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
49
45
|
|
|
50
|
-
*
|
|
46
|
+
* Small documentation tweaks. First attempt to lodge on deno.land
|
|
51
47
|
|
|
52
48
|
|
|
53
49
|
|
|
@@ -56,13 +52,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
56
52
|
|
|
57
53
|
|
|
58
54
|
|
|
59
|
-
## [Untagged] - 6/
|
|
55
|
+
## [Untagged] - 6/23/2022 1:41:18 PM
|
|
60
56
|
|
|
61
|
-
Commit [
|
|
57
|
+
Commit [67c3240798d31933413aab27db7ea9fbb5de3b2a](https://github.com/StoneCypher/jssm/commit/67c3240798d31933413aab27db7ea9fbb5de3b2a)
|
|
62
58
|
|
|
63
59
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
64
60
|
|
|
65
|
-
*
|
|
61
|
+
* Normalize arguments to hooks, fixes StoneCypher/fsl#895; more docs
|
|
66
62
|
|
|
67
63
|
|
|
68
64
|
|
|
@@ -71,15 +67,15 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
71
67
|
|
|
72
68
|
|
|
73
69
|
|
|
74
|
-
<a name="
|
|
70
|
+
<a name="5__70__36" />
|
|
75
71
|
|
|
76
|
-
## [5.70.
|
|
72
|
+
## [5.70.36] - 6/21/2022 6:53:36 PM
|
|
77
73
|
|
|
78
|
-
Commit [
|
|
74
|
+
Commit [093db23b719161e35e477cc0fe7d9f1132bc28b8](https://github.com/StoneCypher/jssm/commit/093db23b719161e35e477cc0fe7d9f1132bc28b8)
|
|
79
75
|
|
|
80
76
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
81
77
|
|
|
82
|
-
*
|
|
78
|
+
* Another trivial build - this one to cause chain publishment
|
|
83
79
|
|
|
84
80
|
|
|
85
81
|
|
|
@@ -88,15 +84,15 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
88
84
|
|
|
89
85
|
|
|
90
86
|
|
|
91
|
-
<a name="
|
|
87
|
+
<a name="5__70__35" />
|
|
92
88
|
|
|
93
|
-
## [5.70.
|
|
89
|
+
## [5.70.35] - 6/19/2022 10:56:41 AM
|
|
94
90
|
|
|
95
|
-
Commit [
|
|
91
|
+
Commit [13ee9eb71ca9ab868699e535abf6ba30c8ad5829](https://github.com/StoneCypher/jssm/commit/13ee9eb71ca9ab868699e535abf6ba30c8ad5829)
|
|
96
92
|
|
|
97
93
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
98
94
|
|
|
99
|
-
*
|
|
95
|
+
* new trigger with replaced token - this time with a bump
|
|
100
96
|
|
|
101
97
|
|
|
102
98
|
|
|
@@ -105,15 +101,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
105
101
|
|
|
106
102
|
|
|
107
103
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
## [5.70.32] - 6/18/2022 8:48:07 PM
|
|
104
|
+
## [Untagged] - 6/19/2022 10:37:04 AM
|
|
111
105
|
|
|
112
|
-
Commit [
|
|
106
|
+
Commit [b3e69d9745b92d845bedcfbc08f342997137af3d](https://github.com/StoneCypher/jssm/commit/b3e69d9745b92d845bedcfbc08f342997137af3d)
|
|
113
107
|
|
|
114
108
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
115
109
|
|
|
116
|
-
*
|
|
110
|
+
* new trigger with replaced token
|
|
117
111
|
|
|
118
112
|
|
|
119
113
|
|
|
@@ -122,15 +116,15 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
122
116
|
|
|
123
117
|
|
|
124
118
|
|
|
125
|
-
<a name="
|
|
119
|
+
<a name="5__70__34" />
|
|
126
120
|
|
|
127
|
-
## [5.70.
|
|
121
|
+
## [5.70.34] - 6/18/2022 9:40:31 PM
|
|
128
122
|
|
|
129
|
-
Commit [
|
|
123
|
+
Commit [a0f295f060c7f08a8b10b2208dd1c95dc7f3c97a](https://github.com/StoneCypher/jssm/commit/a0f295f060c7f08a8b10b2208dd1c95dc7f3c97a)
|
|
130
124
|
|
|
131
125
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
132
126
|
|
|
133
|
-
* another
|
|
127
|
+
* another trigger commit with mild doc extension
|
|
134
128
|
|
|
135
129
|
|
|
136
130
|
|
|
@@ -139,15 +133,15 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
139
133
|
|
|
140
134
|
|
|
141
135
|
|
|
142
|
-
<a name="
|
|
136
|
+
<a name="5__70__33" />
|
|
143
137
|
|
|
144
|
-
## [5.70.
|
|
138
|
+
## [5.70.33] - 6/18/2022 8:57:42 PM
|
|
145
139
|
|
|
146
|
-
Commit [
|
|
140
|
+
Commit [ca254f455f2c19f21e77834e993c310e05272822](https://github.com/StoneCypher/jssm/commit/ca254f455f2c19f21e77834e993c310e05272822)
|
|
147
141
|
|
|
148
142
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
149
143
|
|
|
150
|
-
*
|
|
144
|
+
* holy another facile build for triggering, batman
|
|
151
145
|
|
|
152
146
|
|
|
153
147
|
|
|
@@ -156,15 +150,15 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
156
150
|
|
|
157
151
|
|
|
158
152
|
|
|
159
|
-
<a name="
|
|
153
|
+
<a name="5__70__32" />
|
|
160
154
|
|
|
161
|
-
## [5.70.
|
|
155
|
+
## [5.70.32] - 6/18/2022 8:48:07 PM
|
|
162
156
|
|
|
163
|
-
Commit [
|
|
157
|
+
Commit [8115e8b62d8ac1cff3c7eb07afabced097f1be42](https://github.com/StoneCypher/jssm/commit/8115e8b62d8ac1cff3c7eb07afabced097f1be42)
|
|
164
158
|
|
|
165
159
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
166
160
|
|
|
167
|
-
*
|
|
161
|
+
* yet another small commit as a trigger, this time to get the extended diff
|
|
168
162
|
|
|
169
163
|
|
|
170
164
|
|
|
@@ -173,12 +167,12 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
173
167
|
|
|
174
168
|
|
|
175
169
|
|
|
176
|
-
<a name="
|
|
170
|
+
<a name="5__70__31" />
|
|
177
171
|
|
|
178
|
-
## [5.70.
|
|
172
|
+
## [5.70.31] - 6/18/2022 8:00:06 PM
|
|
179
173
|
|
|
180
|
-
Commit [
|
|
174
|
+
Commit [de3d8a105aa85045a9f19ed46b4b3c5e5fb1e235](https://github.com/StoneCypher/jssm/commit/de3d8a105aa85045a9f19ed46b4b3c5e5fb1e235)
|
|
181
175
|
|
|
182
176
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
183
177
|
|
|
184
|
-
*
|
|
178
|
+
* another small commit as a trigger, this time to get the diff
|
package/dist/es6/jssm.d.ts
CHANGED
|
@@ -208,6 +208,7 @@ declare class Machine<mDT> {
|
|
|
208
208
|
_raw_state_declaration?: Array<Object>;
|
|
209
209
|
_state_declarations: Map<StateType, JssmStateDeclaration>;
|
|
210
210
|
_instance_name: string;
|
|
211
|
+
_data?: mDT;
|
|
211
212
|
_graph_layout: JssmLayout;
|
|
212
213
|
_dot_preamble: string;
|
|
213
214
|
_arrange_declaration: Array<Array<StateType>>;
|
|
@@ -232,7 +233,7 @@ declare class Machine<mDT> {
|
|
|
232
233
|
_main_transition_hook: HookHandler | undefined;
|
|
233
234
|
_forced_transition_hook: HookHandler | undefined;
|
|
234
235
|
_any_transition_hook: HookHandler | undefined;
|
|
235
|
-
constructor({ start_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name }: JssmGenericConfig<mDT>);
|
|
236
|
+
constructor({ start_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name, data }: JssmGenericConfig<mDT>);
|
|
236
237
|
/********
|
|
237
238
|
*
|
|
238
239
|
* Internal method for fabricating states. Not meant for external use.
|
|
@@ -259,6 +260,21 @@ declare class Machine<mDT> {
|
|
|
259
260
|
*
|
|
260
261
|
*/
|
|
261
262
|
state(): StateType;
|
|
263
|
+
/*********
|
|
264
|
+
*
|
|
265
|
+
* Get the current data of a machine.
|
|
266
|
+
*
|
|
267
|
+
* ```typescript
|
|
268
|
+
* import * as jssm from 'jssm';
|
|
269
|
+
*
|
|
270
|
+
* const switch = jssm.from('on <=> off;', {data: 1});
|
|
271
|
+
* console.log( switch.data() ); // 1
|
|
272
|
+
* ```
|
|
273
|
+
*
|
|
274
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
275
|
+
*
|
|
276
|
+
*/
|
|
277
|
+
data(): mDT;
|
|
262
278
|
/********
|
|
263
279
|
*
|
|
264
280
|
* Check whether a given state is final (either has no exits or is marked
|
package/dist/es6/jssm.js
CHANGED
|
@@ -534,7 +534,7 @@ function transfer_state_properties(state_decl) {
|
|
|
534
534
|
// TODO add a lotta docblock here
|
|
535
535
|
class Machine {
|
|
536
536
|
// whargarbl this badly needs to be broken up, monolith master
|
|
537
|
-
constructor({ start_states, complete = [], transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, fsl_version, dot_preamble = undefined, arrange_declaration = [], arrange_start_declaration = [], arrange_end_declaration = [], theme = 'default', flow = 'down', graph_layout = 'dot', instance_name }) {
|
|
537
|
+
constructor({ start_states, complete = [], transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, fsl_version, dot_preamble = undefined, arrange_declaration = [], arrange_start_declaration = [], arrange_end_declaration = [], theme = 'default', flow = 'down', graph_layout = 'dot', instance_name, data }) {
|
|
538
538
|
this._instance_name = instance_name;
|
|
539
539
|
this._state = start_states[0];
|
|
540
540
|
this._states = new Map();
|
|
@@ -581,6 +581,7 @@ class Machine {
|
|
|
581
581
|
this._forced_transition_hook = undefined;
|
|
582
582
|
this._any_transition_hook = undefined;
|
|
583
583
|
this._standard_transition_hook = undefined;
|
|
584
|
+
this._data = data;
|
|
584
585
|
if (state_declaration) {
|
|
585
586
|
state_declaration.map((state_decl) => {
|
|
586
587
|
if (this._state_declarations.has(state_decl.state)) { // no repeats
|
|
@@ -718,6 +719,30 @@ class Machine {
|
|
|
718
719
|
return true; // todo whargarbl
|
|
719
720
|
}
|
|
720
721
|
*/
|
|
722
|
+
/*********
|
|
723
|
+
*
|
|
724
|
+
* Get the current data of a machine.
|
|
725
|
+
*
|
|
726
|
+
* ```typescript
|
|
727
|
+
* import * as jssm from 'jssm';
|
|
728
|
+
*
|
|
729
|
+
* const switch = jssm.from('on <=> off;', {data: 1});
|
|
730
|
+
* console.log( switch.data() ); // 1
|
|
731
|
+
* ```
|
|
732
|
+
*
|
|
733
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
734
|
+
*
|
|
735
|
+
*/
|
|
736
|
+
data() {
|
|
737
|
+
return this._data;
|
|
738
|
+
}
|
|
739
|
+
/* whargarbl todo major
|
|
740
|
+
when we reimplement this, reintroduce this change to the is_final call
|
|
741
|
+
|
|
742
|
+
is_changing(): boolean {
|
|
743
|
+
return true; // todo whargarbl
|
|
744
|
+
}
|
|
745
|
+
*/
|
|
721
746
|
/********
|
|
722
747
|
*
|
|
723
748
|
* Check whether a given state is final (either has no exits or is marked
|
|
@@ -1229,52 +1254,42 @@ class Machine {
|
|
|
1229
1254
|
}
|
|
1230
1255
|
}
|
|
1231
1256
|
hook(from, to, handler) {
|
|
1232
|
-
// TODO: should this throw if setting the hook fails, or ignore it and continue?
|
|
1233
1257
|
this.set_hook({ kind: 'hook', from, to, handler });
|
|
1234
1258
|
return this;
|
|
1235
1259
|
}
|
|
1236
1260
|
hook_action(from, to, action, handler) {
|
|
1237
|
-
// TODO: should this throw if setting the hook fails, or ignore it and continue?
|
|
1238
1261
|
this.set_hook({ kind: 'named', from, to, action, handler });
|
|
1239
1262
|
return this;
|
|
1240
1263
|
}
|
|
1241
1264
|
hook_global_action(action, handler) {
|
|
1242
|
-
// TODO: should this throw if setting the hook fails, or ignore it and continue?
|
|
1243
1265
|
this.set_hook({ kind: 'global action', action, handler });
|
|
1244
1266
|
return this;
|
|
1245
1267
|
}
|
|
1246
1268
|
hook_any_action(handler) {
|
|
1247
|
-
// TODO: should this throw if setting the hook fails, or ignore it and continue?
|
|
1248
1269
|
this.set_hook({ kind: 'any action', handler });
|
|
1249
1270
|
return this;
|
|
1250
1271
|
}
|
|
1251
1272
|
hook_standard_transition(handler) {
|
|
1252
|
-
// TODO: should this throw if setting the hook fails, or ignore it and continue?
|
|
1253
1273
|
this.set_hook({ kind: 'standard transition', handler });
|
|
1254
1274
|
return this;
|
|
1255
1275
|
}
|
|
1256
1276
|
hook_main_transition(handler) {
|
|
1257
|
-
// TODO: should this throw if setting the hook fails, or ignore it and continue?
|
|
1258
1277
|
this.set_hook({ kind: 'main transition', handler });
|
|
1259
1278
|
return this;
|
|
1260
1279
|
}
|
|
1261
1280
|
hook_forced_transition(handler) {
|
|
1262
|
-
// TODO: should this throw if setting the hook fails, or ignore it and continue?
|
|
1263
1281
|
this.set_hook({ kind: 'forced transition', handler });
|
|
1264
1282
|
return this;
|
|
1265
1283
|
}
|
|
1266
1284
|
hook_any_transition(handler) {
|
|
1267
|
-
// TODO: should this throw if setting the hook fails, or ignore it and continue?
|
|
1268
1285
|
this.set_hook({ kind: 'any transition', handler });
|
|
1269
1286
|
return this;
|
|
1270
1287
|
}
|
|
1271
1288
|
hook_entry(to, handler) {
|
|
1272
|
-
// TODO: should this throw if setting the hook fails, or ignore it and continue?
|
|
1273
1289
|
this.set_hook({ kind: 'entry', to, handler });
|
|
1274
1290
|
return this;
|
|
1275
1291
|
}
|
|
1276
1292
|
hook_exit(from, handler) {
|
|
1277
|
-
// TODO: should this throw if setting the hook fails, or ignore it and continue?
|
|
1278
1293
|
this.set_hook({ kind: 'exit', from, handler });
|
|
1279
1294
|
return this;
|
|
1280
1295
|
}
|
|
@@ -1317,7 +1332,7 @@ class Machine {
|
|
|
1317
1332
|
// todo major incomplete whargarbl comeback
|
|
1318
1333
|
if (valid) {
|
|
1319
1334
|
if (this._has_hooks) {
|
|
1320
|
-
const hook_args = { action: fromAction, from: this._state, to: newState, forced: wasForced };
|
|
1335
|
+
const hook_args = { data: this._data, action: fromAction, from: this._state, to: newState, forced: wasForced };
|
|
1321
1336
|
if (wasAction) {
|
|
1322
1337
|
// 1. any action hook
|
|
1323
1338
|
if (this._any_action_hook !== undefined) {
|
package/dist/es6/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = "5.
|
|
1
|
+
const version = "5.72.1";
|
|
2
2
|
export { version };
|