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

vue-leafbook

v0.1.0

Published

An SSR-safe Vue 3 PDF and SVG flipbook with lazy rendering and automatic PDF.js workers.

Readme

vue-leafbook

A reusable Vue 3 PDF and SVG flipbook. Supply a PDF URL/File or a directory of pre-generated SVG pages.

Vue 3向けのパンフレットビューアーです。PDFまたは事前に用意したSVGのフォルダーを指定して、ページめくり・見開き・スマートフォンでの単ページ表示を利用できます。

Development preview / 開発版: The package name is vue-leafbook. It has not been published to npm. Build and install a local tarball using the steps below.

初めて導入する場合は、先にビルド済みパッケージのインストールを行ってください。まだ pnpm add vue-leafbook でnpmから取得する段階ではありません。

Quick start / 使い方

<script setup lang="ts">
import { FlipbookViewer } from 'vue-leafbook'
import 'vue-leafbook/style.css'
</script>

<template>
  <FlipbookViewer src="/pamphlet.pdf" />
</template>

上の例では、導入先アプリの public/pamphlet.pdf にPDFを置きます。src はパソコン内の絶対パスではなく、ブラウザーからアクセスするURLです。

No PDF-to-image conversion, CDN, manual worker configuration, backend, Tailwind, or Nuxt dependency is required. CSS is an explicit import for predictable SSR and bundler behavior. Public page numbers start at 1. Set locale="en" for English controls, messages and accessible labels (default: Japanese). Language changes preserve the open document and current page.

For pre-generated SVG pages, register the public folder once with the Vite plugin or Nuxt module, then use <FlipbookViewer svg-dir="/pamphlet/" />. Page order is generated automatically from filenames; SVG-only viewers do not load PDF.js or a PDF worker. See SVGフォルダーの設定と使い方.

Develop / ローカルで試す

Use Node.js 24 LTS (24.15+), or 22.22.3+, and pnpm 11.13.0.

corepack enable
pnpm install
pnpm dev
# Vue playground: http://127.0.0.1:5173/demo/
pnpm dev:nuxt
# Nuxt playground: http://127.0.0.1:3000/nuxt-demo/

Original, redistributable PDF and SVG fixtures are included. Regenerate them with pnpm fixtures. The playground's 「SVGフォルダー」 button selects the SVG sample; ?format=svg opens it directly.

The Vue playground also serves as the introduction site. Development-only controls are available with ?testing=true. See 紹介サイトの編集・GitHub Pages公開.

Install the built package / ビルド済みパッケージを使う

pnpm build
pnpm --filter vue-leafbook pack --pack-destination ../../.artifacts
# In your own Vue or Nuxt project:
pnpm add /absolute/path/to/vue-leafbook-0.1.0.tgz

If you used the earlier development tarball, remove @your-org/vue-flipbook from your app and update all imports, CSS paths and Vite/Nuxt integration paths to vue-leafbook. The FlipbookViewer component and its API are unchanged. Previously generated SVG indexes are updated automatically on the next dev/build run. See release instructions before an authorized npm release.

Nuxt 4

// nuxt.config.ts
export default defineNuxtConfig({
  css: ['vue-leafbook/style.css'],
})
<!-- app/app.vue -->
<script setup lang="ts">
import { FlipbookViewer } from 'vue-leafbook'
</script>
<template>
  <FlipbookViewer src="/pamphlet.pdf" />
</template>

The component renders a loading placeholder on the server and creates its PDF worker after mount. <ClientOnly> is optional. For a deployment under a subpath, include your app base path in src.

Features / 機能

  • URL and local File inputs; loading, error, retry, and source replacement.
  • SVG directory input with numeric filename ordering, automatically generated static index, and development file watching for Vite/Nuxt.
  • Animated dragging, touch swipes, previous/next, page jump, optional single cover.
  • Container-based responsive single-page and spread modes.
  • Scoped keyboard navigation, labeled controls, fullscreen when supported.
  • Six-page canvas window, two-million-pixel canvas limit, cancellable sequential rendering.
  • Typed props, events, exposed methods; replaceable flip-engine adapter.
  • Automatic embedded worker and on-demand PDF font/CMap/WASM assets.
  • Vue and Nuxt playgrounds; unit tests and browser tests against installed tarballs.

Documentation

Checks

pnpm build
pnpm typecheck
pnpm lint
pnpm format:check
pnpm test
pnpm test:tooling
pnpm test:licenses
pnpm exec playwright install chromium firefox webkit
pnpm test:package

test:package builds and packs the actual npm artifact, installs it in independent Vue and Nuxt apps, builds both for production at non-root base paths, and runs Playwright against them. It does not publish anything.

Scope and browser requirements

Current evergreen desktop/mobile browsers with module Workers, Canvas, ResizeObserver and the modern PDF.js APIs (including Promise.withResolvers). Fullscreen depends on browser support and user activation. Remote PDF servers must permit CORS. Strict CSP must allow worker-src 'self' blob:; PDF codecs may require script-src 'wasm-unsafe-eval'. See the architecture document for details.

This is a visual Canvas/image viewer, not a complete accessible document reader: text selection, search, annotations, password entry and screen-reader document text are not implemented. Provide the original document link or an HTML alternative alongside the viewer when needed. SVG uses image loading and AbortSignal.any; its host must permit the index under connect-src and page images under img-src. SVG-only use does not require PDF worker or WASM CSP permissions.

License

Original project code: MIT © 2026 MTowa. Bundled third-party code, fonts and data retain their own licenses; the root MIT declaration does not relicense them. PDF.js is Apache-2.0, StPageFlip and QuickJS are MIT, and support assets also include BSD and SIL OFL terms.

The package includes THIRD_PARTY_NOTICES.md and the upstream texts and reviewed inventory in dist/licenses/. The source repository tracks these texts in third-party/licenses/, including the attribution for the StPageFlip patch. Builds check the inventory, and package tests verify the exact license bytes after installing the real tarball. See the license review for provenance and maintenance.

When deploying an application that bundles this library, carry the applicable notices and license texts into the application distribution, together with notices for Vue and other application dependencies. All sample artwork is original and MIT licensed; user-supplied PDFs, SVGs and their contents keep their own rights.