jssm 5.50.0 → 5.53.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/.codeclimate.yml +22 -0
- package/.editorconfig +12 -0
- package/.eslintrc +20 -0
- package/.nycrc +6 -0
- package/.travis.yml +9 -0
- package/dist/es6/jssm.d.ts +2 -2
- package/dist/es6/jssm.js +28 -41
- package/dist/es6/version.js +1 -1
- package/dist/jssm.es5.cjs.js +1 -1
- package/dist/jssm.es5.iife.js +1 -1
- package/jest-spec.config.js +27 -0
- package/jest-stoch.config.js +27 -0
- package/jssm.d.ts +2 -2
- package/package.json +1 -1
package/.codeclimate.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
engines:
|
|
2
|
+
csslint:
|
|
3
|
+
enabled: true
|
|
4
|
+
duplication:
|
|
5
|
+
enabled: true
|
|
6
|
+
config:
|
|
7
|
+
languages:
|
|
8
|
+
- javascript
|
|
9
|
+
eslint:
|
|
10
|
+
enabled: true
|
|
11
|
+
fixme:
|
|
12
|
+
enabled: true
|
|
13
|
+
ratings:
|
|
14
|
+
paths:
|
|
15
|
+
- "**.css"
|
|
16
|
+
- "**.js"
|
|
17
|
+
- "**.jsx"
|
|
18
|
+
exclude_paths:
|
|
19
|
+
- dist/
|
|
20
|
+
- docs/
|
|
21
|
+
- src/js/tests/
|
|
22
|
+
- build/
|
package/.editorconfig
ADDED
package/.eslintrc
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
|
|
3
|
+
"parser" : "@typescript-eslint/parser",
|
|
4
|
+
"parserOptions": {
|
|
5
|
+
"sourceType" : "module",
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
"plugins" : [ "@typescript-eslint" ],
|
|
9
|
+
"env" : { "es6": true, "commonjs": true },
|
|
10
|
+
|
|
11
|
+
"extends" : [
|
|
12
|
+
"plugin:@typescript-eslint/eslint-recommended"
|
|
13
|
+
],
|
|
14
|
+
|
|
15
|
+
rules: {
|
|
16
|
+
"no-unused-vars": 0,
|
|
17
|
+
"@typescript-eslint/no-unused-vars": 0
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
package/.nycrc
ADDED
package/.travis.yml
ADDED
package/dist/es6/jssm.d.ts
CHANGED
|
@@ -96,8 +96,8 @@ declare class Machine<mDT> {
|
|
|
96
96
|
hook(from: string, to: string, handler: HookHandler): Machine<mDT>;
|
|
97
97
|
hook_action(from: string, to: string, action: string, handler: HookHandler): Machine<mDT>;
|
|
98
98
|
hook_any_transition(handler: HookHandler): Machine<mDT>;
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
transition_impl(newStateOrAction: StateType, newData: mDT | undefined, wasForced: boolean, wasAction: boolean): boolean;
|
|
100
|
+
action(actionName: StateType, newData?: mDT): boolean;
|
|
101
101
|
transition(newState: StateType, newData?: mDT): boolean;
|
|
102
102
|
force_transition(newState: StateType, newData?: mDT): boolean;
|
|
103
103
|
current_action_for(action: StateType): number;
|
package/dist/es6/jssm.js
CHANGED
|
@@ -746,53 +746,25 @@ class Machine {
|
|
|
746
746
|
// remove_hook(HookDesc: HookDescription) {
|
|
747
747
|
// throw 'TODO: Should remove hook here';
|
|
748
748
|
// }
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
if (this._has_hooks) {
|
|
756
|
-
let hook_permits = undefined;
|
|
757
|
-
if (this._any_transition_hook !== undefined) {
|
|
758
|
-
if (this._any_transition_hook() === false) {
|
|
759
|
-
return false;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
const nhn = named_hook_name(this._state, edge.to, name), maybe_hook = this._named_hooks.get(nhn);
|
|
763
|
-
if (maybe_hook === undefined) {
|
|
764
|
-
hook_permits = true;
|
|
765
|
-
}
|
|
766
|
-
else {
|
|
767
|
-
hook_permits = maybe_hook({ from: this._state, to: edge.to, action: name });
|
|
768
|
-
}
|
|
769
|
-
if (hook_permits !== false) {
|
|
770
|
-
this._state = edge.to;
|
|
771
|
-
return true;
|
|
772
|
-
}
|
|
773
|
-
else {
|
|
774
|
-
return false;
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
else {
|
|
778
|
-
this._state = edge.to;
|
|
779
|
-
return true;
|
|
749
|
+
transition_impl(newStateOrAction, newData, wasForced, wasAction) {
|
|
750
|
+
let valid = false, newState;
|
|
751
|
+
if (wasForced) {
|
|
752
|
+
if (this.valid_force_transition(newStateOrAction, newData)) {
|
|
753
|
+
valid = true;
|
|
754
|
+
newState = newStateOrAction;
|
|
780
755
|
}
|
|
781
756
|
}
|
|
782
|
-
else {
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
}
|
|
786
|
-
transition_impl(newState, newData, wasForced, wasAction) {
|
|
787
|
-
let valid = false;
|
|
788
|
-
if (wasForced) {
|
|
789
|
-
if (this.valid_force_transition(newState, newData)) {
|
|
757
|
+
else if (wasAction) {
|
|
758
|
+
if (this.valid_action(newStateOrAction, newData)) {
|
|
759
|
+
const edge = this.current_action_edge_for(newStateOrAction);
|
|
790
760
|
valid = true;
|
|
761
|
+
newState = edge.to;
|
|
791
762
|
}
|
|
792
763
|
}
|
|
793
764
|
else {
|
|
794
|
-
if (this.valid_transition(
|
|
765
|
+
if (this.valid_transition(newStateOrAction, newData)) {
|
|
795
766
|
valid = true;
|
|
767
|
+
newState = newStateOrAction;
|
|
796
768
|
}
|
|
797
769
|
}
|
|
798
770
|
// todo whargarbl implement data stuff
|
|
@@ -805,12 +777,24 @@ class Machine {
|
|
|
805
777
|
return false;
|
|
806
778
|
}
|
|
807
779
|
}
|
|
780
|
+
if (wasAction) {
|
|
781
|
+
const nhn = named_hook_name(this._state, newState, newStateOrAction), n_maybe_hook = this._named_hooks.get(nhn);
|
|
782
|
+
if (n_maybe_hook === undefined) {
|
|
783
|
+
hook_permits = true;
|
|
784
|
+
}
|
|
785
|
+
else {
|
|
786
|
+
hook_permits = n_maybe_hook({ from: this._state, to: newState, action: newStateOrAction });
|
|
787
|
+
}
|
|
788
|
+
if (!(hook_permits)) {
|
|
789
|
+
return false;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
808
792
|
const hn = hook_name(this._state, newState), maybe_hook = this._hooks.get(hn);
|
|
809
793
|
if (maybe_hook === undefined) {
|
|
810
794
|
hook_permits = true;
|
|
811
795
|
}
|
|
812
796
|
else {
|
|
813
|
-
hook_permits = maybe_hook({ from: this._state, to: newState, forced: wasForced });
|
|
797
|
+
hook_permits = maybe_hook({ from: this._state, to: newState, forced: wasForced, action: wasAction ? newStateOrAction : undefined });
|
|
814
798
|
}
|
|
815
799
|
if (hook_permits !== false) {
|
|
816
800
|
this._state = newState;
|
|
@@ -829,6 +813,9 @@ class Machine {
|
|
|
829
813
|
return false;
|
|
830
814
|
}
|
|
831
815
|
}
|
|
816
|
+
action(actionName, newData) {
|
|
817
|
+
return this.transition_impl(actionName, newData, false, true);
|
|
818
|
+
}
|
|
832
819
|
transition(newState, newData) {
|
|
833
820
|
return this.transition_impl(newState, newData, false, false);
|
|
834
821
|
}
|
package/dist/es6/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = "5.
|
|
1
|
+
const version = "5.53.0";
|
|
2
2
|
export { version };
|