atom
atom copied to clipboard
WIP: add automated lit integration
Just a PR containing the stuff that was in #2
Implementing an "auto" version of the lit integration which tracks atoms and observes the right ones automatically.
Usage:
export class MyElement extends AtomLitElement {
render() {
return html`
<button @click="${() => setCount(old => old - 1)}">-</button>
<span>${count.getState()}</span>
<button @click="${() => setCount(old => old + 1)}">+</button>
`;
}
}
Couple of thoughts:
- Can it be typescript? pretty please 😆
- I named it
AtomLitElement
to follow the same convention lit-mobx and a few others did (*LitElement
) - we should align the two integrations some way (name them similar or combine them into one configurable integration)
- a formatter like prettier or clang might be nice
- i tried to add tests but wtr doesn't work on chromeos so i have no clue if they fail