jssm 5.58.1 → 5.59.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/dist/es6/jssm.d.ts +1 -0
- package/dist/es6/jssm.js +13 -3
- package/dist/es6/jssm_types.d.ts +6 -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 +1 -0
- package/jssm_types.d.ts +6 -1
- package/package.json +1 -1
package/dist/es6/jssm.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ declare class Machine<mDT> {
|
|
|
46
46
|
_named_hooks: Map<string, Function>;
|
|
47
47
|
_entry_hooks: Map<string, Function>;
|
|
48
48
|
_exit_hooks: Map<string, Function>;
|
|
49
|
+
_global_action_hooks: Map<string, Function>;
|
|
49
50
|
_any_action_hook: HookHandler | undefined;
|
|
50
51
|
_any_transition_hook: HookHandler | undefined;
|
|
51
52
|
constructor({ start_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout }: JssmGenericConfig<mDT>);
|
package/dist/es6/jssm.js
CHANGED
|
@@ -355,6 +355,7 @@ class Machine {
|
|
|
355
355
|
this._named_hooks = new Map();
|
|
356
356
|
this._entry_hooks = new Map();
|
|
357
357
|
this._exit_hooks = new Map();
|
|
358
|
+
this._global_action_hooks = new Map();
|
|
358
359
|
this._any_action_hook = undefined;
|
|
359
360
|
this._any_transition_hook = undefined;
|
|
360
361
|
if (state_declaration) {
|
|
@@ -719,6 +720,10 @@ class Machine {
|
|
|
719
720
|
this._named_hooks.set(named_hook_name(HookDesc.from, HookDesc.to, HookDesc.action), HookDesc.handler);
|
|
720
721
|
this._has_hooks = true;
|
|
721
722
|
break;
|
|
723
|
+
case 'global action':
|
|
724
|
+
this._global_action_hooks.set(HookDesc.action, HookDesc.handler);
|
|
725
|
+
this._has_hooks = true;
|
|
726
|
+
break;
|
|
722
727
|
case 'any action':
|
|
723
728
|
this._any_action_hook = HookDesc.handler;
|
|
724
729
|
this._has_hooks = true;
|
|
@@ -798,16 +803,21 @@ class Machine {
|
|
|
798
803
|
// todo major incomplete whargarbl comeback
|
|
799
804
|
if (valid) {
|
|
800
805
|
if (this._has_hooks) {
|
|
801
|
-
// 1. any action hook
|
|
802
806
|
if (wasAction) {
|
|
807
|
+
// 1. any action hook
|
|
803
808
|
if (this._any_action_hook !== undefined) {
|
|
804
809
|
if (this._any_action_hook() === false) {
|
|
805
810
|
return false;
|
|
806
811
|
}
|
|
807
812
|
}
|
|
813
|
+
// 2. global specific action hook
|
|
814
|
+
const maybe_ga_hook = this._global_action_hooks.get(newStateOrAction);
|
|
815
|
+
if (maybe_ga_hook !== undefined) {
|
|
816
|
+
if (maybe_ga_hook({ action: newStateOrAction, forced: wasForced }) === false) {
|
|
817
|
+
return false;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
808
820
|
}
|
|
809
|
-
// 2. global specific action hook
|
|
810
|
-
// not yet implemented
|
|
811
821
|
// 3. any transition hook
|
|
812
822
|
if (this._any_transition_hook !== undefined) {
|
|
813
823
|
if (this._any_transition_hook() === false) {
|
package/dist/es6/jssm_types.d.ts
CHANGED
|
@@ -166,6 +166,11 @@ declare type AnyTransitionHook = {
|
|
|
166
166
|
kind: 'any transition';
|
|
167
167
|
handler: HookHandler;
|
|
168
168
|
};
|
|
169
|
+
declare type GlobalActionHook = {
|
|
170
|
+
kind: 'global action';
|
|
171
|
+
action: string;
|
|
172
|
+
handler: HookHandler;
|
|
173
|
+
};
|
|
169
174
|
declare type AnyActionHook = {
|
|
170
175
|
kind: 'any action';
|
|
171
176
|
handler: HookHandler;
|
|
@@ -180,5 +185,5 @@ declare type ExitHook = {
|
|
|
180
185
|
from: string;
|
|
181
186
|
handler: HookHandler;
|
|
182
187
|
};
|
|
183
|
-
declare type HookDescription = BasicHookDescription | HookDescriptionWithAction | AnyActionHook | AnyTransitionHook | EntryHook | ExitHook;
|
|
188
|
+
declare type HookDescription = BasicHookDescription | HookDescriptionWithAction | GlobalActionHook | AnyActionHook | AnyTransitionHook | EntryHook | ExitHook;
|
|
184
189
|
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, HookDescription, HookHandler };
|
package/dist/es6/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = "5.
|
|
1
|
+
const version = "5.59.0";
|
|
2
2
|
export { version };
|