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

bigger-flow

v0.0.1

Published

### 介绍

Readme

bigger-flow

介绍

bigger-flow 是一个基于 @xyflow/reactdagre 的关系矩阵组件,旨在简化复杂关系图的展示和管理。它提供了自动布局功能,使用户能够轻松地可视化节点和它们之间的连接关系。

简单案例 relation-matrix relation-matrix relation-matrix 复杂案例 relation-matrix

使用教程

Step 1: 安装依赖

npm install bigger-flow
# OR
pnpm add bigger-flow

Step 2: 引入组件

import { RelationMatrix } from 'bigger-flow';
import 'bigger-flow/lib/styles.css';

Step 3: 使用组件

import { RelationMatrix, ReactFlowProvider, type RelationMatrixNode, type RelationMatrixEdge } from 'bigger-flow'

// 描述节点
const nodes: RelationMatrixNode[] ={
  {
    id: '1',
    data: { label: 'Sample 1' },
    type: 'sample',
  },
  {
    id: '2',
    data: { label: 'Sample 2' },
    type: 'sample',
  },
}

// 描述连线
const edges: RelationMatrixEdge[] = {
  { source: '1', target: '2' },
}

export const App = () => {
  return (
    <ReactFlowProvider>
      <RelationMatrix
        nodes={nodes}
        edges={edges}
        layout='dagre'
        flowProps={{ fitView: true }}
        backgroundProps={{ bgColor: '#f0f2f5' }}
      />
    </ReactFlowProvider>
  );
};

本地启动事例代码

pnpm install
pnpm dev

类型描述


// RelationMatrix 组件 props
export type RelationMatrixProps = {
  nodes?: RelationMatrixNode[] // node 节点
  edges?: RelationMatrixEdge[] // edge 连线
  layout?: 'dagre' | false // 自动布局
  direction?: Direction // 布局方向 'TB' | 'LR'
  fitViewOnResize?: boolean // 是否在窗口大小变化时适应视图
  flowProps?: ReactFlowProps // 传递给 ReactFlow 的属性。参阅:@xyflow/react 的 ReactFlowProps
  backgroundProps?: BackgroundProps // 传递给 Background 的属性。参阅:@xyflow/react 的 BackgroundProps
  dagreOptions?: Partial<DagreGraphOptions> // dagre 布局配置,layout=dagre有效。参阅: @dagrejs/dagre 的 GraphLabel 配置
}


// RelationMatrixNode 节点类型
export type RelationMatrixNode = {
  id: string
  type: keyof typeof nodeTypes // 仅支持 sample 类型
  data: SampleData // 这个传递控制 sample 的数据
 } & Partial<Omit<Node, 'data' | 'type' | 'id'>>

// SampleData 节点类型
export type SampleData = {
  label: string
  // 样式
  style?: React.CSSProperties
  // className?: string
  className?: string
  // 方向
  direction?: Direction
  // 动态 handle
  dynamicHandle?: boolean
  // 是否自定义 render
  render?: (element: ReactElement, nodeProps: NodeProps) => ReactNode
  // 扩展渲染
  extraRender?: (element: ReactElement | null, nodeProps: NodeProps) => ReactNode
  // sample node 容器属性,可以添加事件或者ref
  elementProps?: HTMLProps<HTMLDivElement>
  // 角标定义
  marker?: {
    label: string
    color?: string
    backgroundColor?: string
    type?: 'line' | 'outline'
    style?: React.CSSProperties,
    render?: (element: React.ReactNode, node: NodeProps) => React.ReactNode
  }
  // 其他数据
  [index: string]: any
}

// 连线节点
export type RelationMatrixEdge = Omit<Edge, 'id'> & { id?: string }