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

@luisli/menu-topbar-sidebar-test-lib

v1.0.0

Published

Reusable Angular menu library (sidebar + topbar)

Readme

Menu Library

A reusable Angular library for creating configurable sidebars and topbars following Domain-Driven Design (DDD) principles.

Features

  • DDD Architecture: Organized into Domain, Application, Infrastructure, and Presentation layers.
  • Design Patterns: Implements Factory Method, Strategy, and Adapter patterns.
  • Configurable: Easily customize themes, layouts, and permissions.
  • Extensible: Add new menu items, roles, and permissions dynamically.
  • Standalone Components: Built with Angular standalone components for easy integration.

Installation

npm install menu-lib

Usage

Basic Setup

  1. Import the library in your app.config.ts:
import { provideMenuLib } from 'menu-lib';

export const appConfig: ApplicationConfig = {
  providers: [
    provideMenuLib()
  ]
};
  1. Use the components in your template:
<lib-sidebar [userPermissions]="userPermissions" [userRoles]="userRoles" theme="default"></lib-sidebar>
<lib-topbar [userPermissions]="userPermissions" [userRoles]="userRoles" theme="default"></lib-topbar>
  1. Configure the menu in your component:
import { MenuService, MenuFactory, MenuItem } from 'menu-lib';

export class AppComponent implements OnInit {
  userPermissions = ['read', 'write'];
  userRoles = ['admin'];

  constructor(private menuService: MenuService) {}

  ngOnInit(): void {
    const items = [
      MenuItem.simple('home', 'Home', '/home', '🏠'),
      MenuItem.simple('profile', 'Profile', '/profile', '👤', ['read'], ['admin'])
    ];

    const menu = MenuFactory.createStaticMenu('main-menu', 'Main Menu', items);
    this.menuService.setMenu(menu);
  }
}

Advanced Configuration

Using Adapters for Dynamic Configuration

import { MenuConfigService, JsonMenuAdapter } from 'menu-lib';

const jsonData = [
  { id: 'home', name: 'Home', url: '/home' },
  { id: 'settings', name: 'Settings', url: '/settings' }
];

const adapter = new JsonMenuAdapter(jsonData);
menuConfigService.setAdapter(adapter);

Custom Themes

<lib-sidebar theme="dark"></lib-sidebar>

Permission-Based Visibility

The library automatically filters menu items based on user permissions and roles.

API Reference

Components

  • SidebarComponent: Displays a vertical sidebar menu.
  • TopbarComponent: Displays a horizontal topbar menu.

Services

  • MenuService: Manages the current menu state.
  • PermissionService: Handles permission and role validation.
  • MenuConfigService: Manages configuration adapters.

Factories

  • MenuFactory: Creates menu instances with different configurations.

Domain Objects

  • MenuItem: Represents a single menu item.
  • Menu: Represents a collection of menu items.
  • MenuConfig: Configuration for menu appearance and behavior.

Contributing

  1. Fork the repository.
  2. Create a feature branch.
  3. Make your changes.
  4. Run tests: ng test menu-lib.
  5. Build: ng build menu-lib.
  6. Submit a pull request.

License

MIT