Created
February 20, 2020 03:57
-
-
Save rjdestigter/c7872f30671d66770d3f0a40a180a330 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const machine = Machine({ | |
| "id": "bms", | |
| "type": "parallel", | |
| "states": { | |
| "login": { | |
| "id": "login", | |
| "type": "parallel", | |
| "states": { | |
| "username": { | |
| "type": "parallel", | |
| "states": { | |
| "edit": { | |
| "entry": "username.assignInitialValue", | |
| "on": { | |
| "username.CHANGE": { | |
| "actions": "username.assignChange" | |
| }, | |
| "username.RESET": { | |
| "actions": "username.assignInitialValue" | |
| } | |
| } | |
| }, | |
| "pristine": { | |
| "initial": "pristine", | |
| "states": { | |
| "pristine": { | |
| "on": { | |
| "username.CHANGE": { | |
| "target": "dirty", | |
| "cond": "username.isHuman" | |
| } | |
| } | |
| }, | |
| "dirty": { | |
| "on": { | |
| "username.RESET": "pristine" | |
| } | |
| } | |
| } | |
| }, | |
| "touched": { | |
| "initial": "untouched", | |
| "states": { | |
| "untouched": { | |
| "on": { | |
| "username.FOCUS": { | |
| "target": "touching" | |
| } | |
| } | |
| }, | |
| "touching": { | |
| "on": { | |
| "username.BLUR": { | |
| "target": "touched" | |
| } | |
| } | |
| }, | |
| "touched": { | |
| "on": { | |
| "username.RESET": "untouched" | |
| } | |
| } | |
| } | |
| }, | |
| "valid": { | |
| "initial": "invalid", | |
| "states": { | |
| "invalid": { | |
| "": { | |
| "target": "valid", | |
| "cond": "username.isValid" | |
| }, | |
| "on": { | |
| "username.CHANGE": { | |
| "target": "valid", | |
| "cond": "username.isValid" | |
| } | |
| } | |
| }, | |
| "valid": { | |
| "on": { | |
| "username.CHANGE": { | |
| "target": "invalid", | |
| "cond": "username.isNotValid" | |
| }, | |
| "username.RESET": "invalid" | |
| } | |
| } | |
| } | |
| }, | |
| "focused": { | |
| "initial": "blurred", | |
| "states": { | |
| "focused": { | |
| "on": { | |
| "username.BLUR": "blurred" | |
| } | |
| }, | |
| "blurred": { | |
| "on": { | |
| "username.FOCUS": "focused" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "password": { | |
| "type": "parallel", | |
| "states": { | |
| "edit": { | |
| "entry": "password.assignInitialValue", | |
| "on": { | |
| "password.CHANGE": { | |
| "actions": "password.assignChange" | |
| }, | |
| "password.RESET": { | |
| "actions": "password.assignInitialValue" | |
| } | |
| } | |
| }, | |
| "pristine": { | |
| "initial": "pristine", | |
| "states": { | |
| "pristine": { | |
| "on": { | |
| "password.CHANGE": { | |
| "target": "dirty", | |
| "cond": "password.isHuman" | |
| } | |
| } | |
| }, | |
| "dirty": { | |
| "on": { | |
| "password.RESET": "pristine" | |
| } | |
| } | |
| } | |
| }, | |
| "touched": { | |
| "initial": "untouched", | |
| "states": { | |
| "untouched": { | |
| "on": { | |
| "password.FOCUS": { | |
| "target": "touching" | |
| } | |
| } | |
| }, | |
| "touching": { | |
| "on": { | |
| "password.BLUR": { | |
| "target": "touched" | |
| } | |
| } | |
| }, | |
| "touched": { | |
| "on": { | |
| "password.RESET": "untouched" | |
| } | |
| } | |
| } | |
| }, | |
| "valid": { | |
| "initial": "invalid", | |
| "states": { | |
| "invalid": { | |
| "": { | |
| "target": "valid", | |
| "cond": "password.isValid" | |
| }, | |
| "on": { | |
| "password.CHANGE": { | |
| "target": "valid", | |
| "cond": "password.isValid" | |
| } | |
| } | |
| }, | |
| "valid": { | |
| "on": { | |
| "password.CHANGE": { | |
| "target": "invalid", | |
| "cond": "password.isNotValid" | |
| }, | |
| "password.RESET": "invalid" | |
| } | |
| } | |
| } | |
| }, | |
| "focused": { | |
| "initial": "blurred", | |
| "states": { | |
| "focused": { | |
| "on": { | |
| "password.BLUR": "blurred" | |
| } | |
| }, | |
| "blurred": { | |
| "on": { | |
| "password.FOCUS": "focused" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "status": { | |
| "initial": "inProgress", | |
| "on": { | |
| "status.RESET": { | |
| "target": "status.inProgress", | |
| "actions": "status.assignInitial" | |
| } | |
| }, | |
| "states": { | |
| "inProgress": { | |
| "entry": "status.assignInitial", | |
| "on": { | |
| "status.SUBMIT": { | |
| "target": "submitting" | |
| } | |
| } | |
| }, | |
| "submitting": { | |
| "invoke": { | |
| "id": "status.submitOperation", | |
| "src": "status.submitOperation", | |
| "onDone": "done", | |
| "onError": "done" | |
| } | |
| }, | |
| "done": { | |
| "entry": "status.assignDone" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "router": { | |
| "id": "routes", | |
| "initial": "home", | |
| "context": {}, | |
| "on": { | |
| "GOTO": [ | |
| { | |
| "target": ".home", | |
| "cond": "home" | |
| }, | |
| { | |
| "target": ".login", | |
| "cond": "login" | |
| }, | |
| { | |
| "target": ".signup", | |
| "cond": "signup" | |
| }, | |
| { | |
| "target": ".404" | |
| } | |
| ] | |
| }, | |
| "states": { | |
| "404": {}, | |
| "home": {}, | |
| "signup": {}, | |
| "login": {} | |
| } | |
| } | |
| } | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment