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

@splicetree/core

v1.1.0

Published

SpliceTree 是一个 Headless 树运行时,面向扁平数据构建可操作的树结构,提供精简 API,并通过插件扩展搜索、拖拽、懒加载、键盘导航等能力。

Readme

@splicetree/core

SpliceTree 是一个 Headless 树运行时,面向扁平数据构建可操作的树结构,提供精简 API,并通过插件扩展搜索、拖拽、懒加载、键盘导航等能力。

为扁平数据提供轻量、可扩展的树运行时。支持插件扩展事件与能力。

version downloads license Website GitHub

官方文档

文档与示例位于 https://www.splicetree.dev

安装

pnpm add @splicetree/core

使用

import { createSpliceTree } from '@splicetree/core'

const data = [
  { id: 'a' },
  { id: 'b', parent: 'a' },
]

const { items } = createSpliceTree(data, {
  keyField: 'id',
  parentField: 'parent',
  defaultExpanded: ['a'],
})

// 渲染可见节点
for (const node of items()) {
  console.log(node.id, node.level)
}

选项

| 名称 | 类型 | 默认值 | 说明 | | ----------------- | -------------------- | ---------- | ---------------------------- | | keyField | string | 'id' | 主键字段名 | | parentField | string | 'parent' | 父级字段名 | | plugins | SpliceTreePlugin[] | [] | 插件列表(可扩展实例与节点) | | defaultExpanded | string[] | [] | 初始展开的节点 id 集合 |

实例 API

  • items() 返回当前可见节点序列
  • getNode(id) 通过 id 获取节点
  • events 事件总线(on/emit
  • expand/collapse/toggleExpand(id) 展开/收起/切换
  • appendChildren(parentId, children) 追加子节点(支持追加到根)
  • moveNode(id, newParentId, beforeId?) 移动到新父级,并指定插入位置

节点 API

  • id/original/level
  • isExpanded() 当前是否展开
  • hasChildren() 是否存在子节点(懒加载插件可覆盖)
  • getParent()/getChildren() 父子节点查询

License

MIT,仓库地址 https://github.com/michaelcocova/splicetree