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

superhaptic

v0.1.0

Published

A lightweight library for haptic feedback on the web, bringing mobile-like tactile experiences to browsers

Readme

🎯 Superhaptic

A lightweight, zero-dependency library for haptic feedback on the web. Bring mobile-like tactile experiences to your web applications!

Features

  • 🎮 Simple API - Easy to use, intuitive methods
  • 📱 Mobile-like haptics - Pre-defined patterns mimicking iOS and Android
  • 🔊 Audio Feedback - Sound feedback when vibration isn't supported
  • 🎨 Custom patterns - Create your own vibration patterns
  • 🪶 Lightweight - Zero dependencies, tiny bundle size
  • 🔧 TypeScript support - Full type definitions included
  • 🌐 Universal - Works with npm, pnpm, yarn, and bun

Installation

# npm
npm install superhaptic

# pnpm
pnpm add superhaptic

# yarn
yarn add superhaptic

# bun
bun add superhaptic

Quick Start

import superhaptic from 'superhaptic';

// Use preset patterns (with automatic audio fallback)
superhaptic.preset('light');    // Light tap (vibrates OR plays sound)
superhaptic.preset('success');  // Success feedback
superhaptic.preset('error');    // Error feedback

// Custom vibration pattern
superhaptic.vibrate(50);        // Single vibration for 50ms
superhaptic.vibrate([10, 50, 10]); // Pattern: vibrate, pause, vibrate

// Control
superhaptic.stop();             // Stop vibration
superhaptic.disable();          // Disable all feedback
superhaptic.enable();           // Re-enable feedback

🔊 Audio Fallback

Superhaptic automatically uses audio feedback when vibration isn't supported! Users on desktop or browsers without vibration support get tactile-like click sounds instead. It just works!

API Reference

Preset Patterns

import { preset, HapticPresets } from 'superhaptic';

preset('light');        // 10ms - Subtle feedback
preset('medium');       // 20ms - Standard feedback
preset('heavy');        // 40ms - Strong feedback
preset('success');      // Two short taps
preset('warning');      // Medium then light
preset('error');        // Three short taps
preset('selection');    // 5ms - Very light
preset('doubleTap');    // Double tap pattern
preset('tripleTap');    // Triple tap pattern
preset('notification'); // Escalating pattern
preset('longPress');    // 50ms sustained

Custom Patterns

import { vibrate } from 'superhaptic';

// Single vibration (in milliseconds)
vibrate(100);

// Pattern: [vibrate, pause, vibrate, pause, ...]
vibrate([50, 100, 50, 100, 50]);

Instance Methods

import { Superhaptic } from 'superhaptic';

const haptic = new Superhaptic({
  enabled: true,
  audioFallback: true     // Enable audio when vibration unavailable
});

haptic.vibrate(pattern);       // Trigger vibration/audio
haptic.preset('success');      // Use preset
haptic.stop();                 // Stop vibration
haptic.enable();               // Enable feedback
haptic.disable();              // Disable feedback
haptic.toggle();               // Toggle on/off
haptic.isSupported();          // Check browser vibration support
haptic.isEnabled();            // Check if enabled

Functional API

import {
  vibrate,
  preset,
  stop,
  enable,
  disable,
  toggle,
  isSupported,
  isEnabled
} from 'superhaptic';

Usage Examples

Button Feedback

import { preset } from 'superhaptic';

button.addEventListener('click', () => {
  preset('light');
  // Your click handler
});

Form Validation

import { preset } from 'superhaptic';

if (isValid) {
  preset('success');
  submitForm();
} else {
  preset('error');
  showErrors();
}

Toggle Switch

import { vibrate } from 'superhaptic';

toggle.addEventListener('change', (e) => {
  vibrate(e.target.checked ? 20 : 10);
});

User Preferences

import superhaptic from 'superhaptic';

// Let users control haptics
const hapticsEnabled = localStorage.getItem('haptics') === 'true';
if (!hapticsEnabled) {
  superhaptic.disable();
}

// Settings toggle
settingsToggle.addEventListener('change', (e) => {
  superhaptic.toggle();
  localStorage.setItem('haptics', superhaptic.isEnabled().toString());
});

Browser Support

The Vibration API is supported in:

  • Chrome/Edge 32+
  • Firefox 16+
  • Safari 13+ (iOS Safari requires user interaction)
  • Opera 19+
  • Android Browser 4.4+

On unsupported browsers, the library fails silently by default.

TypeScript

Full TypeScript support included:

import type { HapticPattern, HapticOptions, HapticPresetName } from 'superhaptic';

License

MIT

Contributing

Contributions welcome! Please open an issue or PR.

Author

Created with ❤️ for better web experiences