bpmn-js 9.3.2 → 10.0.0-alpha.1

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 (24) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/assets/diagram-js.css +18 -8
  3. package/dist/bpmn-modeler.development.js +533 -356
  4. package/dist/bpmn-modeler.production.min.js +6 -6
  5. package/dist/bpmn-navigated-viewer.development.js +78 -73
  6. package/dist/bpmn-navigated-viewer.production.min.js +6 -6
  7. package/dist/bpmn-viewer.development.js +20 -17
  8. package/dist/bpmn-viewer.production.min.js +6 -6
  9. package/lib/features/copy-paste/BpmnCopyPaste.js +75 -69
  10. package/lib/features/copy-paste/ModdleCopy.js +26 -13
  11. package/lib/features/grid-snapping/behavior/{AutoPlaceBehavior.js → GridSnappingAutoPlaceBehavior.js} +2 -2
  12. package/lib/features/grid-snapping/behavior/{LayoutConnectionBehavior.js → GridSnappingLayoutConnectionBehavior.js} +4 -4
  13. package/lib/features/grid-snapping/behavior/{CreateParticipantBehavior.js → GridSnappingParticipantBehavior.js} +2 -2
  14. package/lib/features/grid-snapping/behavior/index.js +7 -7
  15. package/lib/features/label-editing/LabelEditingProvider.js +0 -22
  16. package/lib/features/modeling/ElementFactory.js +18 -8
  17. package/lib/features/modeling/behavior/BoundaryEventBehavior.js +1 -16
  18. package/lib/features/modeling/behavior/GroupBehavior.js +205 -93
  19. package/lib/features/modeling/behavior/ResizeBehavior.js +2 -0
  20. package/lib/features/modeling/behavior/RootElementReferenceBehavior.js +7 -8
  21. package/lib/features/modeling/behavior/SpaceToolBehavior.js +5 -0
  22. package/lib/features/modeling/behavior/util/CategoryUtil.js +66 -13
  23. package/lib/features/modeling/cmd/UpdateModdlePropertiesHandler.js +3 -0
  24. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-navigated-viewer v9.3.2
2
+ * bpmn-js - bpmn-navigated-viewer v10.0.0-alpha.1
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: 2022-08-04
11
+ * Date: 2022-08-17
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -8910,20 +8910,11 @@
8910
8910
  return function() {
8911
8911
  initializers.forEach(function(initializer) {
8912
8912
 
8913
- try {
8914
-
8915
- // eagerly resolve component (fn or string)
8916
- if (typeof initializer === 'string') {
8917
- injector.get(initializer);
8918
- } else {
8919
- injector.invoke(initializer);
8920
- }
8921
- } catch (error) {
8922
- if (typeof AggregateError !== 'undefined') {
8923
- throw new AggregateError([ error ], 'Failed to initialize!');
8924
- }
8925
-
8926
- throw new Error('Failed to initialize! ' + error.message);
8913
+ // eagerly resolve component (fn or string)
8914
+ if (typeof initializer === 'string') {
8915
+ injector.get(initializer);
8916
+ } else {
8917
+ injector.invoke(initializer);
8927
8918
  }
8928
8919
  });
8929
8920
  };
@@ -9433,7 +9424,19 @@
9433
9424
  var container = this._container = createContainer(config);
9434
9425
 
9435
9426
  var svg = this._svg = create$1('svg');
9436
- attr$1(svg, { width: '100%', height: '100%' });
9427
+
9428
+ attr$1(svg, {
9429
+ width: '100%',
9430
+ height: '100%'
9431
+ });
9432
+
9433
+ attr(svg, 'tabindex', 0);
9434
+
9435
+ eventBus.on('element.hover', function() {
9436
+ if (document.activeElement === document.body) {
9437
+ svg.focus();
9438
+ }
9439
+ });
9437
9440
 
9438
9441
  append(container, svg);
9439
9442
 
@@ -21615,6 +21618,16 @@
21615
21618
  // default moddle extensions the viewer is composed of
21616
21619
  Viewer.prototype._moddleExtensions = {};
21617
21620
 
21621
+ var KEYCODE_C = 67;
21622
+ var KEYCODE_V = 86;
21623
+ var KEYCODE_Y = 89;
21624
+ var KEYCODE_Z = 90;
21625
+
21626
+ var KEYS_COPY = [ 'c', 'C', KEYCODE_C ];
21627
+ var KEYS_PASTE = [ 'v', 'V', KEYCODE_V ];
21628
+ var KEYS_REDO = [ 'y', 'Y', KEYCODE_Y ];
21629
+ var KEYS_UNDO = [ 'z', 'Z', KEYCODE_Z ];
21630
+
21618
21631
  /**
21619
21632
  * Returns true if event was triggered with any modifier
21620
21633
  * @param {KeyboardEvent} event
@@ -21654,15 +21667,36 @@
21654
21667
  */
21655
21668
  function isShift(event) {
21656
21669
  return event.shiftKey;
21670
+ }
21671
+
21672
+ function isCopy(event) {
21673
+ return isCmd(event) && isKey(KEYS_COPY, event);
21674
+ }
21675
+
21676
+ function isPaste(event) {
21677
+ return isCmd(event) && isKey(KEYS_PASTE, event);
21678
+ }
21679
+
21680
+ function isUndo(event) {
21681
+ return isCmd(event) && !isShift(event) && isKey(KEYS_UNDO, event);
21682
+ }
21683
+
21684
+ function isRedo(event) {
21685
+ return isCmd(event) && (
21686
+ isKey(KEYS_REDO, event) || (
21687
+ isKey(KEYS_UNDO, event) && isShift(event)
21688
+ )
21689
+ );
21657
21690
  }
21658
21691
 
21659
21692
  var KEYDOWN_EVENT = 'keyboard.keydown',
21660
21693
  KEYUP_EVENT = 'keyboard.keyup';
21661
21694
 
21662
- var HANDLE_MODIFIER_ATTRIBUTE = 'input-handle-modified-keys';
21663
-
21664
21695
  var DEFAULT_PRIORITY = 1000;
21665
21696
 
21697
+ var compatMessage = 'Explicit binding of keyboard to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661';
21698
+
21699
+
21666
21700
  /**
21667
21701
  * A keyboard abstraction that may be activated and
21668
21702
  * deactivated by users at will, consuming key events
@@ -21681,8 +21715,8 @@
21681
21715
  *
21682
21716
  * All events contain one field which is node.
21683
21717
  *
21684
- * A default binding for the keyboard may be specified via the
21685
- * `keyboard.bindTo` configuration option.
21718
+ * Specify the initial keyboard binding state via the
21719
+ * `keyboard.bind=true|false` configuration option.
21686
21720
  *
21687
21721
  * @param {Config} config
21688
21722
  * @param {EventBus} eventBus
@@ -21690,7 +21724,8 @@
21690
21724
  function Keyboard(config, eventBus) {
21691
21725
  var self = this;
21692
21726
 
21693
- this._config = config || {};
21727
+ this._config = config = config || {};
21728
+
21694
21729
  this._eventBus = eventBus;
21695
21730
 
21696
21731
  this._keydownHandler = this._keydownHandler.bind(this);
@@ -21703,19 +21738,22 @@
21703
21738
  self.unbind();
21704
21739
  });
21705
21740
 
21706
- eventBus.on('diagram.init', function() {
21707
- self._fire('init');
21708
- });
21741
+ if (config.bindTo) {
21742
+ console.error('unsupported configuration <keyboard.bindTo>', new Error(compatMessage));
21743
+ }
21744
+
21745
+ var bind = config && config.bind !== false;
21746
+
21747
+ eventBus.on('canvas.init', function(event) {
21748
+ self._target = event.svg;
21709
21749
 
21710
- eventBus.on('attach', function() {
21711
- if (config && config.bindTo) {
21712
- self.bind(config.bindTo);
21750
+ if (bind) {
21751
+ self.bind();
21713
21752
  }
21714
- });
21715
21753
 
21716
- eventBus.on('detach', function() {
21717
- self.unbind();
21754
+ self._fire('init');
21718
21755
  });
21756
+
21719
21757
  }
21720
21758
 
21721
21759
  Keyboard.$inject = [
@@ -21750,34 +21788,19 @@
21750
21788
  };
21751
21789
 
21752
21790
  Keyboard.prototype._isEventIgnored = function(event) {
21753
- return isInput(event.target) && this._isModifiedKeyIgnored(event);
21754
- };
21755
-
21756
- Keyboard.prototype._isModifiedKeyIgnored = function(event) {
21757
- if (!isCmd(event)) {
21758
- return true;
21759
- }
21760
-
21761
- var allowedModifiers = this._getAllowedModifiers(event.target);
21762
- return allowedModifiers.indexOf(event.key) === -1;
21791
+ return false;
21763
21792
  };
21764
21793
 
21765
- Keyboard.prototype._getAllowedModifiers = function(element) {
21766
- var modifierContainer = closest(element, '[' + HANDLE_MODIFIER_ATTRIBUTE + ']', true);
21794
+ Keyboard.prototype.bind = function(node) {
21767
21795
 
21768
- if (!modifierContainer || (this._node && !this._node.contains(modifierContainer))) {
21769
- return [];
21796
+ if (node) {
21797
+ console.error('unsupported argument <node>', new Error(compatMessage));
21770
21798
  }
21771
21799
 
21772
- return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');
21773
- };
21774
-
21775
- Keyboard.prototype.bind = function(node) {
21776
-
21777
21800
  // make sure that the keyboard is only bound once to the DOM
21778
21801
  this.unbind();
21779
21802
 
21780
- this._node = node;
21803
+ node = this._node = this._target;
21781
21804
 
21782
21805
  // bind key events
21783
21806
  componentEvent.bind(node, 'keydown', this._keydownHandler, true);
@@ -21836,26 +21859,8 @@
21836
21859
  Keyboard.prototype.isShift = isShift;
21837
21860
  Keyboard.prototype.isKey = isKey;
21838
21861
 
21839
-
21840
-
21841
- // helpers ///////
21842
-
21843
- function isInput(target) {
21844
- return target && (matchesSelector(target, 'input, textarea') || target.contentEditable === 'true');
21845
- }
21846
-
21847
21862
  var LOW_PRIORITY = 500;
21848
21863
 
21849
- var KEYCODE_C = 67;
21850
- var KEYCODE_V = 86;
21851
- var KEYCODE_Y = 89;
21852
- var KEYCODE_Z = 90;
21853
-
21854
- var KEYS_COPY = [ 'c', 'C', KEYCODE_C ];
21855
- var KEYS_PASTE = [ 'v', 'V', KEYCODE_V ];
21856
- var KEYS_REDO = [ 'y', 'Y', KEYCODE_Y ];
21857
- var KEYS_UNDO = [ 'z', 'Z', KEYCODE_Z ];
21858
-
21859
21864
 
21860
21865
  /**
21861
21866
  * Adds default keyboard bindings.
@@ -21913,7 +21918,7 @@
21913
21918
 
21914
21919
  var event = context.keyEvent;
21915
21920
 
21916
- if (isCmd(event) && !isShift(event) && isKey(KEYS_UNDO, event)) {
21921
+ if (isUndo(event)) {
21917
21922
  editorActions.trigger('undo');
21918
21923
 
21919
21924
  return true;
@@ -21927,7 +21932,7 @@
21927
21932
 
21928
21933
  var event = context.keyEvent;
21929
21934
 
21930
- if (isCmd(event) && (isKey(KEYS_REDO, event) || (isKey(KEYS_UNDO, event) && isShift(event)))) {
21935
+ if (isRedo(event)) {
21931
21936
  editorActions.trigger('redo');
21932
21937
 
21933
21938
  return true;
@@ -21940,7 +21945,7 @@
21940
21945
 
21941
21946
  var event = context.keyEvent;
21942
21947
 
21943
- if (isCmd(event) && isKey(KEYS_COPY, event)) {
21948
+ if (isCopy(event)) {
21944
21949
  editorActions.trigger('copy');
21945
21950
 
21946
21951
  return true;
@@ -21953,7 +21958,7 @@
21953
21958
 
21954
21959
  var event = context.keyEvent;
21955
21960
 
21956
- if (isCmd(event) && isKey(KEYS_PASTE, event)) {
21961
+ if (isPaste(event)) {
21957
21962
  editorActions.trigger('paste');
21958
21963
 
21959
21964
  return true;