NOTE: Please ignore the files in lib. These files are generated
New Syntax/Semantic Rules
A file is just a container/scope for machine definitions (i.e.@machine {machine ID})
Only machine definitions can occur at the root of a file
More than one machine can be defined per file
Within a machine's context (i.e. from the start of an @machine block to the next @machine block or end of the file) all state IDs must be unique
@machine App
event 1 -> State 2
State 1
State 2
event 2 -> State 2
@machine OtherApp
State 1
State 2
- Files can be imported
- If no file extension is provided then `.wirestate` is assumed
- Cyclic dependencies are not supported
@import { OtherApp } from "file"
// Same as above
@import { OtherApp } from "file.wirestate"
- Machines can be used by other states via `@use {machine ID}`
- A machine can declare events that the state using the machine **must** define as transitions
// App.wirestate
@import { Modal } from 'Modals'
@machine App
State 1
close -> State 2
accept -> Saving Data
@use Modal
Saving Data
data saved -> State 2
State 2
// Modals.wirestate
@machine Modal
State 1
<- close
State 2
<- accept
NOTE: Please ignore the files in
lib
. These files are generatedNew Syntax/Semantic Rules
@machine {machine ID}
)@machine
block to the next@machine
block or end of the file) all state IDs must be unique@machine OtherApp State 1 State 2
@import { OtherApp } from "file" // Same as above @import { OtherApp } from "file.wirestate"
// App.wirestate @import { Modal } from 'Modals'
@machine App State 1 close -> State 2 accept -> Saving Data @use Modal Saving Data data saved -> State 2 State 2
// Modals.wirestate @machine Modal State 1 <- close State 2 <- accept