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 🙏

© 2026 – Pkg Stats / Ryan Hefner

taro-typeit

v1.0.1

Published

A custom typeit component for Taro + React

Readme

taro-typeit

注:本项目80%由chatGPT生成

一个基于 Taro + React 的小程序/H5 自定义打字机效果实用组件。

适用于 Taro 3+ 项目,React 17/18。

✨ 特性

  • ✅ 打字机效果:支持字符串和 JSX 元素混合显示
  • ✅ 打字速度可配置:speeddeleteSpeed
  • ✅ 支持循环播放 loop 与删除模式 deleteMode
  • ✅ 可控制光标显示 cursor 与闪烁
  • ✅ 支持开始延迟 startDelay 与停顿延迟 breakDelay
  • ✅ 保留已打字内容 keepAll
  • ✅ TypeScript 完整类型定义

📦 安装

# 安装组件包
npm install taro-typeit

# 确保项目已有依赖
npm install react @tarojs/components @tarojs/taro

样式需要单独引入(或让打包产物自动引入):

import 'taro-typeit/dist/index.css';

🔨 快速上手

import React from 'react';
import { View } from '@tarojs/components';
import TypeIt from 'taro-typeit';

const App: React.FC = () => {
  return (
    <View>
      <TypeIt
        strings={[
          'Hello, world!',
          <View style={{ color: 'red' }}>This is JSX content!</View>,
          'Welcome to Taro + React!',
        ]}
        speed={120}
        deleteSpeed={60}
        loop
        keepAll
        cursor
        startDelay={500}
        breakDelay={1000}
        onStringComplete={index => console.log('String complete:', index)}
        onComplete={() => console.log('All strings complete!')}
      />
    </View>
  );
};

export default App;

🧩 组件属性(Props)

| 属性名 | 类型 | 必填 | 默认值 | 说明 | | | ------------------ | ------------------------- | ---------------- | ------- | --------------- | ----------------- | | strings | `(string | JSX.Element)[]` | ✔️ | [] | 要显示的字符串或 JSX 元素数组 | | speed | number | ✖️ | 100 | 打字速度(毫秒/字符) | | | deleteSpeed | number | ✖️ | 50 | 删除速度(毫秒/字符) | | | breakDelay | number | ✖️ | 1000 | 打完一条字符串后的停顿时间 | | | loop | boolean | ✖️ | false | 是否循环播放 | | | cursor | boolean | ✖️ | true | 是否显示光标 | | | keepAll | boolean | ✖️ | true | 是否保留已打过的内容 | | | deleteMode | boolean | ✖️ | false | 打完后是否删除文字再继续下一条 | | | startDelay | number | ✖️ | 0 | 初始开始延迟 | | | onStringComplete | (index: number) => void | ✖️ | — | 每条字符串完成回调 | | | onComplete | () => void | ✖️ | — | 所有字符串完成回调 | |


🌏 使用注意事项

  • JSX 元素不会有打字动画,会直接显示完整内容。
  • 光标仅在当前打字的字符串上闪烁。
  • looptrue 时,打完最后一条字符串会重头开始。
  • 配合 deleteMode 可实现打完字符串后删除效果。

🧪 TypeScript 支持

组件自带类型定义(.d.ts),推荐 tsconfig.json 至少包含:

{
  "compilerOptions": {
    "jsx": "react",
    "moduleResolution": "nodenext",
    "esModuleInterop": true,
    "skipLibCheck": true
  }
}

❓FAQ

Q: 可以显示 JSX 吗?
A: 可以,支持 strings 中混合 JSX 元素。元素会一次性显示,不会打字。

Q: 可以循环播放吗?
A: 可以,通过 loop 属性控制。

Q: 可以在打完后自动删除再显示下一条吗?
A: 可以,通过 deleteMode 属性控制。


📜 许可证

MIT