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 🙏

© 2026 – Pkg Stats / Ryan Hefner

notifications-kd

v1.2.0

Published

A standalone, ultra-lightweight, responsive & mobile-friendly toast notification system with a modern, elegant UI and zero dependencies.

Readme

KD Notifications (notifications-kd)

A highly optimized, ultra-lightweight toast notification system with a modern, elegant UI, fully responsive mobile support, and zero dependencies.

KD Notifications Overview

Live Demo Changelog Support

Installation

Via NPM (Bundlers):

npm install notifications-kd

Via CDN (Direct Browser Usage):

<script src="https://cdn.jsdelivr.net/npm/notifications-kd"></script>

<script src="https://unpkg.com/notifications-kd"></script>

Features

  • Elegant & Modern UI: Beautifully crafted default themes featuring Glassmorphism modals and smooth requestAnimationFrame transitions.
  • 🚀 Zero Dependencies: Pure Vanilla JS. No jQuery, no external CSS.
  • 🛡️ Secure: Built-in DOM-based XSS protection (strict whitelisting, <svg>/<math> blocking, and control-character sanitization).
  • 🎨 Smart Auto-Theming: Automatically detects host environment (Light/Dark mode) and reads modern CSS space-separated syntax to adapt seamlessly.
  • 📍 Smart Positioning: Place toasts anywhere (center, top-left, bottom-right, etc.) with strict CSS unit validation for custom offsets.
  • Highly Accessible: Comprehensive Focus Trap, automatic Focus Restoration (WCAG standard), Esc-key support, and OS-level prefers-reduced-motion integration.
  • 📱 Responsive & Mobile-Ready: Fully adaptive layout with native Safe Area (env(safe-area-inset-*)) support for modern devices (e.g., iPhone Notch).
  • High Performance: Optimized DOM manipulation, race-condition prevention, and strict memory management.

Usage

Include the library in your project:

import KDNotification from "notifications-kd";

(Or simply load the notifications-kd.js file via a <script> tag in browser environments).

Basic Info Toast

KDNotification.show({
  type: "info",
  message: "Operation completed successfully.",
  position: "top-right",
});

Rich Toast with Title & Auto-dismiss

KDNotification.show({
  type: "success",
  title: "Profile Updated",
  message: "Your changes have been saved.",
  duration: 4000,
  position: "bottom-left",
});

Interactive Modal (Promises)

KDNotification.show({
  type: "warning",
  title: "Delete File?",
  message: "Are you sure you want to permanently delete this file?",
  isModal: true, // Blocks background clicks and escapes
  position: "center",
  buttons: [
    { text: "Yes, Delete", className: "kd-btn-danger", value: "deleted" },
    { text: "Cancel", value: "cancelled" },
  ],
}).then((res) => {
  if (res === "deleted") {
    console.log("File deleted!");
  }
});

API Options

| Parameter | Type | Default | Description | | ----------- | ------------- | ---------- | --------------------------------------------------------------------------------------------- | | type | String | 'info' | 'info', 'success', 'error', 'warning', 'processing' | | title | String | '' | Optional title for a rich UI layout | | message | String | '' | The main content of the notification (Safe HTML supported) | | duration | Number | 3000 | Auto-dismiss time in ms (0 disables auto-dismiss) | | position | String | 'center' | 'center', 'top-left', 'top-right', 'bottom-left', 'bottom-right' | | theme | String | 'auto' | 'auto' (detects background), 'light', or 'dark' | | isModal | Boolean | false | If true, blocks background interaction and requires manual dismissal. | | buttons | Array | null | Array of button objects { text, value, className, onClick } (Safe HTML supported in text) | | icon | String | null | Custom SVG string to override the default icon | | style | Object | {} | Custom inline CSS properties or CSS variables | | offsetX/Y | String/Number | '50px' | Custom distance from screen edges (supports all CSS units with validation). |

Methods

  • KDNotification.show(options): Displays the notification and returns a Promise. Resolves with the clicked button's value, or null/true on auto-dismiss or overlay click.
  • KDNotification.close(): Programmatically dismisses the currently active notification. Ideal for hiding processing toasts after a background task (like an API call) finishes.

Customization & CSS

You can globally override default styles via the :root pseudo-class, or locally per toast using the style option API:

  • --kd-toast-anim-duration: Controls the enter/leave animation speed. Accurately parses both seconds (e.g., 0.3s) and milliseconds (e.g., 300ms) (Default: 250ms).
  • --kd-z-toast: Controls the z-index of the toast overlay (Default: 2147483647).
  • --kd-mobile-offset-x: Controls the horizontal distance from screen edges on mobile devices (Default: 12px).
  • --kd-mobile-offset-y: Controls the vertical distance from screen edges on mobile devices (Default: 16px).
  • --kd-mobile-max-width: Controls the maximum width of the toast on mobile devices (Default: 420px).

💡 Best Practice: It is strongly recommended to use the style API or CSS variables for customization. Please avoid targeting internal CSS classes directly in your stylesheet, as the internal HTML structure may evolve in future minor updates and could break your custom overrides.

Contact & Support

If you have any questions, bug reports, or feature requests, please open an issue on the GitHub repository.

License

MIT License © KhvichaDev