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

choreograph.js

v0.1.0

Published

A JavaScript library for choreography

Readme

Choreograph.js

Choreograph.js is a modern, lightweight library for creating interactive user onboarding tours, product walkthroughs, and automated session replays. It features smart positioning, visual connectors, focus trapping, and a robust session recorder/replayer system.

Features

  • 🎯 Smart Spotlight: Highlights elements with a customizable overlay.
  • 💬 Adaptive Annotations: Tooltips automatically position themselves to stay in view.
  • 🔗 Visual Connectors: Elegant Bézier curves connect annotations to their targets.
  • 🔒 Focus Trap: Keeps keyboard navigation within the active step for accessibility.
  • 🎥 Session Recording: Record user interactions (clicks, mouse movements) during a tour.
  • ⏯️ Session Replay: Replay recorded sessions with a simulated "Ghost Cursor" that adapts to layout changes.
  • 🧩 Robust Triggers: Waits for elements to appear and handles dynamic content gracefully.

Installation

via NPM

npm install choreograph.js

via CDN / Script Tag

Include the UMD build in your HTML:

<script src="dist/choreograph.min.js"></script>

Quick Start

  1. Initialize the Library
import Choreograph from 'choreograph.js'; // ESM
// or const Choreograph = window.Choreograph; // UMD

const choreo = new Choreograph();
  1. Define Your Scenes

A "scene" represents a step in your tour.

const scenes = [
    {
        id: 'step-1',
        selector: '#header-logo',
        annotation: {
            text: 'Welcome! This is our logo.',
            position: 'bottom'
        },
        trigger: {
            type: 'click',
            targetSelector: '#next-button'
        }
    },
    {
        id: 'step-2',
        selector: '.feature-box',
        annotation: {
            text: 'Here is a cool feature.',
            position: 'right'
        },
        trigger: {
            type: 'click',
            targetSelector: '.finish-btn'
        },
        allowInteraction: true // Allow user to click the highlighted element
    }
];
  1. Play the Tour
choreo.play(scenes).then(() => {
    console.log('Tour completed!');
});

API Reference

new Choreograph()

Creates a new instance. Automatically initializes the overlay and canvas.

play(scenes)

Starts the tour sequence.

  • scenes: Array of Scene objects.
  • Returns: A Promise that resolves when the tour finishes.

destroy()

Completely cleans up the instance. Removes the overlay, canvas, event listeners, and stops any active recording or replay.

recorder

Access the built-in session recorder.

  • recorder.start(): Start recording user actions.
  • recorder.stop(): Stop recording.
  • recorder.getEvents(): Get the array of recorded events.

replayer

Access the session replayer.

  • replayer.play(events, scenes): Replay a recorded session.
    • events: Array of events from recorder.getEvents().
    • scenes: (Optional) The scenes array used during recording, for context-aware positioning.

Scene Configuration

| Property | Type | Description | |----------|------|-------------| | id | string | Unique identifier for the scene. | | selector | string | CSS selector of the element to highlight. | | annotation | object | Configuration for the tooltip. | | annotation.text | string | Text content of the tooltip. | | annotation.position | string | Preferred position (top, bottom, left, right). | | trigger | object | Event that advances to the next scene. | | trigger.type | string | Event type (e.g., click). | | trigger.targetSelector | string | Selector of the element to wait for the event on. | | allowInteraction | boolean | If true, allows clicks to pass through to the highlighted element. |

Advanced Usage

Session Recording & Replay

Choreograph.js can record the user's journey through the tour and replay it later. This is useful for automated testing or demonstrating flows.

// 1. Start Recording (happens automatically during play(), or manually)
choreo.recorder.start();

// ... user interacts ...

// 2. Stop & Get Events
choreo.recorder.stop();
const events = choreo.recorder.getEvents();

// 3. Replay
// The Ghost Cursor will simulate the user's mouse movements and clicks.
choreo.replayer.play(events, scenes);

Ghost Cursor

You can use the GhostCursor class independently for custom demos.

const cursor = new choreo.GhostCursor();
cursor.moveTo(100, 100);
setTimeout(() => cursor.click(), 1000);

Development

  1. Clone the repository
  2. Install dependencies: npm install
  3. Build the library: npm run build (Outputs to dist/)
  4. Run the demo: Open demo/index.html in your browser.

License

MIT