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

mz-wow-talent-tree

v1.0.10

Published

一个可嵌入页面的《魔兽世界》天赋树组件。对外提供 `create(container, options)` 用于挂载/销毁,并可获取当前选择的天赋字符串。

Readme

mz-wow-talent-tree

一个可嵌入页面的《魔兽世界》天赋树组件。对外提供 create(container, options) 用于挂载/销毁,并可获取当前选择的天赋字符串。

安装

npm i mz-wow-talent-tree
# or
pnpm add mz-wow-talent-tree

快速开始(推荐:Vite/webpack 等打包器)

import { create } from "mz-wow-talent-tree";
import "mz-wow-talent-tree/compDist/app.css";

const instance = create("#talent-tree", {
  specId: 72,
  level: 90,
  talents: "",
  readOnly: true,
});

// 需要时获取当前天赋字符串(例如提交表单)
console.log(instance.getTalentString());

// 卸载
// instance.destroy();

HTML 容器示例:

<div id="talent-tree" style="width: 900px; height: 600px"></div>

API

create(container, options?)

  • container
    • 类型:string | HTMLElement
    • 说明:CSS 选择器或 DOM 节点。传选择器时内部会 document.querySelector,找不到会抛错。
  • 返回值:{ destroy(): void; getTalentString(): string | undefined }

返回值方法

  • destroy():卸载组件(内部调用 ReactDOM.unmountComponentAtNode)。
  • getTalentString():返回当前用户选择的天赋字符串;如果用户还没产生变更,可能是 undefined

options(完整参数)

| 参数 | 类型 | 默认值 | 说明 | |---|---|---|---| | specId | number | 72 | 专精 ID(决定加载哪套天赋数据)。 | | level | number | 90 | 角色等级(影响可用点数/解锁等)。 | | talents | string \| object | "" | 初始天赋(通常传字符串)。传无效/过期字符串会提示。 | | exclude | any[] | [] | 排除列表(配合 allowExclude 使用)。 | | strokeWidth | number | 2 | 连线粗细。 | | mini | boolean | false | 迷你模式(更紧凑的展示/底部能力图标)。 | | showRanks | boolean | true | 是否显示 rank(层数/点数)。 | | hideExport | boolean | false | 是否隐藏导出相关 UI。 | | allowExclude | boolean | false | 是否允许排除天赋(用于“禁用/不考虑”某些天赋的交互)。 | | readOnly | boolean | true | 是否只读(不允许点选变更)。 | | hideFooter | boolean | false | 是否隐藏底部(mini 模式下的底部区域)。 | | hideHeader | boolean | false | 是否隐藏顶部区域。 | | name | string \| null | null | 标题文案(有值则显示)。 | | showCopy | boolean | true | 是否显示“复制”按钮(非 mini 模式下生效)。 | | width | number | 自动 | 组件宽度。未传时:create() 会用容器 clientWidth。 |

注意:当前实现里,create() 会覆盖 options.onChange(内部用于缓存导出数据),因此外部传 onChange 不会生效。