bpmn-js 13.0.3 → 13.0.4

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 (162) hide show
  1. package/dist/bpmn-modeler.development.js +362 -113
  2. package/dist/bpmn-modeler.production.min.js +2 -2
  3. package/dist/bpmn-navigated-viewer.development.js +195 -40
  4. package/dist/bpmn-navigated-viewer.production.min.js +1 -1
  5. package/dist/bpmn-viewer.development.js +116 -32
  6. package/dist/bpmn-viewer.production.min.js +1 -1
  7. package/lib/BaseModeler.d.ts +12 -12
  8. package/lib/BaseViewer.d.ts +160 -160
  9. package/lib/Modeler.d.ts +76 -76
  10. package/lib/NavigatedViewer.d.ts +8 -8
  11. package/lib/Viewer.d.ts +44 -44
  12. package/lib/core/index.d.ts +10 -10
  13. package/lib/draw/BpmnRenderUtil.d.ts +77 -77
  14. package/lib/draw/BpmnRenderUtil.js +6 -6
  15. package/lib/draw/BpmnRenderer.d.ts +124 -124
  16. package/lib/draw/PathMap.d.ts +330 -330
  17. package/lib/draw/TextRenderer.d.ts +74 -74
  18. package/lib/draw/index.d.ts +10 -10
  19. package/lib/features/align-elements/AlignElementsContextPadProvider.d.ts +32 -32
  20. package/lib/features/align-elements/AlignElementsIcons.d.ts +10 -10
  21. package/lib/features/align-elements/AlignElementsMenuProvider.d.ts +32 -32
  22. package/lib/features/align-elements/BpmnAlignElements.d.ts +9 -9
  23. package/lib/features/align-elements/index.d.ts +11 -11
  24. package/lib/features/auto-place/BpmnAutoPlace.d.ts +13 -13
  25. package/lib/features/auto-place/BpmnAutoPlaceUtil.d.ts +47 -47
  26. package/lib/features/auto-place/index.d.ts +7 -7
  27. package/lib/features/auto-resize/BpmnAutoResize.d.ts +25 -25
  28. package/lib/features/auto-resize/BpmnAutoResizeProvider.d.ts +26 -26
  29. package/lib/features/auto-resize/index.d.ts +8 -8
  30. package/lib/features/context-pad/ContextPadProvider.d.ts +60 -60
  31. package/lib/features/context-pad/index.d.ts +7 -7
  32. package/lib/features/copy-paste/BpmnCopyPaste.d.ts +17 -17
  33. package/lib/features/copy-paste/ModdleCopy.d.ts +45 -45
  34. package/lib/features/copy-paste/index.d.ts +9 -9
  35. package/lib/features/di-ordering/BpmnDiOrdering.d.ts +11 -11
  36. package/lib/features/di-ordering/index.d.ts +6 -6
  37. package/lib/features/distribute-elements/BpmnDistributeElements.d.ts +10 -10
  38. package/lib/features/distribute-elements/DistributeElementsIcons.d.ts +5 -5
  39. package/lib/features/distribute-elements/DistributeElementsMenuProvider.d.ts +32 -32
  40. package/lib/features/distribute-elements/index.d.ts +9 -9
  41. package/lib/features/drilldown/DrilldownBreadcrumbs.d.ts +19 -19
  42. package/lib/features/drilldown/DrilldownCentering.d.ts +17 -17
  43. package/lib/features/drilldown/DrilldownOverlayBehavior.d.ts +18 -18
  44. package/lib/features/drilldown/SubprocessCompatibility.d.ts +21 -21
  45. package/lib/features/drilldown/index.d.ts +13 -13
  46. package/lib/features/editor-actions/BpmnEditorActions.d.ts +13 -13
  47. package/lib/features/editor-actions/index.d.ts +6 -6
  48. package/lib/features/grid-snapping/BpmnGridSnapping.d.ts +9 -9
  49. package/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.d.ts +12 -12
  50. package/lib/features/grid-snapping/behavior/GridSnappingLayoutConnectionBehavior.d.ts +27 -27
  51. package/lib/features/grid-snapping/behavior/GridSnappingParticipantBehavior.d.ts +13 -13
  52. package/lib/features/grid-snapping/behavior/index.d.ts +10 -10
  53. package/lib/features/grid-snapping/index.d.ts +11 -11
  54. package/lib/features/interaction-events/BpmnInteractionEvents.d.ts +18 -18
  55. package/lib/features/interaction-events/index.d.ts +6 -6
  56. package/lib/features/keyboard/BpmnKeyboardBindings.d.ts +15 -15
  57. package/lib/features/keyboard/index.d.ts +7 -7
  58. package/lib/features/label-editing/LabelEditingPreview.d.ts +13 -13
  59. package/lib/features/label-editing/LabelEditingProvider.d.ts +62 -62
  60. package/lib/features/label-editing/LabelUtil.d.ts +1 -1
  61. package/lib/features/label-editing/cmd/UpdateLabelHandler.d.ts +22 -22
  62. package/lib/features/label-editing/index.d.ts +9 -9
  63. package/lib/features/modeling/BpmnFactory.d.ts +73 -73
  64. package/lib/features/modeling/BpmnLayouter.d.ts +26 -26
  65. package/lib/features/modeling/BpmnUpdater.d.ts +92 -92
  66. package/lib/features/modeling/ElementFactory.d.ts +119 -119
  67. package/lib/features/modeling/Modeling.d.ts +150 -150
  68. package/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.d.ts +20 -20
  69. package/lib/features/modeling/behavior/AppendBehavior.d.ts +6 -6
  70. package/lib/features/modeling/behavior/AssociationBehavior.d.ts +11 -11
  71. package/lib/features/modeling/behavior/AttachEventBehavior.d.ts +15 -15
  72. package/lib/features/modeling/behavior/BoundaryEventBehavior.d.ts +15 -15
  73. package/lib/features/modeling/behavior/CreateBehavior.d.ts +9 -9
  74. package/lib/features/modeling/behavior/CreateDataObjectBehavior.d.ts +15 -15
  75. package/lib/features/modeling/behavior/CreateParticipantBehavior.d.ts +19 -19
  76. package/lib/features/modeling/behavior/DataInputAssociationBehavior.d.ts +21 -21
  77. package/lib/features/modeling/behavior/DataStoreBehavior.d.ts +19 -19
  78. package/lib/features/modeling/behavior/DeleteLaneBehavior.d.ts +15 -15
  79. package/lib/features/modeling/behavior/DetachEventBehavior.d.ts +15 -15
  80. package/lib/features/modeling/behavior/DropOnFlowBehavior.d.ts +13 -13
  81. package/lib/features/modeling/behavior/EventBasedGatewayBehavior.d.ts +11 -11
  82. package/lib/features/modeling/behavior/FixHoverBehavior.d.ts +17 -17
  83. package/lib/features/modeling/behavior/GroupBehavior.d.ts +26 -26
  84. package/lib/features/modeling/behavior/ImportDockingFix.d.ts +13 -13
  85. package/lib/features/modeling/behavior/IsHorizontalFix.d.ts +10 -10
  86. package/lib/features/modeling/behavior/LabelBehavior.d.ts +56 -56
  87. package/lib/features/modeling/behavior/LayoutConnectionBehavior.d.ts +16 -16
  88. package/lib/features/modeling/behavior/MessageFlowBehavior.d.ts +15 -15
  89. package/lib/features/modeling/behavior/ModelingFeedback.d.ts +13 -13
  90. package/lib/features/modeling/behavior/RemoveElementBehavior.d.ts +13 -13
  91. package/lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.d.ts +16 -16
  92. package/lib/features/modeling/behavior/RemoveParticipantBehavior.d.ts +15 -15
  93. package/lib/features/modeling/behavior/ReplaceConnectionBehavior.d.ts +15 -15
  94. package/lib/features/modeling/behavior/ReplaceElementBehaviour.d.ts +23 -23
  95. package/lib/features/modeling/behavior/ResizeBehavior.d.ts +57 -57
  96. package/lib/features/modeling/behavior/ResizeLaneBehavior.d.ts +16 -16
  97. package/lib/features/modeling/behavior/RootElementReferenceBehavior.d.ts +25 -25
  98. package/lib/features/modeling/behavior/SpaceToolBehavior.d.ts +10 -10
  99. package/lib/features/modeling/behavior/SubProcessPlaneBehavior.d.ts +28 -28
  100. package/lib/features/modeling/behavior/SubProcessStartEventBehavior.d.ts +15 -15
  101. package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.d.ts +14 -14
  102. package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.d.ts +13 -13
  103. package/lib/features/modeling/behavior/UnclaimIdBehavior.d.ts +19 -19
  104. package/lib/features/modeling/behavior/UnsetDefaultFlowBehavior.d.ts +16 -16
  105. package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.d.ts +17 -17
  106. package/lib/features/modeling/behavior/index.d.ts +2 -2
  107. package/lib/features/modeling/behavior/util/CategoryUtil.d.ts +49 -49
  108. package/lib/features/modeling/behavior/util/ConnectionLayoutUtil.d.ts +19 -19
  109. package/lib/features/modeling/behavior/util/GeometricUtil.d.ts +1 -1
  110. package/lib/features/modeling/behavior/util/LabelLayoutUtil.d.ts +32 -32
  111. package/lib/features/modeling/behavior/util/LayoutUtil.d.ts +48 -48
  112. package/lib/features/modeling/behavior/util/LineAttachmentUtil.d.ts +37 -37
  113. package/lib/features/modeling/behavior/util/LineIntersect.d.ts +13 -13
  114. package/lib/features/modeling/behavior/util/ResizeUtil.d.ts +1 -1
  115. package/lib/features/modeling/cmd/AddLaneHandler.d.ts +22 -22
  116. package/lib/features/modeling/cmd/IdClaimHandler.d.ts +22 -22
  117. package/lib/features/modeling/cmd/ResizeLaneHandler.d.ts +39 -39
  118. package/lib/features/modeling/cmd/SetColorHandler.d.ts +18 -18
  119. package/lib/features/modeling/cmd/SplitLaneHandler.d.ts +22 -22
  120. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.d.ts +20 -20
  121. package/lib/features/modeling/cmd/UpdateFlowNodeRefsHandler.d.ts +21 -21
  122. package/lib/features/modeling/cmd/UpdateModdlePropertiesHandler.d.ts +20 -20
  123. package/lib/features/modeling/cmd/UpdatePropertiesHandler.d.ts +60 -60
  124. package/lib/features/modeling/cmd/UpdateSemanticParentHandler.d.ts +18 -18
  125. package/lib/features/modeling/index.d.ts +27 -27
  126. package/lib/features/modeling/util/LaneUtil.d.ts +46 -46
  127. package/lib/features/modeling/util/ModelingUtil.d.ts +12 -12
  128. package/lib/features/ordering/BpmnOrderingProvider.d.ts +21 -21
  129. package/lib/features/ordering/index.d.ts +7 -7
  130. package/lib/features/palette/PaletteProvider.d.ts +34 -34
  131. package/lib/features/palette/index.d.ts +9 -9
  132. package/lib/features/popup-menu/ReplaceMenuProvider.d.ts +50 -50
  133. package/lib/features/popup-menu/index.d.ts +11 -11
  134. package/lib/features/popup-menu/util/TypeUtil.d.ts +14 -14
  135. package/lib/features/replace/BpmnReplace.d.ts +47 -47
  136. package/lib/features/replace/ReplaceOptions.d.ts +75 -75
  137. package/lib/features/replace/index.d.ts +9 -9
  138. package/lib/features/replace-preview/BpmnReplacePreview.d.ts +17 -17
  139. package/lib/features/replace-preview/index.d.ts +7 -7
  140. package/lib/features/rules/BpmnRules.d.ts +172 -172
  141. package/lib/features/rules/index.d.ts +7 -7
  142. package/lib/features/search/BpmnSearchProvider.d.ts +29 -29
  143. package/lib/features/search/index.d.ts +7 -7
  144. package/lib/features/snapping/BpmnConnectSnapping.d.ts +17 -17
  145. package/lib/features/snapping/BpmnCreateMoveSnapping.d.ts +41 -41
  146. package/lib/features/snapping/BpmnSnappingUtil.d.ts +11 -11
  147. package/lib/features/snapping/index.d.ts +9 -9
  148. package/lib/features/space-tool/BpmnSpaceTool.d.ts +21 -21
  149. package/lib/features/space-tool/index.d.ts +6 -6
  150. package/lib/import/BpmnImporter.d.ts +53 -53
  151. package/lib/import/BpmnTreeWalker.d.ts +22 -22
  152. package/lib/import/Importer.d.ts +25 -25
  153. package/lib/import/Util.d.ts +1 -1
  154. package/lib/import/index.d.ts +6 -6
  155. package/lib/model/Types.d.ts +24 -24
  156. package/lib/util/CompatibilityUtil.d.ts +22 -22
  157. package/lib/util/DiUtil.d.ts +53 -53
  158. package/lib/util/DrilldownUtil.d.ts +39 -39
  159. package/lib/util/LabelUtil.d.ts +89 -89
  160. package/lib/util/ModelUtil.d.ts +40 -40
  161. package/lib/util/PoweredByUtil.d.ts +8 -8
  162. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-navigated-viewer v13.0.3
2
+ * bpmn-js - bpmn-navigated-viewer v13.0.4
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -1632,7 +1632,7 @@
1632
1632
  */
1633
1633
 
1634
1634
  /**
1635
- * @param {Component[]} elements
1635
+ * @param {Component[] | Component[][]} elements
1636
1636
  *
1637
1637
  * @return {string}
1638
1638
  */
@@ -1669,6 +1669,11 @@
1669
1669
  return [ 'C', p1.x, p1.y, p2.x, p2.y, p3.x, p3.y ];
1670
1670
  }
1671
1671
 
1672
+ /**
1673
+ * @param {Point[]} waypoints
1674
+ * @param {number} [cornerRadius]
1675
+ * @return {Component[][]}
1676
+ */
1672
1677
  function drawPath(waypoints, cornerRadius) {
1673
1678
  const pointCount = waypoints.length;
1674
1679
 
@@ -1732,7 +1737,7 @@
1732
1737
 
1733
1738
  /**
1734
1739
  * @param {Point[]} points
1735
- * @param {any} [attrs]
1740
+ * @param {number|Object} [attrs]
1736
1741
  * @param {number} [radius]
1737
1742
  *
1738
1743
  * @return {SVGElement}
@@ -1820,7 +1825,7 @@
1820
1825
  // color access //////////////////////
1821
1826
 
1822
1827
  /**
1823
- * @param {DiagramElement} element
1828
+ * @param {Element} element
1824
1829
  * @param {string} [defaultColor]
1825
1830
  *
1826
1831
  * @return {string}
@@ -1832,7 +1837,7 @@
1832
1837
  }
1833
1838
 
1834
1839
  /**
1835
- * @param {DiagramElement} element
1840
+ * @param {Element} element
1836
1841
  * @param {string} [defaultColor]
1837
1842
  *
1838
1843
  * @return {string}
@@ -1844,9 +1849,9 @@
1844
1849
  }
1845
1850
 
1846
1851
  /**
1847
- * @param {DiagramElement} element
1848
- * @param {string} defaultColor
1849
- * @param {string} defaultStrokeColor
1852
+ * @param {Element} element
1853
+ * @param {string} [defaultColor]
1854
+ * @param {string} [defaultStrokeColor]
1850
1855
  *
1851
1856
  * @return {string}
1852
1857
  */
@@ -2525,8 +2530,8 @@
2525
2530
  * @param {SVGElement} gfx
2526
2531
  * @param {number} x
2527
2532
  * @param {number} y
2528
- * @param {number} angle
2529
- * @param {number} amount
2533
+ * @param {number} [angle]
2534
+ * @param {number} [amount]
2530
2535
  */
2531
2536
  function transform(gfx, x, y, angle, amount) {
2532
2537
  var translate = createTransform();
@@ -4674,7 +4679,7 @@
4674
4679
  *
4675
4680
  * @typedef { Partial<{
4676
4681
  * align: AlignmentConfig;
4677
- * style: Record<string, any>;
4682
+ * style: Record<string, number | string>;
4678
4683
  * padding: PaddingConfig;
4679
4684
  * }> } BaseTextConfig
4680
4685
  *
@@ -4781,6 +4786,8 @@
4781
4786
  * Alters the lines passed.
4782
4787
  *
4783
4788
  * @param {string[]} lines
4789
+ * @param {number} maxWidth
4790
+ * @param {SVGTextElement} fakeText
4784
4791
  *
4785
4792
  * @return {LineDescriptor} the line descriptor
4786
4793
  */
@@ -5751,6 +5758,11 @@
5751
5758
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5752
5759
  }
5753
5760
 
5761
+ /**
5762
+ * @param {Point} point
5763
+ *
5764
+ * @returns {Point}
5765
+ */
5754
5766
  function roundPoint(point) {
5755
5767
 
5756
5768
  return {
@@ -6267,11 +6279,24 @@
6267
6279
  ]
6268
6280
  };
6269
6281
 
6282
+ /**
6283
+ * @typedef {import('../util/Types').Point} Point
6284
+ */
6285
+
6286
+ /**
6287
+ * @param {import('../core/EventBus').Event} event
6288
+ *
6289
+ * @return {Event}
6290
+ */
6270
6291
  function getOriginal(event) {
6271
6292
  return event.originalEvent || event.srcEvent;
6272
6293
  }
6273
6294
 
6274
-
6295
+ /**
6296
+ * @param {Event} event
6297
+ *
6298
+ * @return {Point|null}
6299
+ */
6275
6300
  function toPoint(event) {
6276
6301
 
6277
6302
  if (event.pointers && event.pointers.length) {
@@ -6292,22 +6317,43 @@
6292
6317
  return (/mac/i).test(navigator.platform);
6293
6318
  }
6294
6319
 
6320
+ /**
6321
+ * @param {MouseEvent} event
6322
+ * @param {string} button
6323
+ *
6324
+ * @return {boolean}
6325
+ */
6295
6326
  function isButton(event, button) {
6296
6327
  return (getOriginal(event) || event).button === button;
6297
6328
  }
6298
6329
 
6330
+ /**
6331
+ * @param {MouseEvent} event
6332
+ *
6333
+ * @return {boolean}
6334
+ */
6299
6335
  function isPrimaryButton(event) {
6300
6336
 
6301
6337
  // button === 0 -> left áka primary mouse button
6302
6338
  return isButton(event, 0);
6303
6339
  }
6304
6340
 
6341
+ /**
6342
+ * @param {MouseEvent} event
6343
+ *
6344
+ * @return {boolean}
6345
+ */
6305
6346
  function isAuxiliaryButton(event) {
6306
6347
 
6307
6348
  // button === 1 -> auxiliary áka wheel button
6308
6349
  return isButton(event, 1);
6309
6350
  }
6310
6351
 
6352
+ /**
6353
+ * @param {MouseEvent} event
6354
+ *
6355
+ * @return {boolean}
6356
+ */
6311
6357
  function hasPrimaryModifier(event) {
6312
6358
  var originalEvent = getOriginal(event) || event;
6313
6359
 
@@ -6323,7 +6369,11 @@
6323
6369
  }
6324
6370
  }
6325
6371
 
6326
-
6372
+ /**
6373
+ * @param {MouseEvent} event
6374
+ *
6375
+ * @return {boolean}
6376
+ */
6327
6377
  function hasSecondaryModifier(event) {
6328
6378
  var originalEvent = getOriginal(event) || event;
6329
6379
 
@@ -6888,7 +6938,13 @@
6888
6938
  };
6889
6939
  }
6890
6940
 
6891
-
6941
+ /**
6942
+ * Get the element's type
6943
+ *
6944
+ * @param {Element} element
6945
+ *
6946
+ * @return {'connection' | 'shape' | 'root'}
6947
+ */
6892
6948
  function getType(element) {
6893
6949
 
6894
6950
  if ('waypoints' in element) {
@@ -6902,8 +6958,12 @@
6902
6958
  return 'root';
6903
6959
  }
6904
6960
 
6961
+ /**
6962
+ * @param {Element} element
6963
+ *
6964
+ * @return {boolean}
6965
+ */
6905
6966
  function isFrameElement(element) {
6906
-
6907
6967
  return !!(element && element.isFrame);
6908
6968
  }
6909
6969
 
@@ -7418,7 +7478,7 @@
7418
7478
  *
7419
7479
  * The ids can be customized via a given prefix and contain a random value to avoid collisions.
7420
7480
  *
7421
- * @param {string} prefix a prefix to prepend to generated ids (for better readability)
7481
+ * @param {string} [prefix] a prefix to prepend to generated ids (for better readability)
7422
7482
  */
7423
7483
  function IdGenerator(prefix) {
7424
7484
 
@@ -8526,6 +8586,7 @@
8526
8586
 
8527
8587
  /**
8528
8588
  * @param {string} str
8589
+ *
8529
8590
  * @return {string}
8530
8591
  */
8531
8592
 
@@ -8537,6 +8598,11 @@
8537
8598
  '\'': '&#39;'
8538
8599
  };
8539
8600
 
8601
+ /**
8602
+ * @param {string} str
8603
+ *
8604
+ * @return {string}
8605
+ */
8540
8606
  function escapeHTML(str) {
8541
8607
  str = '' + str;
8542
8608
 
@@ -9895,13 +9961,14 @@
9895
9961
  var self = this;
9896
9962
 
9897
9963
  /**
9898
- * Builds a style definition from a className, a list of traits and an object of additional attributes.
9964
+ * Builds a style definition from a className, a list of traits and an object
9965
+ * of additional attributes.
9899
9966
  *
9900
9967
  * @param {string} className
9901
- * @param {string[]} traits
9902
- * @param {Object} additionalAttrs
9968
+ * @param {string[]} [traits]
9969
+ * @param {Object} [additionalAttrs]
9903
9970
  *
9904
- * @return {Object} the style defintion
9971
+ * @return {Object} the style definition
9905
9972
  */
9906
9973
  this.cls = function(className, traits, additionalAttrs) {
9907
9974
  var attrs = this.style(traits, additionalAttrs);
@@ -9910,12 +9977,13 @@
9910
9977
  };
9911
9978
 
9912
9979
  /**
9913
- * Builds a style definition from a list of traits and an object of additional attributes.
9980
+ * Builds a style definition from a list of traits and an object of additional
9981
+ * attributes.
9914
9982
  *
9915
- * @param {string[]} traits
9983
+ * @param {string[]} [traits]
9916
9984
  * @param {Object} additionalAttrs
9917
9985
  *
9918
- * @return {Object} the style defintion
9986
+ * @return {Object} the style definition
9919
9987
  */
9920
9988
  this.style = function(traits, additionalAttrs) {
9921
9989
 
@@ -9931,6 +9999,17 @@
9931
9999
  return additionalAttrs ? assign$1(attrs, additionalAttrs) : attrs;
9932
10000
  };
9933
10001
 
10002
+
10003
+ /**
10004
+ * Computes a style definition from a list of traits and an object of
10005
+ * additional attributes, with custom style definition object.
10006
+ *
10007
+ * @param {Object} custom
10008
+ * @param {string[]} [traits]
10009
+ * @param {Object} defaultStyles
10010
+ *
10011
+ * @return {Object} the style definition
10012
+ */
9934
10013
  this.computeStyle = function(custom, traits, defaultStyles) {
9935
10014
  if (!isArray$2(traits)) {
9936
10015
  defaultStyles = traits;
@@ -9979,7 +10058,7 @@
9979
10058
  *
9980
10059
  * @param {Array<Object>} collection
9981
10060
  * @param {Object} element
9982
- * @param {number} idx
10061
+ * @param {number} [idx]
9983
10062
  */
9984
10063
  function add(collection, element, idx) {
9985
10064
 
@@ -10588,11 +10667,13 @@
10588
10667
  *
10589
10668
  * @example
10590
10669
  *
10670
+ * ```javascript
10591
10671
  * canvas.addMarker('foo', 'some-marker');
10592
10672
  *
10593
10673
  * const fooGfx = canvas.getGraphics('foo');
10594
10674
  *
10595
10675
  * fooGfx; // <g class="... some-marker"> ... </g>
10676
+ * ```
10596
10677
  *
10597
10678
  * @param {ShapeLike|ConnectionLike|string} element The element or its ID.
10598
10679
  * @param {string} marker The marker.
@@ -10998,7 +11079,7 @@
10998
11079
  *
10999
11080
  * @memberOf Canvas
11000
11081
  *
11001
- * @event ShapeRemoved
11082
+ * @event ShapeRemovedEvent
11002
11083
  * @type {Object}
11003
11084
  * @property {ShapeLike} element The shape.
11004
11085
  * @property {SVGElement} gfx The graphical element.
@@ -11035,7 +11116,7 @@
11035
11116
  *
11036
11117
  * @memberOf Canvas
11037
11118
  *
11038
- * @event connection.removed
11119
+ * @event ConnectionRemovedEvent
11039
11120
  * @type {Object}
11040
11121
  * @property {ConnectionLike} element The connection.
11041
11122
  * @property {SVGElement} gfx The graphical element.
@@ -11094,6 +11175,7 @@
11094
11175
  *
11095
11176
  * @example
11096
11177
  *
11178
+ * ```javascript
11097
11179
  * canvas.viewbox({ x: 100, y: 100, width: 500, height: 500 })
11098
11180
  *
11099
11181
  * // sets the visible area of the diagram to (100|100) -> (600|100)
@@ -11121,6 +11203,7 @@
11121
11203
  * width: zoomedAndScrolledViewbox.outer.width,
11122
11204
  * height: zoomedAndScrolledViewbox.outer.height
11123
11205
  * });
11206
+ * ```
11124
11207
  *
11125
11208
  * @param {Rect} [box] The viewbox to be set.
11126
11209
  *
@@ -11628,9 +11711,11 @@
11628
11711
  *
11629
11712
  * @example
11630
11713
  *
11714
+ * ```javascript
11631
11715
  * elementRegistry.get('SomeElementId_1');
11632
11716
  *
11633
11717
  * elementRegistry.get(gfx);
11718
+ * ```
11634
11719
  *
11635
11720
  * @param {string|SVGElement} filter The elements ID or graphical representation.
11636
11721
  *
@@ -11724,11 +11809,13 @@
11724
11809
  *
11725
11810
  * @example
11726
11811
  *
11812
+ * ```javascript
11727
11813
  * elementRegistry.getGraphics('SomeElementId_1');
11728
11814
  *
11729
11815
  * elementRegistry.getGraphics(rootElement); // <g ...>
11730
11816
  *
11731
11817
  * elementRegistry.getGraphics(rootElement, true); // <svg ...>
11818
+ * ```
11732
11819
  *
11733
11820
  * @param {ElementLike|string} filter The element or its ID.
11734
11821
  * @param {boolean} [secondary=false] Whether to return the secondary graphical representation.
@@ -12308,7 +12395,7 @@
12308
12395
  *
12309
12396
  * @example
12310
12397
  *
12311
- * ```
12398
+ * ```javascript
12312
12399
  * import * as Model from 'diagram-js/lib/model';
12313
12400
  *
12314
12401
  * const root = Model.create('root', {
@@ -12331,7 +12418,7 @@
12331
12418
  *
12332
12419
  * @example
12333
12420
  *
12334
- * ```
12421
+ * ```javascript
12335
12422
  * import * as Model from 'diagram-js/lib/model';
12336
12423
  *
12337
12424
  * const connection = Model.create('connection', {
@@ -12354,7 +12441,7 @@
12354
12441
  *
12355
12442
  * @example
12356
12443
  *
12357
- * ```
12444
+ * ```javascript
12358
12445
  * import * as Model from 'diagram-js/lib/model';
12359
12446
  *
12360
12447
  * const shape = Model.create('shape', {
@@ -12375,7 +12462,7 @@
12375
12462
  *
12376
12463
  * @example
12377
12464
  *
12378
- * ```
12465
+ * ```javascript
12379
12466
  * import * as Model from 'diagram-js/lib/model';
12380
12467
  *
12381
12468
  * const label = Model.create('label', {
@@ -12388,7 +12475,7 @@
12388
12475
  * ```
12389
12476
  *
12390
12477
  * @param {'label'} type
12391
- * @param {any} [attrs]
12478
+ * @param {Object} [attrs]
12392
12479
  * @return {Label}
12393
12480
  */
12394
12481
  function create(type, attrs) {
@@ -12686,7 +12773,6 @@
12686
12773
  });
12687
12774
  };
12688
12775
 
12689
-
12690
12776
  /**
12691
12777
  * Register an event listener that is called only once.
12692
12778
  *
@@ -12957,7 +13043,7 @@
12957
13043
  * * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]
12958
13044
  *
12959
13045
  * @param {string} event
12960
- * @param {EventBusListener} listener
13046
+ * @param {EventBusListener} newListener
12961
13047
  */
12962
13048
  EventBus.prototype._addListener = function(event, newListener) {
12963
13049
 
@@ -13555,9 +13641,11 @@
13555
13641
  *
13556
13642
  * @example
13557
13643
  *
13644
+ * ```javascript
13558
13645
  * eventBus.on('diagram.init', function() {
13559
13646
  * eventBus.fire('my-custom-event', { foo: 'BAR' });
13560
13647
  * });
13648
+ * ```
13561
13649
  *
13562
13650
  * @type {Object}
13563
13651
  */
@@ -22857,6 +22945,7 @@
22857
22945
 
22858
22946
  /**
22859
22947
  * @param {KeyboardEvent} event
22948
+ * @return {boolean}
22860
22949
  */
22861
22950
  function isCmd(event) {
22862
22951
 
@@ -22874,6 +22963,7 @@
22874
22963
  *
22875
22964
  * @param {string|string[]} keys
22876
22965
  * @param {KeyboardEvent} event
22966
+ * @return {boolean}
22877
22967
  */
22878
22968
  function isKey(keys, event) {
22879
22969
  keys = isArray$2(keys) ? keys : [ keys ];
@@ -22888,18 +22978,30 @@
22888
22978
  return event.shiftKey;
22889
22979
  }
22890
22980
 
22981
+ /**
22982
+ * @param {KeyboardEvent} event
22983
+ */
22891
22984
  function isCopy(event) {
22892
22985
  return isCmd(event) && isKey(KEYS_COPY, event);
22893
22986
  }
22894
22987
 
22988
+ /**
22989
+ * @param {KeyboardEvent} event
22990
+ */
22895
22991
  function isPaste(event) {
22896
22992
  return isCmd(event) && isKey(KEYS_PASTE, event);
22897
22993
  }
22898
22994
 
22995
+ /**
22996
+ * @param {KeyboardEvent} event
22997
+ */
22899
22998
  function isUndo(event) {
22900
22999
  return isCmd(event) && !isShift(event) && isKey(KEYS_UNDO, event);
22901
23000
  }
22902
23001
 
23002
+ /**
23003
+ * @param {KeyboardEvent} event
23004
+ */
22903
23005
  function isRedo(event) {
22904
23006
  return isCmd(event) && (
22905
23007
  isKey(KEYS_REDO, event) || (
@@ -22910,6 +23012,8 @@
22910
23012
 
22911
23013
  /**
22912
23014
  * @typedef {import('../../core/EventBus').default} EventBus
23015
+ *
23016
+ * @typedef {({ keyEvent: KeyboardEvent }) => any} Listener
22913
23017
  */
22914
23018
 
22915
23019
  var KEYDOWN_EVENT = 'keyboard.keydown',
@@ -22941,6 +23045,7 @@
22941
23045
  * `keyboard.bindTo` configuration option.
22942
23046
  *
22943
23047
  * @param {Object} config
23048
+ * @param {EventTarget} [config.bindTo]
22944
23049
  * @param {EventBus} eventBus
22945
23050
  */
22946
23051
  function Keyboard(config, eventBus) {
@@ -23032,6 +23137,11 @@
23032
23137
  return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');
23033
23138
  };
23034
23139
 
23140
+ /**
23141
+ * Bind keyboard events to the given DOM node.
23142
+ *
23143
+ * @param {EventTarget} node
23144
+ */
23035
23145
  Keyboard.prototype.bind = function(node) {
23036
23146
 
23037
23147
  // make sure that the keyboard is only bound once to the DOM
@@ -23046,6 +23156,9 @@
23046
23156
  this._fire('bind');
23047
23157
  };
23048
23158
 
23159
+ /**
23160
+ * @return {EventTarget}
23161
+ */
23049
23162
  Keyboard.prototype.getBinding = function() {
23050
23163
  return this._node;
23051
23164
  };
@@ -23064,6 +23177,9 @@
23064
23177
  this._node = null;
23065
23178
  };
23066
23179
 
23180
+ /**
23181
+ * @param {string} event
23182
+ */
23067
23183
  Keyboard.prototype._fire = function(event) {
23068
23184
  this._eventBus.fire('keyboard.' + event, { node: this._node });
23069
23185
  };
@@ -23074,8 +23190,8 @@
23074
23190
  * provided, the default value of 1000 is used.
23075
23191
  *
23076
23192
  * @param {number} [priority]
23077
- * @param {Function} listener
23078
- * @param {string} type
23193
+ * @param {Listener} listener
23194
+ * @param {string} [type='keyboard.keydown']
23079
23195
  */
23080
23196
  Keyboard.prototype.addListener = function(priority, listener, type) {
23081
23197
  if (isFunction(priority)) {
@@ -23087,6 +23203,12 @@
23087
23203
  this._eventBus.on(type || KEYDOWN_EVENT, priority, listener);
23088
23204
  };
23089
23205
 
23206
+ /**
23207
+ * Remove a listener function.
23208
+ *
23209
+ * @param {Listener} listener
23210
+ * @param {string} [type='keyboard.keydown']
23211
+ */
23090
23212
  Keyboard.prototype.removeListener = function(listener, type) {
23091
23213
  this._eventBus.off(type || KEYDOWN_EVENT, listener);
23092
23214
  };
@@ -23359,15 +23481,21 @@
23359
23481
  }
23360
23482
  }
23361
23483
 
23362
- this.moveCanvas = function(opts) {
23484
+ /**
23485
+ * @param {{
23486
+ * direction: 'up' | 'down' | 'left' | 'right';
23487
+ * speed: number;
23488
+ * }} options
23489
+ */
23490
+ this.moveCanvas = function(options) {
23363
23491
 
23364
23492
  var dx = 0,
23365
23493
  dy = 0,
23366
- speed = opts.speed;
23494
+ speed = options.speed;
23367
23495
 
23368
23496
  var actualSpeed = speed / Math.min(Math.sqrt(canvas.viewbox().scale), 1);
23369
23497
 
23370
- switch (opts.direction) {
23498
+ switch (options.direction) {
23371
23499
  case 'left': // Left
23372
23500
  dx = actualSpeed;
23373
23501
  break;
@@ -23410,7 +23538,9 @@
23410
23538
 
23411
23539
  var CURSOR_CLS_PATTERN = /^djs-cursor-.*$/;
23412
23540
 
23413
-
23541
+ /**
23542
+ * @param {string} mode
23543
+ */
23414
23544
  function set(mode) {
23415
23545
  var classes$1 = classes(document.body);
23416
23546
 
@@ -23425,12 +23555,19 @@
23425
23555
  set(null);
23426
23556
  }
23427
23557
 
23558
+ /**
23559
+ * @typedef {import('../core/EventBus').EventBus} EventBus
23560
+ */
23561
+
23428
23562
  var TRAP_PRIORITY = 5000;
23429
23563
 
23430
23564
  /**
23431
23565
  * Installs a click trap that prevents a ghost click following a dragging operation.
23432
23566
  *
23433
- * @return {Function} a function to immediately remove the installed trap.
23567
+ * @param {EventBus} eventBus
23568
+ * @param {string} [eventName='element.click']
23569
+ *
23570
+ * @return {() => void} a function to immediately remove the installed trap.
23434
23571
  */
23435
23572
  function install(eventBus, eventName) {
23436
23573
 
@@ -23447,6 +23584,17 @@
23447
23584
  };
23448
23585
  }
23449
23586
 
23587
+ /**
23588
+ * @typedef {import('../util/Types').Point} Point
23589
+ * @typedef {import('../util/Types').Rect} Rect
23590
+ */
23591
+
23592
+
23593
+ /**
23594
+ * @param {Point} a
23595
+ * @param {Point} b
23596
+ * @return {Point}
23597
+ */
23450
23598
  function delta(a, b) {
23451
23599
  return {
23452
23600
  x: a.x - b.x,
@@ -23595,6 +23743,7 @@
23595
23743
  * @param {Object} range
23596
23744
  * @param {number} range.min
23597
23745
  * @param {number} range.max
23746
+ * @param {number} steps
23598
23747
  */
23599
23748
  function getStepSize(range, steps) {
23600
23749
 
@@ -23606,6 +23755,12 @@
23606
23755
  return absoluteLinearRange / steps;
23607
23756
  }
23608
23757
 
23758
+ /**
23759
+ * @param {Object} range
23760
+ * @param {number} range.min
23761
+ * @param {number} range.max
23762
+ * @param {number} scale
23763
+ */
23609
23764
  function cap(range, scale) {
23610
23765
  return Math.max(range.min, Math.min(range.max, scale));
23611
23766
  }