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

dndalertjs

v2.5.3

Published

DNDAlert is a simple JavaScript library alert for web developers.

Downloads

18

Readme

DNDAlert.js

Examples

DNDAlert_Examples

Features

  • SVG Types ( success 🟢 , error 🔴 , warning 🟠, info 🔵 )
  • Unlimited button support
  • HTML message support
  • Easy to set up and use
  • Callback bag
  • Responsive
  • Animation
  • Theme (white 🌕 , dark 🌑)
  • Draggable

Simple Usage

const Alert = new DNDAlert({
  message: "DNDAlert is a simple JavaScript library alert for web developers.",
});
  • [message]
    • Null values ​​cannot be entered. The content of the alert.

Usage

const Alert = new DNDAlert({
  title: "Test Alert",
  message:
    "<b>DNDAlert</b> is a simple JavaScript library alert for web developers.",
  type: "warning",
  html: true,
  buttons: [
    {
      text: "Ok",
      class: "btn btn-primary",
      onClick: (bag) => {
        alert("Ok button clicked");
      },
    },
    {
      text: "Cancel",
      type: "danger",
      onClick: (bag) => {
        bag.CLOSE_MODAL();
      },
    },
  ],
  closeBackgroundClick: true,
  portalElement: document.querySelector("#modal"),
  portalOverflowHidden: true,
  textAlign: "center",
  theme: "dark",
  onOpen: (bag) => {
    console.log("Modal Opened");
    console.log(bag);
  },
  onClose: (bag) => {
    console.log("Modal Closed");
    console.log(bag.PROPERTIES);
  },
  opacity: 1,
  autoCloseDuration: 3000,
  draggable: true,
  animationStatus: true,
  closeIcon: false,
  sourceControlWarning: true,
});
  • [title]

    • Message title (If not given, a modal with no header is created.)
  • [html]

    • Message whether to use HTML in the message.
  • [buttons]

    • It is an array. Keeps the buttons inside.

    • [text] Text inside the button

    • [class] Sets the class of the button. * If not defined, it comes with the library's default button style (light)

    • [type] Default button styles available in the library [primary,secondary,success,danger,warning,light]

    • buttonList

    • [onClick] Function to run after clicking the button.

      • The library sends a BAG_ELEMENT object to this function, which contains the CLOSE_MODAL function needed to close the modal
        onClick: (BAG_ELEMENT) => {
             BAG_ELEMENT.CLOSE_MODAL();
           },
  • [closeBackgroundClick] If true, clicking (not Modal) the background closes the Modal

  • [autoCloseDuration] Takes value (X) in milliseconds and closes modal after X milliseconds.

  • [onOpen] The function is called by the library when the modal is opened.

  • [onClose] The function is called by the library when the modal is closed.

  • [closeIcon] Sets the status of the close button on the top right (invisible if false)

  • [portalElement] To call a modal on an element other than body

  • [portalOverflowHidden] Portal overflow hidden

  • [textAlign] Css property of message

  • [theme] Theme (dark AND white)

  • [type] success,error,warning and info | If it is not entered, the type will not be displayed, only the message will be show.

  • [opacity] Modal css opacity.

  • [animationStatus] If true, opening and closing will be accompanied by animation.

  • [draggable] Modal draggable. (Title required)

  • [sourceControlWarning] If true, when the modal is run, it makes a request to NPM and compares the current version with the local version. If the versions are different, a warning message in the console. (If you don't want to make a npm version request, you can turn it off.)

Installation

cd my-web-project
npm i dndalertjs
cd my-web-project
git clone https://github.com/ismailfp/DNDAlert.js.git

Default Value List

| Property | Value | | -------------------- | ------------- | | portalElement | document.body | | portalOverflowHidden | true | | animationStatus | true | | closeIcon | true | | closeBackgroundClick | true | | sourceControlWarning | true | | type | false | | autoCloseDuration | false | | draggable | false | | html | false | | title | false | | buttons[] > class | light | | theme | white | | opacity | 1.00 | | textAlign | left |

BAG_ELEMENT

  • onOpen,onClose and click function of the buttons

| Property | ? | | ---------------------------- | -------------------------------------------------------------------- | | CLOSE_MODAL | Modal closing function | | PROPERTIES | Contains general information | | PROPERTIES->CREATED_TIME | Modal opening date | | PROPERTIES->THEME | THEME | | PROPERTIES->VERSION | Current version (DNDAlert - NPM) | | PROPERTIES->CONTEXT | Everything in Context | | PROPERTIES->HOW_MANY_SECONDS | Only onClose BAG (Shows how many seconds the alert on after closing) |