jssm 5.75.1 → 5.77.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.
@@ -685,7 +685,7 @@ declare class Machine<mDT> {
685
685
  action(actionName: StateType, newData?: mDT): boolean;
686
686
  /********
687
687
  *
688
- * Instruct the machine to complete a transition.
688
+ * Instruct the machine to complete a transition. Synonym for {@link go}.
689
689
  *
690
690
  * ```typescript
691
691
  * const light = sm`red -> green -> yellow -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
@@ -703,6 +703,26 @@ declare class Machine<mDT> {
703
703
  *
704
704
  */
705
705
  transition(newState: StateType, newData?: mDT): boolean;
706
+ /********
707
+ *
708
+ * Instruct the machine to complete a transition. Synonym for {@link transition}.
709
+ *
710
+ * ```typescript
711
+ * const light = sm`red -> green -> yellow -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
712
+ *
713
+ * light.state(); // 'red'
714
+ * light.go('green'); // true
715
+ * light.state(); // 'green'
716
+ * ```
717
+ *
718
+ * @typeparam mDT The type of the machine data member; usually omitted
719
+ *
720
+ * @param newState The state to switch to
721
+ *
722
+ * @param newData The data change to insert during the transition
723
+ *
724
+ */
725
+ go(newState: StateType, newData?: mDT): boolean;
706
726
  /********
707
727
  *
708
728
  * Instruct the machine to complete a forced transition (which will reject if
package/dist/es6/jssm.js CHANGED
@@ -1052,7 +1052,8 @@ class Machine {
1052
1052
  if (!(wstate)) {
1053
1053
  throw new JssmError(this, `No such state ${JSON.stringify(whichState)} in probable_exits_for`);
1054
1054
  }
1055
- const wstate_to = wstate.to, wtf = wstate_to
1055
+ const wstate_to = wstate.to, wtf // wstate_to_filtered -> wtf
1056
+ = wstate_to
1056
1057
  .map((ws) => this.lookup_transition_for(this.state(), ws))
1057
1058
  .filter(Boolean);
1058
1059
  return wtf;
@@ -1745,7 +1746,7 @@ class Machine {
1745
1746
  }
1746
1747
  /********
1747
1748
  *
1748
- * Instruct the machine to complete a transition.
1749
+ * Instruct the machine to complete a transition. Synonym for {@link go}.
1749
1750
  *
1750
1751
  * ```typescript
1751
1752
  * const light = sm`red -> green -> yellow -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
@@ -1765,6 +1766,28 @@ class Machine {
1765
1766
  transition(newState, newData) {
1766
1767
  return this.transition_impl(newState, newData, false, false);
1767
1768
  }
1769
+ /********
1770
+ *
1771
+ * Instruct the machine to complete a transition. Synonym for {@link transition}.
1772
+ *
1773
+ * ```typescript
1774
+ * const light = sm`red -> green -> yellow -> red; [red yellow green] 'shutdown' ~> off 'start' -> red;`;
1775
+ *
1776
+ * light.state(); // 'red'
1777
+ * light.go('green'); // true
1778
+ * light.state(); // 'green'
1779
+ * ```
1780
+ *
1781
+ * @typeparam mDT The type of the machine data member; usually omitted
1782
+ *
1783
+ * @param newState The state to switch to
1784
+ *
1785
+ * @param newData The data change to insert during the transition
1786
+ *
1787
+ */
1788
+ go(newState, newData) {
1789
+ return this.transition_impl(newState, newData, false, false);
1790
+ }
1768
1791
  /********
1769
1792
  *
1770
1793
  * Instruct the machine to complete a forced transition (which will reject if
@@ -14,6 +14,9 @@ declare type JssmColor = string;
14
14
  declare type JssmPermitted = 'required' | 'disallowed';
15
15
  declare type JssmPermittedOpt = 'required' | 'disallowed' | 'optional';
16
16
  declare type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>';
17
+ /**
18
+ * A type teaching Typescript the various supported shapes for nodes, mostly inherited from GraphViz
19
+ */
17
20
  declare type JssmShape = "box" | "polygon" | "ellipse" | "oval" | "circle" | "point" | "egg" | "triangle" | "plaintext" | "plain" | "diamond" | "trapezium" | "parallelogram" | "house" | "pentagon" | "hexagon" | "septagon" | "octagon" | "doublecircle" | "doubleoctagon" | "tripleoctagon" | "invtriangle" | "invtrapezium" | "invhouse" | "Mdiamond" | "Msquare" | "Mcircle" | "rect" | "rectangle" | "square" | "star" | "none" | "underline" | "cylinder" | "note" | "tab" | "folder" | "box3d" | "component" | "promoter" | "cds" | "terminator" | "utr" | "primersite" | "restrictionsite" | "fivepoverhang" | "threepoverhang" | "noverhang" | "assembly" | "signature" | "insulator" | "ribosite" | "rnastab" | "proteasesite" | "proteinstab" | "rpromoter" | "rarrow" | "larrow" | "lpromoter" | "record";
18
21
  declare type JssmArrowDirection = 'left' | 'right' | 'both';
19
22
  declare type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced';
@@ -252,10 +255,7 @@ declare type HookComplexResult<mDT> = {
252
255
  state?: StateType;
253
256
  data?: mDT;
254
257
  };
255
- /********
256
- * Documents whether a hook succeeded, either with a primitive or a reference to the hook complex object
257
- */
258
- declare type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>;
258
+ declare type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>; /** Documents whether a hook succeeded, either with a primitive or a reference to the hook complex object */
259
259
  declare type HookContext<mDT> = {
260
260
  data: mDT;
261
261
  };
@@ -264,4 +264,4 @@ declare type PostHookHandler<mDT> = (hook_context: HookContext<mDT>) => void;
264
264
  declare type JssmErrorExtendedInfo = {
265
265
  requested_state?: StateType | undefined;
266
266
  };
267
- 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 };
267
+ export { JssmColor, JssmShape, 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 };
@@ -49,4 +49,12 @@ declare const hook_name: (from: string, to: string) => string;
49
49
  *
50
50
  */
51
51
  declare const named_hook_name: (from: string, to: string, action: string) => string;
52
- export { seq, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string, hook_name, named_hook_name };
52
+ /*******
53
+ *
54
+ * Creates a Mulberry32 random generator. Used by the randomness test suite.
55
+ *
56
+ * Sourced from `bryc` at StackOverflow: https://stackoverflow.com/a/47593316/763127
57
+ *
58
+ */
59
+ declare const make_mulberry_rand: (a?: number | undefined) => () => number;
60
+ export { seq, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string, hook_name, named_hook_name, make_mulberry_rand };
@@ -84,4 +84,20 @@ const hook_name = (from, to) => JSON.stringify([from, to]);
84
84
  *
85
85
  */
86
86
  const named_hook_name = (from, to, action) => JSON.stringify([from, to, action]);
87
- export { seq, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string, hook_name, named_hook_name };
87
+ /*******
88
+ *
89
+ * Creates a Mulberry32 random generator. Used by the randomness test suite.
90
+ *
91
+ * Sourced from `bryc` at StackOverflow: https://stackoverflow.com/a/47593316/763127
92
+ *
93
+ */
94
+ const make_mulberry_rand = (a) => () => {
95
+ if (a === undefined) {
96
+ a = new Date().getTime();
97
+ }
98
+ let t = a += 0x6D2B79F5;
99
+ t = Math.imul(t ^ t >>> 15, t | 1);
100
+ t ^= t + Math.imul(t ^ t >>> 7, t | 61);
101
+ return ((t ^ t >>> 14) >>> 0) / 4294967296;
102
+ };
103
+ export { seq, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string, hook_name, named_hook_name, make_mulberry_rand };
@@ -1,2 +1,2 @@
1
- const version = "5.75.1";
1
+ const version = "5.77.0";
2
2
  export { version };