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

@dmncodes/vue-typing

v1.0.5

Published

This [Vue](https://vuejs.org/) component simulates a typewriter effect by typing and erasing sentences with customizable typing speed, delay, caret style, and looping options. The component is built with the [Vue 3 Composition API](https://vuejs.org/guide

Downloads

71

Readme

Vue Typewriter Component

This Vue component simulates a typewriter effect by typing and erasing sentences with customizable typing speed, delay, caret style, and looping options. The component is built with the Vue 3 Composition API and TypeScript.

Demo Page

https://dmncodes.github.io/vue-typing/

Features

  • Dynamic Typing: Type out a list of sentences with random typing speed within a specified range.
  • Erasing: Erase sentences after typing, with configurable speed and delay.
  • Looping: Option to loop through the sentences indefinitely.
  • Customizable Caret: Customize the caret character and its appearance.
  • Event Emission: Emits an event after typing each sentence, useful for triggering additional actions.

Usage

Here’s how you can use the Typewriter component in your Vue application:

1. Install

With NPM Package Manager

npm i @dmncodes/vue-typing

With Yarn

yarn add @dmncodes/vue-typing

2. Import the Component

You can import the component into your Vue component:

import VueTyping from "@dmncodes/vue-typing"

3. Use the Component in Your Template

<template>
  <VueTyping 
    :sentences="['Hello World!', 'Welcome to Vue.js']"
    :minTypeSpeed="50"
    :maxTypeSpeed="150"
    :eraseSpeed="100"
    :eraseDelay="1500"
    :writeDelay="0"
    caret="_"
    :loop="true"
    @sentence:typed="onSentenceTyped"
  />
</template>

<script setup>
function onSentenceTyped(sentence: string) {
  console.log(`Typed sentence: ${sentence}`);
}
</script>

4. Props

| Prop | Type | Default | Description | | ---- | ---- | ------- | ----------- | | sentences | string[] | [] | List of sentences to type out. | | minTypeSpeed | number | 50 | Minimum typing speed in milliseconds. | | maxTypeSpeed | number | 150 | Maximum typing speed in milliseconds. | | eraseSpeed | number | 100 | Speed of erasing each character in milliseconds. | | eraseDelay | number | 1500 | Delay before starting to erase in milliseconds. | | writeDelay | number | 0 | Delay before starting to type the next sentence in milliseconds. | | caret | string | _ | Character to display as the caret. | | loop | boolean | false | Whether to loop through the sentences indefinitely. |

5. Events

| Event Name | Payload | Description | | ---------- | ------- | ----------- | | sentence:typed | string (sentence) | Emitted after a sentence is fully typed out. |

6. Styling

The component comes with some basic styles for the caret and typing animations. You can customize these styles by overriding the CSS classes:

.dmn-typing span.caret {
  color: inherit;
  animation: blink 1s infinite;
}

.dmn-typing span.typing {
  animation: none;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

7. Testing

Unit tests are written using Vitest and Vue Test Utils. The tests cover:

  • Typing the sentences correctly.
  • Erasing sentences after typing.
  • Emitting events after each sentence is typed.
  • Correct application of the caret classes and animations.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request or open an issue.

License

This project is licensed under the MIT License.