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

@web-3d/graph

v1.0.0

Published

@web-3d/graph 称为 库构建模板,又称 公共代码构建模板 ,是专门用于构建 公共代码(如:封装的库、工具等) 的 vite 配置模板,当需要开发和构建公共代码时,直接克隆本项目即可,并默认在的 src 目录下开发即可;

Readme

@web-3d/graph

@web-3d/graph 提供渲染引擎无关的二维、三维图数据模型和插件式渲染框架,适合路网、管网及其他由节点和边组成的可编辑场景。

功能

  • 管理节点、边、路径、子图以及图级业务数据。
  • 使用 Signal 暴露位置、端点、方向、曲线和成员变化。
  • 提供事务化变更集,合并一次业务操作内的增删改通知。
  • 支持拆边、切边、溶解节点、断开节点和拓扑编辑计划。
  • 支持路径解析、元素引用和激活元素集合。
  • 通过 GraphRenderer 安装函数式或对象式渲染插件。
  • 核心模型不依赖 Three.js、Cesium、DOM 或拾取实现。

安装

pnpm add @web-3d/graph @web-3d/math @web-3d/tools

快速开始

import { Direction, Graph, GraphRenderer } from '@web-3d/graph';

const graph = new Graph(3);
graph.addNode('start', [0, 0, 0]);
graph.addNode('end', [10, 0, 0]);
graph.addEdge('main', 'start', 'end', {
  direction: Direction.both,
  data: { category: 'main' },
});

const renderer = new GraphRenderer(graph, { scene });
renderer.install(renderPlugin, { color: '#4488ff' });

渲染上下文和插件选项由适配层自行定义,图模型不读取其中的引擎对象。

核心对象

| 对象 | 职责 | | --- | --- | | Graph | 图元素存储、拓扑操作、事务和变更事件 | | Node、Edge | 节点位置、边端点、方向、曲线和业务数据 | | Path | 有序边序列 | | Subgraph | 节点、边和路径的逻辑集合 | | GraphRenderer | 渲染插件安装、卸载和资源清理 | | RenderPlugin | 把图变化映射为具体引擎对象 |

设计边界

图模型只保存拓扑和业务数据。拾取、材质、几何体、场景节点与销毁策略由渲染插件负责;图编辑交互由 @web-3d/inter-draw 及对应引擎适配层负责。

开发

pnpm test
pnpm test:watch
pnpm typecheck
pnpm build
pnpm demo:graph-basic
pnpm apidoc

作者:郭斌勇 · 微信:keyanzhe · 邮箱:[email protected]