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

turn-ts-next

v0.1.1

Published

The Next.js App Router client boundary for turn-ts. Import the page-flip book straight from a Server Component.

Readme

turn-ts-next

The Next.js App Router client boundary for turn-ts. Import TurnBook straight into a Server Component; the 'use client' line is this package's job, not yours.

[!IMPORTANT] Not open source. Non-commercial use only. The runtime dependency turn-ts is a derivative of turn.js (3rd release), whose licence permits use "solely for personal benefit and not for any commercial purpose or for monetary gain." That restriction reaches this package through the dependency and cannot be removed here. Read LICENSE.md before installing.

Install

npm i turn-ts-next

next ^16, react ^19 and react-dom ^19 are peer dependencies. turn-ts and turn-ts-react are direct dependencies — you never install them yourself, but you do import turn-ts's stylesheet, and having it as a direct dependency is what guarantees that specifier resolves from your app no matter how your package manager hoists.

Use

Import the stylesheet once, in the root layout:

// app/layout.tsx — a Server Component
import 'turn-ts/turn-ts.css';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>{children}</body>
    </html>
  );
}

Then use the book anywhere, including from a Server Component, with no 'use client' of your own:

// app/notes/page.tsx — a Server Component. No directive needed.
import { TurnBook, TurnPage } from 'turn-ts-next';

export default async function NotesPage() {
  const notes = await getNotes();

  return (
    <TurnBook width={840} height={560} display="double" role="region" aria-label="Field notes">
      {notes.map((note) => (
        <TurnPage key={note.id}>
          <h2>{note.title}</h2>
          <p>{note.body}</p>
        </TurnPage>
      ))}
    </TurnBook>
  );
}

turn-ts/turn-ts.css is not optional and is not bundled here — it carries the rules the fold needs and, just as importantly, leaves out the ones that break it (no overflow, no contain, no perspective on the container).

Anything that needs a handler — page, onPageChange, ref, onKeyDown — has to be passed from a Client Component, because functions do not cross the server/client boundary. That is a React rule, not this package's:

'use client';

import { useRef, useState } from 'react';
import { TurnBook, TurnPage, type TurnBookApi } from 'turn-ts-next';

export function ControlledBook({ children }: { children: React.ReactNode }) {
  const [page, setPage] = useState(1);
  const book = useRef<TurnBookApi>(null);

  return (
    <>
      <TurnBook ref={book} width={840} height={560} page={page} onPageChange={setPage}>
        {children}
      </TurnBook>
      <button onClick={() => book.current?.previous()}>Back</button>
      <button onClick={() => book.current?.next()}>Next</button>
    </>
  );
}

Server-rendered <TurnPage> elements can still be passed into that as children — they are rendered output, not functions.

What this package is

One module, one directive, named re-exports:

'use client';

export { BOOK_CLASS, PAGE_CLASS, PAGE_CONTENT_CLASS, TurnBook, TurnPage, WRAPPER_CLASS } from 'turn-ts-react';
export type { /* the full turn-ts type surface, plus TurnBookProps and TurnPageProps */ } from 'turn-ts-react';

Never export *. A star re-export leaves the bundler with no export names to turn into client references at build time, so the App Router wants a client boundary to say what it exposes. src/index.test.ts fails if one appears in the source, and scripts/check-dist.mjs fails if one appears in the build or if the directive does not survive it.

turn-ts-react already ships its own 'use client' and works in the App Router directly. Depend on this package instead when you want the boundary to be an explicit, checked artifact of your dependency graph rather than a property of someone else's build output.

API

Identical to turn-ts-reactTurnBook, TurnPage, and the class-name constants, re-exported unchanged. See that package's README for props, events, the TurnBookApi on ref, and the styling and accessibility notes.

Develop

npm install
npm run lint    # typecheck + tests + build + "use client" check + publint

turn-ts-react must be built (npm run build in that package) before the tests here can resolve it, since they import through its published exports map. In a monorepo checkout, build it first or link it with npm link.

License

Non-commercial. See LICENSE.md — turn.js 3rd release terms, inherited through turn-ts.