Is there anything built to visualize a bare statechart without any of the Fulcro integration?
@tony.kay I have your xstate code kinda working but I'm not so sure how to make the :cond translation so the result produces a useful visual representation.
It might be about as good as it gets. In the brand new Stately visualizer you can get different representations, but copying its code over to the classic visualizer produces results like my first screenshot.
like I said….alpha and not maintained 😄
read the xstate docs and see if you can figure something out.
Oh yeah I understand this was just a shared gist and you're not doing anything with it. I was just wondering if you had some baseline for what you wanted the end result to look like. I'll keep playing around with it some more, see what might be a reasonable target to aim for.
oh, I don’t even know. My idea would be a dev tool for statecharts of our own, based on what I already started in visualization. My devtools project is meant for making tools that you can connect to CLJ or CLJS, so I was imagining that the visualizer could be embedded in Fulcro Inspect, but that it would also be easy to take that code and share it into a tool that could run against CLJ statecharts with a lot of shared functionailty. The one in Inspect is meant to let you watch it run in real time, it just isn’t very featured yet (just shows active states)
Right, so the visualization is written to work in clojurescript already, but technically the logic works with the eclipse layout kernel. Converting that to work in clojure should be relatively easy because the data translation is already done. I chose elk because it works in clojurescript and clojure. So there is also some code I wrote that will sort of translate a state chart into JavaScript xstate, and then you can use their visualizer. I think the code for that might be in the src/dev folder?
I'm dictating to my phone and it's making a mess...
lol no worries I understand, ty. Looks like there are a few experiments in that src/dev folder.
@tony.kay I don't think I see the xstate code though. Do you mean this? https://github.com/fulcrologic/statecharts/blob/main/src/dev/chart_io.clj
https://gist.github.com/awkay/82e753c5b25b5a07ebee29ef9a8354e4
I have it in a private repo
I should put it in the dev folder there though…
I copied it over so it is in the src/dev now. I haven’t touched that in a long time, so not sure if it’ll work, but if it does their visualizer is pretty polished
whereas mine is a proof of concept at best…needs a lot of work that I don’t have time to do
Thanks for sharing this code. I'll try it out. I'm trying to debug a chart I'm working on and figured the viz would really help.
Most of the heavy lifting has been done on the newer one using ELK. It’s ugly as hell and doesn’t directly interface with Clojure (yet), but if you’d be interested in helping make that one better let me know. I’d love to have it, just too many balls in the air right now
I have a few priorities on my stack at the moment but I'm hoping in a week or two that should be cleared up and then I might take a good look at this.