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

ngx-signal-router

v1.0.0

Published

Production-ready, type-safe Signal-first Angular Router state access library with built-in codecs, schema inference, and SSR/Zoneless support.

Readme

ngx-signal-router ⚡

Production-Ready, Type-Safe Signal-First Angular Router State Access Library.

ngx-signal-router brings native Angular Signals to ActivatedRoute parameter access, query strings, fragments, titles, route data, and whole-query schemas with built-in codecs, non-permissive type coercion, subscription sharing, and zero memory leaks.


Features

  • ⚡ Native Angular Signals: Replaces RxJS subscriptions with reactive Signal<T> getters for all route state.
  • 📦 Shared Subscriptions: Multiple derived signals off the same route share underlying subscriptions (bounded 6 source signals per route).
  • 🛡️ Type-Safe Codec System: Includes non-permissive built-in codecs (stringParam, numberParam, integerParam, booleanParam, dateParam, dateTimeParam, enumParam, literalParam, jsonParam, customParam, arrayParam, csvParam).
  • 📋 Whole-Query Schemas: Define entire query parameter contracts with defineQuerySchema() and parse them into single typed signals via queryParamsSignal() or route.schema().
  • 🔐 Security Hardened: Built-in defense against prototype pollution (__proto__, constructor, prototype filtered).
  • 🧪 Consumer Testing Harness: Secondary entry point ngx-signal-router/testing with createRouteSignalTestContext() and provideRouteSignalTesting() for synchronous unit testing without complex router mocks.
  • 🌐 SSR & Zoneless Native: Works seamlessly with Server-Side Rendering (SSR/Hydration) and Zoneless Angular 20–22 applications.

Installation

npm install ngx-signal-router

Quick Start

1. Unified Facade (injectRouteSignals)

import { Component } from '@angular/core';
import { injectRouteSignals, integerParam, booleanParam, defineQuerySchema, stringParam } from 'ngx-signal-router';

const filterSchema = defineQuerySchema({
  page: integerParam({ defaultValue: 1, min: 1 }),
  search: stringParam({ trim: true, defaultValue: '' }),
  activeOnly: booleanParam({ defaultValue: true }),
});

@Component({
  standalone: true,
  template: `
    <h1>User #{{ userId() }}</h1>
    <p>Page: {{ query().page }}</p>
    <p>Search: {{ query().search }}</p>
  `,
})
export class UserDetailComponent {
  readonly route = injectRouteSignals();

  // Route parameter with integer coercion
  readonly userId = this.route.param('id', integerParam({ required: true }));

  // Whole-query schema signal
  readonly query = this.route.schema(filterSchema);
}

2. Standalone Signals

import { Component } from '@angular/core';
import { routeParamSignal, queryParamSignal, integerParam } from 'ngx-signal-router';

@Component({
  standalone: true,
  template: `<p>User ID: {{ userId() }} (Page {{ page() }})</p>`,
})
export class UserComponent {
  readonly userId = routeParamSignal('id', integerParam({ required: true }));
  readonly page = queryParamSignal('page', integerParam({ defaultValue: 1 }));
}

Codecs

| Codec | Usage | Coercion Rules | | :--- | :--- | :--- | | stringParam | stringParam({ trim: true }) | String trimming, empty string fallback | | integerParam | integerParam({ min: 1, max: 100 }) | Strict integer regex /^-?\d+$/ (rejects "12abc") | | numberParam | numberParam({ defaultValue: 0 }) | Strict float parsing | | booleanParam | booleanParam({ trueValues: ['true', '1'] }) | Strict explicit truthy/falsy list | | dateParam | dateParam({ format: 'YYYY-MM-DD' }) | Strict calendar date validation (rejects invalid leap years) | | enumParam | enumParam(StatusEnum) | String enum matching | | arrayParam | arrayParam(integerParam()) | Coerces repeated query parameters (?tag=1&tag=2) | | csvParam | csvParam(stringParam()) | Delimited string parsing (?tags=angular,signals) |


Testing (ngx-signal-router/testing)

import { TestBed } from '@angular/core';
import { createRouteSignalTestContext } from 'ngx-signal-router/testing';
import { UserComponent } from './user.component';

describe('UserComponent', () => {
  it('should update state synchronously when query parameters change', () => {
    const testContext = createRouteSignalTestContext({
      params: { id: '42' },
      queryParams: { page: '3' },
    });

    TestBed.configureTestingModule({
      providers: [
        { provide: ActivatedRoute, useValue: testContext.route },
      ],
    });

    const fixture = TestBed.createComponent(UserComponent);
    const instance = fixture.componentInstance;

    expect(instance.userId()).toBe(42);
    expect(instance.page()).toBe(3);

    // Update state dynamically without full router navigation
    testContext.setQueryParams({ page: '10' });
    expect(instance.page()).toBe(10);
  });
});

License

MIT © Antigravity Team