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

@tdh-keyboard/pinyin

v1.0.10

Published

中文虚拟键盘组件库拼音输入引擎

Readme

@tdh-keyboard/pinyin

@tdh-keyboard/pinyin 提供基于 RIME WASM 的拼音输入引擎实现,可直接接入 @tdh-keyboard/vue@tdh-keyboard/react@tdh-keyboard/native

安装

npm install @tdh-keyboard/pinyin

导出内容

  • RimePinyinEngine:基于 RIME WASM 的拼音引擎实现
  • PinyinEngine:通用拼音引擎接口类型
  • PinyinState:拼音候选状态类型

基本用法

import { RimePinyinEngine } from '@tdh-keyboard/pinyin'

const engine = new RimePinyinEngine({
  wasmDir: '/rime',
  simplified: true,
})

await engine.initialize()

const state = await engine.processInput('nihao')
console.log(state?.candidates)

await engine.pickCandidate(0)
await engine.clearInput()
await engine.destroy()

与键盘组件配合使用

import { registerPinyinEngine } from '@tdh-keyboard/vue'
import { RimePinyinEngine } from '@tdh-keyboard/pinyin'

registerPinyinEngine(new RimePinyinEngine({
  wasmDir: '/rime',
}))

资源文件部署

发布时需要同时提供 data/ 目录中的 RIME 资源文件,并保证 wasmDir 指向这些静态资源所在目录。

默认会加载以下文件:

  • rime-api.wasm
  • default.yaml
  • luna_pinyin.schema.yaml
  • luna_pinyin.table.bin
  • luna_pinyin.prism.bin
  • luna_pinyin.reverse.bin

选项说明

RimePinyinEngine 构造参数支持:

  • wasmDirrime-api.jsrime-api.wasm 和数据文件的访问路径前缀
  • dataFiles:自定义需要预加载的数据文件列表
  • simplified:是否默认启用简体中文输出,默认 true

实例方法

  • initialize():初始化引擎并加载 RIME 资源
  • processInput(fullPinyin):处理完整拼音串,返回候选状态
  • pickCandidate(index):按索引选择候选词
  • clearInput():清除当前预编辑输入
  • setSimplified(simplified):切换简体 / 繁体输出
  • destroy():销毁引擎并释放资源