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

marzetz-dialog

v1.2.1

Published

MarzetzDialog is an Angular module, that can be used to show custom popups in any Angular app.

Downloads

22

Readme

MarzetzDialog

semantic-release Build Status

MarzetzDialog can show custom popups in any Angular app.

Built with Angular 5.2.8

Demo

demo

Installation

npm install --save marzetz-dialog

Getting Started

Import the MarzetzDialogModule in your root application module:

import {NgModule} from '@angular/core';
import {MarzetzDialogModule} from 'marzetz-dialog';

@NgModule({
	imports: [
    	// ...
        MarzetzDialogModule
    ],
	// ...
})
export class AppModule {}

Add the appMarzetzDialog directive on one of the main containers inside your app:

import {Component} from '@angular/core';

@Component({
    selector: 'app-main',
    template: `
        <div appMarzetzDialog></div>
    `
})

Init your dialog:

import {Component, OnInit} from '@angular/core';
import {MarzetzDialogInternal, MarzetzDialogService, MarzetzDialogOptions} from 'marzetz-dialog';
import {SomeComponent} from './component';

@Component({
    selector: 'app-main',
    template: `
        <div appMarzetzDialog></div>
    `
})

export class AppMain implements OnInit {
    public dialogOne: MarzetzDialogInternal;
    
    private dialogOneOptions: MarzetzDialogOptions = {
        customComponent: SomeComponent,
        customBodyClass: 'custom-class-for-body'
    };
    
    constructor(private marzetzDialogService: MarzetzDialogService) {
    }
    
    ngOnInit() {
        this.dialogOne = this.marzetzDialogService.init(this.dialogOneOptions)
    }
}

Open and close your dialog:

import {Component, OnInit} from '@angular/core';
import {MarzetzDialogInternal, MarzetzDialogService, MarzetzDialogOptions} from 'marzetz-dialog';
import {SomeComponent} from './component';

@Component({
    selector: 'app-main',
    template: `
        <div appMarzetzDialog>
            <button (click)="openMyDialog()">Open dialog</button>
        </div>
    `
})

export class AppMain implements OnInit {
    public dialogOne: MarzetzDialogInternal;
    
    private dialogOneOptions: MarzetzDialogOptions = {
        customComponent: SomeComponent,
        customBodyClass: 'custom-class-for-body'
    };
    
    constructor(private marzetzDialogService: MarzetzDialogService) {
    }
    
    ngOnInit() {
        this.dialogOne = this.marzetzDialogService.init(this.dialogOneOptions)
    }
    
    public openMyDialog() {
        this.marzetzDialogService.open(this.dialogOne._index);
    }
    
    public closeMyDialog() {
        this.marzetzDialogService.close(this.dialogOne._index);
    }
}

Options and available methods

  • MarzetzDialogService methods:

Method | Description --- | --- init(options?: MarzetzDialogOptions) | Inits new dialog and then returns its MarzetzDialogInternal setup. Argument options is not required. open(index: number) | Opens dialog if it was initiated earlier. Argument index is required, it can be received from MarzetzDialogInternal object. close(index: number) | Closes dialog. Argument index is mandatory. closeAll() | Closes all opened dialogs. destroy(index: number) | Destroys dialog. Argument index is mandatory. destroyAll() | Destroys all dialogs.

  • MarzetzDialogOptions:

You can override dialog defaults with your own options. It can be done by passing argument of type MarzetzDialogOptions into MarzetzDialogService init method.

Option | Type | Default | Desctiption --- | --- | --- | --- addBodyClass | boolean | true | If true specified or default class will be added to html body element when popup is opened. This class is removed while dialog is being closed. customBodyClass | string | 'marzetz-dialog-opened' | The css class that would be added to html body element whilst dialog is being opened. customComponent | any (your component) | null | Custom component to inject into dialog on init. You should also add it to entryComponents in your main module. customContent | string (html) | null | The content to show inside dialog. Use it if you want to create simple alert/info popup. animation | string | 'normal' | The animation that will be applied on dialog. Supported values: 'normal', 'bounceIn' and 'error'.

Credits

TODO

  • Unit & E2E test
  • Add more animations

LICENSE

This project is licensed under the MIT license. LICENSE