├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ ├── BUG_REPORT.md │ ├── FEATURE_REQUEST.md │ ├── TASK.md │ └── config.yml ├── merge-me.yml └── workflows │ ├── CI.yml │ ├── CODE_SCANNING.yml │ ├── MERGE_MAIN_TO_DEVELOP.yml │ ├── POST_RELEASE.yml │ └── RELEASE.yml ├── .gitignore ├── .release-please-manifest.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── assets └── bpmn-js.css ├── docs ├── architecture │ └── overview.svg ├── project │ ├── SETUP.md │ ├── setup-alternative.sh │ ├── setup.bat │ └── setup.sh └── translations.json ├── eslint.config.mjs ├── lib ├── BaseModeler.js ├── BaseModeler.spec.ts ├── BaseViewer.js ├── BaseViewer.spec.ts ├── Modeler.js ├── Modeler.spec.ts ├── NavigatedViewer.js ├── NavigatedViewer.spec.ts ├── Viewer.js ├── Viewer.spec.ts ├── core │ └── index.js ├── draw │ ├── BpmnRenderUtil.js │ ├── BpmnRenderer.js │ ├── PathMap.js │ ├── TextRenderer.js │ ├── TextRenderer.spec.ts │ └── index.js ├── features │ ├── align-elements │ │ ├── AlignElementsContextPadProvider.js │ │ ├── AlignElementsIcons.js │ │ ├── AlignElementsMenuProvider.js │ │ ├── BpmnAlignElements.js │ │ └── index.js │ ├── append-preview │ │ ├── AppendPreview.js │ │ └── index.js │ ├── auto-place │ │ ├── BpmnAutoPlace.js │ │ ├── BpmnAutoPlaceUtil.js │ │ └── index.js │ ├── auto-resize │ │ ├── BpmnAutoResize.js │ │ ├── BpmnAutoResizeProvider.js │ │ └── index.js │ ├── context-pad │ │ ├── ContextPadProvider.js │ │ └── index.js │ ├── copy-paste │ │ ├── BpmnCopyPaste.js │ │ ├── ModdleCopy.js │ │ └── index.js │ ├── di-ordering │ │ ├── BpmnDiOrdering.js │ │ └── index.js │ ├── distribute-elements │ │ ├── BpmnDistributeElements.js │ │ ├── DistributeElementsIcons.js │ │ ├── DistributeElementsMenuProvider.js │ │ └── index.js │ ├── drilldown │ │ ├── DrilldownBreadcrumbs.js │ │ ├── DrilldownCentering.js │ │ ├── DrilldownOverlayBehavior.js │ │ ├── SubprocessCompatibility.js │ │ └── index.js │ ├── editor-actions │ │ ├── BpmnEditorActions.js │ │ └── index.js │ ├── grid-snapping │ │ ├── BpmnGridSnapping.js │ │ ├── behavior │ │ │ ├── GridSnappingAutoPlaceBehavior.js │ │ │ ├── GridSnappingLayoutConnectionBehavior.js │ │ │ ├── GridSnappingParticipantBehavior.js │ │ │ └── index.js │ │ └── index.js │ ├── interaction-events │ │ ├── BpmnInteractionEvents.js │ │ └── index.js │ ├── keyboard │ │ ├── BpmnKeyboardBindings.js │ │ └── index.js │ ├── label-editing │ │ ├── LabelEditingPreview.js │ │ ├── LabelEditingProvider.js │ │ ├── LabelUtil.js │ │ ├── cmd │ │ │ └── UpdateLabelHandler.js │ │ └── index.js │ ├── modeling-feedback │ │ ├── ModelingFeedback.js │ │ └── index.js │ ├── modeling │ │ ├── BpmnFactory.js │ │ ├── BpmnLayouter.js │ │ ├── BpmnUpdater.js │ │ ├── ElementFactory.js │ │ ├── ElementFactory.test.ts │ │ ├── Modeling.js │ │ ├── Modeling.test.ts │ │ ├── behavior │ │ │ ├── AdaptiveLabelPositioningBehavior.js │ │ │ ├── AppendBehavior.js │ │ │ ├── AssociationBehavior.js │ │ │ ├── AttachEventBehavior.js │ │ │ ├── BoundaryEventBehavior.js │ │ │ ├── CompensateBoundaryEventBehavior.js │ │ │ ├── CreateBehavior.js │ │ │ ├── CreateDataObjectBehavior.js │ │ │ ├── CreateParticipantBehavior.js │ │ │ ├── DataInputAssociationBehavior.js │ │ │ ├── DataStoreBehavior.js │ │ │ ├── DeleteLaneBehavior.js │ │ │ ├── DetachEventBehavior.js │ │ │ ├── DropOnFlowBehavior.js │ │ │ ├── EventBasedGatewayBehavior.js │ │ │ ├── FixHoverBehavior.js │ │ │ ├── GroupBehavior.js │ │ │ ├── ImportDockingFix.js │ │ │ ├── IsHorizontalFix.js │ │ │ ├── LabelBehavior.js │ │ │ ├── LayoutConnectionBehavior.js │ │ │ ├── MessageFlowBehavior.js │ │ │ ├── NonInterruptingBehavior.js │ │ │ ├── RemoveElementBehavior.js │ │ │ ├── RemoveEmbeddedLabelBoundsBehavior.js │ │ │ ├── RemoveParticipantBehavior.js │ │ │ ├── ReplaceConnectionBehavior.js │ │ │ ├── ReplaceElementBehaviour.js │ │ │ ├── ResizeBehavior.js │ │ │ ├── ResizeLaneBehavior.js │ │ │ ├── RootElementReferenceBehavior.js │ │ │ ├── SetCompensationActivityAfterPasteBehavior.js │ │ │ ├── SpaceToolBehavior.js │ │ │ ├── SubProcessPlaneBehavior.js │ │ │ ├── SubProcessStartEventBehavior.js │ │ │ ├── TextAnnotationBehavior.js │ │ │ ├── ToggleCollapseConnectionBehaviour.js │ │ │ ├── ToggleElementCollapseBehaviour.js │ │ │ ├── UnclaimIdBehavior.js │ │ │ ├── UnsetDefaultFlowBehavior.js │ │ │ ├── UpdateFlowNodeRefsBehavior.js │ │ │ ├── index.js │ │ │ └── util │ │ │ │ ├── CategoryUtil.js │ │ │ │ ├── ConnectionLayoutUtil.js │ │ │ │ ├── GeometricUtil.js │ │ │ │ ├── LabelLayoutUtil.js │ │ │ │ ├── LayoutUtil.js │ │ │ │ ├── LineAttachmentUtil.js │ │ │ │ ├── LineIntersect.js │ │ │ │ ├── NonInterruptingUtil.js │ │ │ │ └── ResizeUtil.js │ │ ├── cmd │ │ │ ├── AddLaneHandler.js │ │ │ ├── IdClaimHandler.js │ │ │ ├── ResizeLaneHandler.js │ │ │ ├── SetColorHandler.js │ │ │ ├── SplitLaneHandler.js │ │ │ ├── UpdateCanvasRootHandler.js │ │ │ ├── UpdateFlowNodeRefsHandler.js │ │ │ ├── UpdateModdlePropertiesHandler.js │ │ │ ├── UpdatePropertiesHandler.js │ │ │ └── UpdateSemanticParentHandler.js │ │ ├── index.js │ │ └── util │ │ │ ├── LaneUtil.js │ │ │ └── ModelingUtil.js │ ├── ordering │ │ ├── BpmnOrderingProvider.js │ │ └── index.js │ ├── outline │ │ ├── OutlineProvider.js │ │ ├── OutlineUtil.js │ │ └── index.js │ ├── palette │ │ ├── PaletteProvider.js │ │ └── index.js │ ├── popup-menu │ │ ├── ReplaceMenuProvider.js │ │ ├── index.js │ │ └── util │ │ │ ├── Icons.js │ │ │ └── TypeUtil.js │ ├── replace-preview │ │ ├── BpmnReplacePreview.js │ │ └── index.js │ ├── replace │ │ ├── BpmnReplace.js │ │ ├── ReplaceOptions.js │ │ └── index.js │ ├── rules │ │ ├── BpmnRules.js │ │ └── index.js │ ├── search │ │ ├── BpmnSearchProvider.js │ │ └── index.js │ ├── snapping │ │ ├── BpmnConnectSnapping.js │ │ ├── BpmnCreateMoveSnapping.js │ │ ├── BpmnSnappingUtil.js │ │ └── index.js │ └── space-tool │ │ ├── BpmnSpaceTool.js │ │ └── index.js ├── import │ ├── BpmnImporter.js │ ├── BpmnTreeWalker.js │ ├── Importer.js │ ├── Util.js │ └── index.js ├── index.js ├── model │ └── Types.ts └── util │ ├── CompatibilityUtil.js │ ├── DiUtil.js │ ├── DrilldownUtil.js │ ├── LabelUtil.js │ ├── ModelUtil.js │ ├── PoweredByUtil.js │ ├── Types.js │ └── Types.ts ├── package-lock.json ├── package.json ├── renovate.json ├── resources ├── banner-min.txt ├── banner.txt ├── initial.bpmn ├── logo.svg └── screencast.gif ├── rollup.config.js ├── tasks ├── build-distro.mjs ├── stages │ ├── await-published │ ├── update-demo │ ├── update-examples │ ├── update-integration-test │ ├── update-translations │ └── update-website └── test-distro.mjs ├── test ├── TestHelper.js ├── config │ ├── karma.distro.js │ ├── karma.unit.js │ └── translation-reporter.js ├── coverageBundle.js ├── distro │ ├── bpmn-modeler.js │ ├── bpmn-navigated-viewer.js │ ├── bpmn-viewer.js │ └── helper.js ├── fixtures │ ├── bpmn │ │ ├── align-elements.bpmn │ │ ├── basic.bpmn │ │ ├── boundary-events.bpmn │ │ ├── collaboration-data-items.bpmn │ │ ├── collaboration-message-flows.bpmn │ │ ├── collaboration-sequence-flows.bpmn │ │ ├── collaboration-vertical.bpmn │ │ ├── collaboration.bpmn │ │ ├── collaboration │ │ │ ├── collaboration-data-store.bpmn │ │ │ ├── collaboration-empty-participant.bpmn │ │ │ ├── collaboration-message-flows.bpmn │ │ │ ├── collaboration-participant.bpmn │ │ │ ├── process-empty.bpmn │ │ │ └── process.bpmn │ │ ├── collapsed-sub-process-legacy.bpmn │ │ ├── collapsed-sub-process.bpmn │ │ ├── complex.bpmn │ │ ├── conditions.bpmn │ │ ├── containers.bpmn │ │ ├── distribute-elements-filtering.bpmn │ │ ├── distribute-elements-filtering.collaboration.bpmn │ │ ├── distribute-elements.bpmn │ │ ├── draw │ │ │ ├── activity-markers-combination.bpmn │ │ │ ├── activity-markers-simple.bpmn │ │ │ ├── activity-markers.bpmn │ │ │ ├── associations.bpmn │ │ │ ├── boundary-event-with-refnode.bpmn │ │ │ ├── boundary-event-without-refnode.bpmn │ │ │ ├── boundary-event-z-index.bpmn │ │ │ ├── call-activity.bpmn │ │ │ ├── conditional-flow-default.bpmn │ │ │ ├── conditional-flow-gateways.bpmn │ │ │ ├── conditional-flow-typed-task.bpmn │ │ │ ├── conditional-flow.bpmn │ │ │ ├── data-objects.bpmn │ │ │ ├── event-subprocess-icons.bpmn │ │ │ ├── event-subprocesses-collapsed.bpmn │ │ │ ├── event-subprocesses-expanded.bpmn │ │ │ ├── events-interrupting.bpmn │ │ │ ├── events.bpmn │ │ │ ├── gateway-type-default.bpmn │ │ │ ├── gateways.bpmn │ │ │ ├── group-name.bpmn │ │ │ ├── group.bpmn │ │ │ ├── message-label.bpmn │ │ │ ├── message-marker.bpmn │ │ │ ├── pools-with-collection-marker.bpmn │ │ │ ├── pools.bpmn │ │ │ ├── task-types.bpmn │ │ │ ├── text-annotation.bpmn │ │ │ ├── vertical-pools.bpmn │ │ │ └── xor.bpmn │ │ ├── empty-definitions.bpmn │ │ ├── error │ │ │ ├── binary.png │ │ │ ├── categoryValue.bpmn │ │ │ ├── di-plane-no-bpmn-element.bpmn │ │ │ ├── duplicate-ids.bpmn │ │ │ ├── invalid-child.bpmn │ │ │ ├── missing-namespace.bpmn │ │ │ ├── no-process-collaboration.bpmn │ │ │ └── no-xml.txt │ │ ├── event-sub-processes.bpmn │ │ ├── extension │ │ │ ├── camunda.bpmn │ │ │ ├── custom-override.bpmn │ │ │ └── custom.bpmn │ │ ├── features │ │ │ ├── drop │ │ │ │ ├── drop.bpmn │ │ │ │ └── recursive-task.bpmn │ │ │ ├── replace │ │ │ │ ├── 01_replace.bpmn │ │ │ │ ├── association-gateways.bpmn │ │ │ │ ├── cancel-events.bpmn │ │ │ │ ├── connection.bpmn │ │ │ │ ├── copy-properties.bpmn │ │ │ │ ├── data-elements.bpmn │ │ │ │ ├── data-stores-positioned-against-participant.bpmn │ │ │ │ └── participants.bpmn │ │ │ └── rules │ │ │ │ ├── event-based-gateway-outgoing-edge.bpmn │ │ │ │ ├── link-event.bpmn │ │ │ │ └── text-annotation-association.bpmn │ │ ├── flow-markers.bpmn │ │ ├── import │ │ │ ├── boundaryEvent.bpmn │ │ │ ├── collaboration.bpmn │ │ │ ├── collapsed-subprocess.bpmn │ │ │ ├── collapsed │ │ │ │ ├── collaboration.bpmn │ │ │ │ ├── process.bpmn │ │ │ │ └── processWithChildren.bpmn │ │ │ ├── data-store.inside-participant.bpmn │ │ │ ├── data-store.outside-participant.dangling.bpmn │ │ │ ├── data-store.outside-participant.participant.bpmn │ │ │ ├── data-store.outside-participant.subprocess.bpmn │ │ │ ├── default-attrs.bpmn │ │ │ ├── error │ │ │ │ ├── boundaryEvent-invalidAttachToRef.bpmn │ │ │ │ ├── boundaryEvent-missingAttachToRef.bpmn │ │ │ │ ├── dangling-process-message-flow.bpmn │ │ │ │ ├── invalid-flow-element.bpmn │ │ │ │ └── multiple-dis.bpmn │ │ │ ├── groups.bpmn │ │ │ ├── labels │ │ │ │ ├── collaboration-message-flows.bpmn │ │ │ │ ├── collaboration.bpmn │ │ │ │ ├── embedded.bpmn │ │ │ │ ├── external-no-di.bpmn │ │ │ │ └── external.bpmn │ │ │ ├── multiple-diagrams.bpmn │ │ │ ├── position │ │ │ │ └── position-testcase.bpmn │ │ │ ├── process.bpmn │ │ │ └── text-annotation-message-flow.bpmn │ │ ├── kitchen-sink.bpmn │ │ ├── multiple-diagrams-lanesets.bpmn │ │ ├── multiple-diagrams-overlapping-di.bpmn │ │ ├── multiple-diagrams.bpmn │ │ ├── multiple-nested-processes.bpmn │ │ ├── nested-subprocesses.bpmn │ │ ├── sequence-flows.bpmn │ │ ├── simple-resizable.bpmn │ │ └── simple.bpmn │ └── json │ │ └── model │ │ ├── camunda.json │ │ ├── custom-override.json │ │ └── custom.json ├── helper │ ├── TranslationCollector.js │ └── index.js ├── integration │ ├── CustomElementsSpec.js │ ├── ReimportSpec.js │ ├── SimpleModelingSpec.js │ ├── custom-elements │ │ ├── CustomElementFactory.js │ │ ├── CustomRenderer.js │ │ ├── CustomRules.js │ │ ├── CustomUpdater.js │ │ └── index.js │ └── model │ │ └── BpmnModdleSpec.js ├── matchers │ ├── BoundsMatchers.js │ ├── ConnectionMatchers.js │ └── JSONMatcher.js ├── spec │ ├── .eslintrc │ ├── BaseModelerSpec.js │ ├── BaseViewerSpec.js │ ├── Modeler.copy-paste.a.bpmn │ ├── Modeler.copy-paste.b.bpmn │ ├── Modeler.copy-paste.complex.bpmn │ ├── Modeler.copy-paste.empty.bpmn │ ├── ModelerSpec.js │ ├── NavigatedViewerSpec.js │ ├── ViewerSpec.js │ ├── draw │ │ ├── BpmnRenderUtilSpec.js │ │ ├── BpmnRenderer.colors.bpmn │ │ ├── BpmnRenderer.connection-colors.bpmn │ │ ├── BpmnRenderer.group-colors.bpmn │ │ ├── BpmnRenderer.labels.bpmn │ │ ├── BpmnRenderer.no-event-icons.bpmn │ │ ├── BpmnRenderer.sequenceFlow-no-source.bpmn │ │ ├── BpmnRenderer.simple-cropping.bpmn │ │ ├── BpmnRendererSpec.js │ │ ├── TextRenderer.bpmn │ │ ├── TextRendererSpec.js │ │ └── custom-renderer │ │ │ ├── CustomRenderer.js │ │ │ └── index.js │ ├── environment │ │ └── MockingSpec.js │ ├── features │ │ ├── align-elements │ │ │ ├── AlignElementsContextPadProviderSpec.js │ │ │ ├── AlignElementsMenuProviderSpec.js │ │ │ └── BpmnAlignElementsSpec.js │ │ ├── append-preview │ │ │ ├── AppendPreview.bpmn │ │ │ └── AppendPreviewSpec.js │ │ ├── auto-place │ │ │ ├── BpmnAutoPlace.boundary-events.bpmn │ │ │ ├── BpmnAutoPlace.bpmn │ │ │ ├── BpmnAutoPlace.multi-connection.bpmn │ │ │ ├── BpmnAutoPlace.subprocess.bpmn │ │ │ ├── BpmnAutoPlace.subprocess.horizontal.bpmn │ │ │ ├── BpmnAutoPlace.subprocess.vertical.bpmn │ │ │ ├── BpmnAutoPlace.vertical.boundary-events.bpmn │ │ │ ├── BpmnAutoPlace.vertical.bpmn │ │ │ ├── BpmnAutoPlace.vertical.multi-connection.bpmn │ │ │ └── BpmnAutoPlaceSpec.js │ │ ├── auto-resize │ │ │ ├── AutoResize.lanes.bpmn │ │ │ ├── AutoResize.multi-selection.bpmn │ │ │ ├── AutoResize.nested-sub-processes.bpmn │ │ │ ├── AutoResize.participant.bpmn │ │ │ ├── AutoResize.space-tool.bpmn │ │ │ ├── AutoResize.sub-processes.bpmn │ │ │ └── AutoResizeSpec.js │ │ ├── context-pad │ │ │ ├── ContextPad.activation.bpmn │ │ │ └── ContextPadProviderSpec.js │ │ ├── copy-paste │ │ │ ├── BpmnCopyPasteSpec.js │ │ │ ├── ModdleCopySpec.js │ │ │ ├── basic.bpmn │ │ │ ├── collaboration-multiple.bpmn │ │ │ ├── collaboration.bpmn │ │ │ ├── collapsed-subprocess.bpmn │ │ │ ├── complex.bpmn │ │ │ ├── copy-properties.bpmn │ │ │ ├── data-associations.bpmn │ │ │ ├── event-based-gateway.bpmn │ │ │ └── properties.bpmn │ │ ├── distribute-elements │ │ │ ├── BpmnDistributeElementsSpec.js │ │ │ └── DistributeElementsMenuProviderSpec.js │ │ ├── drilldown │ │ │ ├── DrilldownIntegrationSpec.js │ │ │ ├── DrilldownOverlayBehaviorSpec.bpmn │ │ │ ├── DrilldownOverlaysBehaviorSpec.js │ │ │ ├── DrilldownSpec.js │ │ │ ├── collaboration-subprocesses.bpmn │ │ │ ├── diagram-missing-plane.bpmn │ │ │ ├── legacy-subprocesses.bpmn │ │ │ ├── nested-subprocesses.bpmn │ │ │ ├── plane-missing-bpmnelement.bpmn │ │ │ ├── process-missing-bpmndiagram.bpmn │ │ │ ├── subprocess-missing-bpmndiagram.bpmn │ │ │ └── subprocess-missing-di.bpmn │ │ ├── editor-actions │ │ │ └── BpmnEditorActionsSpec.js │ │ ├── grid-snapping │ │ │ ├── BpmnGridSnapping.bpmn │ │ │ ├── BpmnGridSnappingSpec.js │ │ │ ├── basic.bpmn │ │ │ └── behavior │ │ │ │ ├── AutoPlaceBehavior.bpmn │ │ │ │ ├── AutoPlaceBehaviorSpec.js │ │ │ │ ├── AutoResizeBehavior.bpmn │ │ │ │ ├── AutoResizeBehaviorSpec.js │ │ │ │ ├── CreateParticipantBehavior.bpmn │ │ │ │ ├── CreateParticipantBehaviorSpec.js │ │ │ │ ├── LayoutConnectionBehavior.bpmn │ │ │ │ └── LayoutConnectionBehaviorSpec.js │ │ ├── interaction-events │ │ │ └── BpmnInteractionEventsSpec.js │ │ ├── keyboard-move-selection │ │ │ ├── KeyboardMoveSelectionSpec.js │ │ │ └── keyboard-move-selection.bpmn │ │ ├── keyboard │ │ │ └── BpmnKeyboardBindingsSpec.js │ │ ├── label-editing │ │ │ ├── LabelEditing.bpmn │ │ │ ├── LabelEditingPreviewSpec.js │ │ │ └── LabelEditingProviderSpec.js │ │ ├── modeling-feedback │ │ │ ├── ModelingFeedback.bpmn │ │ │ └── ModelingFeedbackSpec.js │ │ ├── modeling │ │ │ ├── AppendShapeSpec.js │ │ │ ├── BendpointsSpec.js │ │ │ ├── BpmnFactorySpec.js │ │ │ ├── BpmnUpdater.bpmn │ │ │ ├── BpmnUpdater.incompleteDi.bpmn │ │ │ ├── BpmnUpdaterSpec.js │ │ │ ├── CreateConnectionSpec.js │ │ │ ├── DeleteConnectionSpec.js │ │ │ ├── DeleteParticipantSpec.js │ │ │ ├── DeleteShape.cropping.bpmn │ │ │ ├── DeleteShapeSpec.js │ │ │ ├── DropSpec.js │ │ │ ├── ElementFactory.bpmn │ │ │ ├── ElementFactorySpec.js │ │ │ ├── IdClaim.bpmn │ │ │ ├── IdClaimSpec.js │ │ │ ├── LabelBoundsSpec.js │ │ │ ├── LabelBoundsSpec.simple.bpmn │ │ │ ├── LabelLayouting.initial.bpmn │ │ │ ├── LabelLayouting.integration.bpmn │ │ │ ├── LabelLayouting.move.bpmn │ │ │ ├── LabelLayoutingSpec.js │ │ │ ├── LoggingCroppingConnectionDocking.js │ │ │ ├── MoveConnectionSpec.js │ │ │ ├── MoveElements.boundary-connection.bpmn │ │ │ ├── MoveElements.centered-connection.bpmn │ │ │ ├── MoveElements.collaboration-association.bpmn │ │ │ ├── MoveElements.data-input-output.bpmn │ │ │ ├── MoveElements.eventBasedTargets.bpmn │ │ │ ├── MoveElements.flow-collaboration.bpmn │ │ │ ├── MoveElementsSpec.js │ │ │ ├── MoveRulesSpec.js │ │ │ ├── MoveShapeSpec.js │ │ │ ├── MoveStress.bpmn │ │ │ ├── MoveStressSpec.js │ │ │ ├── ResizeShapeSpec.js │ │ │ ├── SetColor.bpmn │ │ │ ├── SetColorSpec.js │ │ │ ├── UpdateAttachmentSpec.js │ │ │ ├── UpdateLabel.bpmn │ │ │ ├── UpdateLabelSpec.js │ │ │ ├── UpdateModdleProperties.dataObject.bpmn │ │ │ ├── UpdateModdleProperties.error.bpmn │ │ │ ├── UpdateModdlePropertiesSpec.js │ │ │ ├── UpdatePropertiesSpec.js │ │ │ ├── UpdateSemanticParent.bpmn │ │ │ ├── UpdateSemanticParentSpec.js │ │ │ ├── append │ │ │ │ └── TextAnnotationSpec.js │ │ │ ├── behavior │ │ │ │ ├── AdaptiveLabelPositioningBehavior.basics.bpmn │ │ │ │ ├── AdaptiveLabelPositioningBehavior.boundary-events.bpmn │ │ │ │ ├── AdaptiveLabelPositioningBehaviorSpec.js │ │ │ │ ├── AssociationBehavior.bpmn │ │ │ │ ├── AssociationBehaviorSpec.js │ │ │ │ ├── AttachEventBehavior.bpmn │ │ │ │ ├── AttachEventBehaviorSpec.js │ │ │ │ ├── BoundaryEvent.bpmn │ │ │ │ ├── BoundaryEventBehaviorSpec.js │ │ │ │ ├── CompensateBoundaryEventBehavior.bpmn │ │ │ │ ├── CompensateBoundaryEventBehaviorSpec.js │ │ │ │ ├── CompensationAssociationBehavior.bpmn │ │ │ │ ├── CompensationAssociationBehaviorSpec.js │ │ │ │ ├── CreateBehavior.bpmn │ │ │ │ ├── CreateBehaviorSpec.js │ │ │ │ ├── CreateParticipantBehaviorSpec.js │ │ │ │ ├── DataInputAssociationBehavior.bpmn │ │ │ │ ├── DataInputAssociationBehaviorSpec.js │ │ │ │ ├── DataObjectBehavior.create-data-association.bpmn │ │ │ │ ├── DataObjectBehavior.data-object-reference.bpmn │ │ │ │ ├── DataObjectBehavior.remove-data-association.bpmn │ │ │ │ ├── DataObjectBehaviorSpec.js │ │ │ │ ├── DataStoreBehavior.bpmn │ │ │ │ ├── DataStoreBehavior.collaboration.bpmn │ │ │ │ ├── DataStoreBehavior.connect.bpmn │ │ │ │ ├── DataStoreBehavior.empty-pool.bpmn │ │ │ │ ├── DataStoreBehavior.process.bpmn │ │ │ │ ├── DataStoreBehavior.remove-participant.bpmn │ │ │ │ ├── DataStoreBehaviorSpec.js │ │ │ │ ├── DetachEventBehavior.bpmn │ │ │ │ ├── DetachEventBehaviorSpec.js │ │ │ │ ├── DropOnFlowBehavior.bpmn │ │ │ │ ├── DropOnFlowBehaviorSpec.js │ │ │ │ ├── EventBasedGatewayBehavior.bpmn │ │ │ │ ├── EventBasedGatewayBehaviorSpec.js │ │ │ │ ├── FixHoverBehavior.annotation.bpmn │ │ │ │ ├── FixHoverBehavior.group.bpmn │ │ │ │ ├── FixHoverBehavior.label.bpmn │ │ │ │ ├── FixHoverBehavior.lane-connect.bpmn │ │ │ │ ├── FixHoverBehavior.participant.bpmn │ │ │ │ ├── FixHoverBehaviorSpec.js │ │ │ │ ├── GroupBehaviorSpec.bpmn │ │ │ │ ├── GroupBehaviorSpec.js │ │ │ │ ├── ImportDockingFix.bpmn │ │ │ │ ├── ImportDockingFixSpec.js │ │ │ │ ├── IsHorizontalFix.bpmn │ │ │ │ ├── IsHorizontalFixSpec.js │ │ │ │ ├── LabelBehavior.bpmn │ │ │ │ ├── LabelBehavior.copyPaste.bpmn │ │ │ │ ├── LabelBehaviorSpec.js │ │ │ │ ├── LayoutConnectionBehavior.bpmn │ │ │ │ ├── LayoutConnectionBehaviorSpec.js │ │ │ │ ├── MessageFlowBehavior.bpmn │ │ │ │ ├── MessageFlowBehaviorSpec.js │ │ │ │ ├── NonInterruptingBehavior.bpmn │ │ │ │ ├── NonInterruptingBehaviorSpec.js │ │ │ │ ├── ReconnectConnection.data-association.bpmn │ │ │ │ ├── ReconnectConnectionSpec.js │ │ │ │ ├── RemoveElementBehavior.bpmn │ │ │ │ ├── RemoveElementBehavior.diagonal.bpmn │ │ │ │ ├── RemoveElementBehavior.perpendicular.bpmn │ │ │ │ ├── RemoveElementBehavior.vertical.diagonal.bpmn │ │ │ │ ├── RemoveElementBehaviorSpec.js │ │ │ │ ├── RemoveEmbeddedLabelBoundsBehavior.bpmn │ │ │ │ ├── RemoveEmbeddedLabelBoundsBehaviorSpec.js │ │ │ │ ├── RemoveParticipantBehaviorSpec.js │ │ │ │ ├── ReplaceConnectionBehavior.association.bpmn │ │ │ │ ├── ReplaceConnectionBehavior.boundary-events.bpmn │ │ │ │ ├── ReplaceConnectionBehavior.message-sequence-flow.bpmn │ │ │ │ ├── ReplaceConnectionBehaviorSpec.js │ │ │ │ ├── ReplaceElementBehaviourSpec.js │ │ │ │ ├── ResizeBehavior.lanes.bpmn │ │ │ │ ├── ResizeBehavior.lanes.vertical.bpmn │ │ │ │ ├── ResizeBehavior.participant.bpmn │ │ │ │ ├── ResizeBehavior.participant.vertical.bpmn │ │ │ │ ├── ResizeBehavior.subProcess.bpmn │ │ │ │ ├── ResizeBehavior.textAnnotation.bpmn │ │ │ │ ├── ResizeBehavior.utility.lanes-flowNodes.bpmn │ │ │ │ ├── ResizeBehavior.utility.lanes.bpmn │ │ │ │ ├── ResizeBehavior.utility.lanes.vertical-flowNodes.bpmn │ │ │ │ ├── ResizeBehavior.utility.lanes.vertical.bpmn │ │ │ │ ├── ResizeBehaviorSpec.js │ │ │ │ ├── RootElementReferenceBehavior.bpmn │ │ │ │ ├── RootElementReferenceBehaviorSpec.js │ │ │ │ ├── SetCompensationActivityAfterPasteBehaviorSpec.bpmn │ │ │ │ ├── SetCompensationActivityAfterPasteBehaviorSpec.js │ │ │ │ ├── SpaceToolBehaviorSpec.group.bpmn │ │ │ │ ├── SpaceToolBehaviorSpec.js │ │ │ │ ├── SpaceToolBehaviorSpec.participant.bpmn │ │ │ │ ├── SpaceToolBehaviorSpec.participant.vertical.bpmn │ │ │ │ ├── SpaceToolBehaviorSpec.subprocess.bpmn │ │ │ │ ├── SubProcessBehavior.copy-paste.bpmn │ │ │ │ ├── SubProcessBehavior.multiple-planes.bpmn │ │ │ │ ├── SubProcessBehavior.planes.bpmn │ │ │ │ ├── SubProcessBehavior.start-event.bpmn │ │ │ │ ├── SubProcessPlaneBehaviorSpec.js │ │ │ │ ├── SubProcessStartEventBehaviorSpec.js │ │ │ │ ├── TextAnnotationBehaviorSpec.bpmn │ │ │ │ ├── TextAnnotationBehaviorSpec.js │ │ │ │ ├── ToggleCollapseConnectionBehaviourSpec.bpmn │ │ │ │ ├── ToggleCollapseConnectionBehaviourSpec.js │ │ │ │ ├── ToggleElementCollapseBehaviour.bpmn │ │ │ │ ├── ToggleElementCollapseBehaviourSpec.js │ │ │ │ ├── UnclaimIdBehaviorSpec.bpmn │ │ │ │ ├── UnclaimIdBehaviorSpec.js │ │ │ │ ├── UnsetDefaultFlowBehaviorSpec.bpmn │ │ │ │ ├── UnsetDefaultFlowBehaviorSpec.js │ │ │ │ └── util │ │ │ │ │ ├── GeometricUtilSpec.js │ │ │ │ │ ├── LabelLayoutUtilSpec.js │ │ │ │ │ ├── LineAttachmentUtilSpec.js │ │ │ │ │ ├── LineIntersectSpec.js │ │ │ │ │ └── ResizeUtilSpec.js │ │ │ ├── input-output │ │ │ │ └── DataInputOutput.bpmn │ │ │ ├── lanes │ │ │ │ ├── AddLaneSpec.js │ │ │ │ ├── DeleteLaneSpec.js │ │ │ │ ├── ResizeLaneSpec.js │ │ │ │ ├── SplitLane.nested.bpmn │ │ │ │ ├── SplitLane.nested.vertical.bpmn │ │ │ │ ├── SplitLaneSpec.js │ │ │ │ ├── UpdateFlowNodeRefs.basic.bpmn │ │ │ │ ├── UpdateFlowNodeRefsSpec.js │ │ │ │ ├── lanes-flow-nodes-vertical.bpmn │ │ │ │ ├── lanes-flow-nodes.bpmn │ │ │ │ ├── lanes.bpmn │ │ │ │ ├── lanes.only.bpmn │ │ │ │ ├── lanes.only.vertical.bpmn │ │ │ │ ├── lanes.vertical.bpmn │ │ │ │ ├── participant-lane-vertical.bpmn │ │ │ │ ├── participant-lane.bpmn │ │ │ │ ├── participant-no-lane-vertical.bpmn │ │ │ │ ├── participant-no-lane.bpmn │ │ │ │ └── participant-single-lane.bpmn │ │ │ └── layout │ │ │ │ ├── Helper.js │ │ │ │ ├── LayoutAssociationSpec.js │ │ │ │ ├── LayoutConnectionSpec.js │ │ │ │ ├── LayoutDataAssociationSpec.js │ │ │ │ ├── LayoutMessageFlowSpec.bpmn │ │ │ │ ├── LayoutMessageFlowSpec.js │ │ │ │ ├── LayoutMessageFlowSpec.vertical.bpmn │ │ │ │ ├── LayoutSequenceFlowSpec.boundaryEvents.bpmn │ │ │ │ ├── LayoutSequenceFlowSpec.boundaryEventsLoops.bpmn │ │ │ │ ├── LayoutSequenceFlowSpec.flowElements.bpmn │ │ │ │ ├── LayoutSequenceFlowSpec.js │ │ │ │ ├── LayoutSequenceFlowSpec.subProcess.bpmn │ │ │ │ ├── LayoutSequenceFlowSpec.vertical.boundaryEvents.bpmn │ │ │ │ ├── LayoutSequenceFlowSpec.vertical.boundaryEventsLoops.bpmn │ │ │ │ ├── LayoutSequenceFlowSpec.vertical.flowElements.bpmn │ │ │ │ └── LayoutSequenceFlowSpec.vertical.subProcess.bpmn │ │ ├── ordering │ │ │ ├── BpmnDiOrderingSpec.js │ │ │ ├── BpmnOrderingProviderSpec.js │ │ │ ├── Helper.js │ │ │ ├── collapsed-subprocess.bpmn │ │ │ ├── data-association.bpmn │ │ │ ├── groups.bpmn │ │ │ ├── ordering-start-event.bpmn │ │ │ ├── ordering-subprocesses.bpmn │ │ │ ├── ordering.bpmn │ │ │ └── wrong-di-order.bpmn │ │ ├── outline │ │ │ ├── OutlineProvider.bpmn │ │ │ └── OutlineProviderSpec.js │ │ ├── palette │ │ │ └── PaletteProviderSpec.js │ │ ├── popup-menu │ │ │ ├── ReplaceMenuProvider.collapsedSubProcess.bpmn │ │ │ ├── ReplaceMenuProvider.compensation-activity.bpmn │ │ │ ├── ReplaceMenuProvider.conditionalFlows.bpmn │ │ │ ├── ReplaceMenuProvider.defaultFlows.bpmn │ │ │ ├── ReplaceMenuProvider.defaultFlowsFromComplexGateways.bpmn │ │ │ ├── ReplaceMenuProvider.defaultFlowsFromInclusiveGateways.bpmn │ │ │ ├── ReplaceMenuProvider.events.bpmn │ │ │ ├── ReplaceMenuProvider.pools.bpmn │ │ │ ├── ReplaceMenuProvider.subProcesses.bpmn │ │ │ └── ReplaceMenuProviderSpec.js │ │ ├── replace-preview │ │ │ ├── BpmnReplacePreview.bpmn │ │ │ └── BpmnReplacePreviewSpec.js │ │ ├── replace │ │ │ ├── BpmnReplace.collaboration.bpmn │ │ │ ├── BpmnReplace.collaboration.vertical.bpmn │ │ │ ├── BpmnReplace.collapsedSubProcess.bpmn │ │ │ ├── BpmnReplace.compensation.bpmn │ │ │ ├── BpmnReplace.dataObjects.bpmn │ │ │ ├── BpmnReplace.eventSubProcesses.bpmn │ │ │ ├── BpmnReplace.poolMessageFlows.bpmn │ │ │ ├── BpmnReplace.poolMessageFlows.vertical.bpmn │ │ │ ├── BpmnReplaceSpec.js │ │ │ ├── ReplaceRulesSpec.js │ │ │ └── SubProcess-collapsed.bpmn │ │ ├── rules │ │ │ ├── BpmnRules.attaching.bpmn │ │ │ ├── BpmnRules.boundaryEvent.bpmn │ │ │ ├── BpmnRules.collaboration-dataAssociation.bpmn │ │ │ ├── BpmnRules.collaboration-empty.bpmn │ │ │ ├── BpmnRules.collaboration-lanes.bpmn │ │ │ ├── BpmnRules.collaboration.bpmn │ │ │ ├── BpmnRules.collapsedPools.bpmn │ │ │ ├── BpmnRules.compensation-collaboration.bpmn │ │ │ ├── BpmnRules.compensation.bpmn │ │ │ ├── BpmnRules.connectOnCreate.bpmn │ │ │ ├── BpmnRules.dataAssociation.bpmn │ │ │ ├── BpmnRules.dataInputOutput.collaboration.bpmn │ │ │ ├── BpmnRules.dataInputOutput.process.bpmn │ │ │ ├── BpmnRules.detaching.bpmn │ │ │ ├── BpmnRules.eventBasedGatewayBasic.bpmn │ │ │ ├── BpmnRules.groups.bpmn │ │ │ ├── BpmnRules.insert.bpmn │ │ │ ├── BpmnRules.messageFlow.bpmn │ │ │ ├── BpmnRules.moveLane.bpmn │ │ │ ├── BpmnRules.multiSelectionPools.bpmn │ │ │ ├── BpmnRules.process.bpmn │ │ │ ├── BpmnRules.subProcess-dataAssociation.bpmn │ │ │ ├── BpmnRulesSpec.js │ │ │ └── Helper.js │ │ ├── search │ │ │ ├── BpmnSearchProviderSpec.js │ │ │ ├── bpmn-search-collaboration.bpmn │ │ │ ├── bpmn-search-sorting.bpmn │ │ │ └── bpmn-search.bpmn │ │ ├── snapping │ │ │ ├── BpmnConnectSnapping.bpmn │ │ │ ├── BpmnConnectSnappingSpec.js │ │ │ ├── BpmnCreateMoveSnapping.boundary-events.bpmn │ │ │ ├── BpmnCreateMoveSnapping.collaboration.bpmn │ │ │ ├── BpmnCreateMoveSnapping.docking-create-mode.bpmn │ │ │ ├── BpmnCreateMoveSnapping.docking-points.bpmn │ │ │ ├── BpmnCreateMoveSnapping.process.bpmn │ │ │ ├── BpmnCreateMoveSnapping.sequence-flows.bpmn │ │ │ ├── BpmnCreateMoveSnapping.trbl-snapping.bpmn │ │ │ └── BpmnCreateMoveSnappingSpec.js │ │ └── space-tool │ │ │ ├── BpmnSpaceTool.artifacts.bpmn │ │ │ ├── BpmnSpaceTool.basics.bpmn │ │ │ ├── BpmnSpaceTool.boundary-events.bpmn │ │ │ ├── BpmnSpaceTool.participants.bpmn │ │ │ ├── BpmnSpaceTool.text-annotations.bpmn │ │ │ └── BpmnSpaceToolSpec.js │ ├── helper │ │ └── InjectSpec.js │ ├── i18n │ │ ├── custom-translate │ │ │ ├── custom-translate.js │ │ │ └── index.js │ │ └── translateSpec.js │ ├── import │ │ ├── BpmnTreeWalkerSpec.js │ │ ├── ImporterSpec.js │ │ ├── ModelWiringSpec.js │ │ ├── data-association.bpmn │ │ ├── elements │ │ │ ├── AssociationSpec.collaboration.bpmn │ │ │ ├── AssociationSpec.compensation.bpmn │ │ │ ├── AssociationSpec.data-association.bpmn │ │ │ ├── AssociationSpec.data-input-output.bpmn │ │ │ ├── AssociationSpec.events.bpmn │ │ │ ├── AssociationSpec.js │ │ │ ├── AssociationSpec.text-annotation.bpmn │ │ │ ├── CollapsedSpec.js │ │ │ ├── DataInputOutput.bpmn │ │ │ ├── DataInputOutputSpec.js │ │ │ ├── Groups.bpmn │ │ │ ├── GroupsSpec.js │ │ │ └── LabelSpec.js │ │ ├── lane-flowNodes.bpmn │ │ ├── lane-missing-flowNodeRef.bpmn │ │ ├── missing-di-plane-root-element.bpmn │ │ ├── missing-di-plane.bpmn │ │ ├── sequenceFlow-missingWaypoints.bpmn │ │ └── sequenceFlow-ordering.bpmn │ └── util │ │ └── ModelUtilSpec.js ├── testBundle.js └── util │ ├── KeyEvents.js │ ├── MockEvents.js │ └── custom-rules │ ├── CustomRules.js │ └── index.js └── tsconfig.json /.github/ISSUE_TEMPLATE/BUG_REPORT.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report a problem and help us fix it. 4 | labels: "bug" 5 | --- 6 | 7 | 8 | ### Describe the Bug 9 | 10 | 11 | 12 | 13 | ### Steps to Reproduce 14 | 15 | 1. do this 16 | 2. do that 17 | 18 | 23 | 24 | ### Expected Behavior 25 | 26 | 27 | 28 | 29 | ### Environment 30 | 31 | - Browser: [e.g. IE 11, Chrome 69] 32 | - OS: [e.g. Windows 7] 33 | - Library version: [e.g. 2.0.0] 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea or general improvement. 4 | labels: "enhancement" 5 | --- 6 | 7 | 8 | ### Is your feature request related to a problem? Please describe. 9 | 10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 11 | 12 | 13 | ### Describe the solution you'd like 14 | 15 | A clear and concise description of what you want to happen. 16 | 17 | ### Describe alternatives you've considered 18 | 19 | A clear and concise description of any alternative solutions or features you've considered. 20 | 21 | 22 | ### Additional context 23 | 24 | Add any other context or screenshots about the feature request here. 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/TASK.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Task 3 | about: Describe a generic activity we should carry out. 4 | --- 5 | 6 | 7 | ### What should we do? 8 | 9 | 10 | 11 | 12 | ### Why should we do it? 13 | 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Ask a question 4 | url: https://forum.bpmn.io 5 | about: Head over to our community forum to ask questions and get answers. -------------------------------------------------------------------------------- /.github/merge-me.yml: -------------------------------------------------------------------------------- 1 | reviewTeams: 2 | - modeling-dev 3 | - modeling-design 4 | -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: [ push, pull_request ] 3 | jobs: 4 | build: 5 | 6 | strategy: 7 | matrix: 8 | os: [ macos-latest, ubuntu-latest, windows-latest ] 9 | 10 | runs-on: ${{ matrix.os }} 11 | 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v4 15 | - name: Use Node.js 16 | uses: actions/setup-node@v4 17 | with: 18 | node-version: 20 19 | cache: 'npm' 20 | - name: Install dependencies 21 | run: npm ci 22 | - name: Project setup 23 | uses: bpmn-io/actions/setup@latest 24 | - name: Build 25 | if: runner.os == 'Linux' 26 | env: 27 | COVERAGE: 1 28 | TEST_BROWSERS: Firefox,ChromeHeadless 29 | run: xvfb-run npm run all 30 | - name: Build 31 | if: runner.os != 'Linux' 32 | env: 33 | TEST_BROWSERS: ChromeHeadless 34 | run: npm run all 35 | - name: Upload Coverage 36 | uses: codecov/codecov-action@v5 37 | if: runner.os == 'Linux' 38 | with: 39 | fail_ci_if_error: true 40 | env: 41 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 42 | -------------------------------------------------------------------------------- /.github/workflows/CODE_SCANNING.yml: -------------------------------------------------------------------------------- 1 | name: "Code Scanning" 2 | 3 | on: 4 | push: 5 | branches: [ main, develop ] 6 | pull_request: 7 | branches: [ main, develop ] 8 | paths-ignore: 9 | - '**/*.md' 10 | 11 | jobs: 12 | codeql-build: 13 | # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest 14 | runs-on: ubuntu-latest 15 | 16 | permissions: 17 | # required for all workflows 18 | security-events: write 19 | 20 | steps: 21 | - name: Checkout repository 22 | uses: actions/checkout@v4 23 | 24 | # Initializes the CodeQL tools for scanning. 25 | - name: Initialize CodeQL 26 | uses: github/codeql-action/init@v3 27 | with: 28 | languages: javascript 29 | config: | 30 | paths-ignore: 31 | - '**/test' 32 | 33 | - name: Perform CodeQL Analysis 34 | uses: github/codeql-action/analyze@v3 35 | -------------------------------------------------------------------------------- /.github/workflows/MERGE_MAIN_TO_DEVELOP.yml: -------------------------------------------------------------------------------- 1 | name: MERGE_MASTER_TO_DEVELOP 2 | on: 3 | push: 4 | branches: 5 | - "main" 6 | 7 | jobs: 8 | merge_main_to_develop: 9 | runs-on: ubuntu-latest 10 | permissions: 11 | contents: write 12 | 13 | steps: 14 | - name: Checkout develop 15 | uses: actions/checkout@v4 16 | with: 17 | ref: develop 18 | fetch-depth: 0 19 | - name: Merge main to develop and push 20 | run: | 21 | git config user.name '${{ secrets.BPMN_IO_USERNAME }}' 22 | git config user.email '${{ secrets.BPMN_IO_EMAIL }}' 23 | git merge -m 'chore: merge main to develop' --no-edit origin/main 24 | git push 25 | 26 | - name: Notify failure on Slack 27 | if: failure() 28 | uses: slackapi/slack-github-action@v2 29 | with: 30 | method: chat.postMessage 31 | token: ${{ secrets.SLACK_BOT_TOKEN }} 32 | payload: | 33 | channel: ${{ secrets.SLACK_CHANNEL_ID }} 34 | text: "Automatic merge of to failed." 35 | -------------------------------------------------------------------------------- /.github/workflows/RELEASE.yml: -------------------------------------------------------------------------------- 1 | name: RELEASE 2 | on: 3 | push: 4 | branches: 5 | - main 6 | - develop 7 | jobs: 8 | release_please: 9 | outputs: 10 | release_created: ${{ steps.release.outputs.release_created }} 11 | tag: ${{ steps.release.outputs.tag_name }} 12 | permissions: 13 | contents: write # to create release commit (google-github-actions/release-please-action) 14 | pull-requests: write # to create release PR (google-github-actions/release-please-action) 15 | 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: google-github-actions/release-please-action@v4 19 | id: release 20 | with: 21 | token: ${{ secrets.GITHUB_TOKEN }} 22 | target-branch: main 23 | release-type: node 24 | 25 | publish: 26 | needs: release_please 27 | if: ${{ needs.release_please.outputs.release_created }} 28 | 29 | runs-on: ubuntu-latest 30 | steps: 31 | - name: Checkout 32 | uses: actions/checkout@v4 33 | - name: Use Node.js 34 | uses: actions/setup-node@v4 35 | with: 36 | node-version: 20 37 | cache: 'npm' 38 | registry-url: 'https://registry.npmjs.org' 39 | - name: Install dependencies 40 | run: npm ci 41 | - run: npm publish 42 | env: 43 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | coverage/ 4 | index.d.ts 5 | lib/**/*.d.ts 6 | .idea 7 | *.iml 8 | .DS_Store -------------------------------------------------------------------------------- /.release-please-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "pull-request-title-pattern": "chore: release v${version}", 3 | "changelog-sections": "[{\"type\":\"feat\",\"section\":\"Features\",\"hidden\":false},{\"type\":\"fix\",\"section\":\"Bug Fixes\",\"hidden\":false},{\"type\":\"deps\",\"section\":\"Dependency Updates\",\"hidden\":false}]", 4 | "changelog-type": "github", 5 | ".": "18.5.0" 6 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-present Camunda Services GmbH 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in the 5 | Software without restriction, including without limitation the rights to use, copy, 6 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 7 | and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | The source code responsible for displaying the bpmn.io project watermark that 14 | links back to https://bpmn.io as part of rendered diagrams MUST NOT be 15 | removed or changed. When this software is being used in a website or application, 16 | the watermark must stay fully visible and not visually overlapped by other elements. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 19 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 20 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 23 | OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /docs/project/setup-alternative.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ### 4 | # Setup script to be executed in a bpmn.io project root (some empty folder chosen by YOU). Use if you do not want to rely on npm link. 5 | ### 6 | 7 | base=`pwd` 8 | 9 | echo cloning repositories 10 | 11 | git clone git@github.com:bpmn-io/diagram-js.git 12 | git clone git@github.com:bpmn-io/bpmn-js.git 13 | git clone git@github.com:bpmn-io/bpmn-moddle.git 14 | 15 | 16 | echo done. 17 | 18 | echo setup diagram-js 19 | 20 | cd $base/diagram-js 21 | npm install 22 | 23 | 24 | echo setup bpmn-moddle 25 | 26 | cd $base/bpmn-moddle 27 | npm install 28 | 29 | 30 | echo setup bpmn-js 31 | 32 | cd $base/bpmn-js 33 | mkdir node_modules 34 | ln -s $base/bpmn-moddle node_modules/bpmn-moddle 35 | ln -s $base/diagram-js node_modules/diagram-js 36 | npm install 37 | 38 | 39 | cd $base 40 | 41 | echo all done. 42 | -------------------------------------------------------------------------------- /docs/project/setup.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem ### 4 | rem # Setup script to be executed in a bpmn.io project root (some empty folder chosen by YOU) 5 | rem ## 6 | 7 | set BASE=%CD% 8 | 9 | echo cloning repositories 10 | 11 | git clone git@github.com:bpmn-io/diagram-js.git 12 | git clone git@github.com:bpmn-io/bpmn-js.git 13 | git clone git@github.com:bpmn-io/bpmn-moddle.git 14 | 15 | echo done. 16 | 17 | 18 | echo setup diagram-js 19 | 20 | cd %BASE%\diagram-js 21 | npm install 22 | 23 | 24 | echo setup bpmn-moddle 25 | 26 | cd %BASE%\bpmn-moddle 27 | npm install 28 | 29 | 30 | echo prepare setup bpmn-js 31 | 32 | mkdir %BASE%\bpmn-js\node_modules 33 | 34 | rem link bpmn-js 35 | mklink /D %BASE%\bpmn-js\node_modules\bpmn-moddle %BASE%\bpmn-moddle 36 | mklink /D %BASE%\bpmn-js\node_modules\diagram-js %BASE%\diagram-js 37 | 38 | 39 | echo setup bpmn-js 40 | 41 | cd %BASE%\bpmn-js 42 | npm install 43 | 44 | 45 | cd %BASE% 46 | -------------------------------------------------------------------------------- /docs/project/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ### 4 | # Setup script to be executed in a bpmn.io project root (some empty folder chosen by YOU) 5 | ### 6 | 7 | base=`pwd` 8 | 9 | echo cloning repositories 10 | 11 | git clone git@github.com:bpmn-io/diagram-js.git 12 | git clone git@github.com:bpmn-io/bpmn-js.git 13 | git clone git@github.com:bpmn-io/bpmn-moddle.git 14 | 15 | echo done. 16 | 17 | 18 | echo setup diagram-js 19 | 20 | cd $base/diagram-js 21 | npm install 22 | 23 | 24 | echo setup bpmn-moddle 25 | 26 | cd $base/bpmn-moddle 27 | npm install 28 | 29 | 30 | echo setup bpmn-js 31 | 32 | cd $base/bpmn-js 33 | npm install 34 | npm link ../diagram-js 35 | npm link ../bpmn-moddle 36 | 37 | 38 | cd $base 39 | 40 | echo all done. 41 | -------------------------------------------------------------------------------- /eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import bpmnIoPlugin from 'eslint-plugin-bpmn-io'; 2 | 3 | const files = { 4 | ignored: [ 5 | 'dist', 6 | 'coverage' 7 | ], 8 | build: [ 9 | 'test/config/*.js', 10 | 'tasks/**/*.mjs', 11 | '*.js', 12 | '*.mjs' 13 | ], 14 | test: [ 15 | 'test/**/*.js' 16 | ] 17 | }; 18 | 19 | export default [ 20 | { 21 | ignores: files.ignored 22 | }, 23 | 24 | // build 25 | ...bpmnIoPlugin.configs.node.map(config => { 26 | 27 | return { 28 | ...config, 29 | files: files.build 30 | }; 31 | }), 32 | 33 | // lib + test 34 | ...bpmnIoPlugin.configs.browser.map(config => { 35 | 36 | return { 37 | ...config, 38 | ignores: files.build 39 | }; 40 | }), 41 | 42 | // test 43 | ...bpmnIoPlugin.configs.mocha.map(config => { 44 | 45 | return { 46 | ...config, 47 | files: files.test, 48 | }; 49 | }), 50 | { 51 | languageOptions: { 52 | globals: { 53 | sinon: true, 54 | require: true 55 | } 56 | }, 57 | files: files.test 58 | } 59 | ]; -------------------------------------------------------------------------------- /lib/BaseModeler.spec.ts: -------------------------------------------------------------------------------- 1 | import Canvas from 'diagram-js/lib/core/Canvas'; 2 | import EventBus from 'diagram-js/lib/core/EventBus'; 3 | 4 | import BaseModeler from './BaseModeler'; 5 | 6 | import { testViewer } from './BaseViewer.spec'; 7 | 8 | const modeler = new BaseModeler({ 9 | container: 'container' 10 | }); 11 | 12 | testViewer(modeler); 13 | 14 | 15 | const otherModeler = new BaseModeler({ 16 | container: 'container' 17 | }); 18 | 19 | const extendedModeler = new BaseModeler({ 20 | container: 'container', 21 | alignToOrigin: false, 22 | propertiesPanel: { 23 | attachTo: '#properties-panel' 24 | } 25 | }); 26 | 27 | 28 | // typed API usage 29 | 30 | type FooEvent = { 31 | /** 32 | * Very cool field! 33 | */ 34 | foo: string; 35 | }; 36 | 37 | type EventMap = { 38 | 39 | foo: FooEvent 40 | }; 41 | 42 | type TypeMap = { 43 | canvas: Canvas, 44 | eventBus: EventBus 45 | }; 46 | 47 | const typedModeler = new BaseModeler(); 48 | 49 | const bus = typedModeler.get('eventBus'); 50 | 51 | const canvas = typedModeler.get('canvas'); 52 | 53 | canvas.zoom('fit-viewport'); 54 | 55 | typedModeler.on('foo', event => { 56 | console.log(event.foo); 57 | }); 58 | 59 | typedModeler.get('eventBus').on('foo', e => console.log(e.foo)); -------------------------------------------------------------------------------- /lib/Modeler.spec.ts: -------------------------------------------------------------------------------- 1 | import Canvas from 'diagram-js/lib/core/Canvas'; 2 | import EventBus from 'diagram-js/lib/core/EventBus'; 3 | 4 | import Modeler from './Modeler'; 5 | 6 | import { testViewer } from './BaseViewer.spec'; 7 | 8 | const modeler = new Modeler({ 9 | container: 'container' 10 | }); 11 | 12 | testViewer(modeler); 13 | 14 | modeler.createDiagram(); 15 | 16 | 17 | const otherModeler = new Modeler({ 18 | container: 'container' 19 | }); 20 | 21 | const extendedModeler = new Modeler({ 22 | container: 'container', 23 | alignToOrigin: false, 24 | propertiesPanel: { 25 | attachTo: '#properties-panel' 26 | } 27 | }); 28 | 29 | 30 | // typed API usage 31 | 32 | type FooEvent = { 33 | /** 34 | * Very cool field! 35 | */ 36 | foo: string; 37 | }; 38 | 39 | type EventMap = { 40 | 41 | foo: FooEvent 42 | }; 43 | 44 | type TypeMap = { 45 | canvas: Canvas, 46 | eventBus: EventBus 47 | }; 48 | 49 | const typedViewer = new Modeler(); 50 | 51 | const bus = typedViewer.get('eventBus'); 52 | 53 | const canvas = typedViewer.get('canvas'); 54 | 55 | canvas.zoom('fit-viewport'); 56 | 57 | typedViewer.on('foo', event => { 58 | console.log(event.foo); 59 | }); 60 | 61 | typedViewer.get('eventBus').on('foo', e => console.log(e.foo)); -------------------------------------------------------------------------------- /lib/NavigatedViewer.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import Viewer from './Viewer'; 4 | 5 | import KeyboardMoveModule from 'diagram-js/lib/navigation/keyboard-move'; 6 | import MoveCanvasModule from 'diagram-js/lib/navigation/movecanvas'; 7 | import ZoomScrollModule from 'diagram-js/lib/navigation/zoomscroll'; 8 | 9 | /** 10 | * @typedef { import('./BaseViewer').BaseViewerOptions } BaseViewerOptions 11 | */ 12 | 13 | /** 14 | * A viewer with mouse and keyboard navigation features. 15 | * 16 | * @template [ServiceMap=null] 17 | * 18 | * @extends Viewer 19 | * 20 | * @param {BaseViewerOptions} [options] 21 | */ 22 | export default function NavigatedViewer(options) { 23 | Viewer.call(this, options); 24 | } 25 | 26 | inherits(NavigatedViewer, Viewer); 27 | 28 | 29 | NavigatedViewer.prototype._navigationModules = [ 30 | KeyboardMoveModule, 31 | MoveCanvasModule, 32 | ZoomScrollModule 33 | ]; 34 | 35 | NavigatedViewer.prototype._modules = [].concat( 36 | Viewer.prototype._modules, 37 | NavigatedViewer.prototype._navigationModules 38 | ); -------------------------------------------------------------------------------- /lib/NavigatedViewer.spec.ts: -------------------------------------------------------------------------------- 1 | import Canvas from 'diagram-js/lib/core/Canvas'; 2 | import EventBus from 'diagram-js/lib/core/EventBus'; 3 | 4 | import NavigatedViewer from './NavigatedViewer'; 5 | 6 | import { testViewer } from './BaseViewer.spec'; 7 | 8 | const viewer = new NavigatedViewer({ 9 | container: 'container' 10 | }); 11 | 12 | testViewer(viewer); 13 | 14 | const extendedViewer = new NavigatedViewer({ 15 | container: 'container', 16 | alignToOrigin: false, 17 | propertiesPanel: { 18 | attachTo: '#properties-panel' 19 | } 20 | }); 21 | 22 | // typed API usage 23 | 24 | type FooEvent = { 25 | /** 26 | * Very cool field! 27 | */ 28 | foo: string; 29 | }; 30 | 31 | type EventMap = { 32 | 33 | foo: FooEvent 34 | }; 35 | 36 | type TypeMap = { 37 | canvas: Canvas, 38 | eventBus: EventBus 39 | }; 40 | 41 | const typedViewer = new NavigatedViewer(); 42 | 43 | const bus = typedViewer.get('eventBus'); 44 | 45 | const canvas = typedViewer.get('canvas'); 46 | 47 | canvas.zoom('fit-viewport'); 48 | 49 | typedViewer.on('foo', event => { 50 | console.log(event.foo); 51 | }); 52 | 53 | typedViewer.get('eventBus').on('foo', e => console.log(e.foo)); -------------------------------------------------------------------------------- /lib/Viewer.spec.ts: -------------------------------------------------------------------------------- 1 | import Canvas from 'diagram-js/lib/core/Canvas'; 2 | import EventBus from 'diagram-js/lib/core/EventBus'; 3 | 4 | import Viewer from './Viewer'; 5 | 6 | import { testViewer } from './BaseViewer.spec'; 7 | 8 | const viewer = new Viewer({ 9 | container: 'container' 10 | }); 11 | 12 | testViewer(viewer); 13 | 14 | const extendedViewer = new Viewer({ 15 | container: 'container', 16 | alignToOrigin: false, 17 | propertiesPanel: { 18 | attachTo: '#properties-panel' 19 | } 20 | }); 21 | 22 | 23 | // typed API usage 24 | 25 | type FooEvent = { 26 | /** 27 | * Very cool field! 28 | */ 29 | foo: string; 30 | }; 31 | 32 | type EventMap = { 33 | 34 | foo: FooEvent 35 | }; 36 | 37 | type TypeMap = { 38 | canvas: Canvas, 39 | eventBus: EventBus 40 | }; 41 | 42 | const typedViewer = new Viewer(); 43 | 44 | const bus = typedViewer.get('eventBus'); 45 | 46 | const canvas = typedViewer.get('canvas'); 47 | 48 | canvas.zoom('fit-viewport'); 49 | 50 | typedViewer.on('foo', event => { 51 | console.log(event.foo); 52 | }); 53 | 54 | typedViewer.get('eventBus').on('foo', e => console.log(e.foo)); -------------------------------------------------------------------------------- /lib/core/index.js: -------------------------------------------------------------------------------- 1 | import DrawModule from '../draw'; 2 | import ImportModule from '../import'; 3 | 4 | export default { 5 | __depends__: [ 6 | DrawModule, 7 | ImportModule 8 | ] 9 | }; -------------------------------------------------------------------------------- /lib/draw/TextRenderer.spec.ts: -------------------------------------------------------------------------------- 1 | import TextRenderer from './TextRenderer'; 2 | 3 | new TextRenderer({ 4 | defaultStyle: { 5 | fontFamily: 'foo' 6 | } 7 | }); 8 | 9 | const textRenderer = new TextRenderer(); 10 | 11 | const externalLabelBounds = textRenderer.getExternalLabelBounds({ 12 | x: 100, 13 | y: 100, 14 | width: 100, 15 | height: 100 16 | }, 'FOO\nBAR\n\BAZ'); 17 | 18 | const textAnnotationBounds = textRenderer.getTextAnnotationBounds({ 19 | x: 100, 20 | y: 100, 21 | width: 100, 22 | height: 100 23 | }, 'FOO\nBAR\n\BAZ'); 24 | 25 | let text = textRenderer.createText('foo'); 26 | 27 | text = textRenderer.createText('foo', { 28 | align: 'center-top', 29 | padding: 10 30 | }); 31 | 32 | const defaultStyle = textRenderer.getDefaultStyle(); 33 | 34 | const externalStyle = textRenderer.getExternalStyle(); -------------------------------------------------------------------------------- /lib/draw/index.js: -------------------------------------------------------------------------------- 1 | import BpmnRenderer from './BpmnRenderer'; 2 | import TextRenderer from './TextRenderer'; 3 | 4 | import PathMap from './PathMap'; 5 | 6 | export default { 7 | __init__: [ 'bpmnRenderer' ], 8 | bpmnRenderer: [ 'type', BpmnRenderer ], 9 | textRenderer: [ 'type', TextRenderer ], 10 | pathMap: [ 'type', PathMap ] 11 | }; 12 | -------------------------------------------------------------------------------- /lib/features/align-elements/BpmnAlignElements.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import RuleProvider from 'diagram-js/lib/features/rules/RuleProvider'; 4 | import { getParents } from 'diagram-js/lib/util/Elements'; 5 | 6 | import { 7 | filter 8 | } from 'min-dash'; 9 | 10 | /** 11 | * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus 12 | */ 13 | 14 | /** 15 | * Rule provider for aligning BPMN elements. 16 | * 17 | * @param {EventBus} eventBus 18 | */ 19 | export default function BpmnAlignElements(eventBus) { 20 | RuleProvider.call(this, eventBus); 21 | } 22 | 23 | BpmnAlignElements.$inject = [ 'eventBus' ]; 24 | 25 | inherits(BpmnAlignElements, RuleProvider); 26 | 27 | BpmnAlignElements.prototype.init = function() { 28 | this.addRule('elements.align', function(context) { 29 | var elements = context.elements; 30 | 31 | // filter out elements which cannot be aligned 32 | var filteredElements = filter(elements, function(element) { 33 | return !(element.waypoints || element.host || element.labelTarget); 34 | }); 35 | 36 | // filter out elements which are children of any of the selected elements 37 | filteredElements = getParents(filteredElements); 38 | 39 | if (filteredElements.length < 2) { 40 | return false; 41 | } 42 | 43 | return filteredElements; 44 | }); 45 | }; 46 | -------------------------------------------------------------------------------- /lib/features/align-elements/index.js: -------------------------------------------------------------------------------- 1 | import AlignElementsModule from 'diagram-js/lib/features/align-elements'; 2 | import ContextPadModule from 'diagram-js/lib/features/context-pad'; 3 | import PopupMenuModule from 'diagram-js/lib/features/popup-menu'; 4 | 5 | import AlignElementsContextPadProvider from './AlignElementsContextPadProvider'; 6 | import AlignElementsMenuProvider from './AlignElementsMenuProvider'; 7 | import BpmnAlignElements from './BpmnAlignElements'; 8 | 9 | export default { 10 | __depends__: [ 11 | AlignElementsModule, 12 | ContextPadModule, 13 | PopupMenuModule 14 | ], 15 | __init__: [ 16 | 'alignElementsContextPadProvider', 17 | 'alignElementsMenuProvider', 18 | 'bpmnAlignElements' 19 | ], 20 | alignElementsContextPadProvider: [ 'type', AlignElementsContextPadProvider ], 21 | alignElementsMenuProvider: [ 'type', AlignElementsMenuProvider ], 22 | bpmnAlignElements: [ 'type', BpmnAlignElements ] 23 | }; 24 | -------------------------------------------------------------------------------- /lib/features/append-preview/index.js: -------------------------------------------------------------------------------- 1 | import AutoPlaceModule from '../auto-place'; 2 | import ComplexPreviewModule from 'diagram-js/lib/features/complex-preview'; 3 | import ModelingModule from '../modeling'; 4 | 5 | import AppendPreview from './AppendPreview'; 6 | 7 | export default { 8 | __depends__: [ 9 | AutoPlaceModule, 10 | ComplexPreviewModule, 11 | ModelingModule 12 | ], 13 | __init__: [ 'appendPreview' ], 14 | appendPreview: [ 'type', AppendPreview ] 15 | }; 16 | -------------------------------------------------------------------------------- /lib/features/auto-place/BpmnAutoPlace.js: -------------------------------------------------------------------------------- 1 | import { getNewShapePosition } from './BpmnAutoPlaceUtil'; 2 | 3 | /** 4 | * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus 5 | * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry 6 | */ 7 | 8 | /** 9 | * BPMN auto-place behavior. 10 | * 11 | * @param {EventBus} eventBus 12 | * @param {ElementRegistry} elementRegistry 13 | */ 14 | export default function AutoPlace(eventBus, elementRegistry) { 15 | eventBus.on('autoPlace', function(context) { 16 | var shape = context.shape, 17 | source = context.source; 18 | 19 | return getNewShapePosition(source, shape, elementRegistry); 20 | }); 21 | } 22 | 23 | AutoPlace.$inject = [ 'eventBus', 'elementRegistry' ]; -------------------------------------------------------------------------------- /lib/features/auto-place/index.js: -------------------------------------------------------------------------------- 1 | import AutoPlaceModule from 'diagram-js/lib/features/auto-place'; 2 | 3 | import BpmnAutoPlace from './BpmnAutoPlace'; 4 | 5 | export default { 6 | __depends__: [ AutoPlaceModule ], 7 | __init__: [ 'bpmnAutoPlace' ], 8 | bpmnAutoPlace: [ 'type', BpmnAutoPlace ] 9 | }; -------------------------------------------------------------------------------- /lib/features/auto-resize/BpmnAutoResize.js: -------------------------------------------------------------------------------- 1 | import AutoResize from 'diagram-js/lib/features/auto-resize/AutoResize'; 2 | 3 | import inherits from 'inherits-browser'; 4 | 5 | import { is } from '../../util/ModelUtil'; 6 | 7 | /** 8 | * @typedef {import('didi').Injector} Injector 9 | * 10 | * @typedef {import('../../model/Types').Shape} Shape 11 | * 12 | * @typedef {import('diagram-js/lib/util/Types').Rect} Rect 13 | */ 14 | 15 | /** 16 | * BPMN-specific resize behavior. 17 | * 18 | * @param {Injector} injector 19 | */ 20 | export default function BpmnAutoResize(injector) { 21 | 22 | injector.invoke(AutoResize, this); 23 | } 24 | 25 | BpmnAutoResize.$inject = [ 26 | 'injector' 27 | ]; 28 | 29 | inherits(BpmnAutoResize, AutoResize); 30 | 31 | /** 32 | * Perform BPMN-specific resizing of participants. 33 | * 34 | * @param {Shape} target 35 | * @param {Rect} newBounds 36 | * @param {Object} [hints] 37 | * @param {string} [hints.autoResize] 38 | */ 39 | BpmnAutoResize.prototype.resize = function(target, newBounds, hints) { 40 | 41 | if (is(target, 'bpmn:Participant')) { 42 | this._modeling.resizeLane(target, newBounds, null, hints); 43 | } else { 44 | this._modeling.resizeShape(target, newBounds, null, hints); 45 | } 46 | }; -------------------------------------------------------------------------------- /lib/features/auto-resize/index.js: -------------------------------------------------------------------------------- 1 | import BpmnAutoResize from './BpmnAutoResize'; 2 | import BpmnAutoResizeProvider from './BpmnAutoResizeProvider'; 3 | 4 | 5 | export default { 6 | __init__: [ 7 | 'bpmnAutoResize', 8 | 'bpmnAutoResizeProvider' 9 | ], 10 | bpmnAutoResize: [ 'type', BpmnAutoResize ], 11 | bpmnAutoResizeProvider: [ 'type', BpmnAutoResizeProvider ] 12 | }; 13 | -------------------------------------------------------------------------------- /lib/features/context-pad/index.js: -------------------------------------------------------------------------------- 1 | import AppendPreviewModule from '../append-preview'; 2 | import DirectEditingModule from 'diagram-js-direct-editing'; 3 | import ContextPadModule from 'diagram-js/lib/features/context-pad'; 4 | import SelectionModule from 'diagram-js/lib/features/selection'; 5 | import ConnectModule from 'diagram-js/lib/features/connect'; 6 | import CreateModule from 'diagram-js/lib/features/create'; 7 | import PopupMenuModule from '../popup-menu'; 8 | 9 | import ContextPadProvider from './ContextPadProvider'; 10 | 11 | export default { 12 | __depends__: [ 13 | AppendPreviewModule, 14 | DirectEditingModule, 15 | ContextPadModule, 16 | SelectionModule, 17 | ConnectModule, 18 | CreateModule, 19 | PopupMenuModule 20 | ], 21 | __init__: [ 'contextPadProvider' ], 22 | contextPadProvider: [ 'type', ContextPadProvider ] 23 | }; -------------------------------------------------------------------------------- /lib/features/copy-paste/index.js: -------------------------------------------------------------------------------- 1 | import CopyPasteModule from 'diagram-js/lib/features/copy-paste'; 2 | 3 | import BpmnCopyPaste from './BpmnCopyPaste'; 4 | import ModdleCopy from './ModdleCopy'; 5 | 6 | export default { 7 | __depends__: [ 8 | CopyPasteModule 9 | ], 10 | __init__: [ 'bpmnCopyPaste', 'moddleCopy' ], 11 | bpmnCopyPaste: [ 'type', BpmnCopyPaste ], 12 | moddleCopy: [ 'type', ModdleCopy ] 13 | }; 14 | -------------------------------------------------------------------------------- /lib/features/di-ordering/BpmnDiOrdering.js: -------------------------------------------------------------------------------- 1 | import { getDi } from '../../util/ModelUtil'; 2 | 3 | import { 4 | filter, 5 | forEach, 6 | map 7 | } from 'min-dash'; 8 | 9 | import { selfAndAllChildren } from 'diagram-js/lib/util/Elements'; 10 | 11 | /** 12 | * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus 13 | * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas 14 | */ 15 | 16 | var HIGH_PRIORITY = 2000; 17 | 18 | /** 19 | * @param {EventBus} eventBus 20 | * @param {Canvas} canvas 21 | */ 22 | export default function BpmnDiOrdering(eventBus, canvas) { 23 | 24 | eventBus.on('saveXML.start', HIGH_PRIORITY, orderDi); 25 | 26 | function orderDi() { 27 | var rootElements = canvas.getRootElements(); 28 | 29 | forEach(rootElements, function(root) { 30 | var rootDi = getDi(root), 31 | elements, 32 | diElements; 33 | 34 | elements = selfAndAllChildren([ root ], false); 35 | 36 | // only bpmndi:Shape and bpmndi:Edge can be direct children of bpmndi:Plane 37 | elements = filter(elements, function(element) { 38 | return element !== root && !element.labelTarget; 39 | }); 40 | 41 | diElements = map(elements, getDi); 42 | 43 | rootDi.set('planeElement', diElements); 44 | }); 45 | } 46 | } 47 | 48 | BpmnDiOrdering.$inject = [ 'eventBus', 'canvas' ]; 49 | -------------------------------------------------------------------------------- /lib/features/di-ordering/index.js: -------------------------------------------------------------------------------- 1 | import BpmnDiOrdering from '../di-ordering/BpmnDiOrdering'; 2 | 3 | export default { 4 | __init__: [ 5 | 'bpmnDiOrdering' 6 | ], 7 | bpmnDiOrdering: [ 'type', BpmnDiOrdering ] 8 | }; -------------------------------------------------------------------------------- /lib/features/distribute-elements/DistributeElementsIcons.js: -------------------------------------------------------------------------------- 1 | /** 2 | * To change the icons, modify the SVGs in `./resources`, execute `npx svgo -f resources --datauri enc -o dist`, 3 | * and then replace respective icons with the optimized data URIs in `./dist`. 4 | */ 5 | var icons = { 6 | horizontal: ` 7 | 8 | 9 | 10 | `, 11 | vertical: ` 12 | 13 | 14 | 15 | ` 16 | }; 17 | 18 | export default icons; 19 | -------------------------------------------------------------------------------- /lib/features/distribute-elements/index.js: -------------------------------------------------------------------------------- 1 | import DistributeElementsModule from 'diagram-js/lib/features/distribute-elements'; 2 | import PopupMenuModule from 'diagram-js/lib/features/popup-menu'; 3 | 4 | import BpmnDistributeElements from './BpmnDistributeElements'; 5 | import DistributeElementsMenuProvider from './DistributeElementsMenuProvider'; 6 | 7 | 8 | export default { 9 | __depends__: [ 10 | PopupMenuModule, 11 | DistributeElementsModule 12 | ], 13 | __init__: [ 14 | 'bpmnDistributeElements', 15 | 'distributeElementsMenuProvider' 16 | ], 17 | bpmnDistributeElements: [ 'type', BpmnDistributeElements ], 18 | distributeElementsMenuProvider: [ 'type', DistributeElementsMenuProvider ] 19 | }; 20 | -------------------------------------------------------------------------------- /lib/features/drilldown/index.js: -------------------------------------------------------------------------------- 1 | import OverlaysModule from 'diagram-js/lib/features/overlays'; 2 | import ChangeSupportModule from 'diagram-js/lib/features/change-support'; 3 | import RootElementsModule from 'diagram-js/lib/features/root-elements'; 4 | 5 | import DrilldownBreadcrumbs from './DrilldownBreadcrumbs'; 6 | import DrilldownCentering from './DrilldownCentering'; 7 | import SubprocessCompatibility from './SubprocessCompatibility'; 8 | import DrilldownOverlayBehavior from './DrilldownOverlayBehavior'; 9 | 10 | export default { 11 | __depends__: [ OverlaysModule, ChangeSupportModule, RootElementsModule ], 12 | __init__: [ 'drilldownBreadcrumbs', 'drilldownOverlayBehavior', 'drilldownCentering', 'subprocessCompatibility' ], 13 | drilldownBreadcrumbs: [ 'type', DrilldownBreadcrumbs ], 14 | drilldownCentering: [ 'type', DrilldownCentering ], 15 | drilldownOverlayBehavior: [ 'type', DrilldownOverlayBehavior ], 16 | subprocessCompatibility: [ 'type', SubprocessCompatibility ] 17 | }; -------------------------------------------------------------------------------- /lib/features/editor-actions/index.js: -------------------------------------------------------------------------------- 1 | import EditorActionsModule from 'diagram-js/lib/features/editor-actions'; 2 | 3 | import BpmnEditorActions from './BpmnEditorActions'; 4 | 5 | export default { 6 | __depends__: [ 7 | EditorActionsModule 8 | ], 9 | editorActions: [ 'type', BpmnEditorActions ] 10 | }; 11 | -------------------------------------------------------------------------------- /lib/features/grid-snapping/BpmnGridSnapping.js: -------------------------------------------------------------------------------- 1 | import { isAny } from '../modeling/util/ModelingUtil'; 2 | 3 | /** 4 | * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus 5 | */ 6 | 7 | /** 8 | * @param {EventBus} eventBus 9 | */ 10 | export default function BpmnGridSnapping(eventBus) { 11 | eventBus.on([ 12 | 'create.init', 13 | 'shape.move.init' 14 | ], function(event) { 15 | var context = event.context, 16 | shape = event.shape; 17 | 18 | if (isAny(shape, [ 19 | 'bpmn:Participant', 20 | 'bpmn:SubProcess', 21 | 'bpmn:TextAnnotation' 22 | ])) { 23 | if (!context.gridSnappingContext) { 24 | context.gridSnappingContext = {}; 25 | } 26 | 27 | context.gridSnappingContext.snapLocation = 'top-left'; 28 | } 29 | }); 30 | } 31 | 32 | BpmnGridSnapping.$inject = [ 'eventBus' ]; -------------------------------------------------------------------------------- /lib/features/grid-snapping/behavior/GridSnappingParticipantBehavior.js: -------------------------------------------------------------------------------- 1 | import { is } from '../../../util/ModelUtil'; 2 | 3 | /** 4 | * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas 5 | * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus 6 | * @typedef {import('diagram-js/lib/features/grid-snapping/GridSnapping').default} GridSnapping 7 | */ 8 | 9 | var HIGHER_PRIORITY = 1750; 10 | 11 | /** 12 | * @param {Canvas} canvas 13 | * @param {EventBus} eventBus 14 | * @param {GridSnapping} gridSnapping 15 | */ 16 | export default function GridSnappingParticipantBehavior(canvas, eventBus, gridSnapping) { 17 | eventBus.on([ 18 | 'create.start', 19 | 'shape.move.start' 20 | ], HIGHER_PRIORITY, function(event) { 21 | var context = event.context, 22 | shape = context.shape, 23 | rootElement = canvas.getRootElement(); 24 | 25 | if (!is(shape, 'bpmn:Participant') || 26 | !is(rootElement, 'bpmn:Process') || 27 | !rootElement.children.length) { 28 | return; 29 | } 30 | 31 | var createConstraints = context.createConstraints; 32 | 33 | if (!createConstraints) { 34 | return; 35 | } 36 | 37 | shape.width = gridSnapping.snapValue(shape.width, { min: shape.width }); 38 | shape.height = gridSnapping.snapValue(shape.height, { min: shape.height }); 39 | }); 40 | } 41 | 42 | GridSnappingParticipantBehavior.$inject = [ 43 | 'canvas', 44 | 'eventBus', 45 | 'gridSnapping' 46 | ]; -------------------------------------------------------------------------------- /lib/features/grid-snapping/behavior/index.js: -------------------------------------------------------------------------------- 1 | import GridSnappingAutoPlaceBehavior from './GridSnappingAutoPlaceBehavior'; 2 | import GridSnappingParticipantBehavior from './GridSnappingParticipantBehavior'; 3 | import GridSnappingLayoutConnectionBehavior from './GridSnappingLayoutConnectionBehavior'; 4 | 5 | export default { 6 | __init__: [ 7 | 'gridSnappingAutoPlaceBehavior', 8 | 'gridSnappingParticipantBehavior', 9 | 'gridSnappingLayoutConnectionBehavior', 10 | ], 11 | gridSnappingAutoPlaceBehavior: [ 'type', GridSnappingAutoPlaceBehavior ], 12 | gridSnappingParticipantBehavior: [ 'type', GridSnappingParticipantBehavior ], 13 | gridSnappingLayoutConnectionBehavior: [ 'type', GridSnappingLayoutConnectionBehavior ] 14 | }; -------------------------------------------------------------------------------- /lib/features/grid-snapping/index.js: -------------------------------------------------------------------------------- 1 | import BpmnGridSnapping from './BpmnGridSnapping'; 2 | import GridSnappingModule from 'diagram-js/lib/features/grid-snapping'; 3 | 4 | import GridSnappingBehaviorModule from './behavior'; 5 | 6 | export default { 7 | __depends__: [ 8 | GridSnappingModule, 9 | GridSnappingBehaviorModule 10 | ], 11 | __init__: [ 'bpmnGridSnapping' ], 12 | bpmnGridSnapping: [ 'type', BpmnGridSnapping ] 13 | }; -------------------------------------------------------------------------------- /lib/features/interaction-events/index.js: -------------------------------------------------------------------------------- 1 | import BpmnInteractionEvents from './BpmnInteractionEvents'; 2 | 3 | export default { 4 | __init__: [ 'bpmnInteractionEvents' ], 5 | bpmnInteractionEvents: [ 'type', BpmnInteractionEvents ] 6 | }; -------------------------------------------------------------------------------- /lib/features/keyboard/index.js: -------------------------------------------------------------------------------- 1 | import KeyboardModule from 'diagram-js/lib/features/keyboard'; 2 | 3 | import BpmnKeyboardBindings from './BpmnKeyboardBindings'; 4 | 5 | export default { 6 | __depends__: [ 7 | KeyboardModule 8 | ], 9 | __init__: [ 'keyboardBindings' ], 10 | keyboardBindings: [ 'type', BpmnKeyboardBindings ] 11 | }; 12 | -------------------------------------------------------------------------------- /lib/features/label-editing/LabelUtil.js: -------------------------------------------------------------------------------- 1 | export { 2 | getLabel, 3 | setLabel 4 | } from '../../util/LabelUtil'; 5 | -------------------------------------------------------------------------------- /lib/features/label-editing/index.js: -------------------------------------------------------------------------------- 1 | import ChangeSupportModule from 'diagram-js/lib/features/change-support'; 2 | import ResizeModule from 'diagram-js/lib/features/resize'; 3 | import DirectEditingModule from 'diagram-js-direct-editing'; 4 | 5 | import LabelEditingProvider from './LabelEditingProvider'; 6 | import LabelEditingPreview from './LabelEditingPreview'; 7 | 8 | 9 | export default { 10 | __depends__: [ 11 | ChangeSupportModule, 12 | ResizeModule, 13 | DirectEditingModule 14 | ], 15 | __init__: [ 16 | 'labelEditingProvider', 17 | 'labelEditingPreview' 18 | ], 19 | labelEditingProvider: [ 'type', LabelEditingProvider ], 20 | labelEditingPreview: [ 'type', LabelEditingPreview ] 21 | }; 22 | -------------------------------------------------------------------------------- /lib/features/modeling-feedback/index.js: -------------------------------------------------------------------------------- 1 | import TooltipsModule from 'diagram-js/lib/features/tooltips'; 2 | 3 | import ModelingFeedback from './ModelingFeedback'; 4 | 5 | export default { 6 | __depends__: [ 7 | TooltipsModule 8 | ], 9 | __init__: [ 10 | 'modelingFeedback' 11 | ], 12 | modelingFeedback: [ 'type', ModelingFeedback ] 13 | }; -------------------------------------------------------------------------------- /lib/features/modeling/behavior/AppendBehavior.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import { is } from '../../../util/ModelUtil'; 4 | 5 | import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; 6 | 7 | /** 8 | * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus 9 | */ 10 | 11 | export default function AppendBehavior(eventBus) { 12 | 13 | CommandInterceptor.call(this, eventBus); 14 | 15 | // assign correct shape position unless already set 16 | 17 | this.preExecute('shape.append', function(context) { 18 | 19 | var source = context.source, 20 | shape = context.shape; 21 | 22 | if (!context.position) { 23 | 24 | if (is(shape, 'bpmn:TextAnnotation')) { 25 | context.position = { 26 | x: source.x + source.width / 2 + 75, 27 | y: source.y - 50 - shape.height / 2 28 | }; 29 | } else { 30 | context.position = { 31 | x: source.x + source.width + 80 + shape.width / 2, 32 | y: source.y + source.height / 2 33 | }; 34 | } 35 | } 36 | }, true); 37 | } 38 | 39 | inherits(AppendBehavior, CommandInterceptor); 40 | 41 | AppendBehavior.$inject = [ 42 | 'eventBus' 43 | ]; -------------------------------------------------------------------------------- /lib/features/modeling/behavior/AssociationBehavior.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import { is } from '../../../util/ModelUtil'; 4 | 5 | import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; 6 | 7 | import { 8 | filter, 9 | forEach 10 | } from 'min-dash'; 11 | 12 | /** 13 | * @typedef {import('didi').Injector} Injector 14 | * @typedef {import('../Modeling').default} Modeling 15 | */ 16 | 17 | /** 18 | * @param {Injector} injector 19 | * @param {Modeling} modeling 20 | */ 21 | export default function AssociationBehavior(injector, modeling) { 22 | injector.invoke(CommandInterceptor, this); 23 | 24 | this.postExecute('shape.move', function(context) { 25 | var newParent = context.newParent, 26 | shape = context.shape; 27 | 28 | var associations = filter(shape.incoming.concat(shape.outgoing), function(connection) { 29 | return is(connection, 'bpmn:Association'); 30 | }); 31 | 32 | forEach(associations, function(association) { 33 | modeling.moveConnection(association, { x: 0, y: 0 }, newParent); 34 | }); 35 | }, true); 36 | } 37 | 38 | inherits(AssociationBehavior, CommandInterceptor); 39 | 40 | AssociationBehavior.$inject = [ 41 | 'injector', 42 | 'modeling' 43 | ]; -------------------------------------------------------------------------------- /lib/features/modeling/behavior/CreateBehavior.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import { is } from '../../../util/ModelUtil'; 4 | 5 | import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; 6 | 7 | import { getParent } from '../util/ModelingUtil'; 8 | 9 | /** 10 | * @typedef {import('didi').Injector} Injector 11 | */ 12 | 13 | /** 14 | * @param {Injector} injector 15 | */ 16 | export default function CreateBehavior(injector) { 17 | injector.invoke(CommandInterceptor, this); 18 | 19 | this.preExecute('shape.create', 1500, function(event) { 20 | var context = event.context, 21 | parent = context.parent, 22 | shape = context.shape; 23 | 24 | if (is(parent, 'bpmn:Lane') && !is(shape, 'bpmn:Lane')) { 25 | context.parent = getParent(parent, 'bpmn:Participant'); 26 | } 27 | }); 28 | 29 | } 30 | 31 | 32 | CreateBehavior.$inject = [ 'injector' ]; 33 | 34 | inherits(CreateBehavior, CommandInterceptor); -------------------------------------------------------------------------------- /lib/features/modeling/behavior/CreateDataObjectBehavior.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; 4 | 5 | import { is } from '../../../util/ModelUtil'; 6 | 7 | /** 8 | * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus 9 | * @typedef {import('../BpmnFactory').default} BpmnFactory 10 | */ 11 | 12 | /** 13 | * BPMN specific create data object behavior. 14 | * 15 | * @param {EventBus} eventBus 16 | * @param {BpmnFactory} bpmnFactory 17 | */ 18 | export default function CreateDataObjectBehavior(eventBus, bpmnFactory) { 19 | 20 | CommandInterceptor.call(this, eventBus); 21 | 22 | this.preExecute('shape.create', function(event) { 23 | 24 | var context = event.context, 25 | shape = context.shape; 26 | 27 | if (is(shape, 'bpmn:DataObjectReference') && shape.type !== 'label') { 28 | 29 | // create a DataObject every time a DataObjectReference is created 30 | var dataObject = bpmnFactory.create('bpmn:DataObject'); 31 | 32 | // set the reference to the DataObject 33 | shape.businessObject.dataObjectRef = dataObject; 34 | } 35 | }); 36 | 37 | } 38 | 39 | CreateDataObjectBehavior.$inject = [ 40 | 'eventBus', 41 | 'bpmnFactory' 42 | ]; 43 | 44 | inherits(CreateDataObjectBehavior, CommandInterceptor); -------------------------------------------------------------------------------- /lib/features/modeling/behavior/IsHorizontalFix.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; 4 | 5 | import { 6 | getBusinessObject, 7 | getDi 8 | } from '../../../util/ModelUtil'; 9 | 10 | import { 11 | isAny 12 | } from '../util/ModelingUtil'; 13 | 14 | /** 15 | * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus 16 | */ 17 | 18 | /** 19 | * A component that makes sure that each created or updated 20 | * Pool and Lane is assigned an isHorizontal property set to true. 21 | * 22 | * @param {EventBus} eventBus 23 | */ 24 | export default function IsHorizontalFix(eventBus) { 25 | 26 | CommandInterceptor.call(this, eventBus); 27 | 28 | var elementTypesToUpdate = [ 29 | 'bpmn:Participant', 30 | 'bpmn:Lane' 31 | ]; 32 | 33 | this.executed([ 'shape.move', 'shape.create', 'shape.resize' ], function(event) { 34 | var shape = event.context.shape, 35 | bo = getBusinessObject(shape), 36 | di = getDi(shape); 37 | 38 | if (isAny(bo, elementTypesToUpdate)) { 39 | var isHorizontal = di.get('isHorizontal'); 40 | 41 | if (isHorizontal === undefined) { 42 | isHorizontal = true; 43 | } 44 | 45 | // set attribute directly to avoid modeling#updateProperty side effects 46 | di.set('isHorizontal', isHorizontal); 47 | } 48 | }); 49 | 50 | } 51 | 52 | IsHorizontalFix.$inject = [ 'eventBus' ]; 53 | 54 | inherits(IsHorizontalFix, CommandInterceptor); 55 | -------------------------------------------------------------------------------- /lib/features/modeling/behavior/NonInterruptingBehavior.js: -------------------------------------------------------------------------------- 1 | import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; 2 | import inherits from 'inherits-browser'; 3 | 4 | import { canBeNonInterrupting, getInterruptingProperty } from './util/NonInterruptingUtil'; 5 | import { getBusinessObject } from '../../../util/ModelUtil'; 6 | 7 | export default function NonInterruptingBehavior(injector, modeling) { 8 | injector.invoke(CommandInterceptor, this); 9 | 10 | this.postExecuted('shape.replace', function(event) { 11 | const oldShape = event.context.oldShape; 12 | const newShape = event.context.newShape; 13 | const hints = event.context.hints; 14 | 15 | if (!canBeNonInterrupting(newShape)) { 16 | return; 17 | } 18 | 19 | const property = getInterruptingProperty(newShape); 20 | const isExplicitChange = hints.targetElement && hints.targetElement[property] !== undefined; 21 | 22 | if (isExplicitChange) { 23 | return; 24 | } 25 | 26 | const isOldInterrupting = getBusinessObject(oldShape).get(property); 27 | const isNewInterruptingDefault = getBusinessObject(newShape).get(property); 28 | 29 | if (isOldInterrupting === isNewInterruptingDefault) { 30 | return; 31 | } 32 | 33 | modeling.updateProperties(newShape, { 34 | [property]: isOldInterrupting 35 | }); 36 | }); 37 | } 38 | 39 | NonInterruptingBehavior.$inject = [ 'injector', 'modeling' ]; 40 | 41 | inherits(NonInterruptingBehavior, CommandInterceptor); 42 | -------------------------------------------------------------------------------- /lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; 4 | 5 | import { getDi } from '../../../util/ModelUtil'; 6 | 7 | /** 8 | * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus 9 | * @typedef {import('../Modeling').default} Modeling 10 | */ 11 | 12 | /** 13 | * BPMN specific behavior ensuring that bpmndi:Label's dc:Bounds are removed 14 | * when shape is resized. 15 | * 16 | * @param {EventBus} eventBus 17 | * @param {Modeling} modeling 18 | */ 19 | export default function RemoveEmbeddedLabelBoundsBehavior(eventBus, modeling) { 20 | CommandInterceptor.call(this, eventBus); 21 | 22 | this.preExecute('shape.resize', function(context) { 23 | var shape = context.shape; 24 | 25 | var di = getDi(shape), 26 | label = di && di.get('label'), 27 | bounds = label && label.get('bounds'); 28 | 29 | if (bounds) { 30 | modeling.updateModdleProperties(shape, label, { 31 | bounds: undefined 32 | }); 33 | } 34 | }, true); 35 | } 36 | 37 | inherits(RemoveEmbeddedLabelBoundsBehavior, CommandInterceptor); 38 | 39 | RemoveEmbeddedLabelBoundsBehavior.$inject = [ 40 | 'eventBus', 41 | 'modeling' 42 | ]; -------------------------------------------------------------------------------- /lib/features/modeling/behavior/TextAnnotationBehavior.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import { is } from '../../../util/ModelUtil'; 4 | 5 | import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; 6 | 7 | /** 8 | * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus 9 | */ 10 | 11 | export default function TextAnnotationBehavior(eventBus) { 12 | 13 | CommandInterceptor.call(this, eventBus); 14 | 15 | // On Append, TextAnnotations will be created on the Root. 16 | // The default for connections will create the connection in the parent of 17 | // the source element, so we overwrite the parent here. 18 | this.preExecute('connection.create', function(context) { 19 | const { target } = context; 20 | 21 | if (!is(target, 'bpmn:TextAnnotation')) { 22 | return; 23 | } 24 | 25 | context.parent = target.parent; 26 | }, true); 27 | 28 | this.preExecute([ 'shape.create', 'shape.resize', 'elements.move' ], function(context) { 29 | const shapes = context.shapes || [ context.shape ]; 30 | 31 | if (shapes.length === 1 && is(shapes[0], 'bpmn:TextAnnotation')) { 32 | context.hints = context.hints || {}; 33 | 34 | context.hints.autoResize = false; 35 | } 36 | }, true); 37 | } 38 | 39 | inherits(TextAnnotationBehavior, CommandInterceptor); 40 | 41 | TextAnnotationBehavior.$inject = [ 42 | 'eventBus' 43 | ]; -------------------------------------------------------------------------------- /lib/features/modeling/behavior/util/ConnectionLayoutUtil.js: -------------------------------------------------------------------------------- 1 | import { getAnchorPointAdjustment } from './LayoutUtil'; 2 | 3 | /** 4 | * @typedef {import('diagram-js/lib/util/Types').Point} Point 5 | * 6 | * @typedef {import('./LayoutUtil').FindNewLineStartIndexHints} FindNewLineStartIndexHints 7 | */ 8 | 9 | /** 10 | * Calculate the new point after the connection waypoints got updated. 11 | * 12 | * @param {Point} position 13 | * @param {Point[]} newWaypoints 14 | * @param {Point[]} oldWaypoints 15 | * @param {FindNewLineStartIndexHints} hints 16 | * 17 | * @return {Point} 18 | */ 19 | export function getConnectionAdjustment(position, newWaypoints, oldWaypoints, hints) { 20 | return getAnchorPointAdjustment(position, newWaypoints, oldWaypoints, hints).point; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /lib/features/modeling/behavior/util/GeometricUtil.js: -------------------------------------------------------------------------------- 1 | export * from 'diagram-js/lib/features/bendpoints/GeometricUtil'; -------------------------------------------------------------------------------- /lib/features/modeling/behavior/util/LabelLayoutUtil.js: -------------------------------------------------------------------------------- 1 | import { findNewLineStartIndex, getAnchorPointAdjustment } from './LayoutUtil'; 2 | 3 | import { getMid } from 'diagram-js/lib/layout/LayoutUtil'; 4 | 5 | /** 6 | * @typedef {import('./LineAttachmentUtil').Attachment} Attachment 7 | * 8 | * @typedef {import('./LayoutUtil').FindNewLineStartIndexHints} FindNewLineStartIndexHints 9 | * 10 | * @typedef {import('../../../../model/Types').Label} Label 11 | * 12 | * @typedef {import('diagram-js/lib/util/Types').Point} Point 13 | */ 14 | 15 | /** 16 | * @param {Point[]} oldWaypoints 17 | * @param {Point[]} newWaypoints 18 | * @param {Attachment} attachment 19 | * @param {FindNewLineStartIndexHints} hints 20 | * 21 | * @return {number} 22 | */ 23 | export function findNewLabelLineStartIndex(oldWaypoints, newWaypoints, attachment, hints) { 24 | return findNewLineStartIndex(oldWaypoints, newWaypoints, attachment, hints); 25 | } 26 | 27 | /** 28 | * Calculate the required adjustment (move delta) for the given label 29 | * after the connection waypoints got updated. 30 | * 31 | * @param {Label} label 32 | * @param {Point[]} newWaypoints 33 | * @param {Point[]} oldWaypoints 34 | * @param {FindNewLineStartIndexHints} hints 35 | * 36 | * @return {Point} 37 | */ 38 | export function getLabelAdjustment(label, newWaypoints, oldWaypoints, hints) { 39 | var labelPosition = getMid(label); 40 | 41 | return getAnchorPointAdjustment(labelPosition, newWaypoints, oldWaypoints, hints).delta; 42 | } -------------------------------------------------------------------------------- /lib/features/modeling/behavior/util/LineIntersect.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @typedef {import('diagram-js/lib/util/Types').Point} Point 3 | */ 4 | 5 | /** 6 | * Returns the intersection between two line segments a and b. 7 | * 8 | * @param {Point} l1s 9 | * @param {Point} l1e 10 | * @param {Point} l2s 11 | * @param {Point} l2e 12 | * 13 | * @return {Point} 14 | */ 15 | export default function lineIntersect(l1s, l1e, l2s, l2e) { 16 | 17 | // if the lines intersect, the result contains the x and y of the 18 | // intersection (treating the lines as infinite) and booleans for 19 | // whether line segment 1 or line segment 2 contain the point 20 | var denominator, a, b, c, numerator; 21 | 22 | denominator = ((l2e.y - l2s.y) * (l1e.x - l1s.x)) - ((l2e.x - l2s.x) * (l1e.y - l1s.y)); 23 | 24 | if (denominator == 0) { 25 | return null; 26 | } 27 | 28 | a = l1s.y - l2s.y; 29 | b = l1s.x - l2s.x; 30 | numerator = ((l2e.x - l2s.x) * a) - ((l2e.y - l2s.y) * b); 31 | 32 | c = numerator / denominator; 33 | 34 | // if we cast these lines infinitely in 35 | // both directions, they intersect here 36 | return { 37 | x: Math.round(l1s.x + (c * (l1e.x - l1s.x))), 38 | y: Math.round(l1s.y + (c * (l1e.y - l1s.y))) 39 | }; 40 | } -------------------------------------------------------------------------------- /lib/features/modeling/behavior/util/NonInterruptingUtil.js: -------------------------------------------------------------------------------- 1 | import { isEventSubProcess } from '../../../../util/DiUtil'; 2 | import { getBusinessObject, is } from '../../../../util/ModelUtil'; 3 | 4 | export const NON_INTERRUPTING_EVENT_TYPES = [ 5 | 'bpmn:MessageEventDefinition', 6 | 'bpmn:TimerEventDefinition', 7 | 'bpmn:EscalationEventDefinition', 8 | 'bpmn:ConditionalEventDefinition', 9 | 'bpmn:SignalEventDefinition' 10 | ]; 11 | 12 | export function canBeNonInterrupting(shape) { 13 | 14 | const businessObject = getBusinessObject(shape); 15 | 16 | if ( 17 | !is(businessObject, 'bpmn:BoundaryEvent') && 18 | !(is(businessObject, 'bpmn:StartEvent') && isEventSubProcess(businessObject.$parent)) 19 | ) { 20 | return false; 21 | } 22 | 23 | const eventDefinitions = businessObject.get('eventDefinitions'); 24 | if (!eventDefinitions || !eventDefinitions.length) { 25 | return false; 26 | } 27 | 28 | return NON_INTERRUPTING_EVENT_TYPES.some(event => is(eventDefinitions[0], event)); 29 | } 30 | 31 | export function getInterruptingProperty(shape) { 32 | return is(shape, 'bpmn:BoundaryEvent') ? 'cancelActivity' : 'isInterrupting'; 33 | } -------------------------------------------------------------------------------- /lib/features/modeling/behavior/util/ResizeUtil.js: -------------------------------------------------------------------------------- 1 | export { getParticipantResizeConstraints } from '../ResizeBehavior'; -------------------------------------------------------------------------------- /lib/features/modeling/cmd/IdClaimHandler.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @typedef {import('diagram-js/lib/command/CommandHandler').default} CommandHandler 3 | * 4 | * @typedef {import('../../../model/Types').Moddle} Moddle 5 | */ 6 | 7 | /** 8 | * @implements {CommandHandler} 9 | * 10 | * @param {Moddle} moddle 11 | */ 12 | export default function IdClaimHandler(moddle) { 13 | this._moddle = moddle; 14 | } 15 | 16 | IdClaimHandler.$inject = [ 'moddle' ]; 17 | 18 | 19 | IdClaimHandler.prototype.execute = function(context) { 20 | var ids = this._moddle.ids, 21 | id = context.id, 22 | element = context.element, 23 | claiming = context.claiming; 24 | 25 | if (claiming) { 26 | ids.claim(id, element); 27 | } else { 28 | ids.unclaim(id); 29 | } 30 | 31 | return []; 32 | }; 33 | 34 | /** 35 | * Command revert implementation. 36 | */ 37 | IdClaimHandler.prototype.revert = function(context) { 38 | var ids = this._moddle.ids, 39 | id = context.id, 40 | element = context.element, 41 | claiming = context.claiming; 42 | 43 | if (claiming) { 44 | ids.unclaim(id); 45 | } else { 46 | ids.claim(id, element); 47 | } 48 | 49 | return []; 50 | }; 51 | 52 | -------------------------------------------------------------------------------- /lib/features/ordering/index.js: -------------------------------------------------------------------------------- 1 | import BpmnOrderingProvider from './BpmnOrderingProvider'; 2 | 3 | export default { 4 | __init__: [ 'bpmnOrderingProvider' ], 5 | bpmnOrderingProvider: [ 'type', BpmnOrderingProvider ] 6 | }; -------------------------------------------------------------------------------- /lib/features/outline/index.js: -------------------------------------------------------------------------------- 1 | import Ouline from 'diagram-js/lib/features/outline'; 2 | import OulineProvider from './OutlineProvider'; 3 | 4 | export default { 5 | __depends__: [ 6 | Ouline 7 | ], 8 | __init__: [ 'outlineProvider' ], 9 | outlineProvider: [ 'type', OulineProvider ] 10 | }; 11 | -------------------------------------------------------------------------------- /lib/features/palette/index.js: -------------------------------------------------------------------------------- 1 | import PaletteModule from 'diagram-js/lib/features/palette'; 2 | import CreateModule from 'diagram-js/lib/features/create'; 3 | import SpaceToolModule from '../space-tool'; 4 | import LassoToolModule from 'diagram-js/lib/features/lasso-tool'; 5 | import HandToolModule from 'diagram-js/lib/features/hand-tool'; 6 | import GlobalConnectModule from 'diagram-js/lib/features/global-connect'; 7 | import translate from 'diagram-js/lib/i18n/translate'; 8 | 9 | import PaletteProvider from './PaletteProvider'; 10 | 11 | export default { 12 | __depends__: [ 13 | PaletteModule, 14 | CreateModule, 15 | SpaceToolModule, 16 | LassoToolModule, 17 | HandToolModule, 18 | GlobalConnectModule, 19 | translate 20 | ], 21 | __init__: [ 'paletteProvider' ], 22 | paletteProvider: [ 'type', PaletteProvider ] 23 | }; 24 | -------------------------------------------------------------------------------- /lib/features/popup-menu/index.js: -------------------------------------------------------------------------------- 1 | import PopupMenuModule from 'diagram-js/lib/features/popup-menu'; 2 | import ReplaceModule from '../replace'; 3 | 4 | import ReplaceMenuProvider from './ReplaceMenuProvider'; 5 | import AutoPlaceModule from '../auto-place'; 6 | 7 | export default { 8 | __depends__: [ 9 | PopupMenuModule, 10 | ReplaceModule, 11 | AutoPlaceModule 12 | ], 13 | __init__: [ 14 | 'replaceMenuProvider' 15 | ], 16 | replaceMenuProvider: [ 'type', ReplaceMenuProvider ] 17 | }; -------------------------------------------------------------------------------- /lib/features/popup-menu/util/Icons.js: -------------------------------------------------------------------------------- 1 | export default { 2 | 'start-event-non-interrupting': ` 3 | 4 | 5 | 6 | 7 | `, 8 | 'intermediate-event-non-interrupting': ` 9 | 10 | 11 | 12 | 13 | 14 | ` 15 | }; -------------------------------------------------------------------------------- /lib/features/replace-preview/index.js: -------------------------------------------------------------------------------- 1 | import PreviewSupportModule from 'diagram-js/lib/features/preview-support'; 2 | 3 | import BpmnReplacePreview from './BpmnReplacePreview'; 4 | 5 | export default { 6 | __depends__: [ 7 | PreviewSupportModule 8 | ], 9 | __init__: [ 'bpmnReplacePreview' ], 10 | bpmnReplacePreview: [ 'type', BpmnReplacePreview ] 11 | }; 12 | -------------------------------------------------------------------------------- /lib/features/replace/index.js: -------------------------------------------------------------------------------- 1 | import CopyPasteModule from '../copy-paste'; 2 | import ReplaceModule from 'diagram-js/lib/features/replace'; 3 | import SelectionModule from 'diagram-js/lib/features/selection'; 4 | 5 | import BpmnReplace from './BpmnReplace'; 6 | 7 | export default { 8 | __depends__: [ 9 | CopyPasteModule, 10 | ReplaceModule, 11 | SelectionModule 12 | ], 13 | bpmnReplace: [ 'type', BpmnReplace ] 14 | }; 15 | -------------------------------------------------------------------------------- /lib/features/rules/index.js: -------------------------------------------------------------------------------- 1 | import RulesModule from 'diagram-js/lib/features/rules'; 2 | 3 | import BpmnRules from './BpmnRules'; 4 | 5 | export default { 6 | __depends__: [ 7 | RulesModule 8 | ], 9 | __init__: [ 'bpmnRules' ], 10 | bpmnRules: [ 'type', BpmnRules ] 11 | }; 12 | -------------------------------------------------------------------------------- /lib/features/search/index.js: -------------------------------------------------------------------------------- 1 | import SearchPadModule from 'diagram-js/lib/features/search-pad'; 2 | import SearchModule from 'diagram-js/lib/features/search'; 3 | 4 | import BpmnSearchProvider from './BpmnSearchProvider'; 5 | 6 | 7 | export default { 8 | __depends__: [ 9 | SearchPadModule, 10 | SearchModule 11 | ], 12 | __init__: [ 'bpmnSearch' ], 13 | bpmnSearch: [ 'type', BpmnSearchProvider ] 14 | }; 15 | -------------------------------------------------------------------------------- /lib/features/snapping/BpmnSnappingUtil.js: -------------------------------------------------------------------------------- 1 | import { getOrientation } from 'diagram-js/lib/layout/LayoutUtil'; 2 | 3 | /** 4 | * @typedef {import('diagram-js/lib/util/Types').DirectionTRBL} DirectionTRBL 5 | * @typedef {import('diagram-js/lib/util/Types').Point} Point 6 | * @typedef {import('diagram-js/lib/util/Types').Rect} Rect 7 | */ 8 | 9 | /** 10 | * @param {Point} position 11 | * @param {Rect} targetBounds 12 | * 13 | * @return {DirectionTRBL|null} 14 | */ 15 | export function getBoundaryAttachment(position, targetBounds) { 16 | 17 | var orientation = getOrientation(position, targetBounds, -15); 18 | 19 | if (orientation !== 'intersect') { 20 | return orientation; 21 | } else { 22 | return null; 23 | } 24 | } -------------------------------------------------------------------------------- /lib/features/snapping/index.js: -------------------------------------------------------------------------------- 1 | import BpmnConnectSnapping from './BpmnConnectSnapping'; 2 | import BpmnCreateMoveSnapping from './BpmnCreateMoveSnapping'; 3 | import SnappingModule from 'diagram-js/lib/features/snapping'; 4 | 5 | export default { 6 | __depends__: [ SnappingModule ], 7 | __init__: [ 8 | 'connectSnapping', 9 | 'createMoveSnapping' 10 | ], 11 | connectSnapping: [ 'type', BpmnConnectSnapping ], 12 | createMoveSnapping: [ 'type', BpmnCreateMoveSnapping ] 13 | }; -------------------------------------------------------------------------------- /lib/features/space-tool/index.js: -------------------------------------------------------------------------------- 1 | import SpaceToolModule from 'diagram-js/lib/features/space-tool'; 2 | 3 | import BpmnSpaceTool from './BpmnSpaceTool'; 4 | 5 | export default { 6 | __depends__: [ SpaceToolModule ], 7 | spaceTool: [ 'type', BpmnSpaceTool ] 8 | }; -------------------------------------------------------------------------------- /lib/import/Util.js: -------------------------------------------------------------------------------- 1 | export function elementToString(e) { 2 | if (!e) { 3 | return ''; 4 | } 5 | 6 | return '<' + e.$type + (e.id ? ' id="' + e.id : '') + '" />'; 7 | } -------------------------------------------------------------------------------- /lib/import/index.js: -------------------------------------------------------------------------------- 1 | import translate from 'diagram-js/lib/i18n/translate'; 2 | 3 | import BpmnImporter from './BpmnImporter'; 4 | 5 | export default { 6 | __depends__: [ 7 | translate 8 | ], 9 | bpmnImporter: [ 'type', BpmnImporter ] 10 | }; -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | export { 2 | default 3 | } from './Viewer'; -------------------------------------------------------------------------------- /lib/model/Types.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | Connection as BaseConnection, 3 | Element as BaseElement, 4 | Label as BaseLabel, 5 | Root as BaseRoot, 6 | Shape as BaseShape 7 | } from "diagram-js/lib/model"; 8 | 9 | export type Moddle = any; 10 | 11 | export type ModdleElement = any; 12 | 13 | export type ModdleExtension = {}; 14 | 15 | export type BpmnAttributes = { 16 | associationDirection: 'None' | 'One' | 'Both'; 17 | cancelActivity: boolean; 18 | eventDefinitionType: string; 19 | isExpanded: boolean; 20 | isHorizontal: boolean; 21 | isForCompensation: boolean; 22 | isInterrupting: boolean; 23 | processRef: ModdleElement; 24 | triggeredByEvent: boolean; 25 | }; 26 | 27 | export type Element = { 28 | businessObject: any; 29 | di: any; 30 | type: string; 31 | } & BaseElement; 32 | 33 | export type Connection = BaseConnection & Element; 34 | 35 | export type Label = BaseLabel & Element; 36 | 37 | export type Root = BaseRoot & Element; 38 | 39 | export type Shape = BaseShape & Element; 40 | 41 | export type Parent = Root | Shape; -------------------------------------------------------------------------------- /lib/util/CompatibilityUtil.js: -------------------------------------------------------------------------------- 1 | import { 2 | has 3 | } from 'min-dash'; 4 | 5 | /** 6 | * @typedef {import('../model/Types').ModdleElement} ModdleElement 7 | */ 8 | 9 | 10 | // TODO(nikku): remove with future bpmn-js version 11 | 12 | var DI_ERROR_MESSAGE = 'Tried to access di from the businessObject. The di is available through the diagram element only. For more information, see https://github.com/bpmn-io/bpmn-js/issues/1472'; 13 | 14 | /** 15 | * @private 16 | * 17 | * @param {ModdleElement} businessObject 18 | */ 19 | export function ensureCompatDiRef(businessObject) { 20 | 21 | // bpmnElement can have multiple independent DIs 22 | if (!has(businessObject, 'di')) { 23 | Object.defineProperty(businessObject, 'di', { 24 | enumerable: false, 25 | get: function() { 26 | throw new Error(DI_ERROR_MESSAGE); 27 | } 28 | }); 29 | } 30 | } -------------------------------------------------------------------------------- /lib/util/DrilldownUtil.js: -------------------------------------------------------------------------------- 1 | import { getDi, is } from './ModelUtil'; 2 | 3 | /** 4 | * @typedef {import('../model/Types').Element} Element 5 | * @typedef {import('../model/Types').ModdleElement} ModdleElement 6 | */ 7 | 8 | export var planeSuffix = '_plane'; 9 | 10 | /** 11 | * Get primary shape ID for a plane. 12 | * 13 | * @param {Element|ModdleElement} element 14 | * 15 | * @return {string} 16 | */ 17 | export function getShapeIdFromPlane(element) { 18 | var id = element.id; 19 | 20 | return removePlaneSuffix(id); 21 | } 22 | 23 | /** 24 | * Get plane ID for a primary shape. 25 | * 26 | * @param {Element|ModdleElement} element 27 | * 28 | * @return {string} 29 | */ 30 | export function getPlaneIdFromShape(element) { 31 | var id = element.id; 32 | 33 | if (is(element, 'bpmn:SubProcess')) { 34 | return addPlaneSuffix(id); 35 | } 36 | 37 | return id; 38 | } 39 | 40 | /** 41 | * Get plane ID for primary shape ID. 42 | * 43 | * @param {string} id 44 | * 45 | * @return {string} 46 | */ 47 | export function toPlaneId(id) { 48 | return addPlaneSuffix(id); 49 | } 50 | 51 | /** 52 | * Check wether element is plane. 53 | * 54 | * @param {Element|ModdleElement} element 55 | * 56 | * @return {boolean} 57 | */ 58 | export function isPlane(element) { 59 | var di = getDi(element); 60 | 61 | return is(di, 'bpmndi:BPMNPlane'); 62 | } 63 | 64 | function addPlaneSuffix(id) { 65 | return id + planeSuffix; 66 | } 67 | 68 | function removePlaneSuffix(id) { 69 | return id.replace(new RegExp(planeSuffix + '$'), ''); 70 | } -------------------------------------------------------------------------------- /lib/util/ModelUtil.js: -------------------------------------------------------------------------------- 1 | import { 2 | some 3 | } from 'min-dash'; 4 | 5 | /** 6 | * @typedef { import('../model/Types').Element } Element 7 | * @typedef { import('../model/Types').ModdleElement } ModdleElement 8 | */ 9 | 10 | /** 11 | * Is an element of the given BPMN type? 12 | * 13 | * @param {Element|ModdleElement} element 14 | * @param {string} type 15 | * 16 | * @return {boolean} 17 | */ 18 | export function is(element, type) { 19 | var bo = getBusinessObject(element); 20 | 21 | return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type); 22 | } 23 | 24 | 25 | /** 26 | * Return true if element has any of the given types. 27 | * 28 | * @param {Element|ModdleElement} element 29 | * @param {string[]} types 30 | * 31 | * @return {boolean} 32 | */ 33 | export function isAny(element, types) { 34 | return some(types, function(t) { 35 | return is(element, t); 36 | }); 37 | } 38 | 39 | /** 40 | * Return the business object for a given element. 41 | * 42 | * @param {Element|ModdleElement} element 43 | * 44 | * @return {ModdleElement} 45 | */ 46 | export function getBusinessObject(element) { 47 | return (element && element.businessObject) || element; 48 | } 49 | 50 | /** 51 | * Return the di object for a given element. 52 | * 53 | * @param {Element} element 54 | * 55 | * @return {ModdleElement} 56 | */ 57 | export function getDi(element) { 58 | return element && element.di; 59 | } -------------------------------------------------------------------------------- /lib/util/Types.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @typedef {Object} Colors 3 | * @property {string} [fill] 4 | * @property {string} [stroke] 5 | */ -------------------------------------------------------------------------------- /lib/util/Types.ts: -------------------------------------------------------------------------------- 1 | export type Colors = { 2 | fill?: string; 3 | stroke?: string; 4 | }; -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "github>bpmn-io/renovate-config:recommended" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /resources/banner-min.txt: -------------------------------------------------------------------------------- 1 | /*! bpmn-js - {{ name }} v{{ version }} | Copyright (c) 2014-present, camunda Services GmbH | bpmn.io/license */ -------------------------------------------------------------------------------- /resources/banner.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | * bpmn-js - {{ name }} v{{ version }} 3 | * 4 | * Copyright (c) 2014-present, camunda Services GmbH 5 | * 6 | * Released under the bpmn.io license 7 | * http://bpmn.io/license 8 | * 9 | * Source Code: https://github.com/bpmn-io/bpmn-js 10 | * 11 | * Date: {{ date }} 12 | */ -------------------------------------------------------------------------------- /resources/initial.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/screencast.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bpmn-io/bpmn-js/13f36155d65b69355fa17398798be6dc4d307e6f/resources/screencast.gif -------------------------------------------------------------------------------- /tasks/build-distro.mjs: -------------------------------------------------------------------------------- 1 | import path from 'node:path'; 2 | import fs from 'node:fs'; 3 | 4 | import cp from 'cpy'; 5 | import { deleteAsync as del } from 'del'; 6 | 7 | import { execa as exec } from 'execa'; 8 | 9 | import { createRequire } from 'node:module'; 10 | 11 | var dest = process.env.DISTRO_DIST || 'dist'; 12 | 13 | function resolve(module, sub) { 14 | var require = createRequire(import.meta.url); 15 | var pkg = require.resolve(module + '/package.json'); 16 | 17 | return path.dirname(pkg) + sub; 18 | } 19 | 20 | async function run() { 21 | 22 | console.log('clean ' + dest); 23 | await del(dest); 24 | 25 | console.log('mkdir -p ' + dest); 26 | fs.mkdirSync(dest, { recursive: true }); 27 | 28 | console.log('copy bpmn-font to ' + dest + '/bpmn-font'); 29 | await cp(resolve('bpmn-font', '/dist/css/**'), dest + '/assets/bpmn-font/css'); 30 | await cp(resolve('bpmn-font', '/dist/font/**'), dest + '/assets/bpmn-font/font'); 31 | 32 | console.log('copy diagram-js.css to ' + dest); 33 | await cp(resolve('diagram-js', '/assets/**'), dest + '/assets'); 34 | 35 | console.log('copy bpmn-js.css to ' + dest); 36 | await cp('./assets/*.css', dest + '/assets'); 37 | 38 | console.log('building pre-packaged distributions'); 39 | 40 | await exec('rollup', [ '-c', '--bundleConfigAsCjs' ], { 41 | stdio: 'inherit' 42 | }); 43 | 44 | console.log('done.'); 45 | } 46 | 47 | run().catch(e => { 48 | console.error('failed to build distribution', e); 49 | 50 | process.exit(1); 51 | }); -------------------------------------------------------------------------------- /tasks/stages/await-published: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | shopt -s inherit_errexit nullglob 5 | 6 | i=0 7 | tries=9 8 | pkg="$PKG" 9 | until [ $i -gt $tries ] 10 | do 11 | echo "Checking for $pkg in npm registry ($((i+1))/$((tries+1)))" 12 | info=$(npm info $pkg 2> /dev/null || echo "FAILED") 13 | if [[ "$info" != "FAILED" ]]; then 14 | echo "Found." 15 | exit 0 16 | fi 17 | 18 | i=$(($i+1)) 19 | 20 | sleep 5s 21 | done 22 | 23 | echo "Not found after $i tries. Giving up." 24 | exit 1; -------------------------------------------------------------------------------- /tasks/stages/update-demo: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | shopt -s inherit_errexit nullglob 5 | 6 | # bumps bpmn-js and diagram-js dependencies in bpmn-io-demo 7 | 8 | PWD="$(pwd)" 9 | WORKDIR="$(pwd)/tmp" 10 | CLONE_DIR="$WORKDIR/bpmn-io-demo" 11 | 12 | # create work dir 13 | mkdir -p "$WORKDIR" 14 | 15 | git clone --depth=1 "https://$BPMN_IO_TOKEN@github.com/$BPMN_IO_DEMO_ENDPOINT.git" "$CLONE_DIR" 16 | 17 | cd "$CLONE_DIR" 18 | 19 | npm install --save bpmn-js@latest diagram-js@latest 20 | 21 | if [[ "x$SKIP_COMMIT" = "x" ]]; then 22 | 23 | git config user.email "$BPMN_IO_EMAIL" 24 | git config user.name "$BPMN_IO_USERNAME" 25 | git config push.default simple 26 | 27 | git add -A 28 | git commit -m "deps: bump to bpmn-js@$TAG" 29 | git tag "bpmn-js-$TAG" 30 | git push -q &2>/dev/null 31 | git push --tags -q &2>/dev/null 32 | else 33 | echo "Skipping commit (SKIP_COMMIT=$SKIP_COMMIT)" 34 | fi 35 | 36 | cd "$PWD" -------------------------------------------------------------------------------- /tasks/stages/update-examples: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | shopt -s inherit_errexit nullglob 5 | 6 | # update bpmn-js version in the project 7 | 8 | PWD="$(pwd)" 9 | WORKDIR="$(pwd)/tmp" 10 | EXAMPLES_DIR="$WORKDIR/bpmn-js-examples" 11 | 12 | # create work dir 13 | mkdir -p "$WORKDIR" 14 | 15 | git clone --depth=1 "https://$BPMN_IO_TOKEN@github.com/bpmn-io/bpmn-js-examples.git" "$EXAMPLES_DIR" 16 | 17 | cd "$EXAMPLES_DIR" 18 | 19 | TOOLKIT_VERSION="${TAG:1}" 20 | echo "Updating toolkit version to $TOOLKIT_VERSION" 21 | 22 | sed -i -E "s#(\"bpmn-js\": )\"[^\"]+\"#\1\"^$TOOLKIT_VERSION\"#" **/package.json 23 | sed -i -E "s#/bpmn-js@[^/]+/#/bpmn-js@$TOOLKIT_VERSION/#" **/*.{html,md} 24 | 25 | # install dependencies (fixes up lock file) 26 | npm install 27 | 28 | if [[ "x$SKIP_COMMIT" = "x" ]]; then 29 | 30 | git config user.email "$BPMN_IO_EMAIL" 31 | git config user.name "$BPMN_IO_USERNAME" 32 | git config push.default simple 33 | 34 | # add all resources 35 | git add -A 36 | git commit -m "deps: bump bpmn-js to $TAG" 37 | git tag "$TAG" 38 | git push -q &2>/dev/null 39 | git push --tags -q &2>/dev/null 40 | else 41 | echo "Skipping commit (SKIP_COMMIT=$SKIP_COMMIT)" 42 | fi 43 | 44 | cd "$PWD" -------------------------------------------------------------------------------- /tasks/stages/update-integration-test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | shopt -s inherit_errexit nullglob 5 | 6 | # bumps bpmn-js and diagram-js dependencies in bpmn-js-integration 7 | 8 | PWD="$(pwd)" 9 | WORKDIR="$(pwd)/tmp" 10 | IT_DIR="$WORKDIR/bpmn-js-integration" 11 | 12 | # create work dir 13 | mkdir -p "$WORKDIR" 14 | 15 | git clone --depth=1 "https://$BPMN_IO_TOKEN@github.com/bpmn-io/bpmn-js-integration.git" "$IT_DIR" 16 | 17 | cd "$IT_DIR" 18 | 19 | npm install --save bpmn-js@latest bpmn-moddle@latest 20 | 21 | git config user.email "$BPMN_IO_EMAIL" 22 | git config user.name "$BPMN_IO_USERNAME" 23 | git config push.default simple 24 | 25 | git add -A 26 | git commit -m "deps: bump bpmn-js to $TAG" 27 | git tag "$TAG" 28 | git push -q &2>/dev/null 29 | git push --tags -q &2>/dev/null 30 | 31 | cd "$PWD" -------------------------------------------------------------------------------- /tasks/stages/update-translations: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | shopt -s inherit_errexit nullglob 5 | 6 | # updates translations and creates pull request 7 | 8 | npm ci 9 | npm run collect-translations 10 | 11 | # exit if no changes 12 | if [[ "x$(git status --porcelain docs/translations.json)" = "x" ]]; then echo "No changes; exiting" && exit 0; fi 13 | 14 | if [[ "x$SKIP_COMMIT" = "x" ]]; then 15 | 16 | git config user.email "$BPMN_IO_EMAIL" 17 | git config user.name "$BPMN_IO_USERNAME" 18 | git config push.default simple 19 | BRANCH="update-translations-$(date +%Y%m%d%H%M%S)" 20 | git switch -c $BRANCH 21 | 22 | git add docs/translations.json 23 | git commit -m "docs: update translations for $TAG" 24 | git push -q --set-upstream origin $BRANCH 25 | gh pr create --title "docs: update translations for $TAG" \ 26 | --body "This PR updates translations for $TAG" \ 27 | --reviewer "$REVIEWERS" 28 | else 29 | echo "Skipping commit (SKIP_COMMIT=$SKIP_COMMIT)" 30 | fi 31 | -------------------------------------------------------------------------------- /tasks/stages/update-website: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | shopt -s inherit_errexit nullglob 5 | 6 | # update bpmn-js version in the project 7 | 8 | PWD="$(pwd)" 9 | WORKDIR="$(pwd)/tmp" 10 | CLONE_DIR="$WORKDIR/bpmn.io" 11 | 12 | # create work dir 13 | mkdir -p "$WORKDIR" 14 | 15 | git clone --depth=1 "https://$BPMN_IO_TOKEN@github.com/bpmn-io/bpmn.io.git" "$CLONE_DIR" 16 | 17 | cd "$CLONE_DIR" 18 | 19 | PUBLISHED=`date +"%F %H:%M"` 20 | 21 | echo "Updating toolkit version to version=$TAG, published=$PUBLISHED on bpmn.io" 22 | 23 | cat src/data/site.yml | \ 24 | tr "\r?\n" "\r" | \ 25 | sed -e "s#bpmnjs:\r version: [^\r]*\r published: [^\r]*\r#bpmnjs:\r version: $TAG\r published: $PUBLISHED\r#" | \ 26 | tr "\r" "\n" > src/data/site.yml_new 27 | 28 | mv -f src/data/site.yml_new src/data/site.yml 29 | 30 | if [[ "x$SKIP_COMMIT" = "x" ]]; then 31 | 32 | git config user.email "$BPMN_IO_EMAIL" 33 | git config user.name "$BPMN_IO_USERNAME" 34 | git config push.default simple 35 | 36 | # add all resources 37 | git add -A 38 | git commit -m "deps: bump bpmn-js to $TAG" 39 | git push -q &2>/dev/null 40 | else 41 | echo "Skipping commit (SKIP_COMMIT=$SKIP_COMMIT)" 42 | fi 43 | 44 | cd "$PWD" -------------------------------------------------------------------------------- /test/config/karma.distro.js: -------------------------------------------------------------------------------- 1 | // configures browsers to run test against 2 | // any of [ 'ChromeHeadless', 'Chrome', 'Firefox' ] 3 | var browsers = (process.env.TEST_BROWSERS || 'ChromeHeadless').split(','); 4 | 5 | // use puppeteer provided Chrome for testing 6 | process.env.CHROME_BIN = require('puppeteer').executablePath(); 7 | 8 | var VARIANT = process.env.VARIANT; 9 | 10 | var NODE_ENV = process.env.NODE_ENV; 11 | 12 | 13 | module.exports = function(karma) { 14 | karma.set({ 15 | 16 | basePath: '../../', 17 | 18 | frameworks: [ 19 | 'mocha', 20 | 'sinon-chai' 21 | ], 22 | 23 | files: [ 24 | 'dist/' + VARIANT + '.' + (NODE_ENV === 'production' ? 'production.min' : 'development') + '.js', 25 | 'dist/assets/bpmn-font/css/bpmn.css', 26 | 'dist/assets/diagram-js.css', 27 | { pattern: 'resources/initial.bpmn', included: false }, 28 | { pattern: 'dist/assets/**/*', included: false }, 29 | 'test/distro/helper.js', 30 | 'test/distro/' + VARIANT + '.js' 31 | ], 32 | 33 | reporters: [ 'progress' ], 34 | 35 | browsers, 36 | 37 | browserNoActivityTimeout: 30000, 38 | 39 | singleRun: true, 40 | autoWatch: false 41 | }); 42 | 43 | }; 44 | -------------------------------------------------------------------------------- /test/config/translation-reporter.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var path = require('path'); 3 | 4 | var { 5 | uniqueBy, 6 | sortBy 7 | } = require('min-dash'); 8 | 9 | 10 | function TranslationReporter() { 11 | var translationsFile = path.join(__dirname, '../../docs/translations.json'); 12 | 13 | var translations = []; 14 | 15 | 16 | this.onBrowserLog = function(browser, log, type) { 17 | 18 | if (log === undefined || typeof log !== 'string') { 19 | return; 20 | } 21 | 22 | if (log.substring(0, 1) === '\'') { 23 | log = log.substring(1, log.length - 1); 24 | } 25 | 26 | try { 27 | var obj = JSON.parse(log); 28 | 29 | if (obj.type === 'translations') { 30 | translations.push(obj.msg); 31 | } 32 | } catch (e) { 33 | return; 34 | } 35 | }; 36 | 37 | 38 | this.onRunComplete = function() { 39 | translations = uniqueBy(function(e) { return e; }, translations); 40 | translations = sortBy(translations, function(e) { return e; }); 41 | 42 | fs.writeFileSync(translationsFile, JSON.stringify(translations, null, 2)); 43 | }; 44 | } 45 | 46 | module.exports = { 47 | 'reporter:translation-reporter' : [ 'type', TranslationReporter ] 48 | }; -------------------------------------------------------------------------------- /test/coverageBundle.js: -------------------------------------------------------------------------------- 1 | var allTests = require.context('.', true, /(spec|integration).*Spec\.js$/); 2 | 3 | allTests.keys().forEach(allTests); 4 | 5 | var allSources = require.context('../lib', true, /.*\.js$/); 6 | 7 | allSources.keys().forEach(allSources); -------------------------------------------------------------------------------- /test/distro/bpmn-modeler.js: -------------------------------------------------------------------------------- 1 | describe('bpmn-modeler', function() { 2 | 3 | it('should expose globals', function() { 4 | 5 | var BpmnJS = window.BpmnJS; 6 | 7 | // then 8 | expect(BpmnJS).to.exist; 9 | expect(new BpmnJS()).to.exist; 10 | }); 11 | 12 | 13 | it('should expose Viewer and NavigatedViewer', function() { 14 | 15 | var BpmnJS = window.BpmnJS; 16 | 17 | // then 18 | expect(BpmnJS.NavigatedViewer).to.exist; 19 | expect(new BpmnJS.NavigatedViewer()).to.exist; 20 | 21 | expect(BpmnJS.Viewer).to.exist; 22 | expect(new BpmnJS.Viewer()).to.exist; 23 | }); 24 | 25 | 26 | it('should import initial diagram', function() { 27 | 28 | var BpmnJS = window.BpmnJS; 29 | 30 | // then 31 | /* global testImport */ 32 | return testImport(BpmnJS); 33 | }); 34 | 35 | }); -------------------------------------------------------------------------------- /test/distro/bpmn-navigated-viewer.js: -------------------------------------------------------------------------------- 1 | describe('bpmn-navigated-viewer', function() { 2 | 3 | it('should expose globals', function() { 4 | 5 | var BpmnJS = window.BpmnJS; 6 | 7 | // then 8 | expect(BpmnJS).to.exist; 9 | expect(new BpmnJS()).to.exist; 10 | }); 11 | 12 | 13 | it('should expose Viewer', function() { 14 | 15 | var BpmnJS = window.BpmnJS; 16 | 17 | // then 18 | expect(BpmnJS.Viewer).not.to.exist; 19 | }); 20 | 21 | 22 | it('should import initial diagram', function() { 23 | 24 | var BpmnJS = window.BpmnJS; 25 | 26 | // then 27 | /* global testImport */ 28 | return testImport(BpmnJS); 29 | }); 30 | 31 | }); -------------------------------------------------------------------------------- /test/distro/bpmn-viewer.js: -------------------------------------------------------------------------------- 1 | describe('bpmn-navigated-viewer', function() { 2 | 3 | it('should expose globals', function() { 4 | 5 | var BpmnJS = window.BpmnJS; 6 | 7 | // then 8 | expect(BpmnJS).to.exist; 9 | expect(new BpmnJS()).to.exist; 10 | }); 11 | 12 | 13 | it('should import initial diagram', function() { 14 | 15 | var BpmnJS = window.BpmnJS; 16 | 17 | // then 18 | /* global testImport */ 19 | return testImport(BpmnJS); 20 | }); 21 | 22 | }); -------------------------------------------------------------------------------- /test/distro/helper.js: -------------------------------------------------------------------------------- 1 | 2 | async function testImport(BpmnJS, done) { 3 | 4 | var container = document.createElement('div'); 5 | container.style.height = '500px'; 6 | container.style.border = 'solid 1px #666'; 7 | 8 | document.body.appendChild(container); 9 | 10 | const response = await fetch('/base/resources/initial.bpmn'); 11 | 12 | if (!response.ok) { 13 | throw new Error('failed to fetch diagram'); 14 | } 15 | 16 | const diagramXML = await response.text(); 17 | 18 | var modeler = new BpmnJS({ container: container }); 19 | 20 | const { warnings } = await modeler.importXML(diagramXML); 21 | 22 | if (warnings.length) { 23 | throw new Error('imported with warnings'); 24 | } 25 | 26 | return modeler; 27 | } 28 | 29 | window.testImport = testImport; -------------------------------------------------------------------------------- /test/fixtures/bpmn/basic.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/collaboration/collaboration-empty-participant.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/collaboration/process-empty.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/draw/call-activity.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/empty-definitions.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/error/binary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bpmn-io/bpmn-js/13f36155d65b69355fa17398798be6dc4d307e6f/test/fixtures/bpmn/error/binary.png -------------------------------------------------------------------------------- /test/fixtures/bpmn/error/di-plane-no-bpmn-element.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/error/duplicate-ids.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/error/invalid-child.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/error/missing-namespace.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/error/no-process-collaboration.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/error/no-xml.txt: -------------------------------------------------------------------------------- 1 | this is no xml -------------------------------------------------------------------------------- /test/fixtures/bpmn/features/replace/participants.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/features/rules/text-annotation-association.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | A label 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/import/data-store.inside-participant.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/import/data-store.outside-participant.dangling.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/import/data-store.outside-participant.participant.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/import/default-attrs.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/import/error/multiple-dis.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/import/groups.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/fixtures/bpmn/multiple-diagrams.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/fixtures/json/model/custom-override.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Custom descriptor Override", 3 | "uri": "http://customdescriptor.com/bpmn2", 4 | "prefix": "custom", 5 | "xml": { 6 | "tagAlias": "lowerCase" 7 | }, 8 | "associations": [], 9 | "types": [ 10 | { 11 | "name": "CustomSendElementOverride", 12 | "superClass": [ 13 | "Element" 14 | ], 15 | "properties": [ 16 | { 17 | "name": "name", 18 | "isAttr": true, 19 | "type": "String" 20 | }, 21 | { 22 | "name": "value", 23 | "isAttr": true, 24 | "type": "String" 25 | } 26 | ] 27 | }, 28 | { 29 | "name": "ServiceTaskGroupOverride", 30 | "extends": [ 31 | "bpmn:ServiceTask", 32 | "bpmn:BusinessRuleTask", 33 | "bpmn:SendTask", 34 | "bpmn:MessageEventDefinition" 35 | ] 36 | } 37 | ], 38 | "emumerations": [ ] 39 | } 40 | -------------------------------------------------------------------------------- /test/fixtures/json/model/custom.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Custom descriptor", 3 | "uri": "http://customdescriptor.com/bpmn2", 4 | "prefix": "custom", 5 | "xml": { 6 | "tagAlias": "lowerCase" 7 | }, 8 | "associations": [], 9 | "types": [ 10 | { 11 | "name": "CustomSendElement", 12 | "superClass": [ 13 | "Element" 14 | ], 15 | "properties": [ 16 | { 17 | "name": "name", 18 | "isAttr": true, 19 | "type": "String" 20 | }, 21 | { 22 | "name": "value", 23 | "isAttr": true, 24 | "type": "String" 25 | }, 26 | { 27 | "name": "paths", 28 | "type": "String", 29 | "isMany": true 30 | } 31 | ] 32 | }, 33 | { 34 | "name": "ServiceTaskGroup", 35 | "extends": [ 36 | "bpmn:ServiceTask", 37 | "bpmn:BusinessRuleTask", 38 | "bpmn:SendTask", 39 | "bpmn:MessageEventDefinition" 40 | ] 41 | } 42 | ], 43 | "emumerations": [ ] 44 | } 45 | -------------------------------------------------------------------------------- /test/helper/TranslationCollector.js: -------------------------------------------------------------------------------- 1 | import translate from 'diagram-js/lib/i18n/translate/translate'; 2 | 3 | function collectTranslations(template, replacements) { 4 | var log = { 5 | type: 'translations', 6 | msg: template 7 | }; 8 | 9 | console.log(JSON.stringify(log)); 10 | 11 | return translate(template, replacements); 12 | } 13 | 14 | export default { 15 | translate: [ 'value', collectTranslations ] 16 | }; -------------------------------------------------------------------------------- /test/integration/SimpleModelingSpec.js: -------------------------------------------------------------------------------- 1 | import Modeler from 'lib/Modeler'; 2 | 3 | import TestContainer from 'mocha-test-container-support'; 4 | 5 | describe('scenario - simple modeling', function() { 6 | 7 | 8 | var container; 9 | 10 | beforeEach(function() { 11 | container = TestContainer.get(this); 12 | }); 13 | 14 | 15 | it('should build process from start to end event', function() { 16 | 17 | // given 18 | var modeler = new Modeler({ container: container }); 19 | 20 | // when 21 | return modeler.createDiagram(); 22 | }); 23 | 24 | }); 25 | -------------------------------------------------------------------------------- /test/integration/custom-elements/index.js: -------------------------------------------------------------------------------- 1 | import CustomElementFactory from './CustomElementFactory'; 2 | import CustomRenderer from './CustomRenderer'; 3 | import CustomRules from './CustomRules'; 4 | import CustomUpdater from './CustomUpdater'; 5 | 6 | export default { 7 | __init__: [ 8 | 'customRenderer', 9 | 'customRules', 10 | 'customUpdater' 11 | ], 12 | elementFactory: [ 'type', CustomElementFactory ], 13 | customRenderer: [ 'type', CustomRenderer ], 14 | customRules: [ 'type', CustomRules ], 15 | customUpdater: [ 'type', CustomUpdater ] 16 | }; 17 | -------------------------------------------------------------------------------- /test/matchers/JSONMatcher.js: -------------------------------------------------------------------------------- 1 | export default function(chai, utils) { 2 | 3 | var Assertion = chai.Assertion; 4 | 5 | Assertion.addMethod('jsonEqual', function(comparison, filter) { 6 | 7 | var actual = JSON.stringify(this._obj, filter, ' '); 8 | var expected = JSON.stringify(comparison, filter, ' '); 9 | 10 | this.assert( 11 | actual == expected, 12 | 'expected #{this} to json equal #{exp} but got #{act}', 13 | 'expected #{this} not to json equal #{exp}', 14 | expected, // expected 15 | actual, // actual 16 | true // show diff 17 | ); 18 | }); 19 | } 20 | -------------------------------------------------------------------------------- /test/spec/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "globals": { 3 | "sinon": true 4 | } 5 | } -------------------------------------------------------------------------------- /test/spec/BaseViewerSpec.js: -------------------------------------------------------------------------------- 1 | import BaseViewer from 'lib/BaseViewer'; 2 | 3 | import inherits from 'inherits-browser'; 4 | 5 | 6 | const spy = sinon.spy; 7 | 8 | 9 | describe('BaseViewer', function() { 10 | 11 | it('should instantiate', function() { 12 | 13 | // when 14 | var instance = new BaseViewer(); 15 | 16 | // then 17 | expect(instance.importXML).to.exist; 18 | expect(instance.saveXML).to.exist; 19 | 20 | expect(instance instanceof BaseViewer).to.be.true; 21 | }); 22 | 23 | 24 | describe('#getModule', function() { 25 | 26 | it('should allow override with context', function() { 27 | 28 | // given 29 | const options = { 30 | __foo: 1, 31 | some: { 32 | other: { 33 | thing: 'yes' 34 | } 35 | } 36 | }; 37 | 38 | function SpecialViewer(options) { 39 | this.getModules = spy(function(localOptions) { 40 | expect(localOptions, 'options are passed').to.exist; 41 | 42 | expect(localOptions).to.include(options); 43 | 44 | return BaseViewer.prototype.getModules.call(this, localOptions); 45 | }); 46 | 47 | BaseViewer.call(this, options); 48 | } 49 | 50 | inherits(SpecialViewer, BaseViewer); 51 | 52 | // when 53 | var instance = new SpecialViewer(options); 54 | 55 | // then 56 | expect(instance.getModules).to.have.been.calledOnce; 57 | 58 | expect(instance instanceof SpecialViewer).to.be.true; 59 | expect(instance instanceof BaseViewer).to.be.true; 60 | }); 61 | 62 | }); 63 | 64 | }); 65 | -------------------------------------------------------------------------------- /test/spec/Modeler.copy-paste.a.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/spec/Modeler.copy-paste.b.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/spec/Modeler.copy-paste.empty.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/spec/draw/BpmnRenderer.group-colors.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /test/spec/draw/BpmnRenderer.sequenceFlow-no-source.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/spec/draw/TextRenderer.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/spec/draw/custom-renderer/CustomRenderer.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import BaseRenderer from 'diagram-js/lib/draw/BaseRenderer'; 4 | 5 | import { 6 | is, 7 | isAny 8 | } from 'lib/util/ModelUtil'; 9 | 10 | import { 11 | isLabel 12 | } from 'lib/util/LabelUtil'; 13 | 14 | 15 | var HIGH_PRIORITY = 1250; 16 | 17 | 18 | export default function CustomRenderer( 19 | bpmnRenderer, 20 | eventBus) { 21 | 22 | this._bpmnRenderer = bpmnRenderer; 23 | 24 | BaseRenderer.call(this, eventBus, HIGH_PRIORITY); 25 | } 26 | 27 | inherits(CustomRenderer, BaseRenderer); 28 | 29 | CustomRenderer.prototype.canRender = function(element) { 30 | 31 | if (isLabel(element)) { 32 | return false; 33 | } 34 | 35 | return !!( 36 | isAny(element, [ 'bpmn:Event' ]) 37 | ); 38 | }; 39 | 40 | CustomRenderer.prototype.drawShape = function(parentGfx, element) { 41 | 42 | var renderer = this._bpmnRenderer.handlers[ 43 | [ 44 | 'bpmn:StartEvent', 45 | 'bpmn:IntermediateCatchEvent', 46 | 'bpmn:IntermediateThrowEvent', 47 | 'bpmn:BoundaryEvent', 48 | 'bpmn:EndEvent' 49 | ].find(t => is(element, t)) 50 | ]; 51 | 52 | return renderer(parentGfx, element, { renderIcon: false }); 53 | }; 54 | 55 | CustomRenderer.$inject = [ 56 | 'bpmnRenderer', 57 | 'eventBus' 58 | ]; -------------------------------------------------------------------------------- /test/spec/draw/custom-renderer/index.js: -------------------------------------------------------------------------------- 1 | import CustomRenderer from './CustomRenderer'; 2 | 3 | export default { 4 | __init__: [ 'customRenderer' ], 5 | customRenderer: [ 'type', CustomRenderer ] 6 | }; -------------------------------------------------------------------------------- /test/spec/environment/MockingSpec.js: -------------------------------------------------------------------------------- 1 | import { 2 | bootstrapViewer, 3 | inject 4 | } from 'test/TestHelper'; 5 | 6 | import Events from 'diagram-js/lib/core/EventBus'; 7 | 8 | import Viewer from 'lib/Viewer'; 9 | 10 | 11 | describe('environment - mocking', function() { 12 | 13 | var diagramXML = require('../../fixtures/bpmn/simple.bpmn'); 14 | 15 | var mockEvents, bootstrapCalled; 16 | 17 | beforeEach(bootstrapViewer(diagramXML, { 18 | modules: Viewer.prototype._modules 19 | }, function() { 20 | mockEvents = new Events(); 21 | 22 | bootstrapCalled = true; 23 | 24 | return { 25 | eventBus: mockEvents 26 | }; 27 | })); 28 | 29 | afterEach(function() { 30 | bootstrapCalled = false; 31 | }); 32 | 33 | 34 | it('should use spy', inject(function(eventBus) { 35 | 36 | expect(eventBus).to.eql(mockEvents); 37 | expect(bootstrapCalled).to.be.true; 38 | })); 39 | 40 | 41 | it('should reparse bootstrap code', inject(function(eventBus) { 42 | 43 | expect(bootstrapCalled).to.be.true; 44 | })); 45 | 46 | 47 | it('should inject bpmnjs', inject(function(bpmnjs) { 48 | 49 | expect(bpmnjs).to.exist; 50 | })); 51 | 52 | }); 53 | -------------------------------------------------------------------------------- /test/spec/features/append-preview/AppendPreview.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/spec/features/append-preview/AppendPreviewSpec.js: -------------------------------------------------------------------------------- 1 | import { queryAll as domQueryAll } from 'min-dom'; 2 | 3 | import { 4 | bootstrapModeler, 5 | inject 6 | } from 'test/TestHelper'; 7 | 8 | import appendPreviewModule from 'lib/features/append-preview'; 9 | import coreModule from 'lib/core'; 10 | 11 | describe('features/append-preview', function() { 12 | 13 | var diagramXML = require('./AppendPreview.bpmn'); 14 | 15 | before(bootstrapModeler(diagramXML, { 16 | modules: [ 17 | coreModule, 18 | appendPreviewModule 19 | ] 20 | })); 21 | 22 | 23 | it('should create', inject(function(appendPreview, canvas, elementRegistry) { 24 | 25 | // given 26 | var startEvent = elementRegistry.get('StartEvent_1'); 27 | 28 | // when 29 | appendPreview.create(startEvent, 'bpmn:Task'); 30 | 31 | // then 32 | expect(canvas.getLayer('complex-preview')).to.exist; 33 | expect(domQueryAll('.djs-dragger', canvas.getLayer('complex-preview'))).to.have.length(2); 34 | })); 35 | 36 | 37 | it('should clean up', inject(function(appendPreview, canvas, elementRegistry) { 38 | 39 | // given 40 | var startEvent = elementRegistry.get('StartEvent_1'); 41 | 42 | // when 43 | appendPreview.create(startEvent, 'bpmn:Task'); 44 | 45 | // assume 46 | expect(canvas.getLayer('complex-preview')).to.exist; 47 | expect(domQueryAll('.djs-dragger', canvas.getLayer('complex-preview'))).to.have.length(2); 48 | 49 | // when 50 | appendPreview.cleanUp(); 51 | 52 | // then 53 | expect(domQueryAll('.djs-dragger', canvas.getLayer('complex-preview'))).to.be.empty; 54 | })); 55 | 56 | }); -------------------------------------------------------------------------------- /test/spec/features/auto-resize/AutoResize.multi-selection.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/spec/features/drilldown/diagram-missing-plane.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/spec/features/drilldown/plane-missing-bpmnelement.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/spec/features/drilldown/process-missing-bpmndiagram.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /test/spec/features/drilldown/subprocess-missing-bpmndiagram.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/spec/features/drilldown/subprocess-missing-di.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/spec/features/grid-snapping/basic.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/spec/features/grid-snapping/behavior/AutoPlaceBehavior.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/spec/features/grid-snapping/behavior/AutoResizeBehavior.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/spec/features/grid-snapping/behavior/AutoResizeBehaviorSpec.js: -------------------------------------------------------------------------------- 1 | import { 2 | bootstrapModeler, 3 | inject 4 | } from 'test/TestHelper'; 5 | 6 | import autoResizeModule from 'lib/features/auto-resize'; 7 | import coreModule from 'lib/core'; 8 | import gridSnappingModule from 'lib/features/grid-snapping'; 9 | import modelingModule from 'lib/features/modeling'; 10 | 11 | 12 | describe('features/grid-snapping - auto-resize', function() { 13 | 14 | var diagramXML = require('./AutoResizeBehavior.bpmn'); 15 | 16 | beforeEach(bootstrapModeler(diagramXML, { 17 | modules: [ 18 | autoResizeModule, 19 | coreModule, 20 | gridSnappingModule, 21 | modelingModule 22 | ] 23 | })); 24 | 25 | 26 | it('should snap (width, height)', inject(function(elementRegistry, modeling) { 27 | 28 | // given 29 | var subProcess = elementRegistry.get('SubProcess_1'), 30 | task = elementRegistry.get('Task_1'); 31 | 32 | [ 33 | { x: 100, y: 100, width: 350, height: 270 }, 34 | { x: 100, y: 100, width: 450, height: 270 }, 35 | { x: 100, y: 100, width: 450, height: 360 }, 36 | { x: 100, y: 100, width: 450, height: 360 }, 37 | { x: 100, y: 100, width: 560, height: 460 } 38 | ].forEach(function(bounds) { 39 | 40 | // when 41 | modeling.moveElements([ task ], { x: 36, y: 48 }, subProcess); 42 | 43 | // then 44 | expect(subProcess).to.have.bounds(bounds); 45 | }); 46 | })); 47 | 48 | }); -------------------------------------------------------------------------------- /test/spec/features/grid-snapping/behavior/CreateParticipantBehaviorSpec.js: -------------------------------------------------------------------------------- 1 | import { 2 | bootstrapModeler, 3 | inject 4 | } from 'test/TestHelper'; 5 | 6 | import coreModule from 'lib/core'; 7 | import createModule from 'diagram-js/lib/features/create'; 8 | import gridSnappingModule from 'lib/features/grid-snapping'; 9 | import modelingModule from 'lib/features/modeling'; 10 | 11 | import { createCanvasEvent as canvasEvent } from '../../../../util/MockEvents'; 12 | 13 | 14 | describe('features/grid-snapping - create participant', function() { 15 | 16 | var diagramXML = require('./CreateParticipantBehavior.bpmn'); 17 | 18 | beforeEach(bootstrapModeler(diagramXML, { 19 | modules: [ 20 | coreModule, 21 | createModule, 22 | gridSnappingModule, 23 | modelingModule 24 | ] 25 | })); 26 | 27 | 28 | it('should snap width and height', inject( 29 | function(create, dragging, elementFactory, elementRegistry) { 30 | 31 | // given 32 | var process = elementRegistry.get('Process_1'), 33 | processGfx = elementRegistry.getGraphics(process); 34 | 35 | var participant = elementFactory.createParticipantShape(); 36 | 37 | // when 38 | create.start(canvasEvent({ x: 100, y: 100 }), participant); 39 | 40 | dragging.hover({ element: process, gfx: processGfx }); 41 | 42 | dragging.move(canvasEvent({ x: 100, y: 100 })); 43 | 44 | dragging.end(); 45 | 46 | // then 47 | expect(participant.width).to.equal(610); 48 | expect(participant.height).to.equal(340); 49 | } 50 | )); 51 | 52 | }); -------------------------------------------------------------------------------- /test/spec/features/modeling-feedback/ModelingFeedback.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/spec/features/modeling/BendpointsSpec.js: -------------------------------------------------------------------------------- 1 | import { 2 | bootstrapModeler, 3 | inject 4 | } from 'test/TestHelper'; 5 | 6 | import modelingModule from 'lib/features/modeling'; 7 | import bendpointsModule from 'diagram-js/lib/features/bendpoints'; 8 | import coreModule from 'lib/core'; 9 | 10 | 11 | describe('features/bendpoints', function() { 12 | 13 | var diagramXML = require('../../../fixtures/bpmn/features/drop/drop.bpmn'); 14 | 15 | var testModules = [ coreModule, bendpointsModule, modelingModule ]; 16 | 17 | beforeEach(bootstrapModeler(diagramXML, { modules: testModules })); 18 | 19 | 20 | it('should contain bendpoints', inject(function(bendpoints) { 21 | expect(bendpoints).to.exist; 22 | })); 23 | 24 | }); -------------------------------------------------------------------------------- /test/spec/features/modeling/BpmnUpdater.incompleteDi.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/spec/features/modeling/ElementFactory.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/spec/features/modeling/IdClaim.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/spec/features/modeling/IdClaimSpec.js: -------------------------------------------------------------------------------- 1 | import { 2 | bootstrapModeler, 3 | inject 4 | } from 'test/TestHelper'; 5 | 6 | import modelingModule from 'lib/features/modeling'; 7 | import coreModule from 'lib/core'; 8 | 9 | 10 | describe('features/modeling - id claim management', function() { 11 | 12 | var testModules = [ coreModule, modelingModule ]; 13 | 14 | var processDiagramXML = require('./IdClaim.bpmn'); 15 | 16 | beforeEach(bootstrapModeler(processDiagramXML, { modules: testModules })); 17 | 18 | var element, moddleElement, id; 19 | 20 | beforeEach(inject(function(elementRegistry, moddle) { 21 | id = 'StartEvent_2'; 22 | element = elementRegistry.get(id); 23 | moddleElement = element.businessObject; 24 | })); 25 | 26 | 27 | describe('unclaim', function() { 28 | 29 | it('should unclaim id when removing element', inject(function(modeling, moddle) { 30 | 31 | // when 32 | modeling.removeElements([ element ]); 33 | 34 | // then 35 | expect(moddle.ids.assigned(id)).to.be.false; 36 | })); 37 | 38 | 39 | it('should revert unclaim action on restoring element', inject(function(modeling, moddle, commandStack) { 40 | 41 | // given 42 | modeling.removeElements([ element ]); 43 | 44 | // when 45 | commandStack.undo(); 46 | 47 | // then 48 | expect(moddle.ids.assigned(id)).to.eql(moddleElement); 49 | })); 50 | 51 | }); 52 | 53 | }); 54 | -------------------------------------------------------------------------------- /test/spec/features/modeling/LoggingCroppingConnectionDocking.js: -------------------------------------------------------------------------------- 1 | import CroppingConnectionDocking from 'diagram-js/lib/layout/CroppingConnectionDocking'; 2 | 3 | import { 4 | getOrientation 5 | } from 'diagram-js/lib/layout/LayoutUtil'; 6 | 7 | import inherits from 'inherits-browser'; 8 | 9 | 10 | export default function LoggingCroppingConnectionDocking(injector) { 11 | injector.invoke(CroppingConnectionDocking, this); 12 | } 13 | 14 | LoggingCroppingConnectionDocking.$inject = [ 15 | 'injector' 16 | ]; 17 | 18 | inherits(LoggingCroppingConnectionDocking, CroppingConnectionDocking); 19 | 20 | window.noIntersectCount = 0; 21 | 22 | window.noIntersect = []; 23 | 24 | LoggingCroppingConnectionDocking.prototype._getIntersection = function(shape, connection, takeFirst) { 25 | 26 | var intersection = CroppingConnectionDocking.prototype._getIntersection.call(this, shape, connection, takeFirst); 27 | 28 | if (!intersection) { 29 | 30 | if (getOrientation(connection.source, connection.target) !== 'intersect') { 31 | window.noIntersectCount++; 32 | 33 | window.noIntersect.push([ 34 | connection, 35 | this._getShapePath(shape), 36 | this._getConnectionPath(connection) 37 | ]); 38 | } 39 | } 40 | 41 | return intersection; 42 | }; -------------------------------------------------------------------------------- /test/spec/features/modeling/MoveElements.centered-connection.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SequenceFlow_1 6 | 7 | 8 | SequenceFlow_1 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/spec/features/modeling/UpdateModdleProperties.dataObject.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/spec/features/modeling/UpdateModdleProperties.error.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/AssociationBehaviorSpec.js: -------------------------------------------------------------------------------- 1 | import { 2 | bootstrapModeler, 3 | inject 4 | } from 'test/TestHelper'; 5 | 6 | import modelingModule from 'lib/features/modeling'; 7 | 8 | 9 | describe('modeling/behavior - AssociationBehavior', function() { 10 | 11 | var diagramXML = require('./AssociationBehavior.bpmn'); 12 | 13 | beforeEach(bootstrapModeler(diagramXML, { modules: modelingModule })); 14 | 15 | 16 | it('should move to new parent on source move', inject(function(modeling, elementRegistry) { 17 | 18 | // given 19 | var association = elementRegistry.get('Association_1'), 20 | process = elementRegistry.get('Process_1'), 21 | startEvent = elementRegistry.get('StartEvent_1'); 22 | 23 | // when 24 | modeling.moveElements([ startEvent ], { x: 100, y: 100 }, process); 25 | 26 | // then 27 | expect(association.parent).to.equal(process); 28 | })); 29 | 30 | 31 | it('should move to new parent on target move', inject(function(modeling, elementRegistry) { 32 | 33 | // given 34 | var association = elementRegistry.get('Association_1'), 35 | process = elementRegistry.get('Process_1'), 36 | textAnnotation = elementRegistry.get('TextAnnotation_1'); 37 | 38 | // when 39 | modeling.moveElements([ textAnnotation ], { x: 100, y: 100 }, process); 40 | 41 | // then 42 | expect(association.parent).to.equal(process); 43 | })); 44 | 45 | }); -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/CreateBehavior.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/CreateBehaviorSpec.js: -------------------------------------------------------------------------------- 1 | import { 2 | bootstrapModeler, 3 | inject 4 | } from 'test/TestHelper'; 5 | 6 | import coreModule from 'lib/core'; 7 | import modelingModule from 'lib/features/modeling'; 8 | import { getMid } from 'diagram-js/lib/layout/LayoutUtil'; 9 | 10 | 11 | describe('features/modeling - CreateBehavior', function() { 12 | 13 | var processDiagramXML = require('./CreateBehavior.bpmn'); 14 | 15 | beforeEach(bootstrapModeler(processDiagramXML, { 16 | modules: [ 17 | coreModule, 18 | modelingModule 19 | ] 20 | })); 21 | 22 | 23 | it('should ensure parent is participant', inject( 24 | function(elementFactory, elementRegistry, modeling) { 25 | 26 | // given 27 | var lane = elementRegistry.get('Lane_1'), 28 | participant = elementRegistry.get('Participant_1'); 29 | 30 | var task = elementFactory.createShape({ 31 | type: 'bpmn:Task' 32 | }); 33 | 34 | // when 35 | modeling.createShape(task, getMid(lane), lane); 36 | 37 | // then 38 | expect(task.parent).to.equal(participant); 39 | } 40 | )); 41 | 42 | }); -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/DataObjectBehavior.create-data-association.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/DataObjectBehavior.data-object-reference.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/DataStoreBehavior.collaboration.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/DataStoreBehavior.empty-pool.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/DataStoreBehavior.process.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/FixHoverBehavior.annotation.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/FixHoverBehavior.group.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/FixHoverBehavior.label.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/ImportDockingFixSpec.js: -------------------------------------------------------------------------------- 1 | import { 2 | bootstrapModeler, 3 | inject 4 | } from 'test/TestHelper'; 5 | 6 | import modelingModule from 'lib/features/modeling'; 7 | import coreModule from 'lib/core'; 8 | 9 | 10 | describe('features/modeling/behavior - ImportDockingFix', function() { 11 | 12 | var diagramXML = require('./ImportDockingFix.bpmn'); 13 | 14 | beforeEach(bootstrapModeler(diagramXML, { 15 | modules: [ 16 | coreModule, 17 | modelingModule 18 | ] 19 | })); 20 | 21 | 22 | it('should correct dockings on import', inject(function(elementRegistry, modeling) { 23 | 24 | // when 25 | var sequenceFlowConnection = elementRegistry.get('SequenceFlow'), 26 | associationConnection = elementRegistry.get('DataAssociation_1'); 27 | 28 | // then 29 | expect(sequenceFlowConnection).to.have.startDocking({ x: 191, y: 120 }); 30 | expect(sequenceFlowConnection).to.have.endDocking({ x: 328, y: 120 }); 31 | 32 | expect(associationConnection).to.have.startDocking({ x: 437, y: 369 }); 33 | expect(associationConnection).to.have.endDocking({ x: 328, y: 119 }); 34 | })); 35 | 36 | }); 37 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/ResizeBehavior.subProcess.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/ResizeBehavior.textAnnotation.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.group.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/SpaceToolBehaviorSpec.subprocess.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/SubProcessBehavior.start-event.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/TextAnnotationBehaviorSpec.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/util/GeometricUtilSpec.js: -------------------------------------------------------------------------------- 1 | import { 2 | getDistancePointLine, 3 | getAngle, 4 | getDistancePointPoint, 5 | perpendicularFoot, 6 | rotateVector 7 | } from 'lib/features/modeling/behavior/util/GeometricUtil'; 8 | 9 | 10 | describe('modeling/behavior/util - GeometricUtil', function() { 11 | 12 | it('should re-export diagram-js utility', function() { 13 | 14 | expect(getDistancePointLine).to.exist; 15 | expect(getAngle).to.exist; 16 | expect(getDistancePointPoint).to.exist; 17 | expect(perpendicularFoot).to.exist; 18 | expect(rotateVector).to.exist; 19 | 20 | }); 21 | 22 | }); 23 | -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/util/LineIntersectSpec.js: -------------------------------------------------------------------------------- 1 | import intersection from 'lib/features/modeling/behavior/util/LineIntersect'; 2 | 3 | 4 | describe('modeling/behavior/util - LineIntersect', function() { 5 | 6 | it('should compute intersections', function() { 7 | expect(intersection( 8 | { x: 10, y: 20 }, { x: 50, y: 50 }, 9 | { x: 10, y: 50 }, { x: 50, y: 50 } 10 | )).to.eql({ x: 50, y: 50 }); 11 | 12 | expect(intersection( 13 | { x: 10, y: 20 }, { x: 10, y: 50 }, 14 | { x: 10, y: 50 }, { x: 50, y: 50 } 15 | )).to.eql({ x: 10, y: 50 }); 16 | 17 | expect(intersection( 18 | { x: 50, y: 50 }, { x: 10, y: 40 }, 19 | { x: 10, y: 50 }, { x: 50, y: 50 } 20 | )).to.eql({ x: 50, y: 50 }); 21 | 22 | expect(intersection( 23 | { x: 0, y: 0 }, { x: 100, y: 100 }, 24 | { x: 40, y: 0 }, { x: 30, y: 10 } 25 | )).to.eql({ x: 20, y: 20 }); 26 | 27 | }); 28 | 29 | }); -------------------------------------------------------------------------------- /test/spec/features/modeling/behavior/util/ResizeUtilSpec.js: -------------------------------------------------------------------------------- 1 | import { 2 | getParticipantResizeConstraints 3 | } from 'lib/features/modeling/behavior/util/ResizeUtil'; 4 | 5 | 6 | describe('modeling/behavior/util - Resize', function() { 7 | 8 | describe('#getParticipantResizeConstraints', function() { 9 | 10 | it('should expose', function() { 11 | expect(getParticipantResizeConstraints).to.exist; 12 | }); 13 | 14 | }); 15 | 16 | }); -------------------------------------------------------------------------------- /test/spec/features/modeling/lanes/lanes.only.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/spec/features/modeling/lanes/lanes.only.vertical.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/spec/features/modeling/lanes/participant-no-lane-vertical.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/spec/features/modeling/lanes/participant-no-lane.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/spec/features/modeling/lanes/participant-single-lane.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/spec/features/modeling/layout/LayoutSequenceFlowSpec.subProcess.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/spec/features/ordering/ordering-start-event.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/spec/features/popup-menu/ReplaceMenuProvider.compensation-activity.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/spec/features/replace/BpmnReplace.compensation.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/spec/features/rules/BpmnRules.collaboration-empty.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/spec/features/rules/BpmnRules.collapsedPools.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/spec/features/rules/BpmnRules.connectOnCreate.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/spec/features/rules/BpmnRules.moveLane.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/spec/features/snapping/BpmnCreateMoveSnapping.boundary-events.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/spec/features/snapping/BpmnCreateMoveSnapping.docking-create-mode.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SequenceFlow_1 6 | SequenceFlow_1 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/spec/features/snapping/BpmnCreateMoveSnapping.process.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/spec/features/space-tool/BpmnSpaceTool.participants.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/spec/features/space-tool/BpmnSpaceTool.text-annotations.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Foo bar baz 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/spec/helper/InjectSpec.js: -------------------------------------------------------------------------------- 1 | import { 2 | bootstrapModeler, 3 | inject 4 | } from 'test/TestHelper'; 5 | 6 | import coreModule from 'lib/core'; 7 | import { expect } from 'chai'; 8 | 9 | 10 | describe('helper - inject', function() { 11 | 12 | var diagramXML = require('../../fixtures/bpmn/simple.bpmn'); 13 | 14 | beforeEach(bootstrapModeler(diagramXML, { 15 | modules: [ 16 | coreModule 17 | ] 18 | })); 19 | 20 | 21 | it('should work with Promise as return value', function() { 22 | 23 | // given 24 | var expected = 'resolved'; 25 | 26 | // when 27 | var testFn = inject(function(eventBus) { 28 | 29 | expect(eventBus).to.exist; 30 | 31 | return Promise.resolve(expected); 32 | }); 33 | 34 | // then 35 | return testFn().then(function(result) { 36 | 37 | expect(result).to.eql(expected); 38 | }); 39 | }); 40 | 41 | 42 | it('should handle Promise rejection', function() { 43 | 44 | // given 45 | var expected = new Error('rejected'); 46 | 47 | function onResolved() { 48 | throw new Error('should not resolve'); 49 | } 50 | 51 | function onRejected(error) { 52 | expect(error).to.eql(expected); 53 | } 54 | 55 | // when 56 | var testFn = inject(function(eventBus) { 57 | expect(eventBus).to.exist; 58 | 59 | return Promise.reject(expected); 60 | }); 61 | 62 | // then 63 | return testFn().then(onResolved, onRejected); 64 | }); 65 | 66 | }); 67 | -------------------------------------------------------------------------------- /test/spec/i18n/custom-translate/custom-translate.js: -------------------------------------------------------------------------------- 1 | import translate from 'diagram-js/lib/i18n/translate/translate'; 2 | 3 | export default function customTranslate(template, replacements) { 4 | if (template === 'Delete') { 5 | template = 'Entfernen'; 6 | } 7 | 8 | if (template === 'Activate hand tool') { 9 | template = 'Hand-Tool aktivieren'; 10 | } 11 | 12 | return translate(template, replacements); 13 | } -------------------------------------------------------------------------------- /test/spec/i18n/custom-translate/index.js: -------------------------------------------------------------------------------- 1 | import customTranslate from './custom-translate'; 2 | 3 | export default { 4 | translate: [ 'value', customTranslate ] 5 | }; -------------------------------------------------------------------------------- /test/spec/i18n/translateSpec.js: -------------------------------------------------------------------------------- 1 | import { 2 | bootstrapModeler, 3 | collectTranslations, 4 | inject 5 | } from 'test/TestHelper'; 6 | 7 | import coreModule from 'lib/core'; 8 | import translateModule from 'diagram-js/lib/i18n/translate'; 9 | import customTranslateModule from './custom-translate'; 10 | import modelingModule from 'lib/features/modeling'; 11 | import paletteModule from 'lib/features/palette'; 12 | import contextPadModule from 'lib/features/context-pad'; 13 | 14 | var diagramXML = require('test/fixtures/bpmn/simple.bpmn'); 15 | 16 | 17 | // skipping this file during translation extraction 18 | 19 | collectTranslations ? describe.skip : describe('i18n - translate', function() { 20 | 21 | beforeEach(bootstrapModeler(diagramXML, { 22 | modules: [ 23 | coreModule, 24 | modelingModule, 25 | paletteModule, 26 | contextPadModule, 27 | translateModule, 28 | customTranslateModule 29 | ] 30 | })); 31 | 32 | 33 | it('should translate palette', inject(function(palette) { 34 | 35 | // when 36 | var handToolEntry = palette.getEntries()['hand-tool']; 37 | 38 | // then 39 | expect(handToolEntry.title).to.equal('Hand-Tool aktivieren'); 40 | })); 41 | 42 | 43 | it('should translate context pad', inject(function(contextPad) { 44 | 45 | // given 46 | contextPad.open('Task_1'); 47 | 48 | // when 49 | var deleteEntry = contextPad._current.entries.delete; 50 | 51 | // then 52 | expect(deleteEntry.title).to.equal('Entfernen'); 53 | })); 54 | 55 | }); -------------------------------------------------------------------------------- /test/spec/import/elements/GroupsSpec.js: -------------------------------------------------------------------------------- 1 | import { 2 | bootstrapModeler, 3 | inject 4 | } from 'test/TestHelper'; 5 | 6 | 7 | describe('import - groups', function() { 8 | 9 | describe('should import groups', function() { 10 | 11 | it('with frame property set', function() { 12 | var xml = require('./Groups.bpmn'); 13 | 14 | // given 15 | return bootstrapModeler(xml)().then(function(result) { 16 | 17 | var err = result.error; 18 | 19 | expect(err).not.to.exist; 20 | 21 | // when 22 | inject(function(elementRegistry) { 23 | 24 | // then 25 | var groupElement = elementRegistry.get('Group_1'); 26 | 27 | expect(groupElement).to.exist; 28 | expect(groupElement.isFrame).to.be.true; 29 | })(); 30 | 31 | }); 32 | }); 33 | 34 | 35 | }); 36 | 37 | }); 38 | -------------------------------------------------------------------------------- /test/spec/import/missing-di-plane-root-element.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/spec/import/missing-di-plane.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/spec/import/sequenceFlow-missingWaypoints.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SequenceFlow 6 | 7 | 8 | SequenceFlow 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/testBundle.js: -------------------------------------------------------------------------------- 1 | var allTests = require.context('.', true, /(spec|integration).*Spec\.js$/); 2 | 3 | allTests.keys().forEach(allTests); -------------------------------------------------------------------------------- /test/util/KeyEvents.js: -------------------------------------------------------------------------------- 1 | import { 2 | isString, 3 | assign 4 | } from 'min-dash'; 5 | 6 | /** 7 | * Create a fake key event for testing purposes. 8 | * 9 | * @param {string|number} key the key or keyCode/charCode 10 | * @param {Object} [attrs] 11 | * 12 | * @return {Event} 13 | */ 14 | export function createKeyEvent(key, attrs) { 15 | var event = document.createEvent('Events') || new document.defaultView.CustomEvent('keyEvent'); 16 | 17 | // init and mark as bubbles / cancelable 18 | event.initEvent('keydown', false, true); 19 | 20 | var keyAttrs = isString(key) ? { key: key } : { keyCode: key, which: key }; 21 | 22 | return assign(event, keyAttrs, attrs || {}); 23 | } -------------------------------------------------------------------------------- /test/util/MockEvents.js: -------------------------------------------------------------------------------- 1 | import { 2 | assign 3 | } from 'min-dash'; 4 | 5 | import { 6 | getBpmnJS 7 | } from 'test/TestHelper'; 8 | 9 | 10 | /** 11 | * Create an event with global coordinates 12 | * computed based on the loaded diagrams canvas position and the 13 | * specified canvas local coordinates. 14 | * 15 | * @param {Point} point of the event local the canvas (closure) 16 | * @param {Object} [data] 17 | * 18 | * @return {Event} event, scoped to the given canvas 19 | */ 20 | export function createCanvasEvent(position, data) { 21 | 22 | return getBpmnJS().invoke(function(canvas) { 23 | 24 | var target = canvas._svg; 25 | 26 | var clientRect = canvas._container.getBoundingClientRect(); 27 | 28 | var absolutePosition = { 29 | x: position.x + clientRect.left, 30 | y: position.y + clientRect.top 31 | }; 32 | 33 | return createEvent(target, absolutePosition, data); 34 | }); 35 | } 36 | 37 | /** 38 | * Create an Event 39 | * 40 | * @param {Element} target 41 | * @param { { x: number, y: number } } position 42 | * @param {any} [data] 43 | * 44 | * @return {Event} 45 | */ 46 | export function createEvent(target, position, data) { 47 | 48 | return getBpmnJS().invoke(function(eventBus) { 49 | data = assign({ 50 | target: target, 51 | x: position.x, 52 | y: position.y, 53 | clientX: position.x, 54 | clientY: position.y, 55 | offsetX: position.x, 56 | offsetY: position.y, 57 | button: 0 58 | }, data || {}); 59 | 60 | return eventBus.createEvent(data); 61 | }); 62 | } -------------------------------------------------------------------------------- /test/util/custom-rules/CustomRules.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import RuleProvider from 'diagram-js/lib/features/rules/RuleProvider'; 4 | 5 | 6 | export default function CustomRules(eventBus) { 7 | RuleProvider.call(this, eventBus); 8 | } 9 | 10 | CustomRules.$inject = [ 'eventBus' ]; 11 | 12 | inherits(CustomRules, RuleProvider); 13 | 14 | CustomRules.prototype.init = function() { 15 | 16 | // placeholder 17 | }; -------------------------------------------------------------------------------- /test/util/custom-rules/index.js: -------------------------------------------------------------------------------- 1 | import CustomRules from './CustomRules'; 2 | 3 | export default { 4 | __init__: [ 'customRules' ], 5 | customRules: [ 'type', CustomRules ] 6 | }; 7 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": [ 4 | "DOM", 5 | "ES2018" 6 | ], 7 | "strict": true 8 | }, 9 | "include": [ 10 | "./lib/**/*.d.ts", 11 | "./lib/**/*.spec.ts" 12 | ] 13 | } --------------------------------------------------------------------------------