Sequential workflow designer written in TypeScript with no dependencies.

Overview

Sequential Workflow Designer

Sequential Workflow Designer

Build Status License: MIT View this project on NPM Twitter: b4rtaz

Sequential workflow designer with no dependencies for web. It's written in pure TypeScript and uses SVG for rendering. This designer is not associated with any workflow engine. It's full generic. You may create any kind application by this, from graphical programming languages to workflow designers.

Features:

  • no dependencies,
  • full generic & configurable,
  • light/dark themes,
  • works on modern browsers,
  • works on mobile.

👀 Examples

🚀 Installation

To use the designer you should add JS/TS files and CSS files to your project.

NPM

Install this package by NPM command:

npm i sequential-workflow-designer

To import the package:

import Designer from 'sequential-workflow-designer';

If you use css-loader or similar, you can add CSS files to your boundle:

import 'sequential-workflow-designer/css/designer.css';
import 'sequential-workflow-designer/css/designer-light.css';
import 'sequential-workflow-designer/css/designer-dark.css';

To create the designer write the below code:

// ...
Designer.create(placeholder, definition, configuration);

CDN

Add the below code to your head section in HTML document.

<head>
...
<link href="https://cdn.jsdelivr.net/npm/[email protected]/css/designer.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/css/designer-light.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/css/designer-dark.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/designer.js"></script>

Call the designer by:

sequentialWorkflowDesigner.create(placeholder, definition, configuration);

🎬 Usage

Check examples directory.

import Designer from 'sequential-workflow-designer';

const placeholder = document.getElementById('placeholder');

const definition = {
  properties: {
    // global properties
  },
  sequence: [
    // root steps
  ]
};

const configuration = {
  theme: 'light',
  isReadonly: false,

  toolbox: {
    isHidden: false,
    groups: [
      {
        name: 'Files',
        steps: [
          // steps for the toolbox's group
        ]
      },
      {
        name: 'Notification',
        steps: [
          // steps for the toolbox's group
        ]
      }
    ]
  },

  steps: {
    iconUrlProvider: (componentType, type) => {
      return `icon-${componentType}-${type}.svg`;
    },
    validator: (step) => {
      return step.name.toLowerCase() === step.name;
    }
  },

  editors: {
    isHidden: false,
    globalEditorProvider: (definition) => {
      const container = document.createElement('div');
      // ...
      return container;
    },
    stepEditorProvider: (step) => {
      const container = document.createElement('div');
      // ...
      return container;
    }
  }
};

const designer = Designer.create(placeholder, definition, configuration);
designer.onDefinitionChanged.subscribe((newDefinition) => {
  // ...
});

💡 License

This project is released under the MIT license.

Comments
  • Switch to a previous step

    Switch to a previous step

    Hello,

    I was exploring this library for a flowchart builder I am trying to make.

    I am just wondering if there is a way to connect switch to existing steps, instead of redefining steps again?

    I am trying to use it kind of multi outcome loop, until a specific condition is met.

    Please let me know if this is possible.

    Thanks!

    opened by gaurav-mtalkz 6
  • Is it possible to create a

    Is it possible to create a "Stop" step?

    Hi, sorry about posting two issues at once.

    I'm wondering how I can create a step that "stops" the flow, ie is not connected to the continued flow?

    Something like this (link redacted)

    Thanks!

    opened by liljefelt 5
  • user defined number of branches for the switch

    user defined number of branches for the switch

    Currently the switch component allows only predefines number of branches.

    When using as select/case 1/case 2/case xx it is much desirable to let the user define visually how many cases he wants. So there must be visually a possibility to add more cases.

    So a new option for user defined branches will be really welcome.

    opened by gpetrov 4
  • Query: adding constraints on drag and drop

    Query: adding constraints on drag and drop

    Hello,

    How can I enforce constraint on drag and drop area for a particular step type. Say I want the particular task step (identified by step.type) to be added only at the end of switch node branches and nowhere else then how can such constraint be enforced?

    Thanks!

    opened by gaurav-mtalkz 4
  • Center switch step after adding branches

    Center switch step after adding branches

    Hi, first off this library is amazing, well done!

    The current Switch step behaviour when adding branches is to add them to the right, and I'm wondering if it is possible to "center" a switch step automatically after programmatically adding branches?

    Default behaviour: http://46.246.30.230/github/uncentered-step.jpg

    What I'm looking for: http://46.246.30.230/github/centered-step.jpg

    Thanks!

    opened by liljefelt 2
  • New step not getting focus and global editor not updated

    New step not getting focus and global editor not updated

    Great job on this project!

    Not sure if this is intended behavior but after dragging a new step into the workflow I expected the newly added step to have focus and the appropriate step editor rendered. Instead, the focus stays on the global editor and doesn't reflect the underlying definition change.

    Steps to Repro (version 0.1.6):

    • Start with an empty definition in the fullscreen example (the global editor is shown)
    • Add a step from the toolbox (focus remains on the global editor showing the empty definition even though onDefinitionChanged is called on the designer)
    • Change focus to the newly added step and then back to the overall process (globalEditorProvider is called and the current state of the definition is now rendered)
    opened by carlson 2
  • Undo/Redo - Customize Control Bar

    Undo/Redo - Customize Control Bar

    Hello,

    Thank you very much for this tool it's very customizable and does the job!

    However what is really missing is an undo/redo button preferably you can add custom buttons to the control bar just like how you can customize the toolbox.

    Kind regards,

    Ravindre

    opened by reramjiawan 1
  • Is Horizontal Workflow possible?

    Is Horizontal Workflow possible?

    Good morning @b4rtaz , congratulations for your workflow. I need to work with somewhat extensive flows. In this case, the view of the processes only vertically will be too large. Would it be possible to add steps in the flow horizontally as well?

    Example: image

    opened by thcristianno 3
Releases(v0.3.0)
  • v0.3.0(Dec 26, 2022)

    This version introduces new build formats (ESM, UMD) of the package.

    🤩 For more advanced use cases we prepared the paid pro package. The package is in the early stage. Currently it contains advanced components for steps. Here you can find more information and examples.

    Breaking Changes

    • Default export of the Designer class is removed. Now you should import directly the Designer class.

      import { Designer } from 'sequential-workflow-designer';
      Designer.create(/* ... */);
      

      This affects CDN usage too.

      <script src="https://cdn.jsdelivr.net/..."></script>
      <script>
      sequentialWorkflowDesigner.Designer.create(/* ... */);
      </script>
      
    • The package now contains two type of build: ESM and UMD. ESM build is located in the lib folder. UMD build is located in the dist folder. That means the URL to the CDN is also changed.

      <script src="https://cdn.jsdelivr.net/.../dist/index.umd.js"></script>
      
    • Static method Designer.utils.nextId() is deleted. You should use the next() from the Uid class. Example:

      import { Uid } from 'sequential-workflow-designer';
      Uid.next();
      
    • Static method Designer.utils.getParents() is deleted. You should use the getStepParents() method from the Designer class. Example:

      designer.getStepParents(needleStep);
      
    • The ComponentType is not an enum anymore. It's a type (string). This change doesn't affect serialized JSONs.

    Source code(tar.gz)
    Source code(zip)
  • v0.2.3(Nov 24, 2022)

  • v0.2.2(Nov 14, 2022)

  • v0.2.1(Oct 15, 2022)

    Support undo and redo. This feature is disabled by default. To enable it add the below config.

    const config = {
      undoStackSize: 10,
      // ...
    };
    
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Sep 9, 2022)

    Editor's Context

    We've changed an approach how the editors should notify the designer about changes in the definition. We've deleted revalidate() and notifiyDefinitionChanged() methods from the Designer class. Instead of this, now editors receive an editor's context.

    interface StepEditorContext {
      notifyNameChanged(): void;
      notifyPropertiesChanged(): void;
    }
    
    interface GlobalEditorContext {
      notifyPropertiesChanged(): void;
    }
    
    const config = {
      // ...
      editors: {
        stepEditorProvider: (step: Step, context: StepEditorContext) => {
          // ...
          context.notifyPropertiesChanged();
          // ...
        },
        globalEditorProvider: (definition: Definition, context: GlobalEditorContext) => {
          // ...
          context.notifyPropertiesChanged();
          // ...
        }
      }
    };
    

    Type Requirments

    The type of a step cannot contain special characters from now. Check the type validator.

    • someType
    • some-type
    • some_type
    • some type
    • someType!

    By this, we could add the type to an element's class on the SVG canvas. That allows to customize components by CSS. Check this example.

    Restrictions

    We added canInsertStep, canMoveStep and canDeleteStep callbacks to the StepsConfiguration. You may restrict some activity in the designer by this.

    const config = {
      // ...
      steps: {
        canInsertStep: (step, targetSequence, targetIndex) => {
          return targetSequence.length < 5;
        },
        canMoveStep: (sourceSequence, step, targetSequence, targetIndex) => {
          return !step.properties['isLocked'];
        },
        canDeleteStep: (step, parentSequence) => {
          return step.name !== 'x';
        }
        // ...
      }
    };
    
    Source code(tar.gz)
    Source code(zip)
Owner
Bart Tadych
Bart Tadych
A GitHub app to report failed workflow job actions and notify pull request creator with custom report message for the failed workflow job.

Workflow Reporter A GitHub App built with Probot that reports failed workflow job actions and notify the pull request creator with custom report messa

Divyanshu Shekhar 14 Nov 12, 2022
🖌 Webstudio Visual Designer

Webstudio Designer Webstudio Designer is a NoCode Visual Tool inspired by Webflow. It is the place where you can build your site or app visually. Inst

Webstudio 185 Jan 3, 2023
Ossama Mehmood (ossamamehmood.me) 🚀 Digital Creator / 🎗️ Graphic Designer / 🔮 User Interface (UI) & Experience (UX)

Ossama Mehmood 샘 (ossamamehmood.me) Greetings..! I'm Ossama Mehmood DIGITAL CREATOR OSSAMAMEHMOOD Home About me Skills Resume Testimonials Portfolio C

Ossama Mehmood 샘 2 Jun 17, 2022
🖼 Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well with or without a framework.

file-upload-with-preview ?? Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well

John Datserakis 427 Dec 26, 2022
Snowfall effect written in pure JavaScript. No additional libraries, no dependencies. Works in every modern browser.

pureSnow.js Snow falling slowly on a winter night. Probably the most calming and peaceful snowfall effect written in pure JS/CSS. (No SCSS). Inspired

null 20 Dec 29, 2022
A Lua plugin, written in TypeScript, to write TypeScript (Lua optional).

typescript.nvim A minimal typescript-language-server integration plugin to set up the language server via nvim-lspconfig and add commands for convenie

Jose Alvarez 315 Dec 29, 2022
Screeps Typescript Starter is a starting point for a Screeps AI written in Typescript.

Screeps Typescript Starter Screeps Typescript Starter is a starting point for a Screeps AI written in Typescript. It provides everything you need to s

null 3 Jan 27, 2022
🐬 A simplified implementation of TypeScript's type system written in TypeScript's type system

?? HypeScript Introduction This is a simplified implementation of TypeScript's type system that's written in TypeScript's type annotations. This means

Ronen Amiel 1.8k Dec 20, 2022
A custom action for setting GitHub Workflow environment variables with YAML configuration files.

yaml-env-action - A custom action for setting GitHub Workflow environment variables with YAML configuration files. Introduction yaml-env-action is a c

Piper Dougherty 3 Dec 13, 2022
A NPM package powered by Yeoman that generates a scaffolding boilerplate for back-end workflow with Node.js.

generator-noderplate Generate Node.js starter files with just one command! We have deployed a npm package that will generate a boilerplate for nodejs

Samarjeet 3 Jan 24, 2022
A visual helper in vscode to use github's workflow 'hubflow'

vscode-hubflow README This is the README for your extension "vscode-hubflow". After writing up a brief description, we recommend including the followi

Jannik Ramrath 1 Feb 7, 2022
Create a badge using GitHub Actions and GitHub Workflow CPU time

Generated Badges Create a badge using GitHub Actions and GitHub Workflow CPU time (no 3rd parties servers) Install $ npm i generated-badges -g Command

小弟调调™ 9 Dec 30, 2022
Alfred Workflow for selecting citations in Pandoc Syntax from a BibTeX File.

Supercharged Citation Picker A citation picker for academics that write in markdown. Using Alfred, this citation picker inserts Pandoc citations from

pseudometa 69 Dec 29, 2022
Bitloops is Low-Code Workflow Orchestration platform that helps you build backend systems and APIs 10x faster.

Bitloops Bitloops is a scalable open source Firebase substitute that can support any database and workflow orchestration. We’re building Bitloops usin

Bitloops 21 Aug 9, 2022
A note enhancement & full knowledge management workflow for Zotero.

Knowledge for Zotero A full knowledge management workflow in Zotero. User Guide(EN) | 用户指引(中文) Review.Writing.Best.Practice.mp4 Features Note as you g

null 1.3k Jan 9, 2023
Show a helpful summary of test results in GitHub Actions CI/CD workflow runs

Test Summary Produce an easy-to-read summary of your project's test data as part of your GitHub Actions CI/CD workflow. This helps you understand at-a

Test Summary 293 Jan 2, 2023
Download Notion pages as markdown and image files, preserving hierarchy and enabling workflow properties. Works with Docusaurus.

notion-pull notion-pull lets you use Notion as your editor for markdown-based static site generators like Docusaurus. Using Notion instead of raw mark

SIL LSDev 46 Jan 7, 2023
The project integrates workflow engine, report engine and organization authority management background, which can be applied to the development of OA, HR, CRM, PM and other systems. With tlv8 IDE, business system development, testing and deployment can be realized quickly.

介绍 项目集成了工作流引擎、报表引擎和组织机构权限管理后台,可以应用于OA、HR、CRM、PM等系统开发。配合使用tlv8 ide可以快速实现业务系统开发、测试、部署。 后台采用Spring MVC架构简单方便,前端使用流行的layui界面美观大方。 采用组件开发技术,提高系统的灵活性和可扩展性;采

Qian Chen 38 Dec 27, 2022