localvoid / ivi

Lighweight Embeddable Web UI Library
MIT License
710 stars 20 forks source link

component meta-compiler #64

Open leeoniya opened 8 months ago

leeoniya commented 8 months ago

so here's a fun one. not really ivi specifc.

let's say i want to make an interface that renders arbitray CSV files into html tables. this doesnt fit the nice static Row template approach in js-framework-benchmark.

https://github.com/krausest/js-framework-benchmark/blob/master/frameworks/keyed/ivi/src/main.ts#L66

insteadd you end up having to do nested tr/td loops, which is not great. ideally you could dynamically compile a static Row template probably using new Function to avoid the inner td loop and rely on cloneNode of the mostly complete whole row dom.

would typings need to go out the window in this case? maybe not? 🤔

not sure if there's anything that can be done on the ivi side to help with this use case but figured i'd start a convo.

localvoid commented 8 months ago

ideally you could dynamically compile a static Row template probably using new Function to avoid the inner td loop and rely on cloneNode of the mostly complete whole row dom.

I think that it is possible to generate intermediate template representation without any html parsing steps and compile it with compileTemplate(ir) at runtime.