pietroppeter / nimib

nimib 🐳 - nim 👑 driven ⛵ publishing ✍
https://pietroppeter.github.io/nimib/
MIT License
176 stars 10 forks source link

idyll like api #121

Open pietroppeter opened 1 year ago

pietroppeter commented 1 year ago

now that we have nbKarax, I think it would be a nice project to try and build a idyll like api (which is based on react): https://idyll-lang.org/docs

hopefully we can reuse the work they did on components.

HugoGranstrom commented 1 year ago

There are so many interesting APIs out there 🤯

The benefit they have that we don't is that nbKarax doesn't allow communication between nbKarax-blocks. So we wouldn't be able to do the example they have like this:

nbGraph()...

nbButton()
nbButton()

where each call calls nbKarax. We would need to combine them into a single nbKarax block for it to work. 🤔 Unless you have a brilliant idea to drag out from your magic hat as usual 🧙‍♂️🃏

Another idea would be that each component adds a VNode to a list which Karax then loops over. We can't complain about not having any ideas for new themes and APIs at least 🤣

pietroppeter commented 1 year ago

yes, I think the simplest would be to implement it as a single block like:

nbIdyll:  #adds template for all the apis
  text "..."
  input
  button
  ...

and nbIdyll turns that in a single nbKarax block.

then probably it is possible in some way to split it (as you mention, every piece would need to add procs and VNodes to a list and you could have a nbInitIdyll). I would start from the single block as above.

Unless you have a brilliant idea to drag out from your magic hat as usual 🧙‍♂️🃏

Not really. It think the interest here is if we can reuse the stuff that is in idyll repo. (plus they do have a nice gallery)

We can't complain about not having any ideas for new themes and APIs at least 🤣

I do have a private repo with a list of ideas (issues) on things to do with nim (not all of them apply to nimib), so... not running out so soon. Especially with the pace I have implementing them... 🤣

HugoGranstrom commented 1 year ago

yes, I think the simplest would be to implement it as a single block like: and nbIdyll turns that in a single nbKarax block.

Yes that sounds like the best idea :+1:

then probably it is possible in some way to split it (as you mention, every piece would need to add procs and VNodes to a list and you could have a nbInitIdyll). I would start from the single block as above.

Procs will be troublesome because you can't serialize a proc so you can't send it from C -> JS sadly. VNodes I'm not certain of but it might also be troublesome if it holds any references :thinking: So we will basically have to do everything on the javascript side. But maybe that's what you meant. I'm leaning a bit towards some kind of macro which just copy-pastes code blocks into a nbKarax somehow.

Not really. It think the interest here is if we can reuse the stuff that is in idyll repo. (plus they do have a nice gallery)

Oh, I misread your first post as reusing the work that we did on components :facepalm: Yes le's hope what they did can be done similarly here. And they did have a very nice gallery indeed.

I do have a private repo with a list of ideas (issues) on things to do with nim (not all of them apply to nimib), so... not running out so soon. Especially with the pace I have implementing them... rofl

Look at that, I'm only seeing the top of the iceberg of ideas :rofl: