jssm 5.34.0 → 5.41.15
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/.codeclimate.yml +22 -22
- package/.editorconfig +12 -12
- package/.eslintrc +20 -20
- package/.nycrc +6 -6
- package/.travis.yml +8 -8
- package/LICENSE.md +21 -21
- package/README.md +997 -863
- package/dist/es6/jssm-dot.d.ts +6 -6
- package/dist/es6/jssm-dot.js +1 -1
- package/dist/es6/jssm.d.ts +100 -100
- package/dist/es6/jssm.js +792 -792
- package/dist/es6/jssm_types.d.ts +151 -151
- package/dist/es6/jssm_types.js +1 -1
- package/dist/es6/jssm_util.d.ts +8 -8
- package/dist/es6/jssm_util.js +34 -34
- package/dist/es6/version.d.ts +2 -2
- package/dist/es6/version.js +2 -2
- package/dist/jssm.es5.cjs.js +1 -1
- package/dist/jssm.es5.iife.js +1 -0
- package/jest-spec.config.js +27 -27
- package/jest-stoch.config.js +27 -27
- package/jssm-dot.d.ts +6 -6
- package/jssm.d.ts +100 -100
- package/jssm_types.d.ts +151 -151
- package/jssm_util.d.ts +8 -8
- package/package.json +123 -120
- package/rollup.config.iife.js +44 -44
- package/rollup.config.js +44 -44
- package/src/demo/index.html +38 -38
- package/src/demo/style.css +1 -1
- package/src/ts/jssm-dot.peg +928 -874
- package/src/ts/jssm.ts +1120 -1120
- package/src/ts/jssm_types.ts +346 -346
- package/src/ts/jssm_util.ts +100 -100
- package/src/ts/tests/actions.spec.ts +167 -167
- package/src/ts/tests/arrange.spec.ts +72 -72
- package/src/ts/tests/arrange.stoch.ts +4 -4
- package/src/ts/tests/array_box_if_string.spec.ts +30 -31
- package/src/ts/tests/array_transitions.spec.ts +129 -129
- package/src/ts/tests/arrow unicode.spec.ts +88 -88
- package/src/ts/tests/arrow.spec.ts +124 -124
- package/src/ts/tests/colors.spec.ts +58 -58
- package/src/ts/tests/comment.spec.ts +134 -134
- package/src/ts/tests/compile.spec.ts +79 -79
- package/src/ts/tests/constants.spec.ts +98 -98
- package/src/ts/tests/cycles.spec.ts +153 -153
- package/src/ts/tests/dot_preamble.spec.ts +16 -16
- package/src/ts/tests/embedded_sm.spec.ts +36 -36
- package/src/ts/tests/flow.spec.ts +22 -22
- package/src/ts/tests/forced transitions.spec.ts +26 -26
- package/src/ts/tests/general.spec.ts +933 -933
- package/src/ts/tests/graph node lists.spec.ts +21 -21
- package/src/ts/tests/histo.spec.ts +24 -24
- package/src/ts/tests/hooks.spec.ts +28 -0
- package/src/ts/tests/language.spec.ts +37 -37
- package/src/ts/tests/language_data/belarussian.json +13 -13
- package/src/ts/tests/language_data/bengali.json +15 -15
- package/src/ts/tests/language_data/emoji.json +21 -21
- package/src/ts/tests/language_data/english.json +16 -16
- package/src/ts/tests/language_data/french.json +16 -16
- package/src/ts/tests/language_data/german.json +16 -16
- package/src/ts/tests/language_data/hebrew.json +16 -16
- package/src/ts/tests/language_data/portuguese.json +12 -12
- package/src/ts/tests/language_data/russian.json +12 -12
- package/src/ts/tests/language_data/spanish.json +17 -17
- package/src/ts/tests/language_data/ukrainian.json +18 -18
- package/src/ts/tests/layout.spec.ts +29 -29
- package/src/ts/tests/machine_attributes.spec.ts +398 -398
- package/src/ts/tests/machine_name.spec.ts +14 -14
- package/src/ts/tests/named lists.spec.ts +24 -19
- package/src/ts/tests/nominated states.spec.ts +133 -133
- package/src/ts/tests/parse actions.spec.ts +32 -32
- package/src/ts/tests/parse.spec.ts +94 -94
- package/src/ts/tests/probability.spec.ts +146 -146
- package/src/ts/tests/r639.spec.ts +27 -27
- package/src/ts/tests/sample_select.spec.ts +173 -173
- package/src/ts/tests/seq.spec.ts +14 -16
- package/src/ts/tests/seq.stoch.ts +83 -0
- package/src/ts/tests/shapes.spec.ts +63 -63
- package/src/ts/tests/sm_tag.spec.ts +37 -37
- package/src/ts/tests/special characters.spec.ts +39 -39
- package/src/ts/tests/state_declaration.spec.ts +214 -200
- package/src/ts/tests/state_style.spec.ts +82 -39
- package/src/ts/tests/stop light.spec.ts +157 -157
- package/src/ts/tests/stripes.spec.ts +52 -52
- package/src/ts/tests/theme.spec.ts +45 -45
- package/src/ts/tests/weighted_histo_key.spec.ts +22 -22
- package/src/ts/tests/weighted_rand_select.spec.ts +27 -27
- package/src/ts/tests/weighted_sample_select.spec.ts +24 -26
- package/src/ts/version.ts +1 -1
- package/tree.txt +1794 -0
- package/tsconfig.json +27 -27
- package/version.d.ts +2 -2
package/dist/es6/jssm_types.d.ts
CHANGED
|
@@ -1,151 +1,151 @@
|
|
|
1
|
-
declare type StateType = string;
|
|
2
|
-
declare type JssmSuccess = {
|
|
3
|
-
success: true;
|
|
4
|
-
};
|
|
5
|
-
declare type JssmFailure = {
|
|
6
|
-
success: false;
|
|
7
|
-
error: any;
|
|
8
|
-
};
|
|
9
|
-
declare type JssmIncomplete = {
|
|
10
|
-
success: 'incomplete';
|
|
11
|
-
};
|
|
12
|
-
declare type JssmResult = JssmSuccess | JssmFailure | JssmIncomplete;
|
|
13
|
-
declare type JssmColor = string;
|
|
14
|
-
declare type JssmPermitted = 'required' | 'disallowed';
|
|
15
|
-
declare type JssmPermittedOpt = 'required' | 'disallowed' | 'optional';
|
|
16
|
-
declare type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>';
|
|
17
|
-
declare type JssmShape = "box" | "polygon" | "ellipse" | "oval" | "circle" | "point" | "egg" | "triangle" | "plaintext" | "plain" | "diamond" | "trapezium" | "parallelogram" | "house" | "pentagon" | "hexagon" | "septagon" | "octagon" | "doublecircle" | "doubleoctagon" | "tripleoctagon" | "invtriangle" | "invtrapezium" | "invhouse" | "Mdiamond" | "Msquare" | "Mcircle" | "rect" | "rectangle" | "square" | "star" | "none" | "underline" | "cylinder" | "note" | "tab" | "folder" | "box3d" | "component" | "promoter" | "cds" | "terminator" | "utr" | "primersite" | "restrictionsite" | "fivepoverhang" | "threepoverhang" | "noverhang" | "assembly" | "signature" | "insulator" | "ribosite" | "rnastab" | "proteasesite" | "proteinstab" | "rpromoter" | "rarrow" | "larrow" | "lpromoter" | "record";
|
|
18
|
-
declare type JssmArrowDirection = 'left' | 'right' | 'both';
|
|
19
|
-
declare type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced';
|
|
20
|
-
declare type JssmLayout = 'dot' | 'circo' | 'twopi' | 'fdp';
|
|
21
|
-
declare type JssmCorner = 'regular' | 'rounded' | 'lined';
|
|
22
|
-
declare type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
|
|
23
|
-
declare type FslDirection = 'up' | 'right' | 'down' | 'left';
|
|
24
|
-
declare type FslTheme = 'default' | 'ocean' | 'modern' | 'none';
|
|
25
|
-
declare type JssmTransitionPermitter<DataType> = (OldState: StateType, NewState: StateType, OldData: DataType, NewData: DataType) => boolean;
|
|
26
|
-
declare type JssmTransitionPermitterMaybeArray<DataType> = JssmTransitionPermitter<DataType> | Array<JssmTransitionPermitter<DataType>>;
|
|
27
|
-
declare type JssmTransition<DataType> = {
|
|
28
|
-
from: StateType;
|
|
29
|
-
to: StateType;
|
|
30
|
-
name?: string;
|
|
31
|
-
action?: StateType;
|
|
32
|
-
check?: JssmTransitionPermitterMaybeArray<DataType>;
|
|
33
|
-
probability?: number;
|
|
34
|
-
kind: JssmArrowKind;
|
|
35
|
-
forced_only: boolean;
|
|
36
|
-
main_path: boolean;
|
|
37
|
-
};
|
|
38
|
-
declare type JssmTransitions<DataType> = Array<JssmTransition<DataType>>;
|
|
39
|
-
declare type JssmTransitionList = {
|
|
40
|
-
entrances: Array<StateType>;
|
|
41
|
-
exits: Array<StateType>;
|
|
42
|
-
};
|
|
43
|
-
declare type JssmTransitionCycle = {
|
|
44
|
-
key: 'cycle';
|
|
45
|
-
value: StateType;
|
|
46
|
-
};
|
|
47
|
-
declare type JssmTransitionRule = StateType | JssmTransitionCycle;
|
|
48
|
-
declare type JssmGenericState = {
|
|
49
|
-
from: Array<StateType>;
|
|
50
|
-
name: StateType;
|
|
51
|
-
to: Array<StateType>;
|
|
52
|
-
complete: boolean;
|
|
53
|
-
};
|
|
54
|
-
declare type JssmMachineInternalState<DataType> = {
|
|
55
|
-
internal_state_impl_version: 1;
|
|
56
|
-
state: StateType;
|
|
57
|
-
states: Map<StateType, JssmGenericState>;
|
|
58
|
-
named_transitions: Map<StateType, number>;
|
|
59
|
-
edge_map: Map<StateType, Map<StateType, number>>;
|
|
60
|
-
actions: Map<StateType, Map<StateType, number>>;
|
|
61
|
-
reverse_actions: Map<StateType, Map<StateType, number>>;
|
|
62
|
-
edges: Array<JssmTransition<DataType>>;
|
|
63
|
-
};
|
|
64
|
-
declare type JssmStatePermitter<DataType> = (OldState: StateType, NewState: StateType, OldData: DataType, NewData: DataType) => boolean;
|
|
65
|
-
declare type JssmStatePermitterMaybeArray<DataType> = JssmStatePermitter<DataType> | Array<JssmStatePermitter<DataType>>;
|
|
66
|
-
declare type JssmGenericMachine<DataType> = {
|
|
67
|
-
name?: string;
|
|
68
|
-
state: StateType;
|
|
69
|
-
data?: DataType;
|
|
70
|
-
nodes?: Array<StateType>;
|
|
71
|
-
transitions: JssmTransitions<DataType>;
|
|
72
|
-
check?: JssmStatePermitterMaybeArray<DataType>;
|
|
73
|
-
min_transitions?: number;
|
|
74
|
-
max_transitions?: number;
|
|
75
|
-
allow_empty?: boolean;
|
|
76
|
-
allow_islands?: boolean;
|
|
77
|
-
allow_force?: boolean;
|
|
78
|
-
keep_history?: boolean | number;
|
|
79
|
-
};
|
|
80
|
-
declare type JssmStateDeclarationRule = {
|
|
81
|
-
key: string;
|
|
82
|
-
value: any;
|
|
83
|
-
};
|
|
84
|
-
declare type JssmStateDeclaration = {
|
|
85
|
-
declarations: Array<JssmStateDeclarationRule>;
|
|
86
|
-
shape?: JssmShape;
|
|
87
|
-
color?: JssmColor;
|
|
88
|
-
corners?: JssmCorner;
|
|
89
|
-
linestyle?: JssmLineStyle;
|
|
90
|
-
textColor?: JssmColor;
|
|
91
|
-
backgroundColor?: JssmColor;
|
|
92
|
-
borderColor?: JssmColor;
|
|
93
|
-
state: StateType;
|
|
94
|
-
};
|
|
95
|
-
declare type JssmGenericConfig<DataType> = {
|
|
96
|
-
graph_layout?: JssmLayout;
|
|
97
|
-
complete?: Array<StateType>;
|
|
98
|
-
transitions: JssmTransitions<DataType>;
|
|
99
|
-
theme?: FslTheme;
|
|
100
|
-
flow?: FslDirection;
|
|
101
|
-
name?: string;
|
|
102
|
-
data?: DataType;
|
|
103
|
-
nodes?: Array<StateType>;
|
|
104
|
-
check?: JssmStatePermitterMaybeArray<DataType>;
|
|
105
|
-
min_exits?: number;
|
|
106
|
-
max_exits?: number;
|
|
107
|
-
allow_islands?: false;
|
|
108
|
-
allow_force?: false;
|
|
109
|
-
actions?: JssmPermittedOpt;
|
|
110
|
-
simplify_bidi?: boolean;
|
|
111
|
-
dot_preamble?: string;
|
|
112
|
-
start_states: Array<StateType>;
|
|
113
|
-
end_states?: Array<StateType>;
|
|
114
|
-
state_declaration?: Array<Object>;
|
|
115
|
-
arrange_declaration?: Array<Array<StateType>>;
|
|
116
|
-
arrange_start_declaration?: Array<Array<StateType>>;
|
|
117
|
-
arrange_end_declaration?: Array<Array<StateType>>;
|
|
118
|
-
machine_author?: string | Array<string>;
|
|
119
|
-
machine_comment?: string;
|
|
120
|
-
machine_contributor?: string | Array<string>;
|
|
121
|
-
machine_definition?: string;
|
|
122
|
-
machine_language?: string;
|
|
123
|
-
machine_license?: string;
|
|
124
|
-
machine_name?: string;
|
|
125
|
-
machine_version?: string;
|
|
126
|
-
fsl_version?: string;
|
|
127
|
-
auto_api?: boolean | string;
|
|
128
|
-
};
|
|
129
|
-
declare type JssmCompileRule = {
|
|
130
|
-
agg_as: string;
|
|
131
|
-
val: any;
|
|
132
|
-
};
|
|
133
|
-
declare type JssmCompileSe = {
|
|
134
|
-
to: StateType;
|
|
135
|
-
se: JssmCompileSe;
|
|
136
|
-
kind: JssmArrow;
|
|
137
|
-
l_action?: StateType;
|
|
138
|
-
r_action?: StateType;
|
|
139
|
-
l_probability: number;
|
|
140
|
-
r_probability: number;
|
|
141
|
-
};
|
|
142
|
-
declare type JssmCompileSeStart<DataType> = {
|
|
143
|
-
from: DataType;
|
|
144
|
-
se: JssmCompileSe;
|
|
145
|
-
key: string;
|
|
146
|
-
value?: string | number;
|
|
147
|
-
name?: string;
|
|
148
|
-
};
|
|
149
|
-
declare type JssmParseTree = Array<JssmCompileSeStart<StateType>>;
|
|
150
|
-
declare type JssmParseFunctionType = (string: any) => JssmParseTree;
|
|
151
|
-
export { JssmColor, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmLayout, JssmParseFunctionType, JssmMachineInternalState, FslDirection, FslTheme };
|
|
1
|
+
declare type StateType = string;
|
|
2
|
+
declare type JssmSuccess = {
|
|
3
|
+
success: true;
|
|
4
|
+
};
|
|
5
|
+
declare type JssmFailure = {
|
|
6
|
+
success: false;
|
|
7
|
+
error: any;
|
|
8
|
+
};
|
|
9
|
+
declare type JssmIncomplete = {
|
|
10
|
+
success: 'incomplete';
|
|
11
|
+
};
|
|
12
|
+
declare type JssmResult = JssmSuccess | JssmFailure | JssmIncomplete;
|
|
13
|
+
declare type JssmColor = string;
|
|
14
|
+
declare type JssmPermitted = 'required' | 'disallowed';
|
|
15
|
+
declare type JssmPermittedOpt = 'required' | 'disallowed' | 'optional';
|
|
16
|
+
declare type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>';
|
|
17
|
+
declare type JssmShape = "box" | "polygon" | "ellipse" | "oval" | "circle" | "point" | "egg" | "triangle" | "plaintext" | "plain" | "diamond" | "trapezium" | "parallelogram" | "house" | "pentagon" | "hexagon" | "septagon" | "octagon" | "doublecircle" | "doubleoctagon" | "tripleoctagon" | "invtriangle" | "invtrapezium" | "invhouse" | "Mdiamond" | "Msquare" | "Mcircle" | "rect" | "rectangle" | "square" | "star" | "none" | "underline" | "cylinder" | "note" | "tab" | "folder" | "box3d" | "component" | "promoter" | "cds" | "terminator" | "utr" | "primersite" | "restrictionsite" | "fivepoverhang" | "threepoverhang" | "noverhang" | "assembly" | "signature" | "insulator" | "ribosite" | "rnastab" | "proteasesite" | "proteinstab" | "rpromoter" | "rarrow" | "larrow" | "lpromoter" | "record";
|
|
18
|
+
declare type JssmArrowDirection = 'left' | 'right' | 'both';
|
|
19
|
+
declare type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced';
|
|
20
|
+
declare type JssmLayout = 'dot' | 'circo' | 'twopi' | 'fdp';
|
|
21
|
+
declare type JssmCorner = 'regular' | 'rounded' | 'lined';
|
|
22
|
+
declare type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
|
|
23
|
+
declare type FslDirection = 'up' | 'right' | 'down' | 'left';
|
|
24
|
+
declare type FslTheme = 'default' | 'ocean' | 'modern' | 'none';
|
|
25
|
+
declare type JssmTransitionPermitter<DataType> = (OldState: StateType, NewState: StateType, OldData: DataType, NewData: DataType) => boolean;
|
|
26
|
+
declare type JssmTransitionPermitterMaybeArray<DataType> = JssmTransitionPermitter<DataType> | Array<JssmTransitionPermitter<DataType>>;
|
|
27
|
+
declare type JssmTransition<DataType> = {
|
|
28
|
+
from: StateType;
|
|
29
|
+
to: StateType;
|
|
30
|
+
name?: string;
|
|
31
|
+
action?: StateType;
|
|
32
|
+
check?: JssmTransitionPermitterMaybeArray<DataType>;
|
|
33
|
+
probability?: number;
|
|
34
|
+
kind: JssmArrowKind;
|
|
35
|
+
forced_only: boolean;
|
|
36
|
+
main_path: boolean;
|
|
37
|
+
};
|
|
38
|
+
declare type JssmTransitions<DataType> = Array<JssmTransition<DataType>>;
|
|
39
|
+
declare type JssmTransitionList = {
|
|
40
|
+
entrances: Array<StateType>;
|
|
41
|
+
exits: Array<StateType>;
|
|
42
|
+
};
|
|
43
|
+
declare type JssmTransitionCycle = {
|
|
44
|
+
key: 'cycle';
|
|
45
|
+
value: StateType;
|
|
46
|
+
};
|
|
47
|
+
declare type JssmTransitionRule = StateType | JssmTransitionCycle;
|
|
48
|
+
declare type JssmGenericState = {
|
|
49
|
+
from: Array<StateType>;
|
|
50
|
+
name: StateType;
|
|
51
|
+
to: Array<StateType>;
|
|
52
|
+
complete: boolean;
|
|
53
|
+
};
|
|
54
|
+
declare type JssmMachineInternalState<DataType> = {
|
|
55
|
+
internal_state_impl_version: 1;
|
|
56
|
+
state: StateType;
|
|
57
|
+
states: Map<StateType, JssmGenericState>;
|
|
58
|
+
named_transitions: Map<StateType, number>;
|
|
59
|
+
edge_map: Map<StateType, Map<StateType, number>>;
|
|
60
|
+
actions: Map<StateType, Map<StateType, number>>;
|
|
61
|
+
reverse_actions: Map<StateType, Map<StateType, number>>;
|
|
62
|
+
edges: Array<JssmTransition<DataType>>;
|
|
63
|
+
};
|
|
64
|
+
declare type JssmStatePermitter<DataType> = (OldState: StateType, NewState: StateType, OldData: DataType, NewData: DataType) => boolean;
|
|
65
|
+
declare type JssmStatePermitterMaybeArray<DataType> = JssmStatePermitter<DataType> | Array<JssmStatePermitter<DataType>>;
|
|
66
|
+
declare type JssmGenericMachine<DataType> = {
|
|
67
|
+
name?: string;
|
|
68
|
+
state: StateType;
|
|
69
|
+
data?: DataType;
|
|
70
|
+
nodes?: Array<StateType>;
|
|
71
|
+
transitions: JssmTransitions<DataType>;
|
|
72
|
+
check?: JssmStatePermitterMaybeArray<DataType>;
|
|
73
|
+
min_transitions?: number;
|
|
74
|
+
max_transitions?: number;
|
|
75
|
+
allow_empty?: boolean;
|
|
76
|
+
allow_islands?: boolean;
|
|
77
|
+
allow_force?: boolean;
|
|
78
|
+
keep_history?: boolean | number;
|
|
79
|
+
};
|
|
80
|
+
declare type JssmStateDeclarationRule = {
|
|
81
|
+
key: string;
|
|
82
|
+
value: any;
|
|
83
|
+
};
|
|
84
|
+
declare type JssmStateDeclaration = {
|
|
85
|
+
declarations: Array<JssmStateDeclarationRule>;
|
|
86
|
+
shape?: JssmShape;
|
|
87
|
+
color?: JssmColor;
|
|
88
|
+
corners?: JssmCorner;
|
|
89
|
+
linestyle?: JssmLineStyle;
|
|
90
|
+
textColor?: JssmColor;
|
|
91
|
+
backgroundColor?: JssmColor;
|
|
92
|
+
borderColor?: JssmColor;
|
|
93
|
+
state: StateType;
|
|
94
|
+
};
|
|
95
|
+
declare type JssmGenericConfig<DataType> = {
|
|
96
|
+
graph_layout?: JssmLayout;
|
|
97
|
+
complete?: Array<StateType>;
|
|
98
|
+
transitions: JssmTransitions<DataType>;
|
|
99
|
+
theme?: FslTheme;
|
|
100
|
+
flow?: FslDirection;
|
|
101
|
+
name?: string;
|
|
102
|
+
data?: DataType;
|
|
103
|
+
nodes?: Array<StateType>;
|
|
104
|
+
check?: JssmStatePermitterMaybeArray<DataType>;
|
|
105
|
+
min_exits?: number;
|
|
106
|
+
max_exits?: number;
|
|
107
|
+
allow_islands?: false;
|
|
108
|
+
allow_force?: false;
|
|
109
|
+
actions?: JssmPermittedOpt;
|
|
110
|
+
simplify_bidi?: boolean;
|
|
111
|
+
dot_preamble?: string;
|
|
112
|
+
start_states: Array<StateType>;
|
|
113
|
+
end_states?: Array<StateType>;
|
|
114
|
+
state_declaration?: Array<Object>;
|
|
115
|
+
arrange_declaration?: Array<Array<StateType>>;
|
|
116
|
+
arrange_start_declaration?: Array<Array<StateType>>;
|
|
117
|
+
arrange_end_declaration?: Array<Array<StateType>>;
|
|
118
|
+
machine_author?: string | Array<string>;
|
|
119
|
+
machine_comment?: string;
|
|
120
|
+
machine_contributor?: string | Array<string>;
|
|
121
|
+
machine_definition?: string;
|
|
122
|
+
machine_language?: string;
|
|
123
|
+
machine_license?: string;
|
|
124
|
+
machine_name?: string;
|
|
125
|
+
machine_version?: string;
|
|
126
|
+
fsl_version?: string;
|
|
127
|
+
auto_api?: boolean | string;
|
|
128
|
+
};
|
|
129
|
+
declare type JssmCompileRule = {
|
|
130
|
+
agg_as: string;
|
|
131
|
+
val: any;
|
|
132
|
+
};
|
|
133
|
+
declare type JssmCompileSe = {
|
|
134
|
+
to: StateType;
|
|
135
|
+
se: JssmCompileSe;
|
|
136
|
+
kind: JssmArrow;
|
|
137
|
+
l_action?: StateType;
|
|
138
|
+
r_action?: StateType;
|
|
139
|
+
l_probability: number;
|
|
140
|
+
r_probability: number;
|
|
141
|
+
};
|
|
142
|
+
declare type JssmCompileSeStart<DataType> = {
|
|
143
|
+
from: DataType;
|
|
144
|
+
se: JssmCompileSe;
|
|
145
|
+
key: string;
|
|
146
|
+
value?: string | number;
|
|
147
|
+
name?: string;
|
|
148
|
+
};
|
|
149
|
+
declare type JssmParseTree = Array<JssmCompileSeStart<StateType>>;
|
|
150
|
+
declare type JssmParseFunctionType = (string: any) => JssmParseTree;
|
|
151
|
+
export { JssmColor, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmLayout, JssmParseFunctionType, JssmMachineInternalState, FslDirection, FslTheme };
|
package/dist/es6/jssm_types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/dist/es6/jssm_util.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare function arr_uniq_p<T>(el: T, i: number, source: T[]): boolean;
|
|
2
|
-
declare const array_box_if_string: (n: any) => any;
|
|
3
|
-
declare const weighted_rand_select: Function;
|
|
4
|
-
declare const seq: Function;
|
|
5
|
-
declare const histograph: Function;
|
|
6
|
-
declare const weighted_sample_select: Function;
|
|
7
|
-
declare const weighted_histo_key: Function;
|
|
8
|
-
export { seq, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string };
|
|
1
|
+
declare function arr_uniq_p<T>(el: T, i: number, source: T[]): boolean;
|
|
2
|
+
declare const array_box_if_string: (n: any) => any;
|
|
3
|
+
declare const weighted_rand_select: Function;
|
|
4
|
+
declare const seq: Function;
|
|
5
|
+
declare const histograph: Function;
|
|
6
|
+
declare const weighted_sample_select: Function;
|
|
7
|
+
declare const weighted_histo_key: Function;
|
|
8
|
+
export { seq, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string };
|
package/dist/es6/jssm_util.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
function arr_uniq_p(el, i, source) {
|
|
2
|
-
return source.indexOf(el) === i;
|
|
3
|
-
}
|
|
4
|
-
const array_box_if_string = n => typeof n === 'string' ? [n] : n;
|
|
5
|
-
// this is explicitly about other peoples' data, so it has to be weakly typed
|
|
6
|
-
/* eslint-disable flowtype/no-weak-types */
|
|
7
|
-
const weighted_rand_select = (options, probability_property = 'probability') => {
|
|
8
|
-
if (!Array.isArray(options)) {
|
|
9
|
-
throw new TypeError('options must be a non-empty array of objects');
|
|
10
|
-
}
|
|
11
|
-
if (!(typeof options[0] === 'object')) {
|
|
12
|
-
throw new TypeError('options must be a non-empty array of objects');
|
|
13
|
-
}
|
|
14
|
-
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);
|
|
15
|
-
let cursor = 0, cursor_sum = 0;
|
|
16
|
-
while ((cursor_sum += or_one(options[cursor++][probability_property])) <= rnd) { } // eslint-disable-line no-empty,fp/no-loops
|
|
17
|
-
return options[cursor - 1];
|
|
18
|
-
};
|
|
19
|
-
/* eslint-enable flowtype/no-weak-types */
|
|
20
|
-
const seq = (n) => (new Array(n)).fill(true)
|
|
21
|
-
.map((_, i) => i);
|
|
22
|
-
const histograph = (ar) => // eslint-disable-line flowtype/no-weak-types
|
|
23
|
-
ar.sort()
|
|
24
|
-
.reduce((m, v) => // TODO FIXME eslint-disable-line flowtype/no-weak-types,no-sequences
|
|
25
|
-
(m.set(v, (m.has(v) ? m.get(v) + 1 : 1)), m), new Map());
|
|
26
|
-
const weighted_sample_select = (n, options, probability_property) => // TODO FIXME no any // eslint-disable-line flowtype/no-weak-types
|
|
27
|
-
seq(n)
|
|
28
|
-
.map((_i) => // TODO FIXME eslint-disable-line flowtype/no-weak-types
|
|
29
|
-
weighted_rand_select(options, probability_property));
|
|
30
|
-
const weighted_histo_key = (n, opts, prob_prop, extract) => // TODO FIXME no any // eslint-disable-line flowtype/no-weak-types
|
|
31
|
-
histograph(weighted_sample_select(n, opts, prob_prop)
|
|
32
|
-
.map((s) => s[extract] // TODO FIXME eslint-disable-line flowtype/no-weak-types
|
|
33
|
-
));
|
|
34
|
-
export { seq, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string };
|
|
1
|
+
function arr_uniq_p(el, i, source) {
|
|
2
|
+
return source.indexOf(el) === i;
|
|
3
|
+
}
|
|
4
|
+
const array_box_if_string = n => typeof n === 'string' ? [n] : n;
|
|
5
|
+
// this is explicitly about other peoples' data, so it has to be weakly typed
|
|
6
|
+
/* eslint-disable flowtype/no-weak-types */
|
|
7
|
+
const weighted_rand_select = (options, probability_property = 'probability') => {
|
|
8
|
+
if (!Array.isArray(options)) {
|
|
9
|
+
throw new TypeError('options must be a non-empty array of objects');
|
|
10
|
+
}
|
|
11
|
+
if (!(typeof options[0] === 'object')) {
|
|
12
|
+
throw new TypeError('options must be a non-empty array of objects');
|
|
13
|
+
}
|
|
14
|
+
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);
|
|
15
|
+
let cursor = 0, cursor_sum = 0;
|
|
16
|
+
while ((cursor_sum += or_one(options[cursor++][probability_property])) <= rnd) { } // eslint-disable-line no-empty,fp/no-loops
|
|
17
|
+
return options[cursor - 1];
|
|
18
|
+
};
|
|
19
|
+
/* eslint-enable flowtype/no-weak-types */
|
|
20
|
+
const seq = (n) => (new Array(n)).fill(true)
|
|
21
|
+
.map((_, i) => i);
|
|
22
|
+
const histograph = (ar) => // eslint-disable-line flowtype/no-weak-types
|
|
23
|
+
ar.sort()
|
|
24
|
+
.reduce((m, v) => // TODO FIXME eslint-disable-line flowtype/no-weak-types,no-sequences
|
|
25
|
+
(m.set(v, (m.has(v) ? m.get(v) + 1 : 1)), m), new Map());
|
|
26
|
+
const weighted_sample_select = (n, options, probability_property) => // TODO FIXME no any // eslint-disable-line flowtype/no-weak-types
|
|
27
|
+
seq(n)
|
|
28
|
+
.map((_i) => // TODO FIXME eslint-disable-line flowtype/no-weak-types
|
|
29
|
+
weighted_rand_select(options, probability_property));
|
|
30
|
+
const weighted_histo_key = (n, opts, prob_prop, extract) => // TODO FIXME no any // eslint-disable-line flowtype/no-weak-types
|
|
31
|
+
histograph(weighted_sample_select(n, opts, prob_prop)
|
|
32
|
+
.map((s) => s[extract] // TODO FIXME eslint-disable-line flowtype/no-weak-types
|
|
33
|
+
));
|
|
34
|
+
export { seq, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string };
|
package/dist/es6/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const version: string;
|
|
2
|
-
export { version };
|
|
1
|
+
declare const version: string;
|
|
2
|
+
export { version };
|
package/dist/es6/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = "5.
|
|
2
|
-
export { version };
|
|
1
|
+
const version = "5.41.15";
|
|
2
|
+
export { version };
|