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

@atlasng/common

v0.0.11

Published

Common library for AtlasNG

Readme

@atlasng/common

Shared Angular utilities used by AtlasNG libraries and applications: a link directive that handles internal routes and external URLs in one API, a pluggable link-handling strategy, and a DOM-safe ID generator.

Installation

npm install @atlasng/common

@angular/router is a peer dependency, but it only has to be configured when you opt into router-based link handling.

Usage

Links

AnyLink ([angAnyLink]) renders and navigates links. It accepts the same commands as routerLink (a path string, a command array, or a UrlTree) as well as absolute URLs, and it supports the familiar router inputs such as queryParams, fragment, replaceUrl, and state.

import { Component } from '@angular/core';
import { AnyLink, AnyLinkActive } from '@atlasng/common';

@Component({
  selector: 'app-nav',
  imports: [AnyLink, AnyLinkActive],
  template: `
    <nav angAnyLinkActive="active" ariaCurrentWhenActive="page">
      <a angAnyLink="/docs" [queryParams]="{ tab: 'intro' }">Docs</a>
      <a angAnyLink="https://github.com/cns-iu/AtlasNG" target="_blank">GitHub</a>
    </nav>
  `,
})
export class Nav {}

On anchor-like hosts the directive sets href, target, rel, and download. On other elements it adds tabindex="0" (unless one is set) so the link stays keyboard-reachable, adds role="link" unless the host has its own role or is a <button>, and navigates when Enter is pressed on the host.

AnyLinkActive ([angAnyLinkActive]) applies CSS classes, and optionally aria-current, while a link is active. Place it on the link itself or on an ancestor to track every descendant AnyLink. Use angAnyLinkActiveOptions to control matching (for example { exact: true }) and the isActiveChange output to react to changes.

Link handlers

A LinkHandler decides how links are resolved, navigated, and matched as active. Choose one at bootstrap with provideLinkHandler:

import { provideRouter } from '@angular/router';
import { provideLinkHandler, withRouterHandler } from '@atlasng/common';

bootstrapApplication(App, {
  providers: [provideRouter(routes), provideLinkHandler(withRouterHandler())],
});

| Feature | Behavior | | ------------------------- | ------------------------------------------------------------------------------- | | withRouterlessHandler() | Default. Uses native anchors and window.location; no provideRouter needed. | | withRouterHandler() | Navigates internal routes with the Angular Router. | | withCustomHandler(fn) | Uses a handler returned by fn, for example a subclass of RouterLinkHandler. |

The routerless handler still imports UrlSerializer and UrlTree from @angular/router, so the package must be installed, but no router configuration is required. It ignores URLs with unsafe schemes such as javascript: instead of passing them to location.assign, drops null and undefined query params the same way the Router does, and updates active state on popstate, hashchange, and its own navigations.

Only one handler feature may be passed; development builds throw if more are provided. Router-only inputs such as state or skipLocationChange produce a development warning when used with the routerless handler.

ID generator

IdGenerator creates unique, DOM-safe IDs for id, aria-labelledby, and similar attributes.

import { inject } from '@angular/core';
import { IdGenerator } from '@atlasng/common';

const id = inject(IdGenerator).getId('ang-tooltip'); // "ang-tooltip-0", "ang-tooltip-1", ...

IDs include the application's APP_ID when it is not the default ng. Production builds also add a random infix so that IDs from multiple Angular applications on the same page do not collide. Use provideIdGeneratorConfig({ infix }) to set a fixed infix (string), always use a random one (true), or turn it off (false).