bpmn-js 13.0.2 → 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 (175) hide show
  1. package/dist/bpmn-modeler.development.js +580 -379
  2. package/dist/bpmn-modeler.production.min.js +6 -6
  3. package/dist/bpmn-navigated-viewer.development.js +354 -198
  4. package/dist/bpmn-navigated-viewer.production.min.js +4 -4
  5. package/dist/bpmn-viewer.development.js +275 -190
  6. package/dist/bpmn-viewer.production.min.js +4 -4
  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/BpmnRenderer.js +1 -1
  17. package/lib/draw/PathMap.d.ts +330 -330
  18. package/lib/draw/TextRenderer.d.ts +74 -74
  19. package/lib/draw/index.d.ts +10 -10
  20. package/lib/features/align-elements/AlignElementsContextPadProvider.d.ts +32 -32
  21. package/lib/features/align-elements/AlignElementsIcons.d.ts +10 -10
  22. package/lib/features/align-elements/AlignElementsMenuProvider.d.ts +32 -32
  23. package/lib/features/align-elements/BpmnAlignElements.d.ts +9 -9
  24. package/lib/features/align-elements/index.d.ts +11 -11
  25. package/lib/features/auto-place/BpmnAutoPlace.d.ts +13 -13
  26. package/lib/features/auto-place/BpmnAutoPlaceUtil.d.ts +47 -47
  27. package/lib/features/auto-place/index.d.ts +7 -7
  28. package/lib/features/auto-resize/BpmnAutoResize.d.ts +25 -25
  29. package/lib/features/auto-resize/BpmnAutoResizeProvider.d.ts +26 -26
  30. package/lib/features/auto-resize/index.d.ts +8 -8
  31. package/lib/features/context-pad/ContextPadProvider.d.ts +60 -60
  32. package/lib/features/context-pad/index.d.ts +7 -7
  33. package/lib/features/copy-paste/BpmnCopyPaste.d.ts +17 -17
  34. package/lib/features/copy-paste/ModdleCopy.d.ts +45 -45
  35. package/lib/features/copy-paste/index.d.ts +9 -9
  36. package/lib/features/di-ordering/BpmnDiOrdering.d.ts +11 -11
  37. package/lib/features/di-ordering/index.d.ts +6 -6
  38. package/lib/features/distribute-elements/BpmnDistributeElements.d.ts +10 -10
  39. package/lib/features/distribute-elements/DistributeElementsIcons.d.ts +5 -5
  40. package/lib/features/distribute-elements/DistributeElementsMenuProvider.d.ts +32 -32
  41. package/lib/features/distribute-elements/index.d.ts +9 -9
  42. package/lib/features/drilldown/DrilldownBreadcrumbs.d.ts +19 -19
  43. package/lib/features/drilldown/DrilldownCentering.d.ts +17 -17
  44. package/lib/features/drilldown/DrilldownOverlayBehavior.d.ts +18 -18
  45. package/lib/features/drilldown/SubprocessCompatibility.d.ts +21 -21
  46. package/lib/features/drilldown/index.d.ts +13 -13
  47. package/lib/features/editor-actions/BpmnEditorActions.d.ts +13 -13
  48. package/lib/features/editor-actions/index.d.ts +6 -6
  49. package/lib/features/grid-snapping/BpmnGridSnapping.d.ts +9 -9
  50. package/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.d.ts +12 -12
  51. package/lib/features/grid-snapping/behavior/GridSnappingLayoutConnectionBehavior.d.ts +27 -27
  52. package/lib/features/grid-snapping/behavior/GridSnappingParticipantBehavior.d.ts +13 -13
  53. package/lib/features/grid-snapping/behavior/index.d.ts +10 -10
  54. package/lib/features/grid-snapping/index.d.ts +11 -11
  55. package/lib/features/interaction-events/BpmnInteractionEvents.d.ts +18 -18
  56. package/lib/features/interaction-events/index.d.ts +6 -6
  57. package/lib/features/keyboard/BpmnKeyboardBindings.d.ts +15 -15
  58. package/lib/features/keyboard/index.d.ts +7 -7
  59. package/lib/features/label-editing/LabelEditingPreview.d.ts +13 -13
  60. package/lib/features/label-editing/LabelEditingProvider.d.ts +62 -62
  61. package/lib/features/label-editing/LabelEditingProvider.js +1 -1
  62. package/lib/features/label-editing/LabelUtil.d.ts +1 -14
  63. package/lib/features/label-editing/LabelUtil.js +4 -82
  64. package/lib/features/label-editing/cmd/UpdateLabelHandler.d.ts +22 -22
  65. package/lib/features/label-editing/cmd/UpdateLabelHandler.js +2 -28
  66. package/lib/features/label-editing/index.d.ts +9 -9
  67. package/lib/features/modeling/BpmnFactory.d.ts +73 -73
  68. package/lib/features/modeling/BpmnLayouter.d.ts +26 -26
  69. package/lib/features/modeling/BpmnUpdater.d.ts +92 -92
  70. package/lib/features/modeling/BpmnUpdater.js +28 -2
  71. package/lib/features/modeling/ElementFactory.d.ts +119 -119
  72. package/lib/features/modeling/Modeling.d.ts +150 -150
  73. package/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.d.ts +20 -20
  74. package/lib/features/modeling/behavior/AppendBehavior.d.ts +6 -6
  75. package/lib/features/modeling/behavior/AssociationBehavior.d.ts +11 -11
  76. package/lib/features/modeling/behavior/AttachEventBehavior.d.ts +15 -15
  77. package/lib/features/modeling/behavior/BoundaryEventBehavior.d.ts +15 -15
  78. package/lib/features/modeling/behavior/CreateBehavior.d.ts +9 -9
  79. package/lib/features/modeling/behavior/CreateDataObjectBehavior.d.ts +15 -15
  80. package/lib/features/modeling/behavior/CreateParticipantBehavior.d.ts +19 -19
  81. package/lib/features/modeling/behavior/DataInputAssociationBehavior.d.ts +21 -21
  82. package/lib/features/modeling/behavior/DataStoreBehavior.d.ts +19 -19
  83. package/lib/features/modeling/behavior/DeleteLaneBehavior.d.ts +15 -15
  84. package/lib/features/modeling/behavior/DetachEventBehavior.d.ts +15 -15
  85. package/lib/features/modeling/behavior/DropOnFlowBehavior.d.ts +13 -13
  86. package/lib/features/modeling/behavior/EventBasedGatewayBehavior.d.ts +11 -11
  87. package/lib/features/modeling/behavior/FixHoverBehavior.d.ts +17 -17
  88. package/lib/features/modeling/behavior/GroupBehavior.d.ts +26 -26
  89. package/lib/features/modeling/behavior/ImportDockingFix.d.ts +13 -13
  90. package/lib/features/modeling/behavior/IsHorizontalFix.d.ts +10 -10
  91. package/lib/features/modeling/behavior/LabelBehavior.d.ts +56 -56
  92. package/lib/features/modeling/behavior/LabelBehavior.js +15 -66
  93. package/lib/features/modeling/behavior/LayoutConnectionBehavior.d.ts +16 -16
  94. package/lib/features/modeling/behavior/MessageFlowBehavior.d.ts +15 -15
  95. package/lib/features/modeling/behavior/ModelingFeedback.d.ts +13 -13
  96. package/lib/features/modeling/behavior/RemoveElementBehavior.d.ts +13 -13
  97. package/lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.d.ts +16 -16
  98. package/lib/features/modeling/behavior/RemoveParticipantBehavior.d.ts +15 -15
  99. package/lib/features/modeling/behavior/ReplaceConnectionBehavior.d.ts +15 -15
  100. package/lib/features/modeling/behavior/ReplaceElementBehaviour.d.ts +23 -23
  101. package/lib/features/modeling/behavior/ResizeBehavior.d.ts +57 -57
  102. package/lib/features/modeling/behavior/ResizeLaneBehavior.d.ts +16 -16
  103. package/lib/features/modeling/behavior/RootElementReferenceBehavior.d.ts +25 -25
  104. package/lib/features/modeling/behavior/SpaceToolBehavior.d.ts +10 -10
  105. package/lib/features/modeling/behavior/SubProcessPlaneBehavior.d.ts +28 -28
  106. package/lib/features/modeling/behavior/SubProcessStartEventBehavior.d.ts +15 -15
  107. package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.d.ts +14 -14
  108. package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.d.ts +13 -13
  109. package/lib/features/modeling/behavior/UnclaimIdBehavior.d.ts +19 -19
  110. package/lib/features/modeling/behavior/UnsetDefaultFlowBehavior.d.ts +16 -16
  111. package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.d.ts +17 -17
  112. package/lib/features/modeling/behavior/index.d.ts +2 -2
  113. package/lib/features/modeling/behavior/util/CategoryUtil.d.ts +49 -49
  114. package/lib/features/modeling/behavior/util/ConnectionLayoutUtil.d.ts +19 -19
  115. package/lib/features/modeling/behavior/util/GeometricUtil.d.ts +1 -1
  116. package/lib/features/modeling/behavior/util/LabelLayoutUtil.d.ts +32 -32
  117. package/lib/features/modeling/behavior/util/LayoutUtil.d.ts +48 -48
  118. package/lib/features/modeling/behavior/util/LineAttachmentUtil.d.ts +37 -37
  119. package/lib/features/modeling/behavior/util/LineIntersect.d.ts +13 -13
  120. package/lib/features/modeling/behavior/util/ResizeUtil.d.ts +1 -1
  121. package/lib/features/modeling/cmd/AddLaneHandler.d.ts +22 -22
  122. package/lib/features/modeling/cmd/IdClaimHandler.d.ts +22 -22
  123. package/lib/features/modeling/cmd/ResizeLaneHandler.d.ts +39 -39
  124. package/lib/features/modeling/cmd/SetColorHandler.d.ts +18 -18
  125. package/lib/features/modeling/cmd/SplitLaneHandler.d.ts +22 -22
  126. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.d.ts +20 -20
  127. package/lib/features/modeling/cmd/UpdateFlowNodeRefsHandler.d.ts +21 -21
  128. package/lib/features/modeling/cmd/UpdateModdlePropertiesHandler.d.ts +20 -20
  129. package/lib/features/modeling/cmd/UpdatePropertiesHandler.d.ts +60 -60
  130. package/lib/features/modeling/cmd/UpdateSemanticParentHandler.d.ts +18 -18
  131. package/lib/features/modeling/index.d.ts +27 -27
  132. package/lib/features/modeling/util/LaneUtil.d.ts +46 -46
  133. package/lib/features/modeling/util/ModelingUtil.d.ts +12 -12
  134. package/lib/features/ordering/BpmnOrderingProvider.d.ts +21 -21
  135. package/lib/features/ordering/index.d.ts +7 -7
  136. package/lib/features/palette/PaletteProvider.d.ts +34 -34
  137. package/lib/features/palette/index.d.ts +9 -9
  138. package/lib/features/popup-menu/ReplaceMenuProvider.d.ts +50 -50
  139. package/lib/features/popup-menu/index.d.ts +11 -11
  140. package/lib/features/popup-menu/util/TypeUtil.d.ts +14 -14
  141. package/lib/features/replace/BpmnReplace.d.ts +47 -47
  142. package/lib/features/replace/ReplaceOptions.d.ts +75 -75
  143. package/lib/features/replace/index.d.ts +9 -9
  144. package/lib/features/replace-preview/BpmnReplacePreview.d.ts +17 -17
  145. package/lib/features/replace-preview/index.d.ts +7 -7
  146. package/lib/features/rules/BpmnRules.d.ts +172 -172
  147. package/lib/features/rules/index.d.ts +7 -7
  148. package/lib/features/search/BpmnSearchProvider.d.ts +29 -29
  149. package/lib/features/search/BpmnSearchProvider.js +1 -1
  150. package/lib/features/search/index.d.ts +7 -7
  151. package/lib/features/snapping/BpmnConnectSnapping.d.ts +17 -17
  152. package/lib/features/snapping/BpmnCreateMoveSnapping.d.ts +41 -41
  153. package/lib/features/snapping/BpmnSnappingUtil.d.ts +11 -11
  154. package/lib/features/snapping/index.d.ts +9 -9
  155. package/lib/features/space-tool/BpmnSpaceTool.d.ts +21 -21
  156. package/lib/features/space-tool/index.d.ts +6 -6
  157. package/lib/import/BpmnImporter.d.ts +53 -53
  158. package/lib/import/BpmnImporter.js +2 -5
  159. package/lib/import/BpmnTreeWalker.d.ts +22 -22
  160. package/lib/import/Importer.d.ts +25 -25
  161. package/lib/import/Util.d.ts +1 -1
  162. package/lib/import/index.d.ts +6 -6
  163. package/lib/model/Types.d.ts +24 -24
  164. package/lib/util/CompatibilityUtil.d.ts +22 -22
  165. package/lib/util/DiUtil.d.ts +53 -53
  166. package/lib/util/DrilldownUtil.d.ts +39 -39
  167. package/lib/util/LabelUtil.d.ts +89 -73
  168. package/lib/util/LabelUtil.js +82 -0
  169. package/lib/util/ModelUtil.d.ts +40 -40
  170. package/lib/util/PoweredByUtil.d.ts +8 -8
  171. package/package.json +2 -2
  172. package/lib/icons/dist/append.svg +0 -1
  173. package/lib/icons/dist/connect-context-pad.svg +0 -1
  174. package/lib/icons/dist/connect-palette.svg +0 -1
  175. package/lib/icons/dist/create.svg +0 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v13.0.2
2
+ * bpmn-js - bpmn-modeler v13.0.4
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2023-04-20
11
+ * Date: 2023-04-24
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -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
  */
@@ -17859,7 +17914,183 @@
17859
17914
  }
17860
17915
 
17861
17916
  /**
17862
- * @typedef { import('../../model').DiagramElement } DiagramElement
17917
+ * @typedef {import('diagram-js/lib/util/Types').Point} Point
17918
+ * @typedef {import('diagram-js/lib/util/Types').Rect} Rect
17919
+ *
17920
+ * @typedef {import('../model/Types').Element} Element
17921
+ * @typedef {import('../model/Types').ModdleElement} ModdleElement
17922
+ */
17923
+
17924
+ var DEFAULT_LABEL_SIZE$1 = {
17925
+ width: 90,
17926
+ height: 20
17927
+ };
17928
+
17929
+ var FLOW_LABEL_INDENT = 15;
17930
+
17931
+
17932
+ /**
17933
+ * Return true if the given semantic has an external label.
17934
+ *
17935
+ * @param {Element} semantic
17936
+ *
17937
+ * @return {boolean}
17938
+ */
17939
+ function isLabelExternal(semantic) {
17940
+ return is$1(semantic, 'bpmn:Event') ||
17941
+ is$1(semantic, 'bpmn:Gateway') ||
17942
+ is$1(semantic, 'bpmn:DataStoreReference') ||
17943
+ is$1(semantic, 'bpmn:DataObjectReference') ||
17944
+ is$1(semantic, 'bpmn:DataInput') ||
17945
+ is$1(semantic, 'bpmn:DataOutput') ||
17946
+ is$1(semantic, 'bpmn:SequenceFlow') ||
17947
+ is$1(semantic, 'bpmn:MessageFlow') ||
17948
+ is$1(semantic, 'bpmn:Group');
17949
+ }
17950
+
17951
+ /**
17952
+ * Return true if the given element has an external label.
17953
+ *
17954
+ * @param {Element} element
17955
+ *
17956
+ * @return {boolean}
17957
+ */
17958
+ function hasExternalLabel(element) {
17959
+ return isLabel$5(element.label);
17960
+ }
17961
+
17962
+ /**
17963
+ * Get the position of a sequence flow label.
17964
+ *
17965
+ * @param {Point[]} waypoints
17966
+ *
17967
+ * @return {Point}
17968
+ */
17969
+ function getFlowLabelPosition(waypoints) {
17970
+
17971
+ // get the waypoints mid
17972
+ var mid = waypoints.length / 2 - 1;
17973
+
17974
+ var first = waypoints[Math.floor(mid)];
17975
+ var second = waypoints[Math.ceil(mid + 0.01)];
17976
+
17977
+ // get position
17978
+ var position = getWaypointsMid(waypoints);
17979
+
17980
+ // calculate angle
17981
+ var angle = Math.atan((second.y - first.y) / (second.x - first.x));
17982
+
17983
+ var x = position.x,
17984
+ y = position.y;
17985
+
17986
+ if (Math.abs(angle) < Math.PI / 2) {
17987
+ y -= FLOW_LABEL_INDENT;
17988
+ } else {
17989
+ x += FLOW_LABEL_INDENT;
17990
+ }
17991
+
17992
+ return { x: x, y: y };
17993
+ }
17994
+
17995
+
17996
+ /**
17997
+ * Get the middle of a number of waypoints.
17998
+ *
17999
+ * @param {Point[]} waypoints
18000
+ *
18001
+ * @return {Point}
18002
+ */
18003
+ function getWaypointsMid(waypoints) {
18004
+
18005
+ var mid = waypoints.length / 2 - 1;
18006
+
18007
+ var first = waypoints[Math.floor(mid)];
18008
+ var second = waypoints[Math.ceil(mid + 0.01)];
18009
+
18010
+ return {
18011
+ x: first.x + (second.x - first.x) / 2,
18012
+ y: first.y + (second.y - first.y) / 2
18013
+ };
18014
+ }
18015
+
18016
+ /**
18017
+ * Get the middle of the external label of an element.
18018
+ *
18019
+ * @param {Element} element
18020
+ *
18021
+ * @return {Point}
18022
+ */
18023
+ function getExternalLabelMid(element) {
18024
+
18025
+ if (element.waypoints) {
18026
+ return getFlowLabelPosition(element.waypoints);
18027
+ } else if (is$1(element, 'bpmn:Group')) {
18028
+ return {
18029
+ x: element.x + element.width / 2,
18030
+ y: element.y + DEFAULT_LABEL_SIZE$1.height / 2
18031
+ };
18032
+ } else {
18033
+ return {
18034
+ x: element.x + element.width / 2,
18035
+ y: element.y + element.height + DEFAULT_LABEL_SIZE$1.height / 2
18036
+ };
18037
+ }
18038
+ }
18039
+
18040
+
18041
+ /**
18042
+ * Return the bounds of an elements label, parsed from the elements DI or
18043
+ * generated from its bounds.
18044
+ *
18045
+ * @param {ModdleElement} di
18046
+ * @param {Element} element
18047
+ *
18048
+ * @return {Rect}
18049
+ */
18050
+ function getExternalLabelBounds(di, element) {
18051
+
18052
+ var mid,
18053
+ size,
18054
+ bounds,
18055
+ label = di.label;
18056
+
18057
+ if (label && label.bounds) {
18058
+ bounds = label.bounds;
18059
+
18060
+ size = {
18061
+ width: Math.max(DEFAULT_LABEL_SIZE$1.width, bounds.width),
18062
+ height: bounds.height
18063
+ };
18064
+
18065
+ mid = {
18066
+ x: bounds.x + bounds.width / 2,
18067
+ y: bounds.y + bounds.height / 2
18068
+ };
18069
+ } else {
18070
+
18071
+ mid = getExternalLabelMid(element);
18072
+
18073
+ size = DEFAULT_LABEL_SIZE$1;
18074
+ }
18075
+
18076
+ return assign$1({
18077
+ x: mid.x - size.width / 2,
18078
+ y: mid.y - size.height / 2
18079
+ }, size);
18080
+ }
18081
+
18082
+ /**
18083
+ * @param {Element} element
18084
+ *
18085
+ * @return {boolean}
18086
+ */
18087
+ function isLabel$5(element) {
18088
+ return element && !!element.labelTarget;
18089
+ }
18090
+
18091
+
18092
+ /**
18093
+ * @typedef { import('../model').DiagramElement } DiagramElement
17863
18094
  */
17864
18095
 
17865
18096
  function getLabelAttr(semantic) {
@@ -17985,7 +18216,7 @@
17985
18216
  // color access //////////////////////
17986
18217
 
17987
18218
  /**
17988
- * @param {DiagramElement} element
18219
+ * @param {Element} element
17989
18220
  * @param {string} [defaultColor]
17990
18221
  *
17991
18222
  * @return {string}
@@ -17997,7 +18228,7 @@
17997
18228
  }
17998
18229
 
17999
18230
  /**
18000
- * @param {DiagramElement} element
18231
+ * @param {Element} element
18001
18232
  * @param {string} [defaultColor]
18002
18233
  *
18003
18234
  * @return {string}
@@ -18009,9 +18240,9 @@
18009
18240
  }
18010
18241
 
18011
18242
  /**
18012
- * @param {DiagramElement} element
18013
- * @param {string} defaultColor
18014
- * @param {string} defaultStrokeColor
18243
+ * @param {Element} element
18244
+ * @param {string} [defaultColor]
18245
+ * @param {string} [defaultStrokeColor]
18015
18246
  *
18016
18247
  * @return {string}
18017
18248
  */
@@ -20068,7 +20299,7 @@
20068
20299
  *
20069
20300
  * @typedef { Partial<{
20070
20301
  * align: AlignmentConfig;
20071
- * style: Record<string, any>;
20302
+ * style: Record<string, number | string>;
20072
20303
  * padding: PaddingConfig;
20073
20304
  * }> } BaseTextConfig
20074
20305
  *
@@ -20088,7 +20319,7 @@
20088
20319
 
20089
20320
  var DEFAULT_BOX_PADDING = 0;
20090
20321
 
20091
- var DEFAULT_LABEL_SIZE$1 = {
20322
+ var DEFAULT_LABEL_SIZE = {
20092
20323
  width: 150,
20093
20324
  height: 50
20094
20325
  };
@@ -20175,6 +20406,8 @@
20175
20406
  * Alters the lines passed.
20176
20407
  *
20177
20408
  * @param {string[]} lines
20409
+ * @param {number} maxWidth
20410
+ * @param {SVGTextElement} fakeText
20178
20411
  *
20179
20412
  * @return {LineDescriptor} the line descriptor
20180
20413
  */
@@ -20328,7 +20561,7 @@
20328
20561
  function Text(config) {
20329
20562
 
20330
20563
  this._config = assign$1({}, {
20331
- size: DEFAULT_LABEL_SIZE$1,
20564
+ size: DEFAULT_LABEL_SIZE,
20332
20565
  padding: DEFAULT_BOX_PADDING,
20333
20566
  style: {},
20334
20567
  align: 'center-top'
@@ -21141,181 +21374,6 @@
21141
21374
  translate: [ 'value', translate$1 ]
21142
21375
  };
21143
21376
 
21144
- /**
21145
- * @typedef {import('diagram-js/lib/util/Types').Point} Point
21146
- * @typedef {import('diagram-js/lib/util/Types').Rect} Rect
21147
- *
21148
- * @typedef {import('../model/Types').Element} Element
21149
- * @typedef {import('../model/Types').ModdleElement} ModdleElement
21150
- */
21151
-
21152
- var DEFAULT_LABEL_SIZE = {
21153
- width: 90,
21154
- height: 20
21155
- };
21156
-
21157
- var FLOW_LABEL_INDENT = 15;
21158
-
21159
-
21160
- /**
21161
- * Return true if the given semantic has an external label.
21162
- *
21163
- * @param {Element} semantic
21164
- *
21165
- * @return {boolean}
21166
- */
21167
- function isLabelExternal(semantic) {
21168
- return is$1(semantic, 'bpmn:Event') ||
21169
- is$1(semantic, 'bpmn:Gateway') ||
21170
- is$1(semantic, 'bpmn:DataStoreReference') ||
21171
- is$1(semantic, 'bpmn:DataObjectReference') ||
21172
- is$1(semantic, 'bpmn:DataInput') ||
21173
- is$1(semantic, 'bpmn:DataOutput') ||
21174
- is$1(semantic, 'bpmn:SequenceFlow') ||
21175
- is$1(semantic, 'bpmn:MessageFlow') ||
21176
- is$1(semantic, 'bpmn:Group');
21177
- }
21178
-
21179
- /**
21180
- * Return true if the given element has an external label.
21181
- *
21182
- * @param {Element} element
21183
- *
21184
- * @return {boolean}
21185
- */
21186
- function hasExternalLabel(element) {
21187
- return isLabel$5(element.label);
21188
- }
21189
-
21190
- /**
21191
- * Get the position of a sequence flow label.
21192
- *
21193
- * @param {Point[]} waypoints
21194
- *
21195
- * @return {Point}
21196
- */
21197
- function getFlowLabelPosition(waypoints) {
21198
-
21199
- // get the waypoints mid
21200
- var mid = waypoints.length / 2 - 1;
21201
-
21202
- var first = waypoints[Math.floor(mid)];
21203
- var second = waypoints[Math.ceil(mid + 0.01)];
21204
-
21205
- // get position
21206
- var position = getWaypointsMid(waypoints);
21207
-
21208
- // calculate angle
21209
- var angle = Math.atan((second.y - first.y) / (second.x - first.x));
21210
-
21211
- var x = position.x,
21212
- y = position.y;
21213
-
21214
- if (Math.abs(angle) < Math.PI / 2) {
21215
- y -= FLOW_LABEL_INDENT;
21216
- } else {
21217
- x += FLOW_LABEL_INDENT;
21218
- }
21219
-
21220
- return { x: x, y: y };
21221
- }
21222
-
21223
-
21224
- /**
21225
- * Get the middle of a number of waypoints.
21226
- *
21227
- * @param {Point[]} waypoints
21228
- *
21229
- * @return {Point}
21230
- */
21231
- function getWaypointsMid(waypoints) {
21232
-
21233
- var mid = waypoints.length / 2 - 1;
21234
-
21235
- var first = waypoints[Math.floor(mid)];
21236
- var second = waypoints[Math.ceil(mid + 0.01)];
21237
-
21238
- return {
21239
- x: first.x + (second.x - first.x) / 2,
21240
- y: first.y + (second.y - first.y) / 2
21241
- };
21242
- }
21243
-
21244
- /**
21245
- * Get the middle of the external label of an element.
21246
- *
21247
- * @param {Element} element
21248
- *
21249
- * @return {Point}
21250
- */
21251
- function getExternalLabelMid(element) {
21252
-
21253
- if (element.waypoints) {
21254
- return getFlowLabelPosition(element.waypoints);
21255
- } else if (is$1(element, 'bpmn:Group')) {
21256
- return {
21257
- x: element.x + element.width / 2,
21258
- y: element.y + DEFAULT_LABEL_SIZE.height / 2
21259
- };
21260
- } else {
21261
- return {
21262
- x: element.x + element.width / 2,
21263
- y: element.y + element.height + DEFAULT_LABEL_SIZE.height / 2
21264
- };
21265
- }
21266
- }
21267
-
21268
-
21269
- /**
21270
- * Return the bounds of an elements label, parsed from the elements DI or
21271
- * generated from its bounds.
21272
- *
21273
- * @param {ModdleElement} di
21274
- * @param {Element} element
21275
- *
21276
- * @return {Rect}
21277
- */
21278
- function getExternalLabelBounds(di, element) {
21279
-
21280
- var mid,
21281
- size,
21282
- bounds,
21283
- label = di.label;
21284
-
21285
- if (label && label.bounds) {
21286
- bounds = label.bounds;
21287
-
21288
- size = {
21289
- width: Math.max(DEFAULT_LABEL_SIZE.width, bounds.width),
21290
- height: bounds.height
21291
- };
21292
-
21293
- mid = {
21294
- x: bounds.x + bounds.width / 2,
21295
- y: bounds.y + bounds.height / 2
21296
- };
21297
- } else {
21298
-
21299
- mid = getExternalLabelMid(element);
21300
-
21301
- size = DEFAULT_LABEL_SIZE;
21302
- }
21303
-
21304
- return assign$1({
21305
- x: mid.x - size.width / 2,
21306
- y: mid.y - size.height / 2
21307
- }, size);
21308
- }
21309
-
21310
- /**
21311
- * @param {Element} element
21312
- *
21313
- * @return {boolean}
21314
- */
21315
- function isLabel$5(element) {
21316
- return element && !!element.labelTarget;
21317
- }
21318
-
21319
21377
  /**
21320
21378
  * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
21321
21379
  * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
@@ -21682,6 +21740,10 @@
21682
21740
  ]
21683
21741
  };
21684
21742
 
21743
+ /**
21744
+ * @typedef {import('../util/Types').Point} Point
21745
+ */
21746
+
21685
21747
  function __stopPropagation(event) {
21686
21748
  if (!event || typeof event.stopPropagation !== 'function') {
21687
21749
  return;
@@ -21690,18 +21752,28 @@
21690
21752
  event.stopPropagation();
21691
21753
  }
21692
21754
 
21693
-
21755
+ /**
21756
+ * @param {import('../core/EventBus').Event} event
21757
+ *
21758
+ * @return {Event}
21759
+ */
21694
21760
  function getOriginal$1(event) {
21695
21761
  return event.originalEvent || event.srcEvent;
21696
21762
  }
21697
21763
 
21698
-
21699
- function stopPropagation$1(event, immediate) {
21764
+ /**
21765
+ * @param {Event|import('../core/EventBus').Event} event
21766
+ */
21767
+ function stopPropagation$1(event) {
21700
21768
  __stopPropagation(event);
21701
21769
  __stopPropagation(getOriginal$1(event));
21702
21770
  }
21703
21771
 
21704
-
21772
+ /**
21773
+ * @param {Event} event
21774
+ *
21775
+ * @return {Point|null}
21776
+ */
21705
21777
  function toPoint(event) {
21706
21778
 
21707
21779
  if (event.pointers && event.pointers.length) {
@@ -21722,22 +21794,43 @@
21722
21794
  return (/mac/i).test(navigator.platform);
21723
21795
  }
21724
21796
 
21797
+ /**
21798
+ * @param {MouseEvent} event
21799
+ * @param {string} button
21800
+ *
21801
+ * @return {boolean}
21802
+ */
21725
21803
  function isButton(event, button) {
21726
21804
  return (getOriginal$1(event) || event).button === button;
21727
21805
  }
21728
21806
 
21807
+ /**
21808
+ * @param {MouseEvent} event
21809
+ *
21810
+ * @return {boolean}
21811
+ */
21729
21812
  function isPrimaryButton(event) {
21730
21813
 
21731
21814
  // button === 0 -> left áka primary mouse button
21732
21815
  return isButton(event, 0);
21733
21816
  }
21734
21817
 
21818
+ /**
21819
+ * @param {MouseEvent} event
21820
+ *
21821
+ * @return {boolean}
21822
+ */
21735
21823
  function isAuxiliaryButton(event) {
21736
21824
 
21737
21825
  // button === 1 -> auxiliary áka wheel button
21738
21826
  return isButton(event, 1);
21739
21827
  }
21740
21828
 
21829
+ /**
21830
+ * @param {MouseEvent} event
21831
+ *
21832
+ * @return {boolean}
21833
+ */
21741
21834
  function hasPrimaryModifier(event) {
21742
21835
  var originalEvent = getOriginal$1(event) || event;
21743
21836
 
@@ -21753,7 +21846,11 @@
21753
21846
  }
21754
21847
  }
21755
21848
 
21756
-
21849
+ /**
21850
+ * @param {MouseEvent} event
21851
+ *
21852
+ * @return {boolean}
21853
+ */
21757
21854
  function hasSecondaryModifier(event) {
21758
21855
  var originalEvent = getOriginal$1(event) || event;
21759
21856
 
@@ -22772,7 +22869,7 @@
22772
22869
  *
22773
22870
  * The ids can be customized via a given prefix and contain a random value to avoid collisions.
22774
22871
  *
22775
- * @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)
22776
22873
  */
22777
22874
  function IdGenerator(prefix) {
22778
22875
 
@@ -23880,6 +23977,7 @@
23880
23977
 
23881
23978
  /**
23882
23979
  * @param {string} str
23980
+ *
23883
23981
  * @return {string}
23884
23982
  */
23885
23983
  function escapeCSS(str) {
@@ -23894,6 +23992,11 @@
23894
23992
  '\'': '&#39;'
23895
23993
  };
23896
23994
 
23995
+ /**
23996
+ * @param {string} str
23997
+ *
23998
+ * @return {string}
23999
+ */
23897
24000
  function escapeHTML(str) {
23898
24001
  str = '' + str;
23899
24002
 
@@ -24774,6 +24877,7 @@
24774
24877
 
24775
24878
  /**
24776
24879
  * @param {KeyboardEvent} event
24880
+ * @return {boolean}
24777
24881
  */
24778
24882
  function isCmd(event) {
24779
24883
 
@@ -24791,6 +24895,7 @@
24791
24895
  *
24792
24896
  * @param {string|string[]} keys
24793
24897
  * @param {KeyboardEvent} event
24898
+ * @return {boolean}
24794
24899
  */
24795
24900
  function isKey(keys, event) {
24796
24901
  keys = isArray$3(keys) ? keys : [ keys ];
@@ -24805,18 +24910,30 @@
24805
24910
  return event.shiftKey;
24806
24911
  }
24807
24912
 
24913
+ /**
24914
+ * @param {KeyboardEvent} event
24915
+ */
24808
24916
  function isCopy(event) {
24809
24917
  return isCmd(event) && isKey(KEYS_COPY, event);
24810
24918
  }
24811
24919
 
24920
+ /**
24921
+ * @param {KeyboardEvent} event
24922
+ */
24812
24923
  function isPaste(event) {
24813
24924
  return isCmd(event) && isKey(KEYS_PASTE, event);
24814
24925
  }
24815
24926
 
24927
+ /**
24928
+ * @param {KeyboardEvent} event
24929
+ */
24816
24930
  function isUndo(event) {
24817
24931
  return isCmd(event) && !isShift(event) && isKey(KEYS_UNDO, event);
24818
24932
  }
24819
24933
 
24934
+ /**
24935
+ * @param {KeyboardEvent} event
24936
+ */
24820
24937
  function isRedo(event) {
24821
24938
  return isCmd(event) && (
24822
24939
  isKey(KEYS_REDO, event) || (
@@ -24827,6 +24944,8 @@
24827
24944
 
24828
24945
  /**
24829
24946
  * @typedef {import('../../core/EventBus').default} EventBus
24947
+ *
24948
+ * @typedef {({ keyEvent: KeyboardEvent }) => any} Listener
24830
24949
  */
24831
24950
 
24832
24951
  var KEYDOWN_EVENT = 'keyboard.keydown',
@@ -24858,6 +24977,7 @@
24858
24977
  * `keyboard.bindTo` configuration option.
24859
24978
  *
24860
24979
  * @param {Object} config
24980
+ * @param {EventTarget} [config.bindTo]
24861
24981
  * @param {EventBus} eventBus
24862
24982
  */
24863
24983
  function Keyboard(config, eventBus) {
@@ -24949,6 +25069,11 @@
24949
25069
  return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');
24950
25070
  };
24951
25071
 
25072
+ /**
25073
+ * Bind keyboard events to the given DOM node.
25074
+ *
25075
+ * @param {EventTarget} node
25076
+ */
24952
25077
  Keyboard.prototype.bind = function(node) {
24953
25078
 
24954
25079
  // make sure that the keyboard is only bound once to the DOM
@@ -24963,6 +25088,9 @@
24963
25088
  this._fire('bind');
24964
25089
  };
24965
25090
 
25091
+ /**
25092
+ * @return {EventTarget}
25093
+ */
24966
25094
  Keyboard.prototype.getBinding = function() {
24967
25095
  return this._node;
24968
25096
  };
@@ -24981,6 +25109,9 @@
24981
25109
  this._node = null;
24982
25110
  };
24983
25111
 
25112
+ /**
25113
+ * @param {string} event
25114
+ */
24984
25115
  Keyboard.prototype._fire = function(event) {
24985
25116
  this._eventBus.fire('keyboard.' + event, { node: this._node });
24986
25117
  };
@@ -24991,8 +25122,8 @@
24991
25122
  * provided, the default value of 1000 is used.
24992
25123
  *
24993
25124
  * @param {number} [priority]
24994
- * @param {Function} listener
24995
- * @param {string} type
25125
+ * @param {Listener} listener
25126
+ * @param {string} [type='keyboard.keydown']
24996
25127
  */
24997
25128
  Keyboard.prototype.addListener = function(priority, listener, type) {
24998
25129
  if (isFunction(priority)) {
@@ -25004,6 +25135,12 @@
25004
25135
  this._eventBus.on(type || KEYDOWN_EVENT, priority, listener);
25005
25136
  };
25006
25137
 
25138
+ /**
25139
+ * Remove a listener function.
25140
+ *
25141
+ * @param {Listener} listener
25142
+ * @param {string} [type='keyboard.keydown']
25143
+ */
25007
25144
  Keyboard.prototype.removeListener = function(listener, type) {
25008
25145
  this._eventBus.off(type || KEYDOWN_EVENT, listener);
25009
25146
  };
@@ -25276,15 +25413,21 @@
25276
25413
  }
25277
25414
  }
25278
25415
 
25279
- this.moveCanvas = function(opts) {
25416
+ /**
25417
+ * @param {{
25418
+ * direction: 'up' | 'down' | 'left' | 'right';
25419
+ * speed: number;
25420
+ * }} options
25421
+ */
25422
+ this.moveCanvas = function(options) {
25280
25423
 
25281
25424
  var dx = 0,
25282
25425
  dy = 0,
25283
- speed = opts.speed;
25426
+ speed = options.speed;
25284
25427
 
25285
25428
  var actualSpeed = speed / Math.min(Math.sqrt(canvas.viewbox().scale), 1);
25286
25429
 
25287
- switch (opts.direction) {
25430
+ switch (options.direction) {
25288
25431
  case 'left': // Left
25289
25432
  dx = actualSpeed;
25290
25433
  break;
@@ -25327,7 +25470,9 @@
25327
25470
 
25328
25471
  var CURSOR_CLS_PATTERN = /^djs-cursor-.*$/;
25329
25472
 
25330
-
25473
+ /**
25474
+ * @param {string} mode
25475
+ */
25331
25476
  function set(mode) {
25332
25477
  var classes = classes$1(document.body);
25333
25478
 
@@ -25342,12 +25487,19 @@
25342
25487
  set(null);
25343
25488
  }
25344
25489
 
25490
+ /**
25491
+ * @typedef {import('../core/EventBus').EventBus} EventBus
25492
+ */
25493
+
25345
25494
  var TRAP_PRIORITY = 5000;
25346
25495
 
25347
25496
  /**
25348
25497
  * Installs a click trap that prevents a ghost click following a dragging operation.
25349
25498
  *
25350
- * @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.
25351
25503
  */
25352
25504
  function install(eventBus, eventName) {
25353
25505
 
@@ -25364,6 +25516,15 @@
25364
25516
  };
25365
25517
  }
25366
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
+ */
25367
25528
  function center(bounds) {
25368
25529
  return {
25369
25530
  x: bounds.x + (bounds.width / 2),
@@ -25372,6 +25533,11 @@
25372
25533
  }
25373
25534
 
25374
25535
 
25536
+ /**
25537
+ * @param {Point} a
25538
+ * @param {Point} b
25539
+ * @return {Point}
25540
+ */
25375
25541
  function delta(a, b) {
25376
25542
  return {
25377
25543
  x: a.x - b.x,
@@ -25520,6 +25686,7 @@
25520
25686
  * @param {Object} range
25521
25687
  * @param {number} range.min
25522
25688
  * @param {number} range.max
25689
+ * @param {number} steps
25523
25690
  */
25524
25691
  function getStepSize(range, steps) {
25525
25692
 
@@ -25531,6 +25698,12 @@
25531
25698
  return absoluteLinearRange / steps;
25532
25699
  }
25533
25700
 
25701
+ /**
25702
+ * @param {Object} range
25703
+ * @param {number} range.min
25704
+ * @param {number} range.max
25705
+ * @param {number} scale
25706
+ */
25534
25707
  function cap(range, scale) {
25535
25708
  return Math.max(range.min, Math.min(range.max, scale));
25536
25709
  }
@@ -29587,16 +29760,20 @@
29587
29760
 
29588
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}
29589
29762
 
29763
+ /**
29764
+ * @typedef {import('./PopupMenuProvider').PopupMenuEntry} PopupMenuEntry
29765
+ */
29766
+
29590
29767
  /**
29591
29768
  * Component that renders a popup menu entry.
29592
29769
  *
29593
29770
  * @param {Object} props
29594
29771
  * @param {string} props.key
29595
- * @param {Object} props.entry
29772
+ * @param {PopupMenuEntry} props.entry
29596
29773
  * @param {boolean} props.selected
29597
- * @param {Function} props.onMouseEnter
29598
- * @param {Function} props.onMouseLeave
29599
- * @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
29600
29777
  */
29601
29778
  function PopupMenuItem(props) {
29602
29779
  const {
@@ -29660,15 +29837,17 @@
29660
29837
  `;
29661
29838
  }
29662
29839
 
29840
+ /**
29841
+ * @typedef {import('./PopupMenuProvider').PopupMenuEntry} PopupMenuEntry
29842
+ */
29843
+
29663
29844
  /**
29664
29845
  * Component that renders a popup menu entry list.
29665
29846
  *
29666
29847
  * @param {Object} props
29667
- * @param {Array} props.entries
29668
- * @param {Object} props.selectedEntry
29669
- * @param {Function} props.setSelectedEntry
29670
- * @param {Function} props.onAction
29671
- * @param {Object} props.resultsRef
29848
+ * @param {PopupMenuEntry[]} props.entries
29849
+ * @param {PopupMenuEntry} props.selectedEntry
29850
+ * @param {(entry: PopupMenuEntry | null) => void} props.setSelectedEntry
29672
29851
  */
29673
29852
  function PopupMenuList(props) {
29674
29853
  const {
@@ -29762,15 +29941,22 @@
29762
29941
  }
29763
29942
  }
29764
29943
 
29944
+ /**
29945
+ * @typedef {import('./PopupMenuProvider').PopupMenuEntry} PopupMenuEntry
29946
+ * @typedef {import('./PopupMenuProvider').PopupMenuHeaderEntry} PopupMenuHeaderEntry
29947
+ *
29948
+ * @typedef {import('../../util/Types').Point} Point
29949
+ */
29950
+
29765
29951
  /**
29766
29952
  * A component that renders the popup menus.
29767
29953
  *
29768
29954
  * @param {Object} props
29769
- * @param {function} props.onClose
29770
- * @param {function} props.position
29955
+ * @param {() => void} props.onClose
29956
+ * @param {(element: HTMLElement) => Point} props.position
29771
29957
  * @param {string} props.className
29772
- * @param {Array} props.entries
29773
- * @param {Array} props.headerEntries
29958
+ * @param {PopupMenuEntry[]} props.entries
29959
+ * @param {PopupMenuHeaderEntry[]} props.headerEntries
29774
29960
  * @param {number} props.scale
29775
29961
  * @param {string} [props.title]
29776
29962
  * @param {boolean} [props.search]
@@ -30987,6 +31173,8 @@
30987
31173
  };
30988
31174
 
30989
31175
  /**
31176
+ * @typedef {import('../../model/Types').Connection} Connection
31177
+ * @typedef {import('../../model/Types').Element} Element
30990
31178
  * @typedef {import('../../model/Types').Shape} Shape
30991
31179
  *
30992
31180
  * @typedef {import('../../util/Types').Point} Point
@@ -31006,7 +31194,7 @@
31006
31194
  * @param {Shape} source
31007
31195
  * @param {Shape} element
31008
31196
  * @param {Point} position
31009
- * @param {Function} getNextPosition
31197
+ * @param {(element: Element, position: Point, connectedAtPosition: Element) => Element} getNextPosition
31010
31198
  *
31011
31199
  * @return {Point}
31012
31200
  */
@@ -31027,7 +31215,7 @@
31027
31215
  * @param {Object} [nextPositionDirection.x]
31028
31216
  * @param {Object} [nextPositionDirection.y]
31029
31217
  *
31030
- * @return {Function}
31218
+ * @return {(element: Element, previousPosition: Point, connectedAtPosition: Element) => Point}
31031
31219
  */
31032
31220
  function generateGetNextPosition(nextPositionDirection) {
31033
31221
  return function(element, previousPosition, connectedAtPosition) {
@@ -31103,8 +31291,8 @@
31103
31291
  * @param {Object} [hints]
31104
31292
  * @param {number} [hints.defaultDistance]
31105
31293
  * @param {string} [hints.direction]
31106
- * @param {Function} [hints.filter]
31107
- * @param {Function} [hints.getWeight]
31294
+ * @param {(connection: Connection) => boolean} [hints.filter]
31295
+ * @param {(connection: Connection) => number} [hints.getWeight]
31108
31296
  * @param {number} [hints.maxDistance]
31109
31297
  * @param {string} [hints.reference]
31110
31298
  *
@@ -32308,6 +32496,7 @@
32308
32496
  *
32309
32497
  * @example
32310
32498
  *
32499
+ * ```javascript
32311
32500
  * function MyDragComponent(eventBus, dragging) {
32312
32501
  *
32313
32502
  * eventBus.on('mydrag.start', function(event) {
@@ -32335,6 +32524,7 @@
32335
32524
  * });
32336
32525
  * });
32337
32526
  * }
32527
+ * ```
32338
32528
  *
32339
32529
  * @param {EventBus} eventBus
32340
32530
  * @param {Canvas} canvas
@@ -32644,7 +32834,7 @@
32644
32834
  * relative to it.
32645
32835
  *
32646
32836
  * @param {MouseEvent|TouchEvent} [event]
32647
- * @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
32648
32838
  * @param {string} prefix
32649
32839
  * @param {Object} [options]
32650
32840
  */
@@ -33010,6 +33200,12 @@
33010
33200
 
33011
33201
  /**
33012
33202
  * @typedef {import('../util/Types').Point} Point
33203
+ *
33204
+ * @typedef { {
33205
+ * bendpoint?: boolean;
33206
+ * index: number;
33207
+ * point: Point;
33208
+ * } } Intersection
33013
33209
  */
33014
33210
 
33015
33211
  var round$9 = Math.round,
@@ -33042,6 +33238,12 @@
33042
33238
 
33043
33239
  var INTERSECTION_THRESHOLD$1 = 10;
33044
33240
 
33241
+ /**
33242
+ * @param {Point[]} waypoints
33243
+ * @param {Point} reference
33244
+ *
33245
+ * @return {Intersection|null}
33246
+ */
33045
33247
  function getBendpointIntersection(waypoints, reference) {
33046
33248
 
33047
33249
  var i, w;
@@ -33060,6 +33262,12 @@
33060
33262
  return null;
33061
33263
  }
33062
33264
 
33265
+ /**
33266
+ * @param {Point[]} waypoints
33267
+ * @param {Point} reference
33268
+ *
33269
+ * @return {Intersection|null}
33270
+ */
33063
33271
  function getPathIntersection(waypoints, reference) {
33064
33272
 
33065
33273
  var intersections = intersectPaths(circlePath(reference, INTERSECTION_THRESHOLD$1), linePath(waypoints));
@@ -33114,7 +33322,7 @@
33114
33322
  * @param {Point[]} waypoints
33115
33323
  * @param {Point} reference
33116
33324
  *
33117
- * @return {Object} intersection data (segment, point)
33325
+ * @return {Intersection|null}
33118
33326
  */
33119
33327
  function getApproxIntersection(waypoints, reference) {
33120
33328
  return getBendpointIntersection(waypoints, reference) || getPathIntersection(waypoints, reference);
@@ -37544,6 +37752,8 @@
37544
37752
  * Create a tree-like structure from elements.
37545
37753
  *
37546
37754
  * @example
37755
+ *
37756
+ * ```javascript
37547
37757
  * tree: {
37548
37758
  * 0: [
37549
37759
  * { id: 'Shape_1', priority: 1, ... },
@@ -37556,6 +37766,7 @@
37556
37766
  * ...
37557
37767
  * ]
37558
37768
  * };
37769
+ * ```
37559
37770
  *
37560
37771
  * @param {Element[]} elements
37561
37772
  *
@@ -41207,18 +41418,24 @@
41207
41418
  };
41208
41419
 
41209
41420
  /**
41210
- * @typedef {Object} Range
41211
- * @property {number} min
41212
- * @property {number} max
41213
- */
41214
-
41215
- /**
41421
+ * @typedef {import('../../model/Types').Element} Element
41422
+ *
41216
41423
  * @typedef {import('../../util/Types').Axis} Axis
41217
41424
  * @typedef {import('../../util/Types').Dimension} Dimension
41218
41425
  * @typedef {import('../../util/Types').Rect} Rect
41219
41426
  *
41220
41427
  * @typedef {import('../modeling/Modeling').default} Modeling
41221
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
41222
41439
  */
41223
41440
 
41224
41441
  var AXIS_DIMENSIONS = {
@@ -41258,7 +41475,7 @@
41258
41475
  * Registers filter functions that allow external parties to filter
41259
41476
  * out certain elements.
41260
41477
  *
41261
- * @param {Function} filterFn
41478
+ * @param {(distributableElements: Element[], axis: Axis, dimension: Dimension) => Element[]} filterFn
41262
41479
  */
41263
41480
  DistributeElements$1.prototype.registerFilter = function(filterFn) {
41264
41481
  if (typeof filterFn !== 'function') {
@@ -41271,7 +41488,7 @@
41271
41488
  /**
41272
41489
  * Distributes the elements with a given orientation
41273
41490
  *
41274
- * @param {Array} elements
41491
+ * @param {Element[]} elements
41275
41492
  * @param {string} orientation
41276
41493
  */
41277
41494
  DistributeElements$1.prototype.trigger = function(elements, orientation) {
@@ -41303,9 +41520,9 @@
41303
41520
  /**
41304
41521
  * Filters the elements with provided filters by external parties
41305
41522
  *
41306
- * @param {Array[Elements]} elements
41523
+ * @param {Element[]} elements
41307
41524
  *
41308
- * @return {Array[Elements]}
41525
+ * @return {Element[]}
41309
41526
  */
41310
41527
  DistributeElements$1.prototype._filterElements = function(elements) {
41311
41528
  var filters = this._filters,
@@ -41330,19 +41547,19 @@
41330
41547
  * together that share the same range.
41331
41548
  *
41332
41549
  * @example
41333
- * var distributableElements = [
41334
- * {
41335
- * range: {
41336
- * min: 100,
41337
- * max: 200
41338
- * },
41339
- * elements: [ { id: 'shape1', .. }]
41340
- * }
41341
- * ]
41342
41550
  *
41343
- * @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
41344
41561
  *
41345
- * @return {Array[Objects]}
41562
+ * @return {Group[]}
41346
41563
  */
41347
41564
  DistributeElements$1.prototype._createGroups = function(elements) {
41348
41565
  var rangeGroups = [],
@@ -41377,9 +41594,9 @@
41377
41594
 
41378
41595
 
41379
41596
  /**
41380
- * Maps a direction to the according axis and dimension
41597
+ * Maps a direction to the according axis and dimension.
41381
41598
  *
41382
- * @param {string} direction 'horizontal' or 'vertical'
41599
+ * @param {'horizontal' | 'vertical'} direction 'horizontal' or 'vertical'
41383
41600
  */
41384
41601
  DistributeElements$1.prototype._setOrientation = function(direction) {
41385
41602
  var orientation = AXIS_DIMENSIONS[direction];
@@ -41390,10 +41607,10 @@
41390
41607
 
41391
41608
 
41392
41609
  /**
41393
- * Checks if the two ranges intercept each other
41610
+ * Checks if the two ranges intercept each other.
41394
41611
  *
41395
- * @param {Object} rangeA {min, max}
41396
- * @param {Object} rangeB {min, max}
41612
+ * @param {Range} rangeA
41613
+ * @param {Range} rangeB
41397
41614
  *
41398
41615
  * @return {boolean}
41399
41616
  */
@@ -41406,9 +41623,7 @@
41406
41623
  /**
41407
41624
  * Returns the min and max values for an element
41408
41625
  *
41409
- * @param {Rect} element
41410
- * @param {Axis} axis
41411
- * @param {Dimension} dimension
41626
+ * @param {Element} element
41412
41627
  *
41413
41628
  * @return {Range}
41414
41629
  */
@@ -41772,7 +41987,8 @@
41772
41987
  * The key of the object will be the name of the action.
41773
41988
  *
41774
41989
  * @example
41775
- * ´´´
41990
+ *
41991
+ * ```javascript
41776
41992
  * var actions = {
41777
41993
  * spaceTool: function() {
41778
41994
  * spaceTool.activateSelection();
@@ -41785,7 +42001,7 @@
41785
42001
  * editorActions.register(actions);
41786
42002
  *
41787
42003
  * editorActions.isRegistered('spaceTool'); // true
41788
- * ´´´
42004
+ * ```
41789
42005
  *
41790
42006
  * @param {Object} actions
41791
42007
  */
@@ -47630,11 +47846,6 @@
47630
47846
  return oldTRBL.top !== newTRBL.top && oldTRBL.bottom !== newTRBL.bottom;
47631
47847
  }
47632
47848
 
47633
- var DEFAULT_LABEL_DIMENSIONS = {
47634
- width: 90,
47635
- height: 20
47636
- };
47637
-
47638
47849
  var NAME_PROPERTY = 'name';
47639
47850
  var TEXT_PROPERTY = 'text';
47640
47851
 
@@ -47667,7 +47878,16 @@
47667
47878
  CommandInterceptor.call(this, eventBus);
47668
47879
 
47669
47880
  // update label if name property was updated
47670
- this.postExecute('element.updateProperties', function(e) {
47881
+ this.postExecute('element.updateProperties', onPropertyUpdate);
47882
+ this.postExecute('element.updateModdleProperties', e => {
47883
+ const elementBo = getBusinessObject(e.context.element);
47884
+
47885
+ if (elementBo === e.context.moddleElement) {
47886
+ onPropertyUpdate(e);
47887
+ }
47888
+ });
47889
+
47890
+ function onPropertyUpdate(e) {
47671
47891
  var context = e.context,
47672
47892
  element = context.element,
47673
47893
  properties = context.properties;
@@ -47691,7 +47911,7 @@
47691
47911
 
47692
47912
  modeling.updateLabel(element, properties.text, newBounds);
47693
47913
  }
47694
- });
47914
+ }
47695
47915
 
47696
47916
  // create label shape after shape/connection was created
47697
47917
  this.postExecute([ 'shape.create', 'connection.create' ], function(e) {
@@ -47702,8 +47922,7 @@
47702
47922
  return;
47703
47923
  }
47704
47924
 
47705
- var element = context.shape || context.connection,
47706
- businessObject = element.businessObject;
47925
+ var element = context.shape || context.connection;
47707
47926
 
47708
47927
  if (isLabel$5(element) || !isLabelExternal(element)) {
47709
47928
  return;
@@ -47714,20 +47933,7 @@
47714
47933
  return;
47715
47934
  }
47716
47935
 
47717
- var labelCenter = getExternalLabelMid(element);
47718
-
47719
- // we don't care about x and y
47720
- var labelDimensions = textRenderer.getExternalLabelBounds(
47721
- DEFAULT_LABEL_DIMENSIONS,
47722
- getLabel(element)
47723
- );
47724
-
47725
- modeling.createLabel(element, labelCenter, {
47726
- id: businessObject.id + '_label',
47727
- businessObject: businessObject,
47728
- width: labelDimensions.width,
47729
- height: labelDimensions.height
47730
- });
47936
+ modeling.updateLabel(element, getLabel(element));
47731
47937
  });
47732
47938
 
47733
47939
  // update label after label shape was deleted
@@ -47742,42 +47948,6 @@
47742
47948
  }
47743
47949
  });
47744
47950
 
47745
- // update di information on label creation
47746
- this.postExecute([ 'label.create' ], function(event) {
47747
-
47748
- var context = event.context,
47749
- element = context.shape,
47750
- labelTarget = context.labelTarget,
47751
- di;
47752
-
47753
- // we want to trigger on real labels only
47754
- if (!labelTarget) {
47755
- return;
47756
- }
47757
-
47758
- // we want to trigger on BPMN elements only
47759
- if (!is$1(labelTarget, 'bpmn:BaseElement')) {
47760
- return;
47761
- }
47762
-
47763
- di = getDi(labelTarget);
47764
-
47765
- if (!di.label) {
47766
- di.label = bpmnFactory.create('bpmndi:BPMNLabel', {
47767
- bounds: bpmnFactory.create('dc:Bounds')
47768
- });
47769
-
47770
- element.di = di;
47771
- }
47772
-
47773
- assign$1(di.label.bounds, {
47774
- x: element.x,
47775
- y: element.y,
47776
- width: element.width,
47777
- height: element.height
47778
- });
47779
- });
47780
-
47781
47951
  function getVisibleLabelAdjustment(event) {
47782
47952
 
47783
47953
  var context = event.context,
@@ -54165,7 +54335,7 @@
54165
54335
  /**
54166
54336
  * Remove tooltip with given ID.
54167
54337
  *
54168
- * @param {string} id
54338
+ * @param {string | Tooltip} id
54169
54339
  */
54170
54340
  Tooltips.prototype.remove = function(id) {
54171
54341
 
@@ -54315,7 +54485,7 @@
54315
54485
  * at a time.
54316
54486
  *
54317
54487
  * @param {Object[]} [collection]
54318
- * @param {Function} removeFn
54488
+ * @param {(element: Object) => void} removeFn
54319
54489
  *
54320
54490
  * @return {Object[]} the cleared collection
54321
54491
  */
@@ -55277,6 +55447,28 @@
55277
55447
 
55278
55448
  this.executed([ 'element.updateAttachment' ], ifBpmn(updateAttachment));
55279
55449
  this.reverted([ 'element.updateAttachment' ], ifBpmn(updateAttachment));
55450
+
55451
+
55452
+ // update BPMNLabel
55453
+ this.executed('element.updateLabel', ifBpmn(updateBPMNLabel));
55454
+ this.reverted('element.updateLabel', ifBpmn(updateBPMNLabel));
55455
+
55456
+ function updateBPMNLabel(event) {
55457
+ const { element } = event.context,
55458
+ label = getLabel(element);
55459
+ const di = getDi(element),
55460
+ diLabel = di && di.get('label');
55461
+
55462
+ if (isLabelExternal(element)) {
55463
+ return;
55464
+ }
55465
+
55466
+ if (label && !diLabel) {
55467
+ di.set('label', bpmnFactory.create('bpmndi:BPMNLabel'));
55468
+ } else if (!label && diLabel) {
55469
+ di.set('label', undefined);
55470
+ }
55471
+ }
55280
55472
  }
55281
55473
 
55282
55474
  e$3(BpmnUpdater, CommandInterceptor);
@@ -55777,7 +55969,7 @@
55777
55969
  return function(event) {
55778
55970
 
55779
55971
  var context = event.context,
55780
- element = context.shape || context.connection;
55972
+ element = context.shape || context.connection || context.element;
55781
55973
 
55782
55974
  if (is$1(element, 'bpmn:BaseElement')) {
55783
55975
  fn(event);
@@ -55902,7 +56094,7 @@
55902
56094
  // and wired via attrs
55903
56095
  if (elementType === 'label') {
55904
56096
  var di = attrs.di || this._bpmnFactory.createDiLabel();
55905
- return this._baseCreate(elementType, assign$1({ type: 'label', di: di }, DEFAULT_LABEL_SIZE, attrs));
56097
+ return this._baseCreate(elementType, assign$1({ type: 'label', di: di }, DEFAULT_LABEL_SIZE$1, attrs));
55906
56098
  }
55907
56099
 
55908
56100
  return this.createElement(elementType, attrs);
@@ -57154,23 +57346,56 @@
57154
57346
  return connection;
57155
57347
  };
57156
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
+
57157
57355
  function MoveClosure() {
57158
57356
 
57357
+ /**
57358
+ * @type {Record<string, Shape>}
57359
+ */
57159
57360
  this.allShapes = {};
57361
+
57362
+ /**
57363
+ * @type {Record<string, Connection>}
57364
+ */
57160
57365
  this.allConnections = {};
57161
57366
 
57367
+ /**
57368
+ * @type {Record<string, Element>}
57369
+ */
57162
57370
  this.enclosedElements = {};
57371
+
57372
+ /**
57373
+ * @type {Record<string, Connection>}
57374
+ */
57163
57375
  this.enclosedConnections = {};
57164
57376
 
57377
+ /**
57378
+ * @type {Record<string, Element>}
57379
+ */
57165
57380
  this.topLevel = {};
57166
57381
  }
57167
57382
 
57168
-
57383
+ /**
57384
+ * @param {Element} element
57385
+ * @param {boolean} [isTopLevel]
57386
+ *
57387
+ * @return {MoveClosure}
57388
+ */
57169
57389
  MoveClosure.prototype.add = function(element, isTopLevel) {
57170
57390
  return this.addAll([ element ], isTopLevel);
57171
57391
  };
57172
57392
 
57173
-
57393
+ /**
57394
+ * @param {Element[]} elements
57395
+ * @param {boolean} [isTopLevel]
57396
+ *
57397
+ * @return {MoveClosure}
57398
+ */
57174
57399
  MoveClosure.prototype.addAll = function(elements, isTopLevel) {
57175
57400
 
57176
57401
  var newClosure = getClosure(elements, !!isTopLevel, this);
@@ -60088,29 +60313,6 @@
60088
60313
  */
60089
60314
  function UpdateLabelHandler(modeling, textRenderer, bpmnFactory) {
60090
60315
 
60091
- /**
60092
- * Creates an empty `diLabel` attribute for embedded labels.
60093
- *
60094
- * @param {Element} element
60095
- * @param {string} text
60096
- */
60097
- function ensureInternalLabelDi(element, text) {
60098
- if (isLabelExternal(element)) {
60099
- return;
60100
- }
60101
-
60102
- var di = getDi(element);
60103
-
60104
- if (text && !di.label) {
60105
- di.label = bpmnFactory.create('bpmndi:BPMNLabel');
60106
- }
60107
-
60108
- if (!text && di.label) {
60109
- delete di.label;
60110
- }
60111
- }
60112
-
60113
-
60114
60316
  /**
60115
60317
  * Set the label and return the changed elements.
60116
60318
  *
@@ -60128,8 +60330,6 @@
60128
60330
 
60129
60331
  setLabel(label, text);
60130
60332
 
60131
- ensureInternalLabelDi(element, text);
60132
-
60133
60333
  return [ label, labelTarget ];
60134
60334
  }
60135
60335
 
@@ -60191,7 +60391,7 @@
60191
60391
  return;
60192
60392
  }
60193
60393
 
60194
- var text = getLabel(label);
60394
+ var text = getLabel(element);
60195
60395
 
60196
60396
  // resize element based on label _or_ pre-defined bounds
60197
60397
  if (typeof newBounds === 'undefined') {
@@ -60829,7 +61029,6 @@
60829
61029
  * @param {Rect} target target rectangle
60830
61030
  * @param {Point} [start] source docking
60831
61031
  * @param {Point} [end] target docking
60832
- *
60833
61032
  * @param {Object} [hints]
60834
61033
  * @param {string} [hints.preserveDocking=source] preserve docking on selected side
60835
61034
  * @param {string[]} [hints.preferredLayouts]
@@ -60952,6 +61151,7 @@
60952
61151
  * @param {Point} start
60953
61152
  * @param {Point} end
60954
61153
  * @param {Object} [hints]
61154
+ * @param {string} [hints.preserveDocking]
60955
61155
  *
60956
61156
  * @return {Point[]|null} The waypoints or null if layout isn't possible.
60957
61157
  */
@@ -61167,12 +61367,13 @@
61167
61367
  *
61168
61368
  * @example
61169
61369
  *
61370
+ * ```javascript
61170
61371
  * getDirections('top'); // -> 'v:v'
61171
61372
  * getDirections('intersect'); // -> 't:t'
61172
61373
  *
61173
61374
  * getDirections('top-right', 'v:h'); // -> 'v:h'
61174
61375
  * getDirections('top-right', 'h:h'); // -> 'h:h'
61175
- *
61376
+ * ```
61176
61377
  *
61177
61378
  * @param {string} orientation
61178
61379
  * @param {string} defaultLayout
@@ -62003,7 +62204,7 @@
62003
62204
  * Start move.
62004
62205
  *
62005
62206
  * @param {MouseEvent|TouchEvent} event
62006
- * @param {Shape} shape
62207
+ * @param {Shape} element
62007
62208
  * @param {boolean} [activate]
62008
62209
  * @param {Object} [context]
62009
62210
  */