Template – A simple framework for webapps
github.com
github.com
The shadow DOM stuff was just added. Before I was just using <template>. So those tires are “unkicked” - if ShadowDOM doesn’t work for you, you can git revert that out and the library will work all the same (with less isolation)
It's "open source" as a reference. Just using it for myself. There aren't many docs beyond notes to myself. But the actual framework is a 90LoC JavaScript file that is an easy read.
You're welcome to kick the tires. If you like it I'd entertain PRs and stuff but it's such a small library forking is probably entirely reasonable to make your own flavor too.
It’s BSD licensed, but in the spirit of GPL, if you go and make it your own I’d appreciate if you reported back what worked and didn’t for you!
I use this for a subset of my consulting projects (boutique app development for small businesses). You’d help a large group of people downstream by sharing what you learn back <3
I am not the author.
Updates are scheduled and only components that need updating get their render method called. I even threw in a way to pass objects to child components by means of a yield method.
Just in case someone found it intereting.
Can templates be nested?
Nesting works using the same concept. A parent template either picks one of its child nodes using this.fragment.querySelector or using document.createElement to mount a child template to. You then use this.addChild to opt into garbage collection.