Typescript UI library ^^
Kaori is a dynamic Typescript library designed for creating reactive user interfaces with a syntax that resonates with users familiar with frameworks like React and Solid. Built on top of lit-html and @preact-signals/core, Kaori leverages the power of signals to improve UI responsiveness. The library’s innovative compiler converts JSX into template literals that are efficiently rendered using lit-html, making it a compelling choice for developers seeking to enhance their UI building experience.
What makes Kaori particularly interesting is its reactivity model. By accessing any signal or computed value within the component function, developers can trigger re-renders selectively, only rerunning the render function when necessary. This nuanced approach not only boosts performance but also allows for enhanced control over component behavior.
Reactivity Model: Automatically triggers re-renders of template literals when signals or computed changes are detected, resulting in efficient updates without redrawing the entire component.
onMount: A lifecycle method that allows you to execute a function when a component is mounted, making it easy to set up initial state or perform side effects.
Effect Handling: Easily run functions in response to changes in signals or computed values using the effect utility, providing a straightforward way to manage side effects.
Conditional Rendering: The Show component allows for efficient conditional rendering. It avoids unnecessary parent component re-renders when toggling display states.
List Rendering: Utilizing the For component optimizes list rendering, enabling changes like reordering or selectively adding/removing items without excessive DOM manipulation.
Special Attributes: Enrich element properties with special attributes like prop:value, bool:checked, and event listeners prefixed with on, simplifying the way you bind data and handle events.
Dynamic CSS with classMap: Apply CSS classes dynamically based on truthy values, allowing for responsive styling based on the component state.
Props Management: The splitProps helper provides a clean and organized way to handle props, making it easier to spread or forward properties to other components without cluttering your code.