camunda-bpmn-js 3.2.0 → 3.3.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 (36) hide show
  1. package/dist/assets/bpmn-font/css/bpmn.css +1 -0
  2. package/dist/assets/bpmn-js.css +1 -0
  3. package/dist/base-modeler.development.js +476 -585
  4. package/dist/base-modeler.production.min.js +31 -31
  5. package/dist/base-navigated-viewer.development.js +12 -139
  6. package/dist/base-navigated-viewer.production.min.js +1 -1
  7. package/dist/base-viewer.development.js +12 -139
  8. package/dist/base-viewer.production.min.js +1 -1
  9. package/dist/camunda-cloud-modeler.development.js +476 -585
  10. package/dist/camunda-cloud-modeler.production.min.js +32 -32
  11. package/dist/camunda-cloud-navigated-viewer.development.js +12 -139
  12. package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
  13. package/dist/camunda-cloud-viewer.development.js +12 -139
  14. package/dist/camunda-cloud-viewer.production.min.js +1 -1
  15. package/dist/camunda-platform-modeler.development.js +476 -585
  16. package/dist/camunda-platform-modeler.production.min.js +31 -31
  17. package/dist/camunda-platform-navigated-viewer.development.js +12 -139
  18. package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
  19. package/dist/camunda-platform-viewer.development.js +12 -139
  20. package/dist/camunda-platform-viewer.production.min.js +1 -1
  21. package/lib/base/Modeler.d.ts +15 -15
  22. package/lib/base/NavigatedViewer.d.ts +2 -2
  23. package/lib/base/Viewer.d.ts +2 -2
  24. package/lib/camunda-cloud/ElementTemplatesValidator.d.ts +1 -1
  25. package/lib/camunda-cloud/Modeler.d.ts +3 -3
  26. package/lib/camunda-cloud/NavigatedViewer.d.ts +3 -3
  27. package/lib/camunda-cloud/Viewer.d.ts +3 -3
  28. package/lib/camunda-cloud/features/rules/BpmnRules.d.ts +32 -32
  29. package/lib/camunda-cloud/features/rules/index.d.ts +6 -6
  30. package/lib/camunda-cloud/util/commonModules.d.ts +9 -9
  31. package/lib/camunda-platform/Modeler.d.ts +3 -3
  32. package/lib/camunda-platform/NavigatedViewer.d.ts +5 -5
  33. package/lib/camunda-platform/Viewer.d.ts +5 -5
  34. package/lib/camunda-platform/util/commonModules.d.ts +9 -9
  35. package/lib/util/ExtensionElementsUtil.d.ts +24 -24
  36. package/package.json +3 -3
@@ -82,15 +82,14 @@
82
82
  *
83
83
  * @param {Seed} seed
84
84
  */
85
-
86
85
  function Ids(seed) {
87
86
  if (!(this instanceof Ids)) {
88
87
  return new Ids(seed);
89
88
  }
90
-
91
89
  seed = seed || [128, 36, 1];
92
90
  this._seed = seed.length ? hat_1.rack(seed[0], seed[1], seed[2]) : seed;
93
91
  }
92
+
94
93
  /**
95
94
  * Generate a next id.
96
95
  *
@@ -98,10 +97,10 @@
98
97
  *
99
98
  * @return {String} id
100
99
  */
101
-
102
100
  Ids.prototype.next = function (element) {
103
101
  return this._seed(element || true);
104
102
  };
103
+
105
104
  /**
106
105
  * Generate a next id with a given prefix.
107
106
  *
@@ -109,61 +108,54 @@
109
108
  *
110
109
  * @return {String} id
111
110
  */
112
-
113
-
114
111
  Ids.prototype.nextPrefixed = function (prefix, element) {
115
112
  var id;
116
-
117
113
  do {
118
114
  id = prefix + this.next(true);
119
- } while (this.assigned(id)); // claim {prefix}{random}
120
-
115
+ } while (this.assigned(id));
121
116
 
122
- this.claim(id, element); // return
117
+ // claim {prefix}{random}
118
+ this.claim(id, element);
123
119
 
120
+ // return
124
121
  return id;
125
122
  };
123
+
126
124
  /**
127
125
  * Manually claim an existing id.
128
126
  *
129
127
  * @param {String} id
130
128
  * @param {String} [element] element the id is claimed by
131
129
  */
132
-
133
-
134
130
  Ids.prototype.claim = function (id, element) {
135
131
  this._seed.set(id, element || true);
136
132
  };
133
+
137
134
  /**
138
135
  * Returns true if the given id has already been assigned.
139
136
  *
140
137
  * @param {String} id
141
138
  * @return {Boolean}
142
139
  */
143
-
144
-
145
140
  Ids.prototype.assigned = function (id) {
146
141
  return this._seed.get(id) || false;
147
142
  };
143
+
148
144
  /**
149
145
  * Unclaim an id.
150
146
  *
151
147
  * @param {String} id the id to unclaim
152
148
  */
153
-
154
-
155
149
  Ids.prototype.unclaim = function (id) {
156
150
  delete this._seed.hats[id];
157
151
  };
152
+
158
153
  /**
159
154
  * Clear all claimed ids.
160
155
  */
161
-
162
-
163
156
  Ids.prototype.clear = function () {
164
157
  var hats = this._seed.hats,
165
- id;
166
-
158
+ id;
167
159
  for (id in hats) {
168
160
  this.unclaim(id);
169
161
  }
@@ -16263,62 +16255,6 @@
16263
16255
  * @typedef {import('../model/Types').ModdleElement} ModdleElement
16264
16256
  */
16265
16257
 
16266
- // TODO(nikku): remove with future bpmn-js version
16267
-
16268
- /**
16269
- * Wraps APIs to check:
16270
- *
16271
- * 1) If a callback is passed -> Warn users about callback deprecation.
16272
- * 2) If Promise class is implemented in current environment.
16273
- *
16274
- * @private
16275
- *
16276
- * @param {Function} api
16277
- *
16278
- * @return {Function}
16279
- */
16280
- function wrapForCompatibility(api) {
16281
-
16282
- return function() {
16283
-
16284
- if (!window.Promise) {
16285
- throw new Error('Promises is not supported in this environment. Please polyfill Promise.');
16286
- }
16287
-
16288
- var argLen = arguments.length;
16289
- if (argLen >= 1 && isFunction$1(arguments[argLen - 1])) {
16290
-
16291
- var callback = arguments[argLen - 1];
16292
-
16293
- console.warn(new Error(
16294
- 'Passing callbacks to ' + api.name + ' is deprecated and will be removed in a future major release. ' +
16295
- 'Please switch to promises: https://bpmn.io/l/moving-to-promises.html'
16296
- ));
16297
-
16298
- var argsWithoutCallback = Array.prototype.slice.call(arguments, 0, -1);
16299
-
16300
- api.apply(this, argsWithoutCallback).then(function(result) {
16301
-
16302
- var firstKey = Object.keys(result)[0];
16303
-
16304
- // The APIs we are wrapping all resolve a single item depending on the API.
16305
- // For instance, importXML resolves { warnings } and saveXML returns { xml }.
16306
- // That's why we can call the callback with the first item of result.
16307
- return callback(null, result[firstKey]);
16308
-
16309
- // Passing a second paramter instead of catch because we don't want to
16310
- // catch errors thrown by callback().
16311
- }, function(err) {
16312
-
16313
- return callback(err, err.warnings);
16314
- });
16315
- } else {
16316
-
16317
- return api.apply(this, arguments);
16318
- }
16319
- };
16320
- }
16321
-
16322
16258
 
16323
16259
  // TODO(nikku): remove with future bpmn-js version
16324
16260
 
@@ -17316,28 +17252,7 @@
17316
17252
  const self = this;
17317
17253
 
17318
17254
  function ParseCompleteEvent(data) {
17319
-
17320
- const event = self.get('eventBus').createEvent(data);
17321
-
17322
- // TODO(nikku): remove with future bpmn-js version
17323
- Object.defineProperty(event, 'context', {
17324
- enumerable: true,
17325
- get: function() {
17326
-
17327
- console.warn(new Error(
17328
- 'import.parse.complete <context> is deprecated ' +
17329
- 'and will be removed in future library versions'
17330
- ));
17331
-
17332
- return {
17333
- warnings: data.warnings,
17334
- references: data.references,
17335
- elementsById: data.elementsById
17336
- };
17337
- }
17338
- });
17339
-
17340
- return event;
17255
+ return self.get('eventBus').createEvent(data);
17341
17256
  }
17342
17257
 
17343
17258
  let aggregatedWarnings = [];
@@ -17415,8 +17330,6 @@
17415
17330
  }
17416
17331
  };
17417
17332
 
17418
- BaseViewer.prototype.importXML = wrapForCompatibility(BaseViewer.prototype.importXML);
17419
-
17420
17333
 
17421
17334
  /**
17422
17335
  * Import parsed definitions and render a BPMN 2.0 diagram.
@@ -17447,8 +17360,6 @@
17447
17360
  return { warnings: result.warnings };
17448
17361
  };
17449
17362
 
17450
- BaseViewer.prototype.importDefinitions = wrapForCompatibility(BaseViewer.prototype.importDefinitions);
17451
-
17452
17363
 
17453
17364
  /**
17454
17365
  * Open diagram of previously imported XML.
@@ -17510,8 +17421,6 @@
17510
17421
  return { warnings };
17511
17422
  };
17512
17423
 
17513
- BaseViewer.prototype.open = wrapForCompatibility(BaseViewer.prototype.open);
17514
-
17515
17424
  /**
17516
17425
  * Export the currently displayed BPMN 2.0 diagram as
17517
17426
  * a BPMN 2.0 XML document.
@@ -17586,8 +17495,6 @@
17586
17495
  return result;
17587
17496
  };
17588
17497
 
17589
- BaseViewer.prototype.saveXML = wrapForCompatibility(BaseViewer.prototype.saveXML);
17590
-
17591
17498
 
17592
17499
  /**
17593
17500
  * Export the currently displayed BPMN 2.0 diagram as
@@ -17655,40 +17562,6 @@
17655
17562
  return { svg };
17656
17563
  };
17657
17564
 
17658
- BaseViewer.prototype.saveSVG = wrapForCompatibility(BaseViewer.prototype.saveSVG);
17659
-
17660
- /**
17661
- * Get a named diagram service.
17662
- *
17663
- * @example
17664
- *
17665
- * const elementRegistry = viewer.get('elementRegistry');
17666
- * const startEventShape = elementRegistry.get('StartEvent_1');
17667
- *
17668
- * @param {string} name
17669
- *
17670
- * @return {Object} diagram service instance
17671
- *
17672
- * @method BaseViewer#get
17673
- */
17674
-
17675
- /**
17676
- * Invoke a function in the context of this viewer.
17677
- *
17678
- * @example
17679
- *
17680
- * viewer.invoke(function(elementRegistry) {
17681
- * const startEventShape = elementRegistry.get('StartEvent_1');
17682
- * });
17683
- *
17684
- * @param {Function} fn to be invoked
17685
- *
17686
- * @return {Object} the functions return value
17687
- *
17688
- * @method BaseViewer#invoke
17689
- */
17690
-
17691
-
17692
17565
  BaseViewer.prototype._setDefinitions = function(definitions) {
17693
17566
  this._definitions = definitions;
17694
17567
  };
@@ -38311,7 +38184,7 @@
38311
38184
  property = reference.property;
38312
38185
 
38313
38186
  if (key === descriptor.id) {
38314
- element[ property ] = businessObject;
38187
+ element.set(property, businessObject);
38315
38188
 
38316
38189
  array.push(descriptor.id);
38317
38190
  }
@@ -41519,7 +41392,8 @@
41519
41392
  assign$2(actions, {
41520
41393
  'append.text-annotation': appendAction(
41521
41394
  'bpmn:TextAnnotation',
41522
- 'bpmn-icon-text-annotation'
41395
+ 'bpmn-icon-text-annotation',
41396
+ translate('Append TextAnnotation')
41523
41397
  )
41524
41398
  });
41525
41399
  }
@@ -41535,7 +41409,8 @@
41535
41409
  assign$2(actions, {
41536
41410
  'append.text-annotation': appendAction(
41537
41411
  'bpmn:TextAnnotation',
41538
- 'bpmn-icon-text-annotation'
41412
+ 'bpmn-icon-text-annotation',
41413
+ translate('Append TextAnnotation')
41539
41414
  ),
41540
41415
 
41541
41416
  'connect': {
@@ -41586,7 +41461,11 @@
41586
41461
 
41587
41462
  if (is$6(businessObject, 'bpmn:Group')) {
41588
41463
  assign$2(actions, {
41589
- 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
41464
+ 'append.text-annotation': appendAction(
41465
+ 'bpmn:TextAnnotation',
41466
+ 'bpmn-icon-text-annotation',
41467
+ translate('Append TextAnnotation')
41468
+ )
41590
41469
  });
41591
41470
  }
41592
41471
 
@@ -46707,12 +46586,18 @@
46707
46586
  var sequenceFlows = [];
46708
46587
 
46709
46588
  if (is$6(source, 'bpmn:EventBasedGateway')) {
46710
- sequenceFlows = target.incoming.filter(isSequenceFlow);
46589
+ sequenceFlows = target.incoming
46590
+ .filter(flow =>
46591
+ flow !== connection &&
46592
+ isSequenceFlow(flow)
46593
+ );
46711
46594
  } else {
46712
- sequenceFlows = target.incoming.filter(function(connection) {
46713
- return isSequenceFlow(connection)
46714
- && is$6(connection.source, 'bpmn:EventBasedGateway');
46715
- });
46595
+ sequenceFlows = target.incoming
46596
+ .filter(flow =>
46597
+ flow !== connection &&
46598
+ isSequenceFlow(flow) &&
46599
+ is$6(flow.source, 'bpmn:EventBasedGateway')
46600
+ );
46716
46601
  }
46717
46602
 
46718
46603
  sequenceFlows.forEach(function(sequenceFlow) {
@@ -48736,51 +48621,6 @@
48736
48621
  };
48737
48622
  }
48738
48623
 
48739
- /**
48740
- * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
48741
- * @typedef {import('diagram-js/lib/features/tooltips/Tooltips').default} Tooltips
48742
- * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
48743
- */
48744
-
48745
- var COLLAB_ERR_MSG = 'flow elements must be children of pools/participants';
48746
-
48747
- /**
48748
- * @param {EventBus} eventBus
48749
- * @param {Tooltips} tooltips
48750
- * @param {Translate} translate
48751
- */
48752
- function ModelingFeedback(eventBus, tooltips, translate) {
48753
-
48754
- function showError(position, message, timeout) {
48755
- tooltips.add({
48756
- position: {
48757
- x: position.x + 5,
48758
- y: position.y + 5
48759
- },
48760
- type: 'error',
48761
- timeout: timeout || 2000,
48762
- html: '<div>' + message + '</div>'
48763
- });
48764
- }
48765
-
48766
- eventBus.on([ 'shape.move.rejected', 'create.rejected' ], function(event) {
48767
- var context = event.context,
48768
- shape = context.shape,
48769
- target = context.target;
48770
-
48771
- if (is$6(target, 'bpmn:Collaboration') && is$6(shape, 'bpmn:FlowNode')) {
48772
- showError(event, translate(COLLAB_ERR_MSG));
48773
- }
48774
- });
48775
-
48776
- }
48777
-
48778
- ModelingFeedback.$inject = [
48779
- 'eventBus',
48780
- 'tooltips',
48781
- 'translate'
48782
- ];
48783
-
48784
48624
  /**
48785
48625
  * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
48786
48626
  * @typedef {import('../Modeling').default} Modeling
@@ -50969,7 +50809,6 @@
50969
50809
  'labelBehavior',
50970
50810
  'layoutConnectionBehavior',
50971
50811
  'messageFlowBehavior',
50972
- 'modelingFeedback',
50973
50812
  'removeElementBehavior',
50974
50813
  'removeEmbeddedLabelBoundsBehavior',
50975
50814
  'removeParticipantBehavior',
@@ -51008,7 +50847,6 @@
51008
50847
  labelBehavior: [ 'type', LabelBehavior ],
51009
50848
  layoutConnectionBehavior: [ 'type', LayoutConnectionBehavior ],
51010
50849
  messageFlowBehavior: [ 'type', MessageFlowBehavior ],
51011
- modelingFeedback: [ 'type', ModelingFeedback ],
51012
50850
  removeElementBehavior: [ 'type', RemoveElementBehavior ],
51013
50851
  removeEmbeddedLabelBoundsBehavior: [ 'type', RemoveEmbeddedLabelBoundsBehavior ],
51014
50852
  removeParticipantBehavior: [ 'type', RemoveParticipantBehavior ],
@@ -54318,393 +54156,6 @@
54318
54156
  commandStack: [ 'type', CommandStack$1 ]
54319
54157
  };
54320
54158
 
54321
- /**
54322
- * @typedef {import('../../core/Canvas').default} Canvas
54323
- * @typedef {import('../../core/EventBus').default} EventBus
54324
- *
54325
- * @typedef {import('../../util/Types').RectTRBL} RectTRBL
54326
- *
54327
- * @typedef { {
54328
- * html: string | HTMLElement;
54329
- * position: RectTRBL;
54330
- * show?: {
54331
- * minZoom?: number;
54332
- * maxZoom?: number;
54333
- * };
54334
- * timeout?: number;
54335
- * } } Tooltip
54336
- */
54337
-
54338
- // document wide unique tooltip ids
54339
- var ids$1 = new IdGenerator('tt');
54340
-
54341
-
54342
- function createRoot(parentNode) {
54343
- var root = domify$1(
54344
- '<div class="djs-tooltip-container" />'
54345
- );
54346
-
54347
- assign$1(root, {
54348
- position: 'absolute',
54349
- width: '0',
54350
- height: '0'
54351
- });
54352
-
54353
- parentNode.insertBefore(root, parentNode.firstChild);
54354
-
54355
- return root;
54356
- }
54357
-
54358
-
54359
- function setPosition(el, x, y) {
54360
- assign$1(el, { left: x + 'px', top: y + 'px' });
54361
- }
54362
-
54363
- function setVisible(el, visible) {
54364
- el.style.display = visible === false ? 'none' : '';
54365
- }
54366
-
54367
-
54368
- var tooltipClass = 'djs-tooltip',
54369
- tooltipSelector = '.' + tooltipClass;
54370
-
54371
- /**
54372
- * A service that allows users to render tool tips on the diagram.
54373
- *
54374
- * The tooltip service will take care of updating the tooltip positioning
54375
- * during navigation + zooming.
54376
- *
54377
- * @example
54378
- *
54379
- * ```javascript
54380
- *
54381
- * // add a pink badge on the top left of the shape
54382
- * tooltips.add({
54383
- * position: {
54384
- * x: 50,
54385
- * y: 100
54386
- * },
54387
- * html: '<div style="width: 10px; background: fuchsia; color: white;">0</div>'
54388
- * });
54389
- *
54390
- * // or with optional life span
54391
- * tooltips.add({
54392
- * position: {
54393
- * top: -5,
54394
- * left: -5
54395
- * },
54396
- * html: '<div style="width: 10px; background: fuchsia; color: white;">0</div>',
54397
- * ttl: 2000
54398
- * });
54399
- *
54400
- * // remove a tool tip
54401
- * var id = tooltips.add(...);
54402
- *
54403
- * tooltips.remove(id);
54404
- * ```
54405
- *
54406
- * @param {EventBus} eventBus
54407
- * @param {Canvas} canvas
54408
- */
54409
- function Tooltips(eventBus, canvas) {
54410
-
54411
- this._eventBus = eventBus;
54412
- this._canvas = canvas;
54413
-
54414
- this._ids = ids$1;
54415
-
54416
- this._tooltipDefaults = {
54417
- show: {
54418
- minZoom: 0.7,
54419
- maxZoom: 5.0
54420
- }
54421
- };
54422
-
54423
- /**
54424
- * @type {Record<string, Tooltip>}
54425
- */
54426
- this._tooltips = {};
54427
-
54428
- // root html element for all tooltips
54429
- this._tooltipRoot = createRoot(canvas.getContainer());
54430
-
54431
-
54432
- var self = this;
54433
-
54434
- delegate.bind(this._tooltipRoot, tooltipSelector, 'mousedown', function(event) {
54435
- event.stopPropagation();
54436
- });
54437
-
54438
- delegate.bind(this._tooltipRoot, tooltipSelector, 'mouseover', function(event) {
54439
- self.trigger('mouseover', event);
54440
- });
54441
-
54442
- delegate.bind(this._tooltipRoot, tooltipSelector, 'mouseout', function(event) {
54443
- self.trigger('mouseout', event);
54444
- });
54445
-
54446
- this._init();
54447
- }
54448
-
54449
-
54450
- Tooltips.$inject = [ 'eventBus', 'canvas' ];
54451
-
54452
-
54453
- /**
54454
- * Adds an HTML tooltip to the diagram.
54455
- *
54456
- * @param {Tooltip} tooltip
54457
- *
54458
- * @return {string} ID of the tooltip.
54459
- */
54460
- Tooltips.prototype.add = function(tooltip) {
54461
-
54462
- if (!tooltip.position) {
54463
- throw new Error('must specifiy tooltip position');
54464
- }
54465
-
54466
- if (!tooltip.html) {
54467
- throw new Error('must specifiy tooltip html');
54468
- }
54469
-
54470
- var id = this._ids.next();
54471
-
54472
- tooltip = assign$2({}, this._tooltipDefaults, tooltip, {
54473
- id: id
54474
- });
54475
-
54476
- this._addTooltip(tooltip);
54477
-
54478
- if (tooltip.timeout) {
54479
- this.setTimeout(tooltip);
54480
- }
54481
-
54482
- return id;
54483
- };
54484
-
54485
- /**
54486
- * @param {string} action
54487
- * @param {Event} event
54488
- */
54489
- Tooltips.prototype.trigger = function(action, event) {
54490
-
54491
- var node = event.delegateTarget || event.target;
54492
-
54493
- var tooltip = this.get(attr$1(node, 'data-tooltip-id'));
54494
-
54495
- if (!tooltip) {
54496
- return;
54497
- }
54498
-
54499
- if (action === 'mouseover' && tooltip.timeout) {
54500
- this.clearTimeout(tooltip);
54501
- }
54502
-
54503
- if (action === 'mouseout' && tooltip.timeout) {
54504
-
54505
- // cut timeout after mouse out
54506
- tooltip.timeout = 1000;
54507
-
54508
- this.setTimeout(tooltip);
54509
- }
54510
- };
54511
-
54512
- /**
54513
- * Get tooltip with given ID.
54514
- *
54515
- * @param {Tooltip|string} id
54516
- *
54517
- * @return {Tooltip|undefined}
54518
- */
54519
- Tooltips.prototype.get = function(id) {
54520
-
54521
- if (typeof id !== 'string') {
54522
- id = id.id;
54523
- }
54524
-
54525
- return this._tooltips[id];
54526
- };
54527
-
54528
- /**
54529
- * @param {Tooltip} tooltip
54530
- */
54531
- Tooltips.prototype.clearTimeout = function(tooltip) {
54532
-
54533
- tooltip = this.get(tooltip);
54534
-
54535
- if (!tooltip) {
54536
- return;
54537
- }
54538
-
54539
- var removeTimer = tooltip.removeTimer;
54540
-
54541
- if (removeTimer) {
54542
- clearTimeout(removeTimer);
54543
- tooltip.removeTimer = null;
54544
- }
54545
- };
54546
-
54547
- /**
54548
- * @param {Tooltip} tooltip
54549
- */
54550
- Tooltips.prototype.setTimeout = function(tooltip) {
54551
-
54552
- tooltip = this.get(tooltip);
54553
-
54554
- if (!tooltip) {
54555
- return;
54556
- }
54557
-
54558
- this.clearTimeout(tooltip);
54559
-
54560
- var self = this;
54561
-
54562
- tooltip.removeTimer = setTimeout(function() {
54563
- self.remove(tooltip);
54564
- }, tooltip.timeout);
54565
- };
54566
-
54567
- /**
54568
- * Remove tooltip with given ID.
54569
- *
54570
- * @param {string | Tooltip} id
54571
- */
54572
- Tooltips.prototype.remove = function(id) {
54573
-
54574
- var tooltip = this.get(id);
54575
-
54576
- if (tooltip) {
54577
- remove$4(tooltip.html);
54578
- remove$4(tooltip.htmlContainer);
54579
-
54580
- delete tooltip.htmlContainer;
54581
-
54582
- delete this._tooltips[tooltip.id];
54583
- }
54584
- };
54585
-
54586
-
54587
- Tooltips.prototype.show = function() {
54588
- setVisible(this._tooltipRoot);
54589
- };
54590
-
54591
-
54592
- Tooltips.prototype.hide = function() {
54593
- setVisible(this._tooltipRoot, false);
54594
- };
54595
-
54596
-
54597
- Tooltips.prototype._updateRoot = function(viewbox) {
54598
- var a = viewbox.scale || 1;
54599
- var d = viewbox.scale || 1;
54600
-
54601
- var matrix = 'matrix(' + a + ',0,0,' + d + ',' + (-1 * viewbox.x * a) + ',' + (-1 * viewbox.y * d) + ')';
54602
-
54603
- this._tooltipRoot.style.transform = matrix;
54604
- this._tooltipRoot.style['-ms-transform'] = matrix;
54605
- };
54606
-
54607
-
54608
- Tooltips.prototype._addTooltip = function(tooltip) {
54609
-
54610
- var id = tooltip.id,
54611
- html = tooltip.html,
54612
- htmlContainer,
54613
- tooltipRoot = this._tooltipRoot;
54614
-
54615
- // unwrap jquery (for those who need it)
54616
- if (html.get && html.constructor.prototype.jquery) {
54617
- html = html.get(0);
54618
- }
54619
-
54620
- // create proper html elements from
54621
- // tooltip HTML strings
54622
- if (isString$2(html)) {
54623
- html = domify$1(html);
54624
- }
54625
-
54626
- htmlContainer = domify$1('<div data-tooltip-id="' + id + '" class="' + tooltipClass + '">');
54627
- assign$1(htmlContainer, { position: 'absolute' });
54628
-
54629
- htmlContainer.appendChild(html);
54630
-
54631
- if (tooltip.type) {
54632
- classes$1(htmlContainer).add('djs-tooltip-' + tooltip.type);
54633
- }
54634
-
54635
- if (tooltip.className) {
54636
- classes$1(htmlContainer).add(tooltip.className);
54637
- }
54638
-
54639
- tooltip.htmlContainer = htmlContainer;
54640
-
54641
- tooltipRoot.appendChild(htmlContainer);
54642
-
54643
- this._tooltips[id] = tooltip;
54644
-
54645
- this._updateTooltip(tooltip);
54646
- };
54647
-
54648
-
54649
- Tooltips.prototype._updateTooltip = function(tooltip) {
54650
-
54651
- var position = tooltip.position,
54652
- htmlContainer = tooltip.htmlContainer;
54653
-
54654
- // update overlay html based on tooltip x, y
54655
-
54656
- setPosition(htmlContainer, position.x, position.y);
54657
- };
54658
-
54659
-
54660
- Tooltips.prototype._updateTooltipVisibilty = function(viewbox) {
54661
-
54662
- forEach$2(this._tooltips, function(tooltip) {
54663
- var show = tooltip.show,
54664
- htmlContainer = tooltip.htmlContainer,
54665
- visible = true;
54666
-
54667
- if (show) {
54668
- if (show.minZoom > viewbox.scale ||
54669
- show.maxZoom < viewbox.scale) {
54670
- visible = false;
54671
- }
54672
-
54673
- setVisible(htmlContainer, visible);
54674
- }
54675
- });
54676
- };
54677
-
54678
- Tooltips.prototype._init = function() {
54679
-
54680
- var self = this;
54681
-
54682
- // scroll/zoom integration
54683
-
54684
- function updateViewbox(viewbox) {
54685
- self._updateRoot(viewbox);
54686
- self._updateTooltipVisibilty(viewbox);
54687
-
54688
- self.show();
54689
- }
54690
-
54691
- this._eventBus.on('canvas.viewbox.changing', function(event) {
54692
- self.hide();
54693
- });
54694
-
54695
- this._eventBus.on('canvas.viewbox.changed', function(event) {
54696
- updateViewbox(event.viewbox);
54697
- });
54698
- };
54699
-
54700
- /**
54701
- * @type { import('didi').ModuleDeclaration }
54702
- */
54703
- var TooltipsModule = {
54704
- __init__: [ 'tooltips' ],
54705
- tooltips: [ 'type', Tooltips ]
54706
- };
54707
-
54708
54159
  /**
54709
54160
  * Remove from the beginning of a collection until it is empty.
54710
54161
  *
@@ -62224,7 +61675,6 @@
62224
61675
  OrderingModule,
62225
61676
  ReplaceModule,
62226
61677
  CommandModule,
62227
- TooltipsModule,
62228
61678
  LabelSupportModule,
62229
61679
  AttachSupportModule,
62230
61680
  SelectionModule,
@@ -62239,6 +61689,448 @@
62239
61689
  connectionDocking: [ 'type', CroppingConnectionDocking ]
62240
61690
  };
62241
61691
 
61692
+ /**
61693
+ * @typedef {import('../../core/Canvas').default} Canvas
61694
+ * @typedef {import('../../core/EventBus').default} EventBus
61695
+ *
61696
+ * @typedef {import('../../util/Types').RectTRBL} RectTRBL
61697
+ *
61698
+ * @typedef { {
61699
+ * html: string | HTMLElement;
61700
+ * position: RectTRBL;
61701
+ * show?: {
61702
+ * minZoom?: number;
61703
+ * maxZoom?: number;
61704
+ * };
61705
+ * timeout?: number;
61706
+ * } } Tooltip
61707
+ */
61708
+
61709
+ // document wide unique tooltip ids
61710
+ var ids$1 = new IdGenerator('tt');
61711
+
61712
+
61713
+ function createRoot(parentNode) {
61714
+ var root = domify$1(
61715
+ '<div class="djs-tooltip-container" />'
61716
+ );
61717
+
61718
+ assign$1(root, {
61719
+ position: 'absolute',
61720
+ width: '0',
61721
+ height: '0'
61722
+ });
61723
+
61724
+ parentNode.insertBefore(root, parentNode.firstChild);
61725
+
61726
+ return root;
61727
+ }
61728
+
61729
+
61730
+ function setPosition(el, x, y) {
61731
+ assign$1(el, { left: x + 'px', top: y + 'px' });
61732
+ }
61733
+
61734
+ function setVisible(el, visible) {
61735
+ el.style.display = visible === false ? 'none' : '';
61736
+ }
61737
+
61738
+
61739
+ var tooltipClass = 'djs-tooltip',
61740
+ tooltipSelector = '.' + tooltipClass;
61741
+
61742
+ /**
61743
+ * A service that allows users to render tool tips on the diagram.
61744
+ *
61745
+ * The tooltip service will take care of updating the tooltip positioning
61746
+ * during navigation + zooming.
61747
+ *
61748
+ * @example
61749
+ *
61750
+ * ```javascript
61751
+ *
61752
+ * // add a pink badge on the top left of the shape
61753
+ * tooltips.add({
61754
+ * position: {
61755
+ * x: 50,
61756
+ * y: 100
61757
+ * },
61758
+ * html: '<div style="width: 10px; background: fuchsia; color: white;">0</div>'
61759
+ * });
61760
+ *
61761
+ * // or with optional life span
61762
+ * tooltips.add({
61763
+ * position: {
61764
+ * top: -5,
61765
+ * left: -5
61766
+ * },
61767
+ * html: '<div style="width: 10px; background: fuchsia; color: white;">0</div>',
61768
+ * ttl: 2000
61769
+ * });
61770
+ *
61771
+ * // remove a tool tip
61772
+ * var id = tooltips.add(...);
61773
+ *
61774
+ * tooltips.remove(id);
61775
+ * ```
61776
+ *
61777
+ * @param {EventBus} eventBus
61778
+ * @param {Canvas} canvas
61779
+ */
61780
+ function Tooltips(eventBus, canvas) {
61781
+
61782
+ this._eventBus = eventBus;
61783
+ this._canvas = canvas;
61784
+
61785
+ this._ids = ids$1;
61786
+
61787
+ this._tooltipDefaults = {
61788
+ show: {
61789
+ minZoom: 0.7,
61790
+ maxZoom: 5.0
61791
+ }
61792
+ };
61793
+
61794
+ /**
61795
+ * @type {Record<string, Tooltip>}
61796
+ */
61797
+ this._tooltips = {};
61798
+
61799
+ // root html element for all tooltips
61800
+ this._tooltipRoot = createRoot(canvas.getContainer());
61801
+
61802
+
61803
+ var self = this;
61804
+
61805
+ delegate.bind(this._tooltipRoot, tooltipSelector, 'mousedown', function(event) {
61806
+ event.stopPropagation();
61807
+ });
61808
+
61809
+ delegate.bind(this._tooltipRoot, tooltipSelector, 'mouseover', function(event) {
61810
+ self.trigger('mouseover', event);
61811
+ });
61812
+
61813
+ delegate.bind(this._tooltipRoot, tooltipSelector, 'mouseout', function(event) {
61814
+ self.trigger('mouseout', event);
61815
+ });
61816
+
61817
+ this._init();
61818
+ }
61819
+
61820
+
61821
+ Tooltips.$inject = [ 'eventBus', 'canvas' ];
61822
+
61823
+
61824
+ /**
61825
+ * Adds an HTML tooltip to the diagram.
61826
+ *
61827
+ * @param {Tooltip} tooltip
61828
+ *
61829
+ * @return {string} ID of the tooltip.
61830
+ */
61831
+ Tooltips.prototype.add = function(tooltip) {
61832
+
61833
+ if (!tooltip.position) {
61834
+ throw new Error('must specifiy tooltip position');
61835
+ }
61836
+
61837
+ if (!tooltip.html) {
61838
+ throw new Error('must specifiy tooltip html');
61839
+ }
61840
+
61841
+ var id = this._ids.next();
61842
+
61843
+ tooltip = assign$2({}, this._tooltipDefaults, tooltip, {
61844
+ id: id
61845
+ });
61846
+
61847
+ this._addTooltip(tooltip);
61848
+
61849
+ if (tooltip.timeout) {
61850
+ this.setTimeout(tooltip);
61851
+ }
61852
+
61853
+ return id;
61854
+ };
61855
+
61856
+ /**
61857
+ * @param {string} action
61858
+ * @param {Event} event
61859
+ */
61860
+ Tooltips.prototype.trigger = function(action, event) {
61861
+
61862
+ var node = event.delegateTarget || event.target;
61863
+
61864
+ var tooltip = this.get(attr$1(node, 'data-tooltip-id'));
61865
+
61866
+ if (!tooltip) {
61867
+ return;
61868
+ }
61869
+
61870
+ if (action === 'mouseover' && tooltip.timeout) {
61871
+ this.clearTimeout(tooltip);
61872
+ }
61873
+
61874
+ if (action === 'mouseout' && tooltip.timeout) {
61875
+
61876
+ // cut timeout after mouse out
61877
+ tooltip.timeout = 1000;
61878
+
61879
+ this.setTimeout(tooltip);
61880
+ }
61881
+ };
61882
+
61883
+ /**
61884
+ * Get tooltip with given ID.
61885
+ *
61886
+ * @param {Tooltip|string} id
61887
+ *
61888
+ * @return {Tooltip|undefined}
61889
+ */
61890
+ Tooltips.prototype.get = function(id) {
61891
+
61892
+ if (typeof id !== 'string') {
61893
+ id = id.id;
61894
+ }
61895
+
61896
+ return this._tooltips[id];
61897
+ };
61898
+
61899
+ /**
61900
+ * @param {Tooltip} tooltip
61901
+ */
61902
+ Tooltips.prototype.clearTimeout = function(tooltip) {
61903
+
61904
+ tooltip = this.get(tooltip);
61905
+
61906
+ if (!tooltip) {
61907
+ return;
61908
+ }
61909
+
61910
+ var removeTimer = tooltip.removeTimer;
61911
+
61912
+ if (removeTimer) {
61913
+ clearTimeout(removeTimer);
61914
+ tooltip.removeTimer = null;
61915
+ }
61916
+ };
61917
+
61918
+ /**
61919
+ * @param {Tooltip} tooltip
61920
+ */
61921
+ Tooltips.prototype.setTimeout = function(tooltip) {
61922
+
61923
+ tooltip = this.get(tooltip);
61924
+
61925
+ if (!tooltip) {
61926
+ return;
61927
+ }
61928
+
61929
+ this.clearTimeout(tooltip);
61930
+
61931
+ var self = this;
61932
+
61933
+ tooltip.removeTimer = setTimeout(function() {
61934
+ self.remove(tooltip);
61935
+ }, tooltip.timeout);
61936
+ };
61937
+
61938
+ /**
61939
+ * Remove tooltip with given ID.
61940
+ *
61941
+ * @param {string | Tooltip} id
61942
+ */
61943
+ Tooltips.prototype.remove = function(id) {
61944
+
61945
+ var tooltip = this.get(id);
61946
+
61947
+ if (tooltip) {
61948
+ remove$4(tooltip.html);
61949
+ remove$4(tooltip.htmlContainer);
61950
+
61951
+ delete tooltip.htmlContainer;
61952
+
61953
+ delete this._tooltips[tooltip.id];
61954
+ }
61955
+ };
61956
+
61957
+
61958
+ Tooltips.prototype.show = function() {
61959
+ setVisible(this._tooltipRoot);
61960
+ };
61961
+
61962
+
61963
+ Tooltips.prototype.hide = function() {
61964
+ setVisible(this._tooltipRoot, false);
61965
+ };
61966
+
61967
+
61968
+ Tooltips.prototype._updateRoot = function(viewbox) {
61969
+ var a = viewbox.scale || 1;
61970
+ var d = viewbox.scale || 1;
61971
+
61972
+ var matrix = 'matrix(' + a + ',0,0,' + d + ',' + (-1 * viewbox.x * a) + ',' + (-1 * viewbox.y * d) + ')';
61973
+
61974
+ this._tooltipRoot.style.transform = matrix;
61975
+ this._tooltipRoot.style['-ms-transform'] = matrix;
61976
+ };
61977
+
61978
+
61979
+ Tooltips.prototype._addTooltip = function(tooltip) {
61980
+
61981
+ var id = tooltip.id,
61982
+ html = tooltip.html,
61983
+ htmlContainer,
61984
+ tooltipRoot = this._tooltipRoot;
61985
+
61986
+ // unwrap jquery (for those who need it)
61987
+ if (html.get && html.constructor.prototype.jquery) {
61988
+ html = html.get(0);
61989
+ }
61990
+
61991
+ // create proper html elements from
61992
+ // tooltip HTML strings
61993
+ if (isString$2(html)) {
61994
+ html = domify$1(html);
61995
+ }
61996
+
61997
+ htmlContainer = domify$1('<div data-tooltip-id="' + id + '" class="' + tooltipClass + '">');
61998
+ assign$1(htmlContainer, { position: 'absolute' });
61999
+
62000
+ htmlContainer.appendChild(html);
62001
+
62002
+ if (tooltip.type) {
62003
+ classes$1(htmlContainer).add('djs-tooltip-' + tooltip.type);
62004
+ }
62005
+
62006
+ if (tooltip.className) {
62007
+ classes$1(htmlContainer).add(tooltip.className);
62008
+ }
62009
+
62010
+ tooltip.htmlContainer = htmlContainer;
62011
+
62012
+ tooltipRoot.appendChild(htmlContainer);
62013
+
62014
+ this._tooltips[id] = tooltip;
62015
+
62016
+ this._updateTooltip(tooltip);
62017
+ };
62018
+
62019
+
62020
+ Tooltips.prototype._updateTooltip = function(tooltip) {
62021
+
62022
+ var position = tooltip.position,
62023
+ htmlContainer = tooltip.htmlContainer;
62024
+
62025
+ // update overlay html based on tooltip x, y
62026
+
62027
+ setPosition(htmlContainer, position.x, position.y);
62028
+ };
62029
+
62030
+
62031
+ Tooltips.prototype._updateTooltipVisibilty = function(viewbox) {
62032
+
62033
+ forEach$2(this._tooltips, function(tooltip) {
62034
+ var show = tooltip.show,
62035
+ htmlContainer = tooltip.htmlContainer,
62036
+ visible = true;
62037
+
62038
+ if (show) {
62039
+ if (show.minZoom > viewbox.scale ||
62040
+ show.maxZoom < viewbox.scale) {
62041
+ visible = false;
62042
+ }
62043
+
62044
+ setVisible(htmlContainer, visible);
62045
+ }
62046
+ });
62047
+ };
62048
+
62049
+ Tooltips.prototype._init = function() {
62050
+
62051
+ var self = this;
62052
+
62053
+ // scroll/zoom integration
62054
+
62055
+ function updateViewbox(viewbox) {
62056
+ self._updateRoot(viewbox);
62057
+ self._updateTooltipVisibilty(viewbox);
62058
+
62059
+ self.show();
62060
+ }
62061
+
62062
+ this._eventBus.on('canvas.viewbox.changing', function(event) {
62063
+ self.hide();
62064
+ });
62065
+
62066
+ this._eventBus.on('canvas.viewbox.changed', function(event) {
62067
+ updateViewbox(event.viewbox);
62068
+ });
62069
+ };
62070
+
62071
+ /**
62072
+ * @type { import('didi').ModuleDeclaration }
62073
+ */
62074
+ var TooltipsModule = {
62075
+ __init__: [ 'tooltips' ],
62076
+ tooltips: [ 'type', Tooltips ]
62077
+ };
62078
+
62079
+ /**
62080
+ * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
62081
+ * @typedef {import('diagram-js/lib/features/tooltips/Tooltips').default} Tooltips
62082
+ * @typedef {import('diagram-js/lib/i18n/translate/translate').default} Translate
62083
+ */
62084
+
62085
+ var COLLAB_ERR_MSG = 'flow elements must be children of pools/participants';
62086
+
62087
+ /**
62088
+ * @param {EventBus} eventBus
62089
+ * @param {Tooltips} tooltips
62090
+ * @param {Translate} translate
62091
+ */
62092
+ function ModelingFeedback(eventBus, tooltips, translate) {
62093
+
62094
+ function showError(position, message, timeout) {
62095
+ tooltips.add({
62096
+ position: {
62097
+ x: position.x + 5,
62098
+ y: position.y + 5
62099
+ },
62100
+ type: 'error',
62101
+ timeout: timeout || 2000,
62102
+ html: '<div>' + message + '</div>'
62103
+ });
62104
+ }
62105
+
62106
+ eventBus.on([ 'shape.move.rejected', 'create.rejected' ], function(event) {
62107
+ var context = event.context,
62108
+ shape = context.shape,
62109
+ target = context.target;
62110
+
62111
+ if (is$6(target, 'bpmn:Collaboration') && is$6(shape, 'bpmn:FlowNode')) {
62112
+ showError(event, translate(COLLAB_ERR_MSG));
62113
+ }
62114
+ });
62115
+
62116
+ }
62117
+
62118
+ ModelingFeedback.$inject = [
62119
+ 'eventBus',
62120
+ 'tooltips',
62121
+ 'translate'
62122
+ ];
62123
+
62124
+ var ModelingFeedbackModule = {
62125
+ __depends__: [
62126
+ TooltipsModule
62127
+ ],
62128
+ __init__: [
62129
+ 'modelingFeedback'
62130
+ ],
62131
+ modelingFeedback: [ 'type', ModelingFeedback ]
62132
+ };
62133
+
62242
62134
  /**
62243
62135
  * @typedef {import('../../core/Types').ElementLike} Element
62244
62136
  * @typedef {import('../../core/Types').ShapeLike} Shape
@@ -66251,8 +66143,6 @@
66251
66143
  return this.importXML(initialDiagram);
66252
66144
  };
66253
66145
 
66254
- Modeler$2.prototype.createDiagram = wrapForCompatibility(Modeler$2.prototype.createDiagram);
66255
-
66256
66146
 
66257
66147
  Modeler$2.prototype._interactionModules = [
66258
66148
 
@@ -66284,6 +66174,7 @@
66284
66174
  KeyboardMoveSelectionModule,
66285
66175
  LabelEditingModule,
66286
66176
  ModelingModule,
66177
+ ModelingFeedbackModule,
66287
66178
  MoveModule,
66288
66179
  PaletteModule,
66289
66180
  ReplacePreviewModule,