jssm 5.72.2 → 5.72.5

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- 920 merges; 114 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
5
+ 931 merges; 120 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
6
6
 
7
7
 
8
8
 
@@ -12,7 +12,7 @@ All notable changes to this project will be documented in this file.
12
12
 
13
13
  Published tags:
14
14
 
15
- <a href="#5__70__36">5.70.36</a>, <a href="#5__70__35">5.70.35</a>, <a href="#5__70__34">5.70.34</a>, <a href="#5__70__33">5.70.33</a>, <a href="#5__70__32">5.70.32</a>, <a href="#5__70__31">5.70.31</a>, <a href="#5__70__30">5.70.30</a>, <a href="#5__70__29">5.70.29</a>, <a href="#5__70__28">5.70.28</a>, <a href="#5__70__27">5.70.27</a>, <a href="#5__70__26">5.70.26</a>, <a href="#5__70__25">5.70.25</a>, <a href="#5__70__24">5.70.24</a>, <a href="#5__70__23">5.70.23</a>, <a href="#5__70__22">5.70.22</a>, <a href="#5__70__21">5.70.21</a>, <a href="#5__70__20">5.70.20</a>, <a href="#5__70__19">5.70.19</a>, <a href="#5__70__18">5.70.18</a>, <a href="#5__70__16">5.70.16</a>, <a href="#5__70__15">5.70.15</a>, <a href="#5__70__14">5.70.14</a>, <a href="#5__70__13">5.70.13</a>, <a href="#5__70__12">5.70.12</a>, <a href="#5__70__11">5.70.11</a>, <a href="#5__70__10">5.70.10</a>, <a href="#5__70__9">5.70.9</a>, <a href="#5__70__8">5.70.8</a>, <a href="#5__70__7">5.70.7</a>, <a href="#5__70__6">5.70.6</a>, <a href="#5__70__5">5.70.5</a>, <a href="#5__70__4">5.70.4</a>, <a href="#5__70__3">5.70.3</a>, <a href="#5__70__2">5.70.2</a>, <a href="#5__70__1">5.70.1</a>, <a href="#5__70__0">5.70.0</a>, <a href="#5__69__4">5.69.4</a>, <a href="#5__69__3">5.69.3</a>, <a href="#5__69__2">5.69.2</a>, <a href="#5__69__0">5.69.0</a>, <a href="#5__68__0">5.68.0</a>, <a href="#5__67__2">5.67.2</a>, <a href="#5__67__0">5.67.0</a>, <a href="#5__66__0">5.66.0</a>, <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>
15
+ <a href="#5__72__3">5.72.3</a>, <a href="#5__72__2">5.72.2</a>, <a href="#5__72__1">5.72.1</a>, <a href="#5__72__0">5.72.0</a>, <a href="#5__71__1">5.71.1</a>, <a href="#5__71__0">5.71.0</a>, <a href="#5__70__36">5.70.36</a>, <a href="#5__70__35">5.70.35</a>, <a href="#5__70__34">5.70.34</a>, <a href="#5__70__33">5.70.33</a>, <a href="#5__70__32">5.70.32</a>, <a href="#5__70__31">5.70.31</a>, <a href="#5__70__30">5.70.30</a>, <a href="#5__70__29">5.70.29</a>, <a href="#5__70__28">5.70.28</a>, <a href="#5__70__27">5.70.27</a>, <a href="#5__70__26">5.70.26</a>, <a href="#5__70__25">5.70.25</a>, <a href="#5__70__24">5.70.24</a>, <a href="#5__70__23">5.70.23</a>, <a href="#5__70__22">5.70.22</a>, <a href="#5__70__21">5.70.21</a>, <a href="#5__70__20">5.70.20</a>, <a href="#5__70__19">5.70.19</a>, <a href="#5__70__18">5.70.18</a>, <a href="#5__70__16">5.70.16</a>, <a href="#5__70__15">5.70.15</a>, <a href="#5__70__14">5.70.14</a>, <a href="#5__70__13">5.70.13</a>, <a href="#5__70__12">5.70.12</a>, <a href="#5__70__11">5.70.11</a>, <a href="#5__70__10">5.70.10</a>, <a href="#5__70__9">5.70.9</a>, <a href="#5__70__8">5.70.8</a>, <a href="#5__70__7">5.70.7</a>, <a href="#5__70__6">5.70.6</a>, <a href="#5__70__5">5.70.5</a>, <a href="#5__70__4">5.70.4</a>, <a href="#5__70__3">5.70.3</a>, <a href="#5__70__2">5.70.2</a>, <a href="#5__70__1">5.70.1</a>, <a href="#5__70__0">5.70.0</a>, <a href="#5__69__4">5.69.4</a>, <a href="#5__69__3">5.69.3</a>, <a href="#5__69__2">5.69.2</a>, <a href="#5__69__0">5.69.0</a>, <a href="#5__68__0">5.68.0</a>, <a href="#5__67__2">5.67.2</a>, <a href="#5__67__0">5.67.0</a>, <a href="#5__66__0">5.66.0</a>, <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
16
 
17
17
 
18
18
 
@@ -22,13 +22,16 @@ Published tags:
22
22
 
23
23
  &nbsp;
24
24
 
25
- ## [Untagged] - 6/24/2022 4:55:33 PM
25
+ ## [Untagged] - 6/25/2022 8:12:11 AM
26
26
 
27
- Commit [547e35599ed312bf5300d3f1685e2cb16b80a73e](https://github.com/StoneCypher/jssm/commit/547e35599ed312bf5300d3f1685e2cb16b80a73e)
27
+ Commit [dc3096f064e58ea616899b12d3d25c973f326c1c](https://github.com/StoneCypher/jssm/commit/dc3096f064e58ea616899b12d3d25c973f326c1c)
28
28
 
29
29
  Author: `John Haugeland <stonecypher@gmail.com>`
30
30
 
31
- * Can read data from outside, fixes StoneCypher/fsl#929
31
+ Merges [a184324, 8762d17]
32
+
33
+ * Merge pull request #502 from StoneCypher/AllowHooksToChangeData
34
+ * Allow hooks to change data
32
35
 
33
36
 
34
37
 
@@ -37,13 +40,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
37
40
 
38
41
  &nbsp;
39
42
 
40
- ## [Untagged] - 6/24/2022 4:08:35 PM
43
+ ## [Untagged] - 6/25/2022 8:08:38 AM
41
44
 
42
- Commit [a1c43e9f65f2fd8e856a2544f7c3056b4c06d9d3](https://github.com/StoneCypher/jssm/commit/a1c43e9f65f2fd8e856a2544f7c3056b4c06d9d3)
45
+ Commit [8762d17bd69cdf48f522dbd6ee188f46e29a0c06](https://github.com/StoneCypher/jssm/commit/8762d17bd69cdf48f522dbd6ee188f46e29a0c06)
43
46
 
44
47
  Author: `John Haugeland <stonecypher@gmail.com>`
45
48
 
46
- * First steps towards being a Moore machine - initial data in constructor fixes StoneCypher/fsl#923 , can read in hooks fixes StoneCypher/fsl#924
49
+ * Hooks can change data, fixes StoneCypher/fsl#932
47
50
 
48
51
 
49
52
 
@@ -52,13 +55,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
52
55
 
53
56
  &nbsp;
54
57
 
55
- ## [Untagged] - 6/23/2022 6:34:38 PM
58
+ ## [Untagged] - 6/25/2022 7:15:46 AM
56
59
 
57
- Commit [1dc7c24bfb651eec57fddc902f78db796f71a6c5](https://github.com/StoneCypher/jssm/commit/1dc7c24bfb651eec57fddc902f78db796f71a6c5)
60
+ Commit [fb82aff27a911a29304c8b7c211e48c1b6ac454e](https://github.com/StoneCypher/jssm/commit/fb82aff27a911a29304c8b7c211e48c1b6ac454e)
58
61
 
59
62
  Author: `John Haugeland <stonecypher@gmail.com>`
60
63
 
61
- * Small documentation tweaks. First attempt to lodge on deno.land
64
+ * prepping to test main and forced
62
65
 
63
66
 
64
67
 
@@ -67,13 +70,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
67
70
 
68
71
  &nbsp;
69
72
 
70
- ## [Untagged] - 6/23/2022 1:41:18 PM
73
+ ## [Untagged] - 6/25/2022 7:05:36 AM
71
74
 
72
- Commit [67c3240798d31933413aab27db7ea9fbb5de3b2a](https://github.com/StoneCypher/jssm/commit/67c3240798d31933413aab27db7ea9fbb5de3b2a)
75
+ Commit [3ffc6c2a0b76d1a4870cd80a0f94d745e1c976c9](https://github.com/StoneCypher/jssm/commit/3ffc6c2a0b76d1a4870cd80a0f94d745e1c976c9)
73
76
 
74
77
  Author: `John Haugeland <stonecypher@gmail.com>`
75
78
 
76
- * Normalize arguments to hooks, fixes StoneCypher/fsl#895; more docs
79
+ * everything now tested but standard and main
77
80
 
78
81
 
79
82
 
@@ -82,15 +85,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
82
85
 
83
86
  &nbsp;
84
87
 
85
- <a name="5__70__36" />
86
-
87
- ## [5.70.36] - 6/21/2022 6:53:36 PM
88
+ ## [Untagged] - 6/25/2022 6:50:50 AM
88
89
 
89
- Commit [093db23b719161e35e477cc0fe7d9f1132bc28b8](https://github.com/StoneCypher/jssm/commit/093db23b719161e35e477cc0fe7d9f1132bc28b8)
90
+ Commit [e74cb836ae9c06a3261658ee969506c8dd3c9a24](https://github.com/StoneCypher/jssm/commit/e74cb836ae9c06a3261658ee969506c8dd3c9a24)
90
91
 
91
92
  Author: `John Haugeland <stonecypher@gmail.com>`
92
93
 
93
- * Another trivial build - this one to cause chain publishment
94
+ * six data kinds tested
94
95
 
95
96
 
96
97
 
@@ -99,15 +100,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
99
100
 
100
101
  &nbsp;
101
102
 
102
- <a name="5__70__35" />
103
-
104
- ## [5.70.35] - 6/19/2022 10:56:41 AM
103
+ ## [Untagged] - 6/24/2022 9:24:32 PM
105
104
 
106
- Commit [13ee9eb71ca9ab868699e535abf6ba30c8ad5829](https://github.com/StoneCypher/jssm/commit/13ee9eb71ca9ab868699e535abf6ba30c8ad5829)
105
+ Commit [df34e0fd36d969bcb80488c6609d6bf4140b89a4](https://github.com/StoneCypher/jssm/commit/df34e0fd36d969bcb80488c6609d6bf4140b89a4)
107
106
 
108
107
  Author: `John Haugeland <stonecypher@gmail.com>`
109
108
 
110
- * new trigger with replaced token - this time with a bump
109
+ * working test matrix
111
110
 
112
111
 
113
112
 
@@ -116,13 +115,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
116
115
 
117
116
  &nbsp;
118
117
 
119
- ## [Untagged] - 6/19/2022 10:37:04 AM
118
+ ## [Untagged] - 6/24/2022 8:34:59 PM
120
119
 
121
- Commit [b3e69d9745b92d845bedcfbc08f342997137af3d](https://github.com/StoneCypher/jssm/commit/b3e69d9745b92d845bedcfbc08f342997137af3d)
120
+ Commit [8db075dcd9a135e6757a11c5e497130bb3edb6a9](https://github.com/StoneCypher/jssm/commit/8db075dcd9a135e6757a11c5e497130bb3edb6a9)
122
121
 
123
122
  Author: `John Haugeland <stonecypher@gmail.com>`
124
123
 
125
- * new trigger with replaced token
124
+ * Hooks now change data on basic transitions, moving to handle the rest
126
125
 
127
126
 
128
127
 
@@ -131,32 +130,33 @@ Author: `John Haugeland <stonecypher@gmail.com>`
131
130
 
132
131
  &nbsp;
133
132
 
134
- <a name="5__70__34" />
133
+ <a name="5__72__3" />
135
134
 
136
- ## [5.70.34] - 6/18/2022 9:40:31 PM
135
+ ## [5.72.3] - 6/24/2022 7:48:13 PM
137
136
 
138
- Commit [a0f295f060c7f08a8b10b2208dd1c95dc7f3c97a](https://github.com/StoneCypher/jssm/commit/a0f295f060c7f08a8b10b2208dd1c95dc7f3c97a)
137
+ Commit [a1843247eb5c063910643f675f0a85764f3f3683](https://github.com/StoneCypher/jssm/commit/a1843247eb5c063910643f675f0a85764f3f3683)
139
138
 
140
139
  Author: `John Haugeland <stonecypher@gmail.com>`
141
140
 
142
- * another trigger commit with mild doc extension
141
+ Merges [b0cbe1c, d52217a]
143
142
 
143
+ * Merge pull request #501 from StoneCypher/MovingToAbstractHooks
144
+ * Moving to abstract hooks
144
145
 
145
146
 
146
147
 
147
- &nbsp;
148
148
 
149
149
  &nbsp;
150
150
 
151
- <a name="5__70__33" />
151
+ &nbsp;
152
152
 
153
- ## [5.70.33] - 6/18/2022 8:57:42 PM
153
+ ## [Untagged] - 6/24/2022 7:44:55 PM
154
154
 
155
- Commit [ca254f455f2c19f21e77834e993c310e05272822](https://github.com/StoneCypher/jssm/commit/ca254f455f2c19f21e77834e993c310e05272822)
155
+ Commit [d52217ab9dde2a5746cd0704597d337362057024](https://github.com/StoneCypher/jssm/commit/d52217ab9dde2a5746cd0704597d337362057024)
156
156
 
157
157
  Author: `John Haugeland <stonecypher@gmail.com>`
158
158
 
159
- * holy another facile build for triggering, batman
159
+ * Basic conversion to abstract hooks complete; fixes StoneCypher/fsl#931
160
160
 
161
161
 
162
162
 
@@ -165,12 +165,10 @@ Author: `John Haugeland <stonecypher@gmail.com>`
165
165
 
166
166
  &nbsp;
167
167
 
168
- <a name="5__70__32" />
169
-
170
- ## [5.70.32] - 6/18/2022 8:48:07 PM
168
+ ## [Untagged] - 6/24/2022 7:36:27 PM
171
169
 
172
- Commit [8115e8b62d8ac1cff3c7eb07afabced097f1be42](https://github.com/StoneCypher/jssm/commit/8115e8b62d8ac1cff3c7eb07afabced097f1be42)
170
+ Commit [adfa9069ba5e78d8a227896a5f7e14a8f4b80117](https://github.com/StoneCypher/jssm/commit/adfa9069ba5e78d8a227896a5f7e14a8f4b80117)
173
171
 
174
172
  Author: `John Haugeland <stonecypher@gmail.com>`
175
173
 
176
- * yet another small commit as a trigger, this time to get the extended diff
174
+ * the conversion continues
package/README.md CHANGED
@@ -1,8 +1,31 @@
1
+ <!--
2
+
3
+ I8, 8 ,8I 88
4
+ `8b d8b d8' ""
5
+ "8, ,8"8, ,8"
6
+ Y8 8P Y8 8P ,adPPYYba, 8b,dPPYba, 8b,dPPYba, 88 8b,dPPYba, ,adPPYb,d8
7
+ `8b d8' `8b d8' "" `Y8 88P' "Y8 88P' `"8a 88 88P' `"8a a8" `Y88
8
+ `8a a8' `8a a8' ,adPPPPP88 88 88 88 88 88 88 8b 88
9
+ `8a8' `8a8' 88, ,88 88 88 88 88 88 88 "8a, ,d88
10
+ `8' `8' `"8bbdP"Y8 88 88 88 88 88 88 `"YbbdP"Y8
11
+ aa, ,88
12
+ "Y8bbdP"
13
+
14
+ This file is generated. If you edit it, the edits ***will be lost***.
15
+ ----------------------
16
+
17
+ Please edit the file it's derived from, instead: `./src/md/readme_base.md`
18
+
19
+
20
+
21
+ * Generated for version 5.72.5 at 6/25/2022, 10:53:38 AM
22
+
23
+ -->
1
24
  # jssm
2
25
 
3
26
  Easy. Small. Fast. TS, es6, es5. Node, Browser. 100% coverage. Property
4
27
  tests. Fuzz tests. Language tests for a dozen languages and emoji. Easy to
5
- share online. Easy to embed.
28
+ share online. Easy to embed. ***4,611 tests***.
6
29
 
7
30
  Readable, useful state machines as one-liner strings.
8
31
 
@@ -1,6 +1,6 @@
1
1
  declare type StateType = string;
2
2
  import { JssmGenericState, JssmGenericConfig, JssmTransition, JssmTransitionList, // JssmTransitionRule,
3
- JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, FslDirection, FslTheme, HookDescription, HookHandler } from './jssm_types';
3
+ JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types';
4
4
  import { seq, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util';
5
5
  import { shapes, gviz_shapes, named_colors } from './jssm_constants';
6
6
  import { version } from './version';
@@ -223,11 +223,11 @@ declare class Machine<mDT> {
223
223
  _has_exit_hooks: boolean;
224
224
  _has_global_action_hooks: boolean;
225
225
  _has_transition_hooks: boolean;
226
- _hooks: Map<string, Function>;
227
- _named_hooks: Map<string, Function>;
228
- _entry_hooks: Map<string, Function>;
229
- _exit_hooks: Map<string, Function>;
230
- _global_action_hooks: Map<string, Function>;
226
+ _hooks: Map<string, HookHandler<mDT>>;
227
+ _named_hooks: Map<string, HookHandler<mDT>>;
228
+ _entry_hooks: Map<string, HookHandler<mDT>>;
229
+ _exit_hooks: Map<string, HookHandler<mDT>>;
230
+ _global_action_hooks: Map<string, HookHandler<mDT>>;
231
231
  _any_action_hook: HookHandler<mDT> | undefined;
232
232
  _standard_transition_hook: HookHandler<mDT> | undefined;
233
233
  _main_transition_hook: HookHandler<mDT> | undefined;
@@ -669,4 +669,7 @@ declare function sm<mDT>(template_strings: TemplateStringsArray, ...remainder: a
669
669
  *
670
670
  */
671
671
  declare function from<mDT>(MachineAsString: string, ExtraConstructorFields?: Partial<JssmGenericConfig<mDT>> | undefined): Machine<mDT>;
672
- 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 };
672
+ declare function is_hook_complex_result<mDT>(hr: unknown): hr is HookComplexResult<mDT>;
673
+ declare function is_hook_rejection<mDT>(hr: HookResult<mDT>): boolean;
674
+ declare function abstract_hook_step<mDT>(maybe_hook: HookHandler<mDT> | undefined, hook_args: HookContext<mDT>): HookComplexResult<mDT>;
675
+ 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, is_hook_rejection, is_hook_complex_result, abstract_hook_step };
package/dist/es6/jssm.js CHANGED
@@ -1328,102 +1328,108 @@ class Machine {
1328
1328
  newState = newStateOrAction;
1329
1329
  }
1330
1330
  }
1331
- // todo whargarbl implement data stuff
1332
- // todo major incomplete whargarbl comeback
1333
1331
  if (valid) {
1334
1332
  if (this._has_hooks) {
1335
- const hook_args = { data: this._data, action: fromAction, from: this._state, to: newState, forced: wasForced };
1333
+ const hook_args = {
1334
+ data: this._data,
1335
+ action: fromAction,
1336
+ from: this._state,
1337
+ to: newState,
1338
+ forced: wasForced
1339
+ };
1340
+ function update_fields(res) {
1341
+ if (res.hasOwnProperty('data')) {
1342
+ hook_args.data = res.data;
1343
+ data_changed = true;
1344
+ }
1345
+ }
1346
+ let data_changed = false;
1336
1347
  if (wasAction) {
1337
1348
  // 1. any action hook
1338
- if (this._any_action_hook !== undefined) {
1339
- if (this._any_action_hook(hook_args) === false) {
1340
- return false;
1341
- }
1349
+ const outcome = abstract_hook_step(this._any_action_hook, hook_args);
1350
+ if (outcome.pass === false) {
1351
+ return false;
1342
1352
  }
1353
+ update_fields(outcome);
1343
1354
  // 2. global specific action hook
1344
- const maybe_ga_hook = this._global_action_hooks.get(newStateOrAction);
1345
- if (maybe_ga_hook !== undefined) {
1346
- if (maybe_ga_hook(hook_args) === false) {
1347
- return false;
1348
- }
1355
+ const outcome2 = abstract_hook_step(this._global_action_hooks.get(newStateOrAction), hook_args);
1356
+ if (outcome2.pass === false) {
1357
+ return false;
1349
1358
  }
1359
+ update_fields(outcome2);
1350
1360
  }
1351
1361
  // 3. any transition hook
1352
1362
  if (this._any_transition_hook !== undefined) {
1353
- if (this._any_transition_hook(hook_args) === false) {
1363
+ const outcome = abstract_hook_step(this._any_transition_hook, hook_args);
1364
+ if (outcome.pass === false) {
1354
1365
  return false;
1355
1366
  }
1367
+ update_fields(outcome);
1356
1368
  }
1357
1369
  // 4. exit hook
1358
1370
  if (this._has_exit_hooks) {
1359
- const maybe_ex_hook = this._exit_hooks.get(this._state);
1360
- if (maybe_ex_hook !== undefined) {
1361
- if (maybe_ex_hook(hook_args) === false) {
1362
- return false;
1363
- }
1371
+ const outcome = abstract_hook_step(this._exit_hooks.get(this._state), hook_args);
1372
+ if (outcome.pass === false) {
1373
+ return false;
1364
1374
  }
1375
+ update_fields(outcome);
1365
1376
  }
1366
1377
  // 5. named transition / action hook
1367
1378
  if (this._has_named_hooks) {
1368
1379
  if (wasAction) {
1369
- const nhn = named_hook_name(this._state, newState, newStateOrAction), n_maybe_hook = this._named_hooks.get(nhn);
1370
- if (n_maybe_hook !== undefined) {
1371
- if (n_maybe_hook(hook_args) === false) {
1372
- return false;
1373
- }
1380
+ const nhn = named_hook_name(this._state, newState, newStateOrAction), outcome = abstract_hook_step(this._named_hooks.get(nhn), hook_args);
1381
+ if (outcome.pass === false) {
1382
+ return false;
1374
1383
  }
1384
+ update_fields(outcome);
1375
1385
  }
1376
1386
  }
1377
1387
  // 6. regular hook
1378
1388
  if (this._has_basic_hooks) {
1379
- const hn = hook_name(this._state, newState), maybe_hook = this._hooks.get(hn);
1380
- if (maybe_hook !== undefined) {
1381
- if (maybe_hook(hook_args) === false) {
1382
- return false;
1383
- }
1389
+ const hn = hook_name(this._state, newState), outcome = abstract_hook_step(this._hooks.get(hn), hook_args);
1390
+ if (outcome.pass === false) {
1391
+ return false;
1384
1392
  }
1393
+ update_fields(outcome);
1385
1394
  }
1386
1395
  // 7. edge type hook
1387
1396
  // 7a. standard transition hook
1388
1397
  if (trans_type === 'legal') {
1389
- if (this._standard_transition_hook !== undefined) {
1390
- // todo handle actions
1391
- // todo handle forced
1392
- if (this._standard_transition_hook(hook_args) === false) {
1393
- return false;
1394
- }
1398
+ const outcome = abstract_hook_step(this._standard_transition_hook, hook_args);
1399
+ if (outcome.pass === false) {
1400
+ return false;
1395
1401
  }
1402
+ update_fields(outcome);
1396
1403
  }
1397
1404
  // 7b. main type hook
1398
1405
  if (trans_type === 'main') {
1399
- if (this._main_transition_hook !== undefined) {
1400
- // todo handle actions
1401
- // todo handle forced
1402
- if (this._main_transition_hook(hook_args) === false) {
1403
- return false;
1404
- }
1406
+ const outcome = abstract_hook_step(this._main_transition_hook, hook_args);
1407
+ if (outcome.pass === false) {
1408
+ return false;
1405
1409
  }
1410
+ update_fields(outcome);
1406
1411
  }
1407
1412
  // 7c. forced transition hook
1408
1413
  if (trans_type === 'forced') {
1409
- if (this._forced_transition_hook !== undefined) {
1410
- // todo handle actions
1411
- // todo handle forced
1412
- if (this._forced_transition_hook(hook_args) === false) {
1413
- return false;
1414
- }
1414
+ const outcome = abstract_hook_step(this._forced_transition_hook, hook_args);
1415
+ if (outcome.pass === false) {
1416
+ return false;
1415
1417
  }
1418
+ update_fields(outcome);
1416
1419
  }
1417
1420
  // 8. entry hook
1418
1421
  if (this._has_entry_hooks) {
1419
- const maybe_en_hook = this._entry_hooks.get(newState);
1420
- if (maybe_en_hook !== undefined) {
1421
- if (maybe_en_hook(hook_args) === false) {
1422
- return false;
1423
- }
1422
+ const outcome = abstract_hook_step(this._entry_hooks.get(newState), hook_args);
1423
+ if (outcome.pass === false) {
1424
+ return false;
1424
1425
  }
1426
+ update_fields(outcome);
1425
1427
  }
1428
+ // all hooks passed! let's now establish the result
1426
1429
  this._state = newState;
1430
+ if (data_changed) {
1431
+ this._data = hook_args.data;
1432
+ }
1427
1433
  return true;
1428
1434
  // or without hooks
1429
1435
  }
@@ -1615,6 +1621,50 @@ function from(MachineAsString, ExtraConstructorFields) {
1615
1621
  }
1616
1622
  return new Machine(to_decorate);
1617
1623
  }
1624
+ function is_hook_complex_result(hr) {
1625
+ if (typeof hr === 'object') {
1626
+ if (typeof hr.pass === 'boolean') {
1627
+ return true;
1628
+ }
1629
+ }
1630
+ return false;
1631
+ }
1632
+ function is_hook_rejection(hr) {
1633
+ if (hr === true) {
1634
+ return false;
1635
+ }
1636
+ if (hr === undefined) {
1637
+ return false;
1638
+ }
1639
+ if (hr === false) {
1640
+ return true;
1641
+ }
1642
+ if (is_hook_complex_result(hr)) {
1643
+ return (!(hr.pass));
1644
+ }
1645
+ throw new TypeError('unknown hook rejection type result');
1646
+ }
1647
+ function abstract_hook_step(maybe_hook, hook_args) {
1648
+ if (maybe_hook !== undefined) {
1649
+ const result = maybe_hook(hook_args);
1650
+ if (result === undefined) {
1651
+ return { pass: true };
1652
+ }
1653
+ if (result === true) {
1654
+ return { pass: true };
1655
+ }
1656
+ if (result === false) {
1657
+ return { pass: false };
1658
+ }
1659
+ if (is_hook_complex_result(result)) {
1660
+ return result;
1661
+ }
1662
+ throw new TypeError(`Unknown hook result type ${result}`);
1663
+ }
1664
+ else {
1665
+ return { pass: true };
1666
+ }
1667
+ }
1618
1668
  export { version, transfer_state_properties, Machine, make, wrap_parse as parse, compile, sm, from, arrow_direction, arrow_left_kind, arrow_right_kind,
1619
1669
  // WHARGARBL TODO these should be exported to a utility library
1620
- seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, shapes, gviz_shapes, named_colors };
1670
+ seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, shapes, gviz_shapes, named_colors, is_hook_rejection, is_hook_complex_result, abstract_hook_step };
@@ -198,12 +198,17 @@ declare type ExitHook<mDT> = {
198
198
  handler: HookHandler<mDT>;
199
199
  };
200
200
  declare type HookDescription<mDT> = BasicHookDescription<mDT> | HookDescriptionWithAction<mDT> | GlobalActionHook<mDT> | AnyActionHook<mDT> | StandardTransitionHook<mDT> | MainTransitionHook<mDT> | ForcedTransitionHook<mDT> | AnyTransitionHook<mDT> | EntryHook<mDT> | ExitHook<mDT>;
201
- declare type HookResult = true | false | undefined | void;
201
+ declare type HookComplexResult<mDT> = {
202
+ pass: boolean;
203
+ state?: StateType;
204
+ data?: mDT;
205
+ };
206
+ declare type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>;
202
207
  declare type HookContext<mDT> = {
203
208
  data: mDT;
204
209
  };
205
- declare type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult;
210
+ declare type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult<mDT>;
206
211
  declare type JssmErrorExtendedInfo = {
207
212
  requested_state?: StateType | undefined;
208
213
  };
209
- export { JssmColor, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmLayout, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirection, FslTheme, HookDescription, HookHandler, HookResult };
214
+ export { JssmColor, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmLayout, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult };
@@ -1,2 +1,2 @@
1
- const version = "5.72.2";
1
+ const version = "5.72.5";
2
2
  export { version };