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

popgun

v1.0.6

Published

A pure Javascript popover component for high performance and feature-rich web applications

Downloads

34

Readme

[![npm][npm-badge]][npm-badge-url] [npm-badge]: https://img.shields.io/npm/v/popgun.svg [npm-badge-url]: https://www.npmjs.com/package/popgun

Popgun

What is Popgun?

Popgun is a pure Javascript popover component for high performance and feature-rich web applications!

How to Use

Simple implementation

Define a target element and set some inline attributes.

html

<!-- On hover, a text popover will appear. -->
<div popgun popgun-trigger="hover" popgun-text="Hello World"></div>

Register Groups and Schemas

If there are a lot of popgun elements, rather than define inline attributes, register groups and schemas.

html

<!-- On hover, an html element popover will appear -->
<div popgun popgun-group="sampleGroup1"></div>

<!-- On click or hover, a text popover will appear. -->
<div popgun popgun-group="sampleGroup2"></div>

<!-- On click or hover, a text popover will appear with the overriden inline attribute. -->
<div popgun 
     popgun-group="sampleGroup2" 
     popgun-text="Inline attribute override group attributes, which override schema options.">
</div>

js

// A base schema 
var schema = {
  hoverDelay: 200,
  trigger: 'hover'
}
popgun.registerSchema('sampleSchema', schema);

// A group based on schema
var group = {
  schemaId: 'sampleSchema',
  options: {
    html: '<div>html element</div>'
  }
}

// Another group based on schema that overrides one of the schema attribute
var anotherGroup = {
  schemaId: 'sampleSchema',
  options: {
    text: 'This is sample text.',
    trigger: 'click hover'
  }
}

popgun.registerGroup('sampleGroup1', group);
popgun.registerGroup('sampleGroup2', anotherGroup);

Popgun Attributes

Some Popgun attributes that you can define are:

  • containerCushion: (int - default 10) the amount of padding between the popover border and the window.
  • darkStyle: (boolean - default false) Sets a dark theme to the popover.
  • disable: (boolean - default false) Clicking elsewhere on the page of a pinned popover will not hide the popm if this is set to true.
  • disableClickOff: (boolean - default false) When triggering a popgun target, the popover will not display if this attribute is set to true.
  • fadeDuration: (int - default 100) time for pop to fade in and out.
  • html: an html element for the content of the popover (will take precedence over the text attribute).
  • optimzePlacement: (boolean - default true) popgun will decide how to best position the popover.
  • placement: (string - default 'top') you can set placement of popover around target - 'top', 'bottom', 'left', 'right'.
  • reusePopover: (boolean - default true) boolean which sets whether popgun will reuse the same popover when moving between two Popgun targets of the same group.
  • showDelay: (int - default 0) the time it takes between the user triggering the target and the popover appearing.
  • text: text content for the popover.
  • timeToHoverOnPop: (int - default 300) the time a user has to hover back over the popover when they hover off the target.
  • tipClass: (string - default '') Adds css classes to the popover container (class names should be space separated).
  • trigger: (string - default 'hover') triggers for the target to show pop - 'hover', 'click', 'focus'.

DOM Events

Throughout the life cycle of the popover, Popgun will fire the following events onto the target:

Show States

  • PopgunContentSetup
  • PopgunPrePosition
  • PopgunPreShow
  • PopgunShowing

Hide States

  • PopgunPreHide
  • PopgunHidden

js

el.addEventListener('PopgunPreShow', function(e) {
  console.log('PopgunPreShow');
}, false);

Run Demo Popgun Application

Run bin/iqb install to install the npm and typings dependencies.

Run bin/iqb start to run a demo application with Popgun.