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

ngx-fit-text

v0.0.10

Published

Angular FitText, an Angular implementation of @patrickmarabeas/ng-FitText.js

Downloads

44

Readme

Download via NPM Angular Build Status Contributions welcome License

From the original description (slightly edited for clarity):

Ngx-FitText makes font-sizes flexible. Use this Angular directive in your fluid or responsive layout to achieve scalable headlines that fill the width of a parent element.

Prerequisites

This directive has been tested with Angular 5 and Angular CLI. Let me know if you make it work with different versions and tools.

Installing

Install into your Angular CLI project root folder.

npm install ngx-fittext -S

Usage

Import into AppModule

Help wanted! - At the moment of writing I'm still new to the world of Angular libraries, so I'm in the process of figuring out how to let you avoid having to import the module at the root level instead of importing it just where you need it.

Let me know if you can help with this, and please feel free to open a PR.

// src/app/app.module.ts

...
import { NgxFitTextModule } from 'ngx-fit-text';
...

@NgModule({
  ...
  imports: [
    ...
    NgxFitTextModule.forRoot()
  ],
  ...
})
export class AppModule { }

Use in a component template

Basic usage

Important! - The HTML element you apply the directive to, must have a parent element!

<header>
  <h1 [ngxFitText]>Look at how I resize myself</h1>
</header>

Options (currently implemented but untested)

Compression ratio (accepts float, default: 1)
Set a overall compression ratio.

<header>
  <h1 [ngxFitText]="0.9">
    Look at how I resize myself
  </h1>
</header>

Minimum / maximum font size (accepts px or 'inherit', default min: 0, default max: Number.POSITIVE_INFINITY)

<header>
  <h1
    [ngxFitText]
    [ngxFitTextMin]="11"
    [ngxFitTextMax]="18"
  >
    Look at how I resize myself between 11px and 18px
  </h1>
</header>

Debounce resizing (accepts milliseconds, default: 100)
i.e. for controlling how to debounce the window.resize event

<header>
  <h1
    [ngxFitText]
    [ngxFitTextDelay]="1000"
  >
    Look at how I resize myself after 1 second
  </h1>
</header>

Development and Contributing

Prerequisites

You'll need @gonzofish/angular-librarian.
Go ahead and install it, and make sure to follow the instructions about how to make it work in the command line.

It's also important to have a EditorConfig plugin installed and active in you editor / IDE, so that your code will follow the project's style on a base level.

Linting and prettifying tools will be added in the future.

Installing

  1. Clone this repository
  2. Go inside the project's root directory: cd ngx-fit-text
  3. Install Node modules: npm install
  4. Hack away

Working with Angular Librarian

You can find all the info about how to run a Angular Librarian project in its documentation, but here's two handy commands:

  1. ngl serve - to run the project's examples into a Webpack DevServer
  2. npm test - to run the unit tests before submitting a PR

Built With

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the ISC License - see the LICENSE.md file for details

Acknowledgments

  • Patrick Marabeas for its initial work