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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@boosters/book-reader

v1.3.0

Published

It is library which export only 1 component - Reader. It is used for reading books.

Readme

@boosters/book-reader

It is library which export only 1 component - Reader. It is used for reading books.

Usage

To use this library you should install it:

npm i @boosters/book-reader

Then you can import it:

import { BookReader, Book } from '@boosters/book-reader';

And use it:

<BookReader
  book={book as Book}
  onSwitchPage={({ direction, page }) => {
    console.log(direction, page);
  }}
  onClose={() => {
    console.log('close');
  }}
  initialItemId={22}
/>

Props

| Name | Type | Default value | Description | |--------------------|:----------------------------------------------------------------------------------|:-------------:|--------------------------------------------------------------------------------------------------------------------| | book | Book | - | Book object | | onBookReady | (params: BookReadyParams => void | - | Callback which call when book content is ready | | onSwitchPage | (params: SwitchPageParams => void | - | Callback which call when user switch page | | onClose | (params: CloseParams => void | - | Callback which call when user click close button | | initialItemId | number | - | paragraph id, which must be opened on opening reader | | onSettingsChange | (settings: SettingsChangeParams) => void | - | Callback which call when change reader settings | | initialSettings | Partial<Settings> | - | Initial reader settings | | fullScreen | boolean | true | If true the height of reader would be 100% of viewport | | bookmarks | boolean | false | If true the words with definition has a bookmark button | | onEvent | <T = Record<string, any>>(params: EventParams< T>) => void | - | Callback which call on events which do not affect the logic of the component. Events table | | readerSize | ReaderSize | - | Width and height params for reader | | dyslexicMode | boolean | false | If true the main font switch to Dysfont exclude book content |

Types and interfaces

Events for onEvent callback

| Name | Data | Description | |------------------------------|:------------------------------:|--------------------------------------------------------------------------------------------| | look_up_shown | Definition | Event which is dispatched when the look-up popover is opened | | look_up_play_audio_clicked | Definition | Event which is dispatched when the user clicked the listen button on the look-up popover | | look_up_bookmark_clicked | Definition | Event which is dispatched when the user clicked the bookmark button on the look-up popover | | settings_button_clicked | - | Event which is dispatched when the user clicked the settings button |

Book

type Book = {
  id: string
  title: string
  author: string
  chapters: Chapter[]
}

Chapter

type Chapter = {
  id: number
  uniq_id: number
  title: string
  subtitle: string
  paragraphs: Paragraph[]
}

Paragraph

type Paragraph = {
  id: number
  uniq_id: number
  type: 'text' | 'quote' | 'dialog'
  sentences: Sentence[]
}

Sentence

type Sentence = {
  id: number
  uniq_id: number
  elements: SentenceElement[]
}

SentenceElement

type SentenceElement = {
  id: number
  uniq_id: number
  text: string
  definition?: Definition
}

Definition

type Definition = {
  title: string
  description: string
  mp3?: string
}

BookReadyParams

type BookReadyParams = {
  pagesCount: number // total pages count (1 page - 1 column)
  actualPagesCount: number // pages count (1 page - 1 screen)
  switchToNextPage: () => void
  switchToPrevPage: () => void
}

SwitchPageParams

type SwitchPageParams = {
  page: number
  direction: 'next' | 'prev'
  activeItemId: number
  progress: number
}

CloseParams

type CloseParams = {
  activeItemId: number
  progress: number
}

SettingsChangeParams

type SettingsChangeParams = {
  settings: Settings
  prevSettings: Settings
  changedParam: keyof Settings // 'theme' | 'fontFamily' | 'fontParams'
}

Link to Settings

Settings

type Settings = {
  theme: 'light' | 'dark'
  fontFamily: 'Andada' | 'Dysfont' | 'Manrope' | 'Lora' | 'Raleway'
  fontSize: number
}

EventParams

type EventParams<T = Record<string, any>> = { event: EventNames; data?: T }

Link to EventNames

ReaderSize

type ReaderSize = {
  width: number
  height: number
}