Repository navigation
@uxfront/unframework@0.4.0
Minor Changes
-
de1d9d0: Add async setup: a component may be
asyncand declare what it waits for asconst user = await loadUser(id)at the top of its setup. The server renders what it loaded, a client mount renders once the setup resolves, and a hydrated page keeps the server's HTML while the setup runs again. Async components compile to all seven targets, and the JSX types accept one as a tag.An
awaitthat isn't the whole value of a top-levelconstis UF2038, and anawaitafter another setup item, or one that reads more than props, module values and earlier awaits, is UF2039. An async component as a<component is>candidate is UF1002 for now.Two hosts do one thing each: a hand-written Vue parent wraps an async component in
<Suspense>, and a Svelte app setscompilerOptions.experimental.asyncfor the files that await. On Svelte, aprovidethat reads an awaited value is UF1002.@unframework.dev/target-svelte's mount and hydrate adapters now make a prop's state without writing it, so a component mounted after an async one, in Svelte's async mode, no longer fails withstate_unsafe_mutation.@unframework.dev/testing's hydrate projects now give the focus back to the hydrated view after the client render they compare it with, so a component that focuses as it mounts keeps the focus. -
de1d9d0: Add directives, which package a behaviour an element takes, like a focus trap or a click outside. Declare one once with
defineDirective<T>({ mounted, updated, unmounted })and apply it asv-name={value}. Its hooks run in the browser only, with a descendant's before its ancestor's, andupdatedruns only after a render that changes the value. Directives compile to all seven targets, and Astro renders the element without them..uf.tsmodules may now export directives beside their composables, and each compiles to one module per target. A directive outside the canonical form is UF2037,v-namewith no directive of that name is UF3055, and a directive on a component or with a value built in place is UF3056. -
de1d9d0: Add
solid@2, a target for Solid 2. A project opts in withtargets: ["solid@2"]:solidandsolid@1still mean Solid 1, and the default targets stay the seven. Its output, tree and package subpath are namedsolid2.A configuration,
compile(), the bundler plugin andunframework test,visualandpreviewtake a target's framework and major as well as its name, and a major that doesn't exist namessolid@2. On Vite, the plugin tells Solid 1's plugin from Solid 2's by thesolid-jsthe app installs.build --packagewrites a./solid2subpath compiled by Solid 2's compiler, and a package with both Solid targets takes eithersolid-jsmajor as its peer.A project that installs both Solid majors keeps Solid 2 in a directory of its own and points
package.resolveFrom.solid2at it. -
de1d9d0: Add
<Teleport to>, which mounts one element at the end of another part of the page once the component has mounted, like a dialog or a toast. It compiles to all seven targets, and Astro renders nothing for it. The server renders none of it, and it unmounts with its component. A bound or emptytois UF3053, and content other than one element is UF3054.React packages now peer on
react-dom, whosecreatePortala<Teleport>needs.@unframework.dev/testingnow captures what a view appends to<body>: the DOM, ARIA, geometry, screenshot and axe checks cover it after the view's container, and the view's queries reach what it holds. A test that leaves an element in<body>once its views are unmounted now fails, naming the element. -
de1d9d0: Add
<Transition name appear>, which runs Vue's enter and leave classes on an element as a condition shows or hides it, so a stylesheet animates it. Its child is one element, or one conditional of elements, and a leaving element stays in its place until its transition ends. Transitions compile to all seven targets, the server renders the settled child, and Astro renders the settled child only.A child that isn't one element or one conditional of elements is UF3057, and a bound or empty
nameor a boundappearis UF3058.@unframework.dev/testingnow waits, as it settles a page before each capture, until no transition or animation runs, for at most 2 seconds. One still running then fails the test.On Svelte and Solid, a directive with only an
unmountedhook no longer importsuntrackor reads its value, which their linters reported.
Patch Changes
- Updated dependencies [de1d9d0]
- Updated dependencies [de1d9d0]
- Updated dependencies [de1d9d0]
- Updated dependencies [2f1bd19]
- Updated dependencies [de1d9d0]
- Updated dependencies [de1d9d0]
- Updated dependencies [de1d9d0]
- @unframework.dev/testing@0.3.0
- @unframework.dev/compiler@0.3.0
- @unframework.dev/visual@0.4.0
- @unframework.dev/cli@0.2.0