Skip to content

Instantly share code, notes, and snippets.

@patrickporto
Last active April 3, 2020 22:40
Show Gist options
  • Save patrickporto/86738a237379d3f2137b95d8e9a26112 to your computer and use it in GitHub Desktop.
Save patrickporto/86738a237379d3f2137b95d8e9a26112 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const postCardMachine = Machine({
id: "postCard",
type: "parallel",
states: {
publishing: {
initial: "placeholder",
states: {
operation: {
initial: "listing",
states: {
listing: {
on: { MANIPULATE: "manipulation" },
initial: "expanded",
states: {
expanded: {
on: { SHRINK: "shrinked" },
initial: "pending",
states: {
pending: {
on: { PUBLISH: "published", DRAFT: "draft" },
},
published: {
on: { DRAFT: "draft" },
},
draft: {
on: {
PUBLISH: "published",
},
},
},
},
shrinked: {
on: { EXPAND: "expanded" },
initial: "pending",
states: {
pending: {
on: { PUBLISH: "published", DRAFT: "draft" },
},
published: {
on: { DRAFT: "draft" },
},
draft: {
on: {
PUBLISH: "published",
},
},
},
},
},
},
manipulation: {
on: { LIST: "listing" },
},
},
},
placeholder: {
on: {
OPERATION: "operation",
},
},
},
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment