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

bullets-js

v1.5.0

Published

Speaker

Downloads

2

Readme

BulletsJS

A simple library for common functions.

npm install bullets-js --save-dev

Build Status

Requirements

You'll need to write some CSS for BulletsJS components to work. You can change the default classes used by passing through the options.

Development

For general developement, use the following command:

npm run serve

NOTE: When testing on older devices (with Browser Stack for example) you might see:

SyntaxError: Unexpected token 'const'

Webpack Dev Server isn't serving babelified code.

It's a pain but I currently do the following (3 separate console tabs):

npm run watch

http-server

(optional) gulp browsersync

public/index.html then pulls in fully babelified code via a script tag.

Using the components

Attach a data-bullets-js attribute to an element to instantiate a class. E.g:

<button data-bullets-js="Modal" >Open Modal</button>

You can then pass through options like so:

<button data-bullets-js="Modal" data-bullets-options="activeClass:open">

Chain options with a comma:

<button data-bullets-js="Modal" data-bullets-options="activeClass:open,targetModal:.js-modal-2">

Modal

The Modal takes two options (default values shown). The class should be instantiated on the button used to trigger the modal.

activeClass: is-open targetModal: .js-modal

The activeClass is applied to the modal, and you should use CSS to then show the modal. For example:

.modal {
	display: none;
}
.modal.is-open {
	display: block;
}

If you want multiple modals on the same page, specify a different targetModal for each modal. You should include an overlay element on your page. A class is added to the body which can be used to make your overlay appear/disappear with the modal. The class added to the body is modal-is-open.

Modal mark-up should be as follows. The modal and modal__inner classes are optional but suggested. You only need one overlay element per page.

The aria-controls attribute should match the id attribute of the modal.


<button class="button" data-bullets-js="Modal" aria-controls="modal">Open Modal</button>

<div class="overlay" tabindex="-1"></div>

<div class="modal js-modal" id="modal" aria-hidden="true" role="dialog" aria-labelledby="dialog-title">		
	<div class="modal__inner" role="document" tabindex="0">

		<button class="js-modal-close button secondary button--hollow">Close</button>
		<h2 id="dialog-title">This is a modal!</h2>

		<!-- your modal content here -->

	</div>
</div>

Menu Toggle

The Menu Toggle takes one option (default values shown). The class should be instantiated on the button used to trigger the menu.

activeClass: menu-is-open

Example CSS might be:

.menu {
	display: none;
}

.menu-is-open .menu {
	display: block;
}

The menu toggle component requires the following mark-up to be accessible.

<button class="menutoggle" data-bullets-js="MenuToggle" id="menu-toggle" aria-label="Menu" aria-expanded="false" aria-controls="menu">

The aria-controls attribute should match the id attribute of the navigation menu. The above button is using menu so the navigation is marked-up as follows.

<nav class="menu" aria-hidden="true" aria-labelledby="menu-toggle" id="menu"></nav>

The behaviour of this component is that it toggles a class on the body element which you can then attach CSS to for making your menu appear and disappear. The component then toggles the necessary aria roles for you to ensure the menu is more accessible.

TESTING

Tested across all devices and browsers finding strong compatibility. ScrollClass may not work on IE11, but it works on Edge 14 up.