Gathering detailed insights and metrics for wc-typeit
Gathering detailed insights and metrics for wc-typeit
Gathering detailed insights and metrics for wc-typeit
Gathering detailed insights and metrics for wc-typeit
npm install wc-typeit
Typescript
Module System
Node Version
NPM Version
66.1
Supply Chain
96.9
Quality
75.6
Maintenance
100
Vulnerability
99.6
License
TypeScript (75.92%)
HTML (18.49%)
CSS (5.59%)
Total Downloads
5,965
Last Day
1
Last Week
1
Last Month
29
Last Year
3,765
MIT License
1 Stars
130 Commits
2 Branches
1 Contributors
Updated on Jun 06, 2024
Minified
Minified + Gzipped
Latest Version
1.0.12
Package Id
wc-typeit@1.0.12
Unpacked Size
1.79 MB
Size
455.45 kB
File Count
84
NPM Version
10.2.4
Node Version
18.19.1
Published on
Mar 08, 2024
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-85.7%
1
Compared to previous week
Last Month
-42%
29
Compared to previous month
Last Year
71.1%
3,765
Compared to previous year
1
5
A very intelligent typewriter effect web component which can loop through an array of sentences to render them as typewriter effect. It is smart enough to delete only necessary characters instead of deleting all before rendering the next sentence.
1 2# with npm 3npm i wc-typeit 4 5# with yarn 6yarn add wc-typeit 7
1<script type="module" src="https://unpkg.com/wc-typeit@latest/dist/wc-typeit/wc-typeit.esm.js"></script> 2<script nomodule src="https://unpkg.com/wc-typeit@latest/dist/wc-typeit/wc-typeit.js"></script>
Name | Type | Default value | Description |
---|---|---|---|
sentences | String[] | null | Strings you want to shuffle between |
loop | 'Loop.Infinite' or 'Loop.Once' | 'Loop.Infinite' | Should it iterate through strings once or Infinite number of times |
All methods need to be subscribed to to perform follow-up action
Name | Params | Description |
---|---|---|
start | - | Start the typewriter effect. |
stop | - | Stop the typewriter effect. It stops upon completing one sentence cycle |
Event | Type | Description |
---|---|---|
animationLoopEnd | CustomEvent<void> | An event which is emitted once an animation loop completes |
This web component is slottable which means you can inject a starter text which should always be displayed on load and just once. It is totally optional.
Just install the package and start using it as a custom web component
1import { Loop } from 'wc-typeit'; 2 3const sentences = ['This is wc-typeit', 'It is EASY to USE!', 'It is EASY to INTEGRATE!', 'It is EASY to STYLE!']; 4 5<wc-typeit sentences={sentences} loop={Loop.Once}> 6 Default text which shows up during loading... 7</wc-typeit>
One can get reference to the wc-typeit
element and call start and stop methods on it
1private ref: HTMLWcTypeitElement; 2 3private async startAnimation() { 4 this.ref.start().then(() => { 5 // your custom logic 6 }).catch(() => { 7 console.error('Cannot start animation as it is already running'); 8 }); 9} 10 11private async stopAnimation() { 12 this.ref.stop().then(() => { 13 // your custom logic 14 }).catch(() => { 15 console.error('Cannot stop animation as it is already stopped'); 16 }); 17} 18 19<wc-typeit sentences={this.sentences} loop={Loop.Once} ref={elem => this.ref = elem}> 20 Default text which shows up during loading... 21</wc-typeit>
You can listen to animationLoopEnd
method which fires whenever an animation loop showing all the sentences ends
1private handleAnimationLoopEnd() { 2 // your custom logic 3} 4 5<wc-typeit sentences={sentences} loop={Loop.Once} animationLoopEnd={this.handleAnimationLoopEnd}> 6 Default text which shows up during loading... 7</wc-typeit>
This web component has no nested elements except the text node itself which makes styling it as east as styling any other element.
1wc-typeit { 2 color: maroon; 3 display: block; 4 font-family: Arial, Helvetica, sans-serif; 5 font-size: 2rem; 6 width: 300px; 7}
One can change the cursor color by applying the following styles
1wc-typeit { 2 --cursor-color: green !important; 3}
No vulnerabilities found.
No security vulnerabilities found.