7 ms·
The core idiom I've used for years is deliberately tiny: fully encapsulated custom Web Components that simply re-render when matching an attribute and `window.s
by dpweb 10d ago
The core idiom I've used for years is deliberately tiny: fully encapsulated custom Web Components that simply re-render when matching an attribute and `window.state` changes. Data model is simply:
window.state = new Proxy({}, {
set(target, key, value) {
target[key] = value
document.querySelectorAll(`[data="${key}"]`)
.forEach(el => el.render?.())
return true
}
})
handles reactivity.. https://github.com/digplan/vanilla-light https://github.com/digplan/vanilla-light
- bosmarcel 10d agoLooks nice! Imho, custom elements are great, but very limited in a way that they almost always require knowledge of the domain. Perhaps I can figure out a way to combine mador.js & custom elements.