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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ziocampo/ngx-perfect-layout

v0.1.17

Published

The perfect layout for your Angular app: responsiveness, eye candy and many other features.

Downloads

47

Readme

NgxPerfectLayout

The perfect layout for your Angular app: responsiveness, eye candy and many other features.

Demo

Why?

Because in each project based on the Angular framework I was copy/pasting the wheel, changing small details every time. Elder projects would not benefit from the enhancements made in new ones. A general frustration arose.

Features

Developer friendly

Just import the module in your app.module.ts

import { NgxPerfectLayoutModule, NgxPerfectLayoutService } from '@ziocampo/ngx-perfect-layout';

imports: [
  NgxPerfectLayoutModule,
],  
providers: [
    NgxPerfectLayoutService
]

Then use the component right in the app.component.html:

<ngx-perfect-main-layout>
    <ngx-perfect-page-header-left>
        header left zone
    </ngx-perfect-page-header-left>
    <ngx-perfect-page-header-right>
        header right zone
    </ngx-perfect-page-header-right>
    <ngx-perfect-page-content>
        <router-outlet></router-outlet>
    </ngx-perfect-page-content>
    <ngx-perfect-page-footer-left>
        footer left zone
    </ngx-perfect-page-footer-left>
    <ngx-perfect-page-footer-right>
        footer right zone
    </ngx-perfect-page-footer-right>
</ngx-perfect-main-layout>

For more details refer to the showcase project.

Service centerer for options

NgxPerfectLayout is centered around the NgxPerfectLayoutService. Any options you should want to set are there. In any component you can ask for the service by DI:

import { NgxPerfectLayoutService } from '@ziocampo/ngx-perfect-layout';

constructor(
  private _layoutService: NgxPerfectLayoutService
) { }

and then set some option as shown below.

A decent layout, optimized for responsiveness

Layout automatically adapts to many resolutions, from large panels to small ones.

Snap points are the ones that come with the @angular/flex-layout package.

Layout image 1

Layout image 2

A nice "wait" animation

Just by toggling a bool option you can display a nice wait animation.

this._layoutService.showWaitingAnimation = true;

Wait animation image 1

Support for your own themes or for the standard ones

NgxPerfectLayout supports standard Angular themes (Indigo Pink etc.) as well as custom ones you can craft manually or at Material Theme Generator

To provide a list of custom themes just import them as usual in your styles.scss and declare a list of Theme objects:

import { Theme } from '@ziocampo/ngx-perfect-layout';

public themes: Theme[] = [{
    displayName: "Blue tango",
    name: "blue-tango-theme"
}, {
    displayName: "Coffee",
    name: "coffee-theme"
}, {
    displayName: "Relax",
    name: "relax-theme"
}];

then assign it to the themes parameter:

this._layoutService.themes = themes;

The themes will be displayed in a mat-select within the app drawer and applied upon the (selectionChange).

With standard theme image 1

Menu from angular routes, the easy way

When you define your routes, just add a data element of type RouteData

import { RouteData } from '@ziocampo/ngx-perfect-layout';

export const routes: Routes = [
  {
    path: "",
    pathMatch: "full",
    redirectTo: "home"
  },
  {
    path: "home", 
    component: HomePageComponent,
    data:{
      displayName: "Home",
      iconClass: "la-home"
    } as RouteData
  },
  {
    path: "no-options", 
    component: NoOptionsPageComponent,
    data:{
      displayName: "No options",
      iconClass: "la-broom"
    } as RouteData
  }
];

then pass your routes to the routes parameter. Routes containing a RouteData element with a displayName will be shown as navigation.

this._layoutService.routes = routes;

If you want to have hierarchical menus (just one level) you can group menu items by adding a groupName:string property in the RouteData element:

  {
    path: "child1", 
    component: NoOptionsPageComponent,
    data:{
      displayName: "Child 1",
      iconClass: "la-broom",
      groupName:"With children"
    }as RouteData
  },
  {
    path: "child2", 
    component: NoOptionsPageComponent,
    data:{
      displayName: "No options",
      iconClass: "la-stream",
      groupName: "With children"
    }as RouteData
  },

Your hierarchical menu will be displayed as an expansion panel:

Menu with children image 1

All the options

| Option | Meaning | Type | Default value | |------------------------|-----------------------------------------------------------------------------------------------------------|---------|---------------| | title | The title of the page. If provided the page will display an H1 tag with the title. | string | undefined | | routes | A Routes object. | Routes | undefined | | themes | An array of Theme objects. If provided there will be a select in the drawer to allow switching the theme. | Theme[] | [] | | showWaitingAnimation | If set to true a nice wait animation will be shown. | boolean | false | | useBackgroundAnimation | If set to true a nice animated background will be shown on the drawer. | boolean | false | | loginMode | If set to true hides anything not compatible with a login page, e.g.: drawer. | boolean | false | | hamburgerMenuButtonPosition | Position of the drawer and drawer toggle. | "left", "right" | "left" | | menuMinWidth | Minimum width of the menu, can be any CSS unit. | string | "260px" |