A fast and carefree Typescript state machine.
These components are still "experimental" (v0.x.x
).
Some of them are not tested as rigourously as it should be and none of them have been through code review.
Use them at your own risk and check that them do what you want them to do.
npm install -D @cicerchie/fsm
You can see how it's used in @cicerchie/svelte-swr project.
Is automagically updated with each release and you can read it here.
- Finite states (non-nested)
- Initial state
- Transitions (object)
- Transitions (string target)
- Delayed transitions
- Context
- Entry actions
- Exit actions
- Transition actions
- Transition guards
- Parameterized actions
- Async actions with onDone/onError
- Typescript ready (still incomplete and so many
any
!)
- Docs (HELP!)
- Tests (HELP!)
- Demo site (using
routes
dir: it's a SvelteKit app!)
This project was born after looking for a good typed library for massive use in low-end devices.
Neither Robot (it is not written in Typescript) nor XState (too big) nor its "mini version" @xstate/fsm (lacking essential features) did satisfy us.
By chance we found the great article by @dimfeld that lit the way: what a golden boy!