jssm 5.162.13 → 5.162.16

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/jssm.es5.d.cts CHANGED
@@ -15,12 +15,18 @@ type JssmColor = string;
15
15
  */
16
16
  type JssmPermittedOpt = 'required' | 'disallowed' | 'optional';
17
17
  /**
18
- * The set of ASCII arrow tokens recognized by the FSL grammar. Each arrow
19
- * encodes a direction (one-way left/right, or two-way) and a "kind" for
18
+ * Every arrow token recognized by the FSL grammar — all 42 spellings. Each
19
+ * arrow encodes a direction (one-way left/right, or two-way) and a "kind" for
20
20
  * each direction (`-` legal, `=` main path, `~` forced-only). See the
21
21
  * Language Reference docs for the full semantic table.
22
+ *
23
+ * Every arrow has an ASCII spelling and a unicode spelling, and each half of a
24
+ * two-way arrow may be spelled independently, so the two-way arrows also have
25
+ * mixed ASCII/unicode spellings (`←=>`, `<-⇒`, and so on). All of them are
26
+ * accepted, by the grammar and by {@link arrow_direction},
27
+ * {@link arrow_left_kind}, and {@link arrow_right_kind}.
22
28
  */
23
- type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>';
29
+ type JssmArrow = '->' | '' | '=>' | '' | '~>' | '' | '<-' | '←' | '<=' | '' | '<~' | '' | '<->' | '' | '<=>' | '⇔' | '<~>' | '↮' | '<-=>' | '←⇒' | '←=>' | '<-⇒' | '<-~>' | '←↛' | '←~>' | '<-↛' | '<=->' | '⇐→' | '⇐->' | '<=→' | '<=~>' | '⇐↛' | '⇐~>' | '<=↛' | '<~->' | '↚→' | '↚->' | '<~→' | '<~=>' | '↚⇒' | '↚=>' | '<~⇒';
24
30
  /**
25
31
  * A type teaching Typescript the various supported shapes for nodes, mostly inherited from GraphViz
26
32
  */
@@ -651,8 +657,22 @@ type JssmGenericConfig<StateType, DataType> = {
651
657
  state_hooks?: JssmStateHooks;
652
658
  rng_seed?: number | undefined;
653
659
  time_source?: () => number;
654
- timeout_source?: (Function: any, number: any) => number;
655
- clear_timeout_source?: (number: any) => void;
660
+ /**
661
+ * Schedules `fn` to run after `delay_ms`, and returns a handle that will be
662
+ * handed back to `clear_timeout_source` untouched. Defaults to `setTimeout`.
663
+ *
664
+ * The handle is typed `number` — the browser shape. Node's `setTimeout`
665
+ * returns a `Timeout` object instead, so a Node-shaped source casts it (as
666
+ * jssm's own `DEFAULT_TIMEOUT_SOURCE` does); jssm never inspects the handle,
667
+ * it only stores it and gives it back.
668
+ *
669
+ * (Before 5.162.14 these read `(Function, number) => number`, in which
670
+ * `Function` and `number` were *parameter names*, not types — so both
671
+ * parameters were silently `any`.)
672
+ */
673
+ timeout_source?: (fn: () => void, delay_ms: number) => number;
674
+ /** Cancels a timer previously scheduled by `timeout_source`. Defaults to `clearTimeout`. */
675
+ clear_timeout_source?: (handle: number) => void;
656
676
  };
657
677
  /**
658
678
  * Internal compiler intermediate: one link in a chained transition
@@ -665,7 +685,15 @@ type JssmGenericConfig<StateType, DataType> = {
665
685
  type JssmCompileSe<StateType, mDT> = {
666
686
  to: StateType;
667
687
  se?: JssmCompileSe<StateType, mDT>;
668
- kind: JssmArrow;
688
+ /**
689
+ * The arrow token as the parser emitted it. Deliberately `string` and not
690
+ * {@link JssmArrow}: this internal intermediate flows through the whole
691
+ * compiler, and threading a 42-member string-literal union through that much
692
+ * control-flow analysis overflows `tsc`'s stack (it type-checks standalone
693
+ * but dies under `npm run make`). The value *is* a `JssmArrow` — the two
694
+ * places that care re-assert it on the way into the arrow classifiers.
695
+ */
696
+ kind: string;
669
697
  l_action?: StateType;
670
698
  r_action?: StateType;
671
699
  l_probability: number;
@@ -940,10 +968,33 @@ type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>;
940
968
  * the payload that will be committed if the transition is accepted —
941
969
  * handlers may inspect or mutate the latter via a
942
970
  * {@link HookComplexResult} return value.
971
+ *
972
+ * The remaining fields describe the transition the hook is firing on. They
973
+ * are optional because a handler is not obliged to care about them, but the
974
+ * transition path always supplies all of them; `action` is `undefined` when
975
+ * the transition was not driven by an action.
943
976
  */
944
977
  type HookContext<mDT> = {
945
978
  data: mDT;
946
979
  next_data: mDT;
980
+ /** The state being left. */
981
+ from?: string;
982
+ /** The state being entered. */
983
+ to?: string;
984
+ /** The action that drove the transition, or `undefined` if none did. */
985
+ action?: string;
986
+ /** Whether this transition came from `force_transition` rather than `transition`. */
987
+ forced?: boolean;
988
+ /**
989
+ * Which arrow kind the traversed edge carries — `legal`, `main`, or `forced`.
990
+ *
991
+ * Populated **only when a transition-kind hook is installed** (a standard,
992
+ * main, or forced transition hook, or their post- equivalents). With no such
993
+ * hook registered there is nothing to switch on, so jssm skips resolving the
994
+ * edge's kind and this is `undefined`. Install `hook_standard_transition`
995
+ * (or a sibling) if a general handler needs to read it.
996
+ */
997
+ trans_type?: JssmArrowKind;
947
998
  };
948
999
  /**
949
1000
  * Context object passed to "everything" hooks ({@link EverythingHookHandler}
@@ -1717,7 +1768,7 @@ declare function make<StateType, mDT>(plan: string): JssmGenericConfig<StateType
1717
1768
  * @throws {TypeError} If `options` is not a non-empty array of objects.
1718
1769
  *
1719
1770
  */
1720
- declare const weighted_rand_select: (options: Array<any>, probability_property: string, rng: JssmRng) => any;
1771
+ declare const weighted_rand_select: (options: Array<any>, probability_property?: string, rng?: JssmRng) => any;
1721
1772
  /*******
1722
1773
  *
1723
1774
  * Returns, for a non-negative integer argument `n`, the series `[0 .. n]`.
package/jssm.es6.d.ts CHANGED
@@ -15,12 +15,18 @@ type JssmColor = string;
15
15
  */
16
16
  type JssmPermittedOpt = 'required' | 'disallowed' | 'optional';
17
17
  /**
18
- * The set of ASCII arrow tokens recognized by the FSL grammar. Each arrow
19
- * encodes a direction (one-way left/right, or two-way) and a "kind" for
18
+ * Every arrow token recognized by the FSL grammar — all 42 spellings. Each
19
+ * arrow encodes a direction (one-way left/right, or two-way) and a "kind" for
20
20
  * each direction (`-` legal, `=` main path, `~` forced-only). See the
21
21
  * Language Reference docs for the full semantic table.
22
+ *
23
+ * Every arrow has an ASCII spelling and a unicode spelling, and each half of a
24
+ * two-way arrow may be spelled independently, so the two-way arrows also have
25
+ * mixed ASCII/unicode spellings (`←=>`, `<-⇒`, and so on). All of them are
26
+ * accepted, by the grammar and by {@link arrow_direction},
27
+ * {@link arrow_left_kind}, and {@link arrow_right_kind}.
22
28
  */
23
- type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>';
29
+ type JssmArrow = '->' | '' | '=>' | '' | '~>' | '' | '<-' | '←' | '<=' | '' | '<~' | '' | '<->' | '' | '<=>' | '⇔' | '<~>' | '↮' | '<-=>' | '←⇒' | '←=>' | '<-⇒' | '<-~>' | '←↛' | '←~>' | '<-↛' | '<=->' | '⇐→' | '⇐->' | '<=→' | '<=~>' | '⇐↛' | '⇐~>' | '<=↛' | '<~->' | '↚→' | '↚->' | '<~→' | '<~=>' | '↚⇒' | '↚=>' | '<~⇒';
24
30
  /**
25
31
  * A type teaching Typescript the various supported shapes for nodes, mostly inherited from GraphViz
26
32
  */
@@ -651,8 +657,22 @@ type JssmGenericConfig<StateType, DataType> = {
651
657
  state_hooks?: JssmStateHooks;
652
658
  rng_seed?: number | undefined;
653
659
  time_source?: () => number;
654
- timeout_source?: (Function: any, number: any) => number;
655
- clear_timeout_source?: (number: any) => void;
660
+ /**
661
+ * Schedules `fn` to run after `delay_ms`, and returns a handle that will be
662
+ * handed back to `clear_timeout_source` untouched. Defaults to `setTimeout`.
663
+ *
664
+ * The handle is typed `number` — the browser shape. Node's `setTimeout`
665
+ * returns a `Timeout` object instead, so a Node-shaped source casts it (as
666
+ * jssm's own `DEFAULT_TIMEOUT_SOURCE` does); jssm never inspects the handle,
667
+ * it only stores it and gives it back.
668
+ *
669
+ * (Before 5.162.14 these read `(Function, number) => number`, in which
670
+ * `Function` and `number` were *parameter names*, not types — so both
671
+ * parameters were silently `any`.)
672
+ */
673
+ timeout_source?: (fn: () => void, delay_ms: number) => number;
674
+ /** Cancels a timer previously scheduled by `timeout_source`. Defaults to `clearTimeout`. */
675
+ clear_timeout_source?: (handle: number) => void;
656
676
  };
657
677
  /**
658
678
  * Internal compiler intermediate: one link in a chained transition
@@ -665,7 +685,15 @@ type JssmGenericConfig<StateType, DataType> = {
665
685
  type JssmCompileSe<StateType, mDT> = {
666
686
  to: StateType;
667
687
  se?: JssmCompileSe<StateType, mDT>;
668
- kind: JssmArrow;
688
+ /**
689
+ * The arrow token as the parser emitted it. Deliberately `string` and not
690
+ * {@link JssmArrow}: this internal intermediate flows through the whole
691
+ * compiler, and threading a 42-member string-literal union through that much
692
+ * control-flow analysis overflows `tsc`'s stack (it type-checks standalone
693
+ * but dies under `npm run make`). The value *is* a `JssmArrow` — the two
694
+ * places that care re-assert it on the way into the arrow classifiers.
695
+ */
696
+ kind: string;
669
697
  l_action?: StateType;
670
698
  r_action?: StateType;
671
699
  l_probability: number;
@@ -940,10 +968,33 @@ type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>;
940
968
  * the payload that will be committed if the transition is accepted —
941
969
  * handlers may inspect or mutate the latter via a
942
970
  * {@link HookComplexResult} return value.
971
+ *
972
+ * The remaining fields describe the transition the hook is firing on. They
973
+ * are optional because a handler is not obliged to care about them, but the
974
+ * transition path always supplies all of them; `action` is `undefined` when
975
+ * the transition was not driven by an action.
943
976
  */
944
977
  type HookContext<mDT> = {
945
978
  data: mDT;
946
979
  next_data: mDT;
980
+ /** The state being left. */
981
+ from?: string;
982
+ /** The state being entered. */
983
+ to?: string;
984
+ /** The action that drove the transition, or `undefined` if none did. */
985
+ action?: string;
986
+ /** Whether this transition came from `force_transition` rather than `transition`. */
987
+ forced?: boolean;
988
+ /**
989
+ * Which arrow kind the traversed edge carries — `legal`, `main`, or `forced`.
990
+ *
991
+ * Populated **only when a transition-kind hook is installed** (a standard,
992
+ * main, or forced transition hook, or their post- equivalents). With no such
993
+ * hook registered there is nothing to switch on, so jssm skips resolving the
994
+ * edge's kind and this is `undefined`. Install `hook_standard_transition`
995
+ * (or a sibling) if a general handler needs to read it.
996
+ */
997
+ trans_type?: JssmArrowKind;
947
998
  };
948
999
  /**
949
1000
  * Context object passed to "everything" hooks ({@link EverythingHookHandler}
@@ -1717,7 +1768,7 @@ declare function make<StateType, mDT>(plan: string): JssmGenericConfig<StateType
1717
1768
  * @throws {TypeError} If `options` is not a non-empty array of objects.
1718
1769
  *
1719
1770
  */
1720
- declare const weighted_rand_select: (options: Array<any>, probability_property: string, rng: JssmRng) => any;
1771
+ declare const weighted_rand_select: (options: Array<any>, probability_property?: string, rng?: JssmRng) => any;
1721
1772
  /*******
1722
1773
  *
1723
1774
  * Returns, for a non-negative integer argument `n`, the series `[0 .. n]`.
package/jssm.fence.d.ts CHANGED
@@ -155,13 +155,6 @@ type JssmColor = string;
155
155
  * is meaningful (for example, the `actions` config key).
156
156
  */
157
157
  type JssmPermittedOpt = 'required' | 'disallowed' | 'optional';
158
- /**
159
- * The set of ASCII arrow tokens recognized by the FSL grammar. Each arrow
160
- * encodes a direction (one-way left/right, or two-way) and a "kind" for
161
- * each direction (`-` legal, `=` main path, `~` forced-only). See the
162
- * Language Reference docs for the full semantic table.
163
- */
164
- type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>';
165
158
  /**
166
159
  * A type teaching Typescript the various supported shapes for nodes, mostly inherited from GraphViz
167
160
  */
@@ -761,8 +754,22 @@ type JssmGenericConfig<StateType, DataType> = {
761
754
  state_hooks?: JssmStateHooks;
762
755
  rng_seed?: number | undefined;
763
756
  time_source?: () => number;
764
- timeout_source?: (Function: any, number: any) => number;
765
- clear_timeout_source?: (number: any) => void;
757
+ /**
758
+ * Schedules `fn` to run after `delay_ms`, and returns a handle that will be
759
+ * handed back to `clear_timeout_source` untouched. Defaults to `setTimeout`.
760
+ *
761
+ * The handle is typed `number` — the browser shape. Node's `setTimeout`
762
+ * returns a `Timeout` object instead, so a Node-shaped source casts it (as
763
+ * jssm's own `DEFAULT_TIMEOUT_SOURCE` does); jssm never inspects the handle,
764
+ * it only stores it and gives it back.
765
+ *
766
+ * (Before 5.162.14 these read `(Function, number) => number`, in which
767
+ * `Function` and `number` were *parameter names*, not types — so both
768
+ * parameters were silently `any`.)
769
+ */
770
+ timeout_source?: (fn: () => void, delay_ms: number) => number;
771
+ /** Cancels a timer previously scheduled by `timeout_source`. Defaults to `clearTimeout`. */
772
+ clear_timeout_source?: (handle: number) => void;
766
773
  };
767
774
  /**
768
775
  * Internal compiler intermediate: one link in a chained transition
@@ -775,7 +782,15 @@ type JssmGenericConfig<StateType, DataType> = {
775
782
  type JssmCompileSe<StateType, mDT> = {
776
783
  to: StateType;
777
784
  se?: JssmCompileSe<StateType, mDT>;
778
- kind: JssmArrow;
785
+ /**
786
+ * The arrow token as the parser emitted it. Deliberately `string` and not
787
+ * {@link JssmArrow}: this internal intermediate flows through the whole
788
+ * compiler, and threading a 42-member string-literal union through that much
789
+ * control-flow analysis overflows `tsc`'s stack (it type-checks standalone
790
+ * but dies under `npm run make`). The value *is* a `JssmArrow` — the two
791
+ * places that care re-assert it on the way into the arrow classifiers.
792
+ */
793
+ kind: string;
779
794
  l_action?: StateType;
780
795
  r_action?: StateType;
781
796
  l_probability: number;
@@ -1021,10 +1036,33 @@ type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>;
1021
1036
  * the payload that will be committed if the transition is accepted —
1022
1037
  * handlers may inspect or mutate the latter via a
1023
1038
  * {@link HookComplexResult} return value.
1039
+ *
1040
+ * The remaining fields describe the transition the hook is firing on. They
1041
+ * are optional because a handler is not obliged to care about them, but the
1042
+ * transition path always supplies all of them; `action` is `undefined` when
1043
+ * the transition was not driven by an action.
1024
1044
  */
1025
1045
  type HookContext<mDT> = {
1026
1046
  data: mDT;
1027
1047
  next_data: mDT;
1048
+ /** The state being left. */
1049
+ from?: string;
1050
+ /** The state being entered. */
1051
+ to?: string;
1052
+ /** The action that drove the transition, or `undefined` if none did. */
1053
+ action?: string;
1054
+ /** Whether this transition came from `force_transition` rather than `transition`. */
1055
+ forced?: boolean;
1056
+ /**
1057
+ * Which arrow kind the traversed edge carries — `legal`, `main`, or `forced`.
1058
+ *
1059
+ * Populated **only when a transition-kind hook is installed** (a standard,
1060
+ * main, or forced transition hook, or their post- equivalents). With no such
1061
+ * hook registered there is nothing to switch on, so jssm skips resolving the
1062
+ * edge's kind and this is `undefined`. Install `hook_standard_transition`
1063
+ * (or a sibling) if a general handler needs to read it.
1064
+ */
1065
+ trans_type?: JssmArrowKind;
1028
1066
  };
1029
1067
  /**
1030
1068
  * Context object passed to "everything" hooks ({@link EverythingHookHandler}
@@ -14,13 +14,6 @@ type JssmColor = string;
14
14
  * is meaningful (for example, the `actions` config key).
15
15
  */
16
16
  type JssmPermittedOpt = 'required' | 'disallowed' | 'optional';
17
- /**
18
- * The set of ASCII arrow tokens recognized by the FSL grammar. Each arrow
19
- * encodes a direction (one-way left/right, or two-way) and a "kind" for
20
- * each direction (`-` legal, `=` main path, `~` forced-only). See the
21
- * Language Reference docs for the full semantic table.
22
- */
23
- type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>';
24
17
  /**
25
18
  * A type teaching Typescript the various supported shapes for nodes, mostly inherited from GraphViz
26
19
  */
@@ -620,8 +613,22 @@ type JssmGenericConfig<StateType, DataType> = {
620
613
  state_hooks?: JssmStateHooks;
621
614
  rng_seed?: number | undefined;
622
615
  time_source?: () => number;
623
- timeout_source?: (Function: any, number: any) => number;
624
- clear_timeout_source?: (number: any) => void;
616
+ /**
617
+ * Schedules `fn` to run after `delay_ms`, and returns a handle that will be
618
+ * handed back to `clear_timeout_source` untouched. Defaults to `setTimeout`.
619
+ *
620
+ * The handle is typed `number` — the browser shape. Node's `setTimeout`
621
+ * returns a `Timeout` object instead, so a Node-shaped source casts it (as
622
+ * jssm's own `DEFAULT_TIMEOUT_SOURCE` does); jssm never inspects the handle,
623
+ * it only stores it and gives it back.
624
+ *
625
+ * (Before 5.162.14 these read `(Function, number) => number`, in which
626
+ * `Function` and `number` were *parameter names*, not types — so both
627
+ * parameters were silently `any`.)
628
+ */
629
+ timeout_source?: (fn: () => void, delay_ms: number) => number;
630
+ /** Cancels a timer previously scheduled by `timeout_source`. Defaults to `clearTimeout`. */
631
+ clear_timeout_source?: (handle: number) => void;
625
632
  };
626
633
  /**
627
634
  * Internal compiler intermediate: one link in a chained transition
@@ -634,7 +641,15 @@ type JssmGenericConfig<StateType, DataType> = {
634
641
  type JssmCompileSe<StateType, mDT> = {
635
642
  to: StateType;
636
643
  se?: JssmCompileSe<StateType, mDT>;
637
- kind: JssmArrow;
644
+ /**
645
+ * The arrow token as the parser emitted it. Deliberately `string` and not
646
+ * {@link JssmArrow}: this internal intermediate flows through the whole
647
+ * compiler, and threading a 42-member string-literal union through that much
648
+ * control-flow analysis overflows `tsc`'s stack (it type-checks standalone
649
+ * but dies under `npm run make`). The value *is* a `JssmArrow` — the two
650
+ * places that care re-assert it on the way into the arrow classifiers.
651
+ */
652
+ kind: string;
638
653
  l_action?: StateType;
639
654
  r_action?: StateType;
640
655
  l_probability: number;
@@ -880,10 +895,33 @@ type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>;
880
895
  * the payload that will be committed if the transition is accepted —
881
896
  * handlers may inspect or mutate the latter via a
882
897
  * {@link HookComplexResult} return value.
898
+ *
899
+ * The remaining fields describe the transition the hook is firing on. They
900
+ * are optional because a handler is not obliged to care about them, but the
901
+ * transition path always supplies all of them; `action` is `undefined` when
902
+ * the transition was not driven by an action.
883
903
  */
884
904
  type HookContext<mDT> = {
885
905
  data: mDT;
886
906
  next_data: mDT;
907
+ /** The state being left. */
908
+ from?: string;
909
+ /** The state being entered. */
910
+ to?: string;
911
+ /** The action that drove the transition, or `undefined` if none did. */
912
+ action?: string;
913
+ /** Whether this transition came from `force_transition` rather than `transition`. */
914
+ forced?: boolean;
915
+ /**
916
+ * Which arrow kind the traversed edge carries — `legal`, `main`, or `forced`.
917
+ *
918
+ * Populated **only when a transition-kind hook is installed** (a standard,
919
+ * main, or forced transition hook, or their post- equivalents). With no such
920
+ * hook registered there is nothing to switch on, so jssm skips resolving the
921
+ * edge's kind and this is `undefined`. Install `hook_standard_transition`
922
+ * (or a sibling) if a general handler needs to read it.
923
+ */
924
+ trans_type?: JssmArrowKind;
887
925
  };
888
926
  /**
889
927
  * Context object passed to "everything" hooks ({@link EverythingHookHandler}
package/jssm_viz.es6.d.ts CHANGED
@@ -14,13 +14,6 @@ type JssmColor = string;
14
14
  * is meaningful (for example, the `actions` config key).
15
15
  */
16
16
  type JssmPermittedOpt = 'required' | 'disallowed' | 'optional';
17
- /**
18
- * The set of ASCII arrow tokens recognized by the FSL grammar. Each arrow
19
- * encodes a direction (one-way left/right, or two-way) and a "kind" for
20
- * each direction (`-` legal, `=` main path, `~` forced-only). See the
21
- * Language Reference docs for the full semantic table.
22
- */
23
- type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>';
24
17
  /**
25
18
  * A type teaching Typescript the various supported shapes for nodes, mostly inherited from GraphViz
26
19
  */
@@ -620,8 +613,22 @@ type JssmGenericConfig<StateType, DataType> = {
620
613
  state_hooks?: JssmStateHooks;
621
614
  rng_seed?: number | undefined;
622
615
  time_source?: () => number;
623
- timeout_source?: (Function: any, number: any) => number;
624
- clear_timeout_source?: (number: any) => void;
616
+ /**
617
+ * Schedules `fn` to run after `delay_ms`, and returns a handle that will be
618
+ * handed back to `clear_timeout_source` untouched. Defaults to `setTimeout`.
619
+ *
620
+ * The handle is typed `number` — the browser shape. Node's `setTimeout`
621
+ * returns a `Timeout` object instead, so a Node-shaped source casts it (as
622
+ * jssm's own `DEFAULT_TIMEOUT_SOURCE` does); jssm never inspects the handle,
623
+ * it only stores it and gives it back.
624
+ *
625
+ * (Before 5.162.14 these read `(Function, number) => number`, in which
626
+ * `Function` and `number` were *parameter names*, not types — so both
627
+ * parameters were silently `any`.)
628
+ */
629
+ timeout_source?: (fn: () => void, delay_ms: number) => number;
630
+ /** Cancels a timer previously scheduled by `timeout_source`. Defaults to `clearTimeout`. */
631
+ clear_timeout_source?: (handle: number) => void;
625
632
  };
626
633
  /**
627
634
  * Internal compiler intermediate: one link in a chained transition
@@ -634,7 +641,15 @@ type JssmGenericConfig<StateType, DataType> = {
634
641
  type JssmCompileSe<StateType, mDT> = {
635
642
  to: StateType;
636
643
  se?: JssmCompileSe<StateType, mDT>;
637
- kind: JssmArrow;
644
+ /**
645
+ * The arrow token as the parser emitted it. Deliberately `string` and not
646
+ * {@link JssmArrow}: this internal intermediate flows through the whole
647
+ * compiler, and threading a 42-member string-literal union through that much
648
+ * control-flow analysis overflows `tsc`'s stack (it type-checks standalone
649
+ * but dies under `npm run make`). The value *is* a `JssmArrow` — the two
650
+ * places that care re-assert it on the way into the arrow classifiers.
651
+ */
652
+ kind: string;
638
653
  l_action?: StateType;
639
654
  r_action?: StateType;
640
655
  l_probability: number;
@@ -880,10 +895,33 @@ type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>;
880
895
  * the payload that will be committed if the transition is accepted —
881
896
  * handlers may inspect or mutate the latter via a
882
897
  * {@link HookComplexResult} return value.
898
+ *
899
+ * The remaining fields describe the transition the hook is firing on. They
900
+ * are optional because a handler is not obliged to care about them, but the
901
+ * transition path always supplies all of them; `action` is `undefined` when
902
+ * the transition was not driven by an action.
883
903
  */
884
904
  type HookContext<mDT> = {
885
905
  data: mDT;
886
906
  next_data: mDT;
907
+ /** The state being left. */
908
+ from?: string;
909
+ /** The state being entered. */
910
+ to?: string;
911
+ /** The action that drove the transition, or `undefined` if none did. */
912
+ action?: string;
913
+ /** Whether this transition came from `force_transition` rather than `transition`. */
914
+ forced?: boolean;
915
+ /**
916
+ * Which arrow kind the traversed edge carries — `legal`, `main`, or `forced`.
917
+ *
918
+ * Populated **only when a transition-kind hook is installed** (a standard,
919
+ * main, or forced transition hook, or their post- equivalents). With no such
920
+ * hook registered there is nothing to switch on, so jssm skips resolving the
921
+ * edge's kind and this is `undefined`. Install `hook_standard_transition`
922
+ * (or a sibling) if a general handler needs to read it.
923
+ */
924
+ trans_type?: JssmArrowKind;
887
925
  };
888
926
  /**
889
927
  * Context object passed to "everything" hooks ({@link EverythingHookHandler}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jssm",
3
- "version": "5.162.13",
3
+ "version": "5.162.16",
4
4
  "engines": {
5
5
  "node": ">=10.0.0"
6
6
  },
@@ -191,8 +191,9 @@
191
191
  "test": "npm run make && npm run vitest",
192
192
  "make_cli": "rollup -c rollup.config.cli.js",
193
193
  "typecheck_cli": "tsc --noEmit -p tsconfig.cli.json",
194
- "min_cli": "terser dist/cli/fsl.cjs -o dist/cli/fsl.cjs --comments=/^#!/ && terser dist/cli/fsl-render.cjs -o dist/cli/fsl-render.cjs --comments=/^#!/ && terser dist/cli/lib.cjs -o dist/cli/lib.cjs && terser dist/cli/lib.mjs -o dist/cli/lib.mjs",
195
- "clean": "rm -rf dist && rm -rf docs && cd coverage && rm -rf cloc && cd .. && rm -f src/ts/fsl_parser.ts && rm -f src/ts/version.ts && rm -f src/ts/tests/generated/*.docex.ts && rm -f *.d.ts && mkdir dist && cd dist && mkdir wc && mkdir cdn && cd .. && mkdir docs && cd coverage && mkdir cloc && cd .. && rm -f ./src/tools/jssm.es5.iife.nonmin.js",
194
+ "typecheck_tests": "tsc --noEmit -p tsconfig.test.json",
195
+ "min_cli": "terser dist/cli/fsl.cjs -o dist/cli/fsl.cjs --comments=/^#!/ && terser dist/cli/fsl-render.cjs -o dist/cli/fsl-render.cjs --comments=/^#!/ && terser dist/cli/fsl-export-system-prompt.cjs -o dist/cli/fsl-export-system-prompt.cjs --comments=/^#!/ && terser dist/cli/lib.cjs -o dist/cli/lib.cjs && terser dist/cli/lib.mjs -o dist/cli/lib.mjs",
196
+ "clean": "rm -rf dist && rm -rf docs && rm -f tsconfig.tsbuildinfo && cd coverage && rm -rf cloc && cd .. && rm -f src/ts/fsl_parser.ts && rm -f src/ts/version.ts && rm -f src/ts/tests/generated/*.docex.ts && rm -f *.d.ts && mkdir dist && cd dist && mkdir wc && mkdir cdn && cd .. && mkdir docs && cd coverage && mkdir cloc && cd .. && rm -f ./src/tools/jssm.es5.iife.nonmin.js",
196
197
  "peg": "rm -f src/ts/fsl_parser.js && pegjs src/ts/fsl_parser.peg && node src/buildjs/fixparser.cjs",
197
198
  "build:cem": "custom-elements-manifest analyze --config custom-elements-manifest.config.mjs",
198
199
  "make_core": "rollup -c rollup.config.core.js",