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

@pvway/alpha-prime

v16.0.0

Published

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.2.0.

Downloads

1,654

Readme

AlphaPrime

This library was generated with Angular CLI version 15.2.0.

Description

This is an Angular Service that provides functionalities for handling modals in your application.

How to initialize the service

Before being able to open a modal, the service needs to be initialized by calling the init method.

  /**
 * Initializes the dialog service.
 *
 * @param {DialogService} ds - The DialogService object to be initialized.
 * @param {(path: string, title: string) => any} postNavigationLog - The function used for posting navigation logs, with parameters path: string and title: string.
 * @param {string} [modalStyleClass] - Optional. The CSS class to be applied to the modals created by the DialogService.
 * @return {void}
 */
init(
  ds: DialogService,
  postNavigationLog: (path: string, title: string) => any,
  modalStyleClass?: string): void

Open a modal

You can open a modal by calling the openModal method.

  /**
 * Opens a modal dialog.
 *
 * @template T - The type of the component to be opened in the modal.
 *
 * @param {Type<T>} component - The component to be opened in the modal.
 * @param {string} anchor - The name of the component calling the openModal method.
 * @param {string} modal - The name of the modal.
 * @param {DynamicDialogConfig} [ddc] - Optional configuration for the modal dialog.
 *
 * @return {Observable<T>} - An Observable that emits an instance of the opened component when the modal is displayed.
 *                           If an error occurs during the opening of the modal, the Observable will emit an error instead.
 */
openModal<T>(
  component: Type<T>,
  anchor: string,
  modal: string,
  ddc?: DynamicDialogConfig): Observable<T>

This service uses Angular's dependency Injection system to work properly and utilise Primeng's DialogService to display modals. It also emits an Observable carrying the instance of the opened modal.

Usage

initialization

...

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
  providers: [DialogService]
})
export class AppComponent implements OnInit {

  constructor(
    // PRIME
    private mDs: DialogService,
    // MODAL
    private mPms: AlphaPrimeModalService,
    private mLbs: AlphaLbsService,
    // LOGGER
    private mLs: AlphaLsService) {
  }

  ngOnInit(): void {

    // LOGGING 
    const postNavLog = (path: string, title: string) =>
      this.mLs.postNavigationLog(path, title);

    // MODAL
    this.mPms.init(this.mDs, postNavLog, 'iota-max-modal-width');
  }
}

Opening a modal from an app component

  onLogin(): void {
    this.modalService.openModal(
      UamLoginModalComponent,      // the component that will open into the modal
      'welcomePage', // the component that opens the modal 
      'UamLogin') // the friendy name of the component to open in the modal
      .subscribe( 
        // when the modal is fully displayed
        // we get its instance
        // here we call the init method
        modal => modal.init(
          true,
          () => { /* the code that will be called when the modal terminates */ }));
  }