jssm 5.104.2 → 5.112.4
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/MIGRATING-jssm-viz.md +67 -0
- package/README.md +179 -882
- package/dist/deno/README.md +347 -0
- package/dist/{es6 → deno}/jssm.d.ts +773 -39
- package/dist/deno/jssm.js +1 -0
- package/{jssm_compiler.d.ts → dist/deno/jssm_compiler.d.ts} +17 -2
- package/dist/deno/jssm_constants.d.ts +37 -0
- package/dist/deno/jssm_error.d.ts +27 -0
- package/dist/deno/jssm_theme.d.ts +15 -0
- package/dist/{es6 → deno}/jssm_types.d.ts +327 -8
- package/dist/deno/jssm_util.d.ts +258 -0
- package/dist/deno/jssm_viz.d.ts +175 -0
- package/dist/deno/jssm_viz_colors.d.ts +63 -0
- package/dist/jssm.es5.cjs +1 -1
- package/dist/jssm.es5.iife.js +1 -0
- package/dist/jssm.es6.mjs +1 -1
- package/dist/jssm_viz.cjs +1 -0
- package/dist/jssm_viz.iife.cjs +1 -0
- package/dist/jssm_viz.mjs +1 -0
- package/jssm.es5.d.cts +1191 -43
- package/jssm.es6.d.ts +1191 -43
- package/jssm_viz.es5.d.cts +2341 -0
- package/jssm_viz.es6.d.ts +2341 -0
- package/package.json +73 -24
- package/.clocignore +0 -1
- package/.codeclimate.yml +0 -22
- package/.editorconfig +0 -12
- package/.eslintrc +0 -20
- package/.gitattributes +0 -6
- package/.nycrc +0 -6
- package/.travis.yml +0 -9
- package/CHANGELOG.md +0 -178
- package/dist/es6/fsl_parser.js +0 -1
- package/dist/es6/jssm.js +0 -2488
- package/dist/es6/jssm_arrow.js +0 -187
- package/dist/es6/jssm_compiler.d.ts +0 -135
- package/dist/es6/jssm_compiler.js +0 -366
- package/dist/es6/jssm_constants.d.ts +0 -5
- package/dist/es6/jssm_constants.js +0 -94
- package/dist/es6/jssm_error.d.ts +0 -8
- package/dist/es6/jssm_error.js +0 -28
- package/dist/es6/jssm_theme.d.ts +0 -4
- package/dist/es6/jssm_theme.js +0 -13
- package/dist/es6/jssm_types.js +0 -3
- package/dist/es6/jssm_util.d.ts +0 -106
- package/dist/es6/jssm_util.js +0 -180
- package/dist/es6/themes/jssm_base_stylesheet.d.ts +0 -11
- package/dist/es6/themes/jssm_base_stylesheet.js +0 -58
- package/dist/es6/themes/jssm_theme_bold.d.ts +0 -11
- package/dist/es6/themes/jssm_theme_bold.js +0 -58
- package/dist/es6/themes/jssm_theme_default.d.ts +0 -11
- package/dist/es6/themes/jssm_theme_default.js +0 -58
- package/dist/es6/themes/jssm_theme_modern.d.ts +0 -11
- package/dist/es6/themes/jssm_theme_modern.js +0 -58
- package/dist/es6/themes/jssm_theme_ocean.d.ts +0 -11
- package/dist/es6/themes/jssm_theme_ocean.js +0 -56
- package/dist/es6/themes/jssm_theme_plain.d.ts +0 -11
- package/dist/es6/themes/jssm_theme_plain.js +0 -70
- package/dist/es6/version.js +0 -2
- package/dist/jssm.es5.iife.cjs +0 -1
- package/dist/jssm.es5.iife.nonmin.cjs +0 -23180
- package/dist/jssm.es5.nonmin.cjs +0 -23175
- package/dist/jssm.es6.nonmin.cjs +0 -23144
- package/fsl_parser.d.ts +0 -6
- package/jest-dragon.config.cjs +0 -33
- package/jest-spec.config.cjs +0 -33
- package/jest-stoch.config.cjs +0 -33
- package/jest-unicode.config.cjs +0 -33
- package/jssm.d.ts +0 -1141
- package/jssm_arrow.d.ts +0 -53
- package/jssm_constants.d.ts +0 -5
- package/jssm_error.d.ts +0 -8
- package/jssm_theme.d.ts +0 -4
- package/jssm_types.d.ts +0 -378
- package/jssm_util.d.ts +0 -106
- package/rollup.config.deno.js +0 -44
- package/rollup.config.es5.js +0 -52
- package/rollup.config.es6.js +0 -55
- package/tutorial_learn_testing.md +0 -168
- package/typedoc-options.cjs +0 -68
- package/version.d.ts +0 -2
- /package/dist/{es6 → deno}/fsl_parser.d.ts +0 -0
- /package/dist/{es6 → deno}/jssm_arrow.d.ts +0 -0
- /package/dist/{es6 → deno}/version.d.ts +0 -0
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
export const NegInfinity = Number.NEGATIVE_INFINITY, PosInfinity = Number.POSITIVE_INFINITY, Epsilon = Number.EPSILON, Pi = Math.PI, E = Math.E, Root2 = Math.SQRT2, RootHalf = Math.SQRT1_2, Ln2 = Math.LN2, Ln10 = Math.LN10, Log2E = Math.LOG2E, Log10E = Math.LOG10E, MaxSafeInt = Number.MAX_SAFE_INTEGER, MinSafeInt = Number.MIN_SAFE_INTEGER, MaxPosNum = Number.MAX_VALUE, MinPosNum = Number.MIN_VALUE, Phi = 1.61803398874989484820, EulerC = 0.57721566490153286060;
|
|
2
|
-
const gviz_shapes = [
|
|
3
|
-
"box3d",
|
|
4
|
-
"polygon",
|
|
5
|
-
"ellipse",
|
|
6
|
-
"oval",
|
|
7
|
-
"circle",
|
|
8
|
-
"point",
|
|
9
|
-
"egg",
|
|
10
|
-
"triangle",
|
|
11
|
-
"plaintext",
|
|
12
|
-
"plain",
|
|
13
|
-
"diamond",
|
|
14
|
-
"trapezium",
|
|
15
|
-
"parallelogram",
|
|
16
|
-
"house",
|
|
17
|
-
"pentagon",
|
|
18
|
-
"hexagon",
|
|
19
|
-
"septagon",
|
|
20
|
-
"octagon",
|
|
21
|
-
"doublecircle",
|
|
22
|
-
"doubleoctagon",
|
|
23
|
-
"tripleoctagon",
|
|
24
|
-
"invtriangle",
|
|
25
|
-
"invtrapezium",
|
|
26
|
-
"invhouse",
|
|
27
|
-
"Mdiamond",
|
|
28
|
-
"Msquare",
|
|
29
|
-
"Mcircle",
|
|
30
|
-
"rectangle",
|
|
31
|
-
"rect",
|
|
32
|
-
"square",
|
|
33
|
-
"star",
|
|
34
|
-
"none",
|
|
35
|
-
"underline",
|
|
36
|
-
"cylinder",
|
|
37
|
-
"note",
|
|
38
|
-
"tab",
|
|
39
|
-
"folder",
|
|
40
|
-
"box",
|
|
41
|
-
"component",
|
|
42
|
-
"promoter",
|
|
43
|
-
"cds",
|
|
44
|
-
"terminator",
|
|
45
|
-
"utr",
|
|
46
|
-
"primersite",
|
|
47
|
-
"restrictionsite",
|
|
48
|
-
"fivepoverhang",
|
|
49
|
-
"threepoverhang",
|
|
50
|
-
"noverhang",
|
|
51
|
-
"assembly",
|
|
52
|
-
"signature",
|
|
53
|
-
"insulator",
|
|
54
|
-
"ribosite",
|
|
55
|
-
"rnastab",
|
|
56
|
-
"proteasesite",
|
|
57
|
-
"proteinstab",
|
|
58
|
-
"rpromoter",
|
|
59
|
-
"rarrow",
|
|
60
|
-
"larrow",
|
|
61
|
-
"lpromoter",
|
|
62
|
-
"record"
|
|
63
|
-
];
|
|
64
|
-
const shapes = gviz_shapes;
|
|
65
|
-
const named_colors = [
|
|
66
|
-
"AliceBlue", "AntiqueWhite", "Aqua", "Aquamarine", "Azure", "Beige",
|
|
67
|
-
"Bisque", "Black", "BlanchedAlmond", "Blue", "BlueViolet", "Brown",
|
|
68
|
-
"BurlyWood", "CadetBlue", "Chartreuse", "Chocolate", "Coral",
|
|
69
|
-
"CornflowerBlue", "Cornsilk", "Crimson", "Cyan", "DarkBlue", "DarkCyan",
|
|
70
|
-
"DarkGoldenRod", "DarkGray", "DarkGrey", "DarkGreen", "DarkKhaki",
|
|
71
|
-
"DarkMagenta", "DarkOliveGreen", "Darkorange", "DarkOrchid", "DarkRed",
|
|
72
|
-
"DarkSalmon", "DarkSeaGreen", "DarkSlateBlue", "DarkSlateGray",
|
|
73
|
-
"DarkSlateGrey", "DarkTurquoise", "DarkViolet", "DeepPink", "DeepSkyBlue",
|
|
74
|
-
"DimGray", "DimGrey", "DodgerBlue", "FireBrick", "FloralWhite", "ForestGreen",
|
|
75
|
-
"Fuchsia", "Gainsboro", "GhostWhite", "Gold", "GoldenRod", "Gray", "Grey",
|
|
76
|
-
"Green", "GreenYellow", "HoneyDew", "HotPink", "IndianRed", "Indigo", "Ivory",
|
|
77
|
-
"Khaki", "Lavender", "LavenderBlush", "LawnGreen", "LemonChiffon",
|
|
78
|
-
"LightBlue", "LightCoral", "LightCyan", "LightGoldenRodYellow", "LightGray",
|
|
79
|
-
"LightGrey", "LightGreen", "LightPink", "LightSalmon", "LightSeaGreen",
|
|
80
|
-
"LightSkyBlue", "LightSlateGray", "LightSlateGrey", "LightSteelBlue",
|
|
81
|
-
"LightYellow", "Lime", "LimeGreen", "Linen", "Magenta", "Maroon",
|
|
82
|
-
"MediumAquaMarine", "MediumBlue", "MediumOrchid", "MediumPurple",
|
|
83
|
-
"MediumSeaGreen", "MediumSlateBlue", "MediumSpringGreen", "MediumTurquoise",
|
|
84
|
-
"MediumVioletRed", "MidnightBlue", "MintCream", "MistyRose", "Moccasin",
|
|
85
|
-
"NavajoWhite", "Navy", "OldLace", "Olive", "OliveDrab", "Orange", "OrangeRed",
|
|
86
|
-
"Orchid", "PaleGoldenRod", "PaleGreen", "PaleTurquoise", "PaleVioletRed",
|
|
87
|
-
"PapayaWhip", "PeachPuff", "Peru", "Pink", "Plum", "PowderBlue", "Purple",
|
|
88
|
-
"Red", "RosyBrown", "RoyalBlue", "SaddleBrown", "Salmon", "SandyBrown",
|
|
89
|
-
"SeaGreen", "SeaShell", "Sienna", "Silver", "SkyBlue", "SlateBlue",
|
|
90
|
-
"SlateGray", "SlateGrey", "Snow", "SpringGreen", "SteelBlue", "Tan", "Teal",
|
|
91
|
-
"Thistle", "Tomato", "Turquoise", "Violet", "Wheat", "White", "WhiteSmoke",
|
|
92
|
-
"Yellow", "YellowGreen"
|
|
93
|
-
];
|
|
94
|
-
export { gviz_shapes, shapes, named_colors, };
|
package/dist/es6/jssm_error.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { JssmErrorExtendedInfo } from './jssm_types';
|
|
2
|
-
declare class JssmError extends Error {
|
|
3
|
-
message: string;
|
|
4
|
-
base_message: string;
|
|
5
|
-
requested_state: string | undefined;
|
|
6
|
-
constructor(machine: any, message: string, JEEI?: JssmErrorExtendedInfo);
|
|
7
|
-
}
|
|
8
|
-
export { JssmError };
|
package/dist/es6/jssm_error.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
class JssmError extends Error {
|
|
2
|
-
constructor(machine, message, JEEI) {
|
|
3
|
-
const { requested_state } = (JEEI === undefined)
|
|
4
|
-
? { requested_state: undefined }
|
|
5
|
-
: JEEI;
|
|
6
|
-
const follow_ups = [];
|
|
7
|
-
if (machine) {
|
|
8
|
-
if (machine.state() !== undefined) {
|
|
9
|
-
follow_ups.push(`at "${machine.state()}"`);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
if (requested_state !== undefined) {
|
|
13
|
-
follow_ups.push(`requested "${requested_state}"`);
|
|
14
|
-
}
|
|
15
|
-
const complex_msg = `${((machine === null || machine === void 0 ? void 0 : machine.instance_name()) !== undefined)
|
|
16
|
-
? `[[${machine.instance_name()}]]: `
|
|
17
|
-
: ''}${message}${follow_ups.length
|
|
18
|
-
? ` (${follow_ups.join(', ')})`
|
|
19
|
-
: ''}`;
|
|
20
|
-
super(complex_msg);
|
|
21
|
-
this.name = 'JssmError';
|
|
22
|
-
this.message = complex_msg;
|
|
23
|
-
this.base_message = message;
|
|
24
|
-
this.requested_state = requested_state;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
;
|
|
28
|
-
export { JssmError };
|
package/dist/es6/jssm_theme.d.ts
DELETED
package/dist/es6/jssm_theme.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { base_theme } from './themes/jssm_base_stylesheet';
|
|
2
|
-
import { default_theme } from './themes/jssm_theme_default';
|
|
3
|
-
import { modern_theme } from './themes/jssm_theme_modern';
|
|
4
|
-
import { ocean_theme } from './themes/jssm_theme_ocean';
|
|
5
|
-
import { plain_theme } from './themes/jssm_theme_plain';
|
|
6
|
-
import { bold_theme } from './themes/jssm_theme_bold';
|
|
7
|
-
const theme_mapping = new Map();
|
|
8
|
-
theme_mapping.set('default', default_theme);
|
|
9
|
-
theme_mapping.set('modern', modern_theme);
|
|
10
|
-
theme_mapping.set('ocean', ocean_theme);
|
|
11
|
-
theme_mapping.set('plain', plain_theme);
|
|
12
|
-
theme_mapping.set('bold', bold_theme);
|
|
13
|
-
export { theme_mapping, base_theme };
|
package/dist/es6/jssm_types.js
DELETED
package/dist/es6/jssm_util.d.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/*******
|
|
2
|
-
*
|
|
3
|
-
* Predicate for validating an array for uniqueness. Not generally meant for
|
|
4
|
-
* external use.
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
declare function arr_uniq_p<T>(el: T, i: number, source: T[]): boolean;
|
|
8
|
-
declare const array_box_if_string: (n: any) => any;
|
|
9
|
-
declare const weighted_rand_select: Function;
|
|
10
|
-
/*******
|
|
11
|
-
*
|
|
12
|
-
* Returns, for a non-negative integer argument `n`, the series `[0 .. n]`.
|
|
13
|
-
*
|
|
14
|
-
* ```typescript
|
|
15
|
-
* import { seq } from './jssm';
|
|
16
|
-
*
|
|
17
|
-
* seq(5); // [0, 1, 2, 3, 4]
|
|
18
|
-
* seq(0); // []
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
declare function seq(n: number): number[];
|
|
23
|
-
/*******
|
|
24
|
-
*
|
|
25
|
-
* Returns the histograph of an array as a `Map`. Makes no attempt to cope
|
|
26
|
-
* with deep equality; will fail for complex contents, as such.
|
|
27
|
-
*
|
|
28
|
-
* ```typescript
|
|
29
|
-
* import { histograph } from './jssm';
|
|
30
|
-
*
|
|
31
|
-
* histograph( [0, 0, 1, 1, 2, 2, 1] ); // Map()
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
*/
|
|
35
|
-
declare const histograph: Function;
|
|
36
|
-
declare const weighted_sample_select: Function;
|
|
37
|
-
declare const weighted_histo_key: Function;
|
|
38
|
-
/*******
|
|
39
|
-
*
|
|
40
|
-
* Internal method generating names for edges for the hook lookup map. Not
|
|
41
|
-
* meant for external use.
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
declare function name_bind_prop_and_state(prop: string, state: string): string;
|
|
45
|
-
/*******
|
|
46
|
-
*
|
|
47
|
-
* Internal method generating names for edges for the hook lookup map. Not
|
|
48
|
-
* meant for external use.
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
declare const hook_name: (from: string, to: string) => string;
|
|
52
|
-
/*******
|
|
53
|
-
*
|
|
54
|
-
* Internal method generating names for actions for the hook lookup map. Not
|
|
55
|
-
* meant for external use.
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
declare const named_hook_name: (from: string, to: string, action: string) => string;
|
|
59
|
-
/*******
|
|
60
|
-
*
|
|
61
|
-
* Creates a SplitMix32 random generator. Used by the randomness test suite.
|
|
62
|
-
*
|
|
63
|
-
* Sourced from `bryc`: https://github.com/bryc/code/blob/master/jshash/PRNGs.md#splitmix32
|
|
64
|
-
*
|
|
65
|
-
* Replaces the Mulberry generator, which was found to have problems
|
|
66
|
-
*
|
|
67
|
-
*/
|
|
68
|
-
declare function gen_splitmix32(a?: number | undefined): () => number;
|
|
69
|
-
/*******
|
|
70
|
-
*
|
|
71
|
-
* Reduces an array to its unique contents. Compares with `===` and makes no
|
|
72
|
-
* effort to deep-compare contents; two matching arrays or objects contained
|
|
73
|
-
* will be treated as distinct, according to javascript rules. This also means
|
|
74
|
-
* that `NaNs` will be ***dropped***, because they do not self-compare.
|
|
75
|
-
*
|
|
76
|
-
* ```typescript
|
|
77
|
-
* unique( [] ); // []
|
|
78
|
-
* unique( [0,0] ); // [0]
|
|
79
|
-
* unique( [0,1,2, 0,1,2, 0,1,2] ); // [0,1,2]
|
|
80
|
-
* unique( [ [1], [1] ] ); // [ [1], [1] ] because arrays don't match
|
|
81
|
-
* unique( [0,NaN,2] ); // [0,2]
|
|
82
|
-
* ```
|
|
83
|
-
*
|
|
84
|
-
*/
|
|
85
|
-
declare const unique: <T>(arr?: T[]) => T[];
|
|
86
|
-
/*******
|
|
87
|
-
*
|
|
88
|
-
* Lists all repeated items in an array along with their counts. Subject to
|
|
89
|
-
* matching rules of Map. `NaN` is manually removed because of conflict rules
|
|
90
|
-
* around {@link unique}. Because these are compared with `===` and because
|
|
91
|
-
* arrays and objects never match that way unless they're the same object,
|
|
92
|
-
* arrays and objects are never considered repeats.
|
|
93
|
-
*
|
|
94
|
-
* ```typescript
|
|
95
|
-
* find_repeated<string>([ ]); // []
|
|
96
|
-
* find_repeated<string>([ "one" ]); // []
|
|
97
|
-
* find_repeated<string>([ "one", "two" ]); // []
|
|
98
|
-
* find_repeated<string>([ "one", "one" ]); // [ ["one", 2] ]
|
|
99
|
-
* find_repeated<string>([ "one", "two", "one" ]); // [ ["one", 2] ]
|
|
100
|
-
* find_repeated<number>([ 0, NaN, 0, NaN ]); // [ [0, 2] ]
|
|
101
|
-
* ```
|
|
102
|
-
*
|
|
103
|
-
*/
|
|
104
|
-
declare function find_repeated<T>(arr: T[]): [T, number][];
|
|
105
|
-
declare function sleep(ms: number): Promise<unknown>;
|
|
106
|
-
export { seq, unique, find_repeated, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string, name_bind_prop_and_state, hook_name, named_hook_name, gen_splitmix32, sleep };
|
package/dist/es6/jssm_util.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { JssmError } from './jssm_error';
|
|
2
|
-
/*******
|
|
3
|
-
*
|
|
4
|
-
* Predicate for validating an array for uniqueness. Not generally meant for
|
|
5
|
-
* external use.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
function arr_uniq_p(el, i, source) {
|
|
9
|
-
return source.indexOf(el) === i;
|
|
10
|
-
}
|
|
11
|
-
const array_box_if_string = n => typeof n === 'string' ? [n] : n;
|
|
12
|
-
// this is explicitly about other peoples' data, so it has to be weakly typed
|
|
13
|
-
/* eslint-disable flowtype/no-weak-types */
|
|
14
|
-
const weighted_rand_select = (options, probability_property = 'probability', rng) => {
|
|
15
|
-
if (!Array.isArray(options)) {
|
|
16
|
-
throw new TypeError('options must be a non-empty array of objects');
|
|
17
|
-
}
|
|
18
|
-
if (!(typeof options[0] === 'object')) {
|
|
19
|
-
throw new TypeError('options must be a non-empty array of objects');
|
|
20
|
-
}
|
|
21
|
-
const frand = (cap) => Math.random() * cap, or_one = (item) => item === undefined ? 1 : item, prob_sum = options.reduce((acc, val) => acc + or_one(val[probability_property]), 0), rnd = frand(prob_sum);
|
|
22
|
-
let cursor = 0, cursor_sum = 0;
|
|
23
|
-
while ((cursor_sum += or_one(options[cursor++][probability_property])) <= rnd) { } // eslint-disable-line no-empty,fp/no-loops
|
|
24
|
-
return options[cursor - 1];
|
|
25
|
-
};
|
|
26
|
-
/* eslint-enable flowtype/no-weak-types */
|
|
27
|
-
/*******
|
|
28
|
-
*
|
|
29
|
-
* Returns, for a non-negative integer argument `n`, the series `[0 .. n]`.
|
|
30
|
-
*
|
|
31
|
-
* ```typescript
|
|
32
|
-
* import { seq } from './jssm';
|
|
33
|
-
*
|
|
34
|
-
* seq(5); // [0, 1, 2, 3, 4]
|
|
35
|
-
* seq(0); // []
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
function seq(n) {
|
|
40
|
-
if (!(Number.isInteger(n))) {
|
|
41
|
-
throw new TypeError('seq/1 takes a non-negative integer n as an argument');
|
|
42
|
-
}
|
|
43
|
-
if (n < 0) {
|
|
44
|
-
throw new TypeError('seq/1 takes a non-negative integer n as an argument');
|
|
45
|
-
}
|
|
46
|
-
return (new Array(n))
|
|
47
|
-
.fill(true)
|
|
48
|
-
.map((_, i) => i);
|
|
49
|
-
}
|
|
50
|
-
/*******
|
|
51
|
-
*
|
|
52
|
-
* Returns the histograph of an array as a `Map`. Makes no attempt to cope
|
|
53
|
-
* with deep equality; will fail for complex contents, as such.
|
|
54
|
-
*
|
|
55
|
-
* ```typescript
|
|
56
|
-
* import { histograph } from './jssm';
|
|
57
|
-
*
|
|
58
|
-
* histograph( [0, 0, 1, 1, 2, 2, 1] ); // Map()
|
|
59
|
-
* ```
|
|
60
|
-
*
|
|
61
|
-
*/
|
|
62
|
-
const histograph = (ar) => // eslint-disable-line flowtype/no-weak-types
|
|
63
|
-
ar.sort()
|
|
64
|
-
.reduce((m, v) => // TODO FIXME eslint-disable-line flowtype/no-weak-types,no-sequences
|
|
65
|
-
(m.set(v, (m.has(v) ? m.get(v) + 1 : 1)), m), new Map());
|
|
66
|
-
const weighted_sample_select = (n, options, probability_property) => // TODO FIXME no any // eslint-disable-line flowtype/no-weak-types
|
|
67
|
-
seq(n)
|
|
68
|
-
.map((_i) => // TODO FIXME eslint-disable-line flowtype/no-weak-types
|
|
69
|
-
weighted_rand_select(options, probability_property));
|
|
70
|
-
const weighted_histo_key = (n, opts, prob_prop, extract) => // TODO FIXME no any // eslint-disable-line flowtype/no-weak-types
|
|
71
|
-
histograph(weighted_sample_select(n, opts, prob_prop)
|
|
72
|
-
.map((s) => s[extract] // TODO FIXME eslint-disable-line flowtype/no-weak-types
|
|
73
|
-
));
|
|
74
|
-
/*******
|
|
75
|
-
*
|
|
76
|
-
* Internal method generating names for edges for the hook lookup map. Not
|
|
77
|
-
* meant for external use.
|
|
78
|
-
*
|
|
79
|
-
*/
|
|
80
|
-
function name_bind_prop_and_state(prop, state) {
|
|
81
|
-
if (typeof prop !== 'string') {
|
|
82
|
-
throw new JssmError(undefined, `Name of property must be a string; got ${prop}`);
|
|
83
|
-
}
|
|
84
|
-
if (typeof state !== 'string') {
|
|
85
|
-
throw new JssmError(undefined, `Name of state must be a string; got ${prop}`);
|
|
86
|
-
}
|
|
87
|
-
return JSON.stringify([prop, state]);
|
|
88
|
-
}
|
|
89
|
-
/*******
|
|
90
|
-
*
|
|
91
|
-
* Internal method generating names for edges for the hook lookup map. Not
|
|
92
|
-
* meant for external use.
|
|
93
|
-
*
|
|
94
|
-
*/
|
|
95
|
-
const hook_name = (from, to) => JSON.stringify([from, to]);
|
|
96
|
-
/*******
|
|
97
|
-
*
|
|
98
|
-
* Internal method generating names for actions for the hook lookup map. Not
|
|
99
|
-
* meant for external use.
|
|
100
|
-
*
|
|
101
|
-
*/
|
|
102
|
-
const named_hook_name = (from, to, action) => JSON.stringify([from, to, action]);
|
|
103
|
-
/*******
|
|
104
|
-
*
|
|
105
|
-
* Creates a SplitMix32 random generator. Used by the randomness test suite.
|
|
106
|
-
*
|
|
107
|
-
* Sourced from `bryc`: https://github.com/bryc/code/blob/master/jshash/PRNGs.md#splitmix32
|
|
108
|
-
*
|
|
109
|
-
* Replaces the Mulberry generator, which was found to have problems
|
|
110
|
-
*
|
|
111
|
-
*/
|
|
112
|
-
function gen_splitmix32(a) {
|
|
113
|
-
if (a === undefined) {
|
|
114
|
-
a = new Date().getTime();
|
|
115
|
-
}
|
|
116
|
-
return function () {
|
|
117
|
-
a |= 0;
|
|
118
|
-
a = a + 0x9e3779b9 | 0;
|
|
119
|
-
var t = a ^ a >>> 16;
|
|
120
|
-
t = Math.imul(t, 0x21f0aaad);
|
|
121
|
-
t = t ^ t >>> 15;
|
|
122
|
-
t = Math.imul(t, 0x735a2d97);
|
|
123
|
-
return ((t = t ^ t >>> 15) >>> 0) / 4294967296;
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
/*******
|
|
127
|
-
*
|
|
128
|
-
* Reduces an array to its unique contents. Compares with `===` and makes no
|
|
129
|
-
* effort to deep-compare contents; two matching arrays or objects contained
|
|
130
|
-
* will be treated as distinct, according to javascript rules. This also means
|
|
131
|
-
* that `NaNs` will be ***dropped***, because they do not self-compare.
|
|
132
|
-
*
|
|
133
|
-
* ```typescript
|
|
134
|
-
* unique( [] ); // []
|
|
135
|
-
* unique( [0,0] ); // [0]
|
|
136
|
-
* unique( [0,1,2, 0,1,2, 0,1,2] ); // [0,1,2]
|
|
137
|
-
* unique( [ [1], [1] ] ); // [ [1], [1] ] because arrays don't match
|
|
138
|
-
* unique( [0,NaN,2] ); // [0,2]
|
|
139
|
-
* ```
|
|
140
|
-
*
|
|
141
|
-
*/
|
|
142
|
-
const unique = (arr) => arr.filter((v, i, a) => a.indexOf(v) === i);
|
|
143
|
-
/*******
|
|
144
|
-
*
|
|
145
|
-
* Lists all repeated items in an array along with their counts. Subject to
|
|
146
|
-
* matching rules of Map. `NaN` is manually removed because of conflict rules
|
|
147
|
-
* around {@link unique}. Because these are compared with `===` and because
|
|
148
|
-
* arrays and objects never match that way unless they're the same object,
|
|
149
|
-
* arrays and objects are never considered repeats.
|
|
150
|
-
*
|
|
151
|
-
* ```typescript
|
|
152
|
-
* find_repeated<string>([ ]); // []
|
|
153
|
-
* find_repeated<string>([ "one" ]); // []
|
|
154
|
-
* find_repeated<string>([ "one", "two" ]); // []
|
|
155
|
-
* find_repeated<string>([ "one", "one" ]); // [ ["one", 2] ]
|
|
156
|
-
* find_repeated<string>([ "one", "two", "one" ]); // [ ["one", 2] ]
|
|
157
|
-
* find_repeated<number>([ 0, NaN, 0, NaN ]); // [ [0, 2] ]
|
|
158
|
-
* ```
|
|
159
|
-
*
|
|
160
|
-
*/
|
|
161
|
-
function find_repeated(arr) {
|
|
162
|
-
const uniqued = unique(arr);
|
|
163
|
-
if (uniqued.length !== arr.length) {
|
|
164
|
-
const residue_keys = new Map();
|
|
165
|
-
arr.forEach(k => residue_keys.set(k, residue_keys.has(k)
|
|
166
|
-
? (residue_keys.get(k) + 1)
|
|
167
|
-
: 1));
|
|
168
|
-
uniqued.forEach(k => residue_keys.set(k, residue_keys.get(k) - 1));
|
|
169
|
-
return [...residue_keys.entries()]
|
|
170
|
-
.filter((e) => ((e[1] > 0) && (!(Number.isNaN(e[0])))))
|
|
171
|
-
.map((e) => [e[0], e[1] + 1]);
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
return [];
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
function sleep(ms) {
|
|
178
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
179
|
-
}
|
|
180
|
-
export { seq, unique, find_repeated, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string, name_bind_prop_and_state, hook_name, named_hook_name, gen_splitmix32, sleep };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { JssmStateConfig, JssmBaseTheme } from '../jssm_types';
|
|
2
|
-
declare const base_state_style: JssmStateConfig;
|
|
3
|
-
declare const base_active_state_style: JssmStateConfig;
|
|
4
|
-
declare const base_terminal_state_style: JssmStateConfig;
|
|
5
|
-
declare const base_active_terminal_state_style: JssmStateConfig;
|
|
6
|
-
declare const base_start_state_style: JssmStateConfig;
|
|
7
|
-
declare const base_active_start_state_style: JssmStateConfig;
|
|
8
|
-
declare const base_end_state_style: JssmStateConfig;
|
|
9
|
-
declare const base_active_end_state_style: JssmStateConfig;
|
|
10
|
-
declare const base_theme: JssmBaseTheme;
|
|
11
|
-
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, base_theme, base_theme as theme };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
const base_state_style = {
|
|
2
|
-
shape: 'rectangle',
|
|
3
|
-
backgroundColor: 'white',
|
|
4
|
-
textColor: 'black',
|
|
5
|
-
borderColor: 'black'
|
|
6
|
-
};
|
|
7
|
-
const base_active_state_style = {
|
|
8
|
-
textColor: 'white',
|
|
9
|
-
backgroundColor: 'dodgerblue4'
|
|
10
|
-
};
|
|
11
|
-
const base_hooked_state_style = {
|
|
12
|
-
shape: 'component'
|
|
13
|
-
};
|
|
14
|
-
const base_terminal_state_style = {
|
|
15
|
-
textColor: 'white',
|
|
16
|
-
backgroundColor: 'crimson'
|
|
17
|
-
};
|
|
18
|
-
const base_active_terminal_state_style = {
|
|
19
|
-
textColor: 'white',
|
|
20
|
-
backgroundColor: 'indigo'
|
|
21
|
-
};
|
|
22
|
-
const base_start_state_style = {
|
|
23
|
-
backgroundColor: 'yellow'
|
|
24
|
-
};
|
|
25
|
-
const base_active_start_state_style = {
|
|
26
|
-
backgroundColor: 'yellowgreen'
|
|
27
|
-
};
|
|
28
|
-
const base_active_hooked_state_style = {
|
|
29
|
-
backgroundColor: 'yellowgreen'
|
|
30
|
-
};
|
|
31
|
-
const base_end_state_style = {
|
|
32
|
-
textColor: 'white',
|
|
33
|
-
backgroundColor: 'darkolivegreen'
|
|
34
|
-
};
|
|
35
|
-
const base_active_end_state_style = {
|
|
36
|
-
textColor: 'white',
|
|
37
|
-
backgroundColor: 'darkgreen'
|
|
38
|
-
};
|
|
39
|
-
const base_theme = {
|
|
40
|
-
name: 'base',
|
|
41
|
-
state: base_state_style,
|
|
42
|
-
start: base_start_state_style,
|
|
43
|
-
end: base_end_state_style,
|
|
44
|
-
terminal: base_terminal_state_style,
|
|
45
|
-
hooked: base_hooked_state_style,
|
|
46
|
-
active: base_active_state_style,
|
|
47
|
-
active_start: base_active_start_state_style,
|
|
48
|
-
active_end: base_active_end_state_style,
|
|
49
|
-
active_terminal: base_active_terminal_state_style,
|
|
50
|
-
active_hooked: base_active_hooked_state_style,
|
|
51
|
-
legal: undefined,
|
|
52
|
-
main: undefined,
|
|
53
|
-
forced: undefined,
|
|
54
|
-
action: undefined,
|
|
55
|
-
graph: undefined,
|
|
56
|
-
title: undefined // TODO FIXME
|
|
57
|
-
};
|
|
58
|
-
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, base_theme, base_theme as theme };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { JssmStateConfig, JssmBaseTheme } from '../jssm_types';
|
|
2
|
-
declare const base_state_style: JssmStateConfig;
|
|
3
|
-
declare const base_active_state_style: JssmStateConfig;
|
|
4
|
-
declare const base_terminal_state_style: JssmStateConfig;
|
|
5
|
-
declare const base_active_terminal_state_style: JssmStateConfig;
|
|
6
|
-
declare const base_start_state_style: JssmStateConfig;
|
|
7
|
-
declare const base_active_start_state_style: JssmStateConfig;
|
|
8
|
-
declare const base_end_state_style: JssmStateConfig;
|
|
9
|
-
declare const base_active_end_state_style: JssmStateConfig;
|
|
10
|
-
declare const bold_theme: JssmBaseTheme;
|
|
11
|
-
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, bold_theme, bold_theme as theme };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
const base_state_style = {
|
|
2
|
-
shape: 'rectangle',
|
|
3
|
-
backgroundColor: 'khaki',
|
|
4
|
-
textColor: 'black',
|
|
5
|
-
borderColor: 'black'
|
|
6
|
-
};
|
|
7
|
-
const base_active_state_style = {
|
|
8
|
-
textColor: 'white',
|
|
9
|
-
backgroundColor: 'dodgerblue4'
|
|
10
|
-
};
|
|
11
|
-
const base_hooked_state_style = {
|
|
12
|
-
shape: 'component'
|
|
13
|
-
};
|
|
14
|
-
const base_terminal_state_style = {
|
|
15
|
-
textColor: 'white',
|
|
16
|
-
backgroundColor: 'crimson'
|
|
17
|
-
};
|
|
18
|
-
const base_active_terminal_state_style = {
|
|
19
|
-
textColor: 'white',
|
|
20
|
-
backgroundColor: 'indigo'
|
|
21
|
-
};
|
|
22
|
-
const base_start_state_style = {
|
|
23
|
-
backgroundColor: 'yellow'
|
|
24
|
-
};
|
|
25
|
-
const base_active_start_state_style = {
|
|
26
|
-
backgroundColor: 'yellowgreen'
|
|
27
|
-
};
|
|
28
|
-
const base_active_hooked_state_style = {
|
|
29
|
-
backgroundColor: 'yellowgreen'
|
|
30
|
-
};
|
|
31
|
-
const base_end_state_style = {
|
|
32
|
-
textColor: 'white',
|
|
33
|
-
backgroundColor: 'darkolivegreen'
|
|
34
|
-
};
|
|
35
|
-
const base_active_end_state_style = {
|
|
36
|
-
textColor: 'white',
|
|
37
|
-
backgroundColor: 'darkgreen'
|
|
38
|
-
};
|
|
39
|
-
const bold_theme = {
|
|
40
|
-
name: 'bold',
|
|
41
|
-
state: base_state_style,
|
|
42
|
-
start: base_start_state_style,
|
|
43
|
-
end: base_end_state_style,
|
|
44
|
-
terminal: base_terminal_state_style,
|
|
45
|
-
hooked: base_hooked_state_style,
|
|
46
|
-
active: base_active_state_style,
|
|
47
|
-
active_start: base_active_start_state_style,
|
|
48
|
-
active_end: base_active_end_state_style,
|
|
49
|
-
active_terminal: base_active_terminal_state_style,
|
|
50
|
-
active_hooked: base_active_hooked_state_style,
|
|
51
|
-
legal: undefined,
|
|
52
|
-
main: undefined,
|
|
53
|
-
forced: undefined,
|
|
54
|
-
action: undefined,
|
|
55
|
-
graph: undefined,
|
|
56
|
-
title: undefined // TODO FIXME
|
|
57
|
-
};
|
|
58
|
-
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, bold_theme, bold_theme as theme };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { JssmStateConfig, JssmBaseTheme } from '../jssm_types';
|
|
2
|
-
declare const base_state_style: JssmStateConfig;
|
|
3
|
-
declare const base_active_state_style: JssmStateConfig;
|
|
4
|
-
declare const base_terminal_state_style: JssmStateConfig;
|
|
5
|
-
declare const base_active_terminal_state_style: JssmStateConfig;
|
|
6
|
-
declare const base_start_state_style: JssmStateConfig;
|
|
7
|
-
declare const base_active_start_state_style: JssmStateConfig;
|
|
8
|
-
declare const base_end_state_style: JssmStateConfig;
|
|
9
|
-
declare const base_active_end_state_style: JssmStateConfig;
|
|
10
|
-
declare const default_theme: JssmBaseTheme;
|
|
11
|
-
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, default_theme, default_theme as theme };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
const base_state_style = {
|
|
2
|
-
shape: 'rectangle',
|
|
3
|
-
backgroundColor: 'white',
|
|
4
|
-
textColor: 'black',
|
|
5
|
-
borderColor: 'black'
|
|
6
|
-
};
|
|
7
|
-
const base_active_state_style = {
|
|
8
|
-
textColor: 'white',
|
|
9
|
-
backgroundColor: 'dodgerblue4'
|
|
10
|
-
};
|
|
11
|
-
const base_hooked_state_style = {
|
|
12
|
-
shape: 'component'
|
|
13
|
-
};
|
|
14
|
-
const base_terminal_state_style = {
|
|
15
|
-
textColor: 'white',
|
|
16
|
-
backgroundColor: 'crimson'
|
|
17
|
-
};
|
|
18
|
-
const base_active_terminal_state_style = {
|
|
19
|
-
textColor: 'white',
|
|
20
|
-
backgroundColor: 'indigo'
|
|
21
|
-
};
|
|
22
|
-
const base_start_state_style = {
|
|
23
|
-
backgroundColor: 'yellow'
|
|
24
|
-
};
|
|
25
|
-
const base_active_start_state_style = {
|
|
26
|
-
backgroundColor: 'yellowgreen'
|
|
27
|
-
};
|
|
28
|
-
const base_active_hooked_state_style = {
|
|
29
|
-
backgroundColor: 'yellowgreen'
|
|
30
|
-
};
|
|
31
|
-
const base_end_state_style = {
|
|
32
|
-
textColor: 'white',
|
|
33
|
-
backgroundColor: 'darkolivegreen'
|
|
34
|
-
};
|
|
35
|
-
const base_active_end_state_style = {
|
|
36
|
-
textColor: 'white',
|
|
37
|
-
backgroundColor: 'darkgreen'
|
|
38
|
-
};
|
|
39
|
-
const default_theme = {
|
|
40
|
-
name: 'default',
|
|
41
|
-
state: base_state_style,
|
|
42
|
-
start: base_start_state_style,
|
|
43
|
-
end: base_end_state_style,
|
|
44
|
-
terminal: base_terminal_state_style,
|
|
45
|
-
hooked: base_hooked_state_style,
|
|
46
|
-
active: base_active_state_style,
|
|
47
|
-
active_start: base_active_start_state_style,
|
|
48
|
-
active_end: base_active_end_state_style,
|
|
49
|
-
active_terminal: base_active_terminal_state_style,
|
|
50
|
-
active_hooked: base_active_hooked_state_style,
|
|
51
|
-
legal: undefined,
|
|
52
|
-
main: undefined,
|
|
53
|
-
forced: undefined,
|
|
54
|
-
action: undefined,
|
|
55
|
-
graph: undefined,
|
|
56
|
-
title: undefined // TODO FIXME
|
|
57
|
-
};
|
|
58
|
-
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, default_theme, default_theme as theme };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { JssmStateConfig, JssmBaseTheme } from '../jssm_types';
|
|
2
|
-
declare const base_state_style: JssmStateConfig;
|
|
3
|
-
declare const base_active_state_style: JssmStateConfig;
|
|
4
|
-
declare const base_terminal_state_style: JssmStateConfig;
|
|
5
|
-
declare const base_active_terminal_state_style: JssmStateConfig;
|
|
6
|
-
declare const base_start_state_style: JssmStateConfig;
|
|
7
|
-
declare const base_active_start_state_style: JssmStateConfig;
|
|
8
|
-
declare const base_end_state_style: JssmStateConfig;
|
|
9
|
-
declare const base_active_end_state_style: JssmStateConfig;
|
|
10
|
-
declare const modern_theme: JssmBaseTheme;
|
|
11
|
-
export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, modern_theme, modern_theme as theme };
|