bpmn-js 18.27.0 → 18.28.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v18.27.0
2
+ * bpmn-js - bpmn-modeler v18.28.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: 2026-08-31
11
+ * Date: 2026-09-04
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -26360,6 +26360,99 @@
26360
26360
  // default moddle extensions the viewer is composed of
26361
26361
  Viewer.prototype._moddleExtensions = {};
26362
26362
 
26363
+ var UPDATE_DEBOUNCE_INTERVAL = 300;
26364
+
26365
+ /**
26366
+ * Keeps the current selection visible when the canvas container is resized,
26367
+ * provided the selection was already visible before the resize. If the selection
26368
+ * was out of view, this is a no-op.
26369
+ *
26370
+ * @param {import('../../core/EventBus').default} eventBus
26371
+ * @param {import('../../core/Canvas').default} canvas
26372
+ * @param {import('../selection/Selection').default} selection
26373
+ */
26374
+ function KeepSelectionVisible(eventBus, canvas, selection) {
26375
+
26376
+ this._selectionWasVisible = false;
26377
+
26378
+ // canvas viewbox computation used to determine selection visibility
26379
+ // is a potentially expensive activity. Hence we debounce it to prevent
26380
+ // unnecessary computation. The side-effect is that this happens outside
26381
+ // of the current update cycle - a good thing.
26382
+ const updateSelectionVisible = debounce(() => {
26383
+ this._selectionWasVisible = isSelectionVisible();
26384
+ }, UPDATE_DEBOUNCE_INTERVAL);
26385
+
26386
+ eventBus.on('canvas.viewbox.changed', updateSelectionVisible);
26387
+ eventBus.on('selection.changed', updateSelectionVisible);
26388
+
26389
+ // a pending update would compute the viewbox of a torn down canvas
26390
+ eventBus.on('diagram.destroy', () => {
26391
+ updateSelectionVisible.cancel();
26392
+ });
26393
+
26394
+ eventBus.on('canvas.resized', () => {
26395
+ var selected = selection.get();
26396
+
26397
+ if (!selected.length) {
26398
+ return;
26399
+ }
26400
+
26401
+ if (!this._selectionWasVisible) {
26402
+ return;
26403
+ }
26404
+
26405
+ if (isSelectionVisible()) {
26406
+ return;
26407
+ }
26408
+
26409
+ var currentRoot = canvas.getRootElement();
26410
+
26411
+ // we ensure that selection scrolling always happens on the current root
26412
+ // (no root switch happens)
26413
+ canvas.scrollToElement(selected.concat(currentRoot));
26414
+ });
26415
+
26416
+ function isSelectionVisible() {
26417
+ var selected = selection.get();
26418
+
26419
+ if (!selected.length) {
26420
+ return false;
26421
+ }
26422
+
26423
+ var selectionBBox = getBBox(selected);
26424
+ var viewbox = canvas.viewbox();
26425
+
26426
+ var elementTrbl = asTRBL(selectionBBox);
26427
+ var viewboxTrbl = asTRBL(viewbox);
26428
+
26429
+ return elementTrbl.left >= viewboxTrbl.left &&
26430
+ elementTrbl.right <= viewboxTrbl.right &&
26431
+ elementTrbl.top >= viewboxTrbl.top &&
26432
+ elementTrbl.bottom <= viewboxTrbl.bottom;
26433
+ }
26434
+
26435
+ // @ts-ignore - test helper - flush internal state
26436
+ this._flush = updateSelectionVisible.flush;
26437
+ }
26438
+
26439
+ KeepSelectionVisible.$inject = [
26440
+ 'eventBus',
26441
+ 'canvas',
26442
+ 'selection'
26443
+ ];
26444
+
26445
+ /**
26446
+ * @type { import('didi').ModuleDeclaration }
26447
+ */
26448
+ var KeepSelectionVisibleModule = {
26449
+ __init__: [ 'keepSelectionVisible' ],
26450
+ __depends__: [
26451
+ SelectionModule
26452
+ ],
26453
+ keepSelectionVisible: [ 'type', KeepSelectionVisible ]
26454
+ };
26455
+
26363
26456
  var KEYS_COPY = [ 'c', 'C' ];
26364
26457
  var KEYS_PASTE = [ 'v', 'V' ];
26365
26458
  var KEYS_DUPLICATE = [ 'd', 'D' ];
@@ -27506,6 +27599,7 @@
27506
27599
 
27507
27600
 
27508
27601
  NavigatedViewer.prototype._navigationModules = [
27602
+ KeepSelectionVisibleModule,
27509
27603
  KeyboardMoveModule,
27510
27604
  MoveCanvasModule,
27511
27605
  ZoomScrollModule
@@ -36622,6 +36716,11 @@
36622
36716
  return;
36623
36717
  }
36624
36718
 
36719
+ // group labels are expected to overlap their group
36720
+ if (is(element, 'bpmn:Group')) {
36721
+ return;
36722
+ }
36723
+
36625
36724
  var optimalPosition = getOptimalPosition(element);
36626
36725
 
36627
36726
  // no optimal position found
@@ -69945,6 +70044,7 @@
69945
70044
  Modeler.prototype._interactionModules = [
69946
70045
 
69947
70046
  // non-modeling components
70047
+ KeepSelectionVisibleModule,
69948
70048
  KeyboardMoveModule,
69949
70049
  MoveCanvasModule,
69950
70050
  ZoomScrollModule