jssm 5.60.0 → 5.61.1
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 +5 -0
- package/dist/es6/jssm.js +43 -2
- package/dist/es6/jssm_types.d.ts +9 -3
- 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 +5 -0
- package/jssm_types.d.ts +9 -3
- package/package.json +1 -1
package/dist/es6/jssm.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ declare class Machine<mDT> {
|
|
|
49
49
|
_global_action_hooks: Map<string, Function>;
|
|
50
50
|
_any_action_hook: HookHandler | undefined;
|
|
51
51
|
_standard_transition_hook: HookHandler | undefined;
|
|
52
|
+
_main_transition_hook: HookHandler | undefined;
|
|
53
|
+
_forced_transition_hook: HookHandler | undefined;
|
|
52
54
|
_any_transition_hook: HookHandler | undefined;
|
|
53
55
|
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>);
|
|
54
56
|
_new_state(state_config: JssmGenericState): StateType;
|
|
@@ -104,6 +106,9 @@ declare class Machine<mDT> {
|
|
|
104
106
|
hook_action(from: string, to: string, action: string, handler: HookHandler): Machine<mDT>;
|
|
105
107
|
hook_global_action(action: string, handler: HookHandler): Machine<mDT>;
|
|
106
108
|
hook_any_action(handler: HookHandler): Machine<mDT>;
|
|
109
|
+
hook_standard_transition(handler: HookHandler): Machine<mDT>;
|
|
110
|
+
hook_main_transition(handler: HookHandler): Machine<mDT>;
|
|
111
|
+
hook_forced_transition(handler: HookHandler): Machine<mDT>;
|
|
107
112
|
hook_any_transition(handler: HookHandler): Machine<mDT>;
|
|
108
113
|
hook_entry(to: string, handler: HookHandler): Machine<mDT>;
|
|
109
114
|
hook_exit(from: string, handler: HookHandler): Machine<mDT>;
|
package/dist/es6/jssm.js
CHANGED
|
@@ -358,6 +358,8 @@ class Machine {
|
|
|
358
358
|
this._global_action_hooks = new Map();
|
|
359
359
|
this._any_action_hook = undefined;
|
|
360
360
|
this._standard_transition_hook = undefined;
|
|
361
|
+
this._main_transition_hook = undefined;
|
|
362
|
+
this._forced_transition_hook = undefined;
|
|
361
363
|
this._any_transition_hook = undefined;
|
|
362
364
|
this._standard_transition_hook = undefined;
|
|
363
365
|
if (state_declaration) {
|
|
@@ -734,6 +736,14 @@ class Machine {
|
|
|
734
736
|
this._standard_transition_hook = HookDesc.handler;
|
|
735
737
|
this._has_hooks = true;
|
|
736
738
|
break;
|
|
739
|
+
case 'main transition':
|
|
740
|
+
this._main_transition_hook = HookDesc.handler;
|
|
741
|
+
this._has_hooks = true;
|
|
742
|
+
break;
|
|
743
|
+
case 'forced transition':
|
|
744
|
+
this._forced_transition_hook = HookDesc.handler;
|
|
745
|
+
this._has_hooks = true;
|
|
746
|
+
break;
|
|
737
747
|
case 'any transition':
|
|
738
748
|
this._any_transition_hook = HookDesc.handler;
|
|
739
749
|
this._has_hooks = true;
|
|
@@ -771,6 +781,21 @@ class Machine {
|
|
|
771
781
|
this.set_hook({ kind: 'any action', handler });
|
|
772
782
|
return this;
|
|
773
783
|
}
|
|
784
|
+
hook_standard_transition(handler) {
|
|
785
|
+
// TODO: should this throw if setting the hook fails, or ignore it and continue?
|
|
786
|
+
this.set_hook({ kind: 'standard transition', handler });
|
|
787
|
+
return this;
|
|
788
|
+
}
|
|
789
|
+
hook_main_transition(handler) {
|
|
790
|
+
// TODO: should this throw if setting the hook fails, or ignore it and continue?
|
|
791
|
+
this.set_hook({ kind: 'main transition', handler });
|
|
792
|
+
return this;
|
|
793
|
+
}
|
|
794
|
+
hook_forced_transition(handler) {
|
|
795
|
+
// TODO: should this throw if setting the hook fails, or ignore it and continue?
|
|
796
|
+
this.set_hook({ kind: 'forced transition', handler });
|
|
797
|
+
return this;
|
|
798
|
+
}
|
|
774
799
|
hook_any_transition(handler) {
|
|
775
800
|
// TODO: should this throw if setting the hook fails, or ignore it and continue?
|
|
776
801
|
this.set_hook({ kind: 'any transition', handler });
|
|
@@ -878,9 +903,25 @@ class Machine {
|
|
|
878
903
|
}
|
|
879
904
|
}
|
|
880
905
|
// 7b. main type hook
|
|
881
|
-
|
|
906
|
+
if (trans_type === 'main') {
|
|
907
|
+
if (this._main_transition_hook !== undefined) {
|
|
908
|
+
// todo handle actions
|
|
909
|
+
// todo handle forced
|
|
910
|
+
if (this._main_transition_hook({ from: this._state, to: newState }) === false) {
|
|
911
|
+
return false;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
882
915
|
// 7c. forced transition hook
|
|
883
|
-
|
|
916
|
+
if (trans_type === 'forced') {
|
|
917
|
+
if (this._forced_transition_hook !== undefined) {
|
|
918
|
+
// todo handle actions
|
|
919
|
+
// todo handle forced
|
|
920
|
+
if (this._forced_transition_hook({ from: this._state, to: newState }) === false) {
|
|
921
|
+
return false;
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}
|
|
884
925
|
// 8. entry hook
|
|
885
926
|
const maybe_en_hook = this._entry_hooks.get(newState);
|
|
886
927
|
if (maybe_en_hook !== undefined) {
|
package/dist/es6/jssm_types.d.ts
CHANGED
|
@@ -164,8 +164,14 @@ declare type HookDescriptionWithAction = {
|
|
|
164
164
|
};
|
|
165
165
|
declare type StandardTransitionHook = {
|
|
166
166
|
kind: 'standard transition';
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
handler: HookHandler;
|
|
168
|
+
};
|
|
169
|
+
declare type MainTransitionHook = {
|
|
170
|
+
kind: 'main transition';
|
|
171
|
+
handler: HookHandler;
|
|
172
|
+
};
|
|
173
|
+
declare type ForcedTransitionHook = {
|
|
174
|
+
kind: 'forced transition';
|
|
169
175
|
handler: HookHandler;
|
|
170
176
|
};
|
|
171
177
|
declare type AnyTransitionHook = {
|
|
@@ -191,5 +197,5 @@ declare type ExitHook = {
|
|
|
191
197
|
from: string;
|
|
192
198
|
handler: HookHandler;
|
|
193
199
|
};
|
|
194
|
-
declare type HookDescription = BasicHookDescription | HookDescriptionWithAction | GlobalActionHook | AnyActionHook | StandardTransitionHook | AnyTransitionHook | EntryHook | ExitHook;
|
|
200
|
+
declare type HookDescription = BasicHookDescription | HookDescriptionWithAction | GlobalActionHook | AnyActionHook | StandardTransitionHook | MainTransitionHook | ForcedTransitionHook | AnyTransitionHook | EntryHook | ExitHook;
|
|
195
201
|
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.61.1";
|
|
2
2
|
export { version };
|