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
@@ -1,5 +1,12 @@
1
- import BaseViewer from "./BaseViewer";
2
-
3
- export type Moddle = Object;
4
-
5
- export default class BaseModeler extends BaseViewer {}
1
+ /**
2
+ * A base modeler for BPMN 2.0 diagrams.
3
+ *
4
+ * See {@link Modeler} for a fully-featured modeler.
5
+ *
6
+ */
7
+ export default class BaseModeler extends BaseViewer {}
8
+
9
+ type BaseViewerOptions = import('./BaseViewer').BaseViewerOptions;
10
+ type ModdleElementsById = import('./BaseViewer').ModdleElementsById;
11
+ type ModdleElement = import('./model/Types').ModdleElement;
12
+ import BaseViewer from './BaseViewer';
@@ -6,11 +6,10 @@ import BaseViewer from './BaseViewer';
6
6
 
7
7
 
8
8
  /**
9
- * @typedef {import('./BaseViewer').BaseModelerOptions} BaseModelerOptions
10
- * @typedef {import('./BaseViewer').ModdleElement} ModdleElement
9
+ * @typedef {import('./BaseViewer').BaseViewerOptions} BaseViewerOptions
11
10
  * @typedef {import('./BaseViewer').ModdleElementsById} ModdleElementsById
12
11
  *
13
- * @typedef {import('.').Moddle} Moddle
12
+ * @typedef {import('./model/Types').ModdleElement} ModdleElement
14
13
  */
15
14
 
16
15
  /**
@@ -18,7 +17,7 @@ import BaseViewer from './BaseViewer';
18
17
  *
19
18
  * See {@link Modeler} for a fully-featured modeler.
20
19
  *
21
- * @param {BaseModelerOptions} [options] The options to configure the modeler.
20
+ * @param {BaseViewerOptions} [options] The options to configure the modeler.
22
21
  */
23
22
  export default function BaseModeler(options) {
24
23
  BaseViewer.call(this, options);
@@ -41,7 +40,7 @@ inherits(BaseModeler, BaseViewer);
41
40
  /**
42
41
  * Create a moddle instance, attaching IDs to it.
43
42
  *
44
- * @param {BaseModelerOptions} options
43
+ * @param {BaseViewerOptions} options
45
44
  *
46
45
  * @return {Moddle}
47
46
  */
@@ -1,366 +1,160 @@
1
- import { ModuleDeclaration } from "didi";
2
-
3
- import Diagram from 'diagram-js/lib/Diagram';
4
-
5
- import {
6
- Event,
7
- EventCallback
8
- } from 'diagram-js/lib/core/EventBus';
9
-
10
- export type ModdleExtension = Object;
11
-
12
- export type ModdleExtensions = {
13
- [key: string]: ModdleExtension;
14
- };
15
-
16
- export type BaseViewerOptions = {
17
- width?: number|string;
18
- height?: number|string;
19
- position?: string;
20
- container?: string|HTMLElement;
21
- moddleExtensions?: ModdleExtensions;
22
- additionalModules?: ModuleDeclaration[];
23
- } & Record<string, any>;
24
-
25
- export type ModdleElement = Object;
26
-
27
- export type ModdleElementsById = {
28
- [id: string]: ModdleElement;
29
- };
30
-
31
- export type ImportXMLResult = {
32
-
33
- /**
34
- * The warnings produced when parsing the XML.
35
- */
36
- warnings: string[];
37
- };
38
-
39
- export type ImportXMLError = ImportXMLResult & Error;
40
-
41
- export type ImportDefinitionsResult = ImportXMLResult;
42
-
43
- export type ImportDefinitionsError = ImportXMLError;
44
-
45
- export type OpenResult = ImportXMLResult;
46
-
47
- export type OpenError = ImportXMLError;
48
-
49
- export type SaveXMLOptions = {
50
-
51
- /**
52
- * Whether to format the XML. Defaults to `false`.
53
- */
54
- format?: boolean;
55
-
56
- /**
57
- * Whether to include the preamble. Defaults to `true`.
58
- */
59
- preamble?: boolean;
60
- };
61
-
62
- export type SaveXMLResult = {
63
-
64
- /**
65
- * The saved XML.
66
- */
67
- xml?: string;
68
-
69
- /**
70
- * An error thrown when saving the XML.
71
- */
72
- error?: Error;
73
- };
74
-
75
- export type SaveSVGResult = {
76
- svg: string;
77
- };
78
-
79
- declare namespace Events {
80
-
81
- /**
82
- * A `import.parse.start` event.
83
- */
84
- export type ImportParseStart = {
85
-
86
- /**
87
- * The XML that is to be parsed.
88
- */
89
- xml: string;
90
- } & Event;
91
-
92
- /**
93
- * A `import.parse.complete` event.
94
- */
95
- export type ImportParseComplete = {
96
-
97
- /**
98
- * An error thrown when parsing the XML.
99
- */
100
- error?: ImportXMLError;
101
-
102
- /**
103
- * The definitions model element.
104
- */
105
- definitions?: ModdleElement;
106
-
107
- /**
108
- * The model elements by ID.
109
- */
110
- elementsById?: ModdleElementsById;
111
-
112
- /**
113
- * The referenced model elements.
114
- */
115
- references?: ModdleElement[];
116
-
117
- /**
118
- * The warnings produced when parsing the XML.
119
- */
120
- warnings: string[];
121
- } & Event;
122
-
123
- /**
124
- * A `import.done` event.
125
- */
126
- export type ImportDone = {
127
-
128
- /**
129
- * An error thrown when parsing the XML.
130
- */
131
- error?: ImportXMLError;
132
-
133
- /**
134
- * The warnings produced when parsing the XML.
135
- */
136
- warnings: string[];
137
- } & Event;
138
-
139
- /**
140
- * A `saveXML.start` event.
141
- */
142
- export type SaveXMLStart = {
143
-
144
- /**
145
- * The definitions model element.
146
- */
147
- definitions: ModdleElement;
148
- } & Event;
149
-
150
- /**
151
- * A `saveXML.done` event.
152
- */
153
- export type SaveXMLDone = SaveXMLResult & Event;
154
-
155
- /**
156
- * A `saveSVG.done` event.
157
- */
158
- export type SaveSVGDone = {
159
-
160
- /**
161
- * An error thrown when saving the SVG.
162
- */
163
- error?: Error;
164
-
165
- /**
166
- * The saved SVG.
167
- */
168
- svg: string;
169
- } & Event;
170
- }
171
-
172
- export default class BaseViewer extends Diagram {
173
-
174
- /**
175
- * The constructor.
176
- *
177
- * @param options The options to configure the viewer.
178
- */
179
- constructor(options?: BaseViewerOptions);
180
-
181
- /**
182
- * Parse and render a BPMN 2.0 diagram.
183
- *
184
- * Once finished the viewer reports back the result to the
185
- * provided callback function with (err, warnings).
186
- *
187
- * ## Life-Cycle Events
188
- *
189
- * During import the viewer will fire life-cycle events:
190
- *
191
- * * import.parse.start (about to read model from XML)
192
- * * import.parse.complete (model read; may have worked or not)
193
- * * import.render.start (graphical import start)
194
- * * import.render.complete (graphical import finished)
195
- * * import.done (everything done)
196
- *
197
- * You can use these events to hook into the life-cycle.
198
- *
199
- * @throws An error thrown during the import of the XML.
200
- *
201
- * @param xml The BPMN 2.0 XML to be imported.
202
- * @param bpmnDiagram The optional diagram or Id of the BPMN diagram to open.
203
- *
204
- * @return A promise resolving with warnings that were produced during the import.
205
- */
206
- importXML(xml: string, bpmnDiagram?: ModdleElement | string): Promise<ImportXMLResult>;
207
-
208
- /**
209
- * Import parsed definitions and render a BPMN 2.0 diagram.
210
- *
211
- * Once finished the viewer reports back the result to the
212
- * provided callback function with (err, warnings).
213
- *
214
- * ## Life-Cycle Events
215
- *
216
- * During import the viewer will fire life-cycle events:
217
- *
218
- * * import.render.start (graphical import start)
219
- * * import.render.complete (graphical import finished)
220
- *
221
- * You can use these events to hook into the life-cycle.
222
- *
223
- * @throws An error thrown during the import of the definitions.
224
- *
225
- * @param definitions The definitions.
226
- * @param bpmnDiagram The optional diagram or ID of the BPMN diagram to open.
227
- *
228
- * @return A promise resolving with warnings that were produced during the import.
229
- */
230
- importDefinitions(definitions: ModdleElement, bpmnDiagram?: ModdleElement | string): Promise<ImportDefinitionsResult>;
231
-
232
- /**
233
- * Open diagram of previously imported XML.
234
- *
235
- * Once finished the viewer reports back the result to the
236
- * provided callback function with (err, warnings).
237
- *
238
- * ## Life-Cycle Events
239
- *
240
- * During switch the viewer will fire life-cycle events:
241
- *
242
- * * import.render.start (graphical import start)
243
- * * import.render.complete (graphical import finished)
244
- *
245
- * You can use these events to hook into the life-cycle.
246
- *
247
- * @throws An error thrown during opening.
248
- *
249
- * @param bpmnDiagramOrId The diagram or Id of the BPMN diagram to open.
250
- *
251
- * @return A promise resolving with warnings that were produced during opening.
252
- */
253
- open(bpmnDiagramOrId: ModdleElement | string): Promise<OpenResult>;
254
-
255
- /**
256
- * Export the currently displayed BPMN 2.0 diagram as
257
- * a BPMN 2.0 XML document.
258
- *
259
- * ## Life-Cycle Events
260
- *
261
- * During XML saving the viewer will fire life-cycle events:
262
- *
263
- * * saveXML.start (before serialization)
264
- * * saveXML.serialized (after xml generation)
265
- * * saveXML.done (everything done)
266
- *
267
- * You can use these events to hook into the life-cycle.
268
- *
269
- * @throws An error thrown during export.
270
- *
271
- * @param options The options.
272
- *
273
- * @return A promise resolving with the XML.
274
- */
275
- saveXML(options?: SaveXMLOptions): Promise<SaveXMLResult>;
276
-
277
- /**
278
- * Export the currently displayed BPMN 2.0 diagram as
279
- * an SVG image.
280
- *
281
- * ## Life-Cycle Events
282
- *
283
- * During SVG saving the viewer will fire life-cycle events:
284
- *
285
- * * saveSVG.start (before serialization)
286
- * * saveSVG.done (everything done)
287
- *
288
- * You can use these events to hook into the life-cycle.
289
- *
290
- * @throws An error thrown during export.
291
- *
292
- * @return A promise resolving with the SVG.
293
- */
294
- saveSVG(): Promise<SaveSVGResult>;
295
-
296
- /**
297
- * Return modules to instantiate with.
298
- *
299
- * @return The modules.
300
- */
301
- getModules(): ModuleDeclaration[];
302
-
303
- /**
304
- * Remove all drawn elements from the viewer.
305
- *
306
- * After calling this method the viewer can still be reused for opening another
307
- * diagram.
308
- */
309
- clear(): void;
310
-
311
- /**
312
- * Destroy the viewer instance and remove all its remainders from the document
313
- * tree.
314
- */
315
- destroy(): void;
316
-
317
- /**
318
- * Register an event listener.
319
- *
320
- * Remove a previously added listener via {@link BaseViewer#off}.
321
- *
322
- * @param events The event(s) to listen to.
323
- * @param callback The callback.
324
- * @param that Value of `this` the callback will be called with.
325
- */
326
- on<T extends Event>(events: string | string[], callback: EventCallback<T>, that?: any): void;
327
-
328
- /**
329
- * Register an event listener.
330
- *
331
- * Remove a previously added listener via {@link BaseViewer#off}.
332
- *
333
- * @param events The event(s) to listen to.
334
- * @param priority The priority with which to listen.
335
- * @param callback The callback.
336
- * @param that Value of `this` the callback will be called with.
337
- */
338
- on<T extends Event>(events: string | string[], priority: number, callback: EventCallback<T>, that?: any): void;
339
-
340
- /**
341
- * Remove an event listener.
342
- *
343
- * @param events The event(s).
344
- * @param callback The callback.
345
- */
346
- off(events: string | string[], callback?: EventCallback<any>): void;
347
-
348
- /**
349
- * Attach the viewer to an HTML element.
350
- *
351
- * @param parentNode The parent node to attach to.
352
- */
353
- attachTo(parentNode: HTMLElement): void;
354
-
355
- /**
356
- * Get the definitions model element.
357
- *
358
- * @returns The definitions model element.
359
- */
360
- getDefinitions(): ModdleElement | undefined;
361
-
362
- /**
363
- * Detach the viewer.
364
- */
365
- detach(): void;
366
- }
1
+ /**
2
+ * A base viewer for BPMN 2.0 diagrams.
3
+ *
4
+ * Have a look at {@link Viewer}, {@link NavigatedViewer} or {@link Modeler} for
5
+ * bundles that include actual features.
6
+ *
7
+ */
8
+ export default class BaseViewer extends Diagram {
9
+ /**
10
+ * @param options The options to configure the viewer.
11
+ */
12
+ constructor(options?: BaseViewerOptions);
13
+
14
+ importXML: (xml: string, bpmnDiagram?: ModdleElement | string) => Promise<ImportXMLResult>;
15
+ importDefinitions: (definitions: ModdleElement, bpmnDiagram?: ModdleElement | string) => Promise<ImportDefinitionsResult>;
16
+ open: (bpmnDiagramOrId: ModdleElement | string) => Promise<OpenResult>;
17
+ saveXML: (options?: SaveXMLOptions) => Promise<SaveXMLResult>;
18
+ saveSVG: () => Promise<SaveSVGResult>;
19
+
20
+ /**
21
+ * Return modules to instantiate with.
22
+ *
23
+ * @return The modules.
24
+ */
25
+ getModules(): ModuleDeclaration[];
26
+
27
+ /**
28
+ * Register an event listener.
29
+ *
30
+ * Remove an event listener via {@link BaseViewer#off}.
31
+ *
32
+ *
33
+ * @param events The event(s) to listen to.
34
+ * @param callback The callback.
35
+ * @param that Value of `this` the callback will be called with.
36
+ */
37
+ on<T>(events: string | string[], callback: EventBusEventCallback<T>, that?: any): any;
38
+
39
+ /**
40
+ * Register an event listener.
41
+ *
42
+ * Remove an event listener via {@link BaseViewer#off}.
43
+ *
44
+ *
45
+ * @param events The event(s) to listen to.
46
+ * @param priority The priority with which to listen.
47
+ * @param callback The callback.
48
+ * @param that Value of `this` the callback will be called with.
49
+ */
50
+ on<T>(
51
+ events: string | string[],
52
+ priority: number,
53
+ callback: EventBusEventCallback<T>,
54
+ that?: any
55
+ ): any;
56
+
57
+ /**
58
+ * Remove an event listener.
59
+ *
60
+ * @param events The event(s).
61
+ * @param callback The callback.
62
+ */
63
+ off(events: string | string[], callback?: Function): void;
64
+
65
+ /**
66
+ * Attach the viewer to an HTML element.
67
+ *
68
+ * @param parentNode The parent node to attach to.
69
+ */
70
+ attachTo(parentNode: HTMLElement): void;
71
+
72
+ /**
73
+ * Get the definitions model element.
74
+ *
75
+ * @return The definitions model element.
76
+ */
77
+ getDefinitions(): ModdleElement;
78
+
79
+ /**
80
+ * Detach the viewer.
81
+ *
82
+ * @fires BaseViewer#DetachEvent
83
+ */
84
+ detach(): void;
85
+ }
86
+
87
+ type EventBusEventCallback<T> = import('diagram-js/lib/core/EventBus').EventBusEventCallback<T>;
88
+ type ModuleDeclaration = import('didi').ModuleDeclaration;
89
+ type Moddle = import('./model/Types').Moddle;
90
+ type ModdleElement = import('./model/Types').ModdleElement;
91
+ type ModdleExtension = import('./model/Types').ModdleExtension;
92
+
93
+ export type BaseViewerOptions = {
94
+ width?: number | string;
95
+ height?: number | string;
96
+ position?: string;
97
+ container?: string | HTMLElement;
98
+ moddleExtensions?: ModdleExtensions;
99
+ additionalModules?: ModuleDeclaration[];
100
+ } & Record<string, any>;
101
+
102
+ export type ModdleElementsById = Record<string, ModdleElement>;
103
+
104
+ export type ModdleExtensions = {
105
+ [key: string]: import("./model/Types").ModdleExtension;
106
+ };
107
+
108
+ export type ImportXMLResult = {
109
+ warnings: string[];
110
+ };
111
+
112
+ export type ImportXMLError = ImportXMLResult & Error;
113
+ export type ImportDefinitionsResult = ImportXMLResult;
114
+ export type ImportDefinitionsError = ImportXMLError;
115
+ export type OpenResult = ImportXMLResult;
116
+ export type OpenError = ImportXMLError;
117
+
118
+ export type SaveXMLOptions = {
119
+ format?: boolean;
120
+ preamble?: boolean;
121
+ };
122
+
123
+ export type SaveXMLResult = {
124
+ xml?: string;
125
+ error?: Error;
126
+ };
127
+
128
+ export type SaveSVGResult = {
129
+ svg: string;
130
+ };
131
+
132
+ export type ImportParseStartEvent = {
133
+ xml: string;
134
+ };
135
+
136
+ export type ImportParseCompleteEvent = {
137
+ error?: ImportXMLError;
138
+ definitions?: ModdleElement;
139
+ elementsById?: ModdleElementsById;
140
+ references?: ModdleElement[];
141
+ warnings: string[];
142
+ };
143
+
144
+ export type ImportDoneEvent = {
145
+ error?: ImportXMLError;
146
+ warnings: string[];
147
+ };
148
+
149
+ export type SaveXMLStartEvent = {
150
+ definitions: ModdleElement;
151
+ };
152
+
153
+ export type SaveXMLDoneEvent = SaveXMLResult;
154
+
155
+ export type SaveSVGDoneEvent = {
156
+ error?: Error;
157
+ svg: string;
158
+ };
159
+
160
+ import Diagram from 'diagram-js';