Skip to content

Instantly share code, notes, and snippets.

@mindrones
Last active August 7, 2020 16:14
Show Gist options
  • Save mindrones/934ba3b99f58cd749d73a4c5a255422b to your computer and use it in GitHub Desktop.
Save mindrones/934ba3b99f58cd749d73a4c5a255422b to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
Machine({
"id": "screen",
"type": "parallel",
"states": {
"Form": {
"id": "Form",
"initial": "Simple",
"on": {
"TAB_CREATED": {
"target": "Form.Simple"
},
"TAB_DELETED": [
{
"target": "Form.Complex",
"cond": "isComplex"
},
{
"target": "Form.Simple"
}
],
"TAB_SELECTED": [
{
"target": "Form.Complex",
"cond": "isComplex"
},
{
"target": "Form.Simple"
}
],
"TERM_CLICKED": {
"actions": [
"toggleTermStatus"
]
},
"INDEX_CHANGED": {
"actions": [
"changeIndex"
]
},
"QUERY_RESET": {
"actions": [
"resetQuery"
]
},
"STORE_RESET": {
"actions": [
"resetStore"
]
},
"TEXT_CHANGED": {
"actions": [
"updateCurrentRuleText"
]
},
"RULE_SELECTED": {
"actions": [
"selectRule"
]
},
"RULE_EDITED": {
"actions": [
"editRuleset"
]
}
},
"states": {
"Simple": {
"on": {
"CHANGE_SEARCH_COMPLEX": {
"target": "Complex"
}
}
},
"Complex": {
"on": {
"CHANGE_SEARCH_SIMPLE": {
"target": "Simple",
"actions": [
"activateSimpleSearch"
]
},
"LABEL_CLICKED": {
"actions": [
"toggleLabelTernary"
]
},
"LOGIC_TOGGLED": {
"actions": [
"toggleSearchLogic"
]
},
"RULE_DISABLED": {
"actions": [
"disableRule"
]
},
"RULE_COPIED": {
"actions": [
"copyRule",
"selectRule"
]
},
"RULE_DELETED": {
"actions": [
"deleteRule"
]
},
"LABEL_TOGGLED": {
"actions": [
"toggleLabelBinary"
]
},
"LABEL_DISABLED": {
"actions": [
"disableLabel"
]
},
"LABEL_DELETED": {
"actions": [
"deleteLabel"
]
},
"RULESET_CREATED": {
"actions": [
"createRuleset",
"selectRule"
]
}
}
}
}
},
"Tabs": {
"id": "Tabs",
"initial": "Idle",
"states": {
"Idle": {
"on": {
"TAB_COPIED": {
"actions": [
"duplicateTabs"
]
},
"TAB_DELETED": {
"actions": [
"deleteTabs",
"setUrlQuery"
]
},
"TAB_CREATED": {
"actions": [
"createTab",
"setCurrentTab",
"createSearchMachine",
"pushHistory",
"setUrlQuery"
]
},
"TAB_RESTORED": {
"actions": [
"restoreTab",
"createSearchMachine"
]
},
"TAB_SELECTED": {
"actions": [
"setCurrentTab",
"pushHistory",
"setUrlQuery"
]
},
"TAB_RENAMED": {
"actions": [
"setTabLabel"
]
}
}
}
}
},
"Facets": {
"id": "Facet",
"initial": "Interactive",
"on": {
"PENDING": {
"target": "#Disabled"
},
"SUCCESS": {
"target": "#Interactive"
},
"ERROR": {},
"MATCHING": {},
"DIRTY": {},
"ROUTE_CHANGED": {
"target": "#Disabled",
"actions": [
"changeRoute"
]
},
"LIST_SORT_BY_UPDATED": {
"actions": [
"listUpdateSortBy"
]
}
},
"states": {
"Interactive": {
"id": "Interactive",
"on": {
"SELECTION_UPDATED": {
"target": "#Interactive",
"actions": [
"updateSelections",
"applySelections",
"changeRoute"
]
}
}
},
"Disabled": {
"id": "Disabled",
"on": {
"ROUTE_CHANGE_COMPLETED": {
"target": "#Interactive"
}
}
}
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment