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 🙏

© 2026 – Pkg Stats / Ryan Hefner

web-duo

v0.1.0

Published

Whole-page hinge glass effects and optional MacBook WebHID input

Readme

web-duo

WebGL glass effects driven by an opening angle: perspective, distance-based frost, and reflection. Framework-independent ESM with TypeScript types.

Install

npm install web-duo

Image or canvas

import { createDuo } from 'web-duo';

const image = new Image();
image.src = '/scene.png';
await image.decode();

const effect = createDuo({
  canvas: document.querySelector('#output'),
  source: image,
  openAngle: 120,
});

effect.setAngle(90);
// effect.updateSource(sourceCanvas); // Refresh changed source pixels.
// effect.calibrate(125);             // Set the fully open angle.
// effect.destroy();                  // Clean up on unmount.

Sources: decoded images, HTMLCanvasElement, OffscreenCanvas, or ImageBitmap. Requires WebGL 2 and same-origin or CORS-enabled images. Output pixel dimensions follow the source; preserve its aspect ratio in CSS. Modules can be imported during SSR, but create instances in the browser.

Experimental DOM adapter

import { createDuoPage } from 'web-duo/dom';

const effect = createDuoPage({
  source: document.querySelector('#content'),
  canvas: document.querySelector('#output'),
  openAngle: 120,
  onError: console.error,
});

effect.start();
effect.setAngle(75);
// effect.refresh(); effect.scrollBy(200);
// effect.stop(); effect.start(); effect.destroy();

Renders a viewport-sized snapshot of self-contained HTML/CSS. Keep the output canvas and interactive controls outside the source element. Rendered content is not interactive DOM.

Video, canvas pixels, iframes, Shadow DOM, external assets, and complex forms or CSS animations may not be reproduced. For inaccessible stylesheets, supply self-contained cssText. Optional settings: background, maxPixelRatio (default 2), and captureIntervalMs (default 100).

Optional MacBook input

import { createMacBookSensor } from 'web-duo/sensor';

const sensor = createMacBookSensor({
  onSample: sample => effect.setAngle(sample.angle),
  onError: console.error,
});

button.disabled = !sensor.supported;
button.onclick = async () => {
  try { await sensor.connect(); } catch (error) { console.error(error); }
};
// await sensor.disconnect();
// On unmount: await sensor.destroy(); effect.destroy();

Requires a compatible MacBook, WebHID, HTTPS or localhost, and a user gesture for authorization. Only the validated Apple 05AC:8104 protocol is decoded. No device configuration is written. Input reports on tested devices arrive at about 1 Hz; this library does not remove that limitation. Manual angle input works without a sensor.

Optional callbacks include onPacket, onDevice, onState, onPath, onNotice, and onDisconnect. Connection errors reject connect(); read errors invoke onError. Callbacks should not throw. On WebGL context loss, destroy and recreate the effect.

License and references

UNLICENSED. See NOTICE.md for implementation references.