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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@uiwwsw/infinite-paper

v0.1.0

Published

Composable infinite scroll + pagination data window manager with virtualized lists.

Downloads

97

Readme

Infinite Paper 📜

npm version License: MIT CI

Infinite Paper is a powerful, headless React hook that seamlessly bridges the gap between infinite scrolling and numbered pagination. It allows you to maintain a sliding window of contiguous pages in memory, ensuring high performance even with massive datasets.

Note: This library is headless. You provide the UI (buttons, scroll container), and useInfinitePaper handles the logic.


🌏 Language / 언어


English

Features

  • 🧠 Smart Memory Management: Keeps only a configurable "window" of pages in memory. No more crashing the browser with 10,000 DOM nodes.
  • 🔄 Bi-directional Sync: Scrolling updates the pagination; clicking pagination updates the scroll position.
  • 🚀 Performance Optimized: Batched state updates and efficient re-rendering strategies.
  • 🧩 Headless & Flexible: Works with react-window, react-virtual, or standard CSS overflow scrolling.
  • 🛒 Amazon-style Pagination: Includes logic for "1 ... 4 5 6 ... 100" style pagination controls.

Installation

npm install @uiwwsw/infinitePaper
# or
yarn add @uiwwsw/infinitePaper
# or
pnpm add @uiwwsw/infinitePaper

Usage

import useInfinitePaper, { Pagination } from "@uiwwsw/infinitePaper";

function App() {
  const { 
    items, 
    paginationItems, 
    handleVisibleRange, 
    setPage,
    infiniteScrollOptions 
  } = useInfinitePaper({
    pageSize: 20,
    totalPages: 100,
    fetchPage: async (page) => {
      const res = await fetch(`/api/items?page=${page}`);
      return res.json();
    }
  });

  return (
    <div>
      {/* Your Virtual List or Scroll Container */}
      <div onScroll={(e) => {
         // Calculate visible range and call handleVisibleRange
      }}>
        {items.map(item => <div key={item.globalIndex}>{item.item}</div>)}
      </div>

      {/* Pagination Controls */}
      <Pagination 
        items={paginationItems} 
        onPageChange={setPage} 
      />
    </div>
  );
}

한국어 (Korean)

주요 기능

  • 🧠 스마트 메모리 관리: 설정된 "윈도우" 크기만큼의 페이지만 메모리에 유지합니다. 대용량 데이터도 브라우저 부하 없이 처리할 수 있습니다.
  • 🔄 양방향 동기화: 스크롤하면 페이지네이션이 업데이트되고, 페이지네이션을 클릭하면 스크롤 위치가 이동합니다.
  • 🚀 성능 최적화: 상태 업데이트 배치 처리 및 효율적인 리렌더링 전략이 적용되었습니다.
  • 🧩 헤드리스 & 유연성: react-window, react-virtual 또는 일반 CSS 스크롤과 완벽하게 호환됩니다.
  • 🛒 아마존 스타일 페이지네이션: "1 ... 4 5 6 ... 100" 형태의 페이지네이션 로직을 내장하고 있습니다.

설치 방법

npm install @uiwwsw/infinitePaper
# 또는
yarn add @uiwwsw/infinitePaper
# 또는
pnpm add @uiwwsw/infinitePaper

사용 예시

import useInfinitePaper, { Pagination } from "@uiwwsw/infinitePaper";

function App() {
  const { 
    items, 
    paginationItems, 
    handleVisibleRange, 
    setPage,
    infiniteScrollOptions 
  } = useInfinitePaper({
    pageSize: 20,
    totalPages: 100,
    fetchPage: async (page) => {
      const res = await fetch(`/api/items?page=${page}`);
      return res.json();
    }
  });

  return (
    <div>
      {/* 가상 리스트 또는 스크롤 컨테이너 */}
      <div onScroll={(e) => {
         // 보이는 범위를 계산하여 handleVisibleRange 호출
      }}>
        {items.map(item => <div key={item.globalIndex}>{item.item}</div>)}
      </div>

      {/* 페이지네이션 컨트롤 */}
      <Pagination 
        items={paginationItems} 
        onPageChange={setPage} 
      />
    </div>
  );
}

License

MIT © uiwwsw