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

glaze-ngx-google-fonts

v0.0.45

Published

This library provides a component which handles: * Loading the list of Google fonts, and combining with web safe fonts. * Allowing the user to select from a drop-down-like list, where each font name renders in its own font. * Allowing the user to filter t

Downloads

60

Readme

ngx-google-fonts

This library provides a component which handles:

  • Loading the list of Google fonts, and combining with web safe fonts.
  • Allowing the user to select from a drop-down-like list, where each font name renders in its own font.
  • Allowing the user to filter the list by prefix.
  • Emitting events for hover and user selection.
  • Lazy loading all required fonts as they come into view.

The pages below outline how to use the component:

Below, we'll provide a summarized version of this information.

Getting Started

Using the component itself is straightforward. We just need to put the component in our HTML, hook it up with inputs and outputs, and import it into our module. The component itself will take care of everything else.

Here is an example HTML which uses the component and hooks up to input and output properties:

<!-- Angular Component HTML -->
<byte-this-google-font-selector-input
    <!-- Input for the API key required by Google -->
    [google-api-key]="apiKey$ | async"
    <!-- An optional starting value for the font -->
    value="Aguafina Script"
    <!-- Event when the selected font is changed -->
    (change)="onFontChange($event)"
    <!-- Event when the mouse hovers over a font without selecting it -->
    (hover-value)="onFontHover($event)"
></byte-this-google-font-selector-input>

This is the code for the corresponding TypeScript component class:

@Component({
    /** omitted for brevity **/
})
export class GettingStartedComponent {

    //example service which retrieves your API key from some place
    apiKey$ = this.configService.getGoogleApiKey();

    constructor(
        private configService: ConfigService
    ) {}

    /**
     * iGoogleFont is the data type for the font:
     * font family, variants, and other data from google fonts api
     */ 
    onFontChange(font: iGoogleFont): void {
        console.log("Font changed:", font);
    }

    /**
     * Font hover can be useful for preview purposes,
     * such as showing the user how it would look before selecting it
     */ 
    onFontHover(font: iGoogleFont): void {
        console.log("Font hover:", font);
    }
}

The module declaration is as follows:

/**
 * We have to import this into the module before using it
 */

@NgModule({
    /** other code omitted for brevity **/
    imports: [
        ByteThisNgxGoogleFontsModule
    ]
})
export class GettingStartedModule {}

Running This Project Locally

If you'd like to work with this repo and explore the code, run locally, and even make code changes:

  1. Clone this project.
  2. Run npm install to get the dependencies.
  3. Run ng serve to launch a runner app which contains the component and instructions for working with it.