Repository navigation
Releases
0.9.0
Install with npm install solarite, or import from a CDN with no build step:
import h, {Solarite} from
'https://cdn.jsdelivr.net/npm/solarite@0.9.0/dist/Solarite.min.js';Documentation and live examples →
Event handlers now behave like real listeners
A handler written in a template used to run late, only once the event reached the component's root element. That quietly broke four things: stopPropagation() couldn't stop a listener on an ancestor, a listener on an ancestor could stop your handler from running at all, an event that doesn't bubble never arrived, and an element moved elsewhere in the page lost its handlers.
Solarite now attaches a real listener to each element along the event's path as the event begins, so handlers run in the browser's own order with the correct currentTarget. Rendering stays as cheap as it was, since nothing is registered until an event actually happens.
One difference from a hand-written listener remains: a template handler runs after any listener that other code already added to the same element. Write native:onclick=${...} when yours has to come first. It works in JSX as native:onclick={...}.
Breaking: the eventDelegation: 'document' option is gone. Passing it does no harm, because what it used to do now happens for every handler.
Fixed
- A component written as
<div is="my-panel">is now built once instead of twice, and no longer nests its first render inside its own<slot>. - A component's slot children no longer disappear when its constructor builds another component, such as a toolbar whose menu is created by a field initializer.
Also
- Added
dist/jsx-runtime.min.jsanddist/jsx-dev-runtime.min.js. Pointsolarite/jsx-runtimeat these if your page loadsSolarite.min.jsby path, or you'll get a second, unminified copy of Solarite. - Solarite warns in the console when a second copy loads, naming where both came from. Two copies don't recognise each other's components, and nothing else gives you a clue.
- The download is 12.7KB with Brotli, up from 12.4KB.