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

ab-modal

v0.0.6

Published

Minimal Vanilla JS Modal

Downloads

9

Readme

ab-modal

Hyper-minimal Vanilla JS Modal.

  • Plug&Play, no Markup or CSS are required.
  • Can be styled using the options object.
  • DOM is only used while modal is active. The modal is removed from the DOM on close.
  • All UI elements (title / text / OK button / CANCEL button) are optional and customizable.
  • A simple fade-out is enabled by default when closing the model, can be disabled.
  • Individual callbacks can be passed to the OK or CANCEL buttons.
  • And more options. See the default options below.

Install

With npm do:

$ npm install ab-modal --save-dev

Usage

var modal = require('ab-modal');

// Standard example: Modal with title, text, OK and CANCEL

modal.createModal(
{
	titleText				: 'Question of the day',
	textText				: 'Do you like coffee?',
	confirmButtonText 		: 'Yes',
	cancelButtonText 		: 'No',
	confirmCallback			: function() { console.log('So we will bring coffee!')},
	cancelCallback			: function() { console.log('So we will bring tea!')},
});

// Simplest example: Modal with title, OK

modal.createModal(
{
	titleText				: 'Coffee is over',
	confirmButtonText 		: 'OK',
	// no callBack was passed, the modal will simply close when clicking 'OK'
});

// All the default values are shown below

modal.createModal(
{
	debug 					: false,
	closeOnOKClick 			: false,
	titleText				: 'Title',
	textText				: 'Text',
	confirmButtonText 		: 'OK',
	cancelButtonText 		: 'Cancel',
	showTitle 				: true,
	showText 				: true,
	fontFamily 				: null,
	titleMarginBottom 		: '30px',
	buttonsMarginTop 		: '30px',
	modalBorderRadius 		: '2px',
	buttonsBorderRadius 	: '2px',
	showConfirmButton 		: true,
	showCancelButton 		: true,
	confirmButtonColor 		: '#2ecc71',
	cancelButtonColor 		: '#333',
	confirmButtonTextColor	: 'white',
	cancelButtonTextColor	: 'white',
	defaultCancelIsClose	: true,
	defaultOKIsClose		: false,
	cancelCallback			: null,
	confirmCallback			: null,
	fadeOut					: true,
	modalPadding			: '26px 70px 20px 70px',
});

License

MIT