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

pageforge-flip

v1.1.0

Published

A lightweight, modern flipping book component with touch, mouse, and keyboard support.

Readme

pageforge-flip

A lightweight, zero-dependency flipping book component for modern browsers. pageforge-flip mirrors the ergonomics of the popular page-flip package while embracing ES modules, smooth requestAnimationFrame animations, and comprehensive input support (mouse, touch, and keyboard).

Features

  • Smooth GPU-accelerated page turning with configurable duration and page shadows
  • True two-page spreads with hinge-based flips triggered from either side
  • Works with HTML templates or image URLs
  • Supports mobile swipes, mouse dragging, and arrow-key navigation
  • Orientation-aware spreads (portrait or landscape two-up mode)
  • Small API surface with lifecycle events
  • Ships with ESM, CJS, and TypeScript definitions

Installation

npm install pageforge-flip
# or
pnpm add pageforge-flip
# or
yarn add pageforge-flip

Quick Start

<div id="book">
  <section class="page">Cover</section>
  <section class="page">Page 1</section>
  <section class="page">Page 2</section>
</div>
import PageFlip from 'pageforge-flip';

const book = document.querySelector('#book');
const flip = new PageFlip(book, {
  animationDuration: 700,
  shadowOpacity: 0.2
});

flip.loadFromHtml(book.querySelectorAll('.page'));
flip.on('change', ({ currentPage }) => console.log('Now on page', currentPage));

Click/tap the right half to advance or the left half to go backward. Each page flips around the center hinge, giving a clear open-book effect.

Loading from Images

flip.loadFromImages([
  '/images/page-1.jpg',
  '/images/page-2.jpg',
  '/images/page-3.jpg'
]);

API

Constructor

new PageFlip(parent: HTMLElement, options?: PageFlipOptions)

| Option | Type | Default | Description | | --- | --- | --- | --- | | width | number | 600 | Base width used when auto sizing fails | | height | number | 800 | Base height used when auto sizing fails | | animationDuration | number | 600 | Flip time in ms | | shadowOpacity | number | 0.15 | Max drop shadow intensity | | useShadow | boolean | true | Toggle page shadow rendering | | swipeThreshold | number | 30 | Minimum horizontal drag (px) to trigger a flip | | autoSize | boolean | true | Resize to fit parent container | | orientation | 'auto'\|'portrait'\|'landscape' | 'auto' | Force orientation or auto-detect |

Methods

  • flipNext(): Promise<number> – Flip forward one spread
  • flipPrev(): Promise<number> – Flip backward
  • flipTo(page: number): Promise<number> – Jump to a given page index
  • loadFromHtml(elements: HTMLElement[] | NodeList) – Hydrate from HTML nodes
  • loadFromImages(images: string[]) – Hydrate from image URLs
  • getCurrentPage(): number
  • getTotalPages(): number
  • destroy(): void

Events

| Event | Payload | | --- | --- | | init | { currentPage, totalPages, orientation } | | flipStart | { currentPage, targetPage, direction } | | flipEnd | { currentPage, previousPage, direction } | | change | { currentPage, totalPages, orientation } |

Use flip.on(event, callback) / flip.off(event, callback) to manage listeners.

Building & Testing

npm run build   # rollup builds dist/*.js
npm test        # runs the Jest suite (jsdom)

License

MIT