bpmn-js 18.30.0 → 18.31.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.
@@ -1019,11 +1019,10 @@
1019
1019
 
1020
1020
  /**
1021
1021
  * The footer holds the keyboard/assistive-technology reachable documentation
1022
- * link. Mouse users get the per-entry `.djs-popup-entry-docs` affordance on
1023
- * hover instead, so the (redundant) footer link is hidden while the results
1024
- * list is hovered and shown during keyboard navigation.
1022
+ * link. Pointer interaction switches the popup to the per-entry
1023
+ * `.djs-popup-entry-docs` affordance instead.
1025
1024
  */
1026
- .djs-popup-results:hover ~ .djs-popup-footer {
1025
+ .djs-popup--pointer .djs-popup-footer {
1027
1026
  display: none;
1028
1027
  }
1029
1028
 
@@ -1042,7 +1041,7 @@
1042
1041
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
1043
1042
  }
1044
1043
 
1045
- .djs-popup-body .entry:hover .djs-popup-entry-docs {
1044
+ .djs-popup--pointer .djs-popup-body .entry:hover .djs-popup-entry-docs {
1046
1045
  visibility: visible;
1047
1046
  }
1048
1047
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v18.30.0
2
+ * bpmn-js - bpmn-modeler v18.31.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-09-23
11
+ * Date: 2026-10-01
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -8411,7 +8411,7 @@
8411
8411
  function prependTo(newNode, parentNode, siblingNode) {
8412
8412
  var node = siblingNode || parentNode.firstChild;
8413
8413
 
8414
- // do not prepend node to itself to prevent IE from crashing
8414
+ // do not prepend node to itself
8415
8415
  // https://github.com/bpmn-io/bpmn-js/issues/746
8416
8416
  if (newNode === node) {
8417
8417
  return;
@@ -22144,7 +22144,7 @@
22144
22144
  textBBox.width = fitLine ? textBBox.width : 0;
22145
22145
 
22146
22146
  // try to fit
22147
- if (fitLine === ' ' || fitLine === '' || textBBox.width < Math.round(maxWidth) || fitLine.length < 2) {
22147
+ if (fitLine === ' ' || fitLine === '' || textBBox.width <= maxWidth || fitLine.length < 2) {
22148
22148
  return fit(lines, fitLine, originalLine, textBBox);
22149
22149
  }
22150
22150
 
@@ -26538,6 +26538,13 @@
26538
26538
  /**
26539
26539
  * Checks if key pressed is one of provided keys.
26540
26540
  *
26541
+ * Keys are matched against the logical key (`KeyboardEvent#key`) first,
26542
+ * respecting Latin keyboard layouts such as QWERTZ or AZERTY.
26543
+ *
26544
+ * If a non-Latin layout (e.g. Cyrillic, Arabic) is active, letter keys
26545
+ * are matched by their physical location (`KeyboardEvent#code`), assuming
26546
+ * a US (QWERTY) layout. This applies to shortcuts with and without modifiers.
26547
+ *
26541
26548
  * @param {string|string[]} keys
26542
26549
  * @param {KeyboardEvent} event
26543
26550
  * @return {boolean}
@@ -26545,7 +26552,51 @@
26545
26552
  function isKey(keys, event) {
26546
26553
  keys = isArray$2(keys) ? keys : [ keys ];
26547
26554
 
26548
- return keys.indexOf(event.key) !== -1 || keys.indexOf(event.code) !== -1;
26555
+ return (
26556
+ keys.indexOf(event.key) !== -1 ||
26557
+ keys.indexOf(event.code) !== -1 ||
26558
+ keys.indexOf(getPhysicalLetter(event)) !== -1
26559
+ );
26560
+ }
26561
+
26562
+ // letters of a specific, non-Latin script; excludes letters shared with Latin
26563
+ // orthographies, e.g. U+02BC (ʼ) or U+02BB (ʻ)
26564
+ var NON_LATIN_LETTER = /^(?!\p{Script_Extensions=Latin}|\p{Script=Common})\p{Letter}$/u;
26565
+
26566
+ var NON_LETTER = /^\P{Letter}$/u;
26567
+
26568
+ /**
26569
+ * Returns the (US layout) letter of the physical key pressed,
26570
+ * if the logical key is a non-Latin letter.
26571
+ *
26572
+ * With <Shift>, some non-Latin layouts (e.g. Arabic) produce symbols on letter
26573
+ * keys. As a symbol does not reveal the layout, we additionally require the
26574
+ * legacy `KeyboardEvent#keyCode` to agree: the operating system maps it to the
26575
+ * US letter on non-Latin layouts only, but not on Latin ones (e.g. Dvorak).
26576
+ *
26577
+ * @param {KeyboardEvent} event
26578
+ *
26579
+ * @return {string|null}
26580
+ */
26581
+ function getPhysicalLetter(event) {
26582
+ var key = event.key,
26583
+ match = /^Key([A-Z])$/.exec(event.code || '');
26584
+
26585
+ if (!match || typeof key !== 'string') {
26586
+ return null;
26587
+ }
26588
+
26589
+ var letter = match[1];
26590
+
26591
+ if (NON_LATIN_LETTER.test(key)) {
26592
+ return event.shiftKey ? letter : letter.toLowerCase();
26593
+ }
26594
+
26595
+ if (event.shiftKey && NON_LETTER.test(key) && event.keyCode === letter.charCodeAt(0)) {
26596
+ return letter;
26597
+ }
26598
+
26599
+ return null;
26549
26600
  }
26550
26601
 
26551
26602
  /**
@@ -26943,7 +26994,7 @@
26943
26994
 
26944
26995
  // quirk: it has to be triggered by `=` as well to work on international keyboard layout
26945
26996
  // cf: https://github.com/bpmn-io/bpmn-js/issues/1362#issuecomment-722989754
26946
- if (isKey([ '+', 'Add', '=' ], event) && isCmd(event)) {
26997
+ if (isKey([ '+', '=' ], event) && isCmd(event)) {
26947
26998
  editorActions.trigger('stepZoom', { value: 1 });
26948
26999
 
26949
27000
  return true;
@@ -26956,7 +27007,7 @@
26956
27007
 
26957
27008
  var event = context.keyEvent;
26958
27009
 
26959
- if (isKey([ '-', 'Subtract' ], event) && isCmd(event)) {
27010
+ if (isKey('-', event) && isCmd(event)) {
26960
27011
  editorActions.trigger('stepZoom', { value: -1 });
26961
27012
 
26962
27013
  return true;
@@ -26982,7 +27033,7 @@
26982
27033
 
26983
27034
  var event = context.keyEvent;
26984
27035
 
26985
- if (isKey([ 'Backspace', 'Delete', 'Del' ], event)) {
27036
+ if (isKey([ 'Backspace', 'Delete' ], event)) {
26986
27037
  editorActions.trigger('removeSelection');
26987
27038
 
26988
27039
  return true;
@@ -27042,10 +27093,10 @@
27042
27093
  }
27043
27094
 
27044
27095
  if (keyboard.isKey([
27045
- 'ArrowLeft', 'Left',
27046
- 'ArrowUp', 'Up',
27047
- 'ArrowDown', 'Down',
27048
- 'ArrowRight', 'Right'
27096
+ 'ArrowLeft',
27097
+ 'ArrowUp',
27098
+ 'ArrowDown',
27099
+ 'ArrowRight'
27049
27100
  ], event)) {
27050
27101
 
27051
27102
  var speed = (
@@ -27058,19 +27109,15 @@
27058
27109
 
27059
27110
  switch (event.key) {
27060
27111
  case 'ArrowLeft':
27061
- case 'Left':
27062
27112
  direction = 'left';
27063
27113
  break;
27064
27114
  case 'ArrowUp':
27065
- case 'Up':
27066
27115
  direction = 'up';
27067
27116
  break;
27068
27117
  case 'ArrowRight':
27069
- case 'Right':
27070
27118
  direction = 'right';
27071
27119
  break;
27072
27120
  case 'ArrowDown':
27073
- case 'Down':
27074
27121
  direction = 'down';
27075
27122
  break;
27076
27123
  }
@@ -27249,6 +27296,12 @@
27249
27296
  }
27250
27297
  });
27251
27298
 
27299
+ eventBus.on('diagram.destroy', function() {
27300
+ if (context) {
27301
+ handleEnd();
27302
+ }
27303
+ });
27304
+
27252
27305
 
27253
27306
  function handleMove(event) {
27254
27307
 
@@ -28935,6 +28988,7 @@
28935
28988
  * @param {PopupMenuEntry} props.entry
28936
28989
  * @param {boolean} props.selected
28937
28990
  * @param {(event: MouseEvent) => void} props.onMouseEnter
28991
+ * @param {(event: MouseEvent) => void} props.onMouseMove
28938
28992
  * @param {(event: MouseEvent) => void} props.onMouseLeave
28939
28993
  * @param {(event: MouseEvent, entry?: PopupMenuEntry, action?: string) => void} props.onAction
28940
28994
  */
@@ -28944,6 +28998,7 @@
28944
28998
  entry,
28945
28999
  selected,
28946
29000
  onMouseEnter,
29001
+ onMouseMove,
28947
29002
  onMouseLeave,
28948
29003
  onAction
28949
29004
  } = props;
@@ -28970,6 +29025,7 @@
28970
29025
  aria-disabled=${ entry.disabled || undefined }
28971
29026
  onClick=${ handleClick }
28972
29027
  onMouseEnter=${ onMouseEnter }
29028
+ onMouseMove=${ onMouseMove }
28973
29029
  onMouseLeave=${ onMouseLeave }
28974
29030
  onDragStart=${ (event) => draggable && handleClick(event, 'dragstart') }
28975
29031
  draggable=${ draggable }
@@ -29039,6 +29095,7 @@
29039
29095
  * @param {PopupMenuEntry} props.selectedEntry
29040
29096
  * @param {(entry: PopupMenuEntry | null) => void} props.setSelectedEntry
29041
29097
  * @param {import('@bpmn-io/diagram-js-ui').Ref<boolean>} props.keyboardSelection
29098
+ * @param {() => void} props.onPointerInteraction
29042
29099
  * @param {string} props.idPrefix
29043
29100
  * @param {string} props.id
29044
29101
  * @param {string} [props.ariaLabel]
@@ -29051,6 +29108,7 @@
29051
29108
  setSelectedEntry,
29052
29109
  groupedEntries,
29053
29110
  keyboardSelection,
29111
+ onPointerInteraction,
29054
29112
  idPrefix,
29055
29113
  id,
29056
29114
  ariaLabel,
@@ -29081,6 +29139,13 @@
29081
29139
 
29082
29140
  const handleMouseMove = () => {
29083
29141
  keyboardSelection.current = false;
29142
+ onPointerInteraction();
29143
+ };
29144
+
29145
+ const handleEntryMouseMove = (entry) => {
29146
+ if (entry !== selectedEntry) {
29147
+ setSelectedEntry(entry);
29148
+ }
29084
29149
  };
29085
29150
 
29086
29151
  const handleEntryMouseEnter = (entry) => {
@@ -29132,6 +29197,7 @@
29132
29197
  entry=${ entry }
29133
29198
  selected=${ entry === selectedEntry }
29134
29199
  onMouseEnter=${ () => handleEntryMouseEnter(entry) }
29200
+ onMouseMove=${ () => handleEntryMouseMove(entry) }
29135
29201
  onMouseLeave=${ handleEntryMouseLeave }
29136
29202
  ...${ restProps }
29137
29203
  />
@@ -29457,6 +29523,16 @@
29457
29523
  */
29458
29524
  const keyboardSelection = A(false);
29459
29525
 
29526
+ const [ interactionMode, setInteractionMode ] = d('keyboard');
29527
+
29528
+ const handleKeyboardInteraction = q(() => {
29529
+ setInteractionMode('keyboard');
29530
+ }, []);
29531
+
29532
+ const handlePointerInteraction = q(() => {
29533
+ setInteractionMode('pointer');
29534
+ }, []);
29535
+
29460
29536
  // per instance basis to generate field IDs
29461
29537
  const idPrefix = T(() => ids$1.next(), []);
29462
29538
 
@@ -29677,6 +29753,8 @@
29677
29753
  width=${ width }
29678
29754
  scale=${ scale }
29679
29755
  navigationStack=${ navigationStack }
29756
+ interactionMode=${ interactionMode }
29757
+ onKeyboardInteraction=${ handleKeyboardInteraction }
29680
29758
  >
29681
29759
  ${ displayHeader && m$1`
29682
29760
  <${PopupMenuHeader}
@@ -29762,6 +29840,7 @@
29762
29840
  selectedEntry=${ selectedEntry }
29763
29841
  setSelectedEntry=${ setSelectedEntry }
29764
29842
  keyboardSelection=${ keyboardSelection }
29843
+ onPointerInteraction=${ handlePointerInteraction }
29765
29844
  onAction=${ handleEntryAction }
29766
29845
  idPrefix=${ idPrefix }
29767
29846
  id=${ resultsId }
@@ -29819,9 +29898,11 @@
29819
29898
  onClose,
29820
29899
  onKeydown,
29821
29900
  onKeyup,
29901
+ onKeyboardInteraction,
29822
29902
  className,
29823
29903
  children,
29824
29904
  navigationStack,
29905
+ interactionMode,
29825
29906
  position: positionGetter
29826
29907
  } = props;
29827
29908
 
@@ -29889,10 +29970,15 @@
29889
29970
  };
29890
29971
  }, []);
29891
29972
 
29973
+ const popupClassName = clsx('djs-popup', className, {
29974
+ 'djs-popup--pointer': interactionMode === 'pointer'
29975
+ });
29976
+
29892
29977
  return m$1`
29893
29978
  <div
29894
- class=${ clsx('djs-popup', className) }
29979
+ class=${ popupClassName }
29895
29980
  style=${ getPopupStyle(props) }
29981
+ onKeydownCapture=${ onKeyboardInteraction }
29896
29982
  onKeydown=${ onKeydown }
29897
29983
  onKeyup=${ onKeyup }
29898
29984
  ref=${ popupRef }
@@ -50824,6 +50910,33 @@
50824
50910
  di.set('label', undefined);
50825
50911
  }
50826
50912
  }
50913
+
50914
+ // remove BPMNLabel on external label removal
50915
+ this.executed('shape.delete', ifBpmn(function(event) {
50916
+ const context = event.context,
50917
+ labelTarget = context.labelTarget,
50918
+ di = labelTarget && getDi(labelTarget),
50919
+ diLabel = di && di.get('label');
50920
+
50921
+ if (!diLabel) {
50922
+ return;
50923
+ }
50924
+
50925
+ context.oldDiLabel = diLabel;
50926
+
50927
+ di.set('label', undefined);
50928
+ }));
50929
+
50930
+ this.reverted('shape.delete', ifBpmn(function(event) {
50931
+ const {
50932
+ labelTarget,
50933
+ oldDiLabel
50934
+ } = event.context;
50935
+
50936
+ if (oldDiLabel) {
50937
+ getDi(labelTarget).set('label', oldDiLabel);
50938
+ }
50939
+ }));
50827
50940
  }
50828
50941
 
50829
50942
  e$3(BpmnUpdater, CommandInterceptor);
@@ -58147,6 +58260,67 @@
58147
58260
  appendPreview: [ 'type', AppendPreview ]
58148
58261
  };
58149
58262
 
58263
+ /**
58264
+ * @typedef { {
58265
+ * x: number;
58266
+ * y: number;
58267
+ * width?: number;
58268
+ * height?: number;
58269
+ * maxWidth?: number;
58270
+ * maxHeight?: number;
58271
+ * minWidth?: number;
58272
+ * minHeight?: number;
58273
+ * } } TextBoxBounds
58274
+ *
58275
+ * @typedef { {
58276
+ * width?: string | number;
58277
+ * height?: string | number;
58278
+ * maxWidth?: string | number;
58279
+ * maxHeight?: string | number;
58280
+ * minWidth?: string | number;
58281
+ * minHeight?: string | number;
58282
+ * left?: string | number;
58283
+ * top?: string | number;
58284
+ * backgroundColor?: string | null;
58285
+ * position?: string;
58286
+ * overflow?: string;
58287
+ * border?: string | null;
58288
+ * wordWrap?: string;
58289
+ * textAlign?: string;
58290
+ * outline?: string;
58291
+ * transform?: string | null;
58292
+ * fontFamily?: string;
58293
+ * fontSize?: string | number;
58294
+ * fontWeight?: string | number;
58295
+ * lineHeight?: string | number;
58296
+ * padding?: string | number;
58297
+ * paddingTop?: string | number;
58298
+ * paddingRight?: string | number;
58299
+ * paddingBottom?: string | number;
58300
+ * paddingLeft?: string | number;
58301
+ * } } TextBoxStyle
58302
+ *
58303
+ * @typedef { {
58304
+ * autoResize?: boolean;
58305
+ * resizable?: boolean;
58306
+ * centerVertically?: boolean;
58307
+ * } } TextBoxOptions
58308
+ *
58309
+ * @typedef { {
58310
+ * width: number;
58311
+ * height: number;
58312
+ * dx: number;
58313
+ * dy: number;
58314
+ * } } TextBoxResizeEvent
58315
+ *
58316
+ * @typedef { {
58317
+ * container: HTMLElement;
58318
+ * keyHandler?: (event: KeyboardEvent) => void;
58319
+ * resizeHandler?: (event: TextBoxResizeEvent) => void;
58320
+ * focusoutHandler?: (event: FocusEvent) => void;
58321
+ * } } TextBoxConfig
58322
+ */
58323
+
58150
58324
  var min = Math.min,
58151
58325
  max = Math.max;
58152
58326
 
@@ -58176,11 +58350,7 @@
58176
58350
  * content
58177
58351
  * resize-handle
58178
58352
  *
58179
- * @param {object} options
58180
- * @param {DOMElement} options.container The DOM element to append the contentContainer to
58181
- * @param {Function} options.keyHandler Handler for key events
58182
- * @param {Function} options.resizeHandler Handler for resize events
58183
- * @param {Function} [options.focusoutHandler] Handler for focusout events
58353
+ * @param {TextBoxConfig} options
58184
58354
  */
58185
58355
  function TextBox(options) {
58186
58356
  this.container = options.container;
@@ -58191,7 +58361,10 @@
58191
58361
  '</div>'
58192
58362
  );
58193
58363
 
58194
- this.content = query('[contenteditable]', this.parent);
58364
+ /**
58365
+ * @type {HTMLElement}
58366
+ */
58367
+ this.content = /** @type {HTMLElement} */ (query('[contenteditable]', this.parent));
58195
58368
 
58196
58369
  this.keyHandler = options.keyHandler || function() {};
58197
58370
  this.resizeHandler = options.resizeHandler || function() {};
@@ -58205,19 +58378,12 @@
58205
58378
  /**
58206
58379
  * Create a text box with the given position, size, style and text content
58207
58380
  *
58208
- * @param {Object} bounds
58209
- * @param {Number} bounds.x absolute x position
58210
- * @param {Number} bounds.y absolute y position
58211
- * @param {Number} [bounds.width] fixed width value
58212
- * @param {Number} [bounds.height] fixed height value
58213
- * @param {Number} [bounds.maxWidth] maximum width value
58214
- * @param {Number} [bounds.maxHeight] maximum height value
58215
- * @param {Number} [bounds.minWidth] minimum width value
58216
- * @param {Number} [bounds.minHeight] minimum height value
58217
- * @param {Object} [style]
58218
- * @param {String} value text content
58381
+ * @param {TextBoxBounds} bounds
58382
+ * @param {TextBoxStyle|undefined} style
58383
+ * @param {string} value text content
58384
+ * @param {TextBoxOptions} [options]
58219
58385
  *
58220
- * @return {DOMElement} The created content DOM element
58386
+ * @return {HTMLElement} The created parent DOM element
58221
58387
  */
58222
58388
  TextBox.prototype.create = function(bounds, style, value, options) {
58223
58389
  var self = this;
@@ -58320,6 +58486,8 @@
58320
58486
 
58321
58487
  /**
58322
58488
  * Intercept paste events to remove formatting from pasted text.
58489
+ *
58490
+ * @param {ClipboardEvent} e
58323
58491
  */
58324
58492
  TextBox.prototype.handlePaste = function(e) {
58325
58493
  var options = this.options,
@@ -58350,6 +58518,9 @@
58350
58518
  }
58351
58519
  };
58352
58520
 
58521
+ /**
58522
+ * @param {string} text
58523
+ */
58353
58524
  TextBox.prototype.insertText = function(text) {
58354
58525
  text = normalizeEndOfLineSequences(text);
58355
58526
 
@@ -58565,11 +58736,17 @@
58565
58736
  };
58566
58737
 
58567
58738
 
58739
+ /**
58740
+ * @return {string}
58741
+ */
58568
58742
  TextBox.prototype.getValue = function() {
58569
58743
  return this.content.innerText.trim();
58570
58744
  };
58571
58745
 
58572
58746
 
58747
+ /**
58748
+ * @return {Range}
58749
+ */
58573
58750
  TextBox.prototype.getSelection = function() {
58574
58751
  var selection = window.getSelection(),
58575
58752
  range = selection.getRangeAt(0);
@@ -58578,6 +58755,10 @@
58578
58755
  };
58579
58756
 
58580
58757
 
58758
+ /**
58759
+ * @param {Node|null} container
58760
+ * @param {number} [offset]
58761
+ */
58581
58762
  TextBox.prototype.setSelection = function(container, offset) {
58582
58763
  var range = document.createRange();
58583
58764
 
@@ -58600,19 +58781,71 @@
58600
58781
  return string.replace(/\r\n|\r|\n/g, '\n');
58601
58782
  }
58602
58783
 
58784
+ /**
58785
+ * @typedef {import('diagram-js/lib/core/Canvas.js').default} Canvas
58786
+ * @typedef {import('diagram-js/lib/core/EventBus.js').default} EventBus
58787
+ *
58788
+ * @typedef {import('diagram-js/lib/model/Types.js').Element} Element
58789
+ *
58790
+ * @typedef {import('diagram-js/lib/util/Types.js').Rect} Rect
58791
+ *
58792
+ * @typedef {import('./TextBox.js').TextBoxBounds} TextBoxBounds
58793
+ * @typedef {import('./TextBox.js').TextBoxStyle} TextBoxStyle
58794
+ * @typedef {import('./TextBox.js').TextBoxOptions} TextBoxOptions
58795
+ * @typedef {import('./TextBox.js').TextBoxResizeEvent} TextBoxResizeEvent
58796
+ */
58797
+
58798
+ /**
58799
+ * The context returned by a {@link DirectEditingProvider} to activate
58800
+ * direct editing for an element.
58801
+ *
58802
+ * @typedef { {
58803
+ * bounds: TextBoxBounds;
58804
+ * text: string;
58805
+ * style?: TextBoxStyle;
58806
+ * options?: TextBoxOptions;
58807
+ * } } DirectEditingContext
58808
+ */
58809
+
58810
+ /**
58811
+ * A provider that enables direct editing for elements.
58812
+ *
58813
+ * @typedef { {
58814
+ * activate: (element: Element) => DirectEditingContext | null | undefined;
58815
+ * update: (element: Element, newText: string, previousText: string, bounds: Rect) => void;
58816
+ * } } DirectEditingProvider
58817
+ */
58818
+
58819
+ /**
58820
+ * @typedef { {
58821
+ * element: Element;
58822
+ * context: DirectEditingContext;
58823
+ * provider: DirectEditingProvider;
58824
+ * } } DirectEditingActive
58825
+ */
58826
+
58603
58827
  /**
58604
58828
  * A direct editing component that allows users
58605
58829
  * to edit an elements text directly in the diagram
58606
58830
  *
58607
- * @param {EventBus} eventBus the event bus
58608
- * @param {Canvas} canvas the canvas
58831
+ * @param {EventBus} eventBus
58832
+ * @param {Canvas} canvas
58609
58833
  */
58610
58834
  function DirectEditing(eventBus, canvas) {
58611
58835
 
58612
58836
  this._eventBus = eventBus;
58613
58837
  this._canvas = canvas;
58614
58838
 
58839
+ /**
58840
+ * @type {DirectEditingProvider[]}
58841
+ */
58615
58842
  this._providers = [];
58843
+
58844
+ /**
58845
+ * @type {DirectEditingActive | null}
58846
+ */
58847
+ this._active = null;
58848
+
58616
58849
  this._textbox = new TextBox({
58617
58850
  container: canvas.getContainer(),
58618
58851
  keyHandler: bind$1(this._handleKey, this),
@@ -58627,13 +58860,17 @@
58627
58860
 
58628
58861
 
58629
58862
  /**
58630
- * Register a direct editing provider
58631
-
58632
- * @param {Object} provider the provider, must expose an #activate(element) method that returns
58633
- * an activation context ({ bounds: {x, y, width, height }, text }) if
58634
- * direct editing is available for the given element.
58635
- * Additionally the provider must expose a #update(element, value) method
58636
- * to receive direct editing updates.
58863
+ * Register a direct editing provider.
58864
+ *
58865
+ * A provider must expose an `#activate(element)` method that returns
58866
+ * an activation context (`{ bounds: { x, y, width, height }, text }`) if
58867
+ * direct editing is available for the given element.
58868
+ *
58869
+ * Additionally the provider must expose an
58870
+ * `#update(element, newText, previousText, bounds)` method to receive
58871
+ * direct editing updates.
58872
+ *
58873
+ * @param {DirectEditingProvider} provider
58637
58874
  */
58638
58875
  DirectEditing.prototype.registerProvider = function(provider) {
58639
58876
  this._providers.push(provider);
@@ -58643,7 +58880,7 @@
58643
58880
  /**
58644
58881
  * Returns true if direct editing is currently active
58645
58882
  *
58646
- * @param {djs.model.Base} [element]
58883
+ * @param {Element} [element]
58647
58884
  *
58648
58885
  * @return {boolean}
58649
58886
  */
@@ -58665,10 +58902,17 @@
58665
58902
  };
58666
58903
 
58667
58904
 
58905
+ /**
58906
+ * @param {string} event
58907
+ * @param {Object} [context]
58908
+ */
58668
58909
  DirectEditing.prototype._fire = function(event, context) {
58669
58910
  this._eventBus.fire('directEditing.' + event, context || { active: this._active });
58670
58911
  };
58671
58912
 
58913
+ /**
58914
+ * Close direct editing, if it is currently active.
58915
+ */
58672
58916
  DirectEditing.prototype.close = function() {
58673
58917
  this._fire('deactivate');
58674
58918
 
@@ -58690,6 +58934,10 @@
58690
58934
  this.resizable = undefined;
58691
58935
  };
58692
58936
 
58937
+ /**
58938
+ * Complete direct editing, updating the element via the
58939
+ * active provider if the text or bounds changed.
58940
+ */
58693
58941
  DirectEditing.prototype.complete = function() {
58694
58942
 
58695
58943
  var active = this._active;
@@ -58725,11 +58973,19 @@
58725
58973
  };
58726
58974
 
58727
58975
 
58976
+ /**
58977
+ * Returns the current text value.
58978
+ *
58979
+ * @return {string}
58980
+ */
58728
58981
  DirectEditing.prototype.getValue = function() {
58729
58982
  return this._textbox.getValue();
58730
58983
  };
58731
58984
 
58732
58985
 
58986
+ /**
58987
+ * @param {KeyboardEvent} e
58988
+ */
58733
58989
  DirectEditing.prototype._handleKey = function(e) {
58734
58990
 
58735
58991
  // stop bubble
@@ -58751,11 +59007,17 @@
58751
59007
  };
58752
59008
 
58753
59009
 
59010
+ /**
59011
+ * @param {TextBoxResizeEvent} event
59012
+ */
58754
59013
  DirectEditing.prototype._handleResize = function(event) {
58755
59014
  this._fire('resize', event);
58756
59015
  };
58757
59016
 
58758
59017
 
59018
+ /**
59019
+ * @param {FocusEvent} event
59020
+ */
58759
59021
  DirectEditing.prototype._handleFocusout = function(event) {
58760
59022
 
58761
59023
  // ignore focus moves within the textbox (e.g. to the resize handle)
@@ -58770,8 +59032,9 @@
58770
59032
  /**
58771
59033
  * Activate direct editing on the given element
58772
59034
  *
58773
- * @param {Object} ElementDescriptor the descriptor for a shape or connection
58774
- * @return {Boolean} true if the activation was possible
59035
+ * @param {Element} element
59036
+ *
59037
+ * @return {boolean} true if the activation was possible
58775
59038
  */
58776
59039
  DirectEditing.prototype.activate = function(element) {
58777
59040
  if (this.isActive()) {
@@ -63117,13 +63380,9 @@
63117
63380
 
63118
63381
  var KEY_TO_DIRECTION = {
63119
63382
  ArrowLeft: LEFT,
63120
- Left: LEFT,
63121
63383
  ArrowUp: UP,
63122
- Up: UP,
63123
63384
  ArrowRight: RIGHT,
63124
- Right: RIGHT,
63125
- ArrowDown: DOWN,
63126
- Down: DOWN
63385
+ ArrowDown: DOWN
63127
63386
  };
63128
63387
 
63129
63388
  var DIRECTIONS_DELTA = {