0.1.0 • Published 3 months ago

bpmn-js-headless v0.1.0

Weekly downloads
-
License
-
Repository
github
Last release
3 months ago

bpmn-js-headless

CI

Run bpmn-js in headless environments.

Usage

Use just like bpmn-js, but be sure not to use interactive (extension) modules.

import Modeler from 'bpmn-js-headless/lib/Modeler';

const modeler = new BpmnModeler();

// import diagram
await modeler.importXML(myDiagram);

// perform a change operation
modeler.invoke((modeling, elementRegistry) => {

  const participant = elementRegistry.get('Participant_1');

  modeling.removeElements([ participant ]);
});

// export diagram
const {
  xml
} = await modeler.saveXML({ format: true });

Why?

This utility is useful whenever you want to apply complex modeling operations in headless (aka no browser) environments. Some examples:

How does it work

  • Uses only bpmn-js modules that are safe for headless execution
  • Overrides core diagram-js components to be independent of graphical representation

Caveats

This is a truely headless version of bpmn-js, i.e. it does not fake a browser environment. For extensions to be compatible they shall enforce a proper UI / behavior separation, and not rely on browser features.

You want to bundle this library along with extensions, as bpmn-js and dependent libraries require bundling, too.

0.1.0

3 months ago

0.0.1

9 months ago