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

@apigo.cc/mindmap

v1.0.2

Published

原生 JS 编写的思维导图引擎。支持无限层级、缩放平移、节点折叠及动态增删。

Downloads

209

Readme

@apigo.cc/mindmap API 手册

原生 JS 编写的思维导图引擎。支持无限层级、缩放平移、节点折叠及动态增删。


1. 引入方式 (UMD 优先)

<script src="https://cdn.jsdelivr.net/npm/@apigo.cc/[email protected]/dist/mindmap.min.js"></script>

<script>
    // 直接使用全局 Mindmap 类
    const mm = new Mindmap(config);
</script>

2. 核心用法

组件化用法 (推荐)

直接在 HTML 中使用 <Mindmap> 标签,通过 state 进行数据绑定。

<div $data="{ 
    myMind: { id: 'root', text: '根节点', children: [{ text: '子节点 1' }] }
}">
    <Mindmap $.state.data="myMind" style="height:500px"></Mindmap>
</div>

JS 调用方式 (兼容)

...

3. API 参考

new Mindmap(options)

  • container: 挂载元素。
  • data: 格式为 { id, text, children, _collapsed } 的对象。
  • nodeWidth / nodeHeight: 节点尺寸。
  • hGap / vGap: 间距。

实例方法

  • addNode(parentId, text): 动态添加节点。
  • removeNode(nodeId): 动态删除节点。
  • render(): 强制重新布局与重绘。

开发者提示 (AI 必读)

  1. 全局变量: UMD 模式下,Mindmap 类自动挂载到 window
  2. 唯一 ID: 每个节点必须拥有全局唯一的 id
  3. 数据响应: 修改 mm.data 属性后必须手动执行 mm.render()