jssm 5.112.4 → 5.118.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/README.md +7 -7
- package/dist/deno/README.md +7 -7
- package/dist/deno/jssm.d.ts +70 -5
- package/dist/deno/jssm.js +1 -1
- package/dist/deno/jssm_constants.d.ts +58 -1
- package/dist/deno/jssm_viz.d.ts +41 -6
- package/dist/deno/version.d.ts +13 -1
- package/dist/jssm.es5.cjs +1 -1
- package/dist/jssm.es5.iife.js +1 -1
- package/dist/jssm.es6.mjs +1 -1
- package/dist/jssm_viz.cjs +1 -1
- package/dist/jssm_viz.iife.cjs +1 -1
- package/dist/jssm_viz.mjs +1 -1
- package/jssm.es5.d.cts +143 -4
- package/jssm.es6.d.ts +143 -4
- package/jssm_viz.es5.d.cts +111 -9
- package/jssm_viz.es6.d.ts +111 -9
- package/package.json +1 -1
package/jssm.es5.d.cts
CHANGED
|
@@ -973,6 +973,63 @@ declare const shapes$1: string[];
|
|
|
973
973
|
*
|
|
974
974
|
*/
|
|
975
975
|
declare const named_colors$1: string[];
|
|
976
|
+
/*******
|
|
977
|
+
*
|
|
978
|
+
* Character ranges accepted by the FSL grammar for identifier and label
|
|
979
|
+
* tokens. Each entry is an inclusive `{from, to}` range of single Unicode
|
|
980
|
+
* characters. Single-character entries (e.g. `.`) appear with `from === to`.
|
|
981
|
+
*
|
|
982
|
+
* These are intended for tooling, validators, and editors that need to know
|
|
983
|
+
* which characters are legal in a given FSL token position without re-parsing
|
|
984
|
+
* the PEG grammar.
|
|
985
|
+
*
|
|
986
|
+
*/
|
|
987
|
+
/**
|
|
988
|
+
* Inclusive character ranges accepted by `AtomLetter` — i.e., the characters
|
|
989
|
+
* legal in any but the first position of an FSL state name (atom).
|
|
990
|
+
*
|
|
991
|
+
* Includes ASCII digits/letters and the symbols
|
|
992
|
+
* `.`, `+`, `_`, `^`, `(`, `)`, `*`, `&`, `$`, `#`, `@`, `!`, `?`, `,`,
|
|
993
|
+
* plus the high-Unicode range `U+0080`–`U+FFFF`.
|
|
994
|
+
*
|
|
995
|
+
* @example
|
|
996
|
+
* state_name_chars.some(r => 'A' >= r.from && 'A' <= r.to); // true
|
|
997
|
+
*/
|
|
998
|
+
declare const state_name_chars$1: ReadonlyArray<{
|
|
999
|
+
from: string;
|
|
1000
|
+
to: string;
|
|
1001
|
+
}>;
|
|
1002
|
+
/**
|
|
1003
|
+
* Inclusive character ranges accepted by `AtomFirstLetter` — i.e., the
|
|
1004
|
+
* characters legal in the first position of an FSL state name (atom).
|
|
1005
|
+
*
|
|
1006
|
+
* Notably narrower than {@link state_name_chars}: omits `+`, `(`, `)`, `&`,
|
|
1007
|
+
* `#`, `@`. Includes ASCII digits/letters, `.`, `_`, `!`, `$`, `^`, `*`,
|
|
1008
|
+
* `?`, `,`, and the high-Unicode range `U+0080`–`U+FFFF`.
|
|
1009
|
+
*
|
|
1010
|
+
* @example
|
|
1011
|
+
* state_name_first_chars.some(r => '+' >= r.from && '+' <= r.to); // false
|
|
1012
|
+
*/
|
|
1013
|
+
declare const state_name_first_chars$1: ReadonlyArray<{
|
|
1014
|
+
from: string;
|
|
1015
|
+
to: string;
|
|
1016
|
+
}>;
|
|
1017
|
+
/**
|
|
1018
|
+
* Inclusive character ranges accepted by `ActionLabelUnescaped` — i.e., the
|
|
1019
|
+
* characters legal inside a single-quoted action label without escaping.
|
|
1020
|
+
* Space (`U+0020`) is included; the apostrophe `'` (`U+0027`) is explicitly
|
|
1021
|
+
* excluded since it terminates the label.
|
|
1022
|
+
*
|
|
1023
|
+
* Three ranges: `U+0020`–`U+0026`, `U+0028`–`U+005B`, `U+005D`–`U+FFFF`.
|
|
1024
|
+
*
|
|
1025
|
+
* @example
|
|
1026
|
+
* action_label_chars.some(r => ' ' >= r.from && ' ' <= r.to); // true
|
|
1027
|
+
* action_label_chars.some(r => "'" >= r.from && "'" <= r.to); // false
|
|
1028
|
+
*/
|
|
1029
|
+
declare const action_label_chars$1: ReadonlyArray<{
|
|
1030
|
+
from: string;
|
|
1031
|
+
to: string;
|
|
1032
|
+
}>;
|
|
976
1033
|
|
|
977
1034
|
declare const jssm_constants_d_E: typeof E;
|
|
978
1035
|
declare const jssm_constants_d_Epsilon: typeof Epsilon;
|
|
@@ -1010,13 +1067,27 @@ declare namespace jssm_constants_d {
|
|
|
1010
1067
|
jssm_constants_d_PosInfinity as PosInfinity,
|
|
1011
1068
|
jssm_constants_d_Root2 as Root2,
|
|
1012
1069
|
jssm_constants_d_RootHalf as RootHalf,
|
|
1070
|
+
action_label_chars$1 as action_label_chars,
|
|
1013
1071
|
gviz_shapes$1 as gviz_shapes,
|
|
1014
1072
|
named_colors$1 as named_colors,
|
|
1015
1073
|
shapes$1 as shapes,
|
|
1074
|
+
state_name_chars$1 as state_name_chars,
|
|
1075
|
+
state_name_first_chars$1 as state_name_first_chars,
|
|
1016
1076
|
};
|
|
1017
1077
|
}
|
|
1018
1078
|
|
|
1079
|
+
/**
|
|
1080
|
+
* The published semantic version of the jssm package this build was cut from.
|
|
1081
|
+
* Mirrored from `package.json` by `src/buildjs/makever.cjs` at build time.
|
|
1082
|
+
* Useful for runtime diagnostics and for embedding in serialized machine
|
|
1083
|
+
* snapshots so that deserializers can detect version-skew.
|
|
1084
|
+
*/
|
|
1019
1085
|
declare const version: string;
|
|
1086
|
+
/**
|
|
1087
|
+
* The Unix epoch timestamp (in milliseconds) at which this build was produced,
|
|
1088
|
+
* written by `src/buildjs/makever.cjs`. Useful for distinguishing builds
|
|
1089
|
+
* with the same `version` string during development, and for diagnostic logs.
|
|
1090
|
+
*/
|
|
1020
1091
|
declare const build_time: number;
|
|
1021
1092
|
|
|
1022
1093
|
declare type StateType = string;
|
|
@@ -1024,6 +1095,18 @@ declare type StateType = string;
|
|
|
1024
1095
|
declare const shapes: string[];
|
|
1025
1096
|
declare const gviz_shapes: string[];
|
|
1026
1097
|
declare const named_colors: string[];
|
|
1098
|
+
declare const state_name_chars: readonly {
|
|
1099
|
+
from: string;
|
|
1100
|
+
to: string;
|
|
1101
|
+
}[];
|
|
1102
|
+
declare const state_name_first_chars: readonly {
|
|
1103
|
+
from: string;
|
|
1104
|
+
to: string;
|
|
1105
|
+
}[];
|
|
1106
|
+
declare const action_label_chars: readonly {
|
|
1107
|
+
from: string;
|
|
1108
|
+
to: string;
|
|
1109
|
+
}[];
|
|
1027
1110
|
|
|
1028
1111
|
/*********
|
|
1029
1112
|
*
|
|
@@ -1704,6 +1787,49 @@ declare class Machine<mDT> {
|
|
|
1704
1787
|
* @returns An array of theme name strings.
|
|
1705
1788
|
*/
|
|
1706
1789
|
all_themes(): FslTheme[];
|
|
1790
|
+
/** List the character ranges accepted by the FSL grammar in any but the
|
|
1791
|
+
* first position of a state name (atom). Each entry is an inclusive
|
|
1792
|
+
* `{from, to}` range of single Unicode characters.
|
|
1793
|
+
*
|
|
1794
|
+
* @returns An array of `{from, to}` inclusive character ranges.
|
|
1795
|
+
*
|
|
1796
|
+
* @example
|
|
1797
|
+
* const m = sm`a -> b;`;
|
|
1798
|
+
* m.all_state_name_chars().some(r => '+' >= r.from && '+' <= r.to); // true
|
|
1799
|
+
*/
|
|
1800
|
+
all_state_name_chars(): ReadonlyArray<{
|
|
1801
|
+
from: string;
|
|
1802
|
+
to: string;
|
|
1803
|
+
}>;
|
|
1804
|
+
/** List the character ranges accepted by the FSL grammar in the first
|
|
1805
|
+
* position of a state name (atom). Narrower than
|
|
1806
|
+
* {@link all_state_name_chars}: notably omits `+`, `(`, `)`, `&`, `#`, `@`.
|
|
1807
|
+
*
|
|
1808
|
+
* @returns An array of `{from, to}` inclusive character ranges.
|
|
1809
|
+
*
|
|
1810
|
+
* @example
|
|
1811
|
+
* const m = sm`a -> b;`;
|
|
1812
|
+
* m.all_state_name_first_chars().some(r => '+' >= r.from && '+' <= r.to); // false
|
|
1813
|
+
*/
|
|
1814
|
+
all_state_name_first_chars(): ReadonlyArray<{
|
|
1815
|
+
from: string;
|
|
1816
|
+
to: string;
|
|
1817
|
+
}>;
|
|
1818
|
+
/** List the character ranges accepted inside a single-quoted FSL action
|
|
1819
|
+
* label without escaping. Space is allowed; the apostrophe `'` is
|
|
1820
|
+
* explicitly excluded since it terminates the label.
|
|
1821
|
+
*
|
|
1822
|
+
* @returns An array of `{from, to}` inclusive character ranges.
|
|
1823
|
+
*
|
|
1824
|
+
* @example
|
|
1825
|
+
* const m = sm`a -> b;`;
|
|
1826
|
+
* m.all_action_label_chars().some(r => ' ' >= r.from && ' ' <= r.to); // true
|
|
1827
|
+
* m.all_action_label_chars().some(r => "'" >= r.from && "'" <= r.to); // false
|
|
1828
|
+
*/
|
|
1829
|
+
all_action_label_chars(): ReadonlyArray<{
|
|
1830
|
+
from: string;
|
|
1831
|
+
to: string;
|
|
1832
|
+
}>;
|
|
1707
1833
|
/** Get the active theme(s) for this machine. Always stored as an array
|
|
1708
1834
|
* internally; the union return type exists for setter compatibility.
|
|
1709
1835
|
* @returns The current theme or array of themes.
|
|
@@ -1797,10 +1923,23 @@ declare class Machine<mDT> {
|
|
|
1797
1923
|
*
|
|
1798
1924
|
*/
|
|
1799
1925
|
list_exits(whichState?: StateType): Array<StateType>;
|
|
1800
|
-
/** Get the transitions available from a state
|
|
1801
|
-
*
|
|
1926
|
+
/** Get the transitions available from a state for use by the probabilistic
|
|
1927
|
+
* walk system.
|
|
1928
|
+
*
|
|
1929
|
+
* If any exit declares a `probability`, only those probability-bearing
|
|
1930
|
+
* exits are returned, so that non-probability peers cannot dilute the
|
|
1931
|
+
* declared distribution. If no exit declares a `probability`, every
|
|
1932
|
+
* legal (non-forced) exit is returned, which `weighted_rand_select`
|
|
1933
|
+
* treats as equal weight. Forced-only exits (`~>`) are always excluded,
|
|
1934
|
+
* since they cannot be taken by an ordinary `transition()` call.
|
|
1935
|
+
*
|
|
1936
|
+
* Fixes StoneCypher/fsl#1325, in which the function previously returned
|
|
1937
|
+
* every exit unconditionally — including forced-only exits and exits
|
|
1938
|
+
* with no `probability`, which distorted the weighted distribution.
|
|
1939
|
+
*
|
|
1802
1940
|
* @param whichState - The state to inspect.
|
|
1803
|
-
* @returns An array of {@link JssmTransition} edges exiting the state
|
|
1941
|
+
* @returns An array of {@link JssmTransition} edges exiting the state,
|
|
1942
|
+
* filtered as described above. May be empty.
|
|
1804
1943
|
* @throws {JssmError} If the state does not exist.
|
|
1805
1944
|
*/
|
|
1806
1945
|
probable_exits_for(whichState: StateType): Array<JssmTransition<StateType, mDT>>;
|
|
@@ -2891,4 +3030,4 @@ declare function abstract_everything_hook_step<mDT>(maybe_hook: EverythingHookHa
|
|
|
2891
3030
|
*/
|
|
2892
3031
|
declare function deserialize<mDT>(machine_string: string, ser: JssmSerialization<mDT>): Machine<mDT>;
|
|
2893
3032
|
|
|
2894
|
-
export { FslDirections, Machine, abstract_everything_hook_step, abstract_hook_step, arrow_direction, arrow_left_kind, arrow_right_kind, build_time, compile, jssm_constants_d as constants, deserialize, find_repeated, from, gen_splitmix32, gviz_shapes, histograph, is_hook_complex_result, is_hook_rejection, make, named_colors, wrap_parse as parse, seq, shapes, sleep, sm, state_style_condense, transfer_state_properties, unique, version, weighted_histo_key, weighted_rand_select, weighted_sample_select };
|
|
3033
|
+
export { FslDirections, Machine, abstract_everything_hook_step, abstract_hook_step, action_label_chars, arrow_direction, arrow_left_kind, arrow_right_kind, build_time, compile, jssm_constants_d as constants, deserialize, find_repeated, from, gen_splitmix32, gviz_shapes, histograph, is_hook_complex_result, is_hook_rejection, make, named_colors, wrap_parse as parse, seq, shapes, sleep, sm, state_name_chars, state_name_first_chars, state_style_condense, transfer_state_properties, unique, version, weighted_histo_key, weighted_rand_select, weighted_sample_select };
|
package/jssm.es6.d.ts
CHANGED
|
@@ -973,6 +973,63 @@ declare const shapes$1: string[];
|
|
|
973
973
|
*
|
|
974
974
|
*/
|
|
975
975
|
declare const named_colors$1: string[];
|
|
976
|
+
/*******
|
|
977
|
+
*
|
|
978
|
+
* Character ranges accepted by the FSL grammar for identifier and label
|
|
979
|
+
* tokens. Each entry is an inclusive `{from, to}` range of single Unicode
|
|
980
|
+
* characters. Single-character entries (e.g. `.`) appear with `from === to`.
|
|
981
|
+
*
|
|
982
|
+
* These are intended for tooling, validators, and editors that need to know
|
|
983
|
+
* which characters are legal in a given FSL token position without re-parsing
|
|
984
|
+
* the PEG grammar.
|
|
985
|
+
*
|
|
986
|
+
*/
|
|
987
|
+
/**
|
|
988
|
+
* Inclusive character ranges accepted by `AtomLetter` — i.e., the characters
|
|
989
|
+
* legal in any but the first position of an FSL state name (atom).
|
|
990
|
+
*
|
|
991
|
+
* Includes ASCII digits/letters and the symbols
|
|
992
|
+
* `.`, `+`, `_`, `^`, `(`, `)`, `*`, `&`, `$`, `#`, `@`, `!`, `?`, `,`,
|
|
993
|
+
* plus the high-Unicode range `U+0080`–`U+FFFF`.
|
|
994
|
+
*
|
|
995
|
+
* @example
|
|
996
|
+
* state_name_chars.some(r => 'A' >= r.from && 'A' <= r.to); // true
|
|
997
|
+
*/
|
|
998
|
+
declare const state_name_chars$1: ReadonlyArray<{
|
|
999
|
+
from: string;
|
|
1000
|
+
to: string;
|
|
1001
|
+
}>;
|
|
1002
|
+
/**
|
|
1003
|
+
* Inclusive character ranges accepted by `AtomFirstLetter` — i.e., the
|
|
1004
|
+
* characters legal in the first position of an FSL state name (atom).
|
|
1005
|
+
*
|
|
1006
|
+
* Notably narrower than {@link state_name_chars}: omits `+`, `(`, `)`, `&`,
|
|
1007
|
+
* `#`, `@`. Includes ASCII digits/letters, `.`, `_`, `!`, `$`, `^`, `*`,
|
|
1008
|
+
* `?`, `,`, and the high-Unicode range `U+0080`–`U+FFFF`.
|
|
1009
|
+
*
|
|
1010
|
+
* @example
|
|
1011
|
+
* state_name_first_chars.some(r => '+' >= r.from && '+' <= r.to); // false
|
|
1012
|
+
*/
|
|
1013
|
+
declare const state_name_first_chars$1: ReadonlyArray<{
|
|
1014
|
+
from: string;
|
|
1015
|
+
to: string;
|
|
1016
|
+
}>;
|
|
1017
|
+
/**
|
|
1018
|
+
* Inclusive character ranges accepted by `ActionLabelUnescaped` — i.e., the
|
|
1019
|
+
* characters legal inside a single-quoted action label without escaping.
|
|
1020
|
+
* Space (`U+0020`) is included; the apostrophe `'` (`U+0027`) is explicitly
|
|
1021
|
+
* excluded since it terminates the label.
|
|
1022
|
+
*
|
|
1023
|
+
* Three ranges: `U+0020`–`U+0026`, `U+0028`–`U+005B`, `U+005D`–`U+FFFF`.
|
|
1024
|
+
*
|
|
1025
|
+
* @example
|
|
1026
|
+
* action_label_chars.some(r => ' ' >= r.from && ' ' <= r.to); // true
|
|
1027
|
+
* action_label_chars.some(r => "'" >= r.from && "'" <= r.to); // false
|
|
1028
|
+
*/
|
|
1029
|
+
declare const action_label_chars$1: ReadonlyArray<{
|
|
1030
|
+
from: string;
|
|
1031
|
+
to: string;
|
|
1032
|
+
}>;
|
|
976
1033
|
|
|
977
1034
|
declare const jssm_constants_d_E: typeof E;
|
|
978
1035
|
declare const jssm_constants_d_Epsilon: typeof Epsilon;
|
|
@@ -1010,13 +1067,27 @@ declare namespace jssm_constants_d {
|
|
|
1010
1067
|
jssm_constants_d_PosInfinity as PosInfinity,
|
|
1011
1068
|
jssm_constants_d_Root2 as Root2,
|
|
1012
1069
|
jssm_constants_d_RootHalf as RootHalf,
|
|
1070
|
+
action_label_chars$1 as action_label_chars,
|
|
1013
1071
|
gviz_shapes$1 as gviz_shapes,
|
|
1014
1072
|
named_colors$1 as named_colors,
|
|
1015
1073
|
shapes$1 as shapes,
|
|
1074
|
+
state_name_chars$1 as state_name_chars,
|
|
1075
|
+
state_name_first_chars$1 as state_name_first_chars,
|
|
1016
1076
|
};
|
|
1017
1077
|
}
|
|
1018
1078
|
|
|
1079
|
+
/**
|
|
1080
|
+
* The published semantic version of the jssm package this build was cut from.
|
|
1081
|
+
* Mirrored from `package.json` by `src/buildjs/makever.cjs` at build time.
|
|
1082
|
+
* Useful for runtime diagnostics and for embedding in serialized machine
|
|
1083
|
+
* snapshots so that deserializers can detect version-skew.
|
|
1084
|
+
*/
|
|
1019
1085
|
declare const version: string;
|
|
1086
|
+
/**
|
|
1087
|
+
* The Unix epoch timestamp (in milliseconds) at which this build was produced,
|
|
1088
|
+
* written by `src/buildjs/makever.cjs`. Useful for distinguishing builds
|
|
1089
|
+
* with the same `version` string during development, and for diagnostic logs.
|
|
1090
|
+
*/
|
|
1020
1091
|
declare const build_time: number;
|
|
1021
1092
|
|
|
1022
1093
|
declare type StateType = string;
|
|
@@ -1024,6 +1095,18 @@ declare type StateType = string;
|
|
|
1024
1095
|
declare const shapes: string[];
|
|
1025
1096
|
declare const gviz_shapes: string[];
|
|
1026
1097
|
declare const named_colors: string[];
|
|
1098
|
+
declare const state_name_chars: readonly {
|
|
1099
|
+
from: string;
|
|
1100
|
+
to: string;
|
|
1101
|
+
}[];
|
|
1102
|
+
declare const state_name_first_chars: readonly {
|
|
1103
|
+
from: string;
|
|
1104
|
+
to: string;
|
|
1105
|
+
}[];
|
|
1106
|
+
declare const action_label_chars: readonly {
|
|
1107
|
+
from: string;
|
|
1108
|
+
to: string;
|
|
1109
|
+
}[];
|
|
1027
1110
|
|
|
1028
1111
|
/*********
|
|
1029
1112
|
*
|
|
@@ -1704,6 +1787,49 @@ declare class Machine<mDT> {
|
|
|
1704
1787
|
* @returns An array of theme name strings.
|
|
1705
1788
|
*/
|
|
1706
1789
|
all_themes(): FslTheme[];
|
|
1790
|
+
/** List the character ranges accepted by the FSL grammar in any but the
|
|
1791
|
+
* first position of a state name (atom). Each entry is an inclusive
|
|
1792
|
+
* `{from, to}` range of single Unicode characters.
|
|
1793
|
+
*
|
|
1794
|
+
* @returns An array of `{from, to}` inclusive character ranges.
|
|
1795
|
+
*
|
|
1796
|
+
* @example
|
|
1797
|
+
* const m = sm`a -> b;`;
|
|
1798
|
+
* m.all_state_name_chars().some(r => '+' >= r.from && '+' <= r.to); // true
|
|
1799
|
+
*/
|
|
1800
|
+
all_state_name_chars(): ReadonlyArray<{
|
|
1801
|
+
from: string;
|
|
1802
|
+
to: string;
|
|
1803
|
+
}>;
|
|
1804
|
+
/** List the character ranges accepted by the FSL grammar in the first
|
|
1805
|
+
* position of a state name (atom). Narrower than
|
|
1806
|
+
* {@link all_state_name_chars}: notably omits `+`, `(`, `)`, `&`, `#`, `@`.
|
|
1807
|
+
*
|
|
1808
|
+
* @returns An array of `{from, to}` inclusive character ranges.
|
|
1809
|
+
*
|
|
1810
|
+
* @example
|
|
1811
|
+
* const m = sm`a -> b;`;
|
|
1812
|
+
* m.all_state_name_first_chars().some(r => '+' >= r.from && '+' <= r.to); // false
|
|
1813
|
+
*/
|
|
1814
|
+
all_state_name_first_chars(): ReadonlyArray<{
|
|
1815
|
+
from: string;
|
|
1816
|
+
to: string;
|
|
1817
|
+
}>;
|
|
1818
|
+
/** List the character ranges accepted inside a single-quoted FSL action
|
|
1819
|
+
* label without escaping. Space is allowed; the apostrophe `'` is
|
|
1820
|
+
* explicitly excluded since it terminates the label.
|
|
1821
|
+
*
|
|
1822
|
+
* @returns An array of `{from, to}` inclusive character ranges.
|
|
1823
|
+
*
|
|
1824
|
+
* @example
|
|
1825
|
+
* const m = sm`a -> b;`;
|
|
1826
|
+
* m.all_action_label_chars().some(r => ' ' >= r.from && ' ' <= r.to); // true
|
|
1827
|
+
* m.all_action_label_chars().some(r => "'" >= r.from && "'" <= r.to); // false
|
|
1828
|
+
*/
|
|
1829
|
+
all_action_label_chars(): ReadonlyArray<{
|
|
1830
|
+
from: string;
|
|
1831
|
+
to: string;
|
|
1832
|
+
}>;
|
|
1707
1833
|
/** Get the active theme(s) for this machine. Always stored as an array
|
|
1708
1834
|
* internally; the union return type exists for setter compatibility.
|
|
1709
1835
|
* @returns The current theme or array of themes.
|
|
@@ -1797,10 +1923,23 @@ declare class Machine<mDT> {
|
|
|
1797
1923
|
*
|
|
1798
1924
|
*/
|
|
1799
1925
|
list_exits(whichState?: StateType): Array<StateType>;
|
|
1800
|
-
/** Get the transitions available from a state
|
|
1801
|
-
*
|
|
1926
|
+
/** Get the transitions available from a state for use by the probabilistic
|
|
1927
|
+
* walk system.
|
|
1928
|
+
*
|
|
1929
|
+
* If any exit declares a `probability`, only those probability-bearing
|
|
1930
|
+
* exits are returned, so that non-probability peers cannot dilute the
|
|
1931
|
+
* declared distribution. If no exit declares a `probability`, every
|
|
1932
|
+
* legal (non-forced) exit is returned, which `weighted_rand_select`
|
|
1933
|
+
* treats as equal weight. Forced-only exits (`~>`) are always excluded,
|
|
1934
|
+
* since they cannot be taken by an ordinary `transition()` call.
|
|
1935
|
+
*
|
|
1936
|
+
* Fixes StoneCypher/fsl#1325, in which the function previously returned
|
|
1937
|
+
* every exit unconditionally — including forced-only exits and exits
|
|
1938
|
+
* with no `probability`, which distorted the weighted distribution.
|
|
1939
|
+
*
|
|
1802
1940
|
* @param whichState - The state to inspect.
|
|
1803
|
-
* @returns An array of {@link JssmTransition} edges exiting the state
|
|
1941
|
+
* @returns An array of {@link JssmTransition} edges exiting the state,
|
|
1942
|
+
* filtered as described above. May be empty.
|
|
1804
1943
|
* @throws {JssmError} If the state does not exist.
|
|
1805
1944
|
*/
|
|
1806
1945
|
probable_exits_for(whichState: StateType): Array<JssmTransition<StateType, mDT>>;
|
|
@@ -2891,4 +3030,4 @@ declare function abstract_everything_hook_step<mDT>(maybe_hook: EverythingHookHa
|
|
|
2891
3030
|
*/
|
|
2892
3031
|
declare function deserialize<mDT>(machine_string: string, ser: JssmSerialization<mDT>): Machine<mDT>;
|
|
2893
3032
|
|
|
2894
|
-
export { FslDirections, Machine, abstract_everything_hook_step, abstract_hook_step, arrow_direction, arrow_left_kind, arrow_right_kind, build_time, compile, jssm_constants_d as constants, deserialize, find_repeated, from, gen_splitmix32, gviz_shapes, histograph, is_hook_complex_result, is_hook_rejection, make, named_colors, wrap_parse as parse, seq, shapes, sleep, sm, state_style_condense, transfer_state_properties, unique, version, weighted_histo_key, weighted_rand_select, weighted_sample_select };
|
|
3033
|
+
export { FslDirections, Machine, abstract_everything_hook_step, abstract_hook_step, action_label_chars, arrow_direction, arrow_left_kind, arrow_right_kind, build_time, compile, jssm_constants_d as constants, deserialize, find_repeated, from, gen_splitmix32, gviz_shapes, histograph, is_hook_complex_result, is_hook_rejection, make, named_colors, wrap_parse as parse, seq, shapes, sleep, sm, state_name_chars, state_name_first_chars, state_style_condense, transfer_state_properties, unique, version, weighted_histo_key, weighted_rand_select, weighted_sample_select };
|
package/jssm_viz.es5.d.cts
CHANGED
|
@@ -546,7 +546,18 @@ declare type JssmHistory<mDT> = circular_buffer<[StateType$1, mDT]>;
|
|
|
546
546
|
*/
|
|
547
547
|
declare type JssmRng = () => number;
|
|
548
548
|
|
|
549
|
+
/**
|
|
550
|
+
* The published semantic version of the jssm package this build was cut from.
|
|
551
|
+
* Mirrored from `package.json` by `src/buildjs/makever.cjs` at build time.
|
|
552
|
+
* Useful for runtime diagnostics and for embedding in serialized machine
|
|
553
|
+
* snapshots so that deserializers can detect version-skew.
|
|
554
|
+
*/
|
|
549
555
|
declare const version: string;
|
|
556
|
+
/**
|
|
557
|
+
* The Unix epoch timestamp (in milliseconds) at which this build was produced,
|
|
558
|
+
* written by `src/buildjs/makever.cjs`. Useful for distinguishing builds
|
|
559
|
+
* with the same `version` string during development, and for diagnostic logs.
|
|
560
|
+
*/
|
|
550
561
|
declare const build_time: number;
|
|
551
562
|
|
|
552
563
|
declare type StateType = string;
|
|
@@ -1177,6 +1188,49 @@ declare class Machine<mDT> {
|
|
|
1177
1188
|
* @returns An array of theme name strings.
|
|
1178
1189
|
*/
|
|
1179
1190
|
all_themes(): FslTheme[];
|
|
1191
|
+
/** List the character ranges accepted by the FSL grammar in any but the
|
|
1192
|
+
* first position of a state name (atom). Each entry is an inclusive
|
|
1193
|
+
* `{from, to}` range of single Unicode characters.
|
|
1194
|
+
*
|
|
1195
|
+
* @returns An array of `{from, to}` inclusive character ranges.
|
|
1196
|
+
*
|
|
1197
|
+
* @example
|
|
1198
|
+
* const m = sm`a -> b;`;
|
|
1199
|
+
* m.all_state_name_chars().some(r => '+' >= r.from && '+' <= r.to); // true
|
|
1200
|
+
*/
|
|
1201
|
+
all_state_name_chars(): ReadonlyArray<{
|
|
1202
|
+
from: string;
|
|
1203
|
+
to: string;
|
|
1204
|
+
}>;
|
|
1205
|
+
/** List the character ranges accepted by the FSL grammar in the first
|
|
1206
|
+
* position of a state name (atom). Narrower than
|
|
1207
|
+
* {@link all_state_name_chars}: notably omits `+`, `(`, `)`, `&`, `#`, `@`.
|
|
1208
|
+
*
|
|
1209
|
+
* @returns An array of `{from, to}` inclusive character ranges.
|
|
1210
|
+
*
|
|
1211
|
+
* @example
|
|
1212
|
+
* const m = sm`a -> b;`;
|
|
1213
|
+
* m.all_state_name_first_chars().some(r => '+' >= r.from && '+' <= r.to); // false
|
|
1214
|
+
*/
|
|
1215
|
+
all_state_name_first_chars(): ReadonlyArray<{
|
|
1216
|
+
from: string;
|
|
1217
|
+
to: string;
|
|
1218
|
+
}>;
|
|
1219
|
+
/** List the character ranges accepted inside a single-quoted FSL action
|
|
1220
|
+
* label without escaping. Space is allowed; the apostrophe `'` is
|
|
1221
|
+
* explicitly excluded since it terminates the label.
|
|
1222
|
+
*
|
|
1223
|
+
* @returns An array of `{from, to}` inclusive character ranges.
|
|
1224
|
+
*
|
|
1225
|
+
* @example
|
|
1226
|
+
* const m = sm`a -> b;`;
|
|
1227
|
+
* m.all_action_label_chars().some(r => ' ' >= r.from && ' ' <= r.to); // true
|
|
1228
|
+
* m.all_action_label_chars().some(r => "'" >= r.from && "'" <= r.to); // false
|
|
1229
|
+
*/
|
|
1230
|
+
all_action_label_chars(): ReadonlyArray<{
|
|
1231
|
+
from: string;
|
|
1232
|
+
to: string;
|
|
1233
|
+
}>;
|
|
1180
1234
|
/** Get the active theme(s) for this machine. Always stored as an array
|
|
1181
1235
|
* internally; the union return type exists for setter compatibility.
|
|
1182
1236
|
* @returns The current theme or array of themes.
|
|
@@ -1270,10 +1324,23 @@ declare class Machine<mDT> {
|
|
|
1270
1324
|
*
|
|
1271
1325
|
*/
|
|
1272
1326
|
list_exits(whichState?: StateType): Array<StateType>;
|
|
1273
|
-
/** Get the transitions available from a state
|
|
1274
|
-
*
|
|
1327
|
+
/** Get the transitions available from a state for use by the probabilistic
|
|
1328
|
+
* walk system.
|
|
1329
|
+
*
|
|
1330
|
+
* If any exit declares a `probability`, only those probability-bearing
|
|
1331
|
+
* exits are returned, so that non-probability peers cannot dilute the
|
|
1332
|
+
* declared distribution. If no exit declares a `probability`, every
|
|
1333
|
+
* legal (non-forced) exit is returned, which `weighted_rand_select`
|
|
1334
|
+
* treats as equal weight. Forced-only exits (`~>`) are always excluded,
|
|
1335
|
+
* since they cannot be taken by an ordinary `transition()` call.
|
|
1336
|
+
*
|
|
1337
|
+
* Fixes StoneCypher/fsl#1325, in which the function previously returned
|
|
1338
|
+
* every exit unconditionally — including forced-only exits and exits
|
|
1339
|
+
* with no `probability`, which distorted the weighted distribution.
|
|
1340
|
+
*
|
|
1275
1341
|
* @param whichState - The state to inspect.
|
|
1276
|
-
* @returns An array of {@link JssmTransition} edges exiting the state
|
|
1342
|
+
* @returns An array of {@link JssmTransition} edges exiting the state,
|
|
1343
|
+
* filtered as described above. May be empty.
|
|
1277
1344
|
* @throws {JssmError} If the state does not exist.
|
|
1278
1345
|
*/
|
|
1279
1346
|
probable_exits_for(whichState: StateType): Array<JssmTransition<StateType, mDT>>;
|
|
@@ -2252,30 +2319,49 @@ declare function style_for_state<T>(u_jssm: Machine<T>, state: string): string;
|
|
|
2252
2319
|
/**
|
|
2253
2320
|
* Render a {@link jssm.Machine} as a graphviz dot string.
|
|
2254
2321
|
*
|
|
2322
|
+
* An optional `footer` may be supplied via `opts.footer`; it is emitted
|
|
2323
|
+
* verbatim just before the closing `}` of the dot source, after all
|
|
2324
|
+
* arrange declarations. This is a function-argument-only feature for
|
|
2325
|
+
* the moment — a machine-attribute equivalent is planned as a follow-up.
|
|
2326
|
+
*
|
|
2255
2327
|
* ```typescript
|
|
2256
2328
|
* import { sm } from 'jssm';
|
|
2257
2329
|
* import { machine_to_dot } from 'jssm/viz';
|
|
2258
2330
|
*
|
|
2259
2331
|
* const dot = machine_to_dot(sm`a -> b;`);
|
|
2260
2332
|
* // 'digraph G { ... }'
|
|
2333
|
+
*
|
|
2334
|
+
* const dot_with_footer = machine_to_dot(sm`a -> b;`, { footer: 'labelloc="b"; label="caption";' });
|
|
2335
|
+
* // 'digraph G { ... labelloc="b"; label="caption"; }'
|
|
2261
2336
|
* ```
|
|
2262
2337
|
*
|
|
2263
2338
|
* @param u_jssm The machine to render.
|
|
2339
|
+
* @param opts Optional rendering options.
|
|
2340
|
+
* @param opts.footer Optional verbatim dot source inserted just before the closing `}`.
|
|
2264
2341
|
* @returns A complete graphviz dot source string.
|
|
2265
2342
|
*/
|
|
2266
|
-
declare function machine_to_dot<T>(u_jssm: Machine<T
|
|
2343
|
+
declare function machine_to_dot<T>(u_jssm: Machine<T>, opts?: {
|
|
2344
|
+
footer?: string;
|
|
2345
|
+
}): string;
|
|
2267
2346
|
/**
|
|
2268
2347
|
* Render an FSL string directly to graphviz dot source.
|
|
2269
2348
|
*
|
|
2270
2349
|
* ```typescript
|
|
2271
2350
|
* import { fsl_to_dot } from 'jssm/viz';
|
|
2272
2351
|
* const dot = fsl_to_dot('a -> b;');
|
|
2352
|
+
*
|
|
2353
|
+
* const dot_with_footer = fsl_to_dot('a -> b;', { footer: 'label="caption";' });
|
|
2354
|
+
* // 'digraph G { ... label="caption"; }'
|
|
2273
2355
|
* ```
|
|
2274
2356
|
*
|
|
2275
2357
|
* @param fsl The FSL source.
|
|
2358
|
+
* @param opts Optional rendering options.
|
|
2359
|
+
* @param opts.footer Optional verbatim dot source inserted just before the closing `}`.
|
|
2276
2360
|
* @returns A complete graphviz dot source string.
|
|
2277
2361
|
*/
|
|
2278
|
-
declare function fsl_to_dot(fsl: string
|
|
2362
|
+
declare function fsl_to_dot(fsl: string, opts?: {
|
|
2363
|
+
footer?: string;
|
|
2364
|
+
}): string;
|
|
2279
2365
|
/**
|
|
2280
2366
|
* Render a graphviz dot source string to SVG using `@viz-js/viz`. The
|
|
2281
2367
|
* underlying viz instance is lazy-initialized on first call and cached for
|
|
@@ -2293,32 +2379,48 @@ declare function dot_to_svg(dot: string): Promise<string>;
|
|
|
2293
2379
|
* Render an FSL string directly to SVG.
|
|
2294
2380
|
*
|
|
2295
2381
|
* @param fsl The FSL source.
|
|
2382
|
+
* @param opts Optional rendering options.
|
|
2383
|
+
* @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
|
|
2296
2384
|
* @returns A promise resolving to an SVG XML string.
|
|
2297
2385
|
*/
|
|
2298
|
-
declare function fsl_to_svg_string(fsl: string
|
|
2386
|
+
declare function fsl_to_svg_string(fsl: string, opts?: {
|
|
2387
|
+
footer?: string;
|
|
2388
|
+
}): Promise<string>;
|
|
2299
2389
|
/**
|
|
2300
2390
|
* Render a {@link jssm.Machine} to SVG.
|
|
2301
2391
|
*
|
|
2302
2392
|
* @param u_jssm The machine to render.
|
|
2393
|
+
* @param opts Optional rendering options.
|
|
2394
|
+
* @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
|
|
2303
2395
|
* @returns A promise resolving to an SVG XML string.
|
|
2304
2396
|
*/
|
|
2305
|
-
declare function machine_to_svg_string<T>(u_jssm: Machine<T
|
|
2397
|
+
declare function machine_to_svg_string<T>(u_jssm: Machine<T>, opts?: {
|
|
2398
|
+
footer?: string;
|
|
2399
|
+
}): Promise<string>;
|
|
2306
2400
|
/**
|
|
2307
2401
|
* Render an FSL string directly to a parsed `SVGSVGElement`.
|
|
2308
2402
|
*
|
|
2309
2403
|
* @param fsl The FSL source.
|
|
2404
|
+
* @param opts Optional rendering options.
|
|
2405
|
+
* @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
|
|
2310
2406
|
* @returns A promise resolving to a parsed `SVGSVGElement`.
|
|
2311
2407
|
* @throws {JssmError} if no `DOMParser` is available (Node without `configure`).
|
|
2312
2408
|
*/
|
|
2313
|
-
declare function fsl_to_svg_element(fsl: string
|
|
2409
|
+
declare function fsl_to_svg_element(fsl: string, opts?: {
|
|
2410
|
+
footer?: string;
|
|
2411
|
+
}): Promise<SVGSVGElement>;
|
|
2314
2412
|
/**
|
|
2315
2413
|
* Render a {@link jssm.Machine} to a parsed `SVGSVGElement`.
|
|
2316
2414
|
*
|
|
2317
2415
|
* @param u_jssm The machine to render.
|
|
2416
|
+
* @param opts Optional rendering options.
|
|
2417
|
+
* @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
|
|
2318
2418
|
* @returns A promise resolving to a parsed `SVGSVGElement`.
|
|
2319
2419
|
* @throws {JssmError} if no `DOMParser` is available (Node without `configure`).
|
|
2320
2420
|
*/
|
|
2321
|
-
declare function machine_to_svg_element<T>(u_jssm: Machine<T
|
|
2421
|
+
declare function machine_to_svg_element<T>(u_jssm: Machine<T>, opts?: {
|
|
2422
|
+
footer?: string;
|
|
2423
|
+
}): Promise<SVGSVGElement>;
|
|
2322
2424
|
/**
|
|
2323
2425
|
* Compatibility wrapper for {@link machine_to_dot}, retained from
|
|
2324
2426
|
* jssm-viz. Will be removed in the next major.
|