OGE logoOGE

BPMN Editor API

Complete API reference for @oge-ui/bpmn. The engine — XML reader/writer, geometry, orthogonal routing, snapping and the snapshot command stack — is the framework-free @oge-ui/bpmn-engine package and its user-facing surface (readBpmnXml, writeBpmnXml, the model types) is re-exported from the same barrel; live demos are on the overview page.

Properties Methods Events Types

OgeBpmnEditor

oge-bpmn-editor

Properties 15

Name Type DefaultDescription
readOnlybooleanfalseDisables every mutation: palette, context pad, keyboard editing and drags. Selection, pan, zoom and element search keep working.
gridVisiblebooleantrueShows the dotted background grid.
snapEnabledbooleantrueEnables grid and neighbor-alignment snapping (with guide lines) while moving and placing.
paletteItemsreadonly BpmnPaletteItemType[]all 18 entriesPalette entries offered, in render order: every placeable node type plus the 'pool' pseudo-entry, which creates a collaboration participant. Event sub-processes and transactions are reached by morphing a sub-process via the panel type select.
showPropertiesPanelbooleantrueShows the right-side properties panel (always hidden in readOnly).
showMinimapbooleantrueShows the bottom-right minimap overlay (hidden while the diagram is empty). Click or drag the minimap to pan the main viewport.
showHeaderbooleantrueShows the header toolbar: the inline-editable diagram name, undo/redo, zoom out / percentage (fit) / zoom in, the properties-panel collapse toggle, the optional edit/view mode toggle and the fullscreen button (native Fullscreen API with a fixed-position maximized fallback).
modemodel<'edit' | 'view'>'edit'The UI mode — two-way. 'view' locks every mutating surface exactly like readOnly; zoom, pan, search and fullscreen stay available.
allowModeTogglebooleanfalseShows the edit/view toggle in the header (hidden while readOnly — the app-level lock always wins).
showBrandingbooleantrueThe badge in the canvas corner — a bare logo with no chrome, removable exclusively from code via false. Branding is a courtesy, never a license term (unlike bpmn-js's mandatory watermark).
brandLogoUrlstring | undefined—Badge image URL (per instance, or app-wide via provideOgeBpmnConfig({ brandLogoUrl })); unset renders the built-in drawn mark — no bundled bitmap, no network dependency by default.
Panel resizingbuilt-in—The palette rail and the properties panel carry role="separator" drag handles — pointer drag (Escape cancels) or Tab + Arrow keys / Home / End, the APG window-splitter keys. The header panel-toggle collapses the properties panel entirely.
messagesPartial<OgeBpmnMessages>{}Per-instance message overrides, merged over the provideOgeBpmnConfig() defaults.
zoommodel<number>1Two-way zoom factor ([(zoom)]); wheel zooming writes it back. Clamped to the configured zoomMin/zoomMax.

Canvas keyboard

Name Type DefaultDescription
role="application" canvasTab / Shift+Tab · arrows (Shift = 1px) · C · A · H / L / S · F2 / Enter · Delete · Ctrl+Z / Ctrl+Y · Ctrl+C / Ctrl+X / Ctrl+V · Ctrl+A · Ctrl+F · + / − / F · Escape—Tab cycles elements (never trapped on an empty selection — leave with Escape then Tab, announced in the canvas hint), arrows move the selection by one grid step, C arms the connect tool (Tab/arrows walk candidate targets, Enter commits), A appends a connected task, H/L/S switch to the hand / lasso / space tool (edit mode only), F zooms to fit, F2/Enter edit the label, Ctrl+C/X/V copy/cut/paste via the internal clipboard, Ctrl+A selects all, Ctrl+F opens the element search overlay, Escape cancels the active tool or drag. The selected element is exposed via aria-activedescendant and every action is narrated in a polite live region.

Methods 19

Import & export

Name Type Description
importXml(xml: string)Promise<BpmnImportResult>Parses BPMN XML and loads it into the editor, resetting undo history and fitting the viewport. Resolves with the import result (model + warnings); on a fatal parse error the current diagram is left untouched.
exportXml()stringSerializes the current diagram to deterministic BPMN 2.0 XML — same model, same bytes.
exportJson()BpmnDiagramJsonWraps the current diagram in the versioned JSON persistence envelope — the shape to store in an application database and the payload of the diagramChanged autosave stream.
importJson(value: unknown){ error?: string }Validates a JSON persistence envelope (see fromBpmnJson) and loads it, resetting undo history and fitting the viewport exactly like importXml. On a validation error the current diagram is left untouched and the error message is returned.
exportSvg()stringRenders the current diagram as a self-contained static SVG string (neutral hardcoded colors, no grid or selection, viewBox fitted to the content) via renderDiagramSvg — writable to a file or embeddable as-is.
newDiagram()voidReplaces the diagram with an empty one and resets history and viewport.

Selection, history & navigation

Name Type Description
zoomToFit()voidFits and centers the whole diagram in the canvas.
centerOn(id: string)voidPans the viewport (keeping the current zoom) so the given element is centered in the canvas. Unknown ids are ignored. Used by the element search overlay; public for app-driven navigation.
select(ids: readonly string[])voidSelects the given element ids, pools included (unknown ids are ignored).
getSelection()readonly string[]The currently selected element ids.
deleteSelection()voidDeletes the selected elements, cascading to their attached edges and clearing orphaned default-flow markers.
undo() / redo()voidUndoes / re-applies the most recent command. Snapshot-based: each command — including every arrow-key step — is exactly one entry.
canUndo() / canRedo()booleanWhether at least one command can be undone / redone.
isDirty()booleanTrue when the model differs from the last save point.
markSaved()voidMarks the current model as saved; isDirty() reports false until the model changes again.
focus()voidMoves keyboard focus onto the diagram canvas.

Overlays

Name Type Description
addOverlay(overlay: OgeBpmnOverlay)stringAttaches an HTML badge to a diagram element and returns a handle for removeOverlay. The badge tracks the element through pan/zoom and model changes; a dangling elementId hides it without removing the registration. The html renders through Angular's sanitizing [innerHTML] binding.
removeOverlay(id: string)voidRemoves the overlay registered under the given handle. Unknown handles are ignored.
clearOverlays(elementId?: string)voidRemoves every registered overlay, or — when elementId is given — only the overlays attached to that element.

Events 5

Name Type Description
selectionChangedOgeBpmnSelectionEventThe selection changed (user interaction or select()): { ids, elements } with per-element { id, type, name? } summaries.
elementsChangedOgeBpmnElementsChangedEventThe diagram model changed: { source, label }, where source is execute | undo | redo | import | new and label is the command label.
diagramChangedOgeBpmnDiagramChangedEventDebounced autosave stream: after model changes settle for autoSaveDebounceMs (default 500ms; 0 emits synchronously) the diagram is serialized once to both JSON and XML and emitted together with the change source. Emitted for every source including import and new — filter on source to persist only user edits. No serialization happens mid-drag (gestures commit one command on release); a pending emission is cancelled on destroy.
importCompletedOgeBpmnImportEventAn importXml() call finished parsing; carries the fidelity warnings ({ warnings }) — emitted on fatal errors too.
dirtyChangedbooleanThe dirty state flipped — the model diverged from, or returned to, the save point.

Types 36

Event payloads & overlays

Name Type Description
OgeBpmnSelectionEvent{ ids: readonly string[]; elements: readonly OgeBpmnElementInfo[] }Payload of selectionChanged.
OgeBpmnElementInfo{ id: string; type: BpmnNodeType | BpmnEdgeType | 'pool'; name?: string }Summary of one diagram element carried in editor event payloads.
OgeBpmnElementsChangedEvent{ source: OgeBpmnChangeSource; label: string }Payload of elementsChanged: what changed the model and the command label.
OgeBpmnChangeSource'execute' | 'undo' | 'redo' | 'import' | 'new'Origin of a model change reported by elementsChanged and diagramChanged.
OgeBpmnDiagramChangedEvent{ json: BpmnDiagramJson; xml: string; source: OgeBpmnChangeSource }Payload of the debounced diagramChanged autosave stream: the diagram in both persistence formats plus what caused the change.
OgeBpmnImportEvent{ warnings: readonly BpmnImportWarning[] }Payload of importCompleted: the fidelity warnings collected during import.
OgeBpmnOverlay{ elementId: string; html: string; position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center'; offset?: Point }A programmatic HTML badge attached to a diagram element (process-monitoring overlays), registered via addOverlay(). position picks which corner (or the center) of the element's bounds the badge anchors to; offset is extra diagram-unit displacement applied before the screen transform. html is bound through Angular's sanitizing [innerHTML] — script tags and inline event handlers are stripped; a link that keeps target always gets rel="noopener noreferrer" and role is dropped, matching the React layer.
OgeBpmnPaletteItem{ type: BpmnPaletteItemType }One entry of the elements palette.
BpmnPaletteItemTypeBpmnNodeType | 'pool'Everything the palette can place: node types plus the 'pool' pseudo-entry, which creates a collaboration participant.

Engine — import & export

Name Type Description
readBpmnXml(xml: string)BpmnImportResultStandalone, prefix-agnostic BPMN 2.0 reader (bpmn:, bpmn2: or no prefix) — pure TypeScript, usable outside the component. Missing DI is auto-laid-out with a warning.
writeBpmnXml(model: BpmnDiagram)stringStandalone byte-deterministic BPMN 2.0 writer with fixed, normalized prefixes; preserved extensionElements/documentation/unknown attributes are written back verbatim.
toBpmnJson(model: BpmnDiagram)BpmnDiagramJsonWraps the diagram model in the versioned JSON persistence envelope — the standalone twin of OgeBpmnEditor.exportJson().
fromBpmnJson(value: unknown)BpmnJsonParseResultStructurally validates a value produced by toBpmnJson (typically after a JSON.parse round trip through a database) and returns the diagram model, or an error describing the first problem found. Unknown extra keys are tolerated for forward compatibility; version mismatches, missing required maps and broken id cross-references are not.
renderDiagramSvg(model, options?)(model: BpmnDiagram, options?: BpmnSvgExportOptions) =&gt; stringRenders the diagram as a self-contained static <svg> string: shapes, edges (with arrowhead markers) and labels re-rendered with inline fill/stroke attributes, viewBox fitted to the content bounds plus padding. No grid, no selection state, no external CSS.
BpmnSvgExportOptions{ padding?: number }Options of renderDiagramSvg: padding in diagram units added around the content bounds (default 20).
createEmptyDiagram(processId?)BpmnDiagramA fresh empty diagram model with default <definitions> attributes.
BpmnDiagramJson{ version: 1; diagram: BpmnDiagram }Versioned JSON envelope for persisting a diagram to an application database; version guards forward compatibility of the envelope shape.
BpmnJsonParseResult{ model: BpmnDiagram | null; error?: string }Result of fromBpmnJson: the model, or null plus an error message.
BpmnImportResult{ model: BpmnDiagram | null; warnings: readonly BpmnImportWarning[]; error?: string }Result of importing BPMN XML: the model (null on fatal errors) plus fidelity warnings.
BpmnImportWarning / BpmnImportWarningCode{ code, message, elementId?, localName? } · 'unsupported-element' | 'missing-di' | 'multiple-processes' | 'dangling-ref' | 'event-definition-stripped' | 'invalid-event-definition' | 'nested-lanes-flattened'A non-fatal fidelity loss reported while importing — dropped flow elements, stripped or position-invalid event definitions, dangling references, missing DI, flattened nested lanes.

Engine — alignment

Name Type Description
alignElements(rects, mode)(rects: Readonly&lt;Record&lt;string, Rect&gt;&gt;, mode: BpmnAlignMode) =&gt; Record&lt;string, Point&gt;Computes the per-element move deltas that align the given rectangles (bpmn-js align-elements semantics): edge modes move to the outermost matching edge, center modes to the center of the joint bounding box. Every input id appears in the result (zero delta when already aligned); fewer than 2 rectangles produce an empty result. Pure — no model involved.
distributeElements(rects, axis)(rects: Readonly&lt;Record&lt;string, Rect&gt;&gt;, axis: BpmnDistributeAxis) =&gt; Record&lt;string, Point&gt;Computes the deltas that spread the elements at equal center gaps along one axis (3+ elements). Pure — no model involved.
BpmnAlignMode'left' | 'centerX' | 'right' | 'top' | 'centerY' | 'bottom'Alignment edge/axis of alignElements: edge values align the matching edges, centerX/centerY align the centers on the horizontal / vertical axis of the selection's bounding box.
BpmnDistributeAxis'x' | 'y'Distribution axis of distributeElements: x spreads horizontally.

Engine — model

Name Type Description
BpmnDiagramreadonly plain-object graphThe complete immutable diagram model: the default process, optional collaboration pools, nodes/edges records, a deterministic order list, per-element DI bounds/waypoints and the preserved foreign XML fragments. All nodes and edges of every pool's process live in the single flat maps; a node's poolId decides which <bpmn:process> it is serialized into.
BpmnNode / BpmnNodeType'startEvent' | 'endEvent' | 'intermediateThrowEvent' | 'intermediateCatchEvent' | 'boundaryEvent' | 'task' | 'userTask' | 'serviceTask' | 'scriptTask' | 'callActivity' | 'subProcess' | 'eventSubProcess' | 'transaction' | 'exclusiveGateway' | 'parallelGateway' | 'dataObject' | 'dataStore' | 'group' | 'textAnnotation'A diagram node and every node kind that can appear on the canvas. Events carry eventDefinition (and boundary events attachedToRef/cancelActivity), gateways carry defaultFlowId, activities carry marker/isForCompensation, call activities calledElement, sub-process children parentId, annotations text.
BpmnEdge / BpmnEdgeType'sequenceFlow' | 'association' | 'messageFlow' | 'dataAssociation'A connection with sourceRef/targetRef: sequence flows (may carry name and conditionExpression), annotation associations, cross-pool message flows and data associations (v0.4 — one endpoint must be an activity).
BpmnEventDefinitionKind'message' | 'timer' | 'error' | 'signal' | 'escalation' | 'conditional' | 'link' | 'compensate' | 'terminate'The nine standard BPMN event definition kinds (single definition per event).
VALID_EVENT_DEFINITIONSReadonly&lt;Record&lt;event position, readonly BpmnEventDefinitionKind[]&gt;&gt;Which event definition kinds each event position accepts (BPMN 2.0 table 10.87 subset), enforced by the reader and the panel definition select. v0.3 simplification: error on a start event is allowed unconditionally although the spec restricts it to event sub-processes.
BpmnActivityMarker'loop' | 'multiInstanceParallel' | 'multiInstanceSequential' | 'compensation'Loop/multi-instance/compensation markers rendered at an activity's bottom center.
BpmnSubProcessType'subProcess' | 'eventSubProcess' | 'transaction'The three sub-process container kinds (children carry parentId).
BpmnDataNodeType'dataObject' | 'dataStore'Data element kinds (v0.4): the page-with-fold object and the cylinder store.
BpmnPool / BpmnLaneinterfacesA collaboration participant and its swimlanes. A pool without a processRef is a black-box pool: it renders as an empty band and is a valid message-flow endpoint, but has no process contents. Lane membership is the ordered flowNodeRefs id list, auto-maintained from geometry on every editing command.
BpmnMessageFlowinterfaceA message flow between elements of different pools. Either endpoint may be a participant (pool) id or a flow-node id; serialized inside the <bpmn:collaboration> element.
BpmnClipboardinterfaceA deep-cloned diagram subgraph held by the editor's internal clipboard: the copied nodes plus every edge whose both endpoints were copied, with their DI. Ids still refer to the source diagram; pasting remaps them.
Point / Rect{ x, y } · { x, y, width, height }Geometry primitives used by DI bounds and waypoints.

Configuration

Properties 35

OgeBpmnConfig

Name Type DefaultDescription
gridSizenumber10Grid step in diagram units used for placement and arrow-key movement.
snapThresholdnumber5Neighbor-alignment snapping threshold in diagram units — center/edge alignment beats the grid inside it.
zoomMin / zoomMaxnumber0.2 / 4Bounds of the zoom factor.
autoSaveDebounceMsnumber500Debounce in milliseconds for the editor's diagramChanged autosave stream: rapid model changes collapse into one emission carrying the final state; 0 emits synchronously after every change. Serialization happens only on emit and never while dragging (move/bend gestures commit a single command on release).
colorPresetsreadonly string[]OGE_DEFAULT_BPMN_COLOR_PRESETSFill color presets (any CSS color strings) offered as swatch buttons in the properties panel's appearance section. Presets set the fill only; the stroke has its own picker.
messagesOgeBpmnMessages—Every user-facing string the editor renders, including aria labels.

OgeBpmnMessages

Name Type DefaultDescription
canvasLabel / canvasHintstring—Accessible name of the role="application" canvas, and the focus hint explaining how to leave the diagram (appended to the label).
emptyTextstring—Centered hint shown while the diagram has no elements.
paletteLabelstring—Accessible name of the elements palette toolbar.
paletteLabelsReadonly&lt;Record&lt;BpmnPaletteItemType, string&gt;&gt;—Label (tooltip + aria label) of each palette entry, per palette item type (including 'pool') — a full record, so an override supplies every key.
toolsOgeBpmnToolsMessages—Labels of the tool strip below the palette: label (the toolbar's accessible name), hand, lasso, space, globalConnect and search.
alignOgeBpmnAlignMessages—Labels of the align/distribute flyout on multi-element selections: menuLabel, the six align* entries and distributeHorizontal/distributeVertical (equal gaps, 3+ elements).
searchOgeBpmnSearchMessages—Labels of the element search overlay (Ctrl+F): label, placeholder and noResults.
minimapLabelstring—Accessible name of the minimap navigation overlay.
contextPadOgeBpmnContextPadMessages—Aria labels and titles of the context-pad actions: connect, appendTask, appendGateway, appendEndEvent, editLabel, toggleDefault, deleteElement.
announcementsOgeBpmnAnnouncementMessages—Live-region announcement templates; {token} placeholders are substituted.
elementNamesReadonly&lt;Record&lt;BpmnElementNameKey, string&gt;&gt;—Fallback display name per element type — node/edge types plus pools and lanes — used when an element has no name.
propertiesOgeBpmnPropertiesMessages—Labels of the properties panel: headings, field labels and templates.

OgeBpmnPropertiesMessages

Name Type DefaultDescription
panelLabel / processHeading / name / id / executablestring—The panel region's accessible name, the no-selection (process) heading, the name field label, the read-only id row label and the process "is executable" checkbox label.
condition / defaultFlow / annotationText / selectionCountstring—The sequence-flow condition textarea, the "default flow" checkbox on an exclusive gateway's flow, the text-annotation textarea and the multi-selection summary ({count}).
appearanceHeading / fillLabel / strokeLabel / clearColors / presetLabelstring—The appearance (colors) section: heading, fill/stroke picker labels, the "clear colors" button and the aria label of a preset swatch ({color}).
typeLabel / eventDefinition / noneOption / eventDefinitionNamesstring · Readonly&lt;Record&lt;BpmnEventDefinitionKind, string&gt;&gt;—The element type (morph) select, the event definition select on events, the shared "None" option and the display name per event definition kind.
interrupting / collapsed / marker / markerNames / forCompensation / calledElementstring · Readonly&lt;Record&lt;marker, string&gt;&gt;—The boundary event "Interrupting" checkbox, the sub-process "Collapsed" checkbox, the activity marker select with its per-marker display names, the "For compensation" checkbox and the call activity "Called element" field.
lanesHeading / addLane / removeLane / laneNamestring—The lanes section of the pool panel: heading, "Add lane" button, per-lane "Remove" button ({name}) and lane name input aria label ({name}).

OgeBpmnAnnouncementMessages

Name Type DefaultDescription
created / moved / connected / deletedstring templates—After a palette placement ({type}), a move ({name}), a connection ({source}/{target}) and a deletion ({count}).
undone / redonestring templates—After undo/redo; {label} is the affected command label.
selected / selectionClearedstring templates—When an element becomes selected ({name}) and when the selection is cleared.
imported / importedWithWarningsstring templates—After a clean import, and after an import that produced warnings ({count}).
connectDenied / labelEditedstring templates—When a requested connection is not allowed by the rules, and after an inline label edit is committed.
copied / cut / pastedstring templates—After a clipboard copy, cut and paste; {count} is the number of affected elements.
recolored / resized / typeChangedstring templates—After a recolor ({count}), a resize ({name}) and a properties-panel type morph ({name}/{type}).
attached / attachDenied / collapsedToggledstring templates—After a boundary event attaches ({name}/{host}), when a boundary-event placement finds no activity border, and after a sub-process collapse/expand ({name}).
poolCreated / laneAdded / laneRemovedstring templates—After a pool is placed from the palette and after a lane is added to / removed from a pool ({name} is the pool's display name).
aligned / distributed / spaceAdjustedstring templates—After an align, distribute and space-tool commit; {count} is the number of moved/shifted elements.
searchResults / labelMoved / waypointRemovedstring templates—When the search result set changes ({count}), after an external label drag ({name}) and after a bend-point handle was removed by double click.

Types 7

Name Type Description
provideOgeBpmnConfig(config: OgeBpmnConfigInput)ProviderApplication- or component-scoped editor defaults; messages is a partial merged over the built-in English strings.
OgeBpmnConfigInputPartial&lt;OgeBpmnConfig&gt; with Partial&lt;OgeBpmnMessages&gt;Argument shape of provideOgeBpmnConfig().
OGE_BPMN_CONFIGInjectionToken&lt;OgeBpmnConfig&gt;The DI token the editor reads; defaults to OGE_DEFAULT_BPMN_CONFIG.
OGE_DEFAULT_BPMN_CONFIG / OGE_DEFAULT_BPMN_MESSAGESOgeBpmnConfig / OgeBpmnMessagesThe built-in defaults — handy as a base for wholesale message replacement.
OGE_DEFAULT_BPMN_COLOR_PRESETSreadonly string[]The default fill presets of the properties panel's appearance section: eight soft pastel tones that keep dark strokes and labels readable. Override per app via colorPresets.
BpmnElementNameKeyBpmnNodeType | BpmnEdgeType | 'pool' | 'lane'Every key of elementNames: node/edge types plus pools and lanes.
OgeBpmnContextPadMessages / OgeBpmnToolsMessages / OgeBpmnAlignMessages / OgeBpmnSearchMessages / OgeBpmnPropertiesMessages / OgeBpmnHeaderMessagesinterfacesThe message blocks referenced above — context-pad actions, tool strip, align/distribute flyout, search overlay and properties panel.

Notes

  • There is no [diagram] input — the model is owned by the editor's command stack so undo can never desynchronize. Load with importXml(), observe with elementsChanged, read back with exportXml().
  • Import never fails silently: the few constructs the model cannot represent (nested lane sets, extra event definitions on one event, timer/error definition payloads) are dropped with an explicit BpmnImportWarning, while extensionElements, documentation and unknown attributes are preserved verbatim and written back on export — camunda-flavored files round-trip byte-identically.
  • Persistence has three formats: BPMN XML (importXml/exportXml), the versioned JSON envelope (importJson/exportJson, also emitted by the debounced diagramChanged autosave stream) and static SVG (exportSvg, one-way).