@polight/lego

Tiny webcomponent lib for future-proof HTML mentors

Usage no npm install needed!

<script type="module">
  import polightLego from 'https://cdn.skypack.dev/@polight/lego';
</script>

README

Lego is a fast web-components library

LEGO: Modern Web-Components

LEGO (Lightweight Embedded Gluten-free Objects) is a NodeJS tool to build ๐Ÿš€ fast, โ™ป๏ธ reactive, ๐Ÿก native web-components that are easy to digest ๐ŸŒฑ for your browser.

Lego is:

  • ๐Ÿ‘™ Minimalist: 74 61 lines of readable code in its core (non-optimised, uncompressed, no cheating).
  • ๐ŸŒฑ Low dependency: its single third-party is the minimalist Petit-Dom which itself has no dependency
  • โ™ป๏ธ Reactive: updating the state recalculate the Virtual Dom when needed
  • ๐Ÿš€ fast: using virtual dom through a thin layer makes it close to bare-metal
  • ๐Ÿ’ง Simple: that's Vanilla, there isn't much to know, it's a raw class to extend; no magic โœจ
  • ๐Ÿก Native: webcomponents are actual native webcomponents, you benefit from all the today's and tomorrow's possibilites (slot, encapsulation, โ€ฆ).

Lego is not (and will never be):

  • ๐Ÿฏ A full bloated frontend framework with routing. Others do it well.
  • ๐Ÿ— A website builder with SSR or similar complexities.
  • ๐Ÿ” An HTML replacement that locks you into a specific technology.

View the demo and their source ๐Ÿงช.

Lego is inspired from the native Web-Component spec and Riot.

It's just much lighter with simplicity, source that are easy to read, to hack and to maintain. The core lib is only 61 LOC! Lego is as light as 3Kb for the full bundle!

Demo: view in action

Read the full documentation at https://lego.js.org