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/vue

v1.0.26

Published

Vue composables for jump-section scroll management

Readme

@jump-section/vue

Vue composables for jump-section scroll management.

Installation

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

Requirements

  • Vue 3.0.0 or higher

Usage

Basic Example

<script setup lang="ts">
import { ScrollSectionProvider } from '@jump-section/vue';
import Navigation from './Navigation.vue';
import Content from './Content.vue';
</script>

<template>
  <ScrollSectionProvider :offset="-80" behavior="smooth">
    <Navigation />
    <Content />
  </ScrollSectionProvider>
</template>

Navigation.vue

<script setup lang="ts">
import { useScrollSection } from '@jump-section/vue';

const { scrollTo, activeId } = useScrollSection();
</script>

<template>
  <nav>
    <button @click="scrollTo('section-1')" :class="{ active: activeId === 'section-1' }">
      Section 1
    </button>
    <button @click="scrollTo('section-2')" :class="{ active: activeId === 'section-2' }">
      Section 2
    </button>
  </nav>
</template>

Content.vue

<script setup lang="ts">
import { useScrollSection } from '@jump-section/vue';

const { registerRef: section1Ref } = useScrollSection('section-1');
const { registerRef: section2Ref } = useScrollSection('section-2');
</script>

<template>
  <main>
    <section :ref="section1Ref"><h2>Section 1</h2></section>
    <section :ref="section2Ref"><h2>Section 2</h2></section>
  </main>
</template>

Scroll Progress

<script setup lang="ts">
import { useScrollProgress } from '@jump-section/vue';

const props = defineProps<{ id: string }>();
const progress = useScrollProgress(props.id);
</script>

<template>
  <div :style="{ width: `${progress * 100}%` }" />
</template>

Composition API (without ScrollSectionProvider)

<script setup lang="ts">
import { provideScrollManager, useScrollSection } from '@jump-section/vue';

// Call in the root component instead of using ScrollSectionProvider
provideScrollManager({ offset: -80, behavior: 'smooth', hash: true });

const { activeId, scrollTo } = useScrollSection();
</script>

API

ScrollSectionProvider

Component that provides scroll management context to descendants.

Props:

| Prop | 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 | | keyboard | boolean | false | Enable Alt+ArrowDown / Alt+ArrowUp keyboard navigation | | root | HTMLElement \| null | null | Custom scroll container (defaults to window) |

useScrollSection(sectionId?: string)

Composable for registering a section and accessing scroll controls.

Returns:

| Property | Type | Description | | --------------- | --------------------------------------- | ----------------------------------------------------------------------------- | | registerRef | (el: Element \| undefined) => void | Ref callback to register the section element | | scrollTo | (id: string) => Promise<void> | Scroll to a specific section | | scrollToNext | () => Promise<void> | Scroll to the next section | | scrollToPrev | () => Promise<void> | Scroll to the previous section | | scrollToFirst | () => Promise<void> | Scroll to the first section | | scrollToLast | () => Promise<void> | Scroll to the last section | | activeId | Readonly<Ref<string \| null>> | Currently active section ID (reactive) | | isActive | ComputedRef<boolean> | Whether this section is active (only meaningful when sectionId is provided) | | direction | Readonly<Ref<'up' \| 'down' \| null>> | Current scroll direction |

useScrollProgress(sectionId: string): Readonly<Ref<number>>

Returns a reactive scroll progress value (0–1) for a specific section.

provideScrollManager(options?: ScrollOptions): ScrollManager

Alternative to ScrollSectionProvider for Composition API usage. Call in a parent component's setup to provide a ScrollManager instance to all descendants.

useScrollManager(): ScrollManager

Returns the underlying ScrollManager instance for advanced use cases.

License

ISC