valdres-lit
v0.0.1
Published
Lit bindings for Valdres — reserved. Not yet implemented; today use the framework-agnostic `valdres` core. See README.
Maintainers
Readme
valdres-lit
Reserved — not yet implemented.
This package name is reserved for first-class Lit bindings for Valdres. It currently ships no functionality.
Use Valdres with Lit today
The valdres core is framework-agnostic — drive it directly and bridge it into
a Lit component with a
ReactiveController:
import { store, atom } from "valdres"
const s = store()
const counter = atom(0)
class ValdresController {
#unsub
constructor(host, state) {
this.host = host
this.state = state
host.addController(this)
}
get value() {
return s.get(this.state)
}
hostConnected() {
this.#unsub = s.sub(this.state, () => this.host.requestUpdate())
}
hostDisconnected() {
this.#unsub?.()
}
}
// in a LitElement:
// #counter = new ValdresController(this, counter)
// render() { return html`${this.#counter.value}` }Dedicated valdres-lit bindings will ship this controller for you. Track
progress at https://github.com/eigilsagafos/valdres
