fulcro

sheluchin 2025-05-28T13:56:23.342529Z

Is there anything built to visualize a bare statechart without any of the Fulcro integration?

sheluchin 2025-05-30T15:54:37.869719Z

@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.

sheluchin 2025-05-30T16:01:41.058459Z

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.

tony.kay 2025-05-30T16:21:48.162339Z

like I said….alpha and not maintained 😄

tony.kay 2025-05-30T16:22:10.425499Z

read the xstate docs and see if you can figure something out.

sheluchin 2025-05-30T16:35:48.247359Z

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.

tony.kay 2025-05-30T17:02:18.926419Z

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)

tony.kay 2025-05-29T13:48:40.689779Z

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?

👀 1
tony.kay 2025-05-29T13:51:16.654679Z

I'm dictating to my phone and it's making a mess...

sheluchin 2025-05-29T13:52:25.553119Z

lol no worries I understand, ty. Looks like there are a few experiments in that src/dev folder.

sheluchin 2025-05-29T14:01:30.469529Z

@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

tony.kay 2025-05-29T14:19:30.786029Z

I have it in a private repo

tony.kay 2025-05-29T14:19:40.748999Z

I should put it in the dev folder there though…

tony.kay 2025-05-29T14:25:09.343009Z

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

tony.kay 2025-05-29T14:25:26.804119Z

whereas mine is a proof of concept at best…needs a lot of work that I don’t have time to do

sheluchin 2025-05-29T14:35:12.638909Z

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.

tony.kay 2025-05-29T14:47:21.110939Z

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

sheluchin 2025-05-29T14:52:53.570649Z

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.