Last active
April 7, 2020 15:14
-
-
Save patrickporto/cb82c70897e30963686c56337635c79b 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const postCardMachine = Machine({ | |
id: "postCard", | |
initial: "idle", | |
states: { | |
resolved: { | |
on: { PENDING: "pending" }, | |
type: "parallel", | |
states: { | |
size: { | |
initial: "expanded", | |
states: { | |
expanded: { | |
on: { SHRINK: "shrinked" }, | |
}, | |
shrinked: { | |
on: { EXPAND: "expanded" }, | |
}, | |
} | |
}, | |
status: { | |
initial: "staged", | |
states: { | |
staged: { | |
on: { DRAFT: "draft", PUBLISH: "published" }, | |
}, | |
published: { | |
on: { DRAFT: "draft", CREATE: "staged", UPDATE: "staged" }, | |
}, | |
draft: { | |
on: { | |
PUBLISH: "published", CREATE: "staged", UPDATE: "staged" | |
}, | |
}, | |
} | |
}, | |
operation: { | |
initial: "idle", | |
states: { | |
idle: { | |
on: { UPDATE: "update", CREATE: "create" }, | |
}, | |
create: { | |
on: { PUBLISH: "idle", DRAFT: "idle" }, | |
}, | |
update: { | |
on: { PUBLISH: "idle", DRAFT: "idle" }, | |
}, | |
} | |
} | |
}, | |
}, | |
pending: { | |
on: { | |
RESOLVED: "resolved", | |
}, | |
}, | |
idle: { | |
on: { | |
PENDING: "pending", | |
RESOLVED: "resolved", | |
}, | |
}, | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment