Skip to content

@fiorejs/jsx 2.0.0

Choose a tag to compare

@vrtexe vrtexe released this 16 Nov 16:12
· 1 commit to main since this release

@fiorejs/jsx 2 builds on fiorejs 2.0.0 and its live-value protocol. JSX syntax is unchanged. It requires fiorejs 2.0.0.

Changes

  • Data object: the runtime now produces { props, attrs, on, children } and calls element(type)(data) from fiorejs 2.
  • Live values instead of plugins: a prop or child is live when it is a live value, such as a signal or computed from @fiorejs/signals 2.0.0. A function is never live: class={() => …} passes the function itself, so write class={computed(() => …)}. On a custom element, a function prop is therefore always a callback.
  • Children: the runtime passes children to fiorejs, which flattens nested arrays at any depth, so {items.map(...)} next to other children works as before.
  • Fragments: a lone live child inside <>…</> keeps updating after the fragment is inserted.
  • Custom elements: an object value, which includes every live value, goes to the property of that name, as the README explains.

Install with npm install fiorejs @fiorejs/jsx and set jsxImportSource to @fiorejs/jsx; the README has the setup.