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

auto-typer-vue3

v1.2.3

Published

A simple Autotyper for Vue 3, with some customisation options.

Downloads

3,813

Readme

Auto Typer - Vue3

A simple auto-typer, written in Vue3.

Screenshot(s)

Contents

Installation

Install Auto Typer Vue3 with npm

npm install auto-typer-vue3

Then import the module and css file into your Vue component (see usage/example below).

Usage/Example

Basic Example

<script setup>
import { AutoTyperVue } from "auto-typer-vue3";

let text = [
  'This is a demo.',
  'And this is another Demo!'
];
</script>

<template>
  <AutoTyperVue 
    componentTag="h1" 
    :text="text"
  />
</template>

<style scoped>
@import "auto-typer-vue3/dist/style.css";
</style>

Type out word, then stop

<script setup>
import { AutoTyperVue } from "auto-typer-vue3";
</script>

<template>
  <AutoTyperVue
    componentTag="h1"
    text="This will remain on the screen after being typed!"
    :repeat="false"
  />
</template>

<style scoped>
@import "auto-typer-vue3/dist/style.css";
</style>

Props

| Prop | Type | Default | Description | Validation | | :---------------------- | :----------------------- | :------ | :--------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------- | | componentTag | string | 'span' | The HTML tag that the element will be. | Currently accepts any of the following: span, p, a, h* (where * is any number). | | beginningWord | string | '' | A string prepended to every text item. | N/A. | | writtenBeginningWord | string | '' | A word that will be typed when the auto-typer begins, and then will stay there. | N/A. | | text | string \|array<string> | '' | Either a string to be auto-typed, or an array of strings to be auto-typed. | | | startDelay | number | 500 | Time (ms) before the auto-typer begins. | Number >= 0. | | betweenWordDelay | number | 500 | Time (ms) before the next text string is typed. | Number >= 0. | | typingDelay | number | 150 | Time (ms) between each character is typed (lower means faster typing). | Number >= 0. | | deletingDelay | number | 100 | Time (ms) between each character is deleted after the text has been typed. | Number >= 0. | | waitBeforeDeleteDelay | number | 500 | Time (ms) after the text has been typed before deleting it begins. | Number >= 0. | | startByDefault | bool | true | Whether to start the auto-typer by default. If set to false, the begin() method must be called manually. | Number >= 0. | | repeat | bool | true | Whether to repeat the text once all of them have been typed. | N/A. | | removeAfterRepeat | bool | false | If repeat is false, whether to remove the final word. | N/A. |

Emits

  • finished - Emitted once the auto-typer has finished typing (only applicable if repeat is false).

Styling Customisation: changing the cursor styling

The cursor styling can be completely overridden, or certain parts can be altered by adding additional styles below the import of style.css, targetting the element .auto-typer-vue::after.

Example: Changing the cursor colour/opacity

Note: You may need to use !important to override the default styling if you use this approach.

<style scoped>
@import "auto-typer-vue3/dist/style.css";
.auto-typer-vue::after {
  border-color: rgb(0, 0, 0) !important;
  opacity: 1 !important;
}
</style>

You could also give an ID attribute to auto typer component, and then target the attribute. This helps if there is more than one on the page, and you want each to have different styling:

You will not need to use !important if you use this approach.

<script setup>
import { AutoTyperVue } from "auto-typer-vue3";
</script>

<template>
  <AutoTyperVue 
    componentTag="h1"
    id="main-auto-typer"
    :text="['This is a demo.', 'And this is another Demo!']"
  />
</template>

<style scoped>
@import "auto-typer-vue3/dist/style.css";
#main-auto-typer::after {
  border-color: rgb(0, 0, 0);
  opacity: 0.8;
}
</style>

Contributing

There is a folder playground inside this repository which can be used as a basis for development. Clone the repo and run:

  1. npm run dev:install
  2. npm run dev:run

To launch this folder with Vite.

The App.vue file can be modified to see changes in the browser, and navigating to /src/components/auto-typer-vue/AutoTyperVue.vue will update the changes on the browser for the Auto Typer.

To test the packaged build, run:

  1. npm install
  2. npm build:vite
  3. npm run dev:run-pack

This will run a dev server with the packaged version of auto-typer-vue3, instead of the normal one.

Future Plans

  • [x] Add custom styling options the the cursor.
  • [x] Handle whether to leave the final word on the screen once repeating has stopped.
  • [ ] Add a variable to allow a certain number of repeats, instead of just a boolean.
  • [ ] ...any other suggestions will be considered, please leave an issue if you have any feature requests!