first draft but not working yet

This commit is contained in:
authentik Default Admin 2026-03-04 11:13:15 -08:00
commit b54c89c9c4
10 changed files with 380 additions and 0 deletions

23
controllers/store.js Normal file
View file

@ -0,0 +1,23 @@
export class StoreController {
constructor(host, store, selector) {
this.host = host
this.store = store
this.selector = selector
host.addController(this)
}
hostConnected() {
this._unsub = this.store.subscribe(
(state) => {
const next = this.selector(state)
if (next !== this.value) {
this.value = next
this.host.requestUpdate()
}
}
)
this.value = this.selector(this.store.getState())
}
hostDisconnected() { this._unsub?.() }
}