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 🙏

© 2024 – Pkg Stats / Ryan Hefner

mangatsu-reader

v0.1.0

Published

> Early experimental version! Used in [Mangatsu](https://github.com/Mangatsu/web).

Downloads

11

Readme

mangatsu-reader

Early experimental version! Used in Mangatsu.

A manga and comic and image web reader / viewer package written in TS and React.

Usage

Example

import { MangaReader, ReaderMode } from "mangatsu-reader"

const CustomSVG = () => {
  return (
    <svg xmlns="http://www.w3.org/2000/svg" width={64} height={64} fill="#fff">
    <!-- SVG content -->
    </svg>
  )
}

const pages = {
  {
    url: "http://localhost/page1.webp",
    number: 1,
    doublePage: false
  },
  {
    url: "http://localhost/page2.webp",
    number: 2,
    doublePage: false
  },
  {
    url: "http://localhost/page3.webp",
    number: 3,
    doublePage: true
  }
}

const App = () => {
  return (
    <MangatsuReader
      mode={ReaderMode.LeftToRight}
      controlDirection="ltr"
      doublePage={true}
      initialPage={0}
      pages={pages}
      style={{ height: "50vh" }}
      className="custom-class"
      loadingIcon={<CustomSVG />}
    />
  )
}
  • @param mode the reading mode of the reader
  • @param controlDirection the control direction of the reader
  • @param doublePage whether to show two pages at once
  • @param initialPage the initial page to start the reader (0-indexed)
  • @param pages the pages of the manga/comic
  • @param style custom styles for the reader
  • @param className custom class name for the reader
  • @param customImg custom image component to render the page

Props

  • mode: ReaderMode
    • default: ReaderMode.LeftToRight
    • ReaderMode.LeftToRight: Left to Right page turning
    • ReaderMode.RightToLeft: Right to Left page turning
    • TODO ReaderMode.TopToBottomContinuous: Top to Bottom page turning with continuous scrolling
  • controlDirection: "ltr" | "rtl" (default: "ltr")
    • defaults to the same as mode (ReaderMode.LeftToRight: "ltr", ReaderMode.RightToLeft: "rtl", otherwise "ltr")
    • ltr: Swipe left or press right arrow key to go to the next page, swipe right or press left arrow key to go to the previous page
    • rtl: Swipe right or press right arrow key to go to the next page, swipe left or press left arrow key to go to the previous page
  • doublePage: boolean (true | false)
    • ※ no effect if mode is ReaderMode.TopToBottomContinuous
    • default: false
    • true: Show two pages at once
    • false: Show one page at once
  • initialPage: number
    • default: 0
    • The initial page to show (0-indexed)
  • pages: Page[]
    • required
    • The pages to show
    • Page:
      interface Page {
        url: string // the image url of the page
        doublePage: boolean // true if this page is a double page
      }
  • style: React.CSSProperties | undefined
    • custom styles for the reader
  • className: string | undefined
    • custom class name for the reader
  • customImg: (props: unknown) => React.JSX.Element | undefined
    • custom image component to render the page
  • loadingIcon: React.JSX.Element | undefined
    • custom loading icon to show while loading the image

Dependencies

  • Included
    • (react-swipeable)[https://www.npmjs.com/package/react-swipeable]
  • Required
    • React (>= 18.0.0)