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

@tmdjr/ngx-navigational-list

v0.0.12

Published

This library provides a service for managing hierarchical navigation data in micro frontend applications using Angular 20.

Readme

NgxNavigationalList

This library provides a service for managing hierarchical navigation data in micro frontend applications using Angular 20.

Installation

npm install @tmdjr/ngx-navigational-list

Usage

Basic Setup

import { Component, OnInit } from "@angular/core";
import { NgxNavigationalListService, NavigationData, HierarchicalMenuItem } from "@tmdjr/ngx-navigational-list";
import { Observable } from "rxjs";

@Component({
  selector: "app-navigation",
  templateUrl: "./navigation.component.html",
})
export class NavigationComponent implements OnInit {
  headerNavigation$: Observable<HierarchicalMenuItem[]>;

  constructor(private navService: NgxNavigationalListService) {
    this.headerNavigation$ = this.navService.getFilteredNavigationBySubtypeAndState("HEADER", "FULL");
  }

  ngOnInit() {
    // Set navigation data received from the shell
    const navigationData: NavigationData = {
      domain: "ADMIN",
      structuralSubtypes: {
        HEADER: {
          states: {
            FULL: [
              {
                _id: "68d097bb26641456d521c398",
                menuItemText: "Dashboard",
                routePath: "/dashboard",
                sortId: 0,
                authRequired: false,
                domain: "ADMIN",
                structuralSubtype: "HEADER",
                state: "FULL",
                version: 1,
                description: "Dashboard page",
                lastUpdated: "2025-09-22T01:29:31.104Z",
                archived: false,
                __v: 0,
              },
              {
                _id: "68d03a5b26641456d521c2db",
                menuItemText: "Mission Controls",
                routePath: "/mission-controls",
                sortId: 3,
                authRequired: false,
                domain: "ADMIN",
                structuralSubtype: "HEADER",
                state: "FULL",
                version: 3,
                description: "Mission control center",
                lastUpdated: "2025-09-22T01:29:31.104Z",
                archived: false,
                __v: 0,
              },
              {
                _id: "68d0a16926641456d521c431",
                menuItemText: "Broadcast",
                routePath: "/broadcast",
                sortId: 0,
                authRequired: false,
                parentId: "68d03a5b26641456d521c2db",
                domain: "ADMIN",
                structuralSubtype: "HEADER",
                state: "FULL",
                version: 1,
                description: "Broadcast management",
                lastUpdated: "2025-09-22T01:29:31.104Z",
                archived: false,
                __v: 0,
              },
            ],
          },
        },
      },
    };

    this.navService.setNavigationData(navigationData);
    this.navService.setAuthenticationState(true);
  }
}

Template Example

<!-- navigation.component.html -->
<nav class="navigation">
  <ul class="nav-list">
    <li *ngFor="let menuItem of headerNavigation$ | async; trackBy: trackByMenuItemId" class="nav-item" [class.has-children]="menuItem.children.length > 0">
      <a [routerLink]="menuItem.routePath" class="nav-link" [title]="menuItem.tooltipText"> {{ menuItem.menuItemText }} </a>

      <!-- Render child items recursively -->
      <ul *ngIf="menuItem.children.length > 0" class="sub-nav-list">
        <li *ngFor="let childItem of menuItem.children; trackBy: trackByMenuItemId" class="sub-nav-item">
          <a [routerLink]="childItem.routePath" class="sub-nav-link" [title]="childItem.tooltipText"> {{ childItem.menuItemText }} </a>

          <!-- Continue nesting for deeper levels if needed -->
          <ul *ngIf="childItem.children.length > 0" class="sub-sub-nav-list">
            <li *ngFor="let grandChildItem of childItem.children; trackBy: trackByMenuItemId" class="sub-sub-nav-item">
              <a [routerLink]="grandChildItem.routePath" class="sub-sub-nav-link" [title]="grandChildItem.tooltipText"> {{ grandChildItem.menuItemText }} </a>
            </li>
          </ul>
        </li>
      </ul>
    </li>
  </ul>
</nav>

Component Methods

export class NavigationComponent implements OnInit {
  // ... other code

  trackByMenuItemId(index: number, item: HierarchicalMenuItem): string {
    return item._id;
  }

  // Get specific navigation for different states
  getCompactNavigation() {
    return this.navService.getFilteredNavigationBySubtypeAndState("HEADER", "COMPACT");
  }

  // Find a specific menu item
  findMenuItem(id: string) {
    return this.navService.findMenuItemById(id);
  }

  // Get current domain
  getCurrentDomain() {
    return this.navService.getCurrentDomain();
  }
}

API Reference

Types

  • NavigationData: The main data structure received from the shell
  • HierarchicalMenuItem: Menu item with populated children array
  • OrganizedNavigation: Processed navigation with hierarchy
  • StructuralSubtype: 'HEADER' | 'NAV' | 'FOOTER'
  • Domain: 'ADMIN' | 'WORKSHOP'
  • MenuState: 'FULL' | 'RELAXED' | 'COMPACT'

Service Methods

Core Methods

  • setNavigationData(data: NavigationData): Set the navigation data
  • setAuthenticationState(isAuthenticated: boolean): Update auth state

Navigation Retrieval

  • getNavigationBySubtypeAndState(subtype, state): Get raw navigation
  • getFilteredNavigationBySubtypeAndState(subtype, state): Get filtered by auth
  • findMenuItemById(id): Find specific menu item
  • getCurrentDomain(): Get current domain
  • getAvailableSubtypes(): Get available structural subtypes
  • getAvailableStates(subtype): Get available states for subtype

Utility Methods

  • flattenMenuItems(items): Flatten hierarchical structure

Features

  • Hierarchical Structure: Automatically builds parent-child relationships using parentId
  • Authentication Filtering: Filters menu items based on authRequired and user auth state
  • Sorting: Automatically sorts items by sortId at all levels
  • Multiple States: Supports FULL, RELAXED, COMPACT menu states
  • Multiple Domains: Supports ADMIN and WORKSHOP domains
  • TypeScript: Full TypeScript support with comprehensive types
  • RxJS Observables: Reactive data flow for real-time updates
  • Utility Functions: Helper functions for searching, filtering, and manipulation

Data Structure

The service expects navigation data in this format:

{
  "domain": "ADMIN",
  "structuralSubtypes": {
    "HEADER": {
      "states": {
        "FULL": [
          {
            "_id": "unique-id",
            "menuItemText": "Menu Item",
            "routePath": "/path",
            "sortId": 0,
            "authRequired": false,
            "parentId": "parent-id-optional",
            "domain": "ADMIN",
            "structuralSubtype": "HEADER",
            "state": "FULL",
            "version": 1,
            "description": "Description",
            "lastUpdated": "2025-09-22T01:29:31.104Z",
            "archived": false,
            "__v": 0
          }
        ]
      }
    }
  }
}

The service automatically converts this flat structure into a hierarchical menu tree based on the parentId relationships.