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 🙏

© 2024 – Pkg Stats / Ryan Hefner

logic-liteflow

v1.0.0

Published

基于logicflow创建流程,生成符合liteflow规则的产物

Downloads

3

Readme

logic-liteflow

项目基于logicflow-liteflow扩展而来

将logicflow生成的图形数据转化为liteflow规则,支持拖拽和实时预览liteflow规则,支持 then、when、switch和循环节点

使用步骤

项目已上传至npm仓库

  1. 下载
npm/pnpm install logic-liteflow
  1. 导入(这里默认注册了需要的组件)
import {LiteFlow} from 'logic-liteflow';
  1. 作为LogicFlow插件使用
new LogicFlow({
    ...,
    plugins: [LiteFlow],
})
  1. 解析为liteFlow表达式
import {parse} from 'logic-liteflow';

data = lf.getGraphRawData()
parse(data);

仅使用解析功能

如果想要自定义图形界面,仅使用解析功能,需要保证图形数据至少有以下的属性

interface Data {
    nodes: {
        id: string;
        type: "COMMON" | "SWITCH" | "IF" | "LOOP";

        //仅循环需要的属性
        flowData?: Data;//循环包含的内容
        properties?: {
            name: "FOR" | "WHILE" | "ITERATOR";
            startNum?: number; //循环次数,当name为FOR时生效,同时startId失效。
        };

        startId?: string; //循环节点id
        breakId?: string; //跳出循环节点id
    }[];
    edges: {
        sourceNodeId: string,
        targetNodeId: string
    };
}

自定义节点样式

你可以用任何logicflow支持的方式自定义节点(继承项目中的或是自己写),并注册为项目已有type(COMMON,IF,LOOP,SWITCH),这会覆盖默认注册的组件 如果重写loop节点,注意在getData中输出上面5中需要的属性

运行实例项目

通过gitee直接下载本项目运行试试看。

项目截图

Alt text

启动步骤

npm install
npm run dev

id生成和数据保存

id从1开始自动递增,和图形数据一起保存在localstorage中,可以自行修改

IF 节点的使用

  1. 最稳妥的使用方式当然是有两个分支,并且连线上标明true和false(false可以省略)

  1. liteFlow中有IF(x,a)的语法,但是从图上不好判断IF节点何时结束,所以用空分支指向结束位置。

  1. 为了方便,当if节点在最后时可以只有一个分支,指定为true

循环节点的使用(更新)

循环节点更换成单独的一个节点