jssm 5.60.0 → 5.60.3

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.
@@ -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;
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;
@@ -878,9 +888,25 @@ class Machine {
878
888
  }
879
889
  }
880
890
  // 7b. main type hook
881
- // not yet implemented
891
+ if (trans_type === 'main') {
892
+ if (this._main_transition_hook !== undefined) {
893
+ // todo handle actions
894
+ // todo handle forced
895
+ if (this._main_transition_hook({ from: this._state, to: newState }) === false) {
896
+ return false;
897
+ }
898
+ }
899
+ }
882
900
  // 7c. forced transition hook
883
- // not yet implemented
901
+ if (trans_type === 'forced') {
902
+ if (this._forced_transition_hook !== undefined) {
903
+ // todo handle actions
904
+ // todo handle forced
905
+ if (this._forced_transition_hook({ from: this._state, to: newState }) === false) {
906
+ return false;
907
+ }
908
+ }
909
+ }
884
910
  // 8. entry hook
885
911
  const maybe_en_hook = this._entry_hooks.get(newState);
886
912
  if (maybe_en_hook !== undefined) {
@@ -168,6 +168,18 @@ declare type StandardTransitionHook = {
168
168
  to: string;
169
169
  handler: HookHandler;
170
170
  };
171
+ declare type MainTransitionHook = {
172
+ kind: 'main transition';
173
+ from: string;
174
+ to: string;
175
+ handler: HookHandler;
176
+ };
177
+ declare type ForcedTransitionHook = {
178
+ kind: 'forced transition';
179
+ from: string;
180
+ to: string;
181
+ handler: HookHandler;
182
+ };
171
183
  declare type AnyTransitionHook = {
172
184
  kind: 'any transition';
173
185
  handler: HookHandler;
@@ -191,5 +203,5 @@ declare type ExitHook = {
191
203
  from: string;
192
204
  handler: HookHandler;
193
205
  };
194
- declare type HookDescription = BasicHookDescription | HookDescriptionWithAction | GlobalActionHook | AnyActionHook | StandardTransitionHook | AnyTransitionHook | EntryHook | ExitHook;
206
+ declare type HookDescription = BasicHookDescription | HookDescriptionWithAction | GlobalActionHook | AnyActionHook | StandardTransitionHook | MainTransitionHook | ForcedTransitionHook | AnyTransitionHook | EntryHook | ExitHook;
195
207
  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 };
@@ -1,2 +1,2 @@
1
- const version = "5.60.0";
1
+ const version = "5.60.3";
2
2
  export { version };