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

@massimo-cassandro/modal-alert

v2.5.1

Published

Vanilla JS modal alert

Downloads

15

Readme

modal-alert

Vanilla JS modal alert

Demo: https://massimo-cassandro.github.io/modal-alert/demo/

Use:

Add the css file to your page

Optionally, add this custom properties to your page (see the src/modal-alert.scss file for default values):

  • --malert-success-color: success color
  • --malert-success-color-fg: success color foreground
  • --malert-info-color: info color
  • --malert-info-color-fg: info color foreground
  • --malert-warning-color: warning color
  • --malert-warning-color-fg: warning color foreground
  • --malert-error-color: error color
  • --malert-error-color-fg: error color foreground
  • --malert-confirm-color: confirm color
  • --malert-confirm-color-fg: confirm color foreground
  • --malert-marks-stroke-width: stroke width for svg marks
  • --malert-backdrop: dialog backdrop color
  • --malert-border-radius: dialog border radius
  • --malert-box-shadow: dialog box shadow
  • --malert-heading-font-family: font family for dialog heading
  • --malert-heading-font-size: font size for dialog heading
  • --malert-heading-font-weigth: font weigth for dialog heading
  • --malert-body-font-family: font family for dialog body text ^ --malert-background-color: background color

Add javascript

import mAlert from '@massimo-cassandro/modal-alert';

mAlert({
  type              : 'success', // success warning error info confirm

  // optionals
  // -------------------------------------------------------------------------
  title             : 'Some title',        // NB: required for `info`
  mes               : 'Some message',      // message, default null
  ok_btn_text       : 'OK',                // text for OK button (default `OK`)
  cancel_btn_text   : 'Annulla',           // text for cancel button (`confirm` only)

  // callback function
  // default `null`
  // the `result` argument is available only for the confim type
  // `result` is `true` if the user confirms, `false` if they cancel
  callback          : function(result) {}, 

  // ms for autoclose, null for disable
  // default `4000` for success, `null` for the others
  // has not effects on `confirm`
  timer             : 4000,

  // classes to be added to relative element (default `null`)
  heading_class     : 'text-success',
  ok_btn_class      : 'btn-success',
  cancel_btn_class  : 'btn-outline-warning'
}, custom_defaults);

The default settings for each type can be viewed in the ./src/js/defaults.js file.

The special type global, if present, contains settings to be applied to all other types.

The optional custom defaults object can be used to set custom defaults, without needing to repeat them every time in the first options object.

Customizing

See demo sources.

TODO

  • rivedere naming custom props (confusione tra color e bg, custom prrops specifiche per marks, marks size)
  • custom props non su :root?
  • aggiungere proprietà e opzioni per maggiore personalizzazione (padding, colori ecc)
  • terminare pagina di setup
  • ottimizzare uso classi predefinite gestendole come variabili