In the AST, model activities more cleanly
See original GitHub issueExpected Behavior
I’m trying to create a tool to create svg visualisations of xstate state machines.
To do this I’m attempting to convert xstate machine descriptions to State Machine Cat json, which I can then feed into State Machine Cat to generate an svg.
Alongside entry and exit triggers, xstate supports the idea of activities. At the moment State Machine Cat json has a hard coded list of acceptable trigger types, which only include entry
and exit
.
https://github.com/sverweij/state-machine-cat/blob/develop/src/parse/smcat-ast.schema.json#L29
Would it be possible to add activity
(or some equivalent) to that list?
Steps to Reproduce (for bugs)
I can whip up a minimal example of the problem if that is useful!
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Time-Driven Activity-Based Costing - Harvard Business Review
Time equations greatly simplify the estimating process and produce a far more accurate cost model than would be possible using traditional ABC techniques....
Read more >Activities of Daily Living - StatPearls - NCBI Bookshelf
Activities of daily living (ADLs) are essential and routine tasks that most young, healthy individuals can perform without assistance.
Read more >Top ten ways to clean your data - Microsoft Support
Misspelled words, stubborn trailing spaces, unwanted prefixes, improper cases, and nonprinting characters make a bad first impression.
Read more >Progress Cleaning the Air and Improving People's Health
A key reason is that the motor vehicle fleet is much cleaner because of Clean Air Act emissions standards for new motor vehicles....
Read more >Webinars - Climate Literacy and Energy Awareness Network
All CLEAN webinars are virtual and use the online Zoom platform with screen share and integrated audio. For questions, more information, or to ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Awesome!
That is exactly how I was modelling it in my head, so I’m very happy with that change 😀 On Sat, 29 Sep 2018 at 6:04 pm, Sander Verweij notifications@github.com wrote:
I’ve been struggling with keeping the ordering as entered, but the code became really messy. So I had to get back to base 1: the model wasn’t good enough yet.
entry
andexit
’s are similar toactivities
- but in the model they weren’t.I took a look at the Harel’s original state chart paper - and noticed he calls all three of them actions (similar to the same concept on transitions). So I decided to
triggers
toactions
activity
astype
… which results in this AST for the above sample:
Published as
3.0.4-beta-2
on npm.(I’ve taken the liberty to update redux-saga-state-machine/xstate-to-svg and retest it, and it seems to work OK, provided
jest -u
is run to update the snapshot so it expects the new (more correct) order of actions is - diff here)