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 🙏

© 2025 – Pkg Stats / Ryan Hefner

pawe

v0.1.4

Published

An automatic web progress bar.

Downloads

60

Readme

pawe

An automatic web progress bar. Inspired by pace.

Installation

Via NPM

If you're using a framework like React, that comes with a build system.

Run this command in your terminal:

npm i pawe

Then, add this in your layout (e.g. layout.tsx, +layout.svelte, etc.)

import 'pawe';

Via CDN

If you want to use pawe directly in the browser.

Include this in the <head> of your HTML:

<script
	type="module"
	src="https://cdn.jsdelivr.net/npm/pawe"
></script>

Usage

Automatic Mode

This is the default mode. This means pawe will automatically start monitoring the page load progress & expose the values as HTML attributes & CSS custom properties.

Example

A basic progress bar.

<style>
	/* 1. using CSS custom properties for values */
	#progress {
		/* progress bar */
		width: var(--pawe-bar-percent, 0%);
		background: hsl(0 0% 0%);

		position: fixed;
		height: 2px;
		top: 0;
		left: 0;
		transition:
			width 1s ease-out,
			opacity 1s;

		/* progress text (i.e. '100%') */
		&::after {
			content: var(--pawe-bar-percent-string) '%';
		}
	}

	/* 2. using HTML attributes for state changes */
	:root[data-pawe='idle'] #progress {
		opacity: 0;
	}
</style>

<div id="progress"></div>

HTML API

Here are all the exposed values in HTML/CSS that you can use:

HTML Attributes

| Attribute | Element | Type | Description | | ----------- | ------------------ | ------------------- | ---------------------------- | | data-pawe | :root (<html>) | idle | loading | The current state of pawe. |

CSS Custom Properties

| Property | Range | Description | | -------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | --pawe-bar | 0 to 1 | The augmented progress of the page load that approximates the loading in between down time of collected data points.Users generally prefer this as it provides feedback even if their connections are spotty, causing data to come down in bursts. | | --pawe-bar-percent | 0% to 100% | '', in percent. | | --pawe-bar-percent-int | 0 to 100 | '', floored, without unit. | | --pawe-bar-percent-string | '0' to '100' | '', in string type, for use with the content property. | | --pawe-progress | 0 to 1 | The objective progress of the page load solely based on the collected data points. | | --pawe-progress-percent | 0% to 100% | '', in percent. | | --pawe-progress-percent-int | 0 to 100 | '', floored, without unit. | | --pawe-progress-percent-string | '0' to '100' | '', in string type, for use with the content property. |

JavaScript API

You can also use the JavaScript API to get the progress values programmatically.

For the full list of available exports, see the index.ts file.

Better docs are coming soon™!

Example
import { bar } from 'pawe';

const unsubscribe = bar.subscribe(($bar) => {
	// this is equivalent to `--pawe-bar`
	console.log(`bar: ${$bar}`);
});

Manual Mode (Advanced)

You can also use pawe in manual mode by importing from pawe/api. This means you are in charge of starting the monitoring & scaffolding any other load signals you want to track.

Example: Adding Loads & Reading Progress from the Global Store

// note the different import!
// * `pawe` 	- automatic mode
//				  monitoring is started automatically
// * `pawe/api`	- manual mode
//				  only the api is exposed & no side effects are ran
import { monitorDOM, createLoad, progress } from 'pawe/api';

// log the progress values as we add loads
const unsubscribe = progress.subscribe(($progress) => {
	console.log(`progress: ${$progress}`);
});

// add monitoring of the DOM (skipping the rest)
monitorDOM();

// add your own load signal to the calculated progress
const load = createLoad();
console.log('starting load...');
console.log('loaded: 0%');

// simulate loading
load.set(0.5);
console.log('loaded: 50%');

// mark as finished after 1 second
setTimeout(() => {
	load.finish();
	// or
	// `load.set(1)`
}, 1000);

// the load acts as a promise that will resolve when it hits `1`
await load;
console.log('loaded: 100%');

Example: Creating a Local Progress Bar

// note the different import!
// * `pawe` 	- automatic mode
//				  monitoring is started automatically
// * `pawe/api`	- manual mode
//				  only the api is exposed & no side effects are ran
import { createPool, createLoad, createProgress, createBar } from 'pawe/api';

// where all the loads are stored
const pool = createPool();

// create a load signal
const load = createLoad(pool);
//                      ^^^^
//                      note that `pool` is passed as the first argument!
//                      this is so that the load signal is added to our pool
//                      instead of the global one

// create a progress signal
const progress = createProgress(pool);
// create a progress bar (for UI)
const bar = createBar(progress);

// use the progress values
const unsubscribeProgress = progress.subscribe(($progress) => {
	console.log(`progress: ${$progress}`);
});
const unsubscribeBar = bar.subscribe(($bar) => {
	console.log(`bar: ${$bar}`);
});

Bypassing AJAX Requests

If you want to bypass AJAX requests from being tracked by pawe, you can pass in the non-standard pawe property. It will be removed from the final config/instance before being sent.

fetch

const resp = await fetch('https://example.com', {
	pawe: 'bypass', // add this to bypass tracking
});

XMLHttpRequest

const xhr = new XMLHttpRequest();
xhr.open('GET', 'https://example.com');
xhr.pawe = 'bypass'; // add this to bypass tracking
xhr.send();

TypeScript Support

Include the following in your tsconfig.json to get type hints for the above mentioned pawe property.

{
	"compilerOptions": {
		"types": ["pawe/client"]
	}
}

Data Sources

  • DOM - Track load events from DOM elements that are statically & dynamically added to the page
    • document.readyState until complete
    • <img> load (both eager & lazy)
    • <video> load (when it starts loading until it's ready to play)
    • <audio> load (when it starts loading until it's ready to play)
    • <iframe> load
    • <object> load
    • <embed> load
  • fetch - Track data stream from fetch requests
  • XMLHttpRequest - Track progress events from XMLHttpRequests

License

MIT