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

@nmrhub/notifications

v0.1.0

Published

Backend-agnostic Angular notification/toast service shared across NMRhub and USNAN projects. A glassmorphism snackbar that renders through either Angular Material or PrimeNG - install whichever you already use.

Downloads

105

Readme

@nmrhub/notifications

A small, backend-agnostic Angular notification service shared across the NMRhub and USNAN projects. It shows the "glassmorphism" toast/snackbar those apps use, and renders through either Angular Material or PrimeNG — you install whichever your app already uses; neither is a hard dependency.

The core service owns the message model, the well-known API-error handling, and the post-dismissal navigation. The actual presentation is delegated to a pluggable NotificationRenderer, picked by importing one of the optional entry points.

Installation

npm install @nmrhub/notifications

Required peers (Angular 21): @angular/core, @angular/common, @angular/router, rxjs.

Optional peers — install only the one matching your chosen backend:

  • Material backend: @angular/material, @angular/cdk
  • PrimeNG backend: primeng

Usage

1. Provide a backend in your app config

Angular Material:

import { provideMaterialNotifications } from '@nmrhub/notifications/material';
import { environment } from './environments/environment';

export const appConfig: ApplicationConfig = {
  providers: [
    // ...
    provideMaterialNotifications({
      apiName: 'the NMRhub API',
      validRedirects: environment.validRedirects,
    }),
  ],
};

PrimeNG:

import { providePrimeNgNotifications } from '@nmrhub/notifications/primeng';

export const appConfig: ApplicationConfig = {
  providers: [
    // ...
    providePrimeNgNotifications({
      apiName: 'the NMRhub API',
      validRedirects: environment.validRedirects,
    }),
  ],
};

The PrimeNG backend additionally needs a <p-toast> rendered somewhere in your app template, plus the glass stylesheet (see PrimeNG styling):

<p-toast />

2. Inject and use the service

The service API is identical regardless of backend:

import { NotificationService } from '@nmrhub/notifications';

export class SomeComponent {
  private notifications = inject(NotificationService);

  save() {
    this.api.save().subscribe({
      next: response => this.notifications.sendMessageFromAPI(response),
      error: error => this.notifications.sendMessageFromAPIError(error),
    });
  }

  greet() {
    this.notifications.newMessage('Saved!', 'success', 5000);
  }
}

Configuration

provideMaterialNotifications / providePrimeNgNotifications accept a NotificationConfig:

| Field | Default | Description | |-------|---------|-------------| | validRedirects | [] | URL prefixes safe for a full browser navigation on navigate_to. Anything else routes via the Angular Router. | | navigate | — | Replace navigation entirely with your own callback (e.g. an existing redirect service). | | defaultTimeout | 15000 | Timeout (ms) applied to messages built from an API response. | | apiName | "the API" | Woven into the default error copy. | | errorMessages | composed | Override the 413 / 500 / generic error copy individually. | | colors | brand defaults | Per-type base colours (info/success/warning/error). |

Theming

Tints default to the NMRhub brand colours — blue info, green success, amber warning, red error — in both backends. The renderer applies the glass treatment (translucency + blur) on top of whatever base colour is in effect.

Override per type either through config:

providePrimeNgNotifications({
  colors: { success: '#1cac54', error: '#c0392b' },
})

…or directly via CSS custom properties (only the types you set are changed):

:root {
  --nmr-notify-info:    #1a87bd;
  --nmr-notify-success: #1cac54;
  --nmr-notify-warning: #d9a441;
  --nmr-notify-error:   #da5050;
}

The PrimeNG backend additionally falls back to the active theme palette (--p-blue-500, --p-green-500, …) when a type has no explicit override, before the brand colour. The Material backend uses the brand colour directly (Material exposes no suitable semantic success/warning tokens).

PrimeNG styling

Include the shipped glass stylesheet once, globally — e.g. in angular.json:

{
  "styles": [
    "node_modules/@nmrhub/notifications/assets/primeng-glass.css"
  ]
}

Exports

@nmrhub/notifications (core)

| Name | Kind | Description | |------|------|-------------| | NotificationService | service | The injectable service (newMessage, sendMessage, sendMessageFromAPI, sendMessageFromAPIError, clearMessage). | | NotificationMessage | class | The message model (constructor, fromAPI). | | NotificationApiResponse | interface | The API response envelope shape. | | NotificationType | type | 'info' \| 'success' \| 'warning' \| 'error'. | | NotificationConfig | interface | Host configuration shape. | | NotificationColors | type | Per-type colour overrides (Partial<Record<NotificationType, string>>). | | provideNotificationConfig | function | Provide just the config (for custom renderers). | | applyNotificationColorVars | function | Apply colors as --nmr-notify-* CSS vars (called by the built-in renderers). | | NotificationRenderer | abstract class | The pluggable presentation contract / DI token. | | NotificationHandle, RenderedNotification | interface | Renderer-facing types. |

@nmrhub/notifications/material

| Name | Kind | Description | |------|------|-------------| | provideMaterialNotifications | function | Wire up the Material backend. | | MaterialNotificationRenderer | class | The MatSnackBar-based renderer. | | GlassSnackBarComponent | component | The glassmorphism snackbar. |

@nmrhub/notifications/primeng

| Name | Kind | Description | |------|------|-------------| | providePrimeNgNotifications | function | Wire up the PrimeNG backend. | | PrimeNgNotificationRenderer | class | The MessageService-based renderer. |

Custom backends

Implement NotificationRenderer and provide it alongside provideNotificationConfig(...):

providers: [
  provideNotificationConfig({ apiName: 'the NMRhub API' }),
  { provide: NotificationRenderer, useClass: MyCustomRenderer },
]

Development

npm install
npm run build      # ng-packagr → dist/ (Angular Package Format, all entry points)

Publish with npm run release (clean build, then publishes the built dist/).