Last active
January 27, 2020 08:53
-
-
Save fgandellini/f5d5bfc01efe4fad0a75f9818db909aa to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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 portCallMachine = Machine({ | |
id: 'port-call', | |
initial: 'settled', | |
states: { | |
hovered: { | |
on :{ | |
MOUSE_LEAVE: 'settled.hist', | |
ITEM_SELECTED: 'selected', | |
MOUSE_CLICK: 'selected', | |
}, | |
}, | |
selected: { | |
on :{ | |
MOUSE_CLICK_OUTSIDE: 'settled.hist', | |
}, | |
}, | |
settled: { | |
initial: 'default', | |
states: { | |
default: { | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
'': [ | |
{ target: 'inactive', cond: 'notHitBycurrentRow' }, | |
{ target: 'active', cond: 'hitBycurrentRow' }, | |
], | |
}, | |
}, | |
inactive: {}, | |
active: {}, | |
}, | |
on: { | |
MOUSE_MOVE: { target: 'default' }, | |
LIVE_MOVES: { target: 'pending', cond: 'isFirstLiveMoves' }, | |
}, | |
}, | |
pending: { | |
on: { | |
LIVE_MOVES: [ | |
{ target: 'completed', cond: 'isLastLiveMoves' }, | |
{ target: 'pending' }, | |
], | |
}, | |
}, | |
completed: {}, | |
hist: { | |
type: 'history', | |
history: 'deep', | |
}, | |
}, | |
on: { | |
MOUSE_ENTER: 'hovered', | |
}, | |
}, | |
}, | |
}, { | |
guards: { | |
notHitBycurrentRow: () => true, | |
hitBycurrentRow: () => true, | |
isFirstLiveMoves: () => true, | |
isLastLiveMoves: () => true, | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment