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-typewriter

v0.0.3

Published

![enter image description here](https://raw.githubusercontent.com/MedBenMalek/ngx-typewriter/main/images/tpw.gif)

Downloads

6

Readme

ngx-typewriter

enter image description here

A small angular library for textwriter effect with styling.

DEMO

Installation

npm i ngx-typewriter 

Setup

import {NgxTypewriterModule} from "ngx-typewriter";  
  
@NgModule({  
declarations: [ ... ],  
imports: [  ...,  
NgxTypewriterModule  
],  
providers: [],  
bootstrap: []  
})  
export class MyModule { }  

Usage

  1. You have to add tp-writer component with the options and the selector.

    <tp-writer class="messages" [selector]="'twp'" [options]="options"></tp-writer>
    ---
    NOTE: If selector is not provided the default selector will be 'tpw', if you are planning to add multiple tpwriter components you have to provide the selector to differentiate. 
  2. Define the options

    public options: TPWInterface = { textList: ['ngx-typewriter'], speed: 80,
    loop: true,
    delay: 200,
    }

  3. If you want to make changes (like adding text, change speed, activate/deactivate looping...) you have to call NgxTypewriterService in the constructor then get the TPW instance by the selector.

     import {NgxTypewriterService, TPW, TPWInterface} from "ngx-typewriter";
    
     export class MyComponent {
    
     	public options: TPWInterface = { 
     		 textList: ['ngx-typewriter'], 
     		 speed: 80,    
             loop: true,    
             delay: 200,  
     	}
     	constructor(private typewriterService: NgxTypewriterService) {}
    	
     	addText() {  
     	  const tpw: TPW = this.typewriterService.getTPW('tpw');  
     	  tpw.speed = 200;  
     	  await tpw.addText('adding another text');  
     	}
     }

Component Properties

|Property|Type|Default|Description |--|--|--|--| |options|TPWInterface|undefined|List of options of the typewiter effect| |selector|string|'tpw'|The select is a unique id useful in the case of the existing of multiple typewriting components| |marker|string|'|'|the marker effect that displayed next the words|

Options

List of properties in the options object

|Property|Type|Default|Description |--|--|--|--| |textList|string[]|[]|List text to be displayed| |speed|string|70|speed of writing| |loop|boolean|false|set to true f you want to shoe the effect if loop| |delay|number|1000|delay between phrases| |classList|{[className: string]: {[cssProperty: string]: string}}|{}|List of CSS classes to be set in the text with #tpw-key(word, class:class-name)#|

Functions

Call TPW instance

constructor(private typewriterService: NgxTypewriterService) {}
const tpw: TPW = this.typewriterService.getTPW('tpw');  

Add text

await tpw.addText('adding another text');  

Add css class

const slyle = {  
  'color': 'red',  
  'font-weight': 'bold'  
}  
tpw.addClass('my-class', slyle)

Update options properties

You have the call TPW instance the you will have access to the properties

Example: Update the loop to true

const tpw: TPW = this.typewriterService.getTPW('tpw');  
tpw.loop = true;

Styling

To style words in the text you have to use a special syntax in the text which pretty is easy to use, all you have to do is to add #tpw-key(text, color:red, font-weight:bold)#, this "function" should have the text as the first parameter then you can add the list of styles or classes.

Using CSS classes: you Only have to set the class name with the key class #tpw-key(text, class:my-class)#