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

@jipu123/roulette-flow

v0.1.4

Published

基于 Vue 3、`@vue-flow/core` 和 `elkjs` 的工作流编辑组件。

Readme

@jipu123/roulette-flow

基于 Vue 3、@vue-flow/coreelkjs 的工作流编辑组件。

支持:

  • 开始 / 结束 / 选择器 / 分流器节点
  • 点击添加、拖拽添加
  • 连线创建、更新、删除
  • 节点删除
  • 撤销 / 反撤销
  • 自动布局
  • 视口重置
  • 全屏模式
  • 导入 / 导出工作流 JSON
  • 只读模式

安装

从 npm 安装

bun add @jipu123/roulette-flow

或:

npm install @jipu123/roulette-flow

从 Git 安装

bun add git+ssh://[email protected]/jipu123/roulette-flow.git#v0.1.0

使用

<script setup lang="ts">
import { computed, ref } from 'vue'
import { WorkflowCard } from '@jipu123/roulette-flow'
import '@jipu123/roulette-flow/style.css'
import type { WorkflowCardExpose, WorkflowDocument } from '@jipu123/roulette-flow'

const workflowCard = ref<WorkflowCardExpose | null>(null)
const isLocked = ref(false)
const lockLabel = computed(() => (isLocked.value ? '解锁' : '锁定'))

const items = [
  { id: 1, label: '事件 A', weight: 1, color: '#10b981' },
  { id: 2, label: '事件 B', weight: 1, color: '#0ea5e9' },
]

const handleExport = () => {
  const document = workflowCard.value?.exportWorkflow()
  if (!document) return

  console.log(document)
}

const handleImport = (document: WorkflowDocument) => {
  workflowCard.value?.importWorkflow(document)
}
</script>

<template>
  <button @click="isLocked = !isLocked">{{ lockLabel }}</button>
  <button @click="handleExport">导出</button>

  <WorkflowCard
    ref="workflowCard"
    :items="items"
    title="Flow"
    :is-locked="isLocked"
  />
</template>

样式

使用组件时需要显式引入样式:

import '@jipu123/roulette-flow/style.css'

导出

包入口导出:

  • WorkflowCard
  • WorkflowCardExpose
  • WorkflowDocument
  • WorkflowNodeData
  • RouletteItem
  • SelectorNodeData
  • SplitterNodeData

Props

WorkflowCard 支持以下 props:

{
  items: Array<{
    id: number
    label: string
    weight: number
    color: string
  }>
  title: string
  compact?: boolean
  isLocked?: boolean
}

items

当前主要用于触发基础节点重建与演示数据透传。

title

业务标题字段,当前版本保留在入口参数中。

compact

紧凑模式:

  • 默认缩放更小
  • 画布高度更紧凑

isLocked

只读模式:

  • 隐藏组件库
  • 禁止新增节点
  • 禁止拖动节点
  • 禁止创建、修改、删除连线
  • 禁止删除节点
  • 禁止节点内部表单编辑
  • 显示只读模式标识

Expose

组件通过 ref 暴露以下方法:

exportWorkflow: () => {
  nodes: Node[]
  edges: Edge[]
}

importWorkflow: (document: {
  nodes: Node[]
  edges: Edge[]
}) => void

导出工作流

const document = workflowCard.value?.exportWorkflow()
if (!document) return

导入工作流

workflowCard.value?.importWorkflow(document)

工作流数据结构

{
  nodes: Node[]
  edges: Edge[]
}

选择器节点数据

{
  isRandom: boolean
  eventRows: string[]
}

分流器节点数据

{
  isRandom: boolean
  branchRows: string[]
}

交互说明

添加节点

  • 小屏:点击组件库项添加
  • 大屏:可拖拽到画布,也可点击添加

删除节点

  • 大屏:节点右键
  • 小屏:节点长按
  • 开始节点、结束节点不会被删除
  • 删除节点时会同时删除关联连线

删除连线

  • 大屏:连线右键
  • 小屏:连线长按

自动布局

使用 elkjs 的 layered 布局算法,方向为从左到右。

撤销 / 反撤销

对节点和边的结构修改使用快照方式管理。

开发

bun install
bun run dev

构建:

bun run build