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

bpmn-renderer

v0.0.3

Published

[![npm](https://img.shields.io/npm/v/bpmn-renderer.svg)](https://www.npmjs.com/package/bpmn-renderer)

Downloads

3

Readme

bpmn-renderer bpmn Element custom renderer

npm

bpmn-renderer to solve the problem of bpmn.js style modification is troublesome. The plugin provides style modifiers directly into the configuration item, which you only need to configure, and comes with a nice set of default styles.

Document

中文文档

English document

支持

  • 🎉 Node Size: width and height configuration
  • 🎉 Node border: Border color, border thickness, border rounded corner, Shadow, shadow animation
  • 🎉 Node background: Background color
  • 🎉 Text: text color, text size, font, position
  • 🎉 Connecting line: connecting line color, line thickness, arrow size
  • 🎉 ICONS: Flexible icon Settings

Currently supported types: User task, Script task, Service task, text comment, dotted line connecting comment text, text label, connection line, Start node, End node, Boundary event, Gateway、SendTask、ReceiveTask、ManualTask、BusinessRuleTask

personally backing

  • 🤔 More task nodes

preview

Default style: All nodes in will state Default style: In ing state Default style: All nodes are in over state

install

npm i bpmn-renderer

calling method

import Renderer from 'bpmn-renderer';


new Viewer({
    // ...
    additionalModules: [
        Renderer({
            // Node information. You can set a state for each node. Different states use different colors
            // The ing state will have a shadow animation by default
            nodesInfo:{
                // Each element is fixed to the following configuration, {  [元素ID]: {  status: "ing" } }
                Gateway_0x3cmtw:{
                    // status: "ing", // "will" | "over" | "ing"
                },
            },

            // Node styles in different states are configured using the built-in collocations by default
            // The ing and over states do not exist in the designer (node edit page).
            style: {
                will: {
                    node: {
                        backgroundColor: "red",
                    }
                },
                ing:{},
                over:{}
            }

        }),
    ],
    moddleExtensions: {
        camunda: CamundaBpmnModdle,
        qnn: qnnBpmnModdle
    }
});

style

Each element is divided into three states, the default being the will state (which can also be used for editing pages).

{
    
    base: {
        width: 100,
        height: 80,
    },
    will: {
        name: "未办理",
        // task node
        node: {
            // 背景颜色
            backgroundColor: "#fff",
            // 边框颜色
            borderColor: "#dae2ec",
            // 边框圆角
            borderRadius: 10,
            // 边框粗细
            borderWidth: 2,
            // 节点文字颜色
            color: "#262c33",
            // color: "red",
            fontSize: 12,
            fontFamily: "苹方,微软雅黑",
			// textPosition: "bottom"
            // 阴影大小
            boxShadowSize: 0,

            /** The node styles specified below are preferred **/
            // 开始节点特殊样式
            'bpmn:StartEvent': {
                backgroundColor: "rgb(225, 250, 245)",
                borderColor: "rgb(67, 220, 188)",
            },
            // 结束节点特殊样式
            'bpmn:EndEvent': {
                backgroundColor: "rgb(255, 217, 217)",
                borderColor: "rgb(255, 79, 79)",
            },
            // 网关
            'bpmn:ExclusiveGateway': {
                borderColor: "#FFD400",
            },
            // 边界事件
            'bpmn:IntermediateThrowEvent': {
                borderColor: "#FFD400",
            }
        },
        // Node connection line and arrow
        arrows: {
            // Line Width
            width: 1,
            backgroundColor: "#bfcbd9",
            // Angle connection type  "L" straight line | "C" curve,
            joinStyle: "C",
            // Arrow width and height, must be a number (unit: px)
            arrowsWidth: 12,
            arrowsHeight: 12,
        },

        icon: {
            width: 20,
            height: 20,
            color: "#a7b7cb",
            left: 5, top: 5,
			// center: true, 
            /**
            * svg ICONS for individual elements
            * Must return a '<svg>... The </svg>' string cannot contain DOCTYPE xml tags
            */
            svgs: {
                // 用户任务
                'bpmn:UserTask': ({ element }) => {
                    const nodeType = element.businessObject["userTaskType"];
                    return {
                        "1": chuanyue,
                        "2": guidang
                    }[nodeType] || userIcon;
                },
                'bpmn:ScriptTask': ({ element }) => scriptIcon,
                'bpmn:ServiceTask': ({ element }) => fuwuliu,
                // 网关内部小图标
                'bpmn:ExclusiveGateway': ({ element }) => wubianxing,
            },

            /** The node styles specified below are preferred **/
            // 网关
            'bpmn:ExclusiveGateway': {
                color: "#FFD400",
                width: 25,
                height: 25,
            },
        },
    },

    // 被激活后的样式
    over: {
        name: "已办理",

        // 节点
        node: {
            backgroundColor: "rgb(225, 250, 245)",
            borderColor: "rgb(67, 220, 188)",
            borderRadius: 10,
            borderWidth: 2,
            // 节点文字颜色
            color: "rgb(67, 220, 188)",
            fontSize: 12,
            fontFamily: "苹方,微软雅黑",
            // 阴影大小
            boxShadowSize: 0,

            // 开始节点特殊样式
            'bpmn:StartEvent': {
                backgroundColor: "rgb(225, 250, 245)",
                borderColor: "rgb(67, 220, 188)",
            },
        },
        // 节点连接线/箭头
        arrows: {
            // 线条粗细
            width: 1,
            backgroundColor: "rgb(67, 220, 188)",
            // 转角连接类型  "L" 直线 | "C" 曲线,
            joinStyle: "C",
            // 箭头宽高, 必须为数字(单位 px)
            arrowsWidth: 12,
            arrowsHeight: 12,
        },
        // 图标
        icon: {
            width: 20,
            height: 20,
            color: "rgb(67, 220, 188)",
            left: 5, top: 5,
           /**
            * svg ICONS for individual elements
            * Must return a '<svg>... The </svg>' string cannot contain DOCTYPE xml tags
            */
            svgs: {
                // 用户任务
                'bpmn:UserTask': ({ element }) => {
                    const nodeType = element.businessObject["userTaskType"];
                    return {
                        "1": chuanyue,
                        "2": guidang
                    }[nodeType] || userIcon;
                },
                'bpmn:ScriptTask': ({ element }) => scriptIcon,
                'bpmn:ServiceTask': ({ element }) => fuwuliu,
                // 网关内部小图标
                'bpmn:ExclusiveGateway': ({ element }) => wubianxing,
            }
        },
    },

    // 闪烁样式
    ing: {
        name: "正在办理",

        // 节点
        node: {
            backgroundColor: "rgb(225, 250, 245)",
            borderColor: "rgb(67, 220, 188)",
            borderRadius: 10,
            borderWidth: 2,
            // 节点文字颜色
            color: "rgb(67, 220, 188)",
            fontSize: 12,
            fontFamily: "苹方,微软雅黑",
            // 阴影大小
            boxShadowSize: 0,
        },
        // 节点连接线/箭头
        arrows: {
            // 线条粗细
            width: 1,
            backgroundColor: "rgb(67, 220, 188)",
            // 转角连接类型  "L" 直线 | "C" 曲线,
            joinStyle: "C",
            // 箭头宽高, 必须为数字(单位 px)
            arrowsWidth: 12,
            arrowsHeight: 12,
        },
        // 图标
        icon: {
            width: 20,
            height: 20,
            color: "rgb(67, 220, 188)",
            left: 5, top: 5,
            /**
            * svg ICONS for individual elements
            * Must return a '<svg>... The </svg>' string cannot contain DOCTYPE xml tags
            */
            svgs: {
                // 用户任务
                'bpmn:UserTask': ({ element }) => {
                    const nodeType = element.businessObject["userTaskType"];
                    return {
                        "1": chuanyue,
                        "2": guidang
                    }[nodeType] || userIcon;
                },
                'bpmn:ScriptTask': ({ element }) => scriptIcon,
                'bpmn:ServiceTask': ({ element }) => fuwuliu,
                // 网关内部小图标
                'bpmn:ExclusiveGateway': ({ element }) => wubianxing,
            }
        },
    }
}