bpmn-js 12.1.0 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/dist/bpmn-modeler.development.js +5172 -2047
  2. package/dist/bpmn-modeler.production.min.js +35 -35
  3. package/dist/bpmn-navigated-viewer.development.js +1547 -589
  4. package/dist/bpmn-navigated-viewer.production.min.js +5 -5
  5. package/dist/bpmn-viewer.development.js +1525 -584
  6. package/dist/bpmn-viewer.production.min.js +5 -5
  7. package/lib/BaseModeler.d.ts +12 -5
  8. package/lib/BaseModeler.js +4 -5
  9. package/lib/BaseViewer.d.ts +160 -366
  10. package/lib/BaseViewer.js +136 -57
  11. package/lib/Modeler.d.ts +76 -15
  12. package/lib/Modeler.js +6 -4
  13. package/lib/NavigatedViewer.d.ts +8 -3
  14. package/lib/Viewer.d.ts +44 -3
  15. package/lib/core/index.d.ts +10 -0
  16. package/lib/draw/BpmnRenderUtil.d.ts +76 -0
  17. package/lib/draw/BpmnRenderUtil.js +73 -21
  18. package/lib/draw/BpmnRenderer.d.ts +124 -0
  19. package/lib/draw/BpmnRenderer.js +51 -0
  20. package/lib/draw/PathMap.d.ts +330 -0
  21. package/lib/draw/PathMap.js +9 -2
  22. package/lib/draw/TextRenderer.d.ts +74 -0
  23. package/lib/draw/TextRenderer.js +32 -11
  24. package/lib/draw/index.d.ts +10 -0
  25. package/lib/features/align-elements/AlignElementsContextPadProvider.d.ts +32 -0
  26. package/lib/features/align-elements/AlignElementsContextPadProvider.js +28 -5
  27. package/lib/features/align-elements/AlignElementsIcons.d.ts +10 -0
  28. package/lib/features/align-elements/AlignElementsMenuProvider.d.ts +32 -0
  29. package/lib/features/align-elements/AlignElementsMenuProvider.js +38 -10
  30. package/lib/features/align-elements/BpmnAlignElements.d.ts +9 -0
  31. package/lib/features/align-elements/BpmnAlignElements.js +7 -1
  32. package/lib/features/align-elements/index.d.ts +11 -0
  33. package/lib/features/auto-place/BpmnAutoPlace.d.ts +13 -0
  34. package/lib/features/auto-place/BpmnAutoPlace.js +3 -0
  35. package/lib/features/auto-place/BpmnAutoPlaceUtil.d.ts +47 -0
  36. package/lib/features/auto-place/BpmnAutoPlaceUtil.js +39 -11
  37. package/lib/features/auto-place/index.d.ts +7 -0
  38. package/lib/features/auto-resize/BpmnAutoResize.d.ts +25 -0
  39. package/lib/features/auto-resize/BpmnAutoResize.js +15 -7
  40. package/lib/features/auto-resize/BpmnAutoResizeProvider.d.ts +26 -0
  41. package/lib/features/auto-resize/BpmnAutoResizeProvider.js +16 -4
  42. package/lib/features/auto-resize/index.d.ts +8 -0
  43. package/lib/features/context-pad/ContextPadProvider.d.ts +60 -0
  44. package/lib/features/context-pad/ContextPadProvider.js +64 -9
  45. package/lib/features/context-pad/index.d.ts +7 -0
  46. package/lib/features/copy-paste/BpmnCopyPaste.d.ts +17 -0
  47. package/lib/features/copy-paste/BpmnCopyPaste.js +15 -7
  48. package/lib/features/copy-paste/ModdleCopy.d.ts +45 -0
  49. package/lib/features/copy-paste/ModdleCopy.js +17 -45
  50. package/lib/features/copy-paste/index.d.ts +9 -0
  51. package/lib/features/di-ordering/BpmnDiOrdering.d.ts +11 -0
  52. package/lib/features/di-ordering/BpmnDiOrdering.js +8 -0
  53. package/lib/features/di-ordering/index.d.ts +6 -0
  54. package/lib/features/distribute-elements/BpmnDistributeElements.d.ts +10 -0
  55. package/lib/features/distribute-elements/BpmnDistributeElements.js +9 -4
  56. package/lib/features/distribute-elements/DistributeElementsIcons.d.ts +5 -0
  57. package/lib/features/distribute-elements/DistributeElementsMenuProvider.d.ts +32 -0
  58. package/lib/features/distribute-elements/DistributeElementsMenuProvider.js +27 -4
  59. package/lib/features/distribute-elements/index.d.ts +9 -0
  60. package/lib/features/drilldown/DrilldownBreadcrumbs.d.ts +19 -0
  61. package/lib/features/drilldown/DrilldownBreadcrumbs.js +34 -24
  62. package/lib/features/drilldown/DrilldownCentering.d.ts +17 -0
  63. package/lib/features/drilldown/DrilldownCentering.js +7 -2
  64. package/lib/features/drilldown/DrilldownOverlayBehavior.d.ts +18 -0
  65. package/lib/features/drilldown/DrilldownOverlayBehavior.js +70 -40
  66. package/lib/features/drilldown/SubprocessCompatibility.d.ts +21 -0
  67. package/lib/features/drilldown/SubprocessCompatibility.js +80 -30
  68. package/lib/features/drilldown/index.d.ts +13 -0
  69. package/lib/features/editor-actions/BpmnEditorActions.d.ts +13 -0
  70. package/lib/features/editor-actions/BpmnEditorActions.js +4 -0
  71. package/lib/features/editor-actions/index.d.ts +6 -0
  72. package/lib/features/grid-snapping/BpmnGridSnapping.d.ts +9 -0
  73. package/lib/features/grid-snapping/BpmnGridSnapping.js +7 -0
  74. package/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.d.ts +12 -0
  75. package/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.js +16 -1
  76. package/lib/features/grid-snapping/behavior/GridSnappingLayoutConnectionBehavior.d.ts +27 -0
  77. package/lib/features/grid-snapping/behavior/GridSnappingLayoutConnectionBehavior.js +20 -8
  78. package/lib/features/grid-snapping/behavior/GridSnappingParticipantBehavior.d.ts +13 -0
  79. package/lib/features/grid-snapping/behavior/GridSnappingParticipantBehavior.js +11 -1
  80. package/lib/features/grid-snapping/behavior/index.d.ts +10 -0
  81. package/lib/features/grid-snapping/index.d.ts +11 -0
  82. package/lib/features/interaction-events/BpmnInteractionEvents.d.ts +18 -0
  83. package/lib/features/interaction-events/BpmnInteractionEvents.js +34 -9
  84. package/lib/features/interaction-events/index.d.ts +6 -0
  85. package/lib/features/keyboard/BpmnKeyboardBindings.d.ts +15 -0
  86. package/lib/features/keyboard/BpmnKeyboardBindings.js +5 -0
  87. package/lib/features/keyboard/index.d.ts +7 -0
  88. package/lib/features/label-editing/LabelEditingPreview.d.ts +13 -0
  89. package/lib/features/label-editing/LabelEditingPreview.js +13 -6
  90. package/lib/features/label-editing/LabelEditingProvider.d.ts +62 -0
  91. package/lib/features/label-editing/LabelEditingProvider.js +48 -11
  92. package/lib/features/label-editing/LabelUtil.d.ts +14 -0
  93. package/lib/features/label-editing/LabelUtil.js +16 -1
  94. package/lib/features/label-editing/cmd/UpdateLabelHandler.d.ts +22 -0
  95. package/lib/features/label-editing/cmd/UpdateLabelHandler.js +14 -3
  96. package/lib/features/label-editing/index.d.ts +9 -0
  97. package/lib/features/modeling/BpmnFactory.d.ts +67 -0
  98. package/lib/features/modeling/BpmnFactory.js +57 -8
  99. package/lib/features/modeling/BpmnLayouter.d.ts +26 -0
  100. package/lib/features/modeling/BpmnLayouter.js +25 -2
  101. package/lib/features/modeling/BpmnUpdater.d.ts +92 -0
  102. package/lib/features/modeling/BpmnUpdater.js +90 -29
  103. package/lib/features/modeling/ElementFactory.d.ts +116 -0
  104. package/lib/features/modeling/ElementFactory.js +114 -17
  105. package/lib/features/modeling/ElementFactory.test.ts +133 -0
  106. package/lib/features/modeling/Modeling.d.ts +150 -0
  107. package/lib/features/modeling/Modeling.js +124 -19
  108. package/lib/features/modeling/Modeling.test.ts +148 -0
  109. package/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.d.ts +20 -0
  110. package/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.js +16 -6
  111. package/lib/features/modeling/behavior/AppendBehavior.d.ts +6 -0
  112. package/lib/features/modeling/behavior/AppendBehavior.js +6 -5
  113. package/lib/features/modeling/behavior/AssociationBehavior.d.ts +11 -0
  114. package/lib/features/modeling/behavior/AssociationBehavior.js +9 -1
  115. package/lib/features/modeling/behavior/AttachEventBehavior.d.ts +15 -0
  116. package/lib/features/modeling/behavior/AttachEventBehavior.js +11 -3
  117. package/lib/features/modeling/behavior/BoundaryEventBehavior.d.ts +15 -0
  118. package/lib/features/modeling/behavior/BoundaryEventBehavior.js +8 -1
  119. package/lib/features/modeling/behavior/CreateBehavior.d.ts +9 -0
  120. package/lib/features/modeling/behavior/CreateBehavior.js +6 -0
  121. package/lib/features/modeling/behavior/CreateDataObjectBehavior.d.ts +15 -0
  122. package/lib/features/modeling/behavior/CreateDataObjectBehavior.js +10 -4
  123. package/lib/features/modeling/behavior/CreateParticipantBehavior.d.ts +19 -0
  124. package/lib/features/modeling/behavior/CreateParticipantBehavior.js +10 -0
  125. package/lib/features/modeling/behavior/DataInputAssociationBehavior.d.ts +21 -0
  126. package/lib/features/modeling/behavior/DataInputAssociationBehavior.js +5 -0
  127. package/lib/features/modeling/behavior/DataStoreBehavior.d.ts +19 -0
  128. package/lib/features/modeling/behavior/DataStoreBehavior.js +12 -1
  129. package/lib/features/modeling/behavior/DeleteLaneBehavior.d.ts +15 -0
  130. package/lib/features/modeling/behavior/DeleteLaneBehavior.js +9 -3
  131. package/lib/features/modeling/behavior/DetachEventBehavior.d.ts +15 -0
  132. package/lib/features/modeling/behavior/DetachEventBehavior.js +11 -3
  133. package/lib/features/modeling/behavior/DropOnFlowBehavior.d.ts +13 -0
  134. package/lib/features/modeling/behavior/DropOnFlowBehavior.js +11 -1
  135. package/lib/features/modeling/behavior/EventBasedGatewayBehavior.d.ts +11 -0
  136. package/lib/features/modeling/behavior/EventBasedGatewayBehavior.js +9 -0
  137. package/lib/features/modeling/behavior/FixHoverBehavior.d.ts +17 -0
  138. package/lib/features/modeling/behavior/FixHoverBehavior.js +6 -0
  139. package/lib/features/modeling/behavior/GroupBehavior.d.ts +26 -0
  140. package/lib/features/modeling/behavior/GroupBehavior.js +35 -13
  141. package/lib/features/modeling/behavior/ImportDockingFix.d.ts +13 -0
  142. package/lib/features/modeling/behavior/ImportDockingFix.js +3 -0
  143. package/lib/features/modeling/behavior/IsHorizontalFix.d.ts +10 -0
  144. package/lib/features/modeling/behavior/IsHorizontalFix.js +4 -0
  145. package/lib/features/modeling/behavior/LabelBehavior.d.ts +56 -0
  146. package/lib/features/modeling/behavior/LabelBehavior.js +22 -10
  147. package/lib/features/modeling/behavior/LayoutConnectionBehavior.d.ts +16 -0
  148. package/lib/features/modeling/behavior/LayoutConnectionBehavior.js +6 -2
  149. package/lib/features/modeling/behavior/MessageFlowBehavior.d.ts +15 -0
  150. package/lib/features/modeling/behavior/MessageFlowBehavior.js +8 -0
  151. package/lib/features/modeling/behavior/ModelingFeedback.d.ts +13 -0
  152. package/lib/features/modeling/behavior/ModelingFeedback.js +11 -0
  153. package/lib/features/modeling/behavior/RemoveElementBehavior.d.ts +13 -0
  154. package/lib/features/modeling/behavior/RemoveElementBehavior.js +11 -1
  155. package/lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.d.ts +16 -0
  156. package/lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.js +8 -0
  157. package/lib/features/modeling/behavior/RemoveParticipantBehavior.d.ts +15 -0
  158. package/lib/features/modeling/behavior/RemoveParticipantBehavior.js +8 -1
  159. package/lib/features/modeling/behavior/ReplaceConnectionBehavior.d.ts +15 -0
  160. package/lib/features/modeling/behavior/ReplaceConnectionBehavior.js +13 -1
  161. package/lib/features/modeling/behavior/ReplaceElementBehaviour.d.ts +23 -0
  162. package/lib/features/modeling/behavior/ReplaceElementBehaviour.js +19 -4
  163. package/lib/features/modeling/behavior/ResizeBehavior.d.ts +57 -0
  164. package/lib/features/modeling/behavior/ResizeBehavior.js +35 -0
  165. package/lib/features/modeling/behavior/ResizeLaneBehavior.d.ts +16 -0
  166. package/lib/features/modeling/behavior/ResizeLaneBehavior.js +10 -3
  167. package/lib/features/modeling/behavior/RootElementReferenceBehavior.d.ts +25 -0
  168. package/lib/features/modeling/behavior/RootElementReferenceBehavior.js +19 -0
  169. package/lib/features/modeling/behavior/SpaceToolBehavior.d.ts +10 -0
  170. package/lib/features/modeling/behavior/SpaceToolBehavior.js +14 -4
  171. package/lib/features/modeling/behavior/SubProcessPlaneBehavior.d.ts +28 -0
  172. package/lib/features/modeling/behavior/SubProcessPlaneBehavior.js +45 -23
  173. package/lib/features/modeling/behavior/SubProcessStartEventBehavior.d.ts +15 -0
  174. package/lib/features/modeling/behavior/SubProcessStartEventBehavior.js +6 -0
  175. package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.d.ts +14 -0
  176. package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.js +14 -1
  177. package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.d.ts +13 -0
  178. package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +11 -3
  179. package/lib/features/modeling/behavior/UnclaimIdBehavior.d.ts +19 -0
  180. package/lib/features/modeling/behavior/UnclaimIdBehavior.js +7 -0
  181. package/lib/features/modeling/behavior/UnsetDefaultFlowBehavior.d.ts +16 -0
  182. package/lib/features/modeling/behavior/UnsetDefaultFlowBehavior.js +6 -3
  183. package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.d.ts +17 -0
  184. package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.js +13 -10
  185. package/lib/features/modeling/behavior/index.d.ts +2 -0
  186. package/lib/features/modeling/behavior/index.js +3 -0
  187. package/lib/features/modeling/behavior/util/CategoryUtil.d.ts +49 -0
  188. package/lib/features/modeling/behavior/util/CategoryUtil.js +10 -6
  189. package/lib/features/modeling/behavior/util/ConnectionLayoutUtil.d.ts +19 -0
  190. package/lib/features/modeling/behavior/util/ConnectionLayoutUtil.js +11 -5
  191. package/lib/features/modeling/behavior/util/GeometricUtil.d.ts +1 -0
  192. package/lib/features/modeling/behavior/util/LabelLayoutUtil.d.ts +32 -0
  193. package/lib/features/modeling/behavior/util/LabelLayoutUtil.js +27 -18
  194. package/lib/features/modeling/behavior/util/LayoutUtil.d.ts +48 -0
  195. package/lib/features/modeling/behavior/util/LayoutUtil.js +35 -6
  196. package/lib/features/modeling/behavior/util/LineAttachmentUtil.d.ts +37 -0
  197. package/lib/features/modeling/behavior/util/LineAttachmentUtil.js +17 -5
  198. package/lib/features/modeling/behavior/util/LineIntersect.d.ts +13 -0
  199. package/lib/features/modeling/behavior/util/LineIntersect.js +4 -0
  200. package/lib/features/modeling/behavior/util/ResizeUtil.d.ts +1 -0
  201. package/lib/features/modeling/cmd/AddLaneHandler.d.ts +22 -0
  202. package/lib/features/modeling/cmd/AddLaneHandler.js +8 -0
  203. package/lib/features/modeling/cmd/IdClaimHandler.d.ts +22 -0
  204. package/lib/features/modeling/cmd/IdClaimHandler.js +15 -0
  205. package/lib/features/modeling/cmd/ResizeLaneHandler.d.ts +39 -0
  206. package/lib/features/modeling/cmd/ResizeLaneHandler.js +17 -4
  207. package/lib/features/modeling/cmd/SetColorHandler.d.ts +18 -0
  208. package/lib/features/modeling/cmd/SetColorHandler.js +25 -12
  209. package/lib/features/modeling/cmd/SplitLaneHandler.d.ts +22 -0
  210. package/lib/features/modeling/cmd/SplitLaneHandler.js +9 -0
  211. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.d.ts +20 -0
  212. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +16 -1
  213. package/lib/features/modeling/cmd/UpdateFlowNodeRefsHandler.d.ts +21 -0
  214. package/lib/features/modeling/cmd/UpdateFlowNodeRefsHandler.js +29 -4
  215. package/lib/features/modeling/cmd/UpdateModdlePropertiesHandler.d.ts +20 -0
  216. package/lib/features/modeling/cmd/UpdateModdlePropertiesHandler.js +17 -3
  217. package/lib/features/modeling/cmd/UpdatePropertiesHandler.d.ts +60 -0
  218. package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +38 -14
  219. package/lib/features/modeling/cmd/UpdateSemanticParentHandler.d.ts +18 -0
  220. package/lib/features/modeling/cmd/UpdateSemanticParentHandler.js +15 -0
  221. package/lib/features/modeling/index.d.ts +27 -0
  222. package/lib/features/modeling/util/LaneUtil.d.ts +46 -0
  223. package/lib/features/modeling/util/LaneUtil.js +22 -13
  224. package/lib/features/modeling/util/ModelingUtil.d.ts +12 -0
  225. package/lib/features/modeling/util/ModelingUtil.js +10 -4
  226. package/lib/features/ordering/BpmnOrderingProvider.d.ts +21 -0
  227. package/lib/features/ordering/BpmnOrderingProvider.js +9 -3
  228. package/lib/features/ordering/index.d.ts +7 -0
  229. package/lib/features/palette/PaletteProvider.d.ts +34 -0
  230. package/lib/features/palette/PaletteProvider.js +26 -2
  231. package/lib/features/palette/index.d.ts +9 -0
  232. package/lib/features/popup-menu/ReplaceMenuProvider.d.ts +50 -0
  233. package/lib/features/popup-menu/ReplaceMenuProvider.js +226 -202
  234. package/lib/features/popup-menu/index.d.ts +11 -0
  235. package/lib/features/popup-menu/util/TypeUtil.d.ts +12 -0
  236. package/lib/features/popup-menu/util/TypeUtil.js +4 -1
  237. package/lib/features/replace/BpmnReplace.d.ts +47 -0
  238. package/lib/features/replace/BpmnReplace.js +81 -29
  239. package/lib/features/replace/ReplaceOptions.d.ts +70 -0
  240. package/lib/features/replace/ReplaceOptions.js +58 -0
  241. package/lib/features/replace/index.d.ts +9 -0
  242. package/lib/features/replace-preview/BpmnReplacePreview.d.ts +17 -0
  243. package/lib/features/replace-preview/BpmnReplacePreview.js +15 -1
  244. package/lib/features/replace-preview/index.d.ts +7 -0
  245. package/lib/features/rules/BpmnRules.d.ts +171 -0
  246. package/lib/features/rules/BpmnRules.js +295 -46
  247. package/lib/features/rules/index.d.ts +7 -0
  248. package/lib/features/search/BpmnSearchProvider.d.ts +29 -0
  249. package/lib/features/search/BpmnSearchProvider.js +30 -22
  250. package/lib/features/search/index.d.ts +7 -0
  251. package/lib/features/snapping/BpmnConnectSnapping.d.ts +17 -0
  252. package/lib/features/snapping/BpmnConnectSnapping.js +51 -3
  253. package/lib/features/snapping/BpmnCreateMoveSnapping.d.ts +41 -0
  254. package/lib/features/snapping/BpmnCreateMoveSnapping.js +47 -1
  255. package/lib/features/snapping/BpmnSnappingUtil.d.ts +11 -0
  256. package/lib/features/snapping/BpmnSnappingUtil.js +12 -0
  257. package/lib/features/snapping/index.d.ts +9 -0
  258. package/lib/features/space-tool/BpmnSpaceTool.d.ts +21 -0
  259. package/lib/features/space-tool/BpmnSpaceTool.js +20 -1
  260. package/lib/features/space-tool/index.d.ts +6 -0
  261. package/lib/import/BpmnImporter.d.ts +49 -0
  262. package/lib/import/BpmnImporter.js +37 -10
  263. package/lib/import/BpmnTreeWalker.d.ts +22 -0
  264. package/lib/import/BpmnTreeWalker.js +25 -22
  265. package/lib/import/Importer.d.ts +25 -0
  266. package/lib/import/Importer.js +15 -21
  267. package/lib/import/Util.d.ts +1 -0
  268. package/lib/import/index.d.ts +6 -0
  269. package/lib/model/Types.d.ts +24 -0
  270. package/lib/model/Types.ts +40 -0
  271. package/lib/util/CompatibilityUtil.d.ts +22 -0
  272. package/lib/util/CompatibilityUtil.js +13 -0
  273. package/lib/util/DiUtil.d.ts +53 -0
  274. package/lib/util/DiUtil.js +47 -13
  275. package/lib/util/DrilldownUtil.d.ts +39 -0
  276. package/lib/util/DrilldownUtil.js +12 -8
  277. package/lib/util/LabelUtil.d.ts +73 -0
  278. package/lib/util/LabelUtil.js +40 -16
  279. package/lib/util/ModelUtil.d.ts +40 -0
  280. package/lib/util/ModelUtil.js +9 -5
  281. package/lib/util/PoweredByUtil.d.ts +8 -0
  282. package/lib/util/Types.js +5 -0
  283. package/lib/util/Types.ts +4 -0
  284. package/package.json +10 -5
  285. package/test/matchers/ConnectionMatchers.js +1 -1
  286. package/lib/icons/dist/append.svg +0 -1
  287. package/lib/icons/dist/connect-context-pad.svg +0 -1
  288. package/lib/icons/dist/connect-palette.svg +0 -1
  289. package/lib/icons/dist/create.svg +0 -1
@@ -12,12 +12,17 @@ import {
12
12
  ensureCompatDiRef
13
13
  } from '../util/CompatibilityUtil';
14
14
 
15
+ /**
16
+ * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
17
+ *
18
+ * @typedef {import('../model/Types').ModdleElement} ModdleElement
19
+ */
15
20
 
16
21
  /**
17
- * Returns true if an element has the given meta-model type
22
+ * Returns true if an element is of the given meta-model type.
18
23
  *
19
- * @param {ModdleElement} element
20
- * @param {string} type
24
+ * @param {ModdleElement} element
25
+ * @param {string} type
21
26
  *
22
27
  * @return {boolean}
23
28
  */
@@ -29,6 +34,10 @@ function is(element, type) {
29
34
  /**
30
35
  * Find a suitable display candidate for definitions where the DI does not
31
36
  * correctly specify one.
37
+ *
38
+ * @param {ModdleElement}
39
+ *
40
+ * @return {ModdleElement}
32
41
  */
33
42
  function findDisplayCandidate(definitions) {
34
43
  return find(definitions.rootElements, function(e) {
@@ -36,7 +45,10 @@ function findDisplayCandidate(definitions) {
36
45
  });
37
46
  }
38
47
 
39
-
48
+ /**
49
+ * @param {Function} handler
50
+ * @param {Translate} translate
51
+ */
40
52
  export default function BpmnTreeWalker(handler, translate) {
41
53
 
42
54
  // list of containers already walked
@@ -105,7 +117,7 @@ export default function BpmnTreeWalker(handler, translate) {
105
117
 
106
118
  // DI handling //////////////////////
107
119
 
108
- function registerDi(di) {
120
+ var registerDi = this.registerDi = function registerDi(di) {
109
121
  var bpmnElement = di.bpmnElement;
110
122
 
111
123
  if (bpmnElement) {
@@ -129,7 +141,7 @@ export default function BpmnTreeWalker(handler, translate) {
129
141
  { element: di }
130
142
  );
131
143
  }
132
- }
144
+ };
133
145
 
134
146
  function handleDiagram(diagram) {
135
147
  handlePlane(diagram.plane);
@@ -149,14 +161,14 @@ export default function BpmnTreeWalker(handler, translate) {
149
161
  // Semantic handling //////////////////////
150
162
 
151
163
  /**
152
- * Handle definitions and return the rendered diagram (if any)
164
+ * Handle definitions and return the rendered diagram (if any).
153
165
  *
154
166
  * @param {ModdleElement} definitions to walk and import
155
167
  * @param {ModdleElement} [diagram] specific diagram to import and display
156
168
  *
157
169
  * @throws {Error} if no diagram to display could be found
158
170
  */
159
- function handleDefinitions(definitions, diagram) {
171
+ this.handleDefinitions = function handleDefinitions(definitions, diagram) {
160
172
 
161
173
  // make sure we walk the correct bpmnElement
162
174
 
@@ -234,9 +246,9 @@ export default function BpmnTreeWalker(handler, translate) {
234
246
 
235
247
  // handle all deferred elements
236
248
  handleDeferred(deferred);
237
- }
249
+ };
238
250
 
239
- function handleDeferred() {
251
+ var handleDeferred = this.handleDeferred = function handleDeferred() {
240
252
 
241
253
  var fn;
242
254
 
@@ -246,7 +258,7 @@ export default function BpmnTreeWalker(handler, translate) {
246
258
 
247
259
  fn();
248
260
  }
249
- }
261
+ };
250
262
 
251
263
  function handleProcess(process, context) {
252
264
  handleFlowElementsContainer(process, context);
@@ -322,10 +334,10 @@ export default function BpmnTreeWalker(handler, translate) {
322
334
  forEach(ioSpecification.dataOutputs, contextual(handleDataOutput, context));
323
335
  }
324
336
 
325
- function handleSubProcess(subProcess, context) {
337
+ var handleSubProcess = this.handleSubProcess = function handleSubProcess(subProcess, context) {
326
338
  handleFlowElementsContainer(subProcess, context);
327
339
  handleArtifacts(subProcess.artifacts, context);
328
- }
340
+ };
329
341
 
330
342
  function handleFlowNode(flowNode, context) {
331
343
  var childCtx = visitIfDi(flowNode, context);
@@ -453,13 +465,4 @@ export default function BpmnTreeWalker(handler, translate) {
453
465
  }
454
466
  });
455
467
  }
456
-
457
- // API //////////////////////
458
-
459
- return {
460
- handleDeferred: handleDeferred,
461
- handleDefinitions: handleDefinitions,
462
- handleSubProcess: handleSubProcess,
463
- registerDi: registerDi
464
- };
465
468
  }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Import the definitions into a diagram.
3
+ *
4
+ * Errors and warnings are reported through the specified callback.
5
+ *
6
+ * @param diagram
7
+ * @param definitions
8
+ * @param bpmnDiagram The diagram to be rendered (if not
9
+ * provided, the first one will be rendered).
10
+ *
11
+ * @return
12
+ */
13
+ export function importBpmnDiagram(
14
+ diagram: ModdleElement,
15
+ definitions: ModdleElement,
16
+ bpmnDiagram?: ModdleElement
17
+ ): Promise<ImportBPMNDiagramResult>;
18
+
19
+ type ModdleElement = import('../model/Types').ModdleElement;
20
+
21
+ export type ImportBPMNDiagramResult = {
22
+ warnings: string[];
23
+ };
24
+
25
+ export type ImportBPMNDiagramError = ImportBPMNDiagramResult & Error;
@@ -10,32 +10,26 @@ import { is } from '../util/ModelUtil';
10
10
 
11
11
 
12
12
  /**
13
- * The importBpmnDiagram result.
13
+ * @typedef {import('../model/Types').ModdleElement} ModdleElement
14
14
  *
15
- * @typedef {Object} ImportBPMNDiagramResult
15
+ * @typedef { {
16
+ * warnings: string[];
17
+ * } } ImportBPMNDiagramResult
16
18
  *
17
- * @property {Array<string>} warnings
19
+ * @typedef {ImportBPMNDiagramResult & Error} ImportBPMNDiagramError
18
20
  */
19
21
 
20
- /**
21
- * The importBpmnDiagram error.
22
- *
23
- * @typedef {Error} ImportBPMNDiagramError
24
- *
25
- * @property {Array<string>} warnings
26
- */
27
-
28
22
  /**
29
23
  * Import the definitions into a diagram.
30
24
  *
31
25
  * Errors and warnings are reported through the specified callback.
32
26
  *
33
- * @param {djs.Diagram} diagram
34
- * @param {ModdleElement<Definitions>} definitions
35
- * @param {ModdleElement<BPMNDiagram>} [bpmnDiagram] the diagram to be rendered
36
- * (if not provided, the first one will be rendered)
27
+ * @param {ModdleElement} diagram
28
+ * @param {ModdleElement} definitions
29
+ * @param {ModdleElement} [bpmnDiagram] The diagram to be rendered (if not
30
+ * provided, the first one will be rendered).
37
31
  *
38
- * Returns {Promise<ImportBPMNDiagramResult, ImportBPMNDiagramError>}
32
+ * @return {Promise<ImportBPMNDiagramResult>}
39
33
  */
40
34
  export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
41
35
 
@@ -51,8 +45,8 @@ export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
51
45
  * Walk the diagram semantically, importing (=drawing)
52
46
  * all elements you encounter.
53
47
  *
54
- * @param {ModdleElement<Definitions>} definitions
55
- * @param {ModdleElement<BPMNDiagram>} bpmnDiagram
48
+ * @param {ModdleElement} definitions
49
+ * @param {ModdleElement} bpmnDiagram
56
50
  */
57
51
  function render(definitions, bpmnDiagram) {
58
52
 
@@ -127,10 +121,10 @@ export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
127
121
  * Returns all diagrams in the same hierarchy as the requested diagram.
128
122
  * Includes all parent and sub process diagrams.
129
123
  *
130
- * @param {Array} definitions
131
- * @param {Object} bpmnDiagram
124
+ * @param {ModdleElement} definitions
125
+ * @param {ModdleElement} bpmnDiagram
132
126
  *
133
- * @returns {Array<Object>}
127
+ * @return {ModdleElement[]}
134
128
  */
135
129
  function getDiagramsToImport(definitions, bpmnDiagram) {
136
130
  if (!bpmnDiagram) {
@@ -0,0 +1 @@
1
+ export function elementToString(e: any): string;
@@ -0,0 +1,6 @@
1
+ declare namespace _default {
2
+ const __depends__: import("didi").ModuleDeclaration[];
3
+ const bpmnImporter: (string | typeof BpmnImporter)[];
4
+ }
5
+ export default _default;
6
+ import BpmnImporter from './BpmnImporter';
@@ -0,0 +1,24 @@
1
+ import { Connection as BaseConnection, Element as BaseElement, Label as BaseLabel, Root as BaseRoot, Shape as BaseShape } from "diagram-js/lib/model";
2
+ export type Moddle = any;
3
+ export type ModdleElement = any;
4
+ export type ModdleExtension = {};
5
+ export type BpmnAttributes = {
6
+ associationDirection: 'None' | 'One' | 'Both';
7
+ cancelActivity: boolean;
8
+ eventDefinitionType: string;
9
+ isExpanded: boolean;
10
+ isForCompensation: boolean;
11
+ isInterrupting: boolean;
12
+ processRef: ModdleElement;
13
+ triggeredByEvent: boolean;
14
+ };
15
+ export type Element = {
16
+ businessObject: any;
17
+ di: any;
18
+ type: string;
19
+ } & BaseElement;
20
+ export type Connection = BaseConnection & Element;
21
+ export type Label = BaseLabel & Element;
22
+ export type Root = BaseRoot & Element;
23
+ export type Shape = BaseShape & Element;
24
+ export type Parent = Root | Shape;
@@ -0,0 +1,40 @@
1
+ import {
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
+ isForCompensation: boolean;
21
+ isInterrupting: boolean;
22
+ processRef: ModdleElement;
23
+ triggeredByEvent: boolean;
24
+ };
25
+
26
+ export type Element = {
27
+ businessObject: any;
28
+ di: any;
29
+ type: string;
30
+ } & BaseElement;
31
+
32
+ export type Connection = BaseConnection & Element;
33
+
34
+ export type Label = BaseLabel & Element;
35
+
36
+ export type Root = BaseRoot & Element;
37
+
38
+ export type Shape = BaseShape & Element;
39
+
40
+ export type Parent = Root | Shape;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Wraps APIs to check:
3
+ *
4
+ * 1) If a callback is passed -> Warn users about callback deprecation.
5
+ * 2) If Promise class is implemented in current environment.
6
+ *
7
+ * @private
8
+ *
9
+ * @param api
10
+ *
11
+ * @return
12
+ */
13
+ export function wrapForCompatibility(api: Function): Function;
14
+
15
+ /**
16
+ * @private
17
+ *
18
+ * @param businessObject
19
+ */
20
+ export function ensureCompatDiRef(businessObject: ModdleElement): void;
21
+
22
+ type ModdleElement = import('../model/Types').ModdleElement;
@@ -3,6 +3,10 @@ import {
3
3
  isFunction
4
4
  } from 'min-dash';
5
5
 
6
+ /**
7
+ * @typedef {import('../model/Types').ModdleElement} ModdleElement
8
+ */
9
+
6
10
  // TODO(nikku): remove with future bpmn-js version
7
11
 
8
12
  /**
@@ -12,6 +16,10 @@ import {
12
16
  * 2) If Promise class is implemented in current environment.
13
17
  *
14
18
  * @private
19
+ *
20
+ * @param {Function} api
21
+ *
22
+ * @return {Function}
15
23
  */
16
24
  export function wrapForCompatibility(api) {
17
25
 
@@ -60,6 +68,11 @@ export function wrapForCompatibility(api) {
60
68
 
61
69
  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';
62
70
 
71
+ /**
72
+ * @private
73
+ *
74
+ * @param {ModdleElement} businessObject
75
+ */
63
76
  export function ensureCompatDiRef(businessObject) {
64
77
 
65
78
  // bpmnElement can have multiple independent DIs
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @param element
3
+ * @param di
4
+ *
5
+ * @return
6
+ */
7
+ export function isExpanded(element: Element, di: ModdleElement): boolean;
8
+
9
+ /**
10
+ * @param element
11
+ *
12
+ * @return
13
+ */
14
+ export function isInterrupting(element: Element): boolean;
15
+
16
+ /**
17
+ * @param element
18
+ *
19
+ * @return
20
+ */
21
+ export function isEventSubProcess(element: Element): boolean;
22
+
23
+ /**
24
+ * @param element
25
+ * @param eventType
26
+ *
27
+ * @return
28
+ */
29
+ export function hasEventDefinition(element: Element, eventType: string): boolean;
30
+
31
+ /**
32
+ * @param element
33
+ *
34
+ * @return
35
+ */
36
+ export function hasErrorEventDefinition(element: Element): boolean;
37
+
38
+ /**
39
+ * @param element
40
+ *
41
+ * @return
42
+ */
43
+ export function hasEscalationEventDefinition(element: Element): boolean;
44
+
45
+ /**
46
+ * @param element
47
+ *
48
+ * @return
49
+ */
50
+ export function hasCompensateEventDefinition(element: Element): boolean;
51
+
52
+ type Element = import('../model/Types').Element;
53
+ type ModdleElement = import('../model/Types').ModdleElement;
@@ -5,10 +5,20 @@ import {
5
5
  } from './ModelUtil';
6
6
 
7
7
  import {
8
- forEach
8
+ some
9
9
  } from 'min-dash';
10
10
 
11
-
11
+ /**
12
+ * @typedef {import('../model/Types').Element} Element
13
+ * @typedef {import('../model/Types').ModdleElement} ModdleElement
14
+ */
15
+
16
+ /**
17
+ * @param {Element} element
18
+ * @param {ModdleElement} di
19
+ *
20
+ * @return {boolean}
21
+ */
12
22
  export function isExpanded(element, di) {
13
23
 
14
24
  if (is(element, 'bpmn:CallActivity')) {
@@ -32,37 +42,61 @@ export function isExpanded(element, di) {
32
42
  return true;
33
43
  }
34
44
 
45
+ /**
46
+ * @param {Element} element
47
+ *
48
+ * @return {boolean}
49
+ */
35
50
  export function isInterrupting(element) {
36
51
  return element && getBusinessObject(element).isInterrupting !== false;
37
52
  }
38
53
 
54
+ /**
55
+ * @param {Element} element
56
+ *
57
+ * @return {boolean}
58
+ */
39
59
  export function isEventSubProcess(element) {
40
60
  return element && !!getBusinessObject(element).triggeredByEvent;
41
61
  }
42
62
 
63
+ /**
64
+ * @param {Element} element
65
+ * @param {string} eventType
66
+ *
67
+ * @return {boolean}
68
+ */
43
69
  export function hasEventDefinition(element, eventType) {
44
- var bo = getBusinessObject(element),
45
- hasEventDefinition = false;
46
-
47
- if (bo.eventDefinitions) {
48
- forEach(bo.eventDefinitions, function(event) {
49
- if (is(event, eventType)) {
50
- hasEventDefinition = true;
51
- }
52
- });
53
- }
70
+ var eventDefinitions = getBusinessObject(element).eventDefinitions;
54
71
 
55
- return hasEventDefinition;
72
+ return some(eventDefinitions, function(event) {
73
+ return is(event, eventType);
74
+ });
56
75
  }
57
76
 
77
+ /**
78
+ * @param {Element} element
79
+ *
80
+ * @return {boolean}
81
+ */
58
82
  export function hasErrorEventDefinition(element) {
59
83
  return hasEventDefinition(element, 'bpmn:ErrorEventDefinition');
60
84
  }
61
85
 
86
+ /**
87
+ * @param {Element} element
88
+ *
89
+ * @return {boolean}
90
+ */
62
91
  export function hasEscalationEventDefinition(element) {
63
92
  return hasEventDefinition(element, 'bpmn:EscalationEventDefinition');
64
93
  }
65
94
 
95
+ /**
96
+ * @param {Element} element
97
+ *
98
+ * @return {boolean}
99
+ */
66
100
  export function hasCompensateEventDefinition(element) {
67
101
  return hasEventDefinition(element, 'bpmn:CompensateEventDefinition');
68
102
  }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Get primary shape ID for a plane.
3
+ *
4
+ * @param element
5
+ *
6
+ * @return
7
+ */
8
+ export function getShapeIdFromPlane(element: Element | ModdleElement): string;
9
+
10
+ /**
11
+ * Get plane ID for a primary shape.
12
+ *
13
+ * @param element
14
+ *
15
+ * @return
16
+ */
17
+ export function getPlaneIdFromShape(element: Element | ModdleElement): string;
18
+
19
+ /**
20
+ * Get plane ID for primary shape ID.
21
+ *
22
+ * @param id
23
+ *
24
+ * @return
25
+ */
26
+ export function toPlaneId(id: string): string;
27
+
28
+ /**
29
+ * Check wether element is plane.
30
+ *
31
+ * @param element
32
+ *
33
+ * @return
34
+ */
35
+ export function isPlane(element: Element | ModdleElement): boolean;
36
+
37
+ export const planeSuffix: string;
38
+ type Element = import('../model/Types').Element;
39
+ type ModdleElement = import('../model/Types').ModdleElement;
@@ -1,14 +1,18 @@
1
1
  import { getDi, is } from './ModelUtil';
2
2
 
3
+ /**
4
+ * @typedef {import('../model/Types').Element} Element
5
+ * @typedef {import('../model/Types').ModdleElement} ModdleElement
6
+ */
3
7
 
4
8
  export var planeSuffix = '_plane';
5
9
 
6
10
  /**
7
11
  * Get primary shape ID for a plane.
8
12
  *
9
- * @param {djs.model.Base|ModdleElement} element
13
+ * @param {Element|ModdleElement} element
10
14
  *
11
- * @returns {String}
15
+ * @return {string}
12
16
  */
13
17
  export function getShapeIdFromPlane(element) {
14
18
  var id = element.id;
@@ -19,9 +23,9 @@ export function getShapeIdFromPlane(element) {
19
23
  /**
20
24
  * Get plane ID for a primary shape.
21
25
  *
22
- * @param {djs.model.Base|ModdleElement} element
26
+ * @param {Element|ModdleElement} element
23
27
  *
24
- * @returns {String}
28
+ * @return {string}
25
29
  */
26
30
  export function getPlaneIdFromShape(element) {
27
31
  var id = element.id;
@@ -36,9 +40,9 @@ export function getPlaneIdFromShape(element) {
36
40
  /**
37
41
  * Get plane ID for primary shape ID.
38
42
  *
39
- * @param {String} id
43
+ * @param {string} id
40
44
  *
41
- * @returns {String}
45
+ * @return {string}
42
46
  */
43
47
  export function toPlaneId(id) {
44
48
  return addPlaneSuffix(id);
@@ -47,9 +51,9 @@ export function toPlaneId(id) {
47
51
  /**
48
52
  * Check wether element is plane.
49
53
  *
50
- * @param {djs.model.Base|ModdleElement} element
54
+ * @param {Element|ModdleElement} element
51
55
  *
52
- * @returns {Boolean}
56
+ * @return {boolean}
53
57
  */
54
58
  export function isPlane(element) {
55
59
  var di = getDi(element);
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Return true if the given semantic has an external label.
3
+ *
4
+ * @param semantic
5
+ *
6
+ * @return
7
+ */
8
+ export function isLabelExternal(semantic: Element): boolean;
9
+
10
+ /**
11
+ * Return true if the given element has an external label.
12
+ *
13
+ * @param element
14
+ *
15
+ * @return
16
+ */
17
+ export function hasExternalLabel(element: Element): boolean;
18
+
19
+ /**
20
+ * Get the position of a sequence flow label.
21
+ *
22
+ * @param waypoints
23
+ *
24
+ * @return
25
+ */
26
+ export function getFlowLabelPosition(waypoints: Point[]): Point;
27
+
28
+ /**
29
+ * Get the middle of a number of waypoints.
30
+ *
31
+ * @param waypoints
32
+ *
33
+ * @return
34
+ */
35
+ export function getWaypointsMid(waypoints: Point[]): Point;
36
+
37
+ /**
38
+ * Get the middle of the external label of an element.
39
+ *
40
+ * @param element
41
+ *
42
+ * @return
43
+ */
44
+ export function getExternalLabelMid(element: Element): Point;
45
+
46
+ /**
47
+ * Return the bounds of an elements label, parsed from the elements DI or
48
+ * generated from its bounds.
49
+ *
50
+ * @param di
51
+ * @param element
52
+ *
53
+ * @return
54
+ */
55
+ export function getExternalLabelBounds(di: ModdleElement, element: Element): Rect;
56
+
57
+ /**
58
+ * @param element
59
+ *
60
+ * @return
61
+ */
62
+ export function isLabel(element: Element): boolean;
63
+
64
+ export namespace DEFAULT_LABEL_SIZE {
65
+ const width: number;
66
+ const height: number;
67
+ }
68
+
69
+ export const FLOW_LABEL_INDENT: number;
70
+ type Point = import('diagram-js/lib/util/Types').Point;
71
+ type Rect = import('diagram-js/lib/util/Types').Rect;
72
+ type Element = import('../model/Types').Element;
73
+ type ModdleElement = import('../model/Types').ModdleElement;