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-navigated-viewer v13.0.2
2
+ * bpmn-js - bpmn-navigated-viewer 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() :
@@ -735,7 +735,163 @@
735
735
  }
736
736
 
737
737
  /**
738
- * @typedef { import('../../model').DiagramElement } DiagramElement
738
+ * @typedef {import('diagram-js/lib/util/Types').Point} Point
739
+ * @typedef {import('diagram-js/lib/util/Types').Rect} Rect
740
+ *
741
+ * @typedef {import('../model/Types').Element} Element
742
+ * @typedef {import('../model/Types').ModdleElement} ModdleElement
743
+ */
744
+
745
+ var DEFAULT_LABEL_SIZE$1 = {
746
+ width: 90,
747
+ height: 20
748
+ };
749
+
750
+ var FLOW_LABEL_INDENT = 15;
751
+
752
+
753
+ /**
754
+ * Return true if the given semantic has an external label.
755
+ *
756
+ * @param {Element} semantic
757
+ *
758
+ * @return {boolean}
759
+ */
760
+ function isLabelExternal(semantic) {
761
+ return is$1(semantic, 'bpmn:Event') ||
762
+ is$1(semantic, 'bpmn:Gateway') ||
763
+ is$1(semantic, 'bpmn:DataStoreReference') ||
764
+ is$1(semantic, 'bpmn:DataObjectReference') ||
765
+ is$1(semantic, 'bpmn:DataInput') ||
766
+ is$1(semantic, 'bpmn:DataOutput') ||
767
+ is$1(semantic, 'bpmn:SequenceFlow') ||
768
+ is$1(semantic, 'bpmn:MessageFlow') ||
769
+ is$1(semantic, 'bpmn:Group');
770
+ }
771
+
772
+ /**
773
+ * Get the position of a sequence flow label.
774
+ *
775
+ * @param {Point[]} waypoints
776
+ *
777
+ * @return {Point}
778
+ */
779
+ function getFlowLabelPosition(waypoints) {
780
+
781
+ // get the waypoints mid
782
+ var mid = waypoints.length / 2 - 1;
783
+
784
+ var first = waypoints[Math.floor(mid)];
785
+ var second = waypoints[Math.ceil(mid + 0.01)];
786
+
787
+ // get position
788
+ var position = getWaypointsMid(waypoints);
789
+
790
+ // calculate angle
791
+ var angle = Math.atan((second.y - first.y) / (second.x - first.x));
792
+
793
+ var x = position.x,
794
+ y = position.y;
795
+
796
+ if (Math.abs(angle) < Math.PI / 2) {
797
+ y -= FLOW_LABEL_INDENT;
798
+ } else {
799
+ x += FLOW_LABEL_INDENT;
800
+ }
801
+
802
+ return { x: x, y: y };
803
+ }
804
+
805
+
806
+ /**
807
+ * Get the middle of a number of waypoints.
808
+ *
809
+ * @param {Point[]} waypoints
810
+ *
811
+ * @return {Point}
812
+ */
813
+ function getWaypointsMid(waypoints) {
814
+
815
+ var mid = waypoints.length / 2 - 1;
816
+
817
+ var first = waypoints[Math.floor(mid)];
818
+ var second = waypoints[Math.ceil(mid + 0.01)];
819
+
820
+ return {
821
+ x: first.x + (second.x - first.x) / 2,
822
+ y: first.y + (second.y - first.y) / 2
823
+ };
824
+ }
825
+
826
+ /**
827
+ * Get the middle of the external label of an element.
828
+ *
829
+ * @param {Element} element
830
+ *
831
+ * @return {Point}
832
+ */
833
+ function getExternalLabelMid(element) {
834
+
835
+ if (element.waypoints) {
836
+ return getFlowLabelPosition(element.waypoints);
837
+ } else if (is$1(element, 'bpmn:Group')) {
838
+ return {
839
+ x: element.x + element.width / 2,
840
+ y: element.y + DEFAULT_LABEL_SIZE$1.height / 2
841
+ };
842
+ } else {
843
+ return {
844
+ x: element.x + element.width / 2,
845
+ y: element.y + element.height + DEFAULT_LABEL_SIZE$1.height / 2
846
+ };
847
+ }
848
+ }
849
+
850
+
851
+ /**
852
+ * Return the bounds of an elements label, parsed from the elements DI or
853
+ * generated from its bounds.
854
+ *
855
+ * @param {ModdleElement} di
856
+ * @param {Element} element
857
+ *
858
+ * @return {Rect}
859
+ */
860
+ function getExternalLabelBounds(di, element) {
861
+
862
+ var mid,
863
+ size,
864
+ bounds,
865
+ label = di.label;
866
+
867
+ if (label && label.bounds) {
868
+ bounds = label.bounds;
869
+
870
+ size = {
871
+ width: Math.max(DEFAULT_LABEL_SIZE$1.width, bounds.width),
872
+ height: bounds.height
873
+ };
874
+
875
+ mid = {
876
+ x: bounds.x + bounds.width / 2,
877
+ y: bounds.y + bounds.height / 2
878
+ };
879
+ } else {
880
+
881
+ mid = getExternalLabelMid(element);
882
+
883
+ size = DEFAULT_LABEL_SIZE$1;
884
+ }
885
+
886
+ return assign$1({
887
+ x: mid.x - size.width / 2,
888
+ y: mid.y - size.height / 2
889
+ }, size);
890
+ }
891
+
892
+
893
+ /**
894
+ * @typedef { import('../model').DiagramElement } DiagramElement
739
895
  */
740
896
 
741
897
  function getLabelAttr(semantic) {
@@ -1476,7 +1632,7 @@
1476
1632
  */
1477
1633
 
1478
1634
  /**
1479
- * @param {Component[]} elements
1635
+ * @param {Component[] | Component[][]} elements
1480
1636
  *
1481
1637
  * @return {string}
1482
1638
  */
@@ -1513,6 +1669,11 @@
1513
1669
  return [ 'C', p1.x, p1.y, p2.x, p2.y, p3.x, p3.y ];
1514
1670
  }
1515
1671
 
1672
+ /**
1673
+ * @param {Point[]} waypoints
1674
+ * @param {number} [cornerRadius]
1675
+ * @return {Component[][]}
1676
+ */
1516
1677
  function drawPath(waypoints, cornerRadius) {
1517
1678
  const pointCount = waypoints.length;
1518
1679
 
@@ -1576,7 +1737,7 @@
1576
1737
 
1577
1738
  /**
1578
1739
  * @param {Point[]} points
1579
- * @param {any} [attrs]
1740
+ * @param {number|Object} [attrs]
1580
1741
  * @param {number} [radius]
1581
1742
  *
1582
1743
  * @return {SVGElement}
@@ -1664,7 +1825,7 @@
1664
1825
  // color access //////////////////////
1665
1826
 
1666
1827
  /**
1667
- * @param {DiagramElement} element
1828
+ * @param {Element} element
1668
1829
  * @param {string} [defaultColor]
1669
1830
  *
1670
1831
  * @return {string}
@@ -1676,7 +1837,7 @@
1676
1837
  }
1677
1838
 
1678
1839
  /**
1679
- * @param {DiagramElement} element
1840
+ * @param {Element} element
1680
1841
  * @param {string} [defaultColor]
1681
1842
  *
1682
1843
  * @return {string}
@@ -1688,9 +1849,9 @@
1688
1849
  }
1689
1850
 
1690
1851
  /**
1691
- * @param {DiagramElement} element
1692
- * @param {string} defaultColor
1693
- * @param {string} defaultStrokeColor
1852
+ * @param {Element} element
1853
+ * @param {string} [defaultColor]
1854
+ * @param {string} [defaultStrokeColor]
1694
1855
  *
1695
1856
  * @return {string}
1696
1857
  */
@@ -2369,8 +2530,8 @@
2369
2530
  * @param {SVGElement} gfx
2370
2531
  * @param {number} x
2371
2532
  * @param {number} y
2372
- * @param {number} angle
2373
- * @param {number} amount
2533
+ * @param {number} [angle]
2534
+ * @param {number} [amount]
2374
2535
  */
2375
2536
  function transform(gfx, x, y, angle, amount) {
2376
2537
  var translate = createTransform();
@@ -4518,7 +4679,7 @@
4518
4679
  *
4519
4680
  * @typedef { Partial<{
4520
4681
  * align: AlignmentConfig;
4521
- * style: Record<string, any>;
4682
+ * style: Record<string, number | string>;
4522
4683
  * padding: PaddingConfig;
4523
4684
  * }> } BaseTextConfig
4524
4685
  *
@@ -4538,7 +4699,7 @@
4538
4699
 
4539
4700
  var DEFAULT_BOX_PADDING = 0;
4540
4701
 
4541
- var DEFAULT_LABEL_SIZE$1 = {
4702
+ var DEFAULT_LABEL_SIZE = {
4542
4703
  width: 150,
4543
4704
  height: 50
4544
4705
  };
@@ -4625,6 +4786,8 @@
4625
4786
  * Alters the lines passed.
4626
4787
  *
4627
4788
  * @param {string[]} lines
4789
+ * @param {number} maxWidth
4790
+ * @param {SVGTextElement} fakeText
4628
4791
  *
4629
4792
  * @return {LineDescriptor} the line descriptor
4630
4793
  */
@@ -4778,7 +4941,7 @@
4778
4941
  function Text(config) {
4779
4942
 
4780
4943
  this._config = assign$1({}, {
4781
- size: DEFAULT_LABEL_SIZE$1,
4944
+ size: DEFAULT_LABEL_SIZE,
4782
4945
  padding: DEFAULT_BOX_PADDING,
4783
4946
  style: {},
4784
4947
  align: 'center-top'
@@ -5591,165 +5754,15 @@
5591
5754
  translate: [ 'value', translate ]
5592
5755
  };
5593
5756
 
5594
- /**
5595
- * @typedef {import('diagram-js/lib/util/Types').Point} Point
5596
- * @typedef {import('diagram-js/lib/util/Types').Rect} Rect
5597
- *
5598
- * @typedef {import('../model/Types').Element} Element
5599
- * @typedef {import('../model/Types').ModdleElement} ModdleElement
5600
- */
5601
-
5602
- var DEFAULT_LABEL_SIZE = {
5603
- width: 90,
5604
- height: 20
5605
- };
5606
-
5607
- var FLOW_LABEL_INDENT = 15;
5608
-
5609
-
5610
- /**
5611
- * Return true if the given semantic has an external label.
5612
- *
5613
- * @param {Element} semantic
5614
- *
5615
- * @return {boolean}
5616
- */
5617
- function isLabelExternal(semantic) {
5618
- return is$1(semantic, 'bpmn:Event') ||
5619
- is$1(semantic, 'bpmn:Gateway') ||
5620
- is$1(semantic, 'bpmn:DataStoreReference') ||
5621
- is$1(semantic, 'bpmn:DataObjectReference') ||
5622
- is$1(semantic, 'bpmn:DataInput') ||
5623
- is$1(semantic, 'bpmn:DataOutput') ||
5624
- is$1(semantic, 'bpmn:SequenceFlow') ||
5625
- is$1(semantic, 'bpmn:MessageFlow') ||
5626
- is$1(semantic, 'bpmn:Group');
5627
- }
5628
-
5629
- /**
5630
- * Get the position of a sequence flow label.
5631
- *
5632
- * @param {Point[]} waypoints
5633
- *
5634
- * @return {Point}
5635
- */
5636
- function getFlowLabelPosition(waypoints) {
5637
-
5638
- // get the waypoints mid
5639
- var mid = waypoints.length / 2 - 1;
5640
-
5641
- var first = waypoints[Math.floor(mid)];
5642
- var second = waypoints[Math.ceil(mid + 0.01)];
5643
-
5644
- // get position
5645
- var position = getWaypointsMid(waypoints);
5646
-
5647
- // calculate angle
5648
- var angle = Math.atan((second.y - first.y) / (second.x - first.x));
5649
-
5650
- var x = position.x,
5651
- y = position.y;
5652
-
5653
- if (Math.abs(angle) < Math.PI / 2) {
5654
- y -= FLOW_LABEL_INDENT;
5655
- } else {
5656
- x += FLOW_LABEL_INDENT;
5657
- }
5658
-
5659
- return { x: x, y: y };
5660
- }
5661
-
5662
-
5663
- /**
5664
- * Get the middle of a number of waypoints.
5665
- *
5666
- * @param {Point[]} waypoints
5667
- *
5668
- * @return {Point}
5669
- */
5670
- function getWaypointsMid(waypoints) {
5671
-
5672
- var mid = waypoints.length / 2 - 1;
5673
-
5674
- var first = waypoints[Math.floor(mid)];
5675
- var second = waypoints[Math.ceil(mid + 0.01)];
5676
-
5677
- return {
5678
- x: first.x + (second.x - first.x) / 2,
5679
- y: first.y + (second.y - first.y) / 2
5680
- };
5681
- }
5682
-
5683
- /**
5684
- * Get the middle of the external label of an element.
5685
- *
5686
- * @param {Element} element
5687
- *
5688
- * @return {Point}
5689
- */
5690
- function getExternalLabelMid(element) {
5691
-
5692
- if (element.waypoints) {
5693
- return getFlowLabelPosition(element.waypoints);
5694
- } else if (is$1(element, 'bpmn:Group')) {
5695
- return {
5696
- x: element.x + element.width / 2,
5697
- y: element.y + DEFAULT_LABEL_SIZE.height / 2
5698
- };
5699
- } else {
5700
- return {
5701
- x: element.x + element.width / 2,
5702
- y: element.y + element.height + DEFAULT_LABEL_SIZE.height / 2
5703
- };
5704
- }
5757
+ function getDefaultExportFromCjs (x) {
5758
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5705
5759
  }
5706
5760
 
5707
-
5708
5761
  /**
5709
- * Return the bounds of an elements label, parsed from the elements DI or
5710
- * generated from its bounds.
5711
- *
5712
- * @param {ModdleElement} di
5713
- * @param {Element} element
5762
+ * @param {Point} point
5714
5763
  *
5715
- * @return {Rect}
5764
+ * @returns {Point}
5716
5765
  */
5717
- function getExternalLabelBounds(di, element) {
5718
-
5719
- var mid,
5720
- size,
5721
- bounds,
5722
- label = di.label;
5723
-
5724
- if (label && label.bounds) {
5725
- bounds = label.bounds;
5726
-
5727
- size = {
5728
- width: Math.max(DEFAULT_LABEL_SIZE.width, bounds.width),
5729
- height: bounds.height
5730
- };
5731
-
5732
- mid = {
5733
- x: bounds.x + bounds.width / 2,
5734
- y: bounds.y + bounds.height / 2
5735
- };
5736
- } else {
5737
-
5738
- mid = getExternalLabelMid(element);
5739
-
5740
- size = DEFAULT_LABEL_SIZE;
5741
- }
5742
-
5743
- return assign$1({
5744
- x: mid.x - size.width / 2,
5745
- y: mid.y - size.height / 2
5746
- }, size);
5747
- }
5748
-
5749
- function getDefaultExportFromCjs (x) {
5750
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5751
- }
5752
-
5753
5766
  function roundPoint(point) {
5754
5767
 
5755
5768
  return {
@@ -6266,11 +6279,24 @@
6266
6279
  ]
6267
6280
  };
6268
6281
 
6282
+ /**
6283
+ * @typedef {import('../util/Types').Point} Point
6284
+ */
6285
+
6286
+ /**
6287
+ * @param {import('../core/EventBus').Event} event
6288
+ *
6289
+ * @return {Event}
6290
+ */
6269
6291
  function getOriginal(event) {
6270
6292
  return event.originalEvent || event.srcEvent;
6271
6293
  }
6272
6294
 
6273
-
6295
+ /**
6296
+ * @param {Event} event
6297
+ *
6298
+ * @return {Point|null}
6299
+ */
6274
6300
  function toPoint(event) {
6275
6301
 
6276
6302
  if (event.pointers && event.pointers.length) {
@@ -6291,22 +6317,43 @@
6291
6317
  return (/mac/i).test(navigator.platform);
6292
6318
  }
6293
6319
 
6320
+ /**
6321
+ * @param {MouseEvent} event
6322
+ * @param {string} button
6323
+ *
6324
+ * @return {boolean}
6325
+ */
6294
6326
  function isButton(event, button) {
6295
6327
  return (getOriginal(event) || event).button === button;
6296
6328
  }
6297
6329
 
6330
+ /**
6331
+ * @param {MouseEvent} event
6332
+ *
6333
+ * @return {boolean}
6334
+ */
6298
6335
  function isPrimaryButton(event) {
6299
6336
 
6300
6337
  // button === 0 -> left áka primary mouse button
6301
6338
  return isButton(event, 0);
6302
6339
  }
6303
6340
 
6341
+ /**
6342
+ * @param {MouseEvent} event
6343
+ *
6344
+ * @return {boolean}
6345
+ */
6304
6346
  function isAuxiliaryButton(event) {
6305
6347
 
6306
6348
  // button === 1 -> auxiliary áka wheel button
6307
6349
  return isButton(event, 1);
6308
6350
  }
6309
6351
 
6352
+ /**
6353
+ * @param {MouseEvent} event
6354
+ *
6355
+ * @return {boolean}
6356
+ */
6310
6357
  function hasPrimaryModifier(event) {
6311
6358
  var originalEvent = getOriginal(event) || event;
6312
6359
 
@@ -6322,7 +6369,11 @@
6322
6369
  }
6323
6370
  }
6324
6371
 
6325
-
6372
+ /**
6373
+ * @param {MouseEvent} event
6374
+ *
6375
+ * @return {boolean}
6376
+ */
6326
6377
  function hasSecondaryModifier(event) {
6327
6378
  var originalEvent = getOriginal(event) || event;
6328
6379
 
@@ -6887,7 +6938,13 @@
6887
6938
  };
6888
6939
  }
6889
6940
 
6890
-
6941
+ /**
6942
+ * Get the element's type
6943
+ *
6944
+ * @param {Element} element
6945
+ *
6946
+ * @return {'connection' | 'shape' | 'root'}
6947
+ */
6891
6948
  function getType(element) {
6892
6949
 
6893
6950
  if ('waypoints' in element) {
@@ -6901,8 +6958,12 @@
6901
6958
  return 'root';
6902
6959
  }
6903
6960
 
6961
+ /**
6962
+ * @param {Element} element
6963
+ *
6964
+ * @return {boolean}
6965
+ */
6904
6966
  function isFrameElement(element) {
6905
-
6906
6967
  return !!(element && element.isFrame);
6907
6968
  }
6908
6969
 
@@ -7417,7 +7478,7 @@
7417
7478
  *
7418
7479
  * The ids can be customized via a given prefix and contain a random value to avoid collisions.
7419
7480
  *
7420
- * @param {string} prefix a prefix to prepend to generated ids (for better readability)
7481
+ * @param {string} [prefix] a prefix to prepend to generated ids (for better readability)
7421
7482
  */
7422
7483
  function IdGenerator(prefix) {
7423
7484
 
@@ -8525,6 +8586,7 @@
8525
8586
 
8526
8587
  /**
8527
8588
  * @param {string} str
8589
+ *
8528
8590
  * @return {string}
8529
8591
  */
8530
8592
 
@@ -8536,6 +8598,11 @@
8536
8598
  '\'': '&#39;'
8537
8599
  };
8538
8600
 
8601
+ /**
8602
+ * @param {string} str
8603
+ *
8604
+ * @return {string}
8605
+ */
8539
8606
  function escapeHTML(str) {
8540
8607
  str = '' + str;
8541
8608
 
@@ -9894,13 +9961,14 @@
9894
9961
  var self = this;
9895
9962
 
9896
9963
  /**
9897
- * Builds a style definition from a className, a list of traits and an object of additional attributes.
9964
+ * Builds a style definition from a className, a list of traits and an object
9965
+ * of additional attributes.
9898
9966
  *
9899
9967
  * @param {string} className
9900
- * @param {string[]} traits
9901
- * @param {Object} additionalAttrs
9968
+ * @param {string[]} [traits]
9969
+ * @param {Object} [additionalAttrs]
9902
9970
  *
9903
- * @return {Object} the style defintion
9971
+ * @return {Object} the style definition
9904
9972
  */
9905
9973
  this.cls = function(className, traits, additionalAttrs) {
9906
9974
  var attrs = this.style(traits, additionalAttrs);
@@ -9909,12 +9977,13 @@
9909
9977
  };
9910
9978
 
9911
9979
  /**
9912
- * Builds a style definition from a list of traits and an object of additional attributes.
9980
+ * Builds a style definition from a list of traits and an object of additional
9981
+ * attributes.
9913
9982
  *
9914
- * @param {string[]} traits
9983
+ * @param {string[]} [traits]
9915
9984
  * @param {Object} additionalAttrs
9916
9985
  *
9917
- * @return {Object} the style defintion
9986
+ * @return {Object} the style definition
9918
9987
  */
9919
9988
  this.style = function(traits, additionalAttrs) {
9920
9989
 
@@ -9930,6 +9999,17 @@
9930
9999
  return additionalAttrs ? assign$1(attrs, additionalAttrs) : attrs;
9931
10000
  };
9932
10001
 
10002
+
10003
+ /**
10004
+ * Computes a style definition from a list of traits and an object of
10005
+ * additional attributes, with custom style definition object.
10006
+ *
10007
+ * @param {Object} custom
10008
+ * @param {string[]} [traits]
10009
+ * @param {Object} defaultStyles
10010
+ *
10011
+ * @return {Object} the style definition
10012
+ */
9933
10013
  this.computeStyle = function(custom, traits, defaultStyles) {
9934
10014
  if (!isArray$2(traits)) {
9935
10015
  defaultStyles = traits;
@@ -9978,7 +10058,7 @@
9978
10058
  *
9979
10059
  * @param {Array<Object>} collection
9980
10060
  * @param {Object} element
9981
- * @param {number} idx
10061
+ * @param {number} [idx]
9982
10062
  */
9983
10063
  function add(collection, element, idx) {
9984
10064
 
@@ -10587,11 +10667,13 @@
10587
10667
  *
10588
10668
  * @example
10589
10669
  *
10670
+ * ```javascript
10590
10671
  * canvas.addMarker('foo', 'some-marker');
10591
10672
  *
10592
10673
  * const fooGfx = canvas.getGraphics('foo');
10593
10674
  *
10594
10675
  * fooGfx; // <g class="... some-marker"> ... </g>
10676
+ * ```
10595
10677
  *
10596
10678
  * @param {ShapeLike|ConnectionLike|string} element The element or its ID.
10597
10679
  * @param {string} marker The marker.
@@ -10997,7 +11079,7 @@
10997
11079
  *
10998
11080
  * @memberOf Canvas
10999
11081
  *
11000
- * @event ShapeRemoved
11082
+ * @event ShapeRemovedEvent
11001
11083
  * @type {Object}
11002
11084
  * @property {ShapeLike} element The shape.
11003
11085
  * @property {SVGElement} gfx The graphical element.
@@ -11034,7 +11116,7 @@
11034
11116
  *
11035
11117
  * @memberOf Canvas
11036
11118
  *
11037
- * @event connection.removed
11119
+ * @event ConnectionRemovedEvent
11038
11120
  * @type {Object}
11039
11121
  * @property {ConnectionLike} element The connection.
11040
11122
  * @property {SVGElement} gfx The graphical element.
@@ -11093,6 +11175,7 @@
11093
11175
  *
11094
11176
  * @example
11095
11177
  *
11178
+ * ```javascript
11096
11179
  * canvas.viewbox({ x: 100, y: 100, width: 500, height: 500 })
11097
11180
  *
11098
11181
  * // sets the visible area of the diagram to (100|100) -> (600|100)
@@ -11120,6 +11203,7 @@
11120
11203
  * width: zoomedAndScrolledViewbox.outer.width,
11121
11204
  * height: zoomedAndScrolledViewbox.outer.height
11122
11205
  * });
11206
+ * ```
11123
11207
  *
11124
11208
  * @param {Rect} [box] The viewbox to be set.
11125
11209
  *
@@ -11627,9 +11711,11 @@
11627
11711
  *
11628
11712
  * @example
11629
11713
  *
11714
+ * ```javascript
11630
11715
  * elementRegistry.get('SomeElementId_1');
11631
11716
  *
11632
11717
  * elementRegistry.get(gfx);
11718
+ * ```
11633
11719
  *
11634
11720
  * @param {string|SVGElement} filter The elements ID or graphical representation.
11635
11721
  *
@@ -11723,11 +11809,13 @@
11723
11809
  *
11724
11810
  * @example
11725
11811
  *
11812
+ * ```javascript
11726
11813
  * elementRegistry.getGraphics('SomeElementId_1');
11727
11814
  *
11728
11815
  * elementRegistry.getGraphics(rootElement); // <g ...>
11729
11816
  *
11730
11817
  * elementRegistry.getGraphics(rootElement, true); // <svg ...>
11818
+ * ```
11731
11819
  *
11732
11820
  * @param {ElementLike|string} filter The element or its ID.
11733
11821
  * @param {boolean} [secondary=false] Whether to return the secondary graphical representation.
@@ -12307,7 +12395,7 @@
12307
12395
  *
12308
12396
  * @example
12309
12397
  *
12310
- * ```
12398
+ * ```javascript
12311
12399
  * import * as Model from 'diagram-js/lib/model';
12312
12400
  *
12313
12401
  * const root = Model.create('root', {
@@ -12330,7 +12418,7 @@
12330
12418
  *
12331
12419
  * @example
12332
12420
  *
12333
- * ```
12421
+ * ```javascript
12334
12422
  * import * as Model from 'diagram-js/lib/model';
12335
12423
  *
12336
12424
  * const connection = Model.create('connection', {
@@ -12353,7 +12441,7 @@
12353
12441
  *
12354
12442
  * @example
12355
12443
  *
12356
- * ```
12444
+ * ```javascript
12357
12445
  * import * as Model from 'diagram-js/lib/model';
12358
12446
  *
12359
12447
  * const shape = Model.create('shape', {
@@ -12374,7 +12462,7 @@
12374
12462
  *
12375
12463
  * @example
12376
12464
  *
12377
- * ```
12465
+ * ```javascript
12378
12466
  * import * as Model from 'diagram-js/lib/model';
12379
12467
  *
12380
12468
  * const label = Model.create('label', {
@@ -12387,7 +12475,7 @@
12387
12475
  * ```
12388
12476
  *
12389
12477
  * @param {'label'} type
12390
- * @param {any} [attrs]
12478
+ * @param {Object} [attrs]
12391
12479
  * @return {Label}
12392
12480
  */
12393
12481
  function create(type, attrs) {
@@ -12685,7 +12773,6 @@
12685
12773
  });
12686
12774
  };
12687
12775
 
12688
-
12689
12776
  /**
12690
12777
  * Register an event listener that is called only once.
12691
12778
  *
@@ -12956,7 +13043,7 @@
12956
13043
  * * after: [ 1500, 1500, (new=1300), 1000, 1000, (new=1000) ]
12957
13044
  *
12958
13045
  * @param {string} event
12959
- * @param {EventBusListener} listener
13046
+ * @param {EventBusListener} newListener
12960
13047
  */
12961
13048
  EventBus.prototype._addListener = function(event, newListener) {
12962
13049
 
@@ -13554,9 +13641,11 @@
13554
13641
  *
13555
13642
  * @example
13556
13643
  *
13644
+ * ```javascript
13557
13645
  * eventBus.on('diagram.init', function() {
13558
13646
  * eventBus.fire('my-custom-event', { foo: 'BAR' });
13559
13647
  * });
13648
+ * ```
13560
13649
  *
13561
13650
  * @type {Object}
13562
13651
  */
@@ -22856,6 +22945,7 @@
22856
22945
 
22857
22946
  /**
22858
22947
  * @param {KeyboardEvent} event
22948
+ * @return {boolean}
22859
22949
  */
22860
22950
  function isCmd(event) {
22861
22951
 
@@ -22873,6 +22963,7 @@
22873
22963
  *
22874
22964
  * @param {string|string[]} keys
22875
22965
  * @param {KeyboardEvent} event
22966
+ * @return {boolean}
22876
22967
  */
22877
22968
  function isKey(keys, event) {
22878
22969
  keys = isArray$2(keys) ? keys : [ keys ];
@@ -22887,18 +22978,30 @@
22887
22978
  return event.shiftKey;
22888
22979
  }
22889
22980
 
22981
+ /**
22982
+ * @param {KeyboardEvent} event
22983
+ */
22890
22984
  function isCopy(event) {
22891
22985
  return isCmd(event) && isKey(KEYS_COPY, event);
22892
22986
  }
22893
22987
 
22988
+ /**
22989
+ * @param {KeyboardEvent} event
22990
+ */
22894
22991
  function isPaste(event) {
22895
22992
  return isCmd(event) && isKey(KEYS_PASTE, event);
22896
22993
  }
22897
22994
 
22995
+ /**
22996
+ * @param {KeyboardEvent} event
22997
+ */
22898
22998
  function isUndo(event) {
22899
22999
  return isCmd(event) && !isShift(event) && isKey(KEYS_UNDO, event);
22900
23000
  }
22901
23001
 
23002
+ /**
23003
+ * @param {KeyboardEvent} event
23004
+ */
22902
23005
  function isRedo(event) {
22903
23006
  return isCmd(event) && (
22904
23007
  isKey(KEYS_REDO, event) || (
@@ -22909,6 +23012,8 @@
22909
23012
 
22910
23013
  /**
22911
23014
  * @typedef {import('../../core/EventBus').default} EventBus
23015
+ *
23016
+ * @typedef {({ keyEvent: KeyboardEvent }) => any} Listener
22912
23017
  */
22913
23018
 
22914
23019
  var KEYDOWN_EVENT = 'keyboard.keydown',
@@ -22940,6 +23045,7 @@
22940
23045
  * `keyboard.bindTo` configuration option.
22941
23046
  *
22942
23047
  * @param {Object} config
23048
+ * @param {EventTarget} [config.bindTo]
22943
23049
  * @param {EventBus} eventBus
22944
23050
  */
22945
23051
  function Keyboard(config, eventBus) {
@@ -23031,6 +23137,11 @@
23031
23137
  return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');
23032
23138
  };
23033
23139
 
23140
+ /**
23141
+ * Bind keyboard events to the given DOM node.
23142
+ *
23143
+ * @param {EventTarget} node
23144
+ */
23034
23145
  Keyboard.prototype.bind = function(node) {
23035
23146
 
23036
23147
  // make sure that the keyboard is only bound once to the DOM
@@ -23045,6 +23156,9 @@
23045
23156
  this._fire('bind');
23046
23157
  };
23047
23158
 
23159
+ /**
23160
+ * @return {EventTarget}
23161
+ */
23048
23162
  Keyboard.prototype.getBinding = function() {
23049
23163
  return this._node;
23050
23164
  };
@@ -23063,6 +23177,9 @@
23063
23177
  this._node = null;
23064
23178
  };
23065
23179
 
23180
+ /**
23181
+ * @param {string} event
23182
+ */
23066
23183
  Keyboard.prototype._fire = function(event) {
23067
23184
  this._eventBus.fire('keyboard.' + event, { node: this._node });
23068
23185
  };
@@ -23073,8 +23190,8 @@
23073
23190
  * provided, the default value of 1000 is used.
23074
23191
  *
23075
23192
  * @param {number} [priority]
23076
- * @param {Function} listener
23077
- * @param {string} type
23193
+ * @param {Listener} listener
23194
+ * @param {string} [type='keyboard.keydown']
23078
23195
  */
23079
23196
  Keyboard.prototype.addListener = function(priority, listener, type) {
23080
23197
  if (isFunction(priority)) {
@@ -23086,6 +23203,12 @@
23086
23203
  this._eventBus.on(type || KEYDOWN_EVENT, priority, listener);
23087
23204
  };
23088
23205
 
23206
+ /**
23207
+ * Remove a listener function.
23208
+ *
23209
+ * @param {Listener} listener
23210
+ * @param {string} [type='keyboard.keydown']
23211
+ */
23089
23212
  Keyboard.prototype.removeListener = function(listener, type) {
23090
23213
  this._eventBus.off(type || KEYDOWN_EVENT, listener);
23091
23214
  };
@@ -23358,15 +23481,21 @@
23358
23481
  }
23359
23482
  }
23360
23483
 
23361
- this.moveCanvas = function(opts) {
23484
+ /**
23485
+ * @param {{
23486
+ * direction: 'up' | 'down' | 'left' | 'right';
23487
+ * speed: number;
23488
+ * }} options
23489
+ */
23490
+ this.moveCanvas = function(options) {
23362
23491
 
23363
23492
  var dx = 0,
23364
23493
  dy = 0,
23365
- speed = opts.speed;
23494
+ speed = options.speed;
23366
23495
 
23367
23496
  var actualSpeed = speed / Math.min(Math.sqrt(canvas.viewbox().scale), 1);
23368
23497
 
23369
- switch (opts.direction) {
23498
+ switch (options.direction) {
23370
23499
  case 'left': // Left
23371
23500
  dx = actualSpeed;
23372
23501
  break;
@@ -23409,7 +23538,9 @@
23409
23538
 
23410
23539
  var CURSOR_CLS_PATTERN = /^djs-cursor-.*$/;
23411
23540
 
23412
-
23541
+ /**
23542
+ * @param {string} mode
23543
+ */
23413
23544
  function set(mode) {
23414
23545
  var classes$1 = classes(document.body);
23415
23546
 
@@ -23424,12 +23555,19 @@
23424
23555
  set(null);
23425
23556
  }
23426
23557
 
23558
+ /**
23559
+ * @typedef {import('../core/EventBus').EventBus} EventBus
23560
+ */
23561
+
23427
23562
  var TRAP_PRIORITY = 5000;
23428
23563
 
23429
23564
  /**
23430
23565
  * Installs a click trap that prevents a ghost click following a dragging operation.
23431
23566
  *
23432
- * @return {Function} a function to immediately remove the installed trap.
23567
+ * @param {EventBus} eventBus
23568
+ * @param {string} [eventName='element.click']
23569
+ *
23570
+ * @return {() => void} a function to immediately remove the installed trap.
23433
23571
  */
23434
23572
  function install(eventBus, eventName) {
23435
23573
 
@@ -23446,6 +23584,17 @@
23446
23584
  };
23447
23585
  }
23448
23586
 
23587
+ /**
23588
+ * @typedef {import('../util/Types').Point} Point
23589
+ * @typedef {import('../util/Types').Rect} Rect
23590
+ */
23591
+
23592
+
23593
+ /**
23594
+ * @param {Point} a
23595
+ * @param {Point} b
23596
+ * @return {Point}
23597
+ */
23449
23598
  function delta(a, b) {
23450
23599
  return {
23451
23600
  x: a.x - b.x,
@@ -23594,6 +23743,7 @@
23594
23743
  * @param {Object} range
23595
23744
  * @param {number} range.min
23596
23745
  * @param {number} range.max
23746
+ * @param {number} steps
23597
23747
  */
23598
23748
  function getStepSize(range, steps) {
23599
23749
 
@@ -23605,6 +23755,12 @@
23605
23755
  return absoluteLinearRange / steps;
23606
23756
  }
23607
23757
 
23758
+ /**
23759
+ * @param {Object} range
23760
+ * @param {number} range.min
23761
+ * @param {number} range.max
23762
+ * @param {number} scale
23763
+ */
23608
23764
  function cap(range, scale) {
23609
23765
  return Math.max(range.min, Math.min(range.max, scale));
23610
23766
  }