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

muticons

v0.2.0

Published

Easily create animated buttons.

Downloads

2

Readme

Muticons

An easy to use library for creating animated buttons.

Usage:

To start, you must include the Muticons CSS and JS files. Next, create an element and give it the mut class. To assign an icon, add a second class that starts with mut- followed by the name of the icon. For example, if you'd like to make the classic "hamburger" mobile navigation button, use this markup:

<button type="button" class="mut mut-bars"></button>

Well that's cool, but it doesn't really accomplish anything you couldn't have done with Font Awesome or an image.

Making a Mutation

Here's where it gets fun. If you'd like your mobile navigation button to mutate into an X when clicked, you simply append a new icon name ("x" in this case) onto the second class separated with --. For example:

<button type="button" class="mut mut-bars--x"></button>

This button will start as a mobile navigation icon, then, when clicked, it'll mutate into an X. Dead simple!

Multiple Mutations

Not entirely sure why you'd want to do something like this next example, but that doesn't mean you shouldn't be able to. You can add as many mutations to a button as you want just by separating them by --. Here's a ridiculous example, but it works:

<button
	type="button"
	class="mut mut-bars--x--arrow-left--arrow-right--circle--circle-o--check--minus"
></button>

As you may have guessed, this button will cycle through all the different mutations until it reached the end, then it will change back into the bars icon. Try it out just for funsies!

Javascript Integration

There's no reason you can't use onclick to handle click events, but you might want to know what state your button is in when it's clicked. If that's the case, you can assign a callback function to your button by using the mut-callback attribute like so:

<button
	type="button"
	class="mut mut-bars--x"
	mut-callback="myAppObject.myCallbackFunction"
></button>
window.myAppObject = {
	myCallbackFunction: function(mutation)
	{
		switch (mutation)
		{
			case 'bars':
			
				// open menu
				
			break;
			
			case 'x':
			
				// close menu
				
			break;
		}
	}
};

Styling

There's a couple ways to change the button's colors. You can use the custom attributes mut-bg and mut-fg like this:

<button
	type="button"
	class="mut mut-circle-o--check"
	mut-bg="#0cf"
	mut-fg="#0f0"
></button>

Or you can just use CSS like this:

<button
	type="button"
	id="mybutton"
	class="mut mut-circle-o--check"
	style="background-color: #0cf; color: #0f0;"
></button>

Notes:

  • If you need to change the foreground color after page load, you'll have to set the background-color of the .mut-segment elements within your button.
  • Some of the mutations, such as circle-o, can't have a transparent background because they use masking elements to make their shapes.

Mutation List

|Mutation Name |Icon | |:-------------:|:-------------:| |bars |bars | |check |check | |x |x | |minus |minus | |arrow-right |arrow-right | |arrow-left |arrow-left | |circle |circle | |circle-o |circle-o | |square (stop) |square | |play |play | |pause |pause |

Muticons Attributes

|Attribute Name |Description |Example | |---------------|-------------------------------------------|-------------------------------------------| |mut-fg |Foreground color. |mut-fg="#0f0" | |mut-bg |Background color. |mut-bg="#0cf" | |mut-size |Button size. (square) |mut-size="20px" | |mut-duration |Animation duration. |mut-duration="0.5s" | |mut-callback |Assign a function to be called on click. |mut-callback="myApp.myCallbackFunction" |