jssm 5.65.12 → 5.66.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/dist/es6/jssm.js CHANGED
@@ -17,6 +17,8 @@ import { JssmError } from './jssm_error';
17
17
  * arrow_direction('<~=>'); // 'both'
18
18
  * ```
19
19
  *
20
+ * @param arrow The arrow to be evaluated
21
+ *
20
22
  */
21
23
  function arrow_direction(arrow) {
22
24
  switch (String(arrow)) {
@@ -85,6 +87,8 @@ function arrow_direction(arrow) {
85
87
  * arrow_left_kind('->'); // 'none'
86
88
  * ```
87
89
  *
90
+ * @param arrow The arrow to be evaluated
91
+ *
88
92
  */
89
93
  function arrow_left_kind(arrow) {
90
94
  switch (String(arrow)) {
@@ -142,6 +146,8 @@ function arrow_left_kind(arrow) {
142
146
  * arrow_left_kind('<-'); // 'none'
143
147
  * ```
144
148
  *
149
+ * @param arrow The arrow to be evaluated
150
+ *
145
151
  */
146
152
  function arrow_right_kind(arrow) {
147
153
  switch (String(arrow)) {
@@ -189,7 +195,12 @@ function arrow_right_kind(arrow) {
189
195
  * Internal method meant to perform factory assembly of an edge. Not meant for
190
196
  * external use.
191
197
  *
198
+ * @internal
199
+ *
200
+ * @typeparam mDT The type of the machine data member; usually omitted
201
+ *
192
202
  */
203
+ // TODO add at-param to docblock
193
204
  function makeTransition(this_se, from, to, isRight, _wasList, _wasIndex) {
194
205
  const kind = isRight ? arrow_right_kind(this_se.kind) : arrow_left_kind(this_se.kind), edge = {
195
206
  from,
@@ -272,6 +283,10 @@ function makeTransition(this_se, from, to, isRight, _wasList, _wasIndex) {
272
283
  * `wrap_parse` itself is an internal convenience method for alting out an
273
284
  * object as the options call. Not generally meant for external use.
274
285
  *
286
+ * @param input The FSL code to be evaluated
287
+ *
288
+ * @param options Things to control about the instance
289
+ *
275
290
  */
276
291
  function wrap_parse(input, options) {
277
292
  return parse(input, options || {});
@@ -281,6 +296,10 @@ function wrap_parse(input, options) {
281
296
  * Internal method performing one step in compiling rules for transitions. Not
282
297
  * generally meant for external use.
283
298
  *
299
+ * @internal
300
+ *
301
+ * @typeparam mDT The type of the machine data member; usually omitted
302
+ *
284
303
  */
285
304
  function compile_rule_transition_step(acc, from, to, this_se, next_se) {
286
305
  const edges = [];
@@ -310,6 +329,8 @@ function compile_rule_transition_step(acc, from, to, this_se, next_se) {
310
329
  * Internal method performing one step in compiling rules for transitions. Not
311
330
  * generally meant for external use.
312
331
  *
332
+ * @internal
333
+ *
313
334
  */
314
335
  function compile_rule_handle_transition(rule) {
315
336
  return compile_rule_transition_step([], rule.from, rule.se.to, rule.se, rule.se.se);
@@ -319,6 +340,8 @@ function compile_rule_handle_transition(rule) {
319
340
  * Internal method performing one step in compiling rules for transitions. Not
320
341
  * generally meant for external use.
321
342
  *
343
+ * @internal
344
+ *
322
345
  */
323
346
  function compile_rule_handler(rule) {
324
347
  if (rule.key === 'transition') {
@@ -394,6 +417,10 @@ function compile_rule_handler(rule) {
394
417
  * const toggle = jssm.from('up <=> down;');
395
418
  * ```
396
419
  *
420
+ * @typeparam mDT The type of the machine data member; usually omitted
421
+ *
422
+ * @param tree The parse tree to be boiled down into a machine config
423
+ *
397
424
  */
398
425
  function compile(tree) {
399
426
  const results = {
@@ -458,6 +485,10 @@ function compile(tree) {
458
485
  * Not generally meant for external use. Please see {@link compile} or
459
486
  * {@link sm}.
460
487
  *
488
+ * @typeparam mDT The type of the machine data member; usually omitted
489
+ *
490
+ * @param plan The FSL code to be evaluated and built into a machine config
491
+ *
461
492
  */
462
493
  function make(plan) {
463
494
  return compile(wrap_parse(plan));
@@ -468,6 +499,8 @@ function make(plan) {
468
499
  * a single multi-faceted declaration, in the process of building a state. Not
469
500
  * generally meant for external use.
470
501
  *
502
+ * @internal
503
+ *
471
504
  */
472
505
  function transfer_state_properties(state_decl) {
473
506
  state_decl.declarations.map((d) => {
@@ -498,6 +531,7 @@ function transfer_state_properties(state_decl) {
498
531
  });
499
532
  return state_decl;
500
533
  }
534
+ // TODO add a lotta docblock here
501
535
  class Machine {
502
536
  // whargarbl this badly needs to be broken up, monolith master
503
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 }) {
@@ -647,6 +681,8 @@ class Machine {
647
681
  *
648
682
  * Internal method for fabricating states. Not meant for external use.
649
683
  *
684
+ * @internal
685
+ *
650
686
  */
651
687
  _new_state(state_config) {
652
688
  if (this._states.has(state_config.name)) {
@@ -669,6 +705,8 @@ class Machine {
669
705
  * console.log( switch.state() ); // 'off'
670
706
  * ```
671
707
  *
708
+ * @typeparam mDT The type of the machine data member; usually omitted
709
+ *
672
710
  */
673
711
  state() {
674
712
  return this._state;
@@ -694,6 +732,10 @@ class Machine {
694
732
  * console.log( final_test.state_is_final('second') ); // true
695
733
  * ```
696
734
  *
735
+ * @typeparam mDT The type of the machine data member; usually omitted
736
+ *
737
+ * @param whichState The name of the state to check for finality
738
+ *
697
739
  */
698
740
  state_is_final(whichState) {
699
741
  return ((this.state_is_terminal(whichState)) && (this.state_is_complete(whichState)));
@@ -713,6 +755,8 @@ class Machine {
713
755
  * console.log( final_test.is_final() ); // true
714
756
  * ```
715
757
  *
758
+ * @typeparam mDT The type of the machine data member; usually omitted
759
+ *
716
760
  */
717
761
  is_final() {
718
762
  // return ((!this.is_changing()) && this.state_is_final(this.state()));
@@ -790,6 +834,8 @@ class Machine {
790
834
  * console.log( switch.states() ); // ['on', 'off']
791
835
  * ```
792
836
  *
837
+ * @typeparam mDT The type of the machine data member; usually omitted
838
+ *
793
839
  */
794
840
  states() {
795
841
  return Array.from(this._states.keys());
@@ -816,6 +862,10 @@ class Machine {
816
862
  * console.log( switch.has_state('dance') ); // false
817
863
  * ```
818
864
  *
865
+ * @typeparam mDT The type of the machine data member; usually omitted
866
+ *
867
+ * @param whichState The state to be checked for extance
868
+ *
819
869
  */
820
870
  has_state(whichState) {
821
871
  return this._states.get(whichState) !== undefined;
@@ -850,6 +900,8 @@ class Machine {
850
900
  * ]
851
901
  * ```
852
902
  *
903
+ * @typeparam mDT The type of the machine data member; usually omitted
904
+ *
853
905
  */
854
906
  list_edges() {
855
907
  return this._edges;
@@ -894,6 +946,10 @@ class Machine {
894
946
  * light.list_transitions(); // { entrances: [ 'yellow', 'off' ], exits: [ 'green', 'off' ] }
895
947
  * ```
896
948
  *
949
+ * @typeparam mDT The type of the machine data member; usually omitted
950
+ *
951
+ * @param whichState The state whose transitions to have listed
952
+ *
897
953
  */
898
954
  list_transitions(whichState = this.state()) {
899
955
  return { entrances: this.list_entrances(whichState), exits: this.list_exits(whichState) };
@@ -912,6 +968,10 @@ class Machine {
912
968
  * light.list_entrances(); // [ 'yellow', 'off' ]
913
969
  * ```
914
970
  *
971
+ * @typeparam mDT The type of the machine data member; usually omitted
972
+ *
973
+ * @param whichState The state whose entrances to have listed
974
+ *
915
975
  */
916
976
  list_entrances(whichState = this.state()) {
917
977
  return (this._states.get(whichState)
@@ -932,6 +992,10 @@ class Machine {
932
992
  * light.list_exits(); // [ 'green', 'off' ]
933
993
  * ```
934
994
  *
995
+ * @typeparam mDT The type of the machine data member; usually omitted
996
+ *
997
+ * @param whichState The state whose exits to have listed
998
+ *
935
999
  */
936
1000
  list_exits(whichState = this.state()) {
937
1001
  return (this._states.get(whichState)
@@ -993,6 +1057,10 @@ class Machine {
993
1057
  * console.log( machine.actions() ); // logs ['next', 'shutdown']
994
1058
  * ```
995
1059
  *
1060
+ * @typeparam mDT The type of the machine data member; usually omitted
1061
+ *
1062
+ * @param whichState The state whose actions to have listed
1063
+ *
996
1064
  */
997
1065
  actions(whichState = this.state()) {
998
1066
  const wstate = this._reverse_actions.get(whichState);
@@ -1020,6 +1088,10 @@ class Machine {
1020
1088
  * console.log( machine.list_states_having_action('start') ); // ['off']
1021
1089
  * ```
1022
1090
  *
1091
+ * @typeparam mDT The type of the machine data member; usually omitted
1092
+ *
1093
+ * @param whichState The action to be checked for associated states
1094
+ *
1023
1095
  */
1024
1096
  list_states_having_action(whichState) {
1025
1097
  const wstate = this._actions.get(whichState);
@@ -1360,6 +1432,12 @@ class Machine {
1360
1432
  * light.state(); // 'green'
1361
1433
  * ```
1362
1434
  *
1435
+ * @typeparam mDT The type of the machine data member; usually omitted
1436
+ *
1437
+ * @param actionName The action to engage
1438
+ *
1439
+ * @param newData The data change to insert during the action
1440
+ *
1363
1441
  */
1364
1442
  action(actionName, newData) {
1365
1443
  return this.transition_impl(actionName, newData, false, true);
@@ -1376,6 +1454,12 @@ class Machine {
1376
1454
  * light.state(); // 'green'
1377
1455
  * ```
1378
1456
  *
1457
+ * @typeparam mDT The type of the machine data member; usually omitted
1458
+ *
1459
+ * @param newState The state to switch to
1460
+ *
1461
+ * @param newData The data change to insert during the transition
1462
+ *
1379
1463
  */
1380
1464
  transition(newState, newData) {
1381
1465
  return this.transition_impl(newState, newData, false, false);
@@ -1395,6 +1479,12 @@ class Machine {
1395
1479
  * light.state(); // 'off'
1396
1480
  * ```
1397
1481
  *
1482
+ * @typeparam mDT The type of the machine data member; usually omitted
1483
+ *
1484
+ * @param newState The state to switch to
1485
+ *
1486
+ * @param newData The data change to insert during the transition
1487
+ *
1398
1488
  */
1399
1489
  force_transition(newState, newData) {
1400
1490
  return this.transition_impl(newState, newData, true, false);
@@ -1459,6 +1549,12 @@ class Machine {
1459
1549
  * const switch = jssm.from('on <=> off;');
1460
1550
  * ```
1461
1551
  *
1552
+ * @typeparam mDT The type of the machine data member; usually omitted
1553
+ *
1554
+ * @param template_strings The assembled code
1555
+ *
1556
+ * @param remainder The mechanic for template argument insertion
1557
+ *
1462
1558
  */
1463
1559
  function sm(template_strings, ...remainder /* , arguments */) {
1464
1560
  // foo`a${1}b${2}c` will come in as (['a','b','c'],1,2)
@@ -1488,6 +1584,12 @@ function sm(template_strings, ...remainder /* , arguments */) {
1488
1584
  * const switch = jssm.from('on <=> off;');
1489
1585
  * ```
1490
1586
  *
1587
+ * @typeparam mDT The type of the machine data member; usually omitted
1588
+ *
1589
+ * @param MachineAsString The FSL code to evaluate
1590
+ *
1591
+ * @param ExtraConstructorFields Extra non-code configuration to pass at creation time
1592
+ *
1491
1593
  */
1492
1594
  function from(MachineAsString, ExtraConstructorFields) {
1493
1595
  const to_decorate = make(MachineAsString);
@@ -1,2 +1,2 @@
1
- const version = "5.65.12";
1
+ const version = "5.66.0";
2
2
  export { version };