Beautiful JavaScript notifications with Web Notifications support.

Overview
PNotify
v4:
v5:

A JavaScript/TypeScript notification, confirmation, and prompt library.

Notifications can display as toast style, snackbar style, banners, dialogs, alerts, or desktop notifications (using the Web Notifications spec) with fall back to an in-browser notice.

PNotify provides a unique notification flow called modalish that provides a good user experience, even when many notifications are shown at once.

Demos

Latest Stable - http://sciactive.com/pnotify/

Development - https://sciactive.github.io/pnotify/

Table of Contents

Getting Started

You can get PNotify using NPM or Yarn. (You can also use jsDelivr.)

You should install the packages you need individually. Alternatively, you can install all of them at once with the pnotify package.

# Install the packages you need individually.

# You definitely need this one.
npm install --save-dev @pnotify/core
# These are the optional ones.
npm install --save-dev @pnotify/animate
npm install --save-dev @pnotify/bootstrap3
npm install --save-dev @pnotify/bootstrap4
npm install --save-dev @pnotify/confirm
npm install --save-dev @pnotify/countdown
npm install --save-dev @pnotify/desktop
npm install --save-dev @pnotify/font-awesome4
npm install --save-dev @pnotify/font-awesome5-fix
npm install --save-dev @pnotify/font-awesome5
npm install --save-dev @pnotify/glyphicon
npm install --save-dev @pnotify/mobile

# ...

# Or, you can install this to get them all.
npm install --save-dev pnotify

Documentation for Old Versions

Migrating from PNotify 4

Installation

In addition to the JS and CSS, be sure to include a PNotify style.

Svelte

PNotify in Svelte.

import { alert, defaultModules } from '@pnotify/core';
import * as PNotifyMobile from '@pnotify/mobile';

defaultModules.set(PNotifyMobile, {});

alert({
  text: 'Notice me, senpai!'
});

React

PNotify in React.

import { alert, defaultModules } from '@pnotify/core';
import '@pnotify/core/dist/PNotify.css';
import * as PNotifyMobile from '@pnotify/mobile';
import '@pnotify/mobile/dist/PNotifyMobile.css';

defaultModules.set(PNotifyMobile, {});

alert({
  text: 'Notice me, senpai!'
});

Angular

PNotify in Angular.

import { alert, defaultModules } from '@pnotify/core';
import '@pnotify/core/dist/PNotify.css';
import * as PNotifyMobile from '@pnotify/mobile';
import '@pnotify/mobile/dist/PNotifyMobile.css';

defaultModules.set(PNotifyMobile, {});

//...
export class WhateverComponent {
  constructor() {
    alert({
      text: 'Notice me, senpai!'
    });
  }
}

For IE support, see this issue.

Angular (Injectable)

PNotify in Angular (Injectable)

// pnotify.service.ts
import { Injectable } from '@angular/core';
import { alert, defaultModules } from '@pnotify/core';
import '@pnotify/core/dist/PNotify.css';
import * as PNotifyMobile from '@pnotify/mobile';
import '@pnotify/mobile/dist/PNotifyMobile.css';

defaultModules.set(PNotifyMobile, {});

@Injectable()
export class PNotifyService {
  getPNotifyAlert() {
    return alert;
  }
}

// whatever.module.ts
//...
import { PNotifyService } from './pnotify.service';
@NgModule({
  declarations: [...],
  imports: [...],
  providers: [PNotifyService],
  bootstrap: [...]
})
export class WhateverModule {}

// whatever.component.ts
import { PNotifyService } from './pnotify.service';
//...
export class WhateverComponent {
  alert = undefined;
  constructor(pnotifyService: PNotifyService) {
    this.alert = pnotifyService.getPNotifyAlert();
    this.alert({
      text: 'Notice me, senpai!'
    });
  }
}

AngularJS

PNotify in AngularJS.

<link href="node_modules/@pnotify/core/dist/PNotify.css" rel="stylesheet" type="text/css" />
<link href="node_modules/@pnotify/mobile/dist/PNotifyMobile.css" rel="stylesheet" type="text/css" />
var angular = require('angular');
var PNotify = require('@pnotify/core');
var PNotifyMobile = require('@pnotify/mobile');

PNotify.defaultModules.set(PNotifyMobile, {});

angular.module('WhateverModule', [])
  .value('PNotify', PNotify)
  .controller('WhateverController', ['PNotify', function(PNotify) {
    PNotify.alert({
      text: 'Notice me, senpai!'
    });
  }]);

Vanilla JS (ES5)

PNotify in vanilla ES5

<script type="text/javascript" src="node_modules/@pnotify/core/dist/PNotify.js"></script>
<link href="node_modules/@pnotify/core/dist/PNotify.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="node_modules/@pnotify/mobile/dist/PNotifyMobile.js"></script>
<link href="node_modules/@pnotify/mobile/dist/PNotifyMobile.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
  PNotify.defaultModules.set(PNotifyMobile, {});

  PNotify.alert({
    text: 'Notice me, senpai!'
  });
</script>

Vanilla JS (ES6)

PNotify in vanilla ES6+

<link href="node_modules/@pnotify/core/dist/PNotify.css" rel="stylesheet" type="text/css" />
<link href="node_modules/@pnotify/mobile/dist/PNotifyMobile.css" rel="stylesheet" type="text/css" />
<script type="module">
  import { alert, defaultModules } from 'node_modules/@pnotify/core/dist/PNotify.js';
  import * as PNotifyMobile from 'node_modules/@pnotify/mobile/dist/PNotifyMobile.js';

  defaultModules.set(PNotifyMobile, {});

  alert({
    text: 'Notice me, senpai!'
  });
</script>

Styles

Bright Theme

The default theme, Bright Theme. Supports dark mode. Include the CSS file in your page:

<link href="node_modules/@pnotify/core/dist/BrightTheme.css" rel="stylesheet" type="text/css" />

Or if you're using a packager that imports CSS:

import '@pnotify/core/dist/BrightTheme.css';

Material

The Material theme. Supports dark mode. Requires material-design-icons and optionally the Roboto font. Include the CSS file in your page:

<link href="node_modules/@pnotify/core/dist/Material.css" rel="stylesheet" type="text/css" />

Or if you're using a packager that imports CSS:

import '@pnotify/core/dist/Material.css';

Then set the default styling and icons to 'material':

import { defaults } from '@pnotify/core';
// or
const { defaults } = require('@pnotify/core');

// Set default styling.
defaults.styling = 'material';
// This icon setting requires the Material Icons font. (See below.)
defaults.icons = 'material';

Material Icons

To use the Material Style icons, include the Material Design Icons Font in your page.

# The official Google package:
npm install --save material-design-icons

# OR, An unofficial package that only includes the font:
npm install --save material-design-icon-fonts
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css" />

Or if you're using a packager that imports CSS:

import 'material-design-icons/iconfont/material-icons.css';

Alternatively, you can use the Google Fonts CDN:

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" />

Or a clone from jsDelivr:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/material-icons-font.css" />

Roboto Font

The Material style uses the "400" and "500" weights of Roboto. It will fall back to "sans-serif".

You can use the Google Font CDN:

<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" />

Angeler

The Angeler theme. Supports dark mode. Include the CSS file in your page:

<link href="node_modules/@pnotify/core/dist/Angeler.css" rel="stylesheet" type="text/css" />

Or if you're using a packager that imports CSS:

import '@pnotify/core/dist/Angeler.css';

It's recommended that you set the close button to not hide by default, as that is how Angela designed the theme to look best.

import { defaults } from '@pnotify/core';
// or
const { defaults } = require('@pnotify/core');

defaults.closerHover = false;

You can use the angeler-extended class to use the alternate, more spacious styling for the Angeler theme. This works great for big, center of the page notices, like page errors.

alert({
  text: "I'll be more expanded than normal, with a separated title line.",
  addClass: 'angeler-extended'
});

:info: It's named after Angela Murrell, who designed it, and it's pronounced like An-jel-er.

Bootstrap

npm install --save-dev @pnotify/bootstrap3 @pnotify/glyphicon
# or
npm install --save-dev @pnotify/bootstrap4

Styling for the popular Bootstrap library. Doesn't support dark mode (but you can use a Bootstrap theme).

Include the CSS:

<link rel="stylesheet" href="node_modules/@pnotify/bootstrap4/dist/PNotifyBootstrap4.css" />

Or if you're using a packager that imports CSS:

import '@pnotify/bootstrap4/dist/PNotifyBootstrap4.css';

Include the appropriate line(s) from below:

import { defaultModules } from '@pnotify/core';
import * as PNotifyBootstrap4 from '@pnotify/bootstrap4';
// or
const { defaultModules } = require('@pnotify/core');
const PNotifyBootstrap4 = require('@pnotify/bootstrap4');

Then set it as a default module:

defaultModules.set(PNotifyBootstrap4, {});

Change the "4" to "3" for Bootstrap 3, and also import and set PNotifyGlyphicon to use Bootstrap 3's glyphicons. PNotifyGlyphicon doesn't have any CSS to import.

Font Awesome 4 (Icons)

npm install --save-dev @pnotify/font-awesome4

To set Font Awesome 4 as the default icons, include the appropriate line from below:

import { defaultModules } from '@pnotify/core';
import * as PNotifyFontAwesome4 from '@pnotify/font-awesome4';
// or
const { defaultModules } = require('@pnotify/core');
const PNotifyFontAwesome4 = require('@pnotify/font-awesome4');

Then set it as a default module:

defaultModules.set(PNotifyFontAwesome4, {});

Font Awesome 5 (Icons)

npm install --save-dev @pnotify/font-awesome5 @pnotify/font-awesome5-fix

To set Font Awesome 5 as the default icons, include the appropriate line from below:

import { defaultModules } from '@pnotify/core';
import * as PNotifyFontAwesome5Fix from '@pnotify/font-awesome5-fix';
import * as PNotifyFontAwesome5 from '@pnotify/font-awesome5';
// or
const { defaultModules } = require('@pnotify/core');
const PNotifyFontAwesome5Fix = require('@pnotify/font-awesome5-fix');
const PNotifyFontAwesome5 = require('@pnotify/font-awesome5');

Then set them as default modules:

defaultModules.set(PNotifyFontAwesome5Fix, {});
defaultModules.set(PNotifyFontAwesome5, {});

If you don't want to use Font Awesome 5 as your default icons, but you still want support for them in your notices, you should include only the @pnotify/font-awesome5-fix package. Font Awesome 5 does some mysterious magic in its code that breaks PNotify. This module has a workaround for it.

Creating Notices

To make a notice, use the factory functions. Each one takes an options object as its only argument. It will return a PNotify notice instance.

import { alert, notice, info, success, error } from '@pnotify/core';
// or
const { alert, notice, info, success, error } = require('@pnotify/core');

// Manually set the type.
const myAlert = alert({
  text: "I'm an alert.",
  type: 'info'
});

// Automatically set the type.
const myNotice = notice({
  text: "I'm a notice."
});

const myInfo = info({
  text: "I'm an info message."
});

const mySuccess = success({
  text: "I'm a success message."
});

const myError = error({
  text: "I'm an error message."
});

Options

PNotify options and default values.

defaults = {

  • type: 'notice'
    Type of the notice. 'notice', 'info', 'success', or 'error'.
  • title: false
    The notice's title. Can be a string, an element, or false for no title.
  • titleTrusted: false
    Whether to trust the title or escape its contents. (Not allow HTML.)
  • text: false
    The notice's text. Can be a string, an element, or false for no text.
  • textTrusted: false
    Whether to trust the text or escape its contents. (Not allow HTML.)
  • styling: 'brighttheme'
    What styling classes to use. (Can be 'brighttheme', 'material', another string provided by a module, or a styling object.)
  • icons: 'brighttheme'
    What icons classes to use (Can be 'brighttheme', 'material', another string provided by a module, or an icon object.)
  • mode: 'no-preference'
    Light or dark version of the theme, if supported by the styling. This overrides the CSS media query when a preference is given. (Can be 'no-preference', 'light', or 'dark'.)
  • addClass: ''
    Additional classes to be added to the notice. (For custom styling.)
  • addModalClass: ''
    Additional classes to be added to the notice, only when in modal.
  • addModelessClass: ''
    Additional classes to be added to the notice, only when in modeless.
  • autoOpen: true
    Open the notice immediately when it is created.
  • width: '360px'
    Width of the notice.
  • minHeight: '16px'
    Minimum height of the notice. It will expand to fit content.
  • maxTextHeight: '200px' Maximum height of the text container. If the text goes beyond this height, scrollbars will appear. Use null to remove this restriction.
  • icon: true
    Set icon to true to use the default icon for the selected style/type, false for no icon, or a string for your own icon class.
  • animation: 'fade'
    The animation to use when displaying and hiding the notice. 'none' and 'fade' are supported through CSS. Others are supported through the Animate module and Animate.css.
  • animateSpeed: 'normal'
    Speed at which the notice animates in and out. 'slow', 'normal', or 'fast'. Respectively, 400ms, 250ms, 100ms.
  • shadow: true
    Display a drop shadow.
  • hide: true
    After a delay, close the notice.
  • delay: 8000
    Delay in milliseconds before the notice is removed. If set to Infinity, the notice will not close, but it will not be considered sticky, so it will be closed along with all unstuck notices if the modal backdrop is clicked.
  • mouseReset: true
    Reset the hide timer if the mouse moves over the notice.
  • closer: true
    Provide a button for the user to manually close the notice.
  • closerHover: true
    Only show the closer button on hover.
  • sticker: true
    Provide a button for the user to manually stick the notice.
  • stickerHover: true
    Only show the sticker button on hover.
  • labels: {close: 'Close', stick: 'Pin', unstick: 'Unpin'}
    The various displayed text, helps facilitating internationalization.
  • remove: true
    Remove the notice's elements from the DOM after it is closed.
  • destroy: true
    Whether to remove the notice from the stack (and therefore, stack history) when it is closed.
  • stack: defaultStack
    The stack on which the notices will be placed. Also controls the direction the notices stack.
  • modules: defaultModules
    This is where modules and their options should be added. It is a map of module => options entries.

}

defaultStack = new Stack({
  dir1: 'down',
  dir2: 'left',
  firstpos1: 25,
  firstpos2: 25,
  spacing1: 36,
  spacing2: 36,
  push: 'bottom',
  context: document.body
})

Learn more about stacks.

defaultModules = new Map()

Changing Defaults

import { defaults } from '@pnotify/core';
// or
const { defaults } = require('@pnotify/core');

defaults.width = '400px';

Adding/removing a module to the defaults:

import { defaultModules } from '@pnotify/core';
import * as PNotifyMobile from '@pnotify/mobile';
// or
const { defaultModules } = require('@pnotify/core');
const PNotifyMobile = require('@pnotify/mobile');

// Add a module to the defaults. Note that the second argument should
// always be `{}`.
defaultModules.set(PNotifyMobile, {});

// Removing a module from the defaults.
defaultModules.delete(PNotifyMobile);

Changing a module's defaults:

import { defaults } from '@pnotify/animate';
// or
const { defaults } = require('@pnotify/animate');

// then
defaults.inClass = 'fadeInDown';
defaults.outClass = 'fadeOutUp';

Modules

Creating Notices with Modules

Besides using the default modules, you can remove or add modules and set their options when you call a notice. The modules Map has modules themselves as keys, and an options object as values.

import { notice, defaultModules } from '@pnotify/core';
import * as PNotifyBootstrap4 from '@pnotify/bootstrap4';
import * as PNotifyFontAwesome4 from '@pnotify/font-awesome4';
import * as PNotifyMobile from '@pnotify/mobile';
import * as PNotifyAnimate from '@pnotify/animate';

defaultModules.set(PNotifyBootstrap4, {});
defaultModules.set(PNotifyFontAwesome4, {});
defaultModules.set(PNotifyMobile, {});

// Remove one of the default modules.
notice({
  text: "I don't have the Mobile module.",
  modules: new Map([
    ...[...defaultModules].filter(([mod]) => mod !== PNotifyMobile)
  ])
});

// Add an additional module and options.
notice({
  text: "I use the Animate module in addition to the defaults.",
  modules: new Map([
    ...defaultModules,
    [PNotifyAnimate, {
      inClass: 'fadeInDown',
      outClass: 'fadeOutUp'
    }]
  ])
});

// Don't worry about adding a module that's already in the defaults.
// It's a Map, so only the last instance/options will end up in there.
notice({
  text: "I use the Mobile module with options I specify.",
  modules: new Map([
    ...defaultModules,
    [PNotifyMobile, {
      swipeDismiss: false
    }]
  ])
});

TypeScript

Using modules with TypeScript requires types assertions for module entries, and possibly the downlevelIteration TypeScript option.

import {notice, defaultModules, Notice, ModuleEntry} from '@pnotify/core';
import * as PNotifyConfirm from '@pnotify/confirm';

notice({
  text: "I'm a notice with modules, and my module options are checked by TypeScript.",
  modules: new Map([
    // This requires `"downlevelIteration": true` in your TypeScript config.
    ...defaultModules,
    [PNotifyConfirm, {
      confirm: true,
      buttons: [{
        text: 'Ok',
        primary: true,
        click: (notice: Notice) => notice.close()
      }]
      // ***
      // Notice the type assertion here. It tells TypeScript that the options
      // are for the Confirm module.
      // ***
    }] as ModuleEntry<typeof PNotifyConfirm>,
  ])
});

Desktop Module

Notifications that display even when the web page is not visible. Implements the Web Notifications spec.

If the user's browser doesn't support Web Notifications, or they deny permission to show them, they will see regular in-browser notices, unless fallback is false.

npm install --save-dev @pnotify/desktop
import {notice, defaultModules} from '@pnotify/core';
import * as PNotifyDesktop from '@pnotify/desktop';

const myNotice = notice({
  text: "I'm a notice.",
  modules: new Map([
    ...defaultModules,
    [PNotifyDesktop, {
      // Desktop Module Options
    }]
  ])
});

PNotifyDesktop.defaults = {

  • fallback: true
    If desktop notifications are not supported or allowed, fall back to a regular notice.
  • icon: null
    The URL of the icon to display. If false, no icon will show. If null, a default icon will show.
  • tag: null
    Using a tag lets you update an existing notice, or keep from duplicating notices between tabs. If you leave tag null, one will be generated, facilitating the update function.
  • title: null
    Optionally display a different title for the desktop.
  • text: null
    Optionally display different text for the desktop.
  • options: {}
    Any additional options to be passed to the Notification constructor.

}

Mobile Module

Notices on mobile phones and tablets.

npm install --save-dev @pnotify/mobile
import {notice, defaultModules} from '@pnotify/core';
import * as PNotifyMobile from '@pnotify/mobile';

const myNotice = notice({
  text: "I'm a notice.",
  modules: new Map([
    ...defaultModules,
    [PNotifyMobile, {
      // Mobile Module Options
    }]
  ])
});

PNotifyMobile.defaults = {

  • swipeDismiss: true
    Let the user swipe the notice away.

}

Countdown Module

Give an indication of how much time is left.

npm install --save-dev @pnotify/countdown
import {notice, defaultModules} from '@pnotify/core';
import * as PNotifyCountdown from '@pnotify/countdown';

const myNotice = notice({
  text: "I'm a notice.",
  modules: new Map([
    ...defaultModules,
    [PNotifyCountdown, {
      // Countdown Module Options
    }]
  ])
});

PNotifyCountdown.defaults = {

  • anchor: 'bottom'
    Where the countdown bar should anchor. One of 'top', 'bottom', 'left', or 'right'.
  • reverse: false
    Whether the countdown shrinks the other way.

}

Animate Module

Fluid CSS animations using Animate.css.

npm install --save-dev @pnotify/animate
import {notice, defaultModules} from '@pnotify/core';
import * as PNotifyAnimate from '@pnotify/animate';

const myNotice = notice({
  text: "I'm a notice.",
  modules: new Map([
    ...defaultModules,
    [PNotifyAnimate, {
      // Animate Module Options
    }]
  ])
});

PNotifyAnimate.defaults = {

  • inClass: null
    The class to use to animate the notice in. If only one of these is set, it will be used for both.
  • outClass: null
    The class to use to animate the notice out. If only one of these is set, it will be used for both.

}

The Animate module also creates a method, attention(aniClass, callback), on notices which accepts an attention grabber class and an animation completed callback.

Confirm Module

Confirmation dialogs and prompts.

npm install --save-dev @pnotify/confirm
import {notice, defaultModules} from '@pnotify/core';
import * as PNotifyConfirm from '@pnotify/confirm';

const myNotice = notice({
  text: "I'm a notice.",
  modules: new Map([
    ...defaultModules,
    [PNotifyConfirm, {
      // Confirm Module Options
    }]
  ])
});

PNotifyConfirm.defaults = {

  • confirm: false
    Make a confirmation box.
  • focus: null
    For confirmation boxes, true means the first button or the button with promptTrigger will be focused, and null means focus will change only for modal notices. For prompts, true or null means focus the prompt. When false, focus will not change.
  • prompt: false
    Make a prompt.
  • promptClass: ''
    Classes to add to the input element of the prompt.
  • promptValue: ''
    The value of the prompt. (Note that this is two-way bound to the input.)
  • promptMultiLine: false
    Whether the prompt should accept multiple lines of text.
  • align: 'flex-end'
    Where to align the buttons. (flex-start, center, flex-end, space-around, space-between)
buttons: [
  {
    text: 'Ok',
    primary: true,
    promptTrigger: true,
    click: (notice, value) => {
      notice.close();
      notice.fire('pnotify:confirm', {notice, value});
    }
  },
  {
    text: 'Cancel',
    click: (notice) => {
      notice.close();
      notice.fire('pnotify:cancel', {notice});
    }
  }
]
  • The buttons to display, and their callbacks. If a button has promptTrigger set to true, it will be triggered when the user hits enter in a prompt (unless they hold shift).

}

Because the default buttons fire notice events on confirmation and cancellation, you can listen for them like this:

import { alert } from '@pnotify/core';
const notice = alert({
  title: 'Confirmation Needed',
  text: 'Are you sure?',
  hide: false,
  modules: {
    Confirm: {
      confirm: true
    }
  }
});
notice.on('pnotify:confirm', () => {
  // User confirmed, continue here...
});
notice.on('pnotify:cancel', () => {
  // User canceled, continue here...
});

Paginate Module

Provide an index and count of the notices in the stack, and/or buttons to let the user page through them.

npm install --save-dev @pnotify/paginate
import {notice, defaultModules} from '@pnotify/core';
import * as PNotifyPaginate from '@pnotify/paginate';

const myNotice = notice({
  text: "I'm a notice.",
  modules: new Map([
    ...defaultModules,
    [PNotifyPaginate, {
      // Paginate Module Options
    }]
  ])
});

PNotifyPaginate.defaults = {

  • buttons: true
    Show next and previous buttons.
  • count: true
    Show the stack notice count.
  • immediateTransition: true
    Immediately transition to the next/previous notice (without animations).
  • waiting: true
    After transitioning, set the closed notice to "waiting" state.
  • labels: {previous: 'Previous', next: 'Next', of: 'of'}
    Various texts. Allows for internationalization.

}

Exported Methods and Properties

  • alert(options)
    Create and return a notice with the default type.
  • notice(options)
    Create and return a notice with 'notice' type.
  • info(options)
    Create and return a notice with 'info' type.
  • success(options)
    Create and return a notice with 'success' type.
  • error(options)
    Create and return a notice with 'error' type.
  • defaults
    Defaults for options.
  • defaultStack
    The default stack object.
  • styles
    Styles objects.
  • icons
    Icons objects.

Instance Methods and Properties

  • notice.open(immediate)
    Open the notice. Returns a promise that is rejected on failure or resolved on completion.
  • notice.close(immediate, timerHide, waitAfterward)
    Close the notice. Returns a promise that is rejected on failure or resolved on completion.
  • notice.update(options)
    Update the notice with new options.
  • notice.on(eventName, callback)
    Invokes the callback whenever the notice dispatches the event. Callback receives an event argument with a detail prop. Returns a function that removes the handler when invoked.
  • notice.fire(eventName, detail)
    Fire an event.
  • notice.getState()
    Returns the state of the notice. Can be 'waiting', 'opening', 'open', 'closing', or 'closed'.
  • notice.addModuleClass(element, ...classNames)
    This is for modules to add classes to the notice or container element.
  • notice.removeModuleClass(element, ...classNames)
    This is for modules to remove classes from the notice or container element.
  • notice.hasModuleClass(element, ...classNames)
    This is for modules to test classes on the notice or container element.
  • notice.refs.elem
    The notice's DOM element.
  • notice.refs.container
    The container DOM element.
  • notice.refs.content
    The content DOM element. (Title and text containers are in here.)
  • notice.refs.titleContainer
    The title container DOM element.
  • notice.refs.textContainer
    The text container DOM element.
  • notice.refs.iconContainer
    The icon container DOM element.

Events

Event objects have a detail property that contains information about the event, including a reference to the notice itself.

  • pnotify:init - Fired upon initialization of a new notice. This event bubbles.
  • pnotify:mount - Fired when the notice has been mounted into the DOM. This event bubbles.
  • pnotify:update - Fired when the notice's state changes. Careful, this includes internal state and can be very noisy (don't do anything computationally expensive on this one).
  • pnotify:beforeOpen - Fired before the notice opens. Use preventDefault() on the event to cancel this action.
  • pnotify:afterOpen - Fired after the notice opens.
  • pnotify:enterModal - Fired when the notice enters a modal state. (Opens in a modal stack, or a modalish stack that is in modal state.)
  • pnotify:leaveModal - Fired when the notice leaves a modal state.
  • pnotify:beforeClose - Fired before the notice closes. Use preventDefault() on the event to cancel this action.
  • pnotify:afterClose - Fired after the notice closes.
  • pnotify:beforeDestroy - Fired before the notice is destroyed. Use preventDefault() on the event to cancel this action.
  • pnotify:afterDestroy - Fired after the notice is destroyed.

From the Svelte Component API.

Don't use these. I'm putting them in here to document that you should not use them. That way, if you do, and you file a bug report, I can point to this section in the README, and tell you that you did a bad.

  • notice.$set(options)
    You should use update(options) instead. The Svelte API may change.
  • notice.$on(event, callback)
    You should use on(event, callback) instead. The Svelte API may change.
  • notice.$destroy()
    You should use close() with destroy: true instead. It will animate the notice out and remove it from the stack.notices array. Removes the component from the DOM and any observers/event listeners.

Stacks

A stack is an instance of the Stack class used to determine where to position notices and how they interact with each other.

import {alert, Stack} from '@pnotify/core';

const myStack = new Stack({
  dir1: 'up'
});

alert({
  text: 'I\'m a notice centered at the bottom!',
  stack: myStack
});

Stack options and their defaults:

  • dir1: null
    The primary stacking direction. Can be 'up', 'down', 'right', or 'left'.
  • firstpos1: null
    Number of pixels from the edge of the context, relative to dir1, the first notice will appear. If null, the current position of the notice, whatever that is, will be used.
  • spacing1: 25
    Number of pixels between notices along dir1.
  • dir2: null
    The secondary stacking direction. Should be a perpendicular direction to dir1. The notices will continue in this direction when they reach the edge of the viewport along dir1.
  • firstpos2: null
    Number of pixels from the edge of the context, relative to dir2, the first notice will appear. If null, the current position of the notice, whatever that is, will be used.
  • spacing2: 25
    Number of pixels between notices along dir2.
  • push: 'bottom'
    Where, in the stack, to push new notices. Can be 'top' or 'bottom'.
  • maxOpen: 1
    How many notices are allowed to be open in this stack at once.
  • maxStrategy: 'wait'
    The strategy to use to ensure maxOpen. Can be 'wait', which will cause new notices to wait their turn, or 'close', which will remove the oldest notice to make room for a new one.
  • maxClosureCausesWait: true
    Whether the notices that are closed to abide by maxOpen when maxStrategy === 'close' should wait and reopen in turn.
  • modal: 'ish'
    Whether the stack should be modal (true), modeless (false), or modalish ('ish'). Modalish stacks are cool. See https://sciactive.com/2020/02/11/the-modalish-notification-flow/.
  • modalishFlash: true
    Whether new notices that start waiting in a modalish stack should flash under the leader notice to show that they have been added.
  • overlayClose: true
    Whether clicking on the modal overlay should close the stack's notices.
  • overlayClosesPinned: false
    Whether clicking on the modal to close notices also closes notices that have been pinned (hide === false).
  • positioned: true
    Whether the notices in this stack are positioned by the stack. If false, the notices are simply part of the normal flow.
  • context: document.body
    The DOM element this stack's notices should appear in.

Stack behavior:

  • If there is no dir1 property, the notice will be centered in the context.
  • If there is a dir1 and no dir2, the notices will be centered along the axis of dir1.
  • The firstpos* values are relative to an edge determined by the corresponding dir* value.
    • dirX === 'up' means firstposX is relative to the bottom edge.
    • dirX === 'down' means firstposX is relative to the top edge.
    • dirX === 'left' means firstposX is relative to the right edge.
    • dirX === 'right' means firstposX is relative to the left edge.
  • Stacks are independent of each other, so a stack doesn't know and doesn't care if it overlaps (and blocks) another stack.
  • Stack objects are used and manipulated by PNotify, and therefore, should likely be a variable when passed. Only use stack: new Stack({...}) in your options if you intend to have only one notice open like that.

Stack methods:

  • forEach(callback, { start = 'oldest', dir = 'newer', skipModuleHandled = false } = {})
    Run a callback for all the notices in the stack. start can be 'head', 'tail', 'oldest', or 'newest'. dir can be 'next', 'prev', 'older', or 'newer'.
  • position()
    Position all the notices in the stack.
  • queuePosition(milliseconds = 10)
    Queue a position call in that many milliseconds, unless another one is queued beforehand.
  • close(immediate)
    Close all the notices in the stack.
  • open(immediate)
    Open all the notices in the stack.
  • openLast()
    Open the last closed/closing notice in the stack.
  • swap(one, theOther, immediate = false, waitAfter = false)
    If one is open, close it and open theOther instead. Returns a promise that is rejected on failure or resolved on completion.
  • on(event, callback)
    Add an event listener. Returns a function that will remove the listener when called.

There are other methods on the stack class, but you shouldn't use them. They're meant to be internal, so they begin with an underscore.

Stack properties:

  • stack.notices - An "array" of notices. It's actually built on the fly from the double linked list the notices are really stored in.
  • stack.length - How many notices there are in the stack.
  • stack.leader - When a stack is modalish, this is the notice that is open in the non-modal state.

All of the options are properties as well.

Stack events and event.detail contents:

  • 'beforePosition', { stack }
    Before the notices in the stack are positioned.
  • 'afterPosition', { stack }
    After the notices in the stack are positioned.
  • 'beforeAddNotice', { stack, notice }
    Before a notice is added to the stack.
  • 'afterAddNotice', { stack, notice }
    After a notice is added to the stack.
  • 'beforeOpenNotice', { stack, notice }
    Before a notice in the stack is opened.
  • 'afterOpenNotice', { stack, notice }
    After a notice in the stack is opened.
  • 'beforeCloseNotice', { stack, notice }
    Before a notice in the stack is closed.
  • 'afterCloseNotice', { stack, notice }
    After a notice in the stack is closed.
  • 'beforeRemoveNotice', { stack, notice }
    Before a notice is removed from the stack.
  • 'afterRemoveNotice', { stack, notice }
    After a notice is removed from the stack.
  • 'beforeSetLeader', { stack, leader }
    Before a notice is set as the leader of the stack. The leader is the notice that is open in a Modalish stack.
  • 'afterSetLeader', { stack, leader }
    After a notice is set as the leader of the stack. The leader is the notice that is open in a Modalish stack.
  • 'beforeAddOverlay', { stack }
    Before the stack opens an overlay, indicating it is in modal mode.
  • 'afterAddOverlay', { stack }
    After the stack opens an overlay, indicating it is in modal mode.
  • 'beforeRemoveOverlay', { stack }
    Before the stack closes and removes the overlay, indicating it is exiting modal mode.
  • 'afterRemoveOverlay', { stack }
    After the stack closes and removes the overlay, indicating it is exiting modal mode.
  • 'overlayClose', { stack, clickEvent }
    When the user clicks the overlay to close the stack. You can call clickEvent.preventDefault() to cancel the close action.

⚠️ Calling something like alert({text: 'notice', stack: new Stack({dir1: 'down', firstpos1: 25})}); may not do what you want. It will create a notice, but that notice will be in its own stack and will overlap other notices.

Example Stack

Here is an example stack with comments to explain. You can play with it here.

const stackBottomModal = new Stack({
  dir1: 'up', // With a dir1 of 'up', the stacks will start appearing at the bottom.
  // Without a `dir2`, this stack will be horizontally centered, since the `dir1` axis is vertical.
  firstpos1: 25, // The notices will appear 25 pixels from the bottom of the context.
  // Without a `spacing1`, this stack's notices will be placed 25 pixels apart.
  push: 'top', // Each new notice will appear at the bottom of the screen, which is where the 'top' of the stack is. Other notices will be pushed up.
  modal: true, // When a notice appears in this stack, a modal overlay will be created.
  overlayClose: true, // When the user clicks on the overlay, all notices in this stack will be closed.
  context: document.getElementById('page-container') // The notices will be placed in the 'page-container' element.
});

If you just want to position a single notice programmatically, and don't want to add any other notices into the stack, you can use something like this:

alert({
  text: "Notice that's positioned in its own stack.",
  stack: new Stack({
    dir1: 'down', dir2: 'right', // Position from the top left corner.
    firstpos1: 90, firstpos2: 90 // 90px from the top, 90px from the left.
  })
});

Features

  • Rich graphical features and effects.
    • Automatic dark mode support.
    • Material, Bootstrap 3/4, Font Awesome 4/5, or the stand-alone theme, Bright Theme.
    • Mobile styling and swipe support.
    • Timed hiding.
    • Slick animations with Animate.css.
    • Attention getters with Animate.css.
    • Countdown bar to show time left before notice closes.
  • Highly customizable UI.
    • Modalish, modal, and modeless notification flows.
    • Sticky (pinned) notices.
    • Optional close and stick buttons.
    • Supports non-blocking notices for less intrusive use.
    • Notification types: notice, info, success, and error.
    • Stacks allow notices to position together or independently.
    • Control stack direction and push to top or bottom.
    • Confirm dialogs, alert buttons, and prompts.
    • RTL language support.
  • Feature rich API.
    • Desktop notifications based on the Web Notifications standard.
    • Dynamically update existing notices.
    • Put text, HTML, or DOM elements in notices.
      • By default, escapes text to prevent XSS attacks.
    • Optional notice history for reshowing old notices.
  • Universally compatible.
    • Works with any frontend library (React, Angular, Svelte, Vue, Ember, etc.).
    • Works with bundlers (Webpack, Rollup, etc.).
    • No dependencies for most features.

Browser Compatibility and Build Size

PNotify provides prebuilt JS files, and those files are run through Babel to provide compatibility with older browsers. As such, their build size grows to maintain compatibility. If this is not acceptable, you can build much smaller (~80% of original) files yourself with:

git clone https://github.com/sciactive/pnotify.git
cd pnotify
npm i
mv .browserslistrc-smallbuild .browserslistrc
npx lerna bootstrap
npm build

You should now have dist folders in all the packages with smaller (but only compatible with newer browsers) build files. Note that this doesn't apply to Svelte projects, because they build the PNotify *.svelte source files anyway.

Licensing and Additional Info

Copyright 2009-2020 Hunter Perrin Copyright 2015 Google, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

See http://sciactive.com/pnotify/ for more information, and demos.

Comments
  • Bootstrap v.3 compatibility

    Bootstrap v.3 compatibility

    Hello, in order to be compatible with Bootstrap v3 I've applied some changes / fixes. Can maybe be useful to somebody who wants to upgrade. Lines 38-55 look like this:

    bootstrap: {
                    container: "alert",
                    notice: "alert-info",
                    notice_icon: "glyphicon glyphicon-exclamation-sign",
                    info: "alert-info",
                    info_icon: "glyphicon glyphicon-info-sign",
                    success: "alert-success",
                    success_icon: "glyphicon glyphicon-ok-sign",
                    error: "alert-danger",
                    error_icon: "glyphicon glyphicon-warning-sign",
                    closer: "glyphicon glyphicon-remove",
                    pin_up: "glyphicon glyphicon-pause",
                    pin_down: "glyphicon glyphicon-play",
                    hi_menu: "well",
                    hi_btn: "btn btn-default",
                    hi_btnhov: "",
                    hi_hnd: "glyphicon glyphicon-chevron-down"
                }
    
    opened by jbogdani 23
  • Using with webpack crashes a page

    Using with webpack crashes a page

    I'm using webpack with pnotify (I get pnotify 3.0.0 from npm registry) in my project. So, when I use pnotify 3.0.0 it crashes a site. The reason is here (pnotify.js line 865)

    if (root.document.body) {
        do_when_ready();
    } else {
        $(do_when_ready);
    }
    

    because root is only an object in my case... If I fix it by adding

    if (root.document && root.document.body) {
    

    if crashes again later on (jwindow.height() call). I guess

    jwindow = $(root);
    

    on 45 line is the reason (where root is only an object)

    bug 
    opened by mazavr 20
  • Unable to remove inital non-block PNotify notification after setup

    Unable to remove inital non-block PNotify notification after setup

    After setup (including the required .css and .js), I am unable to figure out how to remove the initial PNotify notification.

    Did some tweaks with body onload -> "PNotify.removeAll();" but doesn't seem like the legit manner and upon hovering over the spot of the initial PNotify, it comes back.

    I've also tried re-downloading the .css and .js without checking the non-block in non minified and minified versions but the initial PNotify was still there.

    Been looking high and low but doesn't seem like anyone having the same issue as me or perhaps its just me. Appreciate any help or pointers, thank you!

    question 
    opened by neoyeowyang 18
  • Merge pull requests #64 and #81.

    Merge pull requests #64 and #81.

    Merge @koppor bootstrap3 #64 koppor/bootstrap3. Merge @jugautam fontawesome #81 jugautam/master. This should also resolve PRs #78 #76 and makes reference to open issues #82 #72 #62 #60.

    If all parties can agree (@peteb4ker @juristr @panicoenlaxbox @jodytate @jbogdani) please close your individual Issues to regain some order around here in @sciactive's absence.

    opened by nickl- 17
  • Feature request: Add click event for notifications

    Feature request: Add click event for notifications

    It would be nice to be able to specify a click handling callback for each notification (or a global one I suppose). The handler would be called any time the notification is clicked unless the user is clicking the sticker or close buttons.

    This functionality could be used to perform the following actions:

    • Close the notification - Easier method to dismiss a notification than searching for the tiny button.
    • Stick/Unstick the notification - Easier method than searching for the button.
    • Take user to resource mentioned in the notification (either another URL or a hashtag for something on the current page).
    • Display more detailed content.
    • Maximize the notification.
    • Overlay the rest of the page with a blurring layer so that the notification is highlighted (i.e. like a jQuery modal dialog).
    • Some combination of the above.

    Of course I'm not asking that those actions be built-in. Those are just a few ideas I came up with that would be possible with a click handler and would really be nice to be able to do.

    Examples:

    $.pnotify({
        title: 'New message',
        text: 'You have a new message from Joe',
        click: function(){
            window.location.href = "http://mysite.com/messages/messageFromJoeId";
        }
    });
    
    $.pnotify({
        title: 'New message',
        text: 'You have a new message from Joe',
        click: function(){
            $(this).append('<div class="messageContents">Hey man, how\'s it going?</div>');
        }
    });
    
    enhancement wontfix 
    opened by aensley 17
  • Cut new release to NPM to support webpack

    Cut new release to NPM to support webpack

    A very important webpack fix was merged in #268, however a new release hasn't been made.

    The diff from version 3.0.0 to now: https://github.com/sciactive/pnotify/compare/3.0.0...master

    A new release would be much appreciated!

    (temporary solution)

    enhancement 
    opened by sman591 12
  • Initialize outside of page load

    Initialize outside of page load

    Is there a way to initialize PNotify outside of page load? I am specifically looking to load PNotify while using Turbo links. So it works fine if I am loading the page via a full load but it doesn't work when it loads through Turbo Links. The easiest fix to to add a hook into my Turbo Links code that can initialize PNotify uploading Turbo Links load. Is this possible? Otherwise I have to download and change core code.

    I was thinking something like this.

    PNotify.init();

    Or:

    $.pnotify(); enhancement 
    opened by wallerjake 11
  • Fix for

    Fix for "All" and "Last" history buttons

    The history buttons were not working properly. They were referencing a capture variable notices_data, which got out of sync with the global collection of notices because $.merge returns a new instance on each pnotify call. Because of this, the buttons only worked on the first notification opened.

    image

    opened by SonofNun15 11
  • Doesn't work with bootstrap 3 when download by bower

    Doesn't work with bootstrap 3 when download by bower

    Because B3 change clases for alert, so pnotify pops-up without style, then you try `$.pnotify.defaults.styling = 'bootstrap3';``

    but the console give you Uncaught TypeError: Cannot read property 'container' of undefined jquery.pnotify.min.js:19 BTW this happen using requireJS

    to load the script not the css

    enhancement 
    opened by alexrqs 11
  • Uncaught ReferenceError: PNotify is not defined

    Uncaught ReferenceError: PNotify is not defined

    I first installed PNotify using NPM like so... npm install pnotify --save

    It shows that it installed fine in my packages.json file... "pnotify": "^3.0.0"

    I then put these two in my head like so... `

    `

    I am getting the following error in my console in my google dev tools... GET http://localhost:8000/pnotify.custom.min.js

    When I call something like this using my jQuery... $(document).ready(function(){ $(function(){ new PNotify({ title: 'Regular Notice', text: 'Check me out! I\'m a notice.' }); }); })

    And am getting the following... Uncaught ReferenceError: PNotify is not defined GET http://localhost:8000/pnotify.custom.min.css

    Is this a bug, or am I just a noob? I would really like to use your product for a project I am doing if you could help me get it working. Thank you.

    question 
    opened by erikasland 10
  • Closing notification not shown

    Closing notification not shown

    The notification does not have the close button with the following code:

             new PNotify({
                    title: 'Successful',
                    text: 'User settings has been successfully save.',
                    styling: "bootstrap3",
                    type: "info",
                    icon: 'glyphicon glyphicon-ok'
                });
    
    bug 
    opened by kahwooi 10
  • Temporal fix for compile-time errors on angular apps for

    Temporal fix for compile-time errors on angular apps for "pnotify": "^5.2.0"

    This might not be a perfect fix but it takes care of the compile-time errors for my angular application.

    node_modules/@pnotify/core/Stack.d.ts you will have to modify line 1 to import { Notice } from './';

    replace line 193 to 208 with the code below swap( one: Notice, theOther: Notice, immediate: boolean, waitAfter: boolean ): Promise<unknown>;

    replace line 220 with the following fire(event: string, detail: {}): void;

    In @pnotify/core/index.d.ts file replace line 250 with open(immediate?: boolean): Promise<unknown>; and replace line 261 to 265 with close( immediate?: boolean, timerHide?: boolean, waitAfterward?: boolean ): Promise<unknown>;

    This fix worked for "pnotify": "^5.2.0", hopefully the next update will fix these error. Ummmm you might have to redo this again if you reinstall the same package.

    opened by samuelsonokoi 1
  • Why Svelte....

    Why Svelte....

    Fist thing I expect from a documentation, a basic example using nothing at all, any additional library NPM, Angular, Bambular....

    Could you just display a success message using simple html and pure js?

    What is the strict minimum to display a notification?

    Is

    https://cdn.jsdelivr.net/npm/@pnotify/[email protected]/dist/PNotify.min.js
    https://cdn.jsdelivr.net/npm/@pnotify/[email protected]/BrightTheme.min.css
    

    enought to display a success notification?

    question 
    opened by sdudnic 1
  • npm run build errors

    npm run build errors

    Cloned the git repo, did the usual 'npm i' on it.

    When I went to do 'npm run build' it returned some errors.

    At first it returned an error about 'rollup' missing, so I 'npm i -g rollup', then it got further and threw up an error on 'rollup-plugin-node-resolve', so I did 'npm i -g rollup-plugin-node-resolve'.

    Every attempt of running 'npm run build' after that kept failing at 'rollup-plugin-node-resolve', so I switched over to installing 'rollup' and 'rollup-plugin-node-resolve' locally instead by doing 'npm i rollup' and 'npm i rollup-plugin-node-resolve'.

    Then I got further, this time, I got stuck on 'rollup-plugin-svelte', and then 'rollup-plugin-babel' and 'rollup-plugin-postcss'.

    It seems every time I fix one rollup-plugin, another one just rears itself.

    Everytime I install one of these additional things, NPM tells me 'This package has been deprecated and is no longer maintained. Please use @rollup/plugin-...'.

    Since this has such a reliance on rollup and its plugins, possibly amend the package.json so that when a person freshly clones the git repo and runs 'npm i', it downloads everything required, and not just assume the person may have it installed?

    I don't use node all that much, it's not something I have any need for in my day to day work, I just wanted a fresh version of pnotify that I could customise where necessary.

    opened by ray73864 2
  • Cannot change default FontAwesome5 icons

    Cannot change default FontAwesome5 icons

    I'm trying to change the default icons but it doesn't seem to work.

    PNotify.defaultModules.set(PNotifyFontAwesome5Fix, {});
    PNotify.defaultModules.set(PNotifyFontAwesome5, {
        notice: 'fal fa-exclamation-circle',
        info: 'fal fa-info-circle',
        success: 'fal fa-check-circle',
        error: 'fal fa-exclamation-triangle',
    
        // Buttons Module
        closer: 'fal fa-times',
        sticker: 'fal',
        stuck: 'fa-play',
        unstuck: 'fa-pause',
    
        // Reference Module (Useful for other modules.)
        refresh: 'fal fa-sync'
    });
    
    opened by forxer 0
Releases(5.2.0)
  • 5.2.0(Nov 7, 2020)

    • Stack swap and events.
    • Notice open/close returns a promise now.
    • Roboto font support for Material theme.
    • New Paginate module to show pagination buttons and stack notice count.
    • New Angeler theme, designed by Angela Murrell.
    • Stacks can now be unpositioned, meaning notices flow in the normal flow.
    Source code(tar.gz)
    Source code(zip)
  • 5.1.2(Apr 29, 2020)

  • 5.1.1(Apr 27, 2020)

  • 5.1.0(Apr 21, 2020)

  • 5.0.1(Apr 18, 2020)

  • 5.0.0(Apr 17, 2020)

    PNotify 5!

    v5 is here! With many awesome new features, including dark mode and the brand new Modalish flow!

    This release has a ton of breaking changes since v4. They are listed in the migration doc: https://github.com/sciactive/pnotify/blob/79fc63951e7e673b78b1edb6d44c421acf22faf6/MIGRATING.md

    Be sure to also read the updated README: https://github.com/sciactive/pnotify/blob/79fc63951e7e673b78b1edb6d44c421acf22faf6/README.md

    There is a new process to install PNotify with only the modules you need, so migrating to the new individual packages is recommended.

    I hope you all enjoy the wealth of new features (and bugfixes)!

    • Hunter Perrin
    Source code(tar.gz)
    Source code(zip)
  • 4.0.1(Mar 6, 2020)

    • Update packages.

    PNotify v4 will receive some bug fixes soon, but no new features. PNotify v5 will be released in the near future, and that will be where I focus my development efforts.

    Source code(tar.gz)
    Source code(zip)
  • 5.0.0-alpha.6(Feb 29, 2020)

    • Broke out PNotify and its modules into their own packages.
    # Install the packages you need individually.
    
    # You definitely need this one.
    npm install --save-dev @pnotify/core
    # These are the optional ones.
    npm install --save-dev @pnotify/animate
    npm install --save-dev @pnotify/bootstrap3
    npm install --save-dev @pnotify/bootstrap4
    npm install --save-dev @pnotify/confirm
    npm install --save-dev @pnotify/desktop
    npm install --save-dev @pnotify/font-awesome4
    npm install --save-dev @pnotify/font-awesome5
    npm install --save-dev @pnotify/font-awesome5-fix
    npm install --save-dev @pnotify/glyphicon
    npm install --save-dev @pnotify/mobile
    
    # ...
    
    # Or, you can install this to get them all (if you're lazy).
    npm install --save pnotify
    
    Source code(tar.gz)
    Source code(zip)
  • 5.0.0-alpha.5(Feb 28, 2020)

  • 5.0.0-alpha.4(Feb 28, 2020)

    • A lot more changes to options and package structure.
    • Everything you wrote before is broken now.
    • Read the migration doc.

    https://github.com/sciactive/pnotify/blob/50f7b7c00747d7eeb957d0e3c664fac3e15c087d/MIGRATING.md

    Source code(tar.gz)
    Source code(zip)
  • 5.0.0-alpha.3(Feb 20, 2020)

  • 5.0.0-alpha.2(Feb 20, 2020)

  • 5.0.0-alpha.1(Feb 20, 2020)

    • So many breaking changes from v4.

    They're all listed in the migration doc: https://github.com/sciactive/pnotify/blob/8f6d3806ae3962b60d856f750ca1ad2ffe721126/MIGRATING.md (corrected)

    And don't forget the README for this version: https://github.com/sciactive/pnotify/blob/456f6106c5080f50c99f025047b6f6609837f6db/README.md

    Source code(tar.gz)
    Source code(zip)
  • 4.0.0(Apr 24, 2019)

  • 4.0.0-beta.2(Dec 5, 2018)

  • 4.0.0-beta.1(Nov 24, 2018)

    • Move peerDependencies to optionalDependencies. Closes #348.
    • Target elements inside notices for defining colors. Fixes #341
    • Focus first button or promptTrigger button on modal confirm dialog. Fixes. #229.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.0-alpha.4(May 17, 2018)

  • 4.0.0-alpha.3(Apr 24, 2018)

    • Add icon container ref.
    • Translate prompt_default to promptValue in PNotifyCompat.
    • Document icon container.
    • Don't create title/text elements if they are off.
    • Main file in package.json should be UMD.
    • NonBlock module rewritten to use NonBlock.js.
    • Changed the Material style module to no longer import Google fonts.
    • Migrate to Svelte v2.
    • Fixed Desktop module icon option.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.0-alpha.2(Feb 14, 2018)

    • Make sure PNotify works even if Array.prototype is edited.
    • Update Animate module speeds. Fixes #296.
    • Remove modal overlay element instead of hiding. Closes #301. Also fixed broken visibility detection.
    • Fixed NonBlock and Desktop module breaking when desktop notice is clicked. Fixes #154.
    • Added support for RTL languages. Closes #181.
    • Migrated all options to camelCase instead of snake_case. Closes #329.
    • New Compat module for running v3 code with v4.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.0-alpha.1(Jan 27, 2018)

    • jQuery is no longer required. v4 doesn't require any libraries, actually.
    • It's built using Svelte, which means it compiles down to vanilla JS.
    • PNotify now has an ES6 module build.
    • text_escape and title_escape have been replaced by trust_text and trust_title, and the default behavior changed.
    • insert_brs option has gone away. (Text and title now have white-space: pre-line;.)
    • The default width was raised from 300px to 360px.
    Source code(tar.gz)
    Source code(zip)
  • 3.2.1(Jul 31, 2017)

  • 3.2.0(Apr 24, 2017)

    Skipping 3.1.0, since there are some pretty big bugfixes and minor potentially breaking changes.

    REMOVED IN THIS VERSION

    • jQuery UI styling
    • Bootstrap 2 styling (what was left in the modules)

    If you need jQuery UI styling, you can run this code:

    PNotify.prototype.options.styling = {
      container: "ui-widget ui-widget-content ui-corner-all",
      notice: "ui-state-highlight",
      notice_icon: "ui-icon ui-icon-info",
      info: "",
      info_icon: "ui-icon ui-icon-info",
      success: "ui-state-default",
      success_icon: "ui-icon ui-icon-circle-check",
      error: "ui-state-error",
      error_icon: "ui-icon ui-icon-alert",
      // Include these for buttons module:
      closer: "ui-icon ui-icon-close",
      pin_up: "ui-icon ui-icon-pin-w",
      pin_down: "ui-icon ui-icon-pin-s",
      // Include these for confirm module:
      btn: "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only",
      btnhover: "ui-state-hover",
      btnactive: "ui-state-active",
      btnfocus: "ui-state-focus",
      input: "",
      text: "ui-button-text",
    };
    

    CHANGED IN THIS VERSION

    • Default animation speeds have been made faster. If you need a different speed, you can run this code:
    PNotify.prototype.options.animate_speed = 'custom';
    

    then add this CSS (replace X with your desired duration):

    .ui-pnotify.ui-pnotify-fade-custom {
      transition: opacity Xs linear;
      opacity: 0;
    }
    .ui-pnotify.ui-pnotify-fade-custom.ui-pnotify.ui-pnotify-move {
      transition: opacity Xs linear, left .5s ease, top .5s ease, right .5s ease, bottom .5s ease;
    }
    
    Source code(tar.gz)
    Source code(zip)
  • 3.0.1(Apr 21, 2017)

  • 3.0.0(Dec 21, 2015)

  • 2.1.0(Sep 3, 2015)

    This release includes various fixes and a new default theme, with no other requirements. The theme, called Bright Theme, is entirely CSS.

    Source code(tar.gz)
    Source code(zip)
  • 2.0.1(May 13, 2014)

    This is a relatively minor release with a few bug fixes and features:

    • Desktop notifications now support .update().
    • Confirm modules now supports prompts.
    • jQuery UI effects work again.
    • Modules now correctly support AMD. RequireJS is fully supported.

    Downloading Version 2.0.1

    Version 2.0 lets you choose what functionality to include in your build, so you must

    Download PNotify from the home page.

    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Apr 10, 2014)

    This release is chocked full of new features, bug fixes, and big changes.

    The biggest change by far is how you create a notice. No longer is it a jQuery function:

    $.pnotify("I'm a notice.");
    

    It's now a class that you can instantiate.

    new PNotify("I'm a notice.");
    

    This change has made it possible to break up PNotify's functionality into modules. Each module can be included to provide the additional functionality. If you don't need that functionality, you don't include that module, and you don't get that extra bloat across the wire!

    The next big change is support of the new Web Notification Draft. This allows you to notify your users, even when they're not on your page. They can be in a different tab, or a different application and still get notified. And if the user's browser doesn't support Web Notification, PNotify will fall back to a regular in-browser notice. This makes PNotify the best way to take advantage of the new Web Notification spec. Check it out under the Module Demos section of the home page.

    The last big change is confirmation dialogs. In the last release, one of the demos showed how you could craft a confirmation dialog, but it wasn't part of PNotify, and it was a lot of extra code. Now confirmation dialogs are part of PNotify, and they're very easy to create. Check it out under the Module Demos section of the home page

    Downloading Version 2.0.0

    Version 2.0.0 lets you choose what functionality to include in your build, so you must

    Download PNotify from the home page.

    Source code(tar.gz)
    Source code(zip)
  • 1.3.1(Mar 13, 2014)

  • 1.3.0(Mar 13, 2014)

Owner
SciActive
Hunter Perrin and friends, open source projects.
SciActive
🚀 The ultimate library for managing multi-channel notifications with a single API.

?? The ultimate library for managing multi-channel notifications with a single API.

Notifire 16.3k Jan 4, 2023
framework-agnostic styled alert system for javascript

SMOKE.JS - 0.1.3 Notify or get approval from your users quickly and with style. This alert system uses css animations and background (so there are no

j youngblood 934 Dec 25, 2022
🔔 a clean and simple notification, input, and selection suite for javascript, with no dependencies

notie notie is a clean and simple notification, input, and selection suite for javascript, with no dependencies Live demo: https://jaredreich.com/noti

Jared Reich 6.3k Dec 26, 2022
Pure JavaScript library for better notification messages

Toastify Toastify is a lightweight, vanilla JS toast notification library. Demo Click here Features Multiple stacked notifications Customizable No blo

Varun A P 1.3k Dec 30, 2022
Query for CSS brower support data, combined from caniuse and MDN, including version support started and global support percentages.

css-browser-support Query for CSS browser support data, combined from caniuse and MDN, including version support started and global support percentage

Stephanie Eckles 65 Nov 2, 2022
A Javascript based web application for monitoring, analytics and notifications

JELLYWATCH Jellywatch is a javascript web application for monitoring*, analytics** and notifications** inspired by tautulli for Jellyfin/Emby Media Se

null 27 Dec 28, 2022
Fnon is a client-side JavaScript library for models, loading indicators, notifications, and alerts which makes your web projects much better.

???????? Fnon is the name of my late mother, It's an Arabic word which means Art, I created this library in honor of her name. Fnon is a client-side J

Adel N Al-Awdy 5 Sep 11, 2022
A handy wrapper for the Web Notifications API

Notify.js A handy wrapper for using the Web Notifications API. Notify.js aims to simplify requesting user permission and associated Web Notification A

Alex Gibson 1.3k Dec 4, 2022
Simple javascript toast notifications

toastr toastr is a Javascript library for non-blocking notifications. jQuery is required. The goal is to create a simple core library that can be cust

null 11.5k Jan 6, 2023
A javascript framework for developing pretty browser dialogs and notifications.

AlertifyJS AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications. AlertifyJS is an extreme makeover of alertify

Mohammad Younes 2k Jan 2, 2023
✨ Small and Clean JavaScript Toast Notifications

BuzzNotify Small and Clean JavaScript Toast Notifications New version introduces breaking changes! Now the styles come separately and you will have to

R. Eliut 9 Aug 23, 2022
Kuldeep 2 Jun 21, 2022
A dependency-free JavaScript library for creating discreet pop-up notifications.

Polipop A dependency-free JavaScript library for creating discreet pop-up notifications. Demo See demo at minitek.github.io/polipop/. Documentation Se

Minitek 8 Aug 15, 2022
A lightweight JavaScript library for creating snackbar & toaster notifications.

Notify.js Notify.js is a lightweight (2.3kb) utility library for creating snackbar and toaster notifications. Installation Download Notify.js via NPM:

Kyle Andrews 7 Feb 13, 2022
Mobile app development framework and SDK using HTML5 and JavaScript. Create beautiful and performant cross-platform mobile apps. Based on Web Components, and provides bindings for Angular 1, 2, React and Vue.js.

Onsen UI - Cross-Platform Hybrid App and PWA Framework Onsen UI is an open source framework that makes it easy to create native-feeling Progressive We

null 8.7k Jan 8, 2023
Mobile app development framework and SDK using HTML5 and JavaScript. Create beautiful and performant cross-platform mobile apps. Based on Web Components, and provides bindings for Angular 1, 2, React and Vue.js.

Onsen UI - Cross-Platform Hybrid App and PWA Framework Onsen UI is an open source framework that makes it easy to create native-feeling Progressive We

null 8.7k Jan 4, 2023
Beautiful and interactive javascript charts for Java-based web applications.

Wicked Charts Beautiful and interactive JavaScript charts for Java-based web applications. Check out the Changelog Check out the Feature Overview with

adesso SE 85 Aug 23, 2022
Multiple file upload plugin with image previews, drag and drop, progress bars. S3 and Azure support, image scaling, form support, chunking, resume, pause, and tons of other features.

Fine Uploader is no longer maintained and the project has been effectively shut down. For more info, see https://github.com/FineUploader/fine-uploader

Fine Uploader 8.2k Jan 2, 2023
The official proxy of Titanium Network with enhanced support for a large majority of sites with hCAPTCHA support. Successor to Alloy Proxy.

Corrosion Titanium Networks main web proxy. Successor to Alloy Installation: npm i corrosion Example: const Corrosion = require('corrosion'); const p

Titanium Network 79 Dec 21, 2022
🟢 OneForAll Support Bot - Is a support bot for the discord server of OFA!

?? OneForAll Support Bot - Is a support bot for the discord server of OFA! Setup You can setup OneForAll Support Bot by simply opening your terminal/c

baby 3 Oct 15, 2022