bpmn-js 17.11.1 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/dist/assets/diagram-js.css +17 -8
  2. package/dist/bpmn-modeler.development.js +1396 -1161
  3. package/dist/bpmn-modeler.production.min.js +47 -46
  4. package/dist/bpmn-navigated-viewer.development.js +305 -767
  5. package/dist/bpmn-navigated-viewer.production.min.js +5 -5
  6. package/dist/bpmn-viewer.development.js +277 -699
  7. package/dist/bpmn-viewer.production.min.js +5 -5
  8. package/lib/BaseModeler.d.ts +3 -3
  9. package/lib/BaseViewer.d.ts +8 -8
  10. package/lib/Modeler.d.ts +2 -2
  11. package/lib/Modeler.js +3 -1
  12. package/lib/NavigatedViewer.d.ts +1 -1
  13. package/lib/Viewer.d.ts +1 -1
  14. package/lib/Viewer.js +0 -2
  15. package/lib/core/index.d.ts +1 -1
  16. package/lib/draw/BpmnRenderUtil.d.ts +12 -12
  17. package/lib/draw/BpmnRenderer.d.ts +4 -4
  18. package/lib/draw/TextRenderer.d.ts +2 -2
  19. package/lib/draw/index.d.ts +4 -4
  20. package/lib/features/align-elements/AlignElementsContextPadProvider.d.ts +6 -6
  21. package/lib/features/align-elements/AlignElementsIcons.d.ts +7 -7
  22. package/lib/features/align-elements/AlignElementsMenuProvider.d.ts +6 -6
  23. package/lib/features/align-elements/BpmnAlignElements.d.ts +1 -1
  24. package/lib/features/align-elements/index.d.ts +5 -5
  25. package/lib/features/append-preview/AppendPreview.d.ts +7 -7
  26. package/lib/features/append-preview/index.d.ts +3 -3
  27. package/lib/features/auto-place/BpmnAutoPlace.d.ts +2 -2
  28. package/lib/features/auto-place/BpmnAutoPlaceUtil.d.ts +4 -4
  29. package/lib/features/auto-place/index.d.ts +3 -3
  30. package/lib/features/auto-resize/BpmnAutoResize.d.ts +3 -3
  31. package/lib/features/auto-resize/BpmnAutoResizeProvider.d.ts +3 -3
  32. package/lib/features/auto-resize/index.d.ts +3 -3
  33. package/lib/features/context-pad/ContextPadProvider.d.ts +16 -16
  34. package/lib/features/context-pad/ContextPadProvider.js +2 -6
  35. package/lib/features/context-pad/index.d.ts +3 -3
  36. package/lib/features/copy-paste/BpmnCopyPaste.d.ts +3 -3
  37. package/lib/features/copy-paste/ModdleCopy.d.ts +4 -4
  38. package/lib/features/copy-paste/index.d.ts +4 -4
  39. package/lib/features/di-ordering/BpmnDiOrdering.d.ts +2 -2
  40. package/lib/features/di-ordering/index.d.ts +2 -2
  41. package/lib/features/distribute-elements/BpmnDistributeElements.d.ts +1 -1
  42. package/lib/features/distribute-elements/DistributeElementsIcons.d.ts +2 -2
  43. package/lib/features/distribute-elements/DistributeElementsMenuProvider.d.ts +6 -6
  44. package/lib/features/distribute-elements/index.d.ts +4 -4
  45. package/lib/features/drilldown/DrilldownBreadcrumbs.d.ts +5 -5
  46. package/lib/features/drilldown/DrilldownCentering.d.ts +2 -2
  47. package/lib/features/drilldown/DrilldownOverlayBehavior.d.ts +7 -7
  48. package/lib/features/drilldown/SubprocessCompatibility.d.ts +6 -6
  49. package/lib/features/drilldown/index.d.ts +6 -6
  50. package/lib/features/editor-actions/BpmnEditorActions.d.ts +1 -1
  51. package/lib/features/editor-actions/index.d.ts +2 -2
  52. package/lib/features/grid-snapping/BpmnGridSnapping.d.ts +1 -1
  53. package/lib/features/grid-snapping/behavior/GridSnappingAutoPlaceBehavior.d.ts +4 -4
  54. package/lib/features/grid-snapping/behavior/GridSnappingLayoutConnectionBehavior.d.ts +4 -4
  55. package/lib/features/grid-snapping/behavior/GridSnappingParticipantBehavior.d.ts +3 -3
  56. package/lib/features/grid-snapping/behavior/index.d.ts +4 -4
  57. package/lib/features/grid-snapping/index.d.ts +3 -3
  58. package/lib/features/interaction-events/BpmnInteractionEvents.d.ts +4 -4
  59. package/lib/features/interaction-events/BpmnInteractionEvents.js +2 -6
  60. package/lib/features/interaction-events/index.d.ts +2 -2
  61. package/lib/features/keyboard/BpmnKeyboardBindings.d.ts +3 -3
  62. package/lib/features/keyboard/index.d.ts +3 -3
  63. package/lib/features/label-editing/LabelEditingPreview.d.ts +3 -3
  64. package/lib/features/label-editing/LabelEditingProvider.d.ts +8 -8
  65. package/lib/features/label-editing/cmd/UpdateLabelHandler.d.ts +4 -4
  66. package/lib/features/label-editing/index.d.ts +4 -4
  67. package/lib/features/modeling/BpmnFactory.d.ts +3 -3
  68. package/lib/features/modeling/BpmnLayouter.d.ts +5 -5
  69. package/lib/features/modeling/BpmnUpdater.d.ts +8 -8
  70. package/lib/features/modeling/BpmnUpdater.js +9 -28
  71. package/lib/features/modeling/ElementFactory.d.ts +11 -11
  72. package/lib/features/modeling/ElementFactory.js +1 -2
  73. package/lib/features/modeling/Modeling.d.ts +15 -15
  74. package/lib/features/modeling/Modeling.test.ts +4 -4
  75. package/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.d.ts +7 -8
  76. package/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.js +7 -3
  77. package/lib/features/modeling/behavior/AppendBehavior.d.ts +1 -1
  78. package/lib/features/modeling/behavior/AssociationBehavior.d.ts +2 -2
  79. package/lib/features/modeling/behavior/AttachEventBehavior.d.ts +2 -2
  80. package/lib/features/modeling/behavior/BoundaryEventBehavior.d.ts +2 -2
  81. package/lib/features/modeling/behavior/CompensateBoundaryEventBehavior.d.ts +2 -2
  82. package/lib/features/modeling/behavior/CreateBehavior.d.ts +1 -1
  83. package/lib/features/modeling/behavior/CreateDataObjectBehavior.d.ts +2 -2
  84. package/lib/features/modeling/behavior/CreateParticipantBehavior.d.ts +3 -3
  85. package/lib/features/modeling/behavior/DataInputAssociationBehavior.d.ts +2 -2
  86. package/lib/features/modeling/behavior/DataStoreBehavior.d.ts +4 -4
  87. package/lib/features/modeling/behavior/DeleteLaneBehavior.d.ts +2 -2
  88. package/lib/features/modeling/behavior/DetachEventBehavior.d.ts +2 -2
  89. package/lib/features/modeling/behavior/DropOnFlowBehavior.d.ts +3 -3
  90. package/lib/features/modeling/behavior/EventBasedGatewayBehavior.d.ts +2 -2
  91. package/lib/features/modeling/behavior/FixHoverBehavior.d.ts +3 -3
  92. package/lib/features/modeling/behavior/GroupBehavior.d.ts +9 -9
  93. package/lib/features/modeling/behavior/ImportDockingFix.d.ts +1 -1
  94. package/lib/features/modeling/behavior/IsHorizontalFix.d.ts +1 -1
  95. package/lib/features/modeling/behavior/LabelBehavior.d.ts +6 -6
  96. package/lib/features/modeling/behavior/LayoutConnectionBehavior.d.ts +2 -2
  97. package/lib/features/modeling/behavior/MessageFlowBehavior.d.ts +2 -2
  98. package/lib/features/modeling/behavior/RemoveElementBehavior.d.ts +3 -3
  99. package/lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.d.ts +2 -2
  100. package/lib/features/modeling/behavior/RemoveParticipantBehavior.d.ts +2 -2
  101. package/lib/features/modeling/behavior/ReplaceConnectionBehavior.d.ts +4 -4
  102. package/lib/features/modeling/behavior/ReplaceElementBehaviour.d.ts +6 -6
  103. package/lib/features/modeling/behavior/ResizeBehavior.d.ts +5 -8
  104. package/lib/features/modeling/behavior/ResizeBehavior.js +3 -6
  105. package/lib/features/modeling/behavior/ResizeLaneBehavior.d.ts +2 -2
  106. package/lib/features/modeling/behavior/RootElementReferenceBehavior.d.ts +8 -8
  107. package/lib/features/modeling/behavior/SetCompensationActivityAfterPasteBehavior.d.ts +3 -3
  108. package/lib/features/modeling/behavior/SpaceToolBehavior.d.ts +2 -2
  109. package/lib/features/modeling/behavior/SubProcessPlaneBehavior.d.ts +10 -10
  110. package/lib/features/modeling/behavior/SubProcessStartEventBehavior.d.ts +2 -2
  111. package/lib/features/modeling/behavior/TextAnnotationBehavior.d.ts +1 -1
  112. package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.d.ts +5 -5
  113. package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.d.ts +3 -3
  114. package/lib/features/modeling/behavior/UnclaimIdBehavior.d.ts +4 -4
  115. package/lib/features/modeling/behavior/UnsetDefaultFlowBehavior.d.ts +2 -2
  116. package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.d.ts +2 -2
  117. package/lib/features/modeling/behavior/index.d.ts +1 -1
  118. package/lib/features/modeling/behavior/util/CategoryUtil.d.ts +6 -6
  119. package/lib/features/modeling/behavior/util/ConnectionLayoutUtil.d.ts +2 -2
  120. package/lib/features/modeling/behavior/util/LabelLayoutUtil.d.ts +4 -4
  121. package/lib/features/modeling/behavior/util/LayoutUtil.d.ts +2 -2
  122. package/lib/features/modeling/behavior/util/LineAttachmentUtil.d.ts +2 -2
  123. package/lib/features/modeling/behavior/util/LineIntersect.d.ts +1 -1
  124. package/lib/features/modeling/cmd/AddLaneHandler.d.ts +3 -3
  125. package/lib/features/modeling/cmd/AddLaneHandler.js +5 -10
  126. package/lib/features/modeling/cmd/IdClaimHandler.d.ts +2 -2
  127. package/lib/features/modeling/cmd/ResizeLaneHandler.d.ts +5 -5
  128. package/lib/features/modeling/cmd/SetColorHandler.d.ts +3 -3
  129. package/lib/features/modeling/cmd/SplitLaneHandler.d.ts +2 -2
  130. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.d.ts +3 -3
  131. package/lib/features/modeling/cmd/UpdateFlowNodeRefsHandler.d.ts +3 -3
  132. package/lib/features/modeling/cmd/UpdateModdlePropertiesHandler.d.ts +4 -4
  133. package/lib/features/modeling/cmd/UpdatePropertiesHandler.d.ts +7 -7
  134. package/lib/features/modeling/cmd/UpdateSemanticParentHandler.d.ts +2 -2
  135. package/lib/features/modeling/index.d.ts +8 -8
  136. package/lib/features/modeling/util/LaneUtil.d.ts +2 -2
  137. package/lib/features/modeling/util/ModelingUtil.d.ts +2 -2
  138. package/lib/features/modeling-feedback/ModelingFeedback.d.ts +2 -2
  139. package/lib/features/modeling-feedback/index.d.ts +3 -3
  140. package/lib/features/ordering/BpmnOrderingProvider.d.ts +2 -2
  141. package/lib/features/ordering/index.d.ts +2 -2
  142. package/lib/features/outline/OutlineProvider.d.ts +4 -4
  143. package/lib/features/outline/OutlineUtil.d.ts +1 -1
  144. package/lib/features/outline/index.d.ts +3 -3
  145. package/lib/features/palette/PaletteProvider.d.ts +8 -8
  146. package/lib/features/palette/index.d.ts +3 -3
  147. package/lib/features/popup-menu/ReplaceMenuProvider.d.ts +15 -15
  148. package/lib/features/popup-menu/ReplaceMenuProvider.js +14 -16
  149. package/lib/features/popup-menu/index.d.ts +3 -3
  150. package/lib/features/popup-menu/util/TypeUtil.d.ts +2 -2
  151. package/lib/features/replace/BpmnReplace.d.ts +9 -11
  152. package/lib/features/replace/index.d.ts +2 -2
  153. package/lib/features/replace-preview/BpmnReplacePreview.d.ts +5 -5
  154. package/lib/features/replace-preview/index.d.ts +3 -3
  155. package/lib/features/rules/BpmnRules.d.ts +9 -9
  156. package/lib/features/rules/index.d.ts +3 -3
  157. package/lib/features/search/BpmnSearchProvider.d.ts +12 -7
  158. package/lib/features/search/BpmnSearchProvider.js +40 -152
  159. package/lib/features/search/index.d.ts +3 -3
  160. package/lib/features/search/index.js +3 -1
  161. package/lib/features/snapping/BpmnConnectSnapping.d.ts +5 -5
  162. package/lib/features/snapping/BpmnCreateMoveSnapping.d.ts +7 -7
  163. package/lib/features/snapping/BpmnSnappingUtil.d.ts +3 -3
  164. package/lib/features/snapping/index.d.ts +4 -4
  165. package/lib/features/space-tool/BpmnSpaceTool.d.ts +4 -4
  166. package/lib/features/space-tool/index.d.ts +2 -2
  167. package/lib/import/BpmnImporter.d.ts +11 -11
  168. package/lib/import/BpmnTreeWalker.d.ts +2 -2
  169. package/lib/import/Importer.d.ts +1 -1
  170. package/lib/import/index.d.ts +2 -2
  171. package/lib/index.d.ts +1 -0
  172. package/lib/index.js +3 -0
  173. package/lib/util/CompatibilityUtil.d.ts +1 -1
  174. package/lib/util/DiUtil.d.ts +2 -2
  175. package/lib/util/DrilldownUtil.d.ts +2 -2
  176. package/lib/util/LabelUtil.d.ts +6 -6
  177. package/lib/util/LabelUtil.js +5 -1
  178. package/lib/util/ModelUtil.d.ts +2 -2
  179. package/lib/util/PoweredByUtil.d.ts +2 -2
  180. package/package.json +23 -24
  181. package/index.js +0 -3
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v17.11.1
2
+ * bpmn-js - bpmn-modeler v18.0.0
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: 2024-09-16
11
+ * Date: 2024-11-06
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -5060,6 +5060,11 @@
5060
5060
  */
5061
5061
  this._rootElement = null;
5062
5062
 
5063
+ /**
5064
+ * @type {boolean}
5065
+ */
5066
+ this._focused = false;
5067
+
5063
5068
  this._init(config || {});
5064
5069
  }
5065
5070
 
@@ -5086,14 +5091,33 @@
5086
5091
  * @param {CanvasConfig} config
5087
5092
  */
5088
5093
  Canvas.prototype._init = function(config) {
5089
-
5090
5094
  const eventBus = this._eventBus;
5091
5095
 
5092
5096
  // html container
5093
5097
  const container = this._container = createContainer(config);
5094
5098
 
5095
5099
  const svg = this._svg = create$1('svg');
5096
- attr(svg, { width: '100%', height: '100%' });
5100
+
5101
+ attr(svg, {
5102
+ width: '100%',
5103
+ height: '100%'
5104
+ });
5105
+
5106
+ attr$1(svg, 'tabindex', 0);
5107
+
5108
+ eventBus.on('element.hover', () => {
5109
+ this.restoreFocus();
5110
+ });
5111
+
5112
+ svg.addEventListener('focusin', () => {
5113
+ this._focused = true;
5114
+ eventBus.fire('canvas.focus.changed', { focused: true });
5115
+ });
5116
+
5117
+ svg.addEventListener('focusout', () => {
5118
+ this._focused = false;
5119
+ eventBus.fire('canvas.focus.changed', { focused: false });
5120
+ });
5097
5121
 
5098
5122
  append(container, svg);
5099
5123
 
@@ -5185,6 +5209,31 @@
5185
5209
  delete this._cachedViewbox;
5186
5210
  };
5187
5211
 
5212
+ /**
5213
+ * Sets focus on the canvas SVG element.
5214
+ */
5215
+ Canvas.prototype.focus = function() {
5216
+ this._svg.focus({ preventScroll: true });
5217
+ };
5218
+
5219
+ /**
5220
+ * Sets focus on the canvas SVG element if `document.body` is currently focused.
5221
+ */
5222
+ Canvas.prototype.restoreFocus = function() {
5223
+ if (document.activeElement === document.body) {
5224
+ this.focus();
5225
+ }
5226
+ };
5227
+
5228
+ /**
5229
+ * Returns true if the canvas is focused.
5230
+ *
5231
+ * @return {boolean}
5232
+ */
5233
+ Canvas.prototype.isFocused = function() {
5234
+ return this._focused;
5235
+ };
5236
+
5188
5237
  /**
5189
5238
  * Returns the default layer on which
5190
5239
  * all elements are drawn.
@@ -6024,7 +6073,7 @@
6024
6073
  Canvas.prototype.viewbox = function(box) {
6025
6074
 
6026
6075
  if (box === undefined && this._cachedViewbox) {
6027
- return this._cachedViewbox;
6076
+ return structuredClone(this._cachedViewbox);
6028
6077
  }
6029
6078
 
6030
6079
  const viewport = this._viewport,
@@ -8708,13 +8757,15 @@
8708
8757
  if (parts.length === 1) {
8709
8758
  localName = name;
8710
8759
  prefix = defaultPrefix;
8711
- } else
8760
+ }
8712
8761
 
8713
8762
  // prefix + local name
8714
- if (parts.length === 2) {
8763
+ else if (parts.length === 2) {
8715
8764
  localName = parts[1];
8716
8765
  prefix = parts[0];
8717
- } else {
8766
+ }
8767
+
8768
+ else {
8718
8769
  throw new Error('expected <prefix:localName> or <localName>, got ' + name);
8719
8770
  }
8720
8771
 
@@ -9616,7 +9667,7 @@
9616
9667
  * sub-set of reserved names (&amp;) as well as
9617
9668
  * hex (&#xaaf;) and decimal (&#1231;) encoded characters.
9618
9669
  *
9619
- * @param {string} str
9670
+ * @param {string} s
9620
9671
  *
9621
9672
  * @return {string} decoded string
9622
9673
  */
@@ -9628,10 +9679,6 @@
9628
9679
  return s;
9629
9680
  }
9630
9681
 
9631
- var XSI_URI = 'http://www.w3.org/2001/XMLSchema-instance';
9632
- var XSI_PREFIX = 'xsi';
9633
- var XSI_TYPE$1 = 'xsi:type';
9634
-
9635
9682
  var NON_WHITESPACE_OUTSIDE_ROOT_NODE = 'non-whitespace outside of root node';
9636
9683
 
9637
9684
  function error$2(msg) {
@@ -9676,7 +9723,7 @@
9676
9723
  }
9677
9724
 
9678
9725
  function noopGetContext() {
9679
- return { 'line': 0, 'column': 0 };
9726
+ return { line: 0, column: 0 };
9680
9727
  }
9681
9728
 
9682
9729
  function throwFunc(err) {
@@ -9842,9 +9889,6 @@
9842
9889
  _nsUriToPrefix[k] = nsMap[k];
9843
9890
  }
9844
9891
 
9845
- // FORCE default mapping for schema instance
9846
- _nsUriToPrefix[XSI_URI] = XSI_PREFIX;
9847
-
9848
9892
  isNamespace = true;
9849
9893
  nsUriToPrefix = _nsUriToPrefix;
9850
9894
 
@@ -10168,23 +10212,6 @@
10168
10212
 
10169
10213
  // end: normalize ns attribute name
10170
10214
 
10171
- // normalize xsi:type ns attribute value
10172
- if (name === XSI_TYPE$1) {
10173
- w = value.indexOf(':');
10174
-
10175
- if (w !== -1) {
10176
- nsName = value.substring(0, w);
10177
-
10178
- // handle default prefixes, i.e. xs:String gracefully
10179
- nsName = nsMatrix[nsName] || nsName;
10180
- value = nsName + value.substring(w);
10181
- } else {
10182
- value = defaultAlias + ':' + value;
10183
- }
10184
- }
10185
-
10186
- // end: normalize xsi:type ns attribute value
10187
-
10188
10215
  attrs[name] = value;
10189
10216
  }
10190
10217
 
@@ -10213,23 +10240,6 @@
10213
10240
  : nsName + name.substr(w);
10214
10241
 
10215
10242
  // end: normalize ns attribute name
10216
-
10217
- // normalize xsi:type ns attribute value
10218
- if (name === XSI_TYPE$1) {
10219
- w = value.indexOf(':');
10220
-
10221
- if (w !== -1) {
10222
- nsName = value.substring(0, w);
10223
-
10224
- // handle default prefixes, i.e. xs:String gracefully
10225
- nsName = nsMatrix[nsName] || nsName;
10226
- value = nsName + value.substring(w);
10227
- } else {
10228
- value = defaultAlias + ':' + value;
10229
- }
10230
- }
10231
-
10232
- // end: normalize xsi:type ns attribute value
10233
10243
  }
10234
10244
 
10235
10245
  attrs[name] = value;
@@ -10370,11 +10380,11 @@
10370
10380
  }
10371
10381
  }
10372
10382
 
10373
- w = xml.charCodeAt(i+1);
10383
+ w = xml.charCodeAt(i + 1);
10374
10384
 
10375
10385
  // parse comments + CDATA
10376
10386
  if (w === 33) { // "!"
10377
- q = xml.charCodeAt(i+2);
10387
+ q = xml.charCodeAt(i + 2);
10378
10388
 
10379
10389
  // CDATA section
10380
10390
  if (q === 91 && xml.substr(i + 3, 6) === 'CDATA[') { // 91 == "["
@@ -10658,18 +10668,16 @@
10658
10668
  'xml': 'http://www.w3.org/XML/1998/namespace'
10659
10669
  };
10660
10670
 
10661
- var XSI_TYPE = 'xsi:type';
10671
+ var SERIALIZE_PROPERTY = 'property';
10662
10672
 
10663
- function serializeFormat(element) {
10673
+ function getSerialization(element) {
10664
10674
  return element.xml && element.xml.serialize;
10665
10675
  }
10666
10676
 
10667
- function serializeAsType(element) {
10668
- return serializeFormat(element) === XSI_TYPE;
10669
- }
10677
+ function getSerializationType(element) {
10678
+ const type = getSerialization(element);
10670
10679
 
10671
- function serializeAsProperty(element) {
10672
- return serializeFormat(element) === 'property';
10680
+ return type !== SERIALIZE_PROPERTY && (type || null);
10673
10681
  }
10674
10682
 
10675
10683
  function capitalize(str) {
@@ -10685,12 +10693,20 @@
10685
10693
  return aliasNs.prefix + ':' + capitalize(aliasNs.localName);
10686
10694
  }
10687
10695
 
10696
+ /**
10697
+ * Un-prefix a potentially prefixed type name.
10698
+ *
10699
+ * @param {NsName} nameNs
10700
+ * @param {Object} [pkg]
10701
+ *
10702
+ * @return {string}
10703
+ */
10688
10704
  function prefixedToName(nameNs, pkg) {
10689
10705
 
10690
10706
  var name = nameNs.name,
10691
10707
  localName = nameNs.localName;
10692
10708
 
10693
- var typePrefix = pkg.xml && pkg.xml.typePrefix;
10709
+ var typePrefix = pkg && pkg.xml && pkg.xml.typePrefix;
10694
10710
 
10695
10711
  if (typePrefix && localName.indexOf(typePrefix) === 0) {
10696
10712
  return nameNs.prefix + ':' + localName.slice(typePrefix.length);
@@ -10699,12 +10715,19 @@
10699
10715
  }
10700
10716
  }
10701
10717
 
10702
- function normalizeXsiTypeName(name, model) {
10718
+ function normalizeTypeName(name, nsMap, model) {
10703
10719
 
10704
- var nameNs = parseName(name);
10705
- var pkg = model.getPackage(nameNs.prefix);
10720
+ // normalize against actual NS
10721
+ const nameNs = parseName(name, nsMap.xmlns);
10706
10722
 
10707
- return prefixedToName(nameNs, pkg);
10723
+ const normalizedName = `${ nsMap[nameNs.prefix] || nameNs.prefix }:${ nameNs.localName }`;
10724
+
10725
+ const normalizedNameNs = parseName(normalizedName);
10726
+
10727
+ // determine actual type name, based on package-defined prefix
10728
+ var pkg = model.getPackage(normalizedNameNs.prefix);
10729
+
10730
+ return prefixedToName(normalizedNameNs, pkg);
10708
10731
  }
10709
10732
 
10710
10733
  function error$1(message) {
@@ -10993,8 +11016,9 @@
10993
11016
  } else {
10994
11017
  if (prop) {
10995
11018
  value = coerceType(prop.type, value);
10996
- } else
10997
- if (name !== 'xmlns') {
11019
+ } else if (name === 'xmlns') {
11020
+ name = ':' + name;
11021
+ } else {
10998
11022
  propNameNs = parseName(name, descriptor.ns.prefix);
10999
11023
 
11000
11024
  // check whether attribute is defined in a well-known namespace
@@ -11027,26 +11051,27 @@
11027
11051
  descriptor = getModdleDescriptor(type);
11028
11052
 
11029
11053
  var propertyName = nameNs.name,
11030
- property = descriptor.propertiesByName[propertyName],
11031
- elementTypeName,
11032
- elementType;
11054
+ property = descriptor.propertiesByName[propertyName];
11033
11055
 
11034
11056
  // search for properties by name first
11035
11057
 
11036
11058
  if (property && !property.isAttr) {
11037
11059
 
11038
- if (serializeAsType(property)) {
11039
- elementTypeName = node.attributes[XSI_TYPE];
11060
+ const serializationType = getSerializationType(property);
11061
+
11062
+ if (serializationType) {
11063
+ const elementTypeName = node.attributes[serializationType];
11040
11064
 
11041
- // xsi type is optional, if it does not exists the
11065
+ // type is optional, if it does not exists the
11042
11066
  // default type is assumed
11043
11067
  if (elementTypeName) {
11044
11068
 
11069
+ // convert the prefix used to the mapped form, but also
11045
11070
  // take possible type prefixes from XML
11046
- // into account, i.e.: xsi:type="t{ActualType}"
11047
- elementTypeName = normalizeXsiTypeName(elementTypeName, model);
11071
+ // into account, i.e.: xsi:type="t{ActualType}",
11072
+ const normalizedTypeName = normalizeTypeName(elementTypeName, node.ns, model);
11048
11073
 
11049
- elementType = model.getType(elementTypeName);
11074
+ const elementType = model.getType(normalizedTypeName);
11050
11075
 
11051
11076
  return assign$1({}, property, {
11052
11077
  effectiveType: getModdleDescriptor(elementType).name
@@ -11061,8 +11086,8 @@
11061
11086
  var pkg = model.getPackage(nameNs.prefix);
11062
11087
 
11063
11088
  if (pkg) {
11064
- elementTypeName = aliasToName(nameNs, pkg);
11065
- elementType = model.getType(elementTypeName);
11089
+ const elementTypeName = aliasToName(nameNs, pkg);
11090
+ const elementType = model.getType(elementTypeName);
11066
11091
 
11067
11092
  // search for collection members later
11068
11093
  property = find(descriptor.properties, function(p) {
@@ -11484,9 +11509,12 @@
11484
11509
  uriMap[p.uri] = p.prefix;
11485
11510
 
11486
11511
  return uriMap;
11487
- }, {
11488
- 'http://www.w3.org/XML/1998/namespace': 'xml' // add default xml ns
11489
- });
11512
+ }, Object.entries(DEFAULT_NS_MAP).reduce(function(map, [ prefix, url ]) {
11513
+ map[url] = prefix;
11514
+
11515
+ return map;
11516
+ }, model.config && model.config.nsMap || {}));
11517
+
11490
11518
  parser
11491
11519
  .ns(uriMap)
11492
11520
  .on('openTag', function(obj, decodeStr, selfClosing, getContext) {
@@ -11587,75 +11615,82 @@
11587
11615
 
11588
11616
  function Namespaces(parent) {
11589
11617
 
11590
- var prefixMap = {};
11591
- var uriMap = {};
11592
- var used = {};
11618
+ this.prefixMap = {};
11619
+ this.uriMap = {};
11620
+ this.used = {};
11593
11621
 
11594
- var wellknown = [];
11595
- var custom = [];
11622
+ this.wellknown = [];
11623
+ this.custom = [];
11624
+ this.parent = parent;
11596
11625
 
11597
- // API
11626
+ this.defaultPrefixMap = parent && parent.defaultPrefixMap || {};
11627
+ }
11598
11628
 
11599
- this.byUri = function(uri) {
11600
- return uriMap[uri] || (
11601
- parent && parent.byUri(uri)
11602
- );
11603
- };
11629
+ Namespaces.prototype.mapDefaultPrefixes = function(defaultPrefixMap) {
11630
+ this.defaultPrefixMap = defaultPrefixMap;
11631
+ };
11604
11632
 
11605
- this.add = function(ns, isWellknown) {
11633
+ Namespaces.prototype.defaultUriByPrefix = function(prefix) {
11634
+ return this.defaultPrefixMap[prefix];
11635
+ };
11606
11636
 
11607
- uriMap[ns.uri] = ns;
11637
+ Namespaces.prototype.byUri = function(uri) {
11638
+ return this.uriMap[uri] || (
11639
+ this.parent && this.parent.byUri(uri)
11640
+ );
11641
+ };
11608
11642
 
11609
- if (isWellknown) {
11610
- wellknown.push(ns);
11611
- } else {
11612
- custom.push(ns);
11613
- }
11643
+ Namespaces.prototype.add = function(ns, isWellknown) {
11614
11644
 
11615
- this.mapPrefix(ns.prefix, ns.uri);
11616
- };
11645
+ this.uriMap[ns.uri] = ns;
11617
11646
 
11618
- this.uriByPrefix = function(prefix) {
11619
- return prefixMap[prefix || 'xmlns'];
11620
- };
11647
+ if (isWellknown) {
11648
+ this.wellknown.push(ns);
11649
+ } else {
11650
+ this.custom.push(ns);
11651
+ }
11621
11652
 
11622
- this.mapPrefix = function(prefix, uri) {
11623
- prefixMap[prefix || 'xmlns'] = uri;
11624
- };
11653
+ this.mapPrefix(ns.prefix, ns.uri);
11654
+ };
11625
11655
 
11626
- this.getNSKey = function(ns) {
11627
- return (ns.prefix !== undefined) ? (ns.uri + '|' + ns.prefix) : ns.uri;
11628
- };
11656
+ Namespaces.prototype.uriByPrefix = function(prefix) {
11657
+ return this.prefixMap[prefix || 'xmlns'] || (
11658
+ this.parent && this.parent.uriByPrefix(prefix)
11659
+ );
11660
+ };
11629
11661
 
11630
- this.logUsed = function(ns) {
11662
+ Namespaces.prototype.mapPrefix = function(prefix, uri) {
11663
+ this.prefixMap[prefix || 'xmlns'] = uri;
11664
+ };
11631
11665
 
11632
- var uri = ns.uri;
11633
- var nsKey = this.getNSKey(ns);
11666
+ Namespaces.prototype.getNSKey = function(ns) {
11667
+ return (ns.prefix !== undefined) ? (ns.uri + '|' + ns.prefix) : ns.uri;
11668
+ };
11634
11669
 
11635
- used[nsKey] = this.byUri(uri);
11670
+ Namespaces.prototype.logUsed = function(ns) {
11636
11671
 
11637
- // Inform parent recursively about the usage of this NS
11638
- if (parent) {
11639
- parent.logUsed(ns);
11640
- }
11641
- };
11672
+ var uri = ns.uri;
11673
+ var nsKey = this.getNSKey(ns);
11642
11674
 
11643
- this.getUsed = function(ns) {
11675
+ this.used[nsKey] = this.byUri(uri);
11644
11676
 
11645
- function isUsed(ns) {
11646
- var nsKey = self.getNSKey(ns);
11677
+ // Inform parent recursively about the usage of this NS
11678
+ if (this.parent) {
11679
+ this.parent.logUsed(ns);
11680
+ }
11681
+ };
11647
11682
 
11648
- return used[nsKey];
11649
- }
11683
+ Namespaces.prototype.getUsed = function(ns) {
11650
11684
 
11651
- var self = this;
11685
+ var allNs = [].concat(this.wellknown, this.custom);
11652
11686
 
11653
- var allNs = [].concat(wellknown, custom);
11687
+ return allNs.filter(ns => {
11688
+ var nsKey = this.getNSKey(ns);
11654
11689
 
11655
- return allNs.filter(isUsed);
11656
- };
11690
+ return this.used[nsKey];
11691
+ });
11692
+ };
11657
11693
 
11658
- }
11659
11694
 
11660
11695
  function lower(string) {
11661
11696
  return string.charAt(0).toLowerCase() + string.slice(1);
@@ -11870,7 +11905,7 @@
11870
11905
  var isGeneric = elementDescriptor.isGeneric;
11871
11906
 
11872
11907
  if (isGeneric) {
11873
- otherAttrs = this.parseGeneric(element);
11908
+ otherAttrs = this.parseGenericNsAttributes(element);
11874
11909
  } else {
11875
11910
  otherAttrs = this.parseNsAttributes(element);
11876
11911
  }
@@ -11884,7 +11919,9 @@
11884
11919
  // compute tag name
11885
11920
  this.tagName = this.addTagName(this.ns);
11886
11921
 
11887
- if (!isGeneric) {
11922
+ if (isGeneric) {
11923
+ this.parseGenericContainments(element);
11924
+ } else {
11888
11925
  properties = getSerializableProperties(element);
11889
11926
 
11890
11927
  this.parseAttributes(filterAttributes(properties));
@@ -11947,35 +11984,29 @@
11947
11984
  }
11948
11985
  };
11949
11986
 
11950
- ElementSerializer.prototype.parseGeneric = function(element) {
11951
-
11952
- var self = this,
11953
- body = this.body;
11954
-
11955
- var attributes = [];
11987
+ ElementSerializer.prototype.parseGenericNsAttributes = function(element) {
11956
11988
 
11957
- forEach$1(element, function(val, key) {
11989
+ return Object.entries(element).filter(
11990
+ ([ key, value ]) => !key.startsWith('$') && this.parseNsAttribute(element, key, value)
11991
+ ).map(
11992
+ ([ key, value ]) => ({ name: key, value: value })
11993
+ );
11994
+ };
11958
11995
 
11959
- var nonNsAttr;
11996
+ ElementSerializer.prototype.parseGenericContainments = function(element) {
11997
+ var body = element.$body;
11960
11998
 
11961
- if (key === '$body') {
11962
- body.push(new BodySerializer().build({ type: 'String' }, val));
11963
- } else
11964
- if (key === '$children') {
11965
- forEach$1(val, function(child) {
11966
- body.push(new ElementSerializer(self).build(child));
11967
- });
11968
- } else
11969
- if (key.indexOf('$') !== 0) {
11970
- nonNsAttr = self.parseNsAttribute(element, key, val);
11999
+ if (body) {
12000
+ this.body.push(new BodySerializer().build({ type: 'String' }, body));
12001
+ }
11971
12002
 
11972
- if (nonNsAttr) {
11973
- attributes.push({ name: key, value: val });
11974
- }
11975
- }
11976
- });
12003
+ var children = element.$children;
11977
12004
 
11978
- return attributes;
12005
+ if (children) {
12006
+ forEach$1(children, child => {
12007
+ this.body.push(new ElementSerializer(this).build(child));
12008
+ });
12009
+ }
11979
12010
  };
11980
12011
 
11981
12012
  ElementSerializer.prototype.parseNsAttribute = function(element, name, value) {
@@ -12022,7 +12053,7 @@
12022
12053
  * @param {Object} element
12023
12054
  * @return {Array<Object>}
12024
12055
  */
12025
- ElementSerializer.prototype.parseNsAttributes = function(element, attrs) {
12056
+ ElementSerializer.prototype.parseNsAttributes = function(element) {
12026
12057
  var self = this;
12027
12058
 
12028
12059
  var genericAttrs = element.$attrs;
@@ -12050,21 +12081,16 @@
12050
12081
 
12051
12082
  forEach$1(attributes, function(attr) {
12052
12083
 
12053
- // do not serialize xsi:type attribute
12054
- // it is set manually based on the actual implementation type
12055
- if (attr.name === XSI_TYPE) {
12056
- return;
12057
- }
12058
-
12059
12084
  try {
12060
12085
  self.addAttribute(self.nsAttributeName(attr.name), attr.value);
12061
12086
  } catch (e) {
12062
- /* global console */
12063
12087
 
12064
- console.warn(
12065
- 'missing namespace information for ',
12066
- attr.name, '=', attr.value, 'on', element,
12067
- e);
12088
+ // eslint-disable-next-line no-undef
12089
+ typeof console !== 'undefined' && console.warn(
12090
+ `missing namespace information for <${
12091
+ attr.name
12092
+ }=${ attr.value }> on`, element, e
12093
+ );
12068
12094
  }
12069
12095
  });
12070
12096
  };
@@ -12086,13 +12112,11 @@
12086
12112
 
12087
12113
  if (p.isBody) {
12088
12114
  body.push(new BodySerializer().build(p, value[0]));
12089
- } else
12090
- if (isSimple(p.type)) {
12115
+ } else if (isSimple(p.type)) {
12091
12116
  forEach$1(value, function(v) {
12092
12117
  body.push(new ValueSerializer(self.addTagName(self.nsPropertyTagName(p))).build(p, v));
12093
12118
  });
12094
- } else
12095
- if (isReference) {
12119
+ } else if (isReference) {
12096
12120
  forEach$1(value, function(v) {
12097
12121
  body.push(new ReferenceSerializer(self.addTagName(self.nsPropertyTagName(p))).build(v));
12098
12122
  });
@@ -12100,17 +12124,17 @@
12100
12124
 
12101
12125
  // allow serialization via type
12102
12126
  // rather than element name
12103
- var asType = serializeAsType(p),
12104
- asProperty = serializeAsProperty(p);
12127
+ var serialization = getSerialization(p);
12105
12128
 
12106
12129
  forEach$1(value, function(v) {
12107
12130
  var serializer;
12108
12131
 
12109
- if (asType) {
12110
- serializer = new TypeSerializer(self, p);
12111
- } else
12112
- if (asProperty) {
12113
- serializer = new ElementSerializer(self, p);
12132
+ if (serialization) {
12133
+ if (serialization === SERIALIZE_PROPERTY) {
12134
+ serializer = new ElementSerializer(self, p);
12135
+ } else {
12136
+ serializer = new TypeSerializer(self, p, serialization);
12137
+ }
12114
12138
  } else {
12115
12139
  serializer = new ElementSerializer(self);
12116
12140
  }
@@ -12158,9 +12182,7 @@
12158
12182
  };
12159
12183
 
12160
12184
  ElementSerializer.prototype.logNamespaceUsed = function(ns, local) {
12161
- var element = this.element,
12162
- model = element.$model,
12163
- namespaces = this.getNamespaces(local);
12185
+ var namespaces = this.getNamespaces(local);
12164
12186
 
12165
12187
  // ns may be
12166
12188
  //
@@ -12178,7 +12200,7 @@
12178
12200
  return { localName: ns.localName };
12179
12201
  }
12180
12202
 
12181
- wellknownUri = DEFAULT_NS_MAP[prefix] || model && (model.getPackage(prefix) || {}).uri;
12203
+ wellknownUri = namespaces.defaultUriByPrefix(prefix);
12182
12204
 
12183
12205
  uri = uri || wellknownUri || namespaces.uriByPrefix(prefix);
12184
12206
 
@@ -12188,6 +12210,11 @@
12188
12210
 
12189
12211
  ns = namespaces.byUri(uri);
12190
12212
 
12213
+ // register new default prefix <xmlns> in local scope
12214
+ if (!ns && !prefix) {
12215
+ ns = this.logNamespace({ uri }, wellknownUri === uri, true);
12216
+ }
12217
+
12191
12218
  if (!ns) {
12192
12219
  newPrefix = prefix;
12193
12220
  idx = 1;
@@ -12219,8 +12246,7 @@
12219
12246
 
12220
12247
  if (!p.isMany) {
12221
12248
  value = value.id;
12222
- }
12223
- else {
12249
+ } else {
12224
12250
  var values = [];
12225
12251
  forEach$1(value, function(v) {
12226
12252
  values.push(v.id);
@@ -12324,20 +12350,25 @@
12324
12350
  /**
12325
12351
  * A serializer for types that handles serialization of data types
12326
12352
  */
12327
- function TypeSerializer(parent, propertyDescriptor) {
12353
+ function TypeSerializer(parent, propertyDescriptor, serialization) {
12328
12354
  ElementSerializer.call(this, parent, propertyDescriptor);
12355
+
12356
+ this.serialization = serialization;
12329
12357
  }
12330
12358
 
12331
12359
  inherits(TypeSerializer, ElementSerializer);
12332
12360
 
12333
12361
  TypeSerializer.prototype.parseNsAttributes = function(element) {
12334
12362
 
12335
- // extracted attributes
12336
- var attributes = ElementSerializer.prototype.parseNsAttributes.call(this, element);
12363
+ // extracted attributes with serialization attribute
12364
+ // <type=typeName> stripped; it may be later
12365
+ var attributes = ElementSerializer.prototype.parseNsAttributes.call(this, element).filter(
12366
+ attr => attr.name !== this.serialization
12367
+ );
12337
12368
 
12338
12369
  var descriptor = element.$descriptor;
12339
12370
 
12340
- // only serialize xsi:type if necessary
12371
+ // only serialize <type=typeName> if necessary
12341
12372
  if (descriptor.name === this.propertyDescriptor.type) {
12342
12373
  return attributes;
12343
12374
  }
@@ -12352,7 +12383,7 @@
12352
12383
  typePrefix = (pkg.xml && pkg.xml.typePrefix) || '';
12353
12384
 
12354
12385
  this.addAttribute(
12355
- this.nsAttributeName(XSI_TYPE),
12386
+ this.nsAttributeName(this.serialization),
12356
12387
  (typeNs.prefix ? typeNs.prefix + ':' : '') + typePrefix + descriptor.ns.localName
12357
12388
  );
12358
12389
 
@@ -12425,7 +12456,13 @@
12425
12456
  formatingWriter.append(XML_PREAMBLE);
12426
12457
  }
12427
12458
 
12428
- new ElementSerializer().build(tree).serializeTo(formatingWriter);
12459
+ var serializer = new ElementSerializer();
12460
+
12461
+ var model = tree.$model;
12462
+
12463
+ serializer.getNamespaces().mapDefaultPrefixes(getDefaultPrefixMappings(model));
12464
+
12465
+ serializer.build(tree).serializeTo(formatingWriter);
12429
12466
 
12430
12467
  if (!writer) {
12431
12468
  return internalWriter.value;
@@ -12437,6 +12474,39 @@
12437
12474
  };
12438
12475
  }
12439
12476
 
12477
+
12478
+ // helpers ///////////
12479
+
12480
+ /**
12481
+ * @param {Moddle} model
12482
+ *
12483
+ * @return { Record<string, string> } map from prefix to URI
12484
+ */
12485
+ function getDefaultPrefixMappings(model) {
12486
+
12487
+ const nsMap = model.config && model.config.nsMap || {};
12488
+
12489
+ const prefixMap = {};
12490
+
12491
+ // { prefix -> uri }
12492
+ for (const prefix in DEFAULT_NS_MAP) {
12493
+ prefixMap[prefix] = DEFAULT_NS_MAP[prefix];
12494
+ }
12495
+
12496
+ // { uri -> prefix }
12497
+ for (const uri in nsMap) {
12498
+ const prefix = nsMap[uri];
12499
+
12500
+ prefixMap[prefix] = uri;
12501
+ }
12502
+
12503
+ for (const pkg of model.getPackages()) {
12504
+ prefixMap[pkg.prefix] = pkg.uri;
12505
+ }
12506
+
12507
+ return prefixMap;
12508
+ }
12509
+
12440
12510
  /**
12441
12511
  * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.
12442
12512
  *
@@ -16163,7 +16233,7 @@
16163
16233
  associations: associations
16164
16234
  };
16165
16235
 
16166
- var packages = {
16236
+ const packages = {
16167
16237
  bpmn: BpmnPackage,
16168
16238
  bpmndi: BpmnDiPackage,
16169
16239
  dc: DcPackage,
@@ -16172,8 +16242,8 @@
16172
16242
  color: BpmnInColorPackage
16173
16243
  };
16174
16244
 
16175
- function simple(additionalPackages, options) {
16176
- var pks = assign$1({}, packages, additionalPackages);
16245
+ function SimpleBpmnModdle(additionalPackages, options) {
16246
+ const pks = assign$1({}, packages, additionalPackages);
16177
16247
 
16178
16248
  return new BpmnModdle(pks, options);
16179
16249
  }
@@ -17728,7 +17798,7 @@
17728
17798
  BaseViewer.prototype._createModdle = function(options) {
17729
17799
  const moddleOptions = assign$1({}, this._moddleExtensions, options.moddleExtensions);
17730
17800
 
17731
- return new simple(moddleOptions);
17801
+ return new SimpleBpmnModdle(moddleOptions);
17732
17802
  };
17733
17803
 
17734
17804
  BaseViewer.prototype._modules = [];
@@ -18260,7 +18330,11 @@
18260
18330
  if (attr) {
18261
18331
 
18262
18332
  if (attr === 'categoryValueRef') {
18263
- semantic['categoryValueRef'].value = text;
18333
+ if (!semantic[attr]) {
18334
+ return element;
18335
+ }
18336
+
18337
+ semantic[attr].value = text;
18264
18338
  } else {
18265
18339
  semantic[attr] = text;
18266
18340
  }
@@ -20888,6 +20962,8 @@
20888
20962
 
20889
20963
  return bbox;
20890
20964
  } catch (e) {
20965
+ console.log(e);
20966
+
20891
20967
  return { width: 0, height: 0 };
20892
20968
  }
20893
20969
  }
@@ -24171,607 +24247,204 @@
24171
24247
  subprocessCompatibility: [ 'type', SubprocessCompatibility ]
24172
24248
  };
24173
24249
 
24174
- var LOW_PRIORITY$o = 500;
24250
+ /**
24251
+ * @typedef {import('../util/Types').Point} Point
24252
+ */
24175
24253
 
24176
- var DEFAULT_PRIORITY$4 = 1000;
24254
+ function __stopPropagation(event) {
24255
+ if (!event || typeof event.stopPropagation !== 'function') {
24256
+ return;
24257
+ }
24258
+
24259
+ event.stopPropagation();
24260
+ }
24177
24261
 
24178
24262
  /**
24179
- * @typedef {import('../../model/Types').Element} Element
24263
+ * @param {import('../core/EventBus').Event} event
24180
24264
  *
24181
- * @typedef {import('./OutlineProvider').default} OutlineProvider
24182
- * @typedef {import('../../core/EventBus').default} EventBus
24183
- * @typedef {import('../../draw/Styles').default} Styles
24265
+ * @return {Event}
24184
24266
  */
24267
+ function getOriginal$1(event) {
24268
+ return event.originalEvent || event.srcEvent;
24269
+ }
24185
24270
 
24186
24271
  /**
24187
- * @class
24188
- *
24189
- * A plugin that adds an outline to shapes and connections that may be activated and styled
24190
- * via CSS classes.
24191
- *
24192
- * @param {EventBus} eventBus
24193
- * @param {Styles} styles
24272
+ * @param {Event|import('../core/EventBus').Event} event
24194
24273
  */
24195
- function Outline(eventBus, styles) {
24196
-
24197
- this._eventBus = eventBus;
24198
-
24199
- this.offset = 5;
24200
-
24201
- var OUTLINE_STYLE = styles.cls('djs-outline', [ 'no-fill' ]);
24202
-
24203
- var self = this;
24204
-
24205
- /**
24206
- * @param {SVGElement} gfx
24207
- *
24208
- * @return {SVGElement} outline
24209
- */
24210
- function createOutline(gfx) {
24211
- var outline = create$1('rect');
24212
-
24213
- attr(outline, assign$1({
24214
- x: 0,
24215
- y: 0,
24216
- rx: 4,
24217
- width: 100,
24218
- height: 100
24219
- }, OUTLINE_STYLE));
24220
-
24221
- return outline;
24222
- }
24223
-
24224
- // A low priortity is necessary, because outlines of labels have to be updated
24225
- // after the label bounds have been updated in the renderer.
24226
- eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$o, function(event) {
24227
- var element = event.element,
24228
- gfx = event.gfx;
24229
-
24230
- var outline = query('.djs-outline', gfx);
24231
-
24232
- if (!outline) {
24233
- outline = self.getOutline(element) || createOutline();
24234
- append(gfx, outline);
24235
- }
24236
-
24237
- self.updateShapeOutline(outline, element);
24238
- });
24239
-
24240
- eventBus.on([ 'connection.added', 'connection.changed' ], function(event) {
24241
- var element = event.element,
24242
- gfx = event.gfx;
24243
-
24244
- var outline = query('.djs-outline', gfx);
24245
-
24246
- if (!outline) {
24247
- outline = createOutline();
24248
- append(gfx, outline);
24249
- }
24250
-
24251
- self.updateConnectionOutline(outline, element);
24252
- });
24274
+ function stopPropagation$1(event) {
24275
+ __stopPropagation(event);
24276
+ __stopPropagation(getOriginal$1(event));
24253
24277
  }
24254
24278
 
24255
-
24256
24279
  /**
24257
- * Updates the outline of a shape respecting the dimension of the
24258
- * element and an outline offset.
24280
+ * @param {Event} event
24259
24281
  *
24260
- * @param {SVGElement} outline
24261
- * @param {Element} element
24282
+ * @return {Point|null}
24262
24283
  */
24263
- Outline.prototype.updateShapeOutline = function(outline, element) {
24264
-
24265
- var updated = false;
24266
- var providers = this._getProviders();
24284
+ function toPoint(event) {
24267
24285
 
24268
- if (providers.length) {
24269
- forEach$1(providers, function(provider) {
24270
- updated = updated || provider.updateOutline(element, outline);
24271
- });
24286
+ if (event.pointers && event.pointers.length) {
24287
+ event = event.pointers[0];
24272
24288
  }
24273
24289
 
24274
- if (!updated) {
24275
- attr(outline, {
24276
- x: -this.offset,
24277
- y: -this.offset,
24278
- width: element.width + this.offset * 2,
24279
- height: element.height + this.offset * 2
24280
- });
24290
+ if (event.touches && event.touches.length) {
24291
+ event = event.touches[0];
24281
24292
  }
24282
- };
24293
+
24294
+ return event ? {
24295
+ x: event.clientX,
24296
+ y: event.clientY
24297
+ } : null;
24298
+ }
24299
+
24300
+ function isMac() {
24301
+ return (/mac/i).test(navigator.platform);
24302
+ }
24283
24303
 
24284
24304
  /**
24285
- * Updates the outline of a connection respecting the bounding box of
24286
- * the connection and an outline offset.
24287
- * Register an outline provider with the given priority.
24305
+ * @param {MouseEvent} event
24306
+ * @param {string} button
24288
24307
  *
24289
- * @param {SVGElement} outline
24290
- * @param {Element} connection
24308
+ * @return {boolean}
24291
24309
  */
24292
- Outline.prototype.updateConnectionOutline = function(outline, connection) {
24293
- var bbox = getBBox(connection);
24294
-
24295
- attr(outline, {
24296
- x: bbox.x - this.offset,
24297
- y: bbox.y - this.offset,
24298
- width: bbox.width + this.offset * 2,
24299
- height: bbox.height + this.offset * 2
24300
- });
24301
- };
24310
+ function isButton(event, button) {
24311
+ return (getOriginal$1(event) || event).button === button;
24312
+ }
24302
24313
 
24303
24314
  /**
24304
- * Register an outline provider with the given priority.
24315
+ * @param {MouseEvent} event
24305
24316
  *
24306
- * @param {number} priority
24307
- * @param {OutlineProvider} provider
24317
+ * @return {boolean}
24308
24318
  */
24309
- Outline.prototype.registerProvider = function(priority, provider) {
24310
- if (!provider) {
24311
- provider = priority;
24312
- priority = DEFAULT_PRIORITY$4;
24313
- }
24319
+ function isPrimaryButton(event) {
24314
24320
 
24315
- this._eventBus.on('outline.getProviders', priority, function(event) {
24316
- event.providers.push(provider);
24317
- });
24318
- };
24321
+ // button === 0 -> left áka primary mouse button
24322
+ return isButton(event, 0);
24323
+ }
24319
24324
 
24320
24325
  /**
24321
- * Returns the registered outline providers.
24326
+ * @param {MouseEvent} event
24322
24327
  *
24323
- * @returns {OutlineProvider[]}
24328
+ * @return {boolean}
24324
24329
  */
24325
- Outline.prototype._getProviders = function() {
24326
- var event = this._eventBus.createEvent({
24327
- type: 'outline.getProviders',
24328
- providers: []
24329
- });
24330
-
24331
- this._eventBus.fire(event);
24330
+ function isAuxiliaryButton(event) {
24332
24331
 
24333
- return event.providers;
24334
- };
24332
+ // button === 1 -> auxiliary áka wheel button
24333
+ return isButton(event, 1);
24334
+ }
24335
24335
 
24336
24336
  /**
24337
- * Returns the outline for an element.
24337
+ * @param {MouseEvent} event
24338
24338
  *
24339
- * @param {Element} element
24339
+ * @return {boolean}
24340
24340
  */
24341
- Outline.prototype.getOutline = function(element) {
24342
- var outline;
24343
- var providers = this._getProviders();
24344
-
24345
- forEach$1(providers, function(provider) {
24346
-
24347
- if (!isFunction(provider.getOutline)) {
24348
- return;
24349
- }
24350
-
24351
- outline = outline || provider.getOutline(element);
24352
- });
24341
+ function hasPrimaryModifier(event) {
24342
+ var originalEvent = getOriginal$1(event) || event;
24353
24343
 
24354
- return outline;
24355
- };
24344
+ if (!isPrimaryButton(event)) {
24345
+ return false;
24346
+ }
24356
24347
 
24357
- Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
24348
+ // Use cmd as primary modifier key for mac OS
24349
+ if (isMac()) {
24350
+ return originalEvent.metaKey;
24351
+ } else {
24352
+ return originalEvent.ctrlKey;
24353
+ }
24354
+ }
24358
24355
 
24359
24356
  /**
24360
- * @type { import('didi').ModuleDeclaration }
24357
+ * @param {MouseEvent} event
24358
+ *
24359
+ * @return {boolean}
24361
24360
  */
24362
- var OutlineModule$1 = {
24363
- __init__: [ 'outline' ],
24364
- outline: [ 'type', Outline ]
24365
- };
24366
-
24367
- const DATA_OBJECT_REFERENCE_OUTLINE_PATH = 'M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z';
24368
- const DATA_STORE_REFERENCE_OUTLINE_PATH = 'M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z';
24361
+ function hasSecondaryModifier(event) {
24362
+ var originalEvent = getOriginal$1(event) || event;
24369
24363
 
24370
- /**
24371
- * @typedef { import('diagram-js/lib/util/Types').Dimensions} Dimensions
24372
- */
24364
+ return isPrimaryButton(event) && originalEvent.shiftKey;
24365
+ }
24373
24366
 
24374
24367
  /**
24375
- * @type {Dimensions}
24368
+ * @typedef {import('../../model/Types').Element} Element
24369
+ *
24370
+ * @typedef {import('../../core/ElementRegistry').default} ElementRegistry
24371
+ * @typedef {import('../../core/EventBus').default} EventBus
24372
+ * @typedef {import('../../draw/Styles').default} Styles
24373
+ *
24374
+ * @typedef {import('../../util/Types').Point} Point
24376
24375
  */
24377
- const DATA_OBJECT_REFERENCE_STANDARD_SIZE = { width: 36, height: 50 };
24378
24376
 
24379
- /**
24380
- * @type {Dimensions}
24381
- */
24382
- const DATA_STORE_REFERENCE_STANDARD_SIZE = { width: 50, height: 50 };
24377
+ function allowAll(event) { return true; }
24383
24378
 
24384
- /**
24385
- * Create a path element with given attributes.
24386
- * @param {string} path
24387
- * @param {Object} attrs
24388
- * @param {Object} OUTLINE_STYLE
24389
- * @return {SVGElement}
24390
- */
24391
- function createPath(path, attrs, OUTLINE_STYLE) {
24392
- return create$1('path', {
24393
- d: path,
24394
- strokeWidth: 2,
24395
- transform: `translate(${attrs.x}, ${attrs.y})`,
24396
- ...OUTLINE_STYLE
24397
- });
24379
+ function allowPrimaryAndAuxiliary(event) {
24380
+ return isPrimaryButton(event) || isAuxiliaryButton(event);
24398
24381
  }
24399
24382
 
24383
+ var LOW_PRIORITY$o = 500;
24384
+
24385
+
24400
24386
  /**
24401
- * @typedef { import('diagram-js/lib/features/outline/OutlineProvider').default } BaseOutlineProvider
24387
+ * A plugin that provides interaction events for diagram elements.
24402
24388
  *
24403
- * @typedef { import('diagram-js/lib/features/outline/OutlineProvider').Outline } Outline
24389
+ * It emits the following events:
24404
24390
  *
24405
- * @typedef { import('diagram-js/lib/draw/Styles').default } Styles
24391
+ * * element.click
24392
+ * * element.contextmenu
24393
+ * * element.dblclick
24394
+ * * element.hover
24395
+ * * element.mousedown
24396
+ * * element.mousemove
24397
+ * * element.mouseup
24398
+ * * element.out
24406
24399
  *
24407
- * @typedef { import('diagram-js/lib/model/Types').Element } Element
24408
- */
24409
-
24410
- const DEFAULT_OFFSET = 5;
24411
-
24412
- /**
24413
- * BPMN-specific outline provider.
24400
+ * Each event is a tuple { element, gfx, originalEvent }.
24414
24401
  *
24415
- * @implements {BaseOutlineProvider}
24402
+ * Canceling the event via Event#preventDefault()
24403
+ * prevents the original DOM operation.
24416
24404
  *
24417
- * @param {Outline} outline
24405
+ * @param {EventBus} eventBus
24406
+ * @param {ElementRegistry} elementRegistry
24418
24407
  * @param {Styles} styles
24419
24408
  */
24420
- function OutlineProvider(outline, styles) {
24409
+ function InteractionEvents(eventBus, elementRegistry, styles) {
24421
24410
 
24422
- this._styles = styles;
24423
- outline.registerProvider(this);
24424
- }
24411
+ var self = this;
24425
24412
 
24426
- OutlineProvider.$inject = [
24427
- 'outline',
24428
- 'styles'
24429
- ];
24413
+ /**
24414
+ * Fire an interaction event.
24415
+ *
24416
+ * @param {string} type local event name, e.g. element.click.
24417
+ * @param {MouseEvent|TouchEvent} event native event
24418
+ * @param {Element} [element] the diagram element to emit the event on;
24419
+ * defaults to the event target
24420
+ */
24421
+ function fire(type, event, element) {
24430
24422
 
24431
- /**
24432
- * Returns outline for a given element.
24433
- *
24434
- * @param {Element} element
24435
- *
24436
- * @return {Outline}
24437
- */
24438
- OutlineProvider.prototype.getOutline = function(element) {
24423
+ if (isIgnored(type, event)) {
24424
+ return;
24425
+ }
24439
24426
 
24440
- const OUTLINE_STYLE = this._styles.cls('djs-outline', [ 'no-fill' ]);
24427
+ var target, gfx, returnValue;
24441
24428
 
24442
- var outline;
24429
+ if (!element) {
24430
+ target = event.delegateTarget || event.target;
24443
24431
 
24444
- if (isLabel(element)) {
24445
- return;
24446
- }
24432
+ if (target) {
24433
+ gfx = target;
24434
+ element = elementRegistry.get(gfx);
24435
+ }
24436
+ } else {
24437
+ gfx = elementRegistry.getGraphics(element);
24438
+ }
24447
24439
 
24448
- if (is$1(element, 'bpmn:Gateway')) {
24449
- outline = create$1('rect');
24440
+ if (!gfx || !element) {
24441
+ return;
24442
+ }
24450
24443
 
24451
- assign$1(outline.style, {
24452
- 'transform-box': 'fill-box',
24453
- 'transform': 'rotate(45deg)',
24454
- 'transform-origin': 'center'
24455
- });
24456
-
24457
- attr(outline, assign$1({
24458
- x: 2,
24459
- y: 2,
24460
- rx: 4,
24461
- width: element.width - 4,
24462
- height: element.height - 4,
24463
- }, OUTLINE_STYLE));
24464
-
24465
- } else if (isAny(element, [ 'bpmn:Task', 'bpmn:SubProcess', 'bpmn:Group', 'bpmn:CallActivity' ])) {
24466
- outline = create$1('rect');
24467
-
24468
- attr(outline, assign$1({
24469
- x: -DEFAULT_OFFSET,
24470
- y: -DEFAULT_OFFSET,
24471
- rx: 14,
24472
- width: element.width + DEFAULT_OFFSET * 2,
24473
- height: element.height + DEFAULT_OFFSET * 2
24474
- }, OUTLINE_STYLE));
24475
-
24476
- } else if (is$1(element, 'bpmn:EndEvent')) {
24477
-
24478
- outline = create$1('circle');
24479
-
24480
- // Extra 1px offset needed due to increased stroke-width of end event
24481
- // which makes it bigger than other events.
24482
-
24483
- attr(outline, assign$1({
24484
- cx: element.width / 2,
24485
- cy: element.height / 2,
24486
- r: element.width / 2 + DEFAULT_OFFSET + 1
24487
- }, OUTLINE_STYLE));
24488
-
24489
- } else if (is$1(element, 'bpmn:Event')) {
24490
- outline = create$1('circle');
24491
-
24492
- attr(outline, assign$1({
24493
- cx: element.width / 2,
24494
- cy: element.height / 2,
24495
- r: element.width / 2 + DEFAULT_OFFSET
24496
- }, OUTLINE_STYLE));
24497
-
24498
- } else if (is$1(element, 'bpmn:DataObjectReference') && isStandardSize(element, 'bpmn:DataObjectReference')) {
24499
-
24500
- outline = createPath(
24501
- DATA_OBJECT_REFERENCE_OUTLINE_PATH,
24502
- { x: -6, y: -6 },
24503
- OUTLINE_STYLE
24504
- );
24505
-
24506
- } else if (is$1(element, 'bpmn:DataStoreReference') && isStandardSize(element, 'bpmn:DataStoreReference')) {
24507
-
24508
- outline = createPath(
24509
- DATA_STORE_REFERENCE_OUTLINE_PATH,
24510
- { x: -6, y: -6 },
24511
- OUTLINE_STYLE
24512
- );
24513
- }
24514
-
24515
- return outline;
24516
- };
24517
-
24518
- /**
24519
- * Updates the outline for a given element.
24520
- * Returns true if the update for the given element was handled by this provider.
24521
- *
24522
- * @param {Element} element
24523
- * @param {Outline} outline
24524
- * @returns {boolean}
24525
- */
24526
- OutlineProvider.prototype.updateOutline = function(element, outline) {
24527
-
24528
- if (isLabel(element)) {
24529
- return;
24530
- }
24531
-
24532
- if (isAny(element, [ 'bpmn:SubProcess', 'bpmn:Group' ])) {
24533
-
24534
- attr(outline, {
24535
- width: element.width + DEFAULT_OFFSET * 2,
24536
- height: element.height + DEFAULT_OFFSET * 2
24537
- });
24538
-
24539
- return true;
24540
-
24541
- } else if (isAny(element, [
24542
- 'bpmn:Event',
24543
- 'bpmn:Gateway',
24544
- 'bpmn:DataStoreReference',
24545
- 'bpmn:DataObjectReference'
24546
- ])) {
24547
- return true;
24548
- }
24549
-
24550
- return false;
24551
- };
24552
-
24553
-
24554
- // helpers //////////
24555
-
24556
- function isStandardSize(element, type) {
24557
- var standardSize;
24558
-
24559
- if (type === 'bpmn:DataObjectReference') {
24560
- standardSize = DATA_OBJECT_REFERENCE_STANDARD_SIZE;
24561
- } else if (type === 'bpmn:DataStoreReference') {
24562
- standardSize = DATA_STORE_REFERENCE_STANDARD_SIZE;
24563
- }
24564
-
24565
- return element.width === standardSize.width
24566
- && element.height === standardSize.height;
24567
- }
24568
-
24569
- var OutlineModule = {
24570
- __depends__: [
24571
- OutlineModule$1
24572
- ],
24573
- __init__: [ 'outlineProvider' ],
24574
- outlineProvider: [ 'type', OutlineProvider ]
24575
- };
24576
-
24577
- /**
24578
- * @typedef {import('../util/Types').Point} Point
24579
- */
24580
-
24581
- function __stopPropagation(event) {
24582
- if (!event || typeof event.stopPropagation !== 'function') {
24583
- return;
24584
- }
24585
-
24586
- event.stopPropagation();
24587
- }
24588
-
24589
- /**
24590
- * @param {import('../core/EventBus').Event} event
24591
- *
24592
- * @return {Event}
24593
- */
24594
- function getOriginal$1(event) {
24595
- return event.originalEvent || event.srcEvent;
24596
- }
24597
-
24598
- /**
24599
- * @param {Event|import('../core/EventBus').Event} event
24600
- */
24601
- function stopPropagation$1(event) {
24602
- __stopPropagation(event);
24603
- __stopPropagation(getOriginal$1(event));
24604
- }
24605
-
24606
- /**
24607
- * @param {Event} event
24608
- *
24609
- * @return {Point|null}
24610
- */
24611
- function toPoint(event) {
24612
-
24613
- if (event.pointers && event.pointers.length) {
24614
- event = event.pointers[0];
24615
- }
24616
-
24617
- if (event.touches && event.touches.length) {
24618
- event = event.touches[0];
24619
- }
24620
-
24621
- return event ? {
24622
- x: event.clientX,
24623
- y: event.clientY
24624
- } : null;
24625
- }
24626
-
24627
- function isMac() {
24628
- return (/mac/i).test(navigator.platform);
24629
- }
24630
-
24631
- /**
24632
- * @param {MouseEvent} event
24633
- * @param {string} button
24634
- *
24635
- * @return {boolean}
24636
- */
24637
- function isButton$1(event, button) {
24638
- return (getOriginal$1(event) || event).button === button;
24639
- }
24640
-
24641
- /**
24642
- * @param {MouseEvent} event
24643
- *
24644
- * @return {boolean}
24645
- */
24646
- function isPrimaryButton(event) {
24647
-
24648
- // button === 0 -> left áka primary mouse button
24649
- return isButton$1(event, 0);
24650
- }
24651
-
24652
- /**
24653
- * @param {MouseEvent} event
24654
- *
24655
- * @return {boolean}
24656
- */
24657
- function isAuxiliaryButton(event) {
24658
-
24659
- // button === 1 -> auxiliary áka wheel button
24660
- return isButton$1(event, 1);
24661
- }
24662
-
24663
- /**
24664
- * @param {MouseEvent} event
24665
- *
24666
- * @return {boolean}
24667
- */
24668
- function hasPrimaryModifier(event) {
24669
- var originalEvent = getOriginal$1(event) || event;
24670
-
24671
- if (!isPrimaryButton(event)) {
24672
- return false;
24673
- }
24674
-
24675
- // Use cmd as primary modifier key for mac OS
24676
- if (isMac()) {
24677
- return originalEvent.metaKey;
24678
- } else {
24679
- return originalEvent.ctrlKey;
24680
- }
24681
- }
24682
-
24683
- /**
24684
- * @param {MouseEvent} event
24685
- *
24686
- * @return {boolean}
24687
- */
24688
- function hasSecondaryModifier(event) {
24689
- var originalEvent = getOriginal$1(event) || event;
24690
-
24691
- return isPrimaryButton(event) && originalEvent.shiftKey;
24692
- }
24693
-
24694
- /**
24695
- * @typedef {import('../../model/Types').Element} Element
24696
- *
24697
- * @typedef {import('../../core/ElementRegistry').default} ElementRegistry
24698
- * @typedef {import('../../core/EventBus').default} EventBus
24699
- * @typedef {import('../../draw/Styles').default} Styles
24700
- *
24701
- * @typedef {import('../../util/Types').Point} Point
24702
- */
24703
-
24704
- function allowAll(event) { return true; }
24705
-
24706
- function allowPrimaryAndAuxiliary(event) {
24707
- return isPrimaryButton(event) || isAuxiliaryButton(event);
24708
- }
24709
-
24710
- var LOW_PRIORITY$n = 500;
24711
-
24712
-
24713
- /**
24714
- * A plugin that provides interaction events for diagram elements.
24715
- *
24716
- * It emits the following events:
24717
- *
24718
- * * element.click
24719
- * * element.contextmenu
24720
- * * element.dblclick
24721
- * * element.hover
24722
- * * element.mousedown
24723
- * * element.mousemove
24724
- * * element.mouseup
24725
- * * element.out
24726
- *
24727
- * Each event is a tuple { element, gfx, originalEvent }.
24728
- *
24729
- * Canceling the event via Event#preventDefault()
24730
- * prevents the original DOM operation.
24731
- *
24732
- * @param {EventBus} eventBus
24733
- * @param {ElementRegistry} elementRegistry
24734
- * @param {Styles} styles
24735
- */
24736
- function InteractionEvents(eventBus, elementRegistry, styles) {
24737
-
24738
- var self = this;
24739
-
24740
- /**
24741
- * Fire an interaction event.
24742
- *
24743
- * @param {string} type local event name, e.g. element.click.
24744
- * @param {MouseEvent|TouchEvent} event native event
24745
- * @param {Element} [element] the diagram element to emit the event on;
24746
- * defaults to the event target
24747
- */
24748
- function fire(type, event, element) {
24749
-
24750
- if (isIgnored(type, event)) {
24751
- return;
24752
- }
24753
-
24754
- var target, gfx, returnValue;
24755
-
24756
- if (!element) {
24757
- target = event.delegateTarget || event.target;
24758
-
24759
- if (target) {
24760
- gfx = target;
24761
- element = elementRegistry.get(gfx);
24762
- }
24763
- } else {
24764
- gfx = elementRegistry.getGraphics(element);
24765
- }
24766
-
24767
- if (!gfx || !element) {
24768
- return;
24769
- }
24770
-
24771
- returnValue = eventBus.fire(type, {
24772
- element: element,
24773
- gfx: gfx,
24774
- originalEvent: event
24444
+ returnValue = eventBus.fire(type, {
24445
+ element: element,
24446
+ gfx: gfx,
24447
+ originalEvent: event
24775
24448
  });
24776
24449
 
24777
24450
  if (returnValue === false) {
@@ -24904,7 +24577,7 @@
24904
24577
  eventBus.on([
24905
24578
  'shape.changed',
24906
24579
  'connection.changed'
24907
- ], LOW_PRIORITY$n, function(event) {
24580
+ ], LOW_PRIORITY$o, function(event) {
24908
24581
 
24909
24582
  var element = event.element,
24910
24583
  gfx = event.gfx;
@@ -24912,7 +24585,7 @@
24912
24585
  eventBus.fire('interactionEvents.updateHit', { element: element, gfx: gfx });
24913
24586
  });
24914
24587
 
24915
- eventBus.on('interactionEvents.createHit', LOW_PRIORITY$n, function(event) {
24588
+ eventBus.on('interactionEvents.createHit', LOW_PRIORITY$o, function(event) {
24916
24589
  var element = event.element,
24917
24590
  gfx = event.gfx;
24918
24591
 
@@ -25315,15 +24988,11 @@
25315
24988
  /**
25316
24989
  * @typedef {import('../../core/Canvas').default} Canvas
25317
24990
  * @typedef {import('../../core/EventBus').default} EventBus
25318
- * @typedef {import('./Selection').default} Selection
25319
24991
  */
25320
24992
 
25321
24993
  var MARKER_HOVER = 'hover',
25322
24994
  MARKER_SELECTED = 'selected';
25323
24995
 
25324
- var SELECTION_OUTLINE_PADDING = 6;
25325
-
25326
-
25327
24996
  /**
25328
24997
  * A plugin that adds a visible selection UI to shapes and connections
25329
24998
  * by appending the <code>hover</code> and <code>selected</code> classes to them.
@@ -25334,15 +25003,10 @@
25334
25003
  *
25335
25004
  * @param {Canvas} canvas
25336
25005
  * @param {EventBus} eventBus
25337
- * @param {Selection} selection
25338
25006
  */
25339
- function SelectionVisuals(canvas, eventBus, selection) {
25007
+ function SelectionVisuals(canvas, eventBus) {
25340
25008
  this._canvas = canvas;
25341
25009
 
25342
- var self = this;
25343
-
25344
- this._multiSelectionBox = null;
25345
-
25346
25010
  function addMarker(e, cls) {
25347
25011
  canvas.addMarker(e, cls);
25348
25012
  }
@@ -25383,63 +25047,14 @@
25383
25047
  select(e);
25384
25048
  }
25385
25049
  });
25386
-
25387
- self._updateSelectionOutline(newSelection);
25388
- });
25389
-
25390
-
25391
- eventBus.on('element.changed', function(event) {
25392
- if (selection.isSelected(event.element)) {
25393
- self._updateSelectionOutline(selection.get());
25394
- }
25395
25050
  });
25396
25051
  }
25397
25052
 
25398
25053
  SelectionVisuals.$inject = [
25399
25054
  'canvas',
25400
- 'eventBus',
25401
- 'selection'
25055
+ 'eventBus'
25402
25056
  ];
25403
25057
 
25404
- SelectionVisuals.prototype._updateSelectionOutline = function(selection) {
25405
- var layer = this._canvas.getLayer('selectionOutline');
25406
-
25407
- clear(layer);
25408
-
25409
- var enabled = selection.length > 1;
25410
-
25411
- var container = this._canvas.getContainer();
25412
-
25413
- classes(container)[enabled ? 'add' : 'remove']('djs-multi-select');
25414
-
25415
- if (!enabled) {
25416
- return;
25417
- }
25418
-
25419
- var bBox = addSelectionOutlinePadding(getBBox(selection));
25420
-
25421
- var rect = create$1('rect');
25422
-
25423
- attr(rect, assign$1({
25424
- rx: 3
25425
- }, bBox));
25426
-
25427
- classes(rect).add('djs-selection-outline');
25428
-
25429
- append(layer, rect);
25430
- };
25431
-
25432
- // helpers //////////
25433
-
25434
- function addSelectionOutlinePadding(bBox) {
25435
- return {
25436
- x: bBox.x - SELECTION_OUTLINE_PADDING,
25437
- y: bBox.y - SELECTION_OUTLINE_PADDING,
25438
- width: bBox.width + SELECTION_OUTLINE_PADDING * 2,
25439
- height: bBox.height + SELECTION_OUTLINE_PADDING * 2
25440
- };
25441
- }
25442
-
25443
25058
  /**
25444
25059
  * @typedef {import('../../core/Canvas').default} Canvas
25445
25060
  * @typedef {import('../../core/ElementRegistry').default} ElementRegistry
@@ -25566,7 +25181,6 @@
25566
25181
  __init__: [ 'selectionVisuals', 'selectionBehavior' ],
25567
25182
  __depends__: [
25568
25183
  InteractionEventsModule$1,
25569
- OutlineModule$1
25570
25184
  ],
25571
25185
  selection: [ 'type', Selection ],
25572
25186
  selectionVisuals: [ 'type', SelectionVisuals ],
@@ -25632,7 +25246,6 @@
25632
25246
  Viewer.prototype._modules = [
25633
25247
  CoreModule,
25634
25248
  DrilldownModdule,
25635
- OutlineModule,
25636
25249
  OverlaysModule,
25637
25250
  SelectionModule,
25638
25251
  TranslateModule
@@ -25730,9 +25343,10 @@
25730
25343
  var KEYDOWN_EVENT = 'keyboard.keydown',
25731
25344
  KEYUP_EVENT = 'keyboard.keyup';
25732
25345
 
25733
- var HANDLE_MODIFIER_ATTRIBUTE = 'input-handle-modified-keys';
25346
+ var DEFAULT_PRIORITY$4 = 1000;
25347
+
25348
+ var compatMessage = 'Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661';
25734
25349
 
25735
- var DEFAULT_PRIORITY$3 = 1000;
25736
25350
 
25737
25351
  /**
25738
25352
  * A keyboard abstraction that may be activated and
@@ -25752,8 +25366,8 @@
25752
25366
  *
25753
25367
  * All events contain one field which is node.
25754
25368
  *
25755
- * A default binding for the keyboard may be specified via the
25756
- * `keyboard.bindTo` configuration option.
25369
+ * Specify the initial keyboard binding state via the
25370
+ * `keyboard.bind=true|false` configuration option.
25757
25371
  *
25758
25372
  * @param {Object} config
25759
25373
  * @param {EventTarget} [config.bindTo]
@@ -25762,7 +25376,8 @@
25762
25376
  function Keyboard(config, eventBus) {
25763
25377
  var self = this;
25764
25378
 
25765
- this._config = config || {};
25379
+ this._config = config = config || {};
25380
+
25766
25381
  this._eventBus = eventBus;
25767
25382
 
25768
25383
  this._keydownHandler = this._keydownHandler.bind(this);
@@ -25775,19 +25390,22 @@
25775
25390
  self.unbind();
25776
25391
  });
25777
25392
 
25778
- eventBus.on('diagram.init', function() {
25779
- self._fire('init');
25780
- });
25393
+ if (config.bindTo) {
25394
+ console.error('unsupported configuration <keyboard.bindTo>', new Error(compatMessage));
25395
+ }
25396
+
25397
+ var bind = config && config.bind !== false;
25781
25398
 
25782
- eventBus.on('attach', function() {
25783
- if (config && config.bindTo) {
25784
- self.bind(config.bindTo);
25399
+ eventBus.on('canvas.init', function(event) {
25400
+ self._target = event.svg;
25401
+
25402
+ if (bind) {
25403
+ self.bind();
25785
25404
  }
25786
- });
25787
25405
 
25788
- eventBus.on('detach', function() {
25789
- self.unbind();
25406
+ self._fire('init');
25790
25407
  });
25408
+
25791
25409
  }
25792
25410
 
25793
25411
  Keyboard.$inject = [
@@ -25822,34 +25440,7 @@
25822
25440
  };
25823
25441
 
25824
25442
  Keyboard.prototype._isEventIgnored = function(event) {
25825
- if (event.defaultPrevented) {
25826
- return true;
25827
- }
25828
-
25829
- return (
25830
- isInput(event.target) || (
25831
- isButton(event.target) && isKey([ ' ', 'Enter' ], event)
25832
- )
25833
- ) && this._isModifiedKeyIgnored(event);
25834
- };
25835
-
25836
- Keyboard.prototype._isModifiedKeyIgnored = function(event) {
25837
- if (!isCmd(event)) {
25838
- return true;
25839
- }
25840
-
25841
- var allowedModifiers = this._getAllowedModifiers(event.target);
25842
- return allowedModifiers.indexOf(event.key) === -1;
25843
- };
25844
-
25845
- Keyboard.prototype._getAllowedModifiers = function(element) {
25846
- var modifierContainer = closest(element, '[' + HANDLE_MODIFIER_ATTRIBUTE + ']', true);
25847
-
25848
- if (!modifierContainer || (this._node && !this._node.contains(modifierContainer))) {
25849
- return [];
25850
- }
25851
-
25852
- return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');
25443
+ return false;
25853
25444
  };
25854
25445
 
25855
25446
  /**
@@ -25859,10 +25450,14 @@
25859
25450
  */
25860
25451
  Keyboard.prototype.bind = function(node) {
25861
25452
 
25453
+ if (node) {
25454
+ console.error('unsupported argument <node>', new Error(compatMessage));
25455
+ }
25456
+
25862
25457
  // make sure that the keyboard is only bound once to the DOM
25863
25458
  this.unbind();
25864
25459
 
25865
- this._node = node;
25460
+ node = this._node = this._target;
25866
25461
 
25867
25462
  // bind key events
25868
25463
  event.bind(node, 'keydown', this._keydownHandler);
@@ -25912,7 +25507,7 @@
25912
25507
  if (isFunction(priority)) {
25913
25508
  type = listener;
25914
25509
  listener = priority;
25915
- priority = DEFAULT_PRIORITY$3;
25510
+ priority = DEFAULT_PRIORITY$4;
25916
25511
  }
25917
25512
 
25918
25513
  this._eventBus.on(type || KEYDOWN_EVENT, priority, listener);
@@ -25933,19 +25528,7 @@
25933
25528
  Keyboard.prototype.isShift = isShift;
25934
25529
  Keyboard.prototype.isKey = isKey;
25935
25530
 
25936
-
25937
-
25938
- // helpers ///////
25939
-
25940
- function isInput(target) {
25941
- return target && (matches(target, 'input, textarea') || target.contentEditable === 'true');
25942
- }
25943
-
25944
- function isButton(target) {
25945
- return target && matches(target, 'button, input[type=submit], input[type=button], a[href], [aria-role=button]');
25946
- }
25947
-
25948
- var LOW_PRIORITY$m = 500;
25531
+ var LOW_PRIORITY$n = 500;
25949
25532
 
25950
25533
 
25951
25534
  /**
@@ -25961,7 +25544,7 @@
25961
25544
 
25962
25545
  var self = this;
25963
25546
 
25964
- eventBus.on('editorActions.init', LOW_PRIORITY$m, function(event) {
25547
+ eventBus.on('editorActions.init', LOW_PRIORITY$n, function(event) {
25965
25548
 
25966
25549
  var editorActions = event.editorActions;
25967
25550
 
@@ -27027,23 +26610,26 @@
27027
26610
 
27028
26611
  Scheduler.prototype._schedule = function(taskFn, id) {
27029
26612
 
27030
- const {
27031
- promise,
27032
- resolve,
27033
- reject
27034
- } = defer();
26613
+ const deferred = defer();
26614
+
26615
+ const executionId = setTimeout(() => {
27035
26616
 
27036
- const executionId = requestAnimationFrame(() => {
27037
26617
  try {
27038
- resolve(taskFn());
26618
+ this._scheduled[id] = null;
26619
+
26620
+ try {
26621
+ deferred.resolve(taskFn());
26622
+ } catch (error) {
26623
+ deferred.reject(error);
26624
+ }
27039
26625
  } catch (error) {
27040
- reject(error);
26626
+ console.error('Scheduler#_schedule execution failed', error);
27041
26627
  }
27042
26628
  });
27043
26629
 
27044
26630
  return {
27045
26631
  executionId,
27046
- promise
26632
+ promise: deferred.promise
27047
26633
  };
27048
26634
  };
27049
26635
 
@@ -27064,7 +26650,7 @@
27064
26650
  };
27065
26651
 
27066
26652
  Scheduler.prototype._cancel = function(scheduled) {
27067
- cancelAnimationFrame(scheduled.executionId);
26653
+ clearTimeout(scheduled.executionId);
27068
26654
  };
27069
26655
 
27070
26656
  /**
@@ -27076,19 +26662,14 @@
27076
26662
  */
27077
26663
  function defer() {
27078
26664
 
27079
- let resolve;
27080
- let reject;
26665
+ const deferred = {};
27081
26666
 
27082
- const promise = new Promise((_resolve, _reject) => {
27083
- resolve = _resolve;
27084
- reject = _reject;
26667
+ deferred.promise = new Promise((resolve, reject) => {
26668
+ deferred.resolve = resolve;
26669
+ deferred.reject = reject;
27085
26670
  });
27086
26671
 
27087
- return {
27088
- promise,
27089
- resolve,
27090
- reject
27091
- };
26672
+ return deferred;
27092
26673
  }
27093
26674
 
27094
26675
  var SchedulerModule = {
@@ -27121,7 +26702,7 @@
27121
26702
 
27122
26703
  var entrySelector = '.entry';
27123
26704
 
27124
- var DEFAULT_PRIORITY$2 = 1000;
26705
+ var DEFAULT_PRIORITY$3 = 1000;
27125
26706
  var CONTEXT_PAD_MARGIN = 8;
27126
26707
  var HOVER_DELAY = 300;
27127
26708
 
@@ -27263,7 +26844,7 @@
27263
26844
  ContextPad.prototype.registerProvider = function(priority, provider) {
27264
26845
  if (!provider) {
27265
26846
  provider = priority;
27266
- priority = DEFAULT_PRIORITY$2;
26847
+ priority = DEFAULT_PRIORITY$3;
27267
26848
  }
27268
26849
 
27269
26850
  this._eventBus.on('contextPad.getProviders', priority, function(event) {
@@ -28116,6 +27697,8 @@
28116
27697
  * @typedef {import('./PopupMenuProvider').PopupMenuHeaderEntry} PopupMenuHeaderEntry
28117
27698
  * @typedef {import('./PopupMenuProvider').PopupMenuEmptyPlaceholderProvider | import('./PopupMenuProvider').PopupMenuEmptyPlaceholder} PopupMenuEmptyPlaceholder
28118
27699
  *
27700
+ * @typedef {import('../search/search').default} search
27701
+ *
28119
27702
  * @typedef {import('../../util/Types').Point} Point
28120
27703
  */
28121
27704
 
@@ -28134,6 +27717,7 @@
28134
27717
  * @param {boolean} [props.search]
28135
27718
  * @param {PopupMenuEmptyPlaceholder} [props.emptyPlaceholder]
28136
27719
  * @param {number} [props.width]
27720
+ * @param {search} props.searchFn
28137
27721
  */
28138
27722
  function PopupMenuComponent(props) {
28139
27723
  const {
@@ -28147,6 +27731,7 @@
28147
27731
  scale,
28148
27732
  search,
28149
27733
  emptyPlaceholder,
27734
+ searchFn,
28150
27735
  entries: originalEntries,
28151
27736
  onOpened,
28152
27737
  onClosed
@@ -28168,29 +27753,19 @@
28168
27753
  return originalEntries;
28169
27754
  }
28170
27755
 
28171
- const filter = entry => {
28172
- if (!value) {
28173
- return (entry.rank || 0) >= 0;
28174
- }
28175
-
28176
- if (entry.searchable === false) {
28177
- return false;
28178
- }
27756
+ if (!value) {
27757
+ return originalEntries.filter(({ rank = 0 }) => rank >= 0);
27758
+ }
28179
27759
 
28180
- const searchableFields = [
28181
- entry.description || '',
28182
- entry.label || '',
28183
- entry.search || ''
28184
- ].map(string => string.toLowerCase());
28185
-
28186
- // every word of `value` should be included in one of the searchable fields
28187
- return value
28188
- .toLowerCase()
28189
- .split(/\s/g)
28190
- .every(word => searchableFields.some(field => field.includes(word)));
28191
- };
27760
+ const searchableEntries = originalEntries.filter(({ searchable }) => searchable !== false);
28192
27761
 
28193
- return originalEntries.filter(filter);
27762
+ return searchFn(searchableEntries, value, {
27763
+ keys: [
27764
+ 'label',
27765
+ 'description',
27766
+ 'search'
27767
+ ]
27768
+ }).map(({ item }) => item);
28194
27769
  }, [ searchable ]);
28195
27770
 
28196
27771
  const [ entries, setEntries ] = p(filterEntries(originalEntries, value));
@@ -28291,7 +27866,7 @@
28291
27866
  <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
28292
27867
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
28293
27868
  </svg>
28294
- <input type="text" aria-label="${ title }" />
27869
+ <input type="text" spellcheck=${ false } aria-label="${ title }" />
28295
27870
  </div>
28296
27871
  ` }
28297
27872
 
@@ -28409,6 +27984,7 @@
28409
27984
  /**
28410
27985
  * @typedef {import('../../core/Canvas').default} Canvas
28411
27986
  * @typedef {import('../../core/EventBus').default} EventBus
27987
+ * @typedef {import('../search/search').default} search
28412
27988
  *
28413
27989
  * @typedef {import('../../util/Types').Point} Point
28414
27990
  *
@@ -28438,7 +28014,7 @@
28438
28014
  'commandStack.changed'
28439
28015
  ];
28440
28016
 
28441
- var DEFAULT_PRIORITY$1 = 1000;
28017
+ var DEFAULT_PRIORITY$2 = 1000;
28442
28018
 
28443
28019
  /**
28444
28020
  * A popup menu to show a number of actions on the canvas.
@@ -28446,10 +28022,12 @@
28446
28022
  * @param {PopupMenuConfig} config
28447
28023
  * @param {EventBus} eventBus
28448
28024
  * @param {Canvas} canvas
28025
+ * @param {search} search
28449
28026
  */
28450
- function PopupMenu(config, eventBus, canvas) {
28027
+ function PopupMenu(config, eventBus, canvas, search) {
28451
28028
  this._eventBus = eventBus;
28452
28029
  this._canvas = canvas;
28030
+ this._search = search;
28453
28031
 
28454
28032
  this._current = null;
28455
28033
 
@@ -28481,7 +28059,8 @@
28481
28059
  PopupMenu.$inject = [
28482
28060
  'config.popupMenu',
28483
28061
  'eventBus',
28484
- 'canvas'
28062
+ 'canvas',
28063
+ 'search'
28485
28064
  ];
28486
28065
 
28487
28066
  PopupMenu.prototype._render = function() {
@@ -28525,6 +28104,7 @@
28525
28104
  scale=${ scale }
28526
28105
  onOpened=${ this._onOpened.bind(this) }
28527
28106
  onClosed=${ this._onClosed.bind(this) }
28107
+ searchFn=${ this._search }
28528
28108
  ...${{ ...options }}
28529
28109
  />
28530
28110
  `,
@@ -28649,6 +28229,8 @@
28649
28229
 
28650
28230
  this.reset();
28651
28231
 
28232
+ this._canvas.restoreFocus();
28233
+
28652
28234
  this._current = null;
28653
28235
  };
28654
28236
 
@@ -28825,7 +28407,7 @@
28825
28407
  PopupMenu.prototype.registerProvider = function(id, priority, provider) {
28826
28408
  if (!provider) {
28827
28409
  provider = priority;
28828
- priority = DEFAULT_PRIORITY$1;
28410
+ priority = DEFAULT_PRIORITY$2;
28829
28411
  }
28830
28412
 
28831
28413
  this._eventBus.on('popupMenu.getProviders.' + id, priority, function(event) {
@@ -28935,7 +28517,6 @@
28935
28517
 
28936
28518
 
28937
28519
  PopupMenu.prototype._getEmptyPlaceholder = function(providers) {
28938
-
28939
28520
  const provider = providers.find(
28940
28521
  provider => isFunction(provider.getEmptyPlaceholder)
28941
28522
  );
@@ -29011,10 +28592,289 @@
29011
28592
  return entry;
29012
28593
  };
29013
28594
 
28595
+ /**
28596
+ * @typedef { {
28597
+ * index: number;
28598
+ * match: boolean;
28599
+ * value: string;
28600
+ * } } Token
28601
+ *
28602
+ * @typedef {Token[]} Tokens
28603
+ */
28604
+
28605
+ /**
28606
+ * @template R
28607
+ *
28608
+ * @typedef { {
28609
+ * item: R,
28610
+ * tokens: Record<string, Tokens>
28611
+ * } } SearchResult
28612
+ */
28613
+
28614
+ /**
28615
+ * Search items by query.
28616
+ *
28617
+ * @template T
28618
+ *
28619
+ * @param {T[]} items
28620
+ * @param {string} pattern
28621
+ * @param { {
28622
+ * keys: string[];
28623
+ * } } options
28624
+ *
28625
+ * @returns {SearchResult<T>[]}
28626
+ */
28627
+ function search(items, pattern, options) {
28628
+
28629
+ const {
28630
+ keys
28631
+ } = options;
28632
+
28633
+ const words = pattern.trim().toLowerCase().split(/\s+/);
28634
+
28635
+ return items.flatMap((item) => {
28636
+ const tokens = matchItem(item, words, keys);
28637
+
28638
+ if (!tokens) {
28639
+ return [];
28640
+ }
28641
+
28642
+ return {
28643
+ item,
28644
+ tokens
28645
+ };
28646
+ }).sort(createResultSorter(keys));
28647
+ }
28648
+
28649
+ /**
28650
+ * Match an item and return tokens in case of a match.
28651
+ *
28652
+ * @param {Object} item
28653
+ * @param {string[]} words
28654
+ * @param {string[]} keys
28655
+ *
28656
+ * @returns {Record<string, Tokens>}
28657
+ */
28658
+ function matchItem(item, words, keys) {
28659
+
28660
+ const {
28661
+ matchedWords,
28662
+ tokens
28663
+ } = keys.reduce((result, key) => {
28664
+ const string = item[ key ];
28665
+
28666
+ const {
28667
+ tokens,
28668
+ matchedWords
28669
+ } = matchString(string, words);
28670
+
28671
+ return {
28672
+ tokens: {
28673
+ ...result.tokens,
28674
+ [ key ]: tokens,
28675
+ },
28676
+ matchedWords: {
28677
+ ...result.matchedWords,
28678
+ ...matchedWords
28679
+ }
28680
+ };
28681
+ }, {
28682
+ matchedWords: {},
28683
+ tokens: {}
28684
+ });
28685
+
28686
+ // only return result if every word got matched
28687
+ if (Object.keys(matchedWords).length !== words.length) {
28688
+ return null;
28689
+ }
28690
+
28691
+ return tokens;
28692
+ }
28693
+
28694
+ /**
28695
+ * Get index of result in list of results.
28696
+ *
28697
+ * @param {string[]} keys
28698
+ *
28699
+ * @returns { (resultA: SearchResult, resultB: SearchResult) => number}
28700
+ */
28701
+ function createResultSorter(keys) {
28702
+
28703
+ /**
28704
+ * @param {SearchResult} resultA
28705
+ * @param {SearchResult} resultB
28706
+ */
28707
+ return (resultA, resultB) => {
28708
+
28709
+ for (const key of keys) {
28710
+
28711
+ const tokenComparison = compareTokens(
28712
+ resultA.tokens[key],
28713
+ resultB.tokens[key]
28714
+ );
28715
+
28716
+ if (tokenComparison !== 0) {
28717
+ return tokenComparison;
28718
+ }
28719
+
28720
+ const stringComparison = compareStrings(
28721
+ resultA.item[ key ],
28722
+ resultB.item[ key ]
28723
+ );
28724
+
28725
+ if (stringComparison !== 0) {
28726
+ return stringComparison;
28727
+ }
28728
+
28729
+ // fall back to next key
28730
+ continue;
28731
+ }
28732
+
28733
+ // eventually call equality
28734
+ return 0;
28735
+ };
28736
+
28737
+ }
28738
+
28739
+ /**
28740
+ * Compares two token arrays.
28741
+ *
28742
+ * @param {Token[]} [tokensA]
28743
+ * @param {Token[]} [tokensB]
28744
+ *
28745
+ * @returns {number}
28746
+ */
28747
+ function compareTokens(tokensA, tokensB) {
28748
+ return scoreTokens(tokensB) - scoreTokens(tokensA);
28749
+ }
28750
+
28751
+ /**
28752
+ * @param { Token[] } tokens
28753
+ * @returns { number }
28754
+ */
28755
+ function scoreTokens(tokens) {
28756
+ return tokens.reduce((sum, token) => sum + scoreToken(token), 0);
28757
+ }
28758
+
28759
+ /**
28760
+ * Score a token.
28761
+ *
28762
+ * @param { Token } token
28763
+ *
28764
+ * @returns { number }
28765
+ */
28766
+ function scoreToken(token) {
28767
+ if (!token.match) {
28768
+ return 0;
28769
+ }
28770
+
28771
+ return token.start
28772
+ ? 1.37
28773
+ : token.wordStart
28774
+ ? 1.13
28775
+ : 1;
28776
+ }
28777
+
28778
+ /**
28779
+ * Compares two strings.
28780
+ *
28781
+ * @param {string} [a = '']
28782
+ * @param {string} [b = '']
28783
+ *
28784
+ * @returns {number}
28785
+ */
28786
+ function compareStrings(a = '', b = '') {
28787
+ return a.localeCompare(b);
28788
+ }
28789
+
28790
+ /**
28791
+ * Match a given string against a set of words,
28792
+ * and return the result.
28793
+ *
28794
+ * @param {string} string
28795
+ * @param {string[]} words
28796
+ *
28797
+ * @return { {
28798
+ * tokens: Token[],
28799
+ * matchedWords: Record<string, boolean>
28800
+ * } }
28801
+ */
28802
+ function matchString(string, words) {
28803
+
28804
+ if (!string) {
28805
+ return {
28806
+ tokens: [],
28807
+ matchedWords: {}
28808
+ };
28809
+ }
28810
+
28811
+ const tokens = [];
28812
+ const matchedWords = {};
28813
+
28814
+ const regexpString = words.map(escapeRegexp).flatMap(str => [ '(?<wordStart>\\b' + str + ')', str ]).join('|');
28815
+
28816
+ const regexp = new RegExp(regexpString, 'ig');
28817
+
28818
+ let match;
28819
+ let lastIndex = 0;
28820
+
28821
+ while ((match = regexp.exec(string))) {
28822
+
28823
+ const [ value ] = match;
28824
+
28825
+ if (match.index > lastIndex) {
28826
+
28827
+ // add previous token (NO match)
28828
+ tokens.push({
28829
+ value: string.slice(lastIndex, match.index),
28830
+ index: lastIndex
28831
+ });
28832
+ }
28833
+
28834
+ // add current token (match)
28835
+ tokens.push({
28836
+ value,
28837
+ index: match.index,
28838
+ match: true,
28839
+ wordStart: !!match.groups.wordStart,
28840
+ start: match.index === 0
28841
+ });
28842
+
28843
+ matchedWords[value.toLowerCase()] = true;
28844
+
28845
+ lastIndex = match.index + value.length;
28846
+ }
28847
+
28848
+ // add after token (NO match)
28849
+ if (lastIndex < string.length) {
28850
+ tokens.push({
28851
+ value: string.slice(lastIndex),
28852
+ index: lastIndex
28853
+ });
28854
+ }
28855
+
28856
+ return {
28857
+ tokens,
28858
+ matchedWords
28859
+ };
28860
+ }
28861
+
28862
+ function escapeRegexp(string) {
28863
+ return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&');
28864
+ }
28865
+
28866
+ /**
28867
+ * @type { import('didi').ModuleDeclaration }
28868
+ */
28869
+ var SearchModule$1 = {
28870
+ search: [ 'value', search ]
28871
+ };
28872
+
29014
28873
  /**
29015
28874
  * @type { import('didi').ModuleDeclaration }
29016
28875
  */
29017
28876
  var PopupMenuModule$1 = {
28877
+ __depends__: [ SearchModule$1 ],
29018
28878
  __init__: [ 'popupMenu' ],
29019
28879
  popupMenu: [ 'type', PopupMenu ]
29020
28880
  };
@@ -29072,7 +28932,7 @@
29072
28932
  * @typedef {import('diagram-js/lib/features/context-pad/ContextPadProvider').default<Element>} ContextPadProvider
29073
28933
  */
29074
28934
 
29075
- var LOW_PRIORITY$l = 900;
28935
+ var LOW_PRIORITY$m = 900;
29076
28936
 
29077
28937
  /**
29078
28938
  * A provider for the `Align elements` context pad entry.
@@ -29086,7 +28946,7 @@
29086
28946
  */
29087
28947
  function AlignElementsContextPadProvider(contextPad, popupMenu, translate, canvas) {
29088
28948
 
29089
- contextPad.registerProvider(LOW_PRIORITY$l, this);
28949
+ contextPad.registerProvider(LOW_PRIORITY$m, this);
29090
28950
 
29091
28951
  this._contextPad = contextPad;
29092
28952
  this._popupMenu = popupMenu;
@@ -29716,7 +29576,7 @@
29716
29576
  * @typedef {import('../modeling/Modeling').default} Modeling
29717
29577
  */
29718
29578
 
29719
- var LOW_PRIORITY$k = 100;
29579
+ var LOW_PRIORITY$l = 100;
29720
29580
 
29721
29581
 
29722
29582
  /**
@@ -29729,7 +29589,7 @@
29729
29589
  */
29730
29590
  function AutoPlace$1(eventBus, modeling, canvas) {
29731
29591
 
29732
- eventBus.on('autoPlace', LOW_PRIORITY$k, function(context) {
29592
+ eventBus.on('autoPlace', LOW_PRIORITY$l, function(context) {
29733
29593
  var shape = context.shape,
29734
29594
  source = context.source;
29735
29595
 
@@ -33813,7 +33673,7 @@
33813
33673
  */
33814
33674
 
33815
33675
  var HIGH_PRIORITY$h = 1100,
33816
- LOW_PRIORITY$j = 900;
33676
+ LOW_PRIORITY$k = 900;
33817
33677
 
33818
33678
  var MARKER_OK$3 = 'connect-ok',
33819
33679
  MARKER_NOT_OK$3 = 'connect-not-ok';
@@ -33857,7 +33717,7 @@
33857
33717
  });
33858
33718
  });
33859
33719
 
33860
- eventBus.on('connect.hover', LOW_PRIORITY$j, function(event) {
33720
+ eventBus.on('connect.hover', LOW_PRIORITY$k, function(event) {
33861
33721
  var context = event.context,
33862
33722
  hover = event.hover,
33863
33723
  canExecute = context.canExecute;
@@ -34338,12 +34198,10 @@
34338
34198
 
34339
34199
  if (gfx.childNodes) {
34340
34200
 
34341
- // TODO: use forEach once we drop PhantomJS
34342
- for (var i = 0; i < gfx.childNodes.length; i++) {
34201
+ gfx.childNodes.forEach((childNode) => {
34202
+ self._cloneMarkers(childNode, className, rootGfx);
34203
+ });
34343
34204
 
34344
- // recursively clone markers of child nodes
34345
- self._cloneMarkers(gfx.childNodes[ i ], className, rootGfx);
34346
- }
34347
34205
  }
34348
34206
 
34349
34207
  if (!canHaveMarker(gfx)) {
@@ -34630,9 +34488,8 @@
34630
34488
  var ELEMENT_LABEL_DISTANCE = 10;
34631
34489
 
34632
34490
  /**
34633
- * A component that makes sure that external labels are added
34634
- * together with respective elements and properly updated (DI wise)
34635
- * during move.
34491
+ * A behavior that ensures that labels are positioned in a way that they do not
34492
+ * overlap with other elements or connections.
34636
34493
  *
34637
34494
  * @param {EventBus} eventBus
34638
34495
  * @param {Modeling} modeling
@@ -34693,6 +34550,10 @@
34693
34550
  return;
34694
34551
  }
34695
34552
 
34553
+ if (isConnection(element)) {
34554
+ return;
34555
+ }
34556
+
34696
34557
  var optimalPosition = getOptimalPosition(element);
34697
34558
 
34698
34559
  // no optimal position found
@@ -34953,7 +34814,7 @@
34953
34814
  * @typedef {import('didi').Injector} Injector
34954
34815
  */
34955
34816
 
34956
- var LOW_PRIORITY$i = 500;
34817
+ var LOW_PRIORITY$j = 500;
34957
34818
 
34958
34819
 
34959
34820
  /**
@@ -34969,7 +34830,7 @@
34969
34830
 
34970
34831
  var self = this;
34971
34832
 
34972
- this.postExecuted('elements.create', LOW_PRIORITY$i, function(context) {
34833
+ this.postExecuted('elements.create', LOW_PRIORITY$j, function(context) {
34973
34834
  var elements = context.elements;
34974
34835
 
34975
34836
  elements = elements.filter(function(shape) {
@@ -34992,7 +34853,7 @@
34992
34853
  }, true);
34993
34854
 
34994
34855
 
34995
- this.preExecute('elements.move', LOW_PRIORITY$i, function(context) {
34856
+ this.preExecute('elements.move', LOW_PRIORITY$j, function(context) {
34996
34857
  var shapes = context.shapes,
34997
34858
  host = context.newHost;
34998
34859
 
@@ -36424,7 +36285,7 @@
36424
36285
  * @typedef {import('../../space-tool/BpmnSpaceTool').default} SpaceTool
36425
36286
  */
36426
36287
 
36427
- var LOW_PRIORITY$h = 500;
36288
+ var LOW_PRIORITY$i = 500;
36428
36289
 
36429
36290
 
36430
36291
  /**
@@ -36537,7 +36398,7 @@
36537
36398
  /**
36538
36399
  * Adjust sizes of other lanes after lane deletion
36539
36400
  */
36540
- this.postExecuted('shape.delete', LOW_PRIORITY$h, function(event) {
36401
+ this.postExecuted('shape.delete', LOW_PRIORITY$i, function(event) {
36541
36402
 
36542
36403
  var context = event.context,
36543
36404
  hints = context.hints,
@@ -36570,7 +36431,7 @@
36570
36431
  * @typedef {import('didi').Injector} Injector
36571
36432
  */
36572
36433
 
36573
- var LOW_PRIORITY$g = 500;
36434
+ var LOW_PRIORITY$h = 500;
36574
36435
 
36575
36436
 
36576
36437
  /**
@@ -36586,7 +36447,7 @@
36586
36447
 
36587
36448
  var self = this;
36588
36449
 
36589
- this.postExecuted('elements.create', LOW_PRIORITY$g, function(context) {
36450
+ this.postExecuted('elements.create', LOW_PRIORITY$h, function(context) {
36590
36451
  var elements = context.elements;
36591
36452
 
36592
36453
  elements.filter(function(shape) {
@@ -36600,7 +36461,7 @@
36600
36461
  });
36601
36462
  }, true);
36602
36463
 
36603
- this.preExecute('elements.move', LOW_PRIORITY$g, function(context) {
36464
+ this.preExecute('elements.move', LOW_PRIORITY$h, function(context) {
36604
36465
  var shapes = context.shapes,
36605
36466
  newHost = context.newHost;
36606
36467
 
@@ -39644,14 +39505,11 @@
39644
39505
 
39645
39506
  if (/n/.test(resizeDirection)) {
39646
39507
  minTrbl.top = laneTrbl.bottom - minDimensions.height;
39647
- } else
39648
- if (/e/.test(resizeDirection)) {
39508
+ } else if (/e/.test(resizeDirection)) {
39649
39509
  minTrbl.right = laneTrbl.left + minDimensions.width;
39650
- } else
39651
- if (/s/.test(resizeDirection)) {
39510
+ } else if (/s/.test(resizeDirection)) {
39652
39511
  minTrbl.bottom = laneTrbl.top + minDimensions.height;
39653
- } else
39654
- if (/w/.test(resizeDirection)) {
39512
+ } else if (/w/.test(resizeDirection)) {
39655
39513
  minTrbl.left = laneTrbl.right - minDimensions.width;
39656
39514
  }
39657
39515
 
@@ -39842,7 +39700,7 @@
39842
39700
  * @typedef {import('diagram-js/lib/util/Types').DirectionTRBL} DirectionTRBL
39843
39701
  */
39844
39702
 
39845
- var LOW_PRIORITY$f = 500;
39703
+ var LOW_PRIORITY$g = 500;
39846
39704
 
39847
39705
 
39848
39706
  /**
@@ -39972,7 +39830,7 @@
39972
39830
  }
39973
39831
  });
39974
39832
 
39975
- eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$f, function(context) {
39833
+ eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$g, function(context) {
39976
39834
  var descriptor = context.descriptor,
39977
39835
  businessObject = descriptor.businessObject,
39978
39836
  referencedRootElement = descriptor.referencedRootElement;
@@ -40217,7 +40075,7 @@
40217
40075
  * @typedef {import('../../../model/Types').ModdleElement} ModdleElement
40218
40076
  */
40219
40077
 
40220
- var LOW_PRIORITY$e = 400;
40078
+ var LOW_PRIORITY$f = 400;
40221
40079
  var HIGH_PRIORITY$d = 600;
40222
40080
 
40223
40081
  var DEFAULT_POSITION = {
@@ -40470,7 +40328,7 @@
40470
40328
 
40471
40329
 
40472
40330
  // create/remove plane for the subprocess
40473
- this.executed('shape.toggleCollapse', LOW_PRIORITY$e, function(context) {
40331
+ this.executed('shape.toggleCollapse', LOW_PRIORITY$f, function(context) {
40474
40332
  var shape = context.shape;
40475
40333
 
40476
40334
  if (!is$1(shape, 'bpmn:SubProcess')) {
@@ -40488,7 +40346,7 @@
40488
40346
 
40489
40347
 
40490
40348
  // create/remove plane for the subprocess
40491
- this.reverted('shape.toggleCollapse', LOW_PRIORITY$e, function(context) {
40349
+ this.reverted('shape.toggleCollapse', LOW_PRIORITY$f, function(context) {
40492
40350
  var shape = context.shape;
40493
40351
 
40494
40352
  if (!is$1(shape, 'bpmn:SubProcess')) {
@@ -40935,7 +40793,7 @@
40935
40793
  * @typedef {import('../Modeling').default} Modeling
40936
40794
  */
40937
40795
 
40938
- var LOW_PRIORITY$d = 500;
40796
+ var LOW_PRIORITY$e = 500;
40939
40797
 
40940
40798
  /**
40941
40799
  * @param {EventBus} eventBus
@@ -40996,7 +40854,7 @@
40996
40854
  };
40997
40855
  }
40998
40856
 
40999
- this.executed([ 'shape.toggleCollapse' ], LOW_PRIORITY$d, function(e) {
40857
+ this.executed([ 'shape.toggleCollapse' ], LOW_PRIORITY$e, function(e) {
41000
40858
 
41001
40859
  var context = e.context,
41002
40860
  shape = context.shape;
@@ -41019,7 +40877,7 @@
41019
40877
  }
41020
40878
  });
41021
40879
 
41022
- this.reverted([ 'shape.toggleCollapse' ], LOW_PRIORITY$d, function(e) {
40880
+ this.reverted([ 'shape.toggleCollapse' ], LOW_PRIORITY$e, function(e) {
41023
40881
 
41024
40882
  var context = e.context;
41025
40883
  var shape = context.shape;
@@ -41034,7 +40892,7 @@
41034
40892
  }
41035
40893
  });
41036
40894
 
41037
- this.postExecuted([ 'shape.toggleCollapse' ], LOW_PRIORITY$d, function(e) {
40895
+ this.postExecuted([ 'shape.toggleCollapse' ], LOW_PRIORITY$e, function(e) {
41038
40896
  var shape = e.context.shape,
41039
40897
  defaultSize = elementFactory.getDefaultSize(shape),
41040
40898
  newBounds;
@@ -41189,7 +41047,7 @@
41189
41047
  * @typedef {import('../Modeling').default} Modeling
41190
41048
  */
41191
41049
 
41192
- var LOW_PRIORITY$c = 500,
41050
+ var LOW_PRIORITY$d = 500,
41193
41051
  HIGH_PRIORITY$c = 5000;
41194
41052
 
41195
41053
 
@@ -41267,7 +41125,7 @@
41267
41125
  initContext();
41268
41126
  });
41269
41127
 
41270
- this.postExecuted(laneRefUpdateEvents, LOW_PRIORITY$c, function(event) {
41128
+ this.postExecuted(laneRefUpdateEvents, LOW_PRIORITY$d, function(event) {
41271
41129
  releaseContext();
41272
41130
  });
41273
41131
 
@@ -43403,7 +43261,7 @@
43403
43261
  * @typedef {import('../../draw/Styles').default} Styles
43404
43262
  */
43405
43263
 
43406
- var LOW_PRIORITY$b = 750;
43264
+ var LOW_PRIORITY$c = 750;
43407
43265
 
43408
43266
  /**
43409
43267
  * @param {Canvas} canvas
@@ -43454,7 +43312,7 @@
43454
43312
  return dragGroup;
43455
43313
  }
43456
43314
 
43457
- eventBus.on('create.move', LOW_PRIORITY$b, function(event) {
43315
+ eventBus.on('create.move', LOW_PRIORITY$c, function(event) {
43458
43316
 
43459
43317
  var hover = event.hover,
43460
43318
  context = event.context,
@@ -44213,7 +44071,7 @@
44213
44071
  });
44214
44072
  }
44215
44073
 
44216
- var LOW_PRIORITY$a = 750;
44074
+ var LOW_PRIORITY$b = 750;
44217
44075
 
44218
44076
  /**
44219
44077
  * BPMN-specific copy & paste.
@@ -44230,7 +44088,7 @@
44230
44088
  return moddleCopy.copyElement(bo, targetBo, null, clone);
44231
44089
  }
44232
44090
 
44233
- eventBus.on('copyPaste.copyElement', LOW_PRIORITY$a, function(context) {
44091
+ eventBus.on('copyPaste.copyElement', LOW_PRIORITY$b, function(context) {
44234
44092
  var descriptor = context.descriptor,
44235
44093
  element = context.element,
44236
44094
  businessObject = getBusinessObject(element);
@@ -44327,7 +44185,7 @@
44327
44185
 
44328
44186
  // copy + paste processRef with participant
44329
44187
 
44330
- eventBus.on('copyPaste.copyElement', LOW_PRIORITY$a, function(context) {
44188
+ eventBus.on('copyPaste.copyElement', LOW_PRIORITY$b, function(context) {
44331
44189
  var descriptor = context.descriptor,
44332
44190
  element = context.element;
44333
44191
 
@@ -44353,7 +44211,7 @@
44353
44211
 
44354
44212
  // resolve references
44355
44213
 
44356
- eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$a, function(context) {
44214
+ eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$b, function(context) {
44357
44215
  var cache = context.cache,
44358
44216
  descriptor = context.descriptor;
44359
44217
 
@@ -45139,7 +44997,7 @@
45139
44997
  * @typedef {import('../../core/EventBus').Event} Event
45140
44998
  */
45141
44999
 
45142
- var LOW_PRIORITY$9 = 250;
45000
+ var LOW_PRIORITY$a = 250;
45143
45001
 
45144
45002
  /**
45145
45003
  * The tool manager acts as middle-man between the available tool's and the Palette,
@@ -45218,7 +45076,7 @@
45218
45076
  eventsToRegister.push(event + '.canceled');
45219
45077
  });
45220
45078
 
45221
- eventBus.on(eventsToRegister, LOW_PRIORITY$9, function(event) {
45079
+ eventBus.on(eventsToRegister, LOW_PRIORITY$a, function(event) {
45222
45080
 
45223
45081
  // We defer the de-activation of the tool to the .activate phase,
45224
45082
  // so we're able to check if we want to toggle off the current
@@ -46008,7 +45866,7 @@
46008
45866
  var MARKER_DRAGGING$1 = 'djs-dragging',
46009
45867
  MARKER_RESIZING$1 = 'djs-resizing';
46010
45868
 
46011
- var LOW_PRIORITY$8 = 250;
45869
+ var LOW_PRIORITY$9 = 250;
46012
45870
 
46013
45871
  /**
46014
45872
  * @typedef {import('../../core/Canvas').default} Canvas
@@ -46090,7 +45948,7 @@
46090
45948
  });
46091
45949
 
46092
45950
  // add and update move/resize previews
46093
- eventBus.on('spaceTool.move', LOW_PRIORITY$8, function(event) {
45951
+ eventBus.on('spaceTool.move', LOW_PRIORITY$9, function(event) {
46094
45952
 
46095
45953
  var context = event.context,
46096
45954
  line = context.line,
@@ -46970,7 +46828,7 @@
46970
46828
  return collection;
46971
46829
  }
46972
46830
 
46973
- var LOW_PRIORITY$7 = 250,
46831
+ var LOW_PRIORITY$8 = 250,
46974
46832
  HIGH_PRIORITY$8 = 1400;
46975
46833
 
46976
46834
  /**
@@ -47009,7 +46867,7 @@
47009
46867
  });
47010
46868
 
47011
46869
  // add labels to visual's group
47012
- movePreview && eventBus.on('shape.move.start', LOW_PRIORITY$7, function(e) {
46870
+ movePreview && eventBus.on('shape.move.start', LOW_PRIORITY$8, function(e) {
47013
46871
 
47014
46872
  var context = e.context,
47015
46873
  shapes = context.shapes;
@@ -47152,7 +47010,7 @@
47152
47010
  * @typedef {import('../modeling/Modeling').default} Modeling
47153
47011
  */
47154
47012
 
47155
- var LOW_PRIORITY$6 = 251,
47013
+ var LOW_PRIORITY$7 = 251,
47156
47014
  HIGH_PRIORITY$7 = 1401;
47157
47015
 
47158
47016
  var MARKER_ATTACH$1 = 'attach-ok';
@@ -47194,7 +47052,7 @@
47194
47052
  });
47195
47053
 
47196
47054
  // add attachers to the visual's group
47197
- movePreview && eventBus.on('shape.move.start', LOW_PRIORITY$6, function(e) {
47055
+ movePreview && eventBus.on('shape.move.start', LOW_PRIORITY$7, function(e) {
47198
47056
 
47199
47057
  var context = e.context,
47200
47058
  shapes = context.shapes,
@@ -48197,17 +48055,13 @@
48197
48055
  }
48198
48056
 
48199
48057
  containment = 'lanes';
48200
- } else
48201
-
48202
- if (is$1(businessObject, 'bpmn:FlowElement')) {
48058
+ } else if (is$1(businessObject, 'bpmn:FlowElement')) {
48203
48059
 
48204
48060
  if (newParent) {
48205
48061
 
48206
48062
  if (is$1(newParent, 'bpmn:Participant')) {
48207
48063
  newParent = newParent.processRef;
48208
- } else
48209
-
48210
- if (is$1(newParent, 'bpmn:Lane')) {
48064
+ } else if (is$1(newParent, 'bpmn:Lane')) {
48211
48065
  do {
48212
48066
 
48213
48067
  // unwrap Lane -> LaneSet -> (Lane | FlowElementsContainer)
@@ -48219,9 +48073,7 @@
48219
48073
 
48220
48074
  containment = 'flowElements';
48221
48075
 
48222
- } else
48223
-
48224
- if (is$1(businessObject, 'bpmn:Artifact')) {
48076
+ } else if (is$1(businessObject, 'bpmn:Artifact')) {
48225
48077
 
48226
48078
  while (newParent &&
48227
48079
  !is$1(newParent, 'bpmn:Process') &&
@@ -48237,14 +48089,9 @@
48237
48089
  }
48238
48090
 
48239
48091
  containment = 'artifacts';
48240
- } else
48241
-
48242
- if (is$1(businessObject, 'bpmn:MessageFlow')) {
48092
+ } else if (is$1(businessObject, 'bpmn:MessageFlow')) {
48243
48093
  containment = 'messageFlows';
48244
-
48245
- } else
48246
-
48247
- if (is$1(businessObject, 'bpmn:Participant')) {
48094
+ } else if (is$1(businessObject, 'bpmn:Participant')) {
48248
48095
  containment = 'participants';
48249
48096
 
48250
48097
  // make sure the participants process is properly attached / detached
@@ -48266,13 +48113,9 @@
48266
48113
  process.$parent = definitions;
48267
48114
  }
48268
48115
  }
48269
- } else
48270
-
48271
- if (is$1(businessObject, 'bpmn:DataOutputAssociation')) {
48116
+ } else if (is$1(businessObject, 'bpmn:DataOutputAssociation')) {
48272
48117
  containment = 'dataOutputAssociations';
48273
- } else
48274
-
48275
- if (is$1(businessObject, 'bpmn:DataInputAssociation')) {
48118
+ } else if (is$1(businessObject, 'bpmn:DataInputAssociation')) {
48276
48119
  containment = 'dataInputAssociations';
48277
48120
  }
48278
48121
 
@@ -48368,9 +48211,7 @@
48368
48211
 
48369
48212
  businessObject.targetRef = newTargetBo;
48370
48213
  }
48371
- } else
48372
-
48373
- if (is$1(businessObject, 'bpmn:DataInputAssociation')) {
48214
+ } else if (is$1(businessObject, 'bpmn:DataInputAssociation')) {
48374
48215
 
48375
48216
  // handle obnoxious isMsome sourceRef
48376
48217
  businessObject.get('sourceRef')[0] = newSourceBo;
@@ -48378,9 +48219,7 @@
48378
48219
  visualParent = context.parent || context.newParent || newTargetBo;
48379
48220
 
48380
48221
  this.updateSemanticParent(businessObject, newTargetBo, visualParent);
48381
- } else
48382
-
48383
- if (is$1(businessObject, 'bpmn:DataOutputAssociation')) {
48222
+ } else if (is$1(businessObject, 'bpmn:DataOutputAssociation')) {
48384
48223
  visualParent = context.parent || context.newParent || newSourceBo;
48385
48224
 
48386
48225
  this.updateSemanticParent(businessObject, newSourceBo, visualParent);
@@ -48597,8 +48436,7 @@
48597
48436
 
48598
48437
  if (elementType === 'root') {
48599
48438
  di = this._bpmnFactory.createDiPlane(businessObject, diAttrs);
48600
- } else
48601
- if (elementType === 'connection') {
48439
+ } else if (elementType === 'connection') {
48602
48440
  di = this._bpmnFactory.createDiEdge(businessObject, diAttrs);
48603
48441
  } else {
48604
48442
  di = this._bpmnFactory.createDiShape(businessObject, diAttrs);
@@ -52071,15 +51909,13 @@
52071
51909
  if (isHorizontalLane) {
52072
51910
  if (location === 'left') {
52073
51911
  location = 'top';
52074
- } else
52075
- if (location === 'right') {
51912
+ } else if (location === 'right') {
52076
51913
  location = 'bottom';
52077
51914
  }
52078
51915
  } else {
52079
51916
  if (location === 'top') {
52080
51917
  location = 'left';
52081
- } else
52082
- if (location === 'bottom') {
51918
+ } else if (location === 'bottom') {
52083
51919
  location = 'right';
52084
51920
  }
52085
51921
  }
@@ -52140,22 +51976,19 @@
52140
51976
  spacePos = lanePosition + 10;
52141
51977
  direction = 'n';
52142
51978
  axis = 'y';
52143
- } else
52144
- if (location === 'left') {
51979
+ } else if (location === 'left') {
52145
51980
  offset = -120;
52146
51981
  lanePosition = shape.x;
52147
51982
  spacePos = lanePosition + 10;
52148
51983
  direction = 'w';
52149
51984
  axis = 'x';
52150
- } else
52151
- if (location === 'bottom') {
51985
+ } else if (location === 'bottom') {
52152
51986
  offset = 120;
52153
51987
  lanePosition = shape.y + shape.height;
52154
51988
  spacePos = lanePosition - 10;
52155
51989
  direction = 's';
52156
51990
  axis = 'y';
52157
- } else
52158
- if (location === 'right') {
51991
+ } else if (location === 'right') {
52159
51992
  offset = 120;
52160
51993
  lanePosition = shape.x + shape.width;
52161
51994
  spacePos = lanePosition - 10;
@@ -55176,10 +55009,12 @@
55176
55009
  * to edit an elements text directly in the diagram
55177
55010
  *
55178
55011
  * @param {EventBus} eventBus the event bus
55012
+ * @param {Canvas} canvas the canvas
55179
55013
  */
55180
55014
  function DirectEditing(eventBus, canvas) {
55181
55015
 
55182
55016
  this._eventBus = eventBus;
55017
+ this._canvas = canvas;
55183
55018
 
55184
55019
  this._providers = [];
55185
55020
  this._textbox = new TextBox({
@@ -55243,6 +55078,9 @@
55243
55078
  this._active = null;
55244
55079
 
55245
55080
  this.resizable = undefined;
55081
+
55082
+ // restoreFocus API is available from diagram-js@15.0.0
55083
+ this._canvas.restoreFocus && this._canvas.restoreFocus();
55246
55084
  };
55247
55085
 
55248
55086
 
@@ -56794,26 +56632,24 @@
56794
56632
  var self = this;
56795
56633
  var translate = this._translate;
56796
56634
 
56797
- function toggleLoopEntry(event, entry) {
56798
-
56799
- // remove
56635
+ function toggleLoopCharacteristics(event, entry) {
56800
56636
  if (entry.active) {
56801
56637
  self._modeling.updateProperties(target, { loopCharacteristics: undefined });
56638
+
56802
56639
  return;
56803
56640
  }
56804
56641
 
56805
- const currentLoopCharacteristics = target.businessObject.get('loopCharacteristics'),
56806
- newLoopCharacteristics = self._moddle.create(entry.options.loopCharacteristics);
56807
-
56808
- // copy old properties
56809
- if (currentLoopCharacteristics) {
56810
- self._moddleCopy.copyElement(currentLoopCharacteristics, newLoopCharacteristics);
56811
- }
56642
+ var loopCharacteristics = target.businessObject.get('loopCharacteristics');
56812
56643
 
56813
- // update `isSequential` property
56814
- newLoopCharacteristics.set('isSequential', entry.options.isSequential);
56644
+ if (loopCharacteristics && is$1(loopCharacteristics, entry.options.loopCharacteristics)) {
56645
+ self._modeling.updateModdleProperties(target, loopCharacteristics, { isSequential: entry.options.isSequential });
56646
+ } else {
56647
+ loopCharacteristics = self._moddle.create(entry.options.loopCharacteristics, {
56648
+ isSequential: entry.options.isSequential
56649
+ });
56815
56650
 
56816
- self._modeling.updateProperties(target, { loopCharacteristics: newLoopCharacteristics });
56651
+ self._modeling.updateProperties(target, { loopCharacteristics: loopCharacteristics });
56652
+ }
56817
56653
  }
56818
56654
 
56819
56655
  var businessObject = getBusinessObject(target),
@@ -56835,7 +56671,7 @@
56835
56671
  className: 'bpmn-icon-parallel-mi-marker',
56836
56672
  title: translate('Parallel multi-instance'),
56837
56673
  active: isParallel,
56838
- action: toggleLoopEntry,
56674
+ action: toggleLoopCharacteristics,
56839
56675
  options: {
56840
56676
  loopCharacteristics: 'bpmn:MultiInstanceLoopCharacteristics',
56841
56677
  isSequential: false
@@ -56845,7 +56681,7 @@
56845
56681
  className: 'bpmn-icon-sequential-mi-marker',
56846
56682
  title: translate('Sequential multi-instance'),
56847
56683
  active: isSequential,
56848
- action: toggleLoopEntry,
56684
+ action: toggleLoopCharacteristics,
56849
56685
  options: {
56850
56686
  loopCharacteristics: 'bpmn:MultiInstanceLoopCharacteristics',
56851
56687
  isSequential: true
@@ -56855,7 +56691,7 @@
56855
56691
  className: 'bpmn-icon-loop-marker',
56856
56692
  title: translate('Loop'),
56857
56693
  active: isLoop,
56858
- action: toggleLoopEntry,
56694
+ action: toggleLoopCharacteristics,
56859
56695
  options: {
56860
56696
  loopCharacteristics: 'bpmn:StandardLoopCharacteristics'
56861
56697
  }
@@ -57392,9 +57228,7 @@
57392
57228
  { eventDefinitionType: 'bpmn:SignalEventDefinition' }
57393
57229
  )
57394
57230
  });
57395
- } else
57396
-
57397
- if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
57231
+ } else if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
57398
57232
 
57399
57233
  assign$1(actions, {
57400
57234
  'append.compensation-activity':
@@ -57407,9 +57241,7 @@
57407
57241
  }
57408
57242
  )
57409
57243
  });
57410
- } else
57411
-
57412
- if (!is$1(businessObject, 'bpmn:EndEvent') &&
57244
+ } else if (!is$1(businessObject, 'bpmn:EndEvent') &&
57413
57245
  !businessObject.isForCompensation &&
57414
57246
  !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
57415
57247
  !isEventSubProcess(businessObject)) {
@@ -57889,7 +57721,7 @@
57889
57721
  * @typedef {import('diagram-js/lib/features/popup-menu/PopupMenu').PopupMenuTarget} PopupMenuTarget
57890
57722
  */
57891
57723
 
57892
- var LOW_PRIORITY$5 = 900;
57724
+ var LOW_PRIORITY$6 = 900;
57893
57725
 
57894
57726
  /**
57895
57727
  * A provider for the distribute elements popup menu.
@@ -57908,7 +57740,7 @@
57908
57740
  this._popupMenu = popupMenu;
57909
57741
  this._rules = rules;
57910
57742
 
57911
- popupMenu.registerProvider('align-elements', LOW_PRIORITY$5, this);
57743
+ popupMenu.registerProvider('align-elements', LOW_PRIORITY$6, this);
57912
57744
  }
57913
57745
 
57914
57746
  DistributeElementsMenuProvider.$inject = [
@@ -58481,7 +58313,7 @@
58481
58313
  */
58482
58314
 
58483
58315
  var LOWER_PRIORITY = 1200;
58484
- var LOW_PRIORITY$4 = 800;
58316
+ var LOW_PRIORITY$5 = 800;
58485
58317
 
58486
58318
  /**
58487
58319
  * Basic grid snapping that covers connecting, creating, moving, resizing shapes, moving bendpoints
@@ -58499,7 +58331,7 @@
58499
58331
 
58500
58332
  var self = this;
58501
58333
 
58502
- eventBus.on('diagram.init', LOW_PRIORITY$4, function() {
58334
+ eventBus.on('diagram.init', LOW_PRIORITY$5, function() {
58503
58335
  self.setActive(active);
58504
58336
  });
58505
58337
 
@@ -59383,17 +59215,13 @@
59383
59215
 
59384
59216
  if (is$1(element, 'bpmn:Lane')) {
59385
59217
  return self._createParticipantHit(element, gfx);
59386
- } else
59387
-
59388
- if (is$1(element, 'bpmn:Participant')) {
59218
+ } else if (is$1(element, 'bpmn:Participant')) {
59389
59219
  if (isExpanded(element)) {
59390
59220
  return self._createParticipantHit(element, gfx);
59391
59221
  } else {
59392
59222
  return self._createDefaultHit(element, gfx);
59393
59223
  }
59394
- } else
59395
-
59396
- if (is$1(element, 'bpmn:SubProcess')) {
59224
+ } else if (is$1(element, 'bpmn:SubProcess')) {
59397
59225
  if (isExpanded(element)) {
59398
59226
  return self._createSubProcessHit(element, gfx);
59399
59227
  } else {
@@ -60132,7 +59960,7 @@
60132
59960
  var MARKER_RESIZING = 'djs-resizing',
60133
59961
  MARKER_RESIZE_NOT_OK = 'resize-not-ok';
60134
59962
 
60135
- var LOW_PRIORITY$3 = 500;
59963
+ var LOW_PRIORITY$4 = 500;
60136
59964
 
60137
59965
  /**
60138
59966
  * @typedef {import('../../core/Canvas').default} Canvas
@@ -60198,7 +60026,7 @@
60198
60026
  }
60199
60027
 
60200
60028
  // add and update previews
60201
- eventBus.on('resize.move', LOW_PRIORITY$3, function(event) {
60029
+ eventBus.on('resize.move', LOW_PRIORITY$4, function(event) {
60202
60030
  updateFrame(event.context);
60203
60031
  });
60204
60032
 
@@ -61503,6 +61331,285 @@
61503
61331
  modelingFeedback: [ 'type', ModelingFeedback ]
61504
61332
  };
61505
61333
 
61334
+ var LOW_PRIORITY$3 = 500;
61335
+
61336
+ var DEFAULT_PRIORITY$1 = 1000;
61337
+
61338
+ /**
61339
+ * @typedef {import('../../model/Types').Element} Element
61340
+ *
61341
+ * @typedef {import('./OutlineProvider').default} OutlineProvider
61342
+ * @typedef {import('../../core/EventBus').default} EventBus
61343
+ * @typedef {import('../../draw/Styles').default} Styles
61344
+ */
61345
+
61346
+ /**
61347
+ * @class
61348
+ *
61349
+ * A plugin that adds an outline to shapes and connections that may be activated and styled
61350
+ * via CSS classes.
61351
+ *
61352
+ * @param {EventBus} eventBus
61353
+ * @param {Styles} styles
61354
+ */
61355
+ function Outline(eventBus, styles) {
61356
+
61357
+ this._eventBus = eventBus;
61358
+
61359
+ this.offset = 5;
61360
+
61361
+ var OUTLINE_STYLE = styles.cls('djs-outline', [ 'no-fill' ]);
61362
+
61363
+ var self = this;
61364
+
61365
+ /**
61366
+ * @param {SVGElement} gfx
61367
+ *
61368
+ * @return {SVGElement} outline
61369
+ */
61370
+ function createOutline(gfx) {
61371
+ var outline = create$1('rect');
61372
+
61373
+ attr(outline, assign$1({
61374
+ x: 0,
61375
+ y: 0,
61376
+ rx: 4,
61377
+ width: 100,
61378
+ height: 100
61379
+ }, OUTLINE_STYLE));
61380
+
61381
+ return outline;
61382
+ }
61383
+
61384
+ // A low priortity is necessary, because outlines of labels have to be updated
61385
+ // after the label bounds have been updated in the renderer.
61386
+ eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$3, function(event) {
61387
+ var element = event.element,
61388
+ gfx = event.gfx;
61389
+
61390
+ var outline = query('.djs-outline', gfx);
61391
+
61392
+ if (!outline) {
61393
+ outline = self.getOutline(element) || createOutline();
61394
+ append(gfx, outline);
61395
+ }
61396
+
61397
+ self.updateShapeOutline(outline, element);
61398
+ });
61399
+
61400
+ eventBus.on([ 'connection.added', 'connection.changed' ], function(event) {
61401
+ var element = event.element,
61402
+ gfx = event.gfx;
61403
+
61404
+ var outline = query('.djs-outline', gfx);
61405
+
61406
+ if (!outline) {
61407
+ outline = createOutline();
61408
+ append(gfx, outline);
61409
+ }
61410
+
61411
+ self.updateConnectionOutline(outline, element);
61412
+ });
61413
+ }
61414
+
61415
+
61416
+ /**
61417
+ * Updates the outline of a shape respecting the dimension of the
61418
+ * element and an outline offset.
61419
+ *
61420
+ * @param {SVGElement} outline
61421
+ * @param {Element} element
61422
+ */
61423
+ Outline.prototype.updateShapeOutline = function(outline, element) {
61424
+
61425
+ var updated = false;
61426
+ var providers = this._getProviders();
61427
+
61428
+ if (providers.length) {
61429
+ forEach$1(providers, function(provider) {
61430
+ updated = updated || provider.updateOutline(element, outline);
61431
+ });
61432
+ }
61433
+
61434
+ if (!updated) {
61435
+ attr(outline, {
61436
+ x: -this.offset,
61437
+ y: -this.offset,
61438
+ width: element.width + this.offset * 2,
61439
+ height: element.height + this.offset * 2
61440
+ });
61441
+ }
61442
+ };
61443
+
61444
+ /**
61445
+ * Updates the outline of a connection respecting the bounding box of
61446
+ * the connection and an outline offset.
61447
+ * Register an outline provider with the given priority.
61448
+ *
61449
+ * @param {SVGElement} outline
61450
+ * @param {Element} connection
61451
+ */
61452
+ Outline.prototype.updateConnectionOutline = function(outline, connection) {
61453
+ var bbox = getBBox(connection);
61454
+
61455
+ attr(outline, {
61456
+ x: bbox.x - this.offset,
61457
+ y: bbox.y - this.offset,
61458
+ width: bbox.width + this.offset * 2,
61459
+ height: bbox.height + this.offset * 2
61460
+ });
61461
+ };
61462
+
61463
+ /**
61464
+ * Register an outline provider with the given priority.
61465
+ *
61466
+ * @param {number} priority
61467
+ * @param {OutlineProvider} provider
61468
+ */
61469
+ Outline.prototype.registerProvider = function(priority, provider) {
61470
+ if (!provider) {
61471
+ provider = priority;
61472
+ priority = DEFAULT_PRIORITY$1;
61473
+ }
61474
+
61475
+ this._eventBus.on('outline.getProviders', priority, function(event) {
61476
+ event.providers.push(provider);
61477
+ });
61478
+ };
61479
+
61480
+ /**
61481
+ * Returns the registered outline providers.
61482
+ *
61483
+ * @returns {OutlineProvider[]}
61484
+ */
61485
+ Outline.prototype._getProviders = function() {
61486
+ var event = this._eventBus.createEvent({
61487
+ type: 'outline.getProviders',
61488
+ providers: []
61489
+ });
61490
+
61491
+ this._eventBus.fire(event);
61492
+
61493
+ return event.providers;
61494
+ };
61495
+
61496
+ /**
61497
+ * Returns the outline for an element.
61498
+ *
61499
+ * @param {Element} element
61500
+ */
61501
+ Outline.prototype.getOutline = function(element) {
61502
+ var outline;
61503
+ var providers = this._getProviders();
61504
+
61505
+ forEach$1(providers, function(provider) {
61506
+
61507
+ if (!isFunction(provider.getOutline)) {
61508
+ return;
61509
+ }
61510
+
61511
+ outline = outline || provider.getOutline(element);
61512
+ });
61513
+
61514
+ return outline;
61515
+ };
61516
+
61517
+ Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
61518
+
61519
+ var SELECTION_OUTLINE_PADDING = 6;
61520
+
61521
+ /**
61522
+ * @typedef {import('../../model/Types').Element} Element
61523
+ *
61524
+ * @typedef {import('../../core/EventBus').default} EventBus
61525
+ * @typedef {import('../selection/Selection').default} Selection
61526
+ * @typedef {import('../../core/Canvas').default} Canvas
61527
+ */
61528
+
61529
+ /**
61530
+ * @class
61531
+ *
61532
+ * A plugin that adds an outline to shapes and connections that may be activated and styled
61533
+ * via CSS classes.
61534
+ *
61535
+ * @param {EventBus} eventBus
61536
+ * @param {Canvas} canvas
61537
+ * @param {Selection} selection
61538
+ */
61539
+ function MultiSelectionOutline(eventBus, canvas, selection) {
61540
+ this._canvas = canvas;
61541
+
61542
+ var self = this;
61543
+
61544
+ eventBus.on('element.changed', function(event) {
61545
+ if (selection.isSelected(event.element)) {
61546
+ self._updateMultiSelectionOutline(selection.get());
61547
+ }
61548
+ });
61549
+
61550
+ eventBus.on('selection.changed', function(event) {
61551
+ var newSelection = event.newSelection;
61552
+
61553
+ self._updateMultiSelectionOutline(newSelection);
61554
+ });
61555
+ }
61556
+
61557
+
61558
+
61559
+ MultiSelectionOutline.prototype._updateMultiSelectionOutline = function(selection) {
61560
+ var layer = this._canvas.getLayer('selectionOutline');
61561
+
61562
+ clear(layer);
61563
+
61564
+ var enabled = selection.length > 1;
61565
+
61566
+ var container = this._canvas.getContainer();
61567
+
61568
+ classes(container)[enabled ? 'add' : 'remove']('djs-multi-select');
61569
+
61570
+ if (!enabled) {
61571
+ return;
61572
+ }
61573
+
61574
+ var bBox = addSelectionOutlinePadding(getBBox(selection));
61575
+
61576
+ var rect = create$1('rect');
61577
+
61578
+ attr(rect, assign$1({
61579
+ rx: 3
61580
+ }, bBox));
61581
+
61582
+ classes(rect).add('djs-selection-outline');
61583
+
61584
+ append(layer, rect);
61585
+ };
61586
+
61587
+
61588
+ MultiSelectionOutline.$inject = [ 'eventBus', 'canvas', 'selection' ];
61589
+
61590
+ // helpers //////////
61591
+
61592
+ function addSelectionOutlinePadding(bBox) {
61593
+ return {
61594
+ x: bBox.x - SELECTION_OUTLINE_PADDING,
61595
+ y: bBox.y - SELECTION_OUTLINE_PADDING,
61596
+ width: bBox.width + SELECTION_OUTLINE_PADDING * 2,
61597
+ height: bBox.height + SELECTION_OUTLINE_PADDING * 2
61598
+ };
61599
+ }
61600
+
61601
+ /**
61602
+ * @type { import('didi').ModuleDeclaration }
61603
+ */
61604
+ var Ouline = {
61605
+ __depends__: [
61606
+ SelectionModule
61607
+ ],
61608
+ __init__: [ 'outline', 'multiSelectionOutline' ],
61609
+ outline: [ 'type', Outline ],
61610
+ multiSelectionOutline: [ 'type', MultiSelectionOutline ]
61611
+ };
61612
+
61506
61613
  /**
61507
61614
  * @typedef {import('../../core/Types').ElementLike} Element
61508
61615
  * @typedef {import('../../core/Types').ShapeLike} Shape
@@ -62005,7 +62112,7 @@
62005
62112
  __depends__: [
62006
62113
  InteractionEventsModule$1,
62007
62114
  SelectionModule,
62008
- OutlineModule$1,
62115
+ Ouline,
62009
62116
  RulesModule$1,
62010
62117
  DraggingModule,
62011
62118
  PreviewSupportModule
@@ -64779,6 +64886,8 @@
64779
64886
  * @typedef {import('./SearchPadProvider').Token} Token
64780
64887
  */
64781
64888
 
64889
+ var SCROLL_TO_ELEMENT_PADDING = 300;
64890
+
64782
64891
  /**
64783
64892
  * Provides searching infrastructure.
64784
64893
  *
@@ -64789,7 +64898,7 @@
64789
64898
  */
64790
64899
  function SearchPad(canvas, eventBus, selection, translate) {
64791
64900
  this._open = false;
64792
- this._results = [];
64901
+ this._results = {};
64793
64902
  this._eventMaps = [];
64794
64903
 
64795
64904
  this._cachedRootElement = null;
@@ -64943,6 +65052,9 @@
64943
65052
  });
64944
65053
 
64945
65054
  if (!searchResults.length) {
65055
+ this._clearMarkers();
65056
+ this._selection.select(null);
65057
+
64946
65058
  return;
64947
65059
  }
64948
65060
 
@@ -65011,12 +65123,22 @@
65011
65123
  SearchPad.prototype._clearResults = function() {
65012
65124
  clear$1(this._resultsContainer);
65013
65125
 
65014
- this._results = [];
65126
+ this._results = {};
65015
65127
 
65016
65128
  this._eventBus.fire('searchPad.cleared');
65017
65129
  };
65018
65130
 
65019
65131
 
65132
+ /**
65133
+ * Clears all markers.
65134
+ */
65135
+ SearchPad.prototype._clearMarkers = function() {
65136
+ for (var id in this._results) {
65137
+ this._canvas.removeMarker(this._results[id].element, 'djs-search-preselected');
65138
+ }
65139
+ };
65140
+
65141
+
65020
65142
  /**
65021
65143
  * Get currently selected result.
65022
65144
  *
@@ -65133,12 +65255,16 @@
65133
65255
  classes$1(this._canvas.getContainer()).remove('djs-search-open');
65134
65256
  classes$1(this._container).remove('open');
65135
65257
 
65258
+ this._clearMarkers();
65259
+
65136
65260
  this._clearResults();
65137
65261
 
65138
65262
  this._searchInput.value = '';
65139
65263
  this._searchInput.blur();
65140
65264
 
65141
65265
  this._eventBus.fire('searchPad.closed');
65266
+
65267
+ this._canvas.restoreFocus();
65142
65268
  };
65143
65269
 
65144
65270
 
@@ -65171,6 +65297,8 @@
65171
65297
  return;
65172
65298
  }
65173
65299
 
65300
+ this._clearMarkers();
65301
+
65174
65302
  // removing preselection from current node
65175
65303
  if (selectedNode) {
65176
65304
  classes$1(selectedNode).remove(SearchPad.RESULT_SELECTED_CLASS);
@@ -65181,14 +65309,14 @@
65181
65309
 
65182
65310
  classes$1(node).add(SearchPad.RESULT_SELECTED_CLASS);
65183
65311
 
65184
- this._canvas.zoom(1);
65185
-
65186
65312
  this._canvas.scrollToElement(element, {
65187
- top: 300
65313
+ top: SCROLL_TO_ELEMENT_PADDING
65188
65314
  });
65189
65315
 
65190
65316
  this._selection.select(element);
65191
65317
 
65318
+ this._canvas.addMarker(element, 'djs-search-preselected');
65319
+
65192
65320
  this._eventBus.fire('searchPad.preselected', element);
65193
65321
  };
65194
65322
 
@@ -65207,7 +65335,9 @@
65207
65335
 
65208
65336
  this.close(false);
65209
65337
 
65210
- this._canvas.scrollToElement(element, { top: 400 });
65338
+ this._canvas.scrollToElement(element, {
65339
+ top: SCROLL_TO_ELEMENT_PADDING
65340
+ });
65211
65341
 
65212
65342
  this._selection.select(element);
65213
65343
 
@@ -65253,10 +65383,13 @@
65253
65383
  var htmlText = '';
65254
65384
 
65255
65385
  tokens.forEach(function(t) {
65256
- if (t.matched) {
65257
- htmlText += '<b class="' + SearchPad.RESULT_HIGHLIGHT_CLASS + '">' + escapeHTML(t.matched) + '</b>';
65386
+ var text = escapeHTML(t.value || t.matched || t.normal);
65387
+ var match = t.match || t.matched;
65388
+
65389
+ if (match) {
65390
+ htmlText += '<b class="' + SearchPad.RESULT_HIGHLIGHT_CLASS + '">' + text + '</b>';
65258
65391
  } else {
65259
- htmlText += escapeHTML(t.normal);
65392
+ htmlText += text;
65260
65393
  }
65261
65394
  });
65262
65395
 
@@ -65314,7 +65447,11 @@
65314
65447
  * @typedef {import('diagram-js/lib/features/search-pad/SearchPad').default} SearchPad
65315
65448
  *
65316
65449
  * @typedef {import('diagram-js/lib/features/search-pad/SearchPadProvider').default} SearchPadProvider
65317
- * @typedef {import('diagram-js/lib/features/search-pad/SearchPadProvider').SearchResult} SearchResult
65450
+ * @typedef {import('diagram-js/lib/features/search-pad/SearchPadProvider').SearchResult} SearchPadResult
65451
+ * @typedef {import('diagram-js/lib/features/search-pad/SearchPadProvider').Token} SearchPadToken
65452
+ * @typedef {import('diagram-js/lib/features/search/search').default} Search
65453
+ * @typedef {import('diagram-js/lib/features/search/search').SearchResult} SearchResult
65454
+ * @typedef {import('diagram-js/lib/features/search/search').Token} SearchToken
65318
65455
  */
65319
65456
 
65320
65457
  /**
@@ -65325,10 +65462,12 @@
65325
65462
  * @param {ElementRegistry} elementRegistry
65326
65463
  * @param {SearchPad} searchPad
65327
65464
  * @param {Canvas} canvas
65465
+ * @param {Search} search
65328
65466
  */
65329
- function BpmnSearchProvider(elementRegistry, searchPad, canvas) {
65467
+ function BpmnSearchProvider(elementRegistry, searchPad, canvas, search) {
65330
65468
  this._elementRegistry = elementRegistry;
65331
65469
  this._canvas = canvas;
65470
+ this._search = search;
65332
65471
 
65333
65472
  searchPad.registerProvider(this);
65334
65473
  }
@@ -65336,13 +65475,14 @@
65336
65475
  BpmnSearchProvider.$inject = [
65337
65476
  'elementRegistry',
65338
65477
  'searchPad',
65339
- 'canvas'
65478
+ 'canvas',
65479
+ 'search'
65340
65480
  ];
65341
65481
 
65342
65482
  /**
65343
65483
  * @param {string} pattern
65344
65484
  *
65345
- * @return {SearchResult[]}
65485
+ * @return {SearchPadResult[]}
65346
65486
  */
65347
65487
  BpmnSearchProvider.prototype.find = function(pattern) {
65348
65488
  var rootElements = this._canvas.getRootElements();
@@ -65351,167 +65491,261 @@
65351
65491
  return !isLabel(element) && !rootElements.includes(element);
65352
65492
  });
65353
65493
 
65354
- return elements
65355
- .reduce(function(results, element) {
65356
- var label = getLabel(element);
65357
-
65358
- var primaryTokens = findMatches(label, pattern),
65359
- secondaryTokens = findMatches(element.id, pattern);
65360
-
65361
- if (hasMatch(primaryTokens) || hasMatch(secondaryTokens)) {
65362
- return [
65363
- ...results,
65364
- {
65365
- primaryTokens,
65366
- secondaryTokens,
65367
- element
65368
- }
65369
- ];
65370
- }
65371
-
65372
- return results;
65373
- }, [])
65374
- .sort(function(a, b) {
65375
- return compareTokens(a.primaryTokens, b.primaryTokens)
65376
- || compareTokens(a.secondaryTokens, b.secondaryTokens)
65377
- || compareStrings(getLabel(a.element), getLabel(b.element))
65378
- || compareStrings(a.element.id, b.element.id);
65379
- })
65380
- .map(function(result) {
65494
+ return this._search(
65495
+ elements.map(element => {
65381
65496
  return {
65382
- element: result.element,
65383
- primaryTokens: result.primaryTokens.map(function(token) {
65384
- return omit(token, [ 'index' ]);
65385
- }),
65386
- secondaryTokens: result.secondaryTokens.map(function(token) {
65387
- return omit(token, [ 'index' ]);
65388
- })
65497
+ element,
65498
+ label: getLabel(element),
65499
+ id: element.id
65389
65500
  };
65390
- });
65501
+ }),
65502
+ pattern, {
65503
+ keys: [
65504
+ 'label',
65505
+ 'id'
65506
+ ]
65507
+ }
65508
+ ).map(toSearchPadResult);
65391
65509
  };
65392
65510
 
65393
65511
  /**
65394
- * @param {Token} token
65512
+ * @param {SearchResult} token
65395
65513
  *
65396
- * @return {boolean}
65514
+ * @return {SearchPadResult}
65397
65515
  */
65398
- function isMatch(token) {
65399
- return 'matched' in token;
65516
+ function toSearchPadResult(result) {
65517
+
65518
+ const {
65519
+ item: {
65520
+ element
65521
+ },
65522
+ tokens
65523
+ } = result;
65524
+
65525
+ return {
65526
+ element,
65527
+ primaryTokens: tokens.label,
65528
+ secondaryTokens: tokens.id
65529
+ };
65400
65530
  }
65401
65531
 
65532
+ var SearchModule = {
65533
+ __depends__: [
65534
+ SearchPadModule,
65535
+ SearchModule$1
65536
+ ],
65537
+ __init__: [ 'bpmnSearch' ],
65538
+ bpmnSearch: [ 'type', BpmnSearchProvider ]
65539
+ };
65540
+
65541
+ const DATA_OBJECT_REFERENCE_OUTLINE_PATH = 'M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z';
65542
+ const DATA_STORE_REFERENCE_OUTLINE_PATH = 'M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z';
65543
+
65402
65544
  /**
65403
- * @param {Token[]} tokens
65545
+ * @typedef { import('diagram-js/lib/util/Types').Dimensions} Dimensions
65546
+ */
65547
+
65548
+ /**
65549
+ * @type {Dimensions}
65550
+ */
65551
+ const DATA_OBJECT_REFERENCE_STANDARD_SIZE = { width: 36, height: 50 };
65552
+
65553
+ /**
65554
+ * @type {Dimensions}
65555
+ */
65556
+ const DATA_STORE_REFERENCE_STANDARD_SIZE = { width: 50, height: 50 };
65557
+
65558
+ /**
65559
+ * Create a path element with given attributes.
65560
+ * @param {string} path
65561
+ * @param {Object} attrs
65562
+ * @param {Object} OUTLINE_STYLE
65563
+ * @return {SVGElement}
65564
+ */
65565
+ function createPath(path, attrs, OUTLINE_STYLE) {
65566
+ return create$1('path', {
65567
+ d: path,
65568
+ strokeWidth: 2,
65569
+ transform: `translate(${attrs.x}, ${attrs.y})`,
65570
+ ...OUTLINE_STYLE
65571
+ });
65572
+ }
65573
+
65574
+ /**
65575
+ * @typedef { import('diagram-js/lib/features/outline/OutlineProvider').default } BaseOutlineProvider
65404
65576
  *
65405
- * @return {boolean}
65577
+ * @typedef { import('diagram-js/lib/features/outline/OutlineProvider').Outline } Outline
65578
+ *
65579
+ * @typedef { import('diagram-js/lib/draw/Styles').default } Styles
65580
+ *
65581
+ * @typedef { import('diagram-js/lib/model/Types').Element } Element
65406
65582
  */
65407
- function hasMatch(tokens) {
65408
- return tokens.find(isMatch);
65583
+
65584
+ const DEFAULT_OFFSET = 5;
65585
+
65586
+ /**
65587
+ * BPMN-specific outline provider.
65588
+ *
65589
+ * @implements {BaseOutlineProvider}
65590
+ *
65591
+ * @param {Outline} outline
65592
+ * @param {Styles} styles
65593
+ */
65594
+ function OutlineProvider(outline, styles) {
65595
+
65596
+ this._styles = styles;
65597
+ outline.registerProvider(this);
65409
65598
  }
65410
65599
 
65600
+ OutlineProvider.$inject = [
65601
+ 'outline',
65602
+ 'styles'
65603
+ ];
65604
+
65411
65605
  /**
65412
- * Compares two token arrays.
65606
+ * Returns outline for a given element.
65413
65607
  *
65414
- * @param {Token[]} tokensA
65415
- * @param {Token[]} tokensB
65608
+ * @param {Element} element
65416
65609
  *
65417
- * @returns {number}
65610
+ * @return {Outline}
65418
65611
  */
65419
- function compareTokens(tokensA, tokensB) {
65420
- const tokensAHasMatch = hasMatch(tokensA),
65421
- tokensBHasMatch = hasMatch(tokensB);
65612
+ OutlineProvider.prototype.getOutline = function(element) {
65422
65613
 
65423
- if (tokensAHasMatch && !tokensBHasMatch) {
65424
- return -1;
65425
- }
65614
+ const OUTLINE_STYLE = this._styles.cls('djs-outline', [ 'no-fill' ]);
65426
65615
 
65427
- if (!tokensAHasMatch && tokensBHasMatch) {
65428
- return 1;
65429
- }
65616
+ var outline;
65430
65617
 
65431
- if (!tokensAHasMatch && !tokensBHasMatch) {
65432
- return 0;
65618
+ if (isLabel(element)) {
65619
+ return;
65433
65620
  }
65434
65621
 
65435
- const tokensAFirstMatch = tokensA.find(isMatch),
65436
- tokensBFirstMatch = tokensB.find(isMatch);
65622
+ if (is$1(element, 'bpmn:Gateway')) {
65623
+ outline = create$1('rect');
65437
65624
 
65438
- if (tokensAFirstMatch.index < tokensBFirstMatch.index) {
65439
- return -1;
65440
- }
65625
+ assign$1(outline.style, {
65626
+ 'transform-box': 'fill-box',
65627
+ 'transform': 'rotate(45deg)',
65628
+ 'transform-origin': 'center'
65629
+ });
65630
+
65631
+ attr(outline, assign$1({
65632
+ x: 2,
65633
+ y: 2,
65634
+ rx: 4,
65635
+ width: element.width - 4,
65636
+ height: element.height - 4,
65637
+ }, OUTLINE_STYLE));
65441
65638
 
65442
- if (tokensAFirstMatch.index > tokensBFirstMatch.index) {
65443
- return 1;
65639
+ } else if (isAny(element, [ 'bpmn:Task', 'bpmn:SubProcess', 'bpmn:Group', 'bpmn:CallActivity' ])) {
65640
+ outline = create$1('rect');
65641
+
65642
+ attr(outline, assign$1({
65643
+ x: -DEFAULT_OFFSET,
65644
+ y: -DEFAULT_OFFSET,
65645
+ rx: 14,
65646
+ width: element.width + DEFAULT_OFFSET * 2,
65647
+ height: element.height + DEFAULT_OFFSET * 2
65648
+ }, OUTLINE_STYLE));
65649
+
65650
+ } else if (is$1(element, 'bpmn:EndEvent')) {
65651
+
65652
+ outline = create$1('circle');
65653
+
65654
+ // Extra 1px offset needed due to increased stroke-width of end event
65655
+ // which makes it bigger than other events.
65656
+
65657
+ attr(outline, assign$1({
65658
+ cx: element.width / 2,
65659
+ cy: element.height / 2,
65660
+ r: element.width / 2 + DEFAULT_OFFSET + 1
65661
+ }, OUTLINE_STYLE));
65662
+
65663
+ } else if (is$1(element, 'bpmn:Event')) {
65664
+ outline = create$1('circle');
65665
+
65666
+ attr(outline, assign$1({
65667
+ cx: element.width / 2,
65668
+ cy: element.height / 2,
65669
+ r: element.width / 2 + DEFAULT_OFFSET
65670
+ }, OUTLINE_STYLE));
65671
+
65672
+ } else if (is$1(element, 'bpmn:DataObjectReference') && isStandardSize(element, 'bpmn:DataObjectReference')) {
65673
+
65674
+ outline = createPath(
65675
+ DATA_OBJECT_REFERENCE_OUTLINE_PATH,
65676
+ { x: -6, y: -6 },
65677
+ OUTLINE_STYLE
65678
+ );
65679
+
65680
+ } else if (is$1(element, 'bpmn:DataStoreReference') && isStandardSize(element, 'bpmn:DataStoreReference')) {
65681
+
65682
+ outline = createPath(
65683
+ DATA_STORE_REFERENCE_OUTLINE_PATH,
65684
+ { x: -6, y: -6 },
65685
+ OUTLINE_STYLE
65686
+ );
65444
65687
  }
65445
65688
 
65446
- return 0;
65447
- }
65689
+ return outline;
65690
+ };
65448
65691
 
65449
65692
  /**
65450
- * Compares two strings.
65451
- *
65452
- * @param {string} [a]
65453
- * @param {string} [b]
65693
+ * Updates the outline for a given element.
65694
+ * Returns true if the update for the given element was handled by this provider.
65454
65695
  *
65455
- * @returns {number}
65696
+ * @param {Element} element
65697
+ * @param {Outline} outline
65698
+ * @returns {boolean}
65456
65699
  */
65457
- function compareStrings(a = '', b = '') {
65458
- return a.localeCompare(b);
65459
- }
65700
+ OutlineProvider.prototype.updateOutline = function(element, outline) {
65460
65701
 
65461
- /**
65462
- * @param {string} text
65463
- * @param {string} pattern
65464
- *
65465
- * @return {Token[]}
65466
- */
65467
- function findMatches(text, pattern) {
65468
- var tokens = [],
65469
- originalText = text;
65702
+ if (isLabel(element)) {
65703
+ return;
65704
+ }
65470
65705
 
65471
- if (!text) {
65472
- return tokens;
65706
+ if (isAny(element, [ 'bpmn:SubProcess', 'bpmn:Group' ])) {
65707
+
65708
+ attr(outline, {
65709
+ width: element.width + DEFAULT_OFFSET * 2,
65710
+ height: element.height + DEFAULT_OFFSET * 2
65711
+ });
65712
+
65713
+ return true;
65714
+
65715
+ } else if (isAny(element, [
65716
+ 'bpmn:Event',
65717
+ 'bpmn:Gateway',
65718
+ 'bpmn:DataStoreReference',
65719
+ 'bpmn:DataObjectReference'
65720
+ ])) {
65721
+ return true;
65473
65722
  }
65474
65723
 
65475
- text = text.toLowerCase();
65476
- pattern = pattern.toLowerCase();
65724
+ return false;
65725
+ };
65477
65726
 
65478
- var index = text.indexOf(pattern);
65479
65727
 
65480
- if (index > -1) {
65481
- if (index !== 0) {
65482
- tokens.push({
65483
- normal: originalText.slice(0, index),
65484
- index: 0
65485
- });
65486
- }
65728
+ // helpers //////////
65487
65729
 
65488
- tokens.push({
65489
- matched: originalText.slice(index, index + pattern.length),
65490
- index: index
65491
- });
65730
+ function isStandardSize(element, type) {
65731
+ var standardSize;
65492
65732
 
65493
- if (pattern.length + index < text.length) {
65494
- tokens.push({
65495
- normal: originalText.slice(index + pattern.length),
65496
- index: index + pattern.length
65497
- });
65498
- }
65499
- } else {
65500
- tokens.push({
65501
- normal: originalText,
65502
- index: 0
65503
- });
65733
+ if (type === 'bpmn:DataObjectReference') {
65734
+ standardSize = DATA_OBJECT_REFERENCE_STANDARD_SIZE;
65735
+ } else if (type === 'bpmn:DataStoreReference') {
65736
+ standardSize = DATA_STORE_REFERENCE_STANDARD_SIZE;
65504
65737
  }
65505
65738
 
65506
- return tokens;
65739
+ return element.width === standardSize.width
65740
+ && element.height === standardSize.height;
65507
65741
  }
65508
65742
 
65509
- var SearchModule = {
65743
+ var OutlineModule = {
65510
65744
  __depends__: [
65511
- SearchPadModule
65745
+ Ouline
65512
65746
  ],
65513
- __init__: [ 'bpmnSearch' ],
65514
- bpmnSearch: [ 'type', BpmnSearchProvider ]
65747
+ __init__: [ 'outlineProvider' ],
65748
+ outlineProvider: [ 'type', OutlineProvider ]
65515
65749
  };
65516
65750
 
65517
65751
  var initialDiagram =
@@ -65666,7 +65900,8 @@
65666
65900
  ReplacePreviewModule,
65667
65901
  ResizeModule,
65668
65902
  SnappingModule,
65669
- SearchModule
65903
+ SearchModule,
65904
+ OutlineModule
65670
65905
  ];
65671
65906
 
65672
65907