uce vs lit-element
A very simple comparison table between these two libraries.
| uce | lit-element | |
|---|---|---|
| version | 1.11.9 | 2.4.0 |
| license | ISC (simplified MIT) | BSD-3-Clause License |
| language | JS w/ TS definition | TS w/ JS transpilation |
| size ( brotli ) | 9437b ES5 / 6811b ES2015+ | 8634b ES5 / 6708b ES2015+ |
polyfill ( brotli ) * |
2.1k w/ builtin extends | 5.2k CE w/out builtin or 68.3k w/ SD |
minimal components size ** |
73b | 30k+ |
| declaration | object literal w/ extends | the base class is LitElement only |
| extends-ability | mixins | classes |
| tooling-free | ✔ | import + @decorators |
| keyed & non-keyed ability | ✔ | ✔ |
SSR *** |
✔ | ❓ |
distributable components **** |
✔ | |
friendly syntax ***** |
✔ | ❓ |
| builtin extends | ✔ | ❌ |
* uce optional polyfill is @ungap/custom-elements which provides builtin extends for IE and Safari too, but no ShadowDOM, which can be optionally added via attachshadow or ShadyDOM, while lit-element optional polyfill is @webcomponents/webcomponentsjs which provides Shadow DOM but no builtin extends.
** in uce the minimal custom element is customElements.whenDefined('uce-lib').then(({define})=>define('a-b',{})), while in lit-element it's import{LitElement}from'lit-element';customElements.define('a-b',class extends LitElement{}).
*** in uce the usage of ShadowDOM is not really necessary, neither encouraged, hence its components work out of the box even landed as SSR. See uce-template for an even richer SSR compatible experience. In lit-element, the usage of ShadowDOM is both encouraged and demoed all over, requiring its heavy polyfill if older browsers such as Edge, IE11, or legacy Mobile, are part of the targets, and yet, ShadowDOM is not SSR friendly, so choose carefully here.
**** in uce components can be distributed without carrying the library with them, thanks to its presence as customElements library, while lit-element requires that each component bundles the library in order to work, adding unnecessary bloat when components are published as stand-alone. That is: uce libarry size is O(1), while in lit-element it's currently O(n).
***** in uce interpolations can be just plain JS, no need to import, know, or learn, any repeater or specialized syntax/feature.
P.S. components written for uce will run without any change in uce-template too ... which is another benefit of not needing the library to define a component.