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

quickpopup

v1.0.1

Published

Fast & light modal popup creator providing rich configuration and styling

Downloads

3

Readme

QuickPopup

Build Status Coverage Code Climate NPM Sauce Test Status

Note: this library is still under development stage and is being processed through heavy real-world battle testing. Full documentation will be released once this module is ready for alpha release.

Usage

npm install --save quickpopup
var QuickPopup = require('quickpopup');
var popup = QuickPopup(...)

API

QuickPopup([settings])

Generates and returns a new Popup instance for the provided settings.

settings can be one of:

  • left blank
  • html text (will be inserted into the popup via .innerHTML)
  • DOM element
  • QuickDOM element
  • settings object

view default settings below

QuickPopup.version

The version of this release.

QuickPopup.hasOpen

Boolean indicator of whether or not any popup instance is currently open/being displayed.

QuickPopup.instances

Array containing all active popup instances.

QuickPopup.defaults

  • placement - placement of popup relative to the window when open. Can be one of: 'center','top','bottom' (default: 'center')
  • open - should the popup be opened immediatly after creation (default: false)
  • forceOpen - if popup.open() is called when another popup is open, this setting will ensure that the other will be closed. If this is set to false and another popup is open then popup.open() will do nothing (default: false)
  • content - the content element to place inside the popup
  • animation - open animation speed in milliseconds (default: 300)
  • contentPadding - padding to apply inside the content wrapper (default: 0)
  • overlayColor - color to apply to the background overlay (default: 'rgba(0,0,0,0.88)')
  • template - custom element QuickDOM settings to apply to each element. Accepts a key:value pair object where key is one of: popup,overlay,content,close
  • close - settings for the popup's close button:
    • show - should the close button render visible (default: false)
    • padding - how far from the edge should the close button be placed (default: 20)
    • inside - should the close button be placed inside or outside the content box
    • size - width/height of close button in pixels (default: 22)
  • triggers - the triggers that will cause the popup to be automatically opened/closed
    • open
      • navigation - when user goes back in browser history (default:false)
      • visibility - when page is not in focus i.e. switch tabs (default:false)
      • exitIntent - when user intends to exit the page (default:false)
    • close
      • esc - when user hits the 'esc' key on keyboard (default:true)

popup.open()

Opens/reveals the popup element.

popup.close()

Closes/hides the popup element.

popup.destroy()

Removes the popup element from the DOM & destroys the popup instance.

events

The following events are emitted by a popup instance:

beforeopen(triggerName)

Emitted before opening animation begins.

triggerName Method of opening the popup.

  • null: when opened manually via the api.
  • "visibility": when opened via the visibility trigger
  • "navigation": when opened via the navigation trigger
  • "exitIntent": when opened via the exitIntent trigger

open(triggerName)

Emitted when opening animation begins.

finishopen(triggerName)

Emitted when opening animation ends and popup becomes fully visible.

beforeclose

Emitted before closing animation begins.

close

Emitted when closing animation begins.

finishclose

Emitted when closing animation ends and becomes fully invisible.

License

MIT © Daniel Kalen