Open levand opened 9 years ago
If you have any ideas on how to do this, I'd be happy to do the implementation if you gave me a few pointers. I'd love to use this on the project I'm working on right now, but I'd need something relatively soon.
Thanks!
Maybe look at how "at" works in enfocus (for inspiration).
@solussd Enfocus has runtime selectors, which that uses. Kioo selection happens exclusively in Clojure at macro expansion time (as far as I can tell).
@levand right-- I was thinking syntactically, but thinking about it more it's not ideal, e.g.:
{[:.widget1] (at this
selector-fragment)}
The most likely way to do this is to port enlive to cljs. You might be able to start with hickory and a translation from enlive selectors to hickory selectors. The data structure you're getting in 'at' here is the clojure-xml format with a minor difference that some of your children nodes could be react nods and xml nodes. So any zipper would have to ignore those nodes when walking for the select.
I have started an effort to port Enlive to cljs - will let you know how it goes.
One side effect of this is that, if I do it right, Kioo can become much smaller and deal only with translating Enlive-produced data structures to React components, not shimming out Enlive as much.
I'll let you know what I come up with.
Say I have something like this:
Is there a way to factor out the common elements? Something like this, perhaps?
I don't care about the syntax, but I can't figure out any way to get this kind of composition/abstraction without hacking Kioo itself.
Any ideas on how this might be supported?