Our great sponsors
-
dom-proxy
Develop lightweight and declarative UI with automatic dependecy tracking without boilerplate code, VDOM, nor compiler
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
I'm experiencing the trade off between simplicity and expressiveness for a lightweight frontend library that doesn't involve VDOM.
On one hand, a library [1] can be very concise (update dom from object).
On another hand, a library [2] can be very flexible and reactive (update dom from dom events).
However, when double-binding (a.k.a. bi-directional binding) is required (update dom from object and update object from dom), it seems more complex than I would consider it lightweight.
When double-binding is preferred, I'd rather go for angular / vue. Still exploring alternatives.
[1] https://github.com/beenotung/data-template
[2] https://github.com/beenotung/dom-proxy
I'm experiencing the trade off between simplicity and expressiveness for a lightweight frontend library that doesn't involve VDOM.
On one hand, a library [1] can be very concise (update dom from object).
On another hand, a library [2] can be very flexible and reactive (update dom from dom events).
However, when double-binding (a.k.a. bi-directional binding) is required (update dom from object and update object from dom), it seems more complex than I would consider it lightweight.
When double-binding is preferred, I'd rather go for angular / vue. Still exploring alternatives.
[1] https://github.com/beenotung/data-template
[2] https://github.com/beenotung/dom-proxy
Nice writeup. We're working on a framework with similar goals, here: https://github.com/frameable/el
Reactivity, composability, templates, etc with no dependencies, in ~150 SLOC.
Depends on the definition of simplicity. People say they want simple, but then really want easy. The most easy is always somebody doing the work for you. I got tired of hearing people mention easy when really they probably mean some combination of fearful and/or lazy, so I chose to define easiness:
https://github.com/prettydiff/wisdom/blob/master/Easiness.md
If developers really wanted simplicity or to be done with work faster they would just learn the primitives of their environment: DOM, functions, and events. Most of the frameworks have APIs that are huge, so clearly simplicity isn't what's wanted.
The lit-plugin in for VS Code offers syntax highlighting, jumpt-to-definition, etc: https://marketplace.visualstudio.com/items?itemName=runem.li...
Prettier already supports HTML in html`` strings, likewise, CSS.
> Is there a way in Lit to write the templates in regular HTML rather than a string?
This would require a compiler. You would need to load the HTML into the JS module graph and JS can't do that yet, though there is a proposal for it: https://github.com/WICG/webcomponents/blob/gh-pages/proposal...
Template in HTML also have the problem of the data not being in scope as it is in JS, and there not being an expression language. So you ned up having to re-implement a lot of JS embedded into the HTML syntax, which then preferences a compiler-based approach to make fast. It turns out to be a lot simpler to embed HTML in JS.