jssm 5.86.0 → 5.86.2
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/CHANGELOG.md +55 -55
- package/README.md +2 -2
- package/dist/es6/fsl_parser.js +1 -1
- package/dist/es6/jssm.d.ts +17 -4
- package/dist/es6/jssm.js +57 -4
- package/dist/es6/jssm_compiler.js +6 -4
- package/dist/es6/jssm_types.d.ts +4 -1
- package/dist/es6/version.js +1 -1
- package/dist/jssm.es5.cjs.js +1 -1
- package/dist/jssm.es5.iife.js +1 -1
- package/jssm.d.ts +17 -4
- package/jssm_types.d.ts +4 -1
- package/package.json +1 -1
package/dist/es6/jssm.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare type StateType = string;
|
|
2
2
|
import { JssmGenericState, JssmGenericConfig, JssmStateConfig, JssmTransition, JssmTransitionList, // JssmTransitionRule,
|
|
3
|
-
JssmMachineInternalState, JssmStateDeclaration, JssmStateStyleKeyList, JssmLayout, JssmHistory, JssmSerialization, FslDirection, FslDirections, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types';
|
|
3
|
+
JssmMachineInternalState, JssmAllowsOverride, JssmStateDeclaration, JssmStateStyleKeyList, JssmLayout, JssmHistory, JssmSerialization, FslDirection, FslDirections, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types';
|
|
4
4
|
import { arrow_direction, arrow_left_kind, arrow_right_kind } from './jssm_arrow';
|
|
5
5
|
import { compile, make, wrap_parse } from './jssm_compiler';
|
|
6
6
|
import { seq, unique, find_repeated, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util';
|
|
@@ -74,7 +74,8 @@ declare class Machine<mDT> {
|
|
|
74
74
|
_has_post_exit_hooks: boolean;
|
|
75
75
|
_has_post_global_action_hooks: boolean;
|
|
76
76
|
_has_post_transition_hooks: boolean;
|
|
77
|
-
|
|
77
|
+
_code_allows_override: JssmAllowsOverride;
|
|
78
|
+
_config_allows_override: JssmAllowsOverride;
|
|
78
79
|
_post_hooks: Map<string, HookHandler<mDT>>;
|
|
79
80
|
_post_named_hooks: Map<string, HookHandler<mDT>>;
|
|
80
81
|
_post_entry_hooks: Map<string, HookHandler<mDT>>;
|
|
@@ -98,7 +99,7 @@ declare class Machine<mDT> {
|
|
|
98
99
|
_start_state_style: JssmStateConfig;
|
|
99
100
|
_end_state_style: JssmStateConfig;
|
|
100
101
|
_state_labels: Map<string, string>;
|
|
101
|
-
constructor({ start_states, end_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, property_definition, state_property, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name, history, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config }: JssmGenericConfig<StateType, mDT>);
|
|
102
|
+
constructor({ start_states, end_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, property_definition, state_property, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name, history, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config, allows_override, config_allows_override }: JssmGenericConfig<StateType, mDT>);
|
|
102
103
|
/********
|
|
103
104
|
*
|
|
104
105
|
* Internal method for fabricating states. Not meant for external use.
|
|
@@ -484,12 +485,24 @@ declare class Machine<mDT> {
|
|
|
484
485
|
list_actions(): Array<StateType>;
|
|
485
486
|
get uses_actions(): boolean;
|
|
486
487
|
get uses_forced_transitions(): boolean;
|
|
488
|
+
/*********
|
|
489
|
+
*
|
|
490
|
+
* Check if the code that built the machine allows overriding state and data.
|
|
491
|
+
*
|
|
492
|
+
*/
|
|
493
|
+
get code_allows_override(): JssmAllowsOverride;
|
|
494
|
+
/*********
|
|
495
|
+
*
|
|
496
|
+
* Check if the machine config allows overriding state and data.
|
|
497
|
+
*
|
|
498
|
+
*/
|
|
499
|
+
get config_allows_override(): JssmAllowsOverride;
|
|
487
500
|
/*********
|
|
488
501
|
*
|
|
489
502
|
* Check if a machine allows overriding state and data.
|
|
490
503
|
*
|
|
491
504
|
*/
|
|
492
|
-
get allows_override():
|
|
505
|
+
get allows_override(): JssmAllowsOverride;
|
|
493
506
|
all_themes(): FslTheme[];
|
|
494
507
|
get themes(): FslTheme | FslTheme[];
|
|
495
508
|
set themes(to: FslTheme | FslTheme[]);
|
package/dist/es6/jssm.js
CHANGED
|
@@ -126,7 +126,7 @@ function state_style_condense(jssk) {
|
|
|
126
126
|
// TODO add a lotta docblock here
|
|
127
127
|
class Machine {
|
|
128
128
|
// whargarbl this badly needs to be broken up, monolith master
|
|
129
|
-
constructor({ start_states, end_states = [], complete = [], transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, property_definition, state_property, fsl_version, dot_preamble = undefined, arrange_declaration = [], arrange_start_declaration = [], arrange_end_declaration = [], theme = ['default'], flow = 'down', graph_layout = 'dot', instance_name, history, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config }) {
|
|
129
|
+
constructor({ start_states, end_states = [], complete = [], transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, property_definition, state_property, fsl_version, dot_preamble = undefined, arrange_declaration = [], arrange_start_declaration = [], arrange_end_declaration = [], theme = ['default'], flow = 'down', graph_layout = 'dot', instance_name, history, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config, allows_override, config_allows_override }) {
|
|
130
130
|
this._instance_name = instance_name;
|
|
131
131
|
this._state = start_states[0];
|
|
132
132
|
this._states = new Map();
|
|
@@ -183,7 +183,11 @@ class Machine {
|
|
|
183
183
|
this._has_post_global_action_hooks = false;
|
|
184
184
|
this._has_post_transition_hooks = true;
|
|
185
185
|
// no need for a boolean for single hooks, just test for undefinedness
|
|
186
|
-
this.
|
|
186
|
+
this._code_allows_override = allows_override;
|
|
187
|
+
this._config_allows_override = config_allows_override;
|
|
188
|
+
if ((allows_override === false) && (config_allows_override === true)) {
|
|
189
|
+
throw new JssmError(undefined, "Code specifies no override, but config tries to permit; config may not be less strict than code");
|
|
190
|
+
}
|
|
187
191
|
this._post_hooks = new Map();
|
|
188
192
|
this._post_named_hooks = new Map();
|
|
189
193
|
this._post_entry_hooks = new Map();
|
|
@@ -901,13 +905,55 @@ class Machine {
|
|
|
901
905
|
get uses_forced_transitions() {
|
|
902
906
|
return this._has_forced_transitions;
|
|
903
907
|
}
|
|
908
|
+
/*********
|
|
909
|
+
*
|
|
910
|
+
* Check if the code that built the machine allows overriding state and data.
|
|
911
|
+
*
|
|
912
|
+
*/
|
|
913
|
+
get code_allows_override() {
|
|
914
|
+
return this._code_allows_override;
|
|
915
|
+
}
|
|
916
|
+
/*********
|
|
917
|
+
*
|
|
918
|
+
* Check if the machine config allows overriding state and data.
|
|
919
|
+
*
|
|
920
|
+
*/
|
|
921
|
+
get config_allows_override() {
|
|
922
|
+
return this._config_allows_override;
|
|
923
|
+
}
|
|
904
924
|
/*********
|
|
905
925
|
*
|
|
906
926
|
* Check if a machine allows overriding state and data.
|
|
907
927
|
*
|
|
908
928
|
*/
|
|
909
929
|
get allows_override() {
|
|
910
|
-
|
|
930
|
+
// code false? config true, throw. config false, false. config undefined, false.
|
|
931
|
+
if (this._code_allows_override === false) {
|
|
932
|
+
/* istanbul ignore next */
|
|
933
|
+
if (this._config_allows_override === true) {
|
|
934
|
+
/* istanbul ignore next */
|
|
935
|
+
throw new JssmError(this, "Code specifies no override, but config tries to permit; config may not be less strict than code; should be unreachable");
|
|
936
|
+
}
|
|
937
|
+
else {
|
|
938
|
+
return false;
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
// code true? config true, true. config false, false. config undefined, true.
|
|
942
|
+
if (this._code_allows_override === true) {
|
|
943
|
+
if (this._config_allows_override === false) {
|
|
944
|
+
return false;
|
|
945
|
+
}
|
|
946
|
+
else {
|
|
947
|
+
return true;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
// code must be undefined. config false, false. config true, true. config undefined, false.
|
|
951
|
+
if (this._config_allows_override === true) {
|
|
952
|
+
return true;
|
|
953
|
+
}
|
|
954
|
+
else {
|
|
955
|
+
return false;
|
|
956
|
+
}
|
|
911
957
|
}
|
|
912
958
|
all_themes() {
|
|
913
959
|
return [...theme_mapping.keys()]; // constructor sets this to "default" otherwise
|
|
@@ -2198,7 +2244,14 @@ function sm(template_strings, ...remainder /* , arguments */) {
|
|
|
2198
2244
|
function from(MachineAsString, ExtraConstructorFields) {
|
|
2199
2245
|
const to_decorate = make(MachineAsString);
|
|
2200
2246
|
if (ExtraConstructorFields !== undefined) {
|
|
2201
|
-
Object.keys(ExtraConstructorFields).map(key =>
|
|
2247
|
+
Object.keys(ExtraConstructorFields).map(key => {
|
|
2248
|
+
if (key === 'allows_override') {
|
|
2249
|
+
to_decorate['config_allows_override'] = ExtraConstructorFields['allows_override'];
|
|
2250
|
+
}
|
|
2251
|
+
else {
|
|
2252
|
+
to_decorate[key] = ExtraConstructorFields[key];
|
|
2253
|
+
}
|
|
2254
|
+
});
|
|
2202
2255
|
}
|
|
2203
2256
|
return new Machine(to_decorate);
|
|
2204
2257
|
}
|
|
@@ -192,9 +192,10 @@ function compile_rule_handler(rule) {
|
|
|
192
192
|
'graph_layout', 'start_states', 'end_states', 'machine_name', 'machine_version',
|
|
193
193
|
'machine_comment', 'machine_author', 'machine_contributor', 'machine_definition',
|
|
194
194
|
'machine_reference', 'machine_license', 'fsl_version', 'state_config', 'theme',
|
|
195
|
-
'flow', 'dot_preamble', '
|
|
196
|
-
'
|
|
197
|
-
'
|
|
195
|
+
'flow', 'dot_preamble', 'allows_override', 'default_state_config',
|
|
196
|
+
'default_start_state_config', 'default_end_state_config',
|
|
197
|
+
'default_hooked_state_config', 'default_active_state_config',
|
|
198
|
+
'default_terminal_state_config'
|
|
198
199
|
];
|
|
199
200
|
if (tautologies.includes(rule.key)) {
|
|
200
201
|
return { agg_as: rule.key, val: rule.value };
|
|
@@ -284,6 +285,7 @@ function compile(tree) {
|
|
|
284
285
|
default_terminal_state_config: [],
|
|
285
286
|
default_start_state_config: [],
|
|
286
287
|
default_end_state_config: [],
|
|
288
|
+
allows_override: []
|
|
287
289
|
};
|
|
288
290
|
tree.map((tr) => {
|
|
289
291
|
const rule = compile_rule_handler(tr), agg_as = rule.agg_as, val = rule.val; // TODO FIXME no any
|
|
@@ -303,7 +305,7 @@ function compile(tree) {
|
|
|
303
305
|
const oneOnlyKeys = [
|
|
304
306
|
'graph_layout', 'machine_name', 'machine_version', 'machine_comment',
|
|
305
307
|
'fsl_version', 'machine_license', 'machine_definition', 'machine_language',
|
|
306
|
-
'flow', 'dot_preamble'
|
|
308
|
+
'flow', 'dot_preamble', 'allows_override'
|
|
307
309
|
];
|
|
308
310
|
oneOnlyKeys.map((oneOnlyKey) => {
|
|
309
311
|
if (results[oneOnlyKey].length > 1) {
|
package/dist/es6/jssm_types.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ declare type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced';
|
|
|
24
24
|
declare type JssmLayout = 'dot' | 'circo' | 'twopi' | 'fdp';
|
|
25
25
|
declare type JssmCorner = 'regular' | 'rounded' | 'lined';
|
|
26
26
|
declare type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
|
|
27
|
+
declare type JssmAllowsOverride = true | false | undefined;
|
|
27
28
|
declare const FslDirections: readonly ["up", "right", "down", "left"];
|
|
28
29
|
declare type FslDirection = typeof FslDirections[number];
|
|
29
30
|
declare const FslThemes: readonly ["default", "ocean", "modern", "plain", "bold"];
|
|
@@ -190,6 +191,8 @@ declare type JssmGenericConfig<StateType, DataType> = {
|
|
|
190
191
|
allow_force?: false;
|
|
191
192
|
actions?: JssmPermittedOpt;
|
|
192
193
|
simplify_bidi?: boolean;
|
|
194
|
+
allows_override?: JssmAllowsOverride;
|
|
195
|
+
config_allows_override?: JssmAllowsOverride;
|
|
193
196
|
dot_preamble?: string;
|
|
194
197
|
start_states: Array<StateType>;
|
|
195
198
|
end_states?: Array<StateType>;
|
|
@@ -354,4 +357,4 @@ declare type JssmErrorExtendedInfo = {
|
|
|
354
357
|
requested_state?: StateType | undefined;
|
|
355
358
|
};
|
|
356
359
|
declare type JssmHistory<mDT> = circular_buffer<[StateType, mDT]>;
|
|
357
|
-
export { JssmColor, JssmShape, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmStateConfig, JssmStateStyleKey, JssmStateStyleKeyList, JssmBaseTheme, JssmTheme, JssmLayout, JssmHistory, JssmSerialization, JssmPropertyDefinition, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirections, FslDirection, FslThemes, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult };
|
|
360
|
+
export { JssmColor, JssmShape, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmStateConfig, JssmStateStyleKey, JssmStateStyleKeyList, JssmBaseTheme, JssmTheme, JssmLayout, JssmHistory, JssmSerialization, JssmPropertyDefinition, JssmAllowsOverride, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirections, FslDirection, FslThemes, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult };
|
package/dist/es6/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = "5.86.
|
|
1
|
+
const version = "5.86.2", build_time = 1668285414765;
|
|
2
2
|
export { version, build_time };
|