0.9.15 • Published 3 years ago

lectorjs v0.9.15

Weekly downloads
192
License
MIT
Repository
github
Last release
3 years ago

The Lector Experience

npm-size npm-size npm-size npm-size

🚀 Demo

Lector produces a reading enviroment, and summons a pointer that will help you read more efficient. It's sole purpose is to transfer a piece of text in the most efficient way possible to your melting brain.

To achieve this, Lector attempts to move the pointer precisely as your eyes would move on the text. This creates a dynamic between the pointer, your eyes and your mind. This dynamic can be expressed as "wiring in". Also known as super fucking focused on the text.

Contribute

First time:

git clone git@github.com:robo-monk/lector.git
cd lector
yarn install
  • Python 3 required (prefferably installed with brew)
  • virtualenv (pip install virtualenv)

Run this to compile the code when you make changes:

Depends on your package manager (my recommendation would be yarn)

source setup yarn
source setup npm

Install

Use npm or yarn:

yarn add pragmajs animejs compromise mousetrap

Using pragmajs:

import { Script } from 'pragmajs'

await Script.load('https://unpkg.com/lectorjs@latest/dist/lector.umd.js')
lectorjs.globalify() //loaded

Development

import { Script } from 'pragmajs'

console.time('📖 [lectorjs] load...')
await Script.load('https://unpkg.com/lectorjs@latest/dist/lector.umd.js', 'lector')
console.timeEnd('📖 [lectorjs] load...')

lectorjs.globalify() //loaded

// ...

Set up

Plug & play

The simplest way you can hookup Lector to your document is like this:

lec = Lector('#article')

// or if you want to await the initialization
;(async () => {
  await Lector('#article', options)
})()

This will trigger a pointer to the element's text, and generate a toolbar to control the pointer's settings.

Plug harder & play harder

You can declare Lector with many settings:

settings = {
  debug: false,
  onboarding: false,
  wfy: true,
  loop: false,
  autostart: false,
  autoscroll: false,

  fullStyles: true,
  defaultStyles: true,

  scaler: true,
  // set scaler: 'font-size' to scale the font instead of the parent element
  // use 'em' units for line-height, in order for it to scale proportionaly to the
  // scaled font

  pragmatizeOnCreate: true,
  experimental: true,

  settings: true,
  stream: fetchContent,
  // function with index as param that
  // returns the content for the page
  // can return a promise

  paginate: {
    from: 'stream',
    as: 'infiniteScroll',

    config: {
      first: 1,
      last: 69,
      headspace: 4,
      timeout: 1,
      onPageAdd,
      onCreate,
      onCreate,
      onPageActive,
      onPageInactive,
      onPageDestroy,
    },
  },
}

lec = Lector('#article', settings)

// default options
const defaultOptions = {
  onboarding: false,
  wfy: true, // false if every word is already wrapped in <w> tags on initializaiton
  settings: false, // display a settings bar controlling the pointer's color, width, speed and more...
  defaultsStyles: true, // inject basic styles
  fullStyles: false, // will decoreate the background of the page, buttons & fonts
  debug: false, // true if you want to see the lector logs #! When false, it hides all the console.log of the page - this will be refactored in new versions
  hintPointer: true, // when the pointer is out of screen, display arrows on top/bottom of the window that hint its position
  autoscroll: true, // sroll the view intelligently
  disableWhenNotInView: false, // offload when not in view
  global: false, // true if you want multiple lectors in the same page
  experimental: false, // if true experimental features are enabled. Unstable.

  // EXPERIMENTAL (set experimental: true to enable these options)
  scaler: false, // if true, scales the view, if set to 'font-size' will scale the font size using em
  stream: false, // this options only makes sense if you have paginated pages
  paginate: false,
  /* 
    paginate: {
      from: 'stream',
      as: 'infiniteScroll',
      config: { ... }
    }
  */
}
0.9.12

3 years ago

0.9.13

3 years ago

0.9.14

3 years ago

0.9.15

3 years ago

0.9.10

3 years ago

0.9.11

3 years ago

0.9.8-d

3 years ago

0.9.8-a

3 years ago

0.9.8-b

3 years ago

0.9.8-c

3 years ago

0.9.0

3 years ago

0.9.2

3 years ago

0.8.0-b

3 years ago

0.9.1

3 years ago

0.8.0-a

3 years ago

0.9.8

3 years ago

0.9.7

3 years ago

0.9.9

3 years ago

0.9.5-d

3 years ago

0.9.4

3 years ago

0.9.5-c

3 years ago

0.9.3

3 years ago

0.9.6

3 years ago

0.9.5-e

3 years ago

0.9.5

3 years ago

0.9.5-b

3 years ago

0.9.5-a

3 years ago

0.8.1

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.7.0

3 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.5.10

3 years ago

0.5.8

3 years ago

0.5.7

3 years ago

0.5.9

3 years ago

0.5.6

3 years ago

0.5.4-a

3 years ago

0.5.4-b

3 years ago

0.5.4

3 years ago

0.5.3

3 years ago

0.5.5

3 years ago

0.5.0-d

3 years ago

0.5.0-a

3 years ago

0.5.0-c

3 years ago

0.5.0-b

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.4.6-b

3 years ago

0.4.6-a

3 years ago

0.4.5

3 years ago

0.4.4

3 years ago

0.4.6

3 years ago

0.4.3

3 years ago

0.4.2-a

3 years ago

0.4.2

3 years ago

0.4.1-b

3 years ago

0.4.1-a

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.3.1-b

3 years ago

0.3.1-a

3 years ago

0.3.1

3 years ago

0.2.3

3 years ago

0.2.2-a

3 years ago

0.2.2

3 years ago

0.2.1-d

3 years ago

0.2.1-c

3 years ago

0.2.1-b

3 years ago

0.2.1

3 years ago

0.1.3

3 years ago

0.1.2-a

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0-b

3 years ago

0.0.5-a

3 years ago