-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uhtml v4 - Release notes #86
Conversation
83f57fd
to
2795879
Compare
Current results in a nutshell: https://twitter.com/WebReflection/status/1723793350002725247 |
Awesome! Do you have plans to mirror these changes to uhtml-ssr as well as the uland part of the family? |
I have plans it's just that time has no plans for me ... I will eventually update the uhtml world around latest. |
Cool. Let me know if you are interested in any areas of contributions to make it happen. |
That's great !! Thanks !! uhtml is a wonderful library. |
Thank you! |
@nuxodin great question ... I feel like that's better off any stale-while-revalidate pattern but I won't forget about it in v4, not in the immediate pipe though, but needed to have |
thanks for clarifying 👍 |
This MR is a partial rewrite of v3 with a "back to origins" purpose and a lot of performance and RAM consumption improvements over the previous stable v3 version.
Please note that while most needed or demanding v3 features will be, eventually, ported over v4, this should be almost a drop-in replacement for v3, with the following most notable breaking changes.
Breaking Changes
uhtml
(~2.5K) for default, non-keyed yet blazing fast and most common use cases,uhtml/keyed
(~2.6K) for both implicit (default) and explicit keyed operations anduhtml/node
(~2.2K) for one-off only use casesonclick
or nativeon*
handler is just directly set like any other special attribute such asvalue
for inputs or textareas, and so onclass
andstyle
are handled as special attributes (amongaria
,data
andref
) so thatclass=${value}
now directly setclassName
of the element whilestyle=${value}
now directly set theelement.style.cssText
but only when the current value is different from the previous onehtml.for(...)
andhtml.node
utilities have been moved:uhtml/keyed
export provides anhtmlFor
and ansvgFor
direct callback to create related tags. The full export there is{Hole, render, html, svg, htmlFor, svgFor, attr}
and these are all typeduhtml/node
export provides a one-off only implementation of the logic, without ever caching details around nodes and without logic around updates ... this export is literally for one-off operations and nothing else, but as escape hatch, creating one-off content can always be done with theuhtml/keyed
export and eitherhtmlFor({})
orsvgFor({})
utility, still keeping performance high and memory consumption lowstring
,boolean
,number
, or arrays within interpolationshtml
orsvg
tags even to create just static text contentref
featureMemory Improvements
bind
for the very always same callback, helping engines further to optimize for its operations. All other updates use always the exact same callback reference just passing a bit more details than before and the resulting value would update the retained one when that's different from the previous oneAbout TypeScript
This module now generates automatically all definitions in the most accurate way and it describes types also internally, hoping to welcome more TS contributors when it comes to bugs or improvements.