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-modeler v13.0.3
2
+ * bpmn-js - bpmn-modeler v13.0.4
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -2704,7 +2704,7 @@
2704
2704
  */
2705
2705
 
2706
2706
  /**
2707
- * @param {Component[]} elements
2707
+ * @param {Component[] | Component[][]} elements
2708
2708
  *
2709
2709
  * @return {string}
2710
2710
  */
@@ -2741,6 +2741,11 @@
2741
2741
  return [ 'C', p1.x, p1.y, p2.x, p2.y, p3.x, p3.y ];
2742
2742
  }
2743
2743
 
2744
+ /**
2745
+ * @param {Point[]} waypoints
2746
+ * @param {number} [cornerRadius]
2747
+ * @return {Component[][]}
2748
+ */
2744
2749
  function drawPath(waypoints, cornerRadius) {
2745
2750
  const pointCount = waypoints.length;
2746
2751
 
@@ -2804,7 +2809,7 @@
2804
2809
 
2805
2810
  /**
2806
2811
  * @param {Point[]} points
2807
- * @param {any} [attrs]
2812
+ * @param {number|Object} [attrs]
2808
2813
  * @param {number} [radius]
2809
2814
  *
2810
2815
  * @return {SVGElement}
@@ -2847,10 +2852,19 @@
2847
2852
  }
2848
2853
 
2849
2854
  /**
2850
- * @typedef {import('../../model/Types').Element} Element
2851
- * @typedef {import('../../model/Types').Shape} Shape
2855
+ * @typedef {import('../model/Types').Connection} Connection
2856
+ * @typedef {import('../model/Types').Element} Element
2857
+ * @typedef {import('../model/Types').Shape} Shape
2852
2858
  *
2853
2859
  * @typedef {import('../../type/Types').Rect} Rect
2860
+ *
2861
+ * @typedef { {
2862
+ * allShapes: Record<string, Shape>,
2863
+ * allConnections: Record<string, Connection>,
2864
+ * topLevel: Record<string, Element>,
2865
+ * enclosedConnections: Record<string, Connection>,
2866
+ * enclosedElements: Record<string, Element>
2867
+ * } } Closure
2854
2868
  */
2855
2869
 
2856
2870
  /**
@@ -2893,14 +2907,14 @@
2893
2907
  * element was added.
2894
2908
  *
2895
2909
  * @param {Object[]} elements
2896
- * @param {Object} e
2897
- * @param {boolean} unique
2910
+ * @param {Object} element
2911
+ * @param {boolean} [unique]
2898
2912
  */
2899
- function add$1(elements, e, unique) {
2900
- var canAdd = !unique || elements.indexOf(e) === -1;
2913
+ function add$1(elements, element, unique) {
2914
+ var canAdd = !unique || elements.indexOf(element) === -1;
2901
2915
 
2902
2916
  if (canAdd) {
2903
- elements.push(e);
2917
+ elements.push(element);
2904
2918
  }
2905
2919
 
2906
2920
  return canAdd;
@@ -2913,8 +2927,8 @@
2913
2927
  *
2914
2928
  * Recurse into all elements that are returned by `fn`.
2915
2929
  *
2916
- * @param {Object|Object[]} elements
2917
- * @param {Function} fn iterator function called with (element, index, recursionDepth)
2930
+ * @param {Element|Element[]} elements
2931
+ * @param {(element: Element, index: number, depth: number) => Element[] | boolean | undefined} fn
2918
2932
  * @param {number} [depth] maximum recursion depth
2919
2933
  */
2920
2934
  function eachElement(elements, fn, depth) {
@@ -2971,7 +2985,7 @@
2971
2985
  * Return self + ALL children for a number of elements
2972
2986
  *
2973
2987
  * @param {Element[]} elements to query
2974
- * @param {boolean} allowDuplicates to allow duplicates in the result set
2988
+ * @param {boolean} [allowDuplicates] to allow duplicates in the result set
2975
2989
  *
2976
2990
  * @return {Element[]} the collected elements
2977
2991
  */
@@ -2986,9 +3000,9 @@
2986
3000
  *
2987
3001
  * @param {Element[]} elements
2988
3002
  * @param {boolean} [isTopLevel=true]
2989
- * @param {Object} [closure]
3003
+ * @param {Closure} [closure]
2990
3004
  *
2991
- * @return {Object} newClosure
3005
+ * @return {Closure} newClosure
2992
3006
  */
2993
3007
  function getClosure(elements, isTopLevel, closure) {
2994
3008
 
@@ -3167,7 +3181,13 @@
3167
3181
  return filteredElements;
3168
3182
  }
3169
3183
 
3170
-
3184
+ /**
3185
+ * Get the element's type
3186
+ *
3187
+ * @param {Element} element
3188
+ *
3189
+ * @return {'connection' | 'shape' | 'root'}
3190
+ */
3171
3191
  function getType(element) {
3172
3192
 
3173
3193
  if ('waypoints' in element) {
@@ -3181,8 +3201,12 @@
3181
3201
  return 'root';
3182
3202
  }
3183
3203
 
3204
+ /**
3205
+ * @param {Element} element
3206
+ *
3207
+ * @return {boolean}
3208
+ */
3184
3209
  function isFrameElement$1(element) {
3185
-
3186
3210
  return !!(element && element.isFrame);
3187
3211
  }
3188
3212
 
@@ -3325,13 +3349,14 @@
3325
3349
  var self = this;
3326
3350
 
3327
3351
  /**
3328
- * Builds a style definition from a className, a list of traits and an object of additional attributes.
3352
+ * Builds a style definition from a className, a list of traits and an object
3353
+ * of additional attributes.
3329
3354
  *
3330
3355
  * @param {string} className
3331
- * @param {string[]} traits
3332
- * @param {Object} additionalAttrs
3356
+ * @param {string[]} [traits]
3357
+ * @param {Object} [additionalAttrs]
3333
3358
  *
3334
- * @return {Object} the style defintion
3359
+ * @return {Object} the style definition
3335
3360
  */
3336
3361
  this.cls = function(className, traits, additionalAttrs) {
3337
3362
  var attrs = this.style(traits, additionalAttrs);
@@ -3340,12 +3365,13 @@
3340
3365
  };
3341
3366
 
3342
3367
  /**
3343
- * Builds a style definition from a list of traits and an object of additional attributes.
3368
+ * Builds a style definition from a list of traits and an object of additional
3369
+ * attributes.
3344
3370
  *
3345
- * @param {string[]} traits
3371
+ * @param {string[]} [traits]
3346
3372
  * @param {Object} additionalAttrs
3347
3373
  *
3348
- * @return {Object} the style defintion
3374
+ * @return {Object} the style definition
3349
3375
  */
3350
3376
  this.style = function(traits, additionalAttrs) {
3351
3377
 
@@ -3361,6 +3387,17 @@
3361
3387
  return additionalAttrs ? assign$1(attrs, additionalAttrs) : attrs;
3362
3388
  };
3363
3389
 
3390
+
3391
+ /**
3392
+ * Computes a style definition from a list of traits and an object of
3393
+ * additional attributes, with custom style definition object.
3394
+ *
3395
+ * @param {Object} custom
3396
+ * @param {string[]} [traits]
3397
+ * @param {Object} defaultStyles
3398
+ *
3399
+ * @return {Object} the style definition
3400
+ */
3364
3401
  this.computeStyle = function(custom, traits, defaultStyles) {
3365
3402
  if (!isArray$3(traits)) {
3366
3403
  defaultStyles = traits;
@@ -3409,7 +3446,7 @@
3409
3446
  *
3410
3447
  * @param {Array<Object>} collection
3411
3448
  * @param {Object} element
3412
- * @param {number} idx
3449
+ * @param {number} [idx]
3413
3450
  */
3414
3451
  function add(collection, element, idx) {
3415
3452
 
@@ -4543,6 +4580,11 @@
4543
4580
  * @typedef {import('../util/Types').RectTRBL} RectTRBL
4544
4581
  */
4545
4582
 
4583
+ /**
4584
+ * @param {Rect} bounds
4585
+ *
4586
+ * @returns {Rect}
4587
+ */
4546
4588
  function roundBounds(bounds) {
4547
4589
  return {
4548
4590
  x: Math.round(bounds.x),
@@ -4552,7 +4594,11 @@
4552
4594
  };
4553
4595
  }
4554
4596
 
4555
-
4597
+ /**
4598
+ * @param {Point} point
4599
+ *
4600
+ * @returns {Point}
4601
+ */
4556
4602
  function roundPoint(point) {
4557
4603
 
4558
4604
  return {
@@ -5386,11 +5432,13 @@
5386
5432
  *
5387
5433
  * @example
5388
5434
  *
5435
+ * ```javascript
5389
5436
  * canvas.addMarker('foo', 'some-marker');
5390
5437
  *
5391
5438
  * const fooGfx = canvas.getGraphics('foo');
5392
5439
  *
5393
5440
  * fooGfx; // <g class="... some-marker"> ... </g>
5441
+ * ```
5394
5442
  *
5395
5443
  * @param {ShapeLike|ConnectionLike|string} element The element or its ID.
5396
5444
  * @param {string} marker The marker.
@@ -5796,7 +5844,7 @@
5796
5844
  *
5797
5845
  * @memberOf Canvas
5798
5846
  *
5799
- * @event ShapeRemoved
5847
+ * @event ShapeRemovedEvent
5800
5848
  * @type {Object}
5801
5849
  * @property {ShapeLike} element The shape.
5802
5850
  * @property {SVGElement} gfx The graphical element.
@@ -5833,7 +5881,7 @@
5833
5881
  *
5834
5882
  * @memberOf Canvas
5835
5883
  *
5836
- * @event connection.removed
5884
+ * @event ConnectionRemovedEvent
5837
5885
  * @type {Object}
5838
5886
  * @property {ConnectionLike} element The connection.
5839
5887
  * @property {SVGElement} gfx The graphical element.
@@ -5892,6 +5940,7 @@
5892
5940
  *
5893
5941
  * @example
5894
5942
  *
5943
+ * ```javascript
5895
5944
  * canvas.viewbox({ x: 100, y: 100, width: 500, height: 500 })
5896
5945
  *
5897
5946
  * // sets the visible area of the diagram to (100|100) -> (600|100)
@@ -5919,6 +5968,7 @@
5919
5968
  * width: zoomedAndScrolledViewbox.outer.width,
5920
5969
  * height: zoomedAndScrolledViewbox.outer.height
5921
5970
  * });
5971
+ * ```
5922
5972
  *
5923
5973
  * @param {Rect} [box] The viewbox to be set.
5924
5974
  *
@@ -6426,9 +6476,11 @@
6426
6476
  *
6427
6477
  * @example
6428
6478
  *
6479
+ * ```javascript
6429
6480
  * elementRegistry.get('SomeElementId_1');
6430
6481
  *
6431
6482
  * elementRegistry.get(gfx);
6483
+ * ```
6432
6484
  *
6433
6485
  * @param {string|SVGElement} filter The elements ID or graphical representation.
6434
6486
  *
@@ -6522,11 +6574,13 @@
6522
6574
  *
6523
6575
  * @example
6524
6576
  *
6577
+ * ```javascript
6525
6578
  * elementRegistry.getGraphics('SomeElementId_1');
6526
6579
  *
6527
6580
  * elementRegistry.getGraphics(rootElement); // <g ...>
6528
6581
  *
6529
6582
  * elementRegistry.getGraphics(rootElement, true); // <svg ...>
6583
+ * ```
6530
6584
  *
6531
6585
  * @param {ElementLike|string} filter The element or its ID.
6532
6586
  * @param {boolean} [secondary=false] Whether to return the secondary graphical representation.
@@ -7106,7 +7160,7 @@
7106
7160
  *
7107
7161
  * @example
7108
7162
  *
7109
- * ```
7163
+ * ```javascript
7110
7164
  * import * as Model from 'diagram-js/lib/model';
7111
7165
  *
7112
7166
  * const root = Model.create('root', {
@@ -7129,7 +7183,7 @@
7129
7183
  *
7130
7184
  * @example
7131
7185
  *
7132
- * ```
7186
+ * ```javascript
7133
7187
  * import * as Model from 'diagram-js/lib/model';
7134
7188
  *
7135
7189
  * const connection = Model.create('connection', {
@@ -7152,7 +7206,7 @@
7152
7206
  *
7153
7207
  * @example
7154
7208
  *
7155
- * ```
7209
+ * ```javascript
7156
7210
  * import * as Model from 'diagram-js/lib/model';
7157
7211
  *
7158
7212
  * const shape = Model.create('shape', {
@@ -7173,7 +7227,7 @@
7173
7227
  *
7174
7228
  * @example
7175
7229
  *
7176
- * ```
7230
+ * ```javascript
7177
7231
  * import * as Model from 'diagram-js/lib/model';
7178
7232
  *
7179
7233
  * const label = Model.create('label', {
@@ -7186,7 +7240,7 @@
7186
7240
  * ```
7187
7241
  *
7188
7242
  * @param {'label'} type
7189
- * @param {any} [attrs]
7243
+ * @param {Object} [attrs]
7190
7244
  * @return {Label}
7191
7245
  */
7192
7246
  function create(type, attrs) {
@@ -7494,7 +7548,6 @@
7494
7548
  });
7495
7549
  };
7496
7550
 
7497
-
7498
7551
  /**
7499
7552
  * Register an event listener that is called only once.
7500
7553
  *
@@ -7765,7 +7818,7 @@
7765
7818
  * * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]
7766
7819
  *
7767
7820
  * @param {string} event
7768
- * @param {EventBusListener} listener
7821
+ * @param {EventBusListener} newListener
7769
7822
  */
7770
7823
  EventBus.prototype._addListener = function(event, newListener) {
7771
7824
 
@@ -7920,8 +7973,8 @@
7920
7973
  * @param {SVGElement} gfx
7921
7974
  * @param {number} x
7922
7975
  * @param {number} y
7923
- * @param {number} angle
7924
- * @param {number} amount
7976
+ * @param {number} [angle]
7977
+ * @param {number} [amount]
7925
7978
  */
7926
7979
  function transform(gfx, x, y, angle, amount) {
7927
7980
  var translate = createTransform();
@@ -8408,9 +8461,11 @@
8408
8461
  *
8409
8462
  * @example
8410
8463
  *
8464
+ * ```javascript
8411
8465
  * eventBus.on('diagram.init', function() {
8412
8466
  * eventBus.fire('my-custom-event', { foo: 'BAR' });
8413
8467
  * });
8468
+ * ```
8414
8469
  *
8415
8470
  * @type {Object}
8416
8471
  */
@@ -18161,7 +18216,7 @@
18161
18216
  // color access //////////////////////
18162
18217
 
18163
18218
  /**
18164
- * @param {DiagramElement} element
18219
+ * @param {Element} element
18165
18220
  * @param {string} [defaultColor]
18166
18221
  *
18167
18222
  * @return {string}
@@ -18173,7 +18228,7 @@
18173
18228
  }
18174
18229
 
18175
18230
  /**
18176
- * @param {DiagramElement} element
18231
+ * @param {Element} element
18177
18232
  * @param {string} [defaultColor]
18178
18233
  *
18179
18234
  * @return {string}
@@ -18185,9 +18240,9 @@
18185
18240
  }
18186
18241
 
18187
18242
  /**
18188
- * @param {DiagramElement} element
18189
- * @param {string} defaultColor
18190
- * @param {string} defaultStrokeColor
18243
+ * @param {Element} element
18244
+ * @param {string} [defaultColor]
18245
+ * @param {string} [defaultStrokeColor]
18191
18246
  *
18192
18247
  * @return {string}
18193
18248
  */
@@ -20244,7 +20299,7 @@
20244
20299
  *
20245
20300
  * @typedef { Partial<{
20246
20301
  * align: AlignmentConfig;
20247
- * style: Record<string, any>;
20302
+ * style: Record<string, number | string>;
20248
20303
  * padding: PaddingConfig;
20249
20304
  * }> } BaseTextConfig
20250
20305
  *
@@ -20351,6 +20406,8 @@
20351
20406
  * Alters the lines passed.
20352
20407
  *
20353
20408
  * @param {string[]} lines
20409
+ * @param {number} maxWidth
20410
+ * @param {SVGTextElement} fakeText
20354
20411
  *
20355
20412
  * @return {LineDescriptor} the line descriptor
20356
20413
  */
@@ -21683,6 +21740,10 @@
21683
21740
  ]
21684
21741
  };
21685
21742
 
21743
+ /**
21744
+ * @typedef {import('../util/Types').Point} Point
21745
+ */
21746
+
21686
21747
  function __stopPropagation(event) {
21687
21748
  if (!event || typeof event.stopPropagation !== 'function') {
21688
21749
  return;
@@ -21691,18 +21752,28 @@
21691
21752
  event.stopPropagation();
21692
21753
  }
21693
21754
 
21694
-
21755
+ /**
21756
+ * @param {import('../core/EventBus').Event} event
21757
+ *
21758
+ * @return {Event}
21759
+ */
21695
21760
  function getOriginal$1(event) {
21696
21761
  return event.originalEvent || event.srcEvent;
21697
21762
  }
21698
21763
 
21699
-
21700
- function stopPropagation$1(event, immediate) {
21764
+ /**
21765
+ * @param {Event|import('../core/EventBus').Event} event
21766
+ */
21767
+ function stopPropagation$1(event) {
21701
21768
  __stopPropagation(event);
21702
21769
  __stopPropagation(getOriginal$1(event));
21703
21770
  }
21704
21771
 
21705
-
21772
+ /**
21773
+ * @param {Event} event
21774
+ *
21775
+ * @return {Point|null}
21776
+ */
21706
21777
  function toPoint(event) {
21707
21778
 
21708
21779
  if (event.pointers && event.pointers.length) {
@@ -21723,22 +21794,43 @@
21723
21794
  return (/mac/i).test(navigator.platform);
21724
21795
  }
21725
21796
 
21797
+ /**
21798
+ * @param {MouseEvent} event
21799
+ * @param {string} button
21800
+ *
21801
+ * @return {boolean}
21802
+ */
21726
21803
  function isButton(event, button) {
21727
21804
  return (getOriginal$1(event) || event).button === button;
21728
21805
  }
21729
21806
 
21807
+ /**
21808
+ * @param {MouseEvent} event
21809
+ *
21810
+ * @return {boolean}
21811
+ */
21730
21812
  function isPrimaryButton(event) {
21731
21813
 
21732
21814
  // button === 0 -> left áka primary mouse button
21733
21815
  return isButton(event, 0);
21734
21816
  }
21735
21817
 
21818
+ /**
21819
+ * @param {MouseEvent} event
21820
+ *
21821
+ * @return {boolean}
21822
+ */
21736
21823
  function isAuxiliaryButton(event) {
21737
21824
 
21738
21825
  // button === 1 -> auxiliary áka wheel button
21739
21826
  return isButton(event, 1);
21740
21827
  }
21741
21828
 
21829
+ /**
21830
+ * @param {MouseEvent} event
21831
+ *
21832
+ * @return {boolean}
21833
+ */
21742
21834
  function hasPrimaryModifier(event) {
21743
21835
  var originalEvent = getOriginal$1(event) || event;
21744
21836
 
@@ -21754,7 +21846,11 @@
21754
21846
  }
21755
21847
  }
21756
21848
 
21757
-
21849
+ /**
21850
+ * @param {MouseEvent} event
21851
+ *
21852
+ * @return {boolean}
21853
+ */
21758
21854
  function hasSecondaryModifier(event) {
21759
21855
  var originalEvent = getOriginal$1(event) || event;
21760
21856
 
@@ -22773,7 +22869,7 @@
22773
22869
  *
22774
22870
  * The ids can be customized via a given prefix and contain a random value to avoid collisions.
22775
22871
  *
22776
- * @param {string} prefix a prefix to prepend to generated ids (for better readability)
22872
+ * @param {string} [prefix] a prefix to prepend to generated ids (for better readability)
22777
22873
  */
22778
22874
  function IdGenerator(prefix) {
22779
22875
 
@@ -23881,6 +23977,7 @@
23881
23977
 
23882
23978
  /**
23883
23979
  * @param {string} str
23980
+ *
23884
23981
  * @return {string}
23885
23982
  */
23886
23983
  function escapeCSS(str) {
@@ -23895,6 +23992,11 @@
23895
23992
  '\'': '&#39;'
23896
23993
  };
23897
23994
 
23995
+ /**
23996
+ * @param {string} str
23997
+ *
23998
+ * @return {string}
23999
+ */
23898
24000
  function escapeHTML(str) {
23899
24001
  str = '' + str;
23900
24002
 
@@ -24775,6 +24877,7 @@
24775
24877
 
24776
24878
  /**
24777
24879
  * @param {KeyboardEvent} event
24880
+ * @return {boolean}
24778
24881
  */
24779
24882
  function isCmd(event) {
24780
24883
 
@@ -24792,6 +24895,7 @@
24792
24895
  *
24793
24896
  * @param {string|string[]} keys
24794
24897
  * @param {KeyboardEvent} event
24898
+ * @return {boolean}
24795
24899
  */
24796
24900
  function isKey(keys, event) {
24797
24901
  keys = isArray$3(keys) ? keys : [ keys ];
@@ -24806,18 +24910,30 @@
24806
24910
  return event.shiftKey;
24807
24911
  }
24808
24912
 
24913
+ /**
24914
+ * @param {KeyboardEvent} event
24915
+ */
24809
24916
  function isCopy(event) {
24810
24917
  return isCmd(event) && isKey(KEYS_COPY, event);
24811
24918
  }
24812
24919
 
24920
+ /**
24921
+ * @param {KeyboardEvent} event
24922
+ */
24813
24923
  function isPaste(event) {
24814
24924
  return isCmd(event) && isKey(KEYS_PASTE, event);
24815
24925
  }
24816
24926
 
24927
+ /**
24928
+ * @param {KeyboardEvent} event
24929
+ */
24817
24930
  function isUndo(event) {
24818
24931
  return isCmd(event) && !isShift(event) && isKey(KEYS_UNDO, event);
24819
24932
  }
24820
24933
 
24934
+ /**
24935
+ * @param {KeyboardEvent} event
24936
+ */
24821
24937
  function isRedo(event) {
24822
24938
  return isCmd(event) && (
24823
24939
  isKey(KEYS_REDO, event) || (
@@ -24828,6 +24944,8 @@
24828
24944
 
24829
24945
  /**
24830
24946
  * @typedef {import('../../core/EventBus').default} EventBus
24947
+ *
24948
+ * @typedef {({ keyEvent: KeyboardEvent }) => any} Listener
24831
24949
  */
24832
24950
 
24833
24951
  var KEYDOWN_EVENT = 'keyboard.keydown',
@@ -24859,6 +24977,7 @@
24859
24977
  * `keyboard.bindTo` configuration option.
24860
24978
  *
24861
24979
  * @param {Object} config
24980
+ * @param {EventTarget} [config.bindTo]
24862
24981
  * @param {EventBus} eventBus
24863
24982
  */
24864
24983
  function Keyboard(config, eventBus) {
@@ -24950,6 +25069,11 @@
24950
25069
  return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');
24951
25070
  };
24952
25071
 
25072
+ /**
25073
+ * Bind keyboard events to the given DOM node.
25074
+ *
25075
+ * @param {EventTarget} node
25076
+ */
24953
25077
  Keyboard.prototype.bind = function(node) {
24954
25078
 
24955
25079
  // make sure that the keyboard is only bound once to the DOM
@@ -24964,6 +25088,9 @@
24964
25088
  this._fire('bind');
24965
25089
  };
24966
25090
 
25091
+ /**
25092
+ * @return {EventTarget}
25093
+ */
24967
25094
  Keyboard.prototype.getBinding = function() {
24968
25095
  return this._node;
24969
25096
  };
@@ -24982,6 +25109,9 @@
24982
25109
  this._node = null;
24983
25110
  };
24984
25111
 
25112
+ /**
25113
+ * @param {string} event
25114
+ */
24985
25115
  Keyboard.prototype._fire = function(event) {
24986
25116
  this._eventBus.fire('keyboard.' + event, { node: this._node });
24987
25117
  };
@@ -24992,8 +25122,8 @@
24992
25122
  * provided, the default value of 1000 is used.
24993
25123
  *
24994
25124
  * @param {number} [priority]
24995
- * @param {Function} listener
24996
- * @param {string} type
25125
+ * @param {Listener} listener
25126
+ * @param {string} [type='keyboard.keydown']
24997
25127
  */
24998
25128
  Keyboard.prototype.addListener = function(priority, listener, type) {
24999
25129
  if (isFunction(priority)) {
@@ -25005,6 +25135,12 @@
25005
25135
  this._eventBus.on(type || KEYDOWN_EVENT, priority, listener);
25006
25136
  };
25007
25137
 
25138
+ /**
25139
+ * Remove a listener function.
25140
+ *
25141
+ * @param {Listener} listener
25142
+ * @param {string} [type='keyboard.keydown']
25143
+ */
25008
25144
  Keyboard.prototype.removeListener = function(listener, type) {
25009
25145
  this._eventBus.off(type || KEYDOWN_EVENT, listener);
25010
25146
  };
@@ -25277,15 +25413,21 @@
25277
25413
  }
25278
25414
  }
25279
25415
 
25280
- this.moveCanvas = function(opts) {
25416
+ /**
25417
+ * @param {{
25418
+ * direction: 'up' | 'down' | 'left' | 'right';
25419
+ * speed: number;
25420
+ * }} options
25421
+ */
25422
+ this.moveCanvas = function(options) {
25281
25423
 
25282
25424
  var dx = 0,
25283
25425
  dy = 0,
25284
- speed = opts.speed;
25426
+ speed = options.speed;
25285
25427
 
25286
25428
  var actualSpeed = speed / Math.min(Math.sqrt(canvas.viewbox().scale), 1);
25287
25429
 
25288
- switch (opts.direction) {
25430
+ switch (options.direction) {
25289
25431
  case 'left': // Left
25290
25432
  dx = actualSpeed;
25291
25433
  break;
@@ -25328,7 +25470,9 @@
25328
25470
 
25329
25471
  var CURSOR_CLS_PATTERN = /^djs-cursor-.*$/;
25330
25472
 
25331
-
25473
+ /**
25474
+ * @param {string} mode
25475
+ */
25332
25476
  function set(mode) {
25333
25477
  var classes = classes$1(document.body);
25334
25478
 
@@ -25343,12 +25487,19 @@
25343
25487
  set(null);
25344
25488
  }
25345
25489
 
25490
+ /**
25491
+ * @typedef {import('../core/EventBus').EventBus} EventBus
25492
+ */
25493
+
25346
25494
  var TRAP_PRIORITY = 5000;
25347
25495
 
25348
25496
  /**
25349
25497
  * Installs a click trap that prevents a ghost click following a dragging operation.
25350
25498
  *
25351
- * @return {Function} a function to immediately remove the installed trap.
25499
+ * @param {EventBus} eventBus
25500
+ * @param {string} [eventName='element.click']
25501
+ *
25502
+ * @return {() => void} a function to immediately remove the installed trap.
25352
25503
  */
25353
25504
  function install(eventBus, eventName) {
25354
25505
 
@@ -25365,6 +25516,15 @@
25365
25516
  };
25366
25517
  }
25367
25518
 
25519
+ /**
25520
+ * @typedef {import('../util/Types').Point} Point
25521
+ * @typedef {import('../util/Types').Rect} Rect
25522
+ */
25523
+
25524
+ /**
25525
+ * @param {Rect} bounds
25526
+ * @return {Point}
25527
+ */
25368
25528
  function center(bounds) {
25369
25529
  return {
25370
25530
  x: bounds.x + (bounds.width / 2),
@@ -25373,6 +25533,11 @@
25373
25533
  }
25374
25534
 
25375
25535
 
25536
+ /**
25537
+ * @param {Point} a
25538
+ * @param {Point} b
25539
+ * @return {Point}
25540
+ */
25376
25541
  function delta(a, b) {
25377
25542
  return {
25378
25543
  x: a.x - b.x,
@@ -25521,6 +25686,7 @@
25521
25686
  * @param {Object} range
25522
25687
  * @param {number} range.min
25523
25688
  * @param {number} range.max
25689
+ * @param {number} steps
25524
25690
  */
25525
25691
  function getStepSize(range, steps) {
25526
25692
 
@@ -25532,6 +25698,12 @@
25532
25698
  return absoluteLinearRange / steps;
25533
25699
  }
25534
25700
 
25701
+ /**
25702
+ * @param {Object} range
25703
+ * @param {number} range.min
25704
+ * @param {number} range.max
25705
+ * @param {number} scale
25706
+ */
25535
25707
  function cap(range, scale) {
25536
25708
  return Math.max(range.min, Math.min(range.max, scale));
25537
25709
  }
@@ -29588,16 +29760,20 @@
29588
29760
 
29589
29761
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
29590
29762
 
29763
+ /**
29764
+ * @typedef {import('./PopupMenuProvider').PopupMenuEntry} PopupMenuEntry
29765
+ */
29766
+
29591
29767
  /**
29592
29768
  * Component that renders a popup menu entry.
29593
29769
  *
29594
29770
  * @param {Object} props
29595
29771
  * @param {string} props.key
29596
- * @param {Object} props.entry
29772
+ * @param {PopupMenuEntry} props.entry
29597
29773
  * @param {boolean} props.selected
29598
- * @param {Function} props.onMouseEnter
29599
- * @param {Function} props.onMouseLeave
29600
- * @param {Function} props.onAction
29774
+ * @param {(event: MouseEvent) => void} props.onMouseEnter
29775
+ * @param {(event: MouseEvent) => void} props.onMouseLeave
29776
+ * @param {(event: MouseEvent, entry?: PopupMenuEntry, action?: string) => void} props.onAction
29601
29777
  */
29602
29778
  function PopupMenuItem(props) {
29603
29779
  const {
@@ -29661,15 +29837,17 @@
29661
29837
  `;
29662
29838
  }
29663
29839
 
29840
+ /**
29841
+ * @typedef {import('./PopupMenuProvider').PopupMenuEntry} PopupMenuEntry
29842
+ */
29843
+
29664
29844
  /**
29665
29845
  * Component that renders a popup menu entry list.
29666
29846
  *
29667
29847
  * @param {Object} props
29668
- * @param {Array} props.entries
29669
- * @param {Object} props.selectedEntry
29670
- * @param {Function} props.setSelectedEntry
29671
- * @param {Function} props.onAction
29672
- * @param {Object} props.resultsRef
29848
+ * @param {PopupMenuEntry[]} props.entries
29849
+ * @param {PopupMenuEntry} props.selectedEntry
29850
+ * @param {(entry: PopupMenuEntry | null) => void} props.setSelectedEntry
29673
29851
  */
29674
29852
  function PopupMenuList(props) {
29675
29853
  const {
@@ -29763,15 +29941,22 @@
29763
29941
  }
29764
29942
  }
29765
29943
 
29944
+ /**
29945
+ * @typedef {import('./PopupMenuProvider').PopupMenuEntry} PopupMenuEntry
29946
+ * @typedef {import('./PopupMenuProvider').PopupMenuHeaderEntry} PopupMenuHeaderEntry
29947
+ *
29948
+ * @typedef {import('../../util/Types').Point} Point
29949
+ */
29950
+
29766
29951
  /**
29767
29952
  * A component that renders the popup menus.
29768
29953
  *
29769
29954
  * @param {Object} props
29770
- * @param {function} props.onClose
29771
- * @param {function} props.position
29955
+ * @param {() => void} props.onClose
29956
+ * @param {(element: HTMLElement) => Point} props.position
29772
29957
  * @param {string} props.className
29773
- * @param {Array} props.entries
29774
- * @param {Array} props.headerEntries
29958
+ * @param {PopupMenuEntry[]} props.entries
29959
+ * @param {PopupMenuHeaderEntry[]} props.headerEntries
29775
29960
  * @param {number} props.scale
29776
29961
  * @param {string} [props.title]
29777
29962
  * @param {boolean} [props.search]
@@ -30988,6 +31173,8 @@
30988
31173
  };
30989
31174
 
30990
31175
  /**
31176
+ * @typedef {import('../../model/Types').Connection} Connection
31177
+ * @typedef {import('../../model/Types').Element} Element
30991
31178
  * @typedef {import('../../model/Types').Shape} Shape
30992
31179
  *
30993
31180
  * @typedef {import('../../util/Types').Point} Point
@@ -31007,7 +31194,7 @@
31007
31194
  * @param {Shape} source
31008
31195
  * @param {Shape} element
31009
31196
  * @param {Point} position
31010
- * @param {Function} getNextPosition
31197
+ * @param {(element: Element, position: Point, connectedAtPosition: Element) => Element} getNextPosition
31011
31198
  *
31012
31199
  * @return {Point}
31013
31200
  */
@@ -31028,7 +31215,7 @@
31028
31215
  * @param {Object} [nextPositionDirection.x]
31029
31216
  * @param {Object} [nextPositionDirection.y]
31030
31217
  *
31031
- * @return {Function}
31218
+ * @return {(element: Element, previousPosition: Point, connectedAtPosition: Element) => Point}
31032
31219
  */
31033
31220
  function generateGetNextPosition(nextPositionDirection) {
31034
31221
  return function(element, previousPosition, connectedAtPosition) {
@@ -31104,8 +31291,8 @@
31104
31291
  * @param {Object} [hints]
31105
31292
  * @param {number} [hints.defaultDistance]
31106
31293
  * @param {string} [hints.direction]
31107
- * @param {Function} [hints.filter]
31108
- * @param {Function} [hints.getWeight]
31294
+ * @param {(connection: Connection) => boolean} [hints.filter]
31295
+ * @param {(connection: Connection) => number} [hints.getWeight]
31109
31296
  * @param {number} [hints.maxDistance]
31110
31297
  * @param {string} [hints.reference]
31111
31298
  *
@@ -32309,6 +32496,7 @@
32309
32496
  *
32310
32497
  * @example
32311
32498
  *
32499
+ * ```javascript
32312
32500
  * function MyDragComponent(eventBus, dragging) {
32313
32501
  *
32314
32502
  * eventBus.on('mydrag.start', function(event) {
@@ -32336,6 +32524,7 @@
32336
32524
  * });
32337
32525
  * });
32338
32526
  * }
32527
+ * ```
32339
32528
  *
32340
32529
  * @param {EventBus} eventBus
32341
32530
  * @param {Canvas} canvas
@@ -32645,7 +32834,7 @@
32645
32834
  * relative to it.
32646
32835
  *
32647
32836
  * @param {MouseEvent|TouchEvent} [event]
32648
- * @param {Point} [localPosition] actual diagram local position this drag operation should start at
32837
+ * @param {Point} [relativeTo] actual diagram local position this drag operation should start at
32649
32838
  * @param {string} prefix
32650
32839
  * @param {Object} [options]
32651
32840
  */
@@ -33011,6 +33200,12 @@
33011
33200
 
33012
33201
  /**
33013
33202
  * @typedef {import('../util/Types').Point} Point
33203
+ *
33204
+ * @typedef { {
33205
+ * bendpoint?: boolean;
33206
+ * index: number;
33207
+ * point: Point;
33208
+ * } } Intersection
33014
33209
  */
33015
33210
 
33016
33211
  var round$9 = Math.round,
@@ -33043,6 +33238,12 @@
33043
33238
 
33044
33239
  var INTERSECTION_THRESHOLD$1 = 10;
33045
33240
 
33241
+ /**
33242
+ * @param {Point[]} waypoints
33243
+ * @param {Point} reference
33244
+ *
33245
+ * @return {Intersection|null}
33246
+ */
33046
33247
  function getBendpointIntersection(waypoints, reference) {
33047
33248
 
33048
33249
  var i, w;
@@ -33061,6 +33262,12 @@
33061
33262
  return null;
33062
33263
  }
33063
33264
 
33265
+ /**
33266
+ * @param {Point[]} waypoints
33267
+ * @param {Point} reference
33268
+ *
33269
+ * @return {Intersection|null}
33270
+ */
33064
33271
  function getPathIntersection(waypoints, reference) {
33065
33272
 
33066
33273
  var intersections = intersectPaths(circlePath(reference, INTERSECTION_THRESHOLD$1), linePath(waypoints));
@@ -33115,7 +33322,7 @@
33115
33322
  * @param {Point[]} waypoints
33116
33323
  * @param {Point} reference
33117
33324
  *
33118
- * @return {Object} intersection data (segment, point)
33325
+ * @return {Intersection|null}
33119
33326
  */
33120
33327
  function getApproxIntersection(waypoints, reference) {
33121
33328
  return getBendpointIntersection(waypoints, reference) || getPathIntersection(waypoints, reference);
@@ -37545,6 +37752,8 @@
37545
37752
  * Create a tree-like structure from elements.
37546
37753
  *
37547
37754
  * @example
37755
+ *
37756
+ * ```javascript
37548
37757
  * tree: {
37549
37758
  * 0: [
37550
37759
  * { id: 'Shape_1', priority: 1, ... },
@@ -37557,6 +37766,7 @@
37557
37766
  * ...
37558
37767
  * ]
37559
37768
  * };
37769
+ * ```
37560
37770
  *
37561
37771
  * @param {Element[]} elements
37562
37772
  *
@@ -41208,18 +41418,24 @@
41208
41418
  };
41209
41419
 
41210
41420
  /**
41211
- * @typedef {Object} Range
41212
- * @property {number} min
41213
- * @property {number} max
41214
- */
41215
-
41216
- /**
41421
+ * @typedef {import('../../model/Types').Element} Element
41422
+ *
41217
41423
  * @typedef {import('../../util/Types').Axis} Axis
41218
41424
  * @typedef {import('../../util/Types').Dimension} Dimension
41219
41425
  * @typedef {import('../../util/Types').Rect} Rect
41220
41426
  *
41221
41427
  * @typedef {import('../modeling/Modeling').default} Modeling
41222
41428
  * @typedef {import('../rules/Rules').default} Rules
41429
+ *
41430
+ * @typedef { {
41431
+ * min: number;
41432
+ * max: number;
41433
+ * } } Range
41434
+ *
41435
+ * @typedef { {
41436
+ * elements: Element[];
41437
+ * range: Range;
41438
+ * } } Group
41223
41439
  */
41224
41440
 
41225
41441
  var AXIS_DIMENSIONS = {
@@ -41259,7 +41475,7 @@
41259
41475
  * Registers filter functions that allow external parties to filter
41260
41476
  * out certain elements.
41261
41477
  *
41262
- * @param {Function} filterFn
41478
+ * @param {(distributableElements: Element[], axis: Axis, dimension: Dimension) => Element[]} filterFn
41263
41479
  */
41264
41480
  DistributeElements$1.prototype.registerFilter = function(filterFn) {
41265
41481
  if (typeof filterFn !== 'function') {
@@ -41272,7 +41488,7 @@
41272
41488
  /**
41273
41489
  * Distributes the elements with a given orientation
41274
41490
  *
41275
- * @param {Array} elements
41491
+ * @param {Element[]} elements
41276
41492
  * @param {string} orientation
41277
41493
  */
41278
41494
  DistributeElements$1.prototype.trigger = function(elements, orientation) {
@@ -41304,9 +41520,9 @@
41304
41520
  /**
41305
41521
  * Filters the elements with provided filters by external parties
41306
41522
  *
41307
- * @param {Array[Elements]} elements
41523
+ * @param {Element[]} elements
41308
41524
  *
41309
- * @return {Array[Elements]}
41525
+ * @return {Element[]}
41310
41526
  */
41311
41527
  DistributeElements$1.prototype._filterElements = function(elements) {
41312
41528
  var filters = this._filters,
@@ -41331,19 +41547,19 @@
41331
41547
  * together that share the same range.
41332
41548
  *
41333
41549
  * @example
41334
- * var distributableElements = [
41335
- * {
41336
- * range: {
41337
- * min: 100,
41338
- * max: 200
41339
- * },
41340
- * elements: [ { id: 'shape1', .. }]
41341
- * }
41342
- * ]
41343
41550
  *
41344
- * @param {Array} elements
41551
+ * ```javascript
41552
+ * const groups = [
41553
+ * {
41554
+ * range: { min: 100, max: 200 },
41555
+ * elements: [ { id: 'shape1', ... } ]
41556
+ * }
41557
+ * ]
41558
+ * ```
41559
+ *
41560
+ * @param {Element[]} elements
41345
41561
  *
41346
- * @return {Array[Objects]}
41562
+ * @return {Group[]}
41347
41563
  */
41348
41564
  DistributeElements$1.prototype._createGroups = function(elements) {
41349
41565
  var rangeGroups = [],
@@ -41378,9 +41594,9 @@
41378
41594
 
41379
41595
 
41380
41596
  /**
41381
- * Maps a direction to the according axis and dimension
41597
+ * Maps a direction to the according axis and dimension.
41382
41598
  *
41383
- * @param {string} direction 'horizontal' or 'vertical'
41599
+ * @param {'horizontal' | 'vertical'} direction 'horizontal' or 'vertical'
41384
41600
  */
41385
41601
  DistributeElements$1.prototype._setOrientation = function(direction) {
41386
41602
  var orientation = AXIS_DIMENSIONS[direction];
@@ -41391,10 +41607,10 @@
41391
41607
 
41392
41608
 
41393
41609
  /**
41394
- * Checks if the two ranges intercept each other
41610
+ * Checks if the two ranges intercept each other.
41395
41611
  *
41396
- * @param {Object} rangeA {min, max}
41397
- * @param {Object} rangeB {min, max}
41612
+ * @param {Range} rangeA
41613
+ * @param {Range} rangeB
41398
41614
  *
41399
41615
  * @return {boolean}
41400
41616
  */
@@ -41407,9 +41623,7 @@
41407
41623
  /**
41408
41624
  * Returns the min and max values for an element
41409
41625
  *
41410
- * @param {Rect} element
41411
- * @param {Axis} axis
41412
- * @param {Dimension} dimension
41626
+ * @param {Element} element
41413
41627
  *
41414
41628
  * @return {Range}
41415
41629
  */
@@ -41773,7 +41987,8 @@
41773
41987
  * The key of the object will be the name of the action.
41774
41988
  *
41775
41989
  * @example
41776
- * ´´´
41990
+ *
41991
+ * ```javascript
41777
41992
  * var actions = {
41778
41993
  * spaceTool: function() {
41779
41994
  * spaceTool.activateSelection();
@@ -41786,7 +42001,7 @@
41786
42001
  * editorActions.register(actions);
41787
42002
  *
41788
42003
  * editorActions.isRegistered('spaceTool'); // true
41789
- * ´´´
42004
+ * ```
41790
42005
  *
41791
42006
  * @param {Object} actions
41792
42007
  */
@@ -54120,7 +54335,7 @@
54120
54335
  /**
54121
54336
  * Remove tooltip with given ID.
54122
54337
  *
54123
- * @param {string} id
54338
+ * @param {string | Tooltip} id
54124
54339
  */
54125
54340
  Tooltips.prototype.remove = function(id) {
54126
54341
 
@@ -54270,7 +54485,7 @@
54270
54485
  * at a time.
54271
54486
  *
54272
54487
  * @param {Object[]} [collection]
54273
- * @param {Function} removeFn
54488
+ * @param {(element: Object) => void} removeFn
54274
54489
  *
54275
54490
  * @return {Object[]} the cleared collection
54276
54491
  */
@@ -57131,23 +57346,56 @@
57131
57346
  return connection;
57132
57347
  };
57133
57348
 
57349
+ /**
57350
+ * @typedef {import('../../../../model/Types').Connection} Connection
57351
+ * @typedef {import('../../../../model/Types').Element} Element
57352
+ * @typedef {import('../../../../model/Types').Shape} Shape
57353
+ */
57354
+
57134
57355
  function MoveClosure() {
57135
57356
 
57357
+ /**
57358
+ * @type {Record<string, Shape>}
57359
+ */
57136
57360
  this.allShapes = {};
57361
+
57362
+ /**
57363
+ * @type {Record<string, Connection>}
57364
+ */
57137
57365
  this.allConnections = {};
57138
57366
 
57367
+ /**
57368
+ * @type {Record<string, Element>}
57369
+ */
57139
57370
  this.enclosedElements = {};
57371
+
57372
+ /**
57373
+ * @type {Record<string, Connection>}
57374
+ */
57140
57375
  this.enclosedConnections = {};
57141
57376
 
57377
+ /**
57378
+ * @type {Record<string, Element>}
57379
+ */
57142
57380
  this.topLevel = {};
57143
57381
  }
57144
57382
 
57145
-
57383
+ /**
57384
+ * @param {Element} element
57385
+ * @param {boolean} [isTopLevel]
57386
+ *
57387
+ * @return {MoveClosure}
57388
+ */
57146
57389
  MoveClosure.prototype.add = function(element, isTopLevel) {
57147
57390
  return this.addAll([ element ], isTopLevel);
57148
57391
  };
57149
57392
 
57150
-
57393
+ /**
57394
+ * @param {Element[]} elements
57395
+ * @param {boolean} [isTopLevel]
57396
+ *
57397
+ * @return {MoveClosure}
57398
+ */
57151
57399
  MoveClosure.prototype.addAll = function(elements, isTopLevel) {
57152
57400
 
57153
57401
  var newClosure = getClosure(elements, !!isTopLevel, this);
@@ -60781,7 +61029,6 @@
60781
61029
  * @param {Rect} target target rectangle
60782
61030
  * @param {Point} [start] source docking
60783
61031
  * @param {Point} [end] target docking
60784
- *
60785
61032
  * @param {Object} [hints]
60786
61033
  * @param {string} [hints.preserveDocking=source] preserve docking on selected side
60787
61034
  * @param {string[]} [hints.preferredLayouts]
@@ -60904,6 +61151,7 @@
60904
61151
  * @param {Point} start
60905
61152
  * @param {Point} end
60906
61153
  * @param {Object} [hints]
61154
+ * @param {string} [hints.preserveDocking]
60907
61155
  *
60908
61156
  * @return {Point[]|null} The waypoints or null if layout isn't possible.
60909
61157
  */
@@ -61119,12 +61367,13 @@
61119
61367
  *
61120
61368
  * @example
61121
61369
  *
61370
+ * ```javascript
61122
61371
  * getDirections('top'); // -> 'v:v'
61123
61372
  * getDirections('intersect'); // -> 't:t'
61124
61373
  *
61125
61374
  * getDirections('top-right', 'v:h'); // -> 'v:h'
61126
61375
  * getDirections('top-right', 'h:h'); // -> 'h:h'
61127
- *
61376
+ * ```
61128
61377
  *
61129
61378
  * @param {string} orientation
61130
61379
  * @param {string} defaultLayout
@@ -61955,7 +62204,7 @@
61955
62204
  * Start move.
61956
62205
  *
61957
62206
  * @param {MouseEvent|TouchEvent} event
61958
- * @param {Shape} shape
62207
+ * @param {Shape} element
61959
62208
  * @param {boolean} [activate]
61960
62209
  * @param {Object} [context]
61961
62210
  */