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

@wiltech-labs/ngx-notifications

v1.0.0

Published

Shared Angular notification bell — polling-based, fully app-pluggable (you supply fetch/dismiss/open), Material-free (CDK Overlay for the panel).

Readme

@wiltech-labs/ngx-notifications

A notification bell + unread badge + dropdown panel. Polling, not websockets — you supply three callbacks (fetch, dismiss, open), and this package handles the interval, the unread count, and the panel UI.

Installation

npm install @wiltech-labs/ngx-notifications

Peer dependencies: @angular/core, @angular/common, @angular/cdk (for the dropdown panel — no Angular Material dependency).

Setup

// app.config.ts
import { ApplicationConfig, inject } from '@angular/core';
import { Router } from '@angular/router';
import { provideNotifications } from '@wiltech-labs/ngx-notifications';
import { ApiClientService } from '@wiltech-labs/ngx-api-client';
import { CurrentUserStore } from '@wiltech-labs/ngx-region-settings';

interface Notification {
  id: string;
  title: string;
  body: string;
  read: boolean;
  links: { dismiss?: { href: string }; target?: { href: string } };
}

export const appConfig: ApplicationConfig = {
  providers: [
    // ...
    provideNotifications<Notification>(() => {
      // Runs once, inside a real injection context (provideNotifications() wires this factory up
      // via useFactory) — inject() here is safe. The callbacks below run later, on a poll tick or a
      // dismiss click, with no injection context of their own, so they close over api/currentUser
      // instead of calling inject() themselves.
      const api = inject(ApiClientService);
      const currentUser = inject(CurrentUserStore);
      const router = inject(Router);

      return {
        fetchNotifications: async () => {
          const link = currentUser.link('notifications');
          if (!link) return { items: [], unreadCount: 0 };
          return api.get<'notifications', { items: Notification[]; unreadCount: number }>(
            'notifications',
            api.resolve(link)!,
          );
        },
        dismissNotification: async (notification) => {
          await api.delete(api.resolve(notification.links.dismiss)!);
        },
        openNotification: (notification) => {
          void router.navigate(['/', notification.links.target?.href]);
        },
      };
    }),
  ],
};

This package never imports @wiltech-labs/ngx-api-client (or any HTTP client) itself — resolving the notifications link and calling your API is entirely your callback's job. ngx-region-settings' CurrentUserStore.link('notifications') is a convenient (optional) way to get that link if you're already using that package; nothing here depends on it.

provideNotifications() takes a factory, not a plain config object — see the code comment above (and this package's own CLAUDE.md) for why: the callbacks it returns run later, outside any injection context, so they can't call inject() directly themselves.

Usage

<ngx-notifications>
  <ng-template let-notification>
    <strong>{{ notification.title }}</strong>
    <p>{{ notification.body }}</p>
  </ng-template>
</ngx-notifications>

Drop it into your nav bar — no inputs required. Clicking a notification's body calls your openNotification callback and closes the panel; clicking its dismiss button calls dismissNotification and refreshes the list. The projected <ng-template let-notification> is almost always worth providing — without one, the panel falls back to a raw JSON dump of each item (useful for wiring this up, not for shipping).

Reading state from logic

import { Component, inject } from '@angular/core';
import { NotificationsService } from '@wiltech-labs/ngx-notifications';

@Component({ selector: 'app-something' /* ... */ })
export class Something {
  protected readonly notifications =
    inject<NotificationsService<Notification>>(NotificationsService);
  // notifications.notifications(), notifications.unreadCount(), notifications.loading(), notifications.error()
}

Config

interface NotificationsConfig<TNotification> {
  fetchNotifications: () => Promise<{ items: TNotification[]; unreadCount: number }>;
  dismissNotification: (notification: TNotification) => Promise<void>;
  openNotification: (notification: TNotification) => void;
  pollIntervalMs?: number; // default 5 minutes
}

unreadCount is whatever your fetchNotifications() returns — this package never inspects an item's fields to guess which ones are unread.

Layout

src/
├── public-api.ts
└── lib/
    ├── config/             # NotificationsConfig, NGX_NOTIFICATIONS_CONFIG, NGX_NOTIFICATIONS_TEXT
    ├── services/notifications.service.ts   # NotificationsService
    ├── providers/provide-notifications.ts  # provideNotifications()
    └── components/notifications-widget/    # NotificationsWidget

Status

Not yet published to npm — under development.

Publishing

To publish this package to npm:

cd packages/notifications
npm run build
cd dist
npm publish

Ensure version in the source package.json is updated before building, per semver conventions.