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

flipbook-tool

v1.0.0

Published

A highly configurable React component for creating page-flip books. Designed for AI agents with JSON-based configuration.

Downloads

9

Readme

Flipbook Tool

A highly configurable React component for creating beautiful page-flip books. Designed for AI agents with JSON-based configuration, supporting full customization of colors, fonts, layouts, images, videos, and more.

Built upon react-pageflip: This package extends the excellent react-pageflip library by Oleg Litovski, adding a JSON-first configuration API, named color/gradient presets, media support, and extensive customization options optimized for AI agents.

Features

  • 📚 JSON-based Configuration - Perfect for AI agents
  • 🎨 Full Customization - Colors, fonts, sizes, layouts, gradients
  • 🖼️ Media Support - Images and YouTube videos with size control
  • 📱 Responsive - Works on all screen sizes
  • 🎯 Type-Safe - Full TypeScript support
  • Easy to Use - Simple API, powerful features

Installation

npm install flipbook-tool

Quick Start

import { Book } from 'flipbook-tool';

const config = {
  size: { width: 400, height: 550 },
  pages: [
    {
      type: "cover",
      title: "My Book",
      style: {
        background: { color: { type: "gradient", colors: ["#667eea", "#764ba2"] } },
        color: "#ffffff"
      }
    },
    {
      type: "content",
      content: "Hello, world!",
      style: {
        background: { color: "blue" },
        typography: { fontSize: "1.2rem" }
      }
    }
  ]
};

function App() {
  return <Book config={config} />;
}

Configuration

Book Configuration

interface BookConfig {
  title?: string;
  size: BookSize;
  pages: PageConfig[];
  settings?: BookSettings;
  controls?: ControlsConfig;
  globalStyle?: GlobalStyle;
}

Page Types

  • cover - Cover page (thick by default)
  • chapter - Chapter divider (thick by default)
  • content - Regular content page
  • custom - Fully customizable page

Styling Options

Colors

  • Named colors: "blue", "purple", "green", etc.
  • Hex colors: "#e3f2fd"
  • RGB colors: "rgb(227, 242, 253)"
  • Gradients: { type: "gradient", colors: ["#667eea", "#764ba2"] }
  • Named gradients: "purple", "ocean", "sunset", etc.

Typography

  • fontSize: number or string
  • fontFamily: string
  • fontWeight: number or string
  • lineHeight: number or string
  • textAlign: "left" | "center" | "right" | "justify"
  • textTransform: "none" | "uppercase" | "lowercase" | "capitalize"

Layout

  • display: "flex" | "block" | "grid"
  • flexDirection: "row" | "column"
  • justifyContent: "flex-start" | "center" | "space-between", etc.
  • alignItems: "flex-start" | "center" | "stretch", etc.
  • gap: number

Media Support

Images

{
  type: "content",
  image: {
    url: "https://example.com/image.jpg",
    width: 300,
    height: 200,
    borderRadius: 8,
    objectFit: "cover"
  }
}

Videos

{
  type: "content",
  video: {
    url: "https://www.youtube.com/watch?v=VIDEO_ID",
    width: 280,
    height: 160,
    borderRadius: 8
  }
}

Examples

Full Example

import { Book } from 'flipbook-tool';

const bookConfig = {
  size: { width: 400, height: 550, size: "stretch" },
  pages: [
    {
      type: "cover",
      title: "My Book",
      style: {
        background: { color: "purple" },
        color: "#ffffff",
        typography: { fontSize: "2.5rem", fontWeight: 700 }
      }
    },
    {
      type: "chapter",
      title: "Chapter 1",
      density: "hard",
      style: {
        background: { color: "blue" },
        color: "#0d47a1",
        typography: { fontSize: "1.5rem" }
      }
    },
    {
      type: "content",
      content: [
        {
          type: "heading",
          level: 3,
          content: "Introduction",
          style: { typography: { fontSize: "1.3rem", color: "#667eea" } }
        },
        {
          type: "text",
          content: "This is the content of the page..."
        },
        {
          type: "image",
          image: {
            url: "https://picsum.photos/300/200",
            width: 300,
            height: 200
          }
        },
        {
          type: "video",
          video: {
            url: "https://www.youtube.com/watch?v=VIDEO_ID",
            width: 280,
            height: 160
          }
        }
      ],
      style: {
        background: { color: "cream" },
        typography: { fontSize: "1rem", lineHeight: 1.6 }
      }
    }
  ]
};

<Book config={bookConfig} />

API Reference

See the full documentation for complete API reference.

Acknowledgments

This package is built upon the excellent react-pageflip library by Oleg Litovski. The core page-flipping engine and animations are powered by react-pageflip.

What we added:

  • JSON-first configuration API optimized for AI agents
  • 40+ named colors and 10+ named gradient presets
  • Image and YouTube video embedding with sizing controls
  • Comprehensive TypeScript type definitions
  • Content element system (headings, text, images, videos, dividers, spacers)
  • Complete customization of typography, spacing, borders, and layouts
  • Extensive documentation and examples for AI agent integration

Thank you to Oleg Litovski for creating the foundation that made this project possible!

License

MIT