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

cometsight

v1.0.0

Published

A TypeScript scroll-tracking library that detects when elements are in user's focus zone with time-duration tracking

Downloads

100

Readme

License NPM Downloads TypeScript Zero Dependencies

Version 1.0.0 - Official Release 🚀

https://www.npmjs.com/package/cometsight


Table of Contents


About

CometSight is a lightweight TypeScript library that detects when elements are in the user's focus zone (not just visible on screen), with time-duration tracking capabilities. Perfect for manhwa/webtoon readers, smart analytics, and scrollytelling experiences. Most scroll-tracking libraries only check if an element is visible anywhere on screen. CometSight goes further by detecting when elements are in the user's focus zone - the area they're actually looking at.


Features

  • Focus Zone Detection: Semantic thresholds like 'center', 'top', 'bottom' without complex calculations
  • Time-on-Element Tracking: Only trigger callbacks if elements stay in focus for a minimum duration
  • Debounce Support: Wait for scroll to settle before triggering
  • Zero Dependencies: Pure TypeScript with native IntersectionObserver API
  • Chainable API: Fluent, intuitive interface
  • Tab Visibility Aware: Automatically pauses tracking when user switches tabs

Installation

npm install cometsight
# or
yarn add cometsight
# or
pnpm add cometsight
# or
bun add cometsight

Quick Start

Usage Examples

import { watchReadingProgress } from 'cometsight';

// Basic usage
const reader = watchReadingProgress('center', '.manhwa-panel', {
  debounce: 500
});

reader.onSectionEnter((panel) => {
  const panelId = panel.getAttribute('data-id');
  console.log(`Reading panel: ${panelId}`);
});

// Chainable API
watchReadingProgress('center', '.story-paragraph', {
  minTime: 3000
})
  .onSectionEnter((el) => {
    console.log('Entered:', el.id);
  })
  .onSectionLeave((el) => {
    console.log('Left:', el.id);
  });

Interface include

import { watchReadingProgress, CometSightOptions } from 'cometsight';

interface PanelElement extends Element {
  dataset: {
    id: string;
  };
}

const reader = watchReadingProgress('center', '.manhwa-panel', {
  minTime: 1000,
  debounce: 500
} as CometSightOptions);

reader.onSectionEnter((panel: PanelElement) => {
  console.log('Panel ID:', panel.dataset.id);
});

API Reference

Methods

| Method/Function | Description | Parameters | Returns | |----------------|-------------|--------------|----------| | watchReadingProgress(threshold, selector, options?) | Creates a new CometSight instance to watch elements matching the selector | - threshold (string) - Focus zone: 'top', 'center', 'bottom', or custom range (e.g., '0.3-0.6')- selector (string) - CSS selector for elements to watch- options (object, optional):  - minTime (number) - Minimum time in focus zone before triggering (ms)  - debounce (number) - Wait time after scroll settles before triggering (ms)  - root (Element | null) - Root element for intersection checking | CometSight instance | | .onSectionEnter(callback) | Register callback for when an element enters the focus zone | - callback (function) - Function called with element as argument | CometSight instance (chainable) | | .onSectionLeave(callback) | Register callback for when an element leaves the focus zone | - callback (function) - Function called with element as argument | CometSight instance (chainable) | | .destroy() | Cleanup and stop watching elements | None | void |

Focus Zones

| Zone | Description | Range | |-------|-------------|--------| | top | Top 30% of viewport | 0.0-0.3 | | center | Center 30% of viewport (default) | 0.3-0.6 | | bottom | Bottom 40% of viewport | 0.6-1.0 | | 'min-max' | Custom range | Any valid range (e.g., '0.4-0.8') |


Use Cases

1. Manhwa/Webtoon Auto-Bookmark

Track exactly which panel the user is reading:

import { watchReadingProgress } from 'cometsight';

const reader = watchReadingProgress('center', '.manhwa-panel', {
  debounce: 500
});

reader.onSectionEnter((panel) => {
  const panelId = panel.getAttribute('data-id');
  localStorage.setItem('lastPanel', panelId);
});

2. Smart Analytics

Distinguish between skimmers and deep readers:

import { watchReadingProgress } from 'cometsight';

watchReadingProgress('center', '#pricing-plans', {
  minTime: 3000
}).onSectionEnter(() => {
  analytics.track('high_intent_user', { focus: 'pricing_table' });
});

3. Scrollytelling

Trigger animations exactly when eyes hit specific paragraphs:

import { watchReadingProgress } from 'cometsight';

const story = watchReadingProgress('center', '.story-paragraph');

story.onSectionEnter((el) => {
  if (el.id === 'jump-scare-text') {
    audio.play('scream.mp3');
    document.body.style.backgroundColor = 'red';
  }
});

story.onSectionLeave((el) => {
  if (el.id === 'jump-scare-text') {
    document.body.style.backgroundColor = 'white';
  }
});

License

MIT License - Copyright (c) 2026 https://github.com/dotjumpdot


Support


Made with ❤️ by DotJumpDot

⬆ Back to Top