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

@jump-section/core

v1.0.26

Published

Core scroll management library for jump-section

Downloads

161

Readme

@jump-section/core

Framework-agnostic scroll section management library. Tracks active sections via IntersectionObserver and provides programmatic scroll navigation.

Installation

npm install @jump-section/core
# or
pnpm add @jump-section/core
# or
yarn add @jump-section/core

Usage

import { ScrollManager } from '@jump-section/core';

const manager = new ScrollManager({
  offset: -80,
  behavior: 'smooth',
  hash: true,
  keyboard: true,
});

// Register sections
manager.registerSection('section-1', document.getElementById('section-1')!);
manager.registerSection('section-2', document.getElementById('section-2')!);

// Scroll to a section
await manager.scrollTo('section-1');

// Listen to active section changes
const unsubscribe = manager.onActiveChange((activeId, meta) => {
  console.log('Active section:', activeId);
  console.log('Previous:', meta.previous, 'Direction:', meta.direction);
});

// Cleanup
unsubscribe();
manager.destroy();

API

ScrollManager

Constructor

new ScrollManager(options?: ScrollOptions)

Options:

| Option | Type | Default | Description | | ---------- | --------------------- | ---------- | ---------------------------------------------------------- | | offset | number | 0 | Vertical offset in pixels (useful for fixed headers) | | behavior | ScrollBehavior | 'smooth' | Scroll behavior: 'smooth' | 'instant' | 'auto' | | hash | boolean | false | Sync active section with URL hash | | root | HTMLElement \| null | null | Custom scroll container (defaults to window) | | keyboard | boolean | false | Enable Alt+ArrowDown / Alt+ArrowUp keyboard navigation |

Methods

registerSection(id: string, element: HTMLElement): void

Registers a section element to be tracked.

unregisterSection(id: string): void

Unregisters a section from tracking.

scrollTo(id: string): Promise<void>

Scrolls to the specified section. Returns a Promise that resolves when scrolling is complete.

scrollToNext(): Promise<void>

Scrolls to the next section in DOM order.

scrollToPrev(): Promise<void>

Scrolls to the previous section in DOM order.

scrollToFirst(): Promise<void>

Scrolls to the first registered section.

scrollToLast(): Promise<void>

Scrolls to the last registered section.

onActiveChange(callback: (id: string | null, meta: ActiveChangeMeta) => void): () => void

Subscribes to active section changes. Returns an unsubscribe function.

ActiveChangeMeta:

  • previous: string | null — previously active section ID
  • direction: 'up' | 'down' | null — scroll direction at the time of change
onProgressChange(id: string, callback: (progress: number) => void): () => void

Subscribes to scroll progress (0–1) for a specific section. Returns an unsubscribe function.

disableSection(id: string): void

Temporarily excludes a section from active tracking.

enableSection(id: string): void

Re-includes a previously disabled section in active tracking.

getSections(): string[]

Returns registered section IDs sorted by DOM position (top to bottom), excluding disabled sections.

getActiveId(): string | null

Returns the currently active section ID.

destroy(): void

Cleans up all observers, event listeners, and internal state.

License

ISC