npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

supertag

v0.0.9

Published

create self contained, reusable web components

Downloads

10

Readme

Supertag

create self contained, reusable web components

Supertag is a light weight library to create self contained, reusable Web Components.

The GZIP size of Supertag The Brotli size of Supertag License: MIT code style: prettier

Features

  • Standards Based: Supertag uses latest features of web platform such as Custom Elements and Shadow DOM and combines them with fast and efficient vDOM rendering based on Superfine.

  • Lightweight: < 2 kb min & gzipped - extremely light weight solution for creating self contained, reusable Web Components

  • Fast - Supertag enables async rendering at next micro-task timing. Multiple calls to render are automatically batched for blazing fast view updates.

Motivation

We believe, that the emerging Web Components standard has reached a level where truly reusable component can now become a reality. Browser support for Custom Elements & Shadow DOM is comprehensive and Framework support for Web Components is at par.

See Custom Elements Everywhere - a fantastic initiative by Rob Dodson which tracks support for many popular frameworks.

However, the ergonomics around vanilla web components are too low level and often inconvenient, which is where Supertag plays a role. Primary focus for Supertag is to make authoring and shipping web components as painless as possible while still staying true to its minimalism promise.

Installation

Grab a copy from CDN:

<script src="https://unpkg.com/supertag"></script>

Or install it from NPM:

npm i supertag

and use it with module bundlers like webpack or parcel as you normally would.

Usage

Our first example is a component that can increment and decrement a counter

import { Component, h } from 'supertag';

class HelloCounter extends Component {
	get count() {
		return Number(this.getAttribute('count') || 0);
	}
	set count(value) {
		this.setAttribute('count', String(value));
	}
	static get observedAttributes() {
		return ['count'];
	}
	render() {
		return (
			<div>
				<h1>{this.count}</h1>
				<button onclick={() => this.count--}>-</button>
				<button onclick={() => this.count++}>+</button>
				<button onclick={() => (this.count = this.count + 10)}>+10</button>
			</div>
		);
	}
}

Every time a count changes, we create a virtual DOM representation as described by render method. We then diff it against an existing virtual DOM representation and patch the real DOM using efficient diff and patch algorithm.

Contributing

Scaffolded using tslib-cli.

Run yarn or npm install in root folder to setup your project.

Available Commands:

yarn build # builds the package
yarn test # run tests for the package
yarn coverage # run tests and generate coverage reports
yarn pub # publish to NPM
yarn format # prettier format
yarn lint # lint pkg files
yarn setup # clean setup

License

MIT License @ osdevisnot