Back to the changelog
0.4.0
Async setup, directives and transitions
Most component libraries soon need a component that loads its data, a focus trap that several elements share, a dialog mounted at the end of the page and an element that animates in and out. This release adds each of them to the language, compiled to all seven targets, and Solid 2 as an eighth target you opt into.
New
- Async setup: a component can be
asyncand await what it needs at the top of its setup, likeconst user = await loadUser(id). The server renders what it loaded, and a hydrated page keeps the server's HTML while the setup runs again. A hand-written Vue parent wraps it in<Suspense>, and a Svelte app turns on its async mode. - Directives package a behaviour an element takes, like a focus trap or a click outside. Declare one with
defineDirectiveand apply it asv-name={value}. Its hooks run in the browser only. <Teleport to>mounts an element at the end of another part of the page once its component has mounted, like a dialog or a toast. A React package fromunframework build --packagenow takesreact-domas a peer, for itscreatePortal.<Transition>runs Vue's enter and leave classes on an element as it shows or hides, so your stylesheet animates it.solid@2compiles to Solid 2. Add it totargetsin your configuration.solidstill means Solid 1, and the default stays the seven targets.
Improved
- A preview of one target, like
unframework preview --target vue, opens with its frame across the whole canvas, with no Targets switch.