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

nitro-popup

v0.2.0-ng17

Published

Nitro Popup is an Angular Library Component for creating animated / non-animated Popups & even also for overriding Browser context menu with custom Menu also.

Downloads

62

Readme

Nitro Popup

Angular Library - Nitro Popup

Angular Library - Nitro Popup

This Documentation is incomplete, please check this link for detailed Documentation.

Nitro Popup can be used for Popups / Modals / Dialog Boxes and even also this can be used as context menu also. Inbuilt support added for overriding context menus.

Features:

  1. Light weight
  2. Fully configurable with just one JSON object for each Popup
  3. Layouts & Templates can be controlled using <ng-template>
  4. Easy Override with CSS styles
  5. In-Built Animation Support

Usage

app.module.ts

import { PopupModule } from 'nitro-popup';

@NgModule({
  declarations: [
    // ...
  ],
  imports: [
    PopupModule
    // ...
  ]
})

some.component.ts

  import { PopupService } from 'nitro-popup';

  // ...
  export class SomeComponent {
    constructor(
      public popupService: PopupService
    ) {
    }

    triggerPopupOpen():void {
      openPopup({
        event: new Event('open'),
        template: popupRef
      });
    }

    openPopup(opt: any): void {
      this.popupService.open(opt);
    }

    closePopup(opt: any): void {
      this.popupService.close(opt);
    }
  }

some.component.html - SIMPLE USE Compact

  <button (click)="openPopup({
    event: $event,
    template: popupRef
  })" class="btn">OPEN POPUP</button>

  <nitro-popup #popupRef [config]="{
      width: '600px',
      height: '600px',
      id: 'popupYourID',
      contentLayout: popupContentLayout
    }">
  </nitro-popup>

  <ng-template #popupContentLayout>
    <ng-container *ngTemplateOutlet="profileImage"></ng-container>
  </ng-template>

  <ng-template #popupHeaderLayout>
    <span class="title">Title</span>
    <button class="btn close" (click)="closePopup($event)">x</button>
  </ng-template>
  <ng-template #popupFooterLayout>
    Footer
  </ng-template>
  <ng-template #popupSideLayout>
    <nav>
      <ul>
      <li>
        <button>Menu 1</button>
      </li>
      <li>
        <button>Menu 2</button>
      </li>
    </ul>
    </nav>
  </ng-template>

some.component.html - SIMPLE USE with Animations and all Templates

  <button (click)="openPopup({
    event: $event,
    template: popupRef
  })" class="btn">OPEN POPUP</button>

  <nitro-popup #popupRef [config]="{
      width: '600px',
      height: '600px',
      id: 'popupDemo',
      class: 'popupYourStyleClass or Classes',
      animateIn: 'zoomIn',
      animateOut: 'zoomOut'
      sideLayout: popupSideLayout,
      headerLayout: popupHeaderLayout,
      footerLayout: popupFooterLayout,
      contentLayout: popupContentLayout
    }">
  </nitro-popup>

  <ng-template #popupContentLayout>
    Popup Contents
  </ng-template>

  <ng-template #popupHeaderLayout>
    <span class="title">Title</span>
    <button class="btn close" (click)="closePopup($event)">x</button>
  </ng-template>
  <ng-template #popupFooterLayout>
    Footer
  </ng-template>
  <ng-template #popupSideLayout>
    <nav class="menu">
      <ul>
        <li>
          <button>Menu 1</button>
        </li>
        <li>
          <button>Menu 2</button>
        </li>
      </ul>
    </nav>
  </ng-template>

some.component.html - Growing from a target element

  <button #btnRef (click)="openPopup({
    event: $event,
    template: popupRef
  })" class="btn">OPEN POPUP</button>

  <nitro-popup #popupRef [config]="{
      delay: 500,
      origin: btnRef,
      width: '100%',
      height: '100%',
      id: 'popupDemo',
      class: 'popupStyle',
      animateIn: 'pulse',
      animateOut: 'zoomOut',
      css: {
        'max-width': '100vw',
        'max-height': '100vh'
      },
      contentLayout: popupContentLayout
    }">
  </nitro-popup>

  <ng-template #popupContentLayout>
    <ng-container *ngTemplateOutlet="profileImage"></ng-container>
  </ng-template>

  <!-- <ng-template #popupHeaderLayout>
    <span class="title">Title</span>
    <button class="btn close" (click)="closePopup($event)">x</button>
  </ng-template>
  <ng-template #popupFooterLayout>
    Footer
  </ng-template>
  <ng-template #popupSideLayout>
    <nav>
      <ul>
      <li>
        <button>Menu 1</button>
      </li>
      <li>
        <button>Menu 2</button>
      </li>
    </ul>
    </nav>
  </ng-template> -->

How to override context menu and open a custom Menu

  <div class="customContextMenu" (contextmenu)="openPopup({
      event: $event,
      template: menu
    })" style="width: 100%; height: 100%; top:0; left:0; position: fixed;background: rgba(0,0,0,0.2)">
    Right Button Click this area to get the CUSTOM MENU
    </div>

  <nitro-popup #menu [config]="{
    width: 'auto',
    height: 'auto',
    id: 'popupMenu',
    class: 'popupMenu',
    contentLayout: menuLayout
  }">
    <ng-template #menuLayout>
      <a href="javascript:;">Menu 1</a>
      <a href="javascript:;">Menu 2</a>
      <a href="javascript:;">Menu 3</a>
      <a href="javascript:;">Menu 4</a>
    </ng-template>
  </nitro-popup>

API:

|Name|Type|Default|Description| |---|---|---|---| |id|String| "" | IDThis will set an ID for the popup template (Keep it unique) Eg.:<nitro-popup [config]="{id: 'popupName'...}"></nitro-popup>Accepted Values:<any_string>ID String will also be added as a class for the popup also.| |width & height|String| 100% | Width and height of popupSet width and height of the popup. The width can be of %, px or auto values as a stringEg.:<nitro-popup [config]="{width: '600px', height: 'auto'}"></nitro-popup>| |css|JSON| "" | Add custom CSSCustom css will be applied as inline style to the PopupEg.:<nitro-popup [config]="{ css: {'max-width': '100vw','max-height': '100vh'}}"></nitro-popup>| |animateIn|String| "" | Class for Animate In AnimateIn Class will be applied to the Popup at opening eventEg.:<nitro-popup [config]="{ animateIn: 'zoomIn'}"></nitro-popup>| |animateOut|String| "" | Class for Animate OutAnimateOut Class will be applied to the Popup at opening eventEg.:<nitro-popup [config]="{ animateOut: 'zoomOut' }"></nitro-popup>| |level|Number| 0 | Updating the Layer OrderThe default z-index of Popup is 1050 and the level value will be added with 1050.NB: You can also decrease the z-index value by giving negative value as levelEg.:<nitro-popup [config]="{ level: '-1049' }"></nitro-popup>Will set the popup layer z-index: 1. | |overlay| String / boolean| true | Various Overlay TypesToggle Overlay Show/Hide or blocks/allow clicks outside the popupAccepted Values are true, false, transparent, none, transparent_none Eg.:<nitro-popup [config]="{overlay: 'transparent'}"></nitro-popup>| |headerLayout|TemplateRef| null | Header TemplateHTML Template for headerEg.:<nitro-popup [config]="{headerLayout: headerTemplateElementRef}"></nitro-popup>| |footerLayout|TemplateRef| null | Footer TemplateHTML Template for footerEg.:<nitro-popup [config]="{footerLayout: footerTemplateElementRef}"></nitro-popup>| |contentLayout|TemplateRef| null | Content TemplateHTML Template for contentEg.:<nitro-popup [config]="{contentLayout: contentTemplateElementRef}"></nitro-popup>| |sideLayout|TemplateRef| null | Left Side TemplateHTML Template for sideEg.:<nitro-popup [config]="{sideLayout: sideTemplateElementRef}"></nitro-popup>| |customLayout|TemplateRef| null | custom Layout TemplateCustom HTML Template for PopupEg.:<nitro-popup [config]="{customLayout: sideTemplateElementRef}"></nitro-popup>|

This library was generated with Angular CLI version 17.1.3.