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

@incendiarybean/notify-framework

v0.2.8

Published

This is a lightweight framework for creating notifications, using TAILWIND and Animate.CSS

Downloads

101

Readme

Notify Framework

Notify-Framework is an extremely lightweight NPM module for creating pop-up notifications.

This module uses TailwindCSS and Animate.css and must be installed alongside it.

Installation

Use NPM to install it and the other 2 requirements with the below command:

npm install @incendiarybean/notify-framework tailwindcss animate.css --save

Usage

Import the module:

import { Notify } from '@incendiarybean/notify-framework';

Try the Demo

Making a large popup notification with buttons:

let content = {
    title:"This is a title",
    body: "This is the body",
    colour: "blue",
    options: ["Dismiss"]
};

Notify(content, "max");

The max popup can be moved around the screen using the draggable feature of the module, though you may need to tweak your Tailwind config to allow active/grab cursor like below:

module.exports = {
    theme: { 
        extend:{
            cursor: {
                grabbing: 'grabbing',
                grab: 'grab'
            },
        }
    },
    variants: {
        cursor: ['responsive', 'hover', 'focus', 'active'],
    },
}

You can also customise the buttons that appear on the notification through a JS file, it will check the root directory for a notify.config.js file (or default to the predefined one). If you don't need to add any functions, you can avoid the func property and leave the file as notify.config.json. The JS file looks like this:

module.exports = {
    "actions":{
        "Dismiss": {
            "options": ["Dismiss", "No", "Cancel"],
            "func": function(){
                    console.log("Do custom function!");
                },
            "close": true,
            "resolve": true,
            "reload": false,
            "returnComment":{
                "ACTION":"Dismissed"
            },
            "colour": "red"
        },
    }
}

This is where you define what the button does, in options you can see the different variants of a dismiss button.

This dismiss button will close the window, resolve the promise, won't reload the page and the returned resolution of the promise is "ACTION": "Dismissed". The button is also red.

If you want to run a custom function along side one of these buttons, you would need to use the property 'func', when clicking the button - this function would then run.

Making a small slide from the side notification:

let content = {
    title:"This is a title",
    body: "This is the body",
    colour: "blue",
    position: ["top", "left"]
};

Notify(content, "min");

You can tell the notification where to position by using the position attribute, you don't have to supply either/or attributes but it will default to bottom left.

Upcoming!

I hope to update this with new notification styles and animation options along with making notifications stackable.