newcat / baklavajs

Graph / node editor in the browser using VueJS
http://baklava.tech
MIT License
1.62k stars 118 forks source link

Logic branching (and react) #223

Open parzival418 opened 2 years ago

parzival418 commented 2 years ago

Hey!

Amazing library! I have been hacking on a customized version of Rete, and it has been a huge headache. I would love to port my application over to Baklava.

Three questions.

1) Does the library support branching logic? I do a lot of things where a boolean operation might determine one or more output sockets to run, but not others. In Rete, I do this with a task plugin, which defined run flow as separate from the data connections. Can I do this kind of branching logic gating in Baklava?

2) Is there any progress on a React rendering library? If not, I would be happy to contribute to one if there is any documentation you have been working on for how the vue rendering plugin works. I was reading through the code trying to get a handle on it.

I was also looking at Veaury to see if I could wrap your library into my app. I basically have to do this with Rete. To integrate Rete into my main react app, I had to build a whole pubsub communication layer between the two applications. It is a huge pain.

3) I saw that this can run "headless" on a server. Can I run a Baklava chain from a node server, and pass in inputs into input nodes? In my current use of Rete, I define inputs, like one would on a submodule, and can pass in arguments to a chain that way when running server side.

Thanks for making such an amazing library!

newcat commented 2 years ago

Thank you for the feedback! Here are the answers to your questions:

  1. No, not yet. This is related to #162. I am planning to implement a "forward" / "execution flow" engine in version 2, however, I don't know when I have the time to implement it.
  2. Unfortunately, I don't think there will be a separate React library. Considering how much effort it was to get the Vue part up and running, maintaining a React renderer as well would basically mean double the effort - and I am already struggling to find the time for maintaining the library in its current state. However, I don't think a full-blown React renderer is really necessary. The core logic of Baklava is independent of Vue anyway and most of the Vue stuff in the renderer is encapsulated as well. The only tricky part I can think of for now is the components displayed in the node interfaces. But this is something where Veaury (or a similar library) could help, I think. So instead of creating a separate library, I'd rather focus on creating a wrapper package. But to be fair, this isn't too high up my priority list, so don't expect it to arrive anytime soon.
  3. Yes! This is especially something I had in mind when creating v2, so it should actually be quite easy to implement.

Hope this answers your questions.

parzival418 commented 2 years ago

Hi @newcat!

Yes, indeed it does. Your library is a lot cleaner than Rete, and with Rete I am already forced to interact with it in a sandbox. So dropping Baklava into my app and finding a way to wire it up to React via some kind of wrapper methodology makes perfect sense.

As I mentioned, I would be happy to contribute as I dig into the code and implement my required features and integrations. A lot of my use cases are pretty custom and fringe (long-running pipelines, real-time nodes that can stream data in and out, multiple subgraphs, loops, dynamically created sockets, etc). If I can build plugins to modify core behaviour, then I can contribute back features in the form of plugins. I created a bunch of custom Rete plugins once I was familiar with this.

I also will need a way to interact with components' persisted state from outside the environment as well. That is one thing I use the pubsub system in my current implementation to do. I have attached a screenshot of my current environment, and you can see the inspector window on the side allow me to manage data properties on nodes without putting it all inside the node on the graph itself.

Screenshot 2022-11-15 at 10 51 37 AM

Do you accept sponsorships or contract work? I am going to be needing a lot of graph system work on a system like this in the near future, and would rather hire or sponsor you to help than try to build something like this from complete scratch for ourselves.

Thanks again!

parzival418 commented 2 years ago

Actually, on one last point, do you have any way I could contact you directly to chat outside of github?

newcat commented 2 years ago

Feel free to contact me on Discord (newcat#6028), but unfortunately, I likely won't be able to make any contract/sponsored work due to the limited time I have available at the moment.

parzival418 commented 2 years ago

Friend request sent on discord :)