🀄️ Osagai

Create WebComponents with no class, just functions

Why?

Creating WebComponents shouldn't be limited to extending classes and it should use native solution and no magic.
Osagai is a library that make WebComponents easier to create and use with only composing functions and template literals.

Easy to create

Create and easily define WebComponents using functions. No needs to extends classes and OOO things.

Fast updates

Update when you say to update. It compares the current DOM tree with the new one and update only what it needs to be updated using the amazing Morphdom library.

Framework agnostic

Take advantage of WebComponents purpose and use your component in whatever Framework/Library.

Simple component

Osagai export a define() function to create your WebComponent. Your component is a function that returns a template with the view definition

Adding event listeners

In addition, in you component function it will be injected some useful methods like query that you could query inside the component tree and add event listeners with the on method from osagai/events.

An application

Besides query, Osagai will also inject an update function that you can use for changing the data (or state) being used in the template function. This will check what it needs to be changed in the DOM and apply the re-render

A real application

This a "real" example of the Hacker News implemented with Osagai as a PWA. You can se the code on Github, or try it live here.