bpmn-js 18.26.0 → 18.27.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.
- package/dist/assets/diagram-js.css +52 -0
- package/dist/bpmn-modeler.development.js +466 -235
- package/dist/bpmn-modeler.production.min.js +11 -2
- package/dist/bpmn-navigated-viewer.development.js +2 -2
- package/dist/bpmn-navigated-viewer.production.min.js +1 -1
- package/dist/bpmn-viewer.development.js +2 -2
- package/dist/bpmn-viewer.production.min.js +1 -1
- package/lib/features/keyboard/BpmnKeyboardBindings.d.ts +10 -0
- package/lib/features/keyboard/BpmnKeyboardBindings.d.ts.map +1 -1
- package/lib/features/keyboard/BpmnKeyboardBindings.js +38 -129
- package/lib/features/label-link/LabelLink.d.ts.map +1 -1
- package/lib/features/label-link/LabelLink.js +24 -9
- package/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.d.ts.map +1 -1
- package/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.js +7 -0
- package/lib/features/modeling/behavior/LabelBehavior.d.ts +2 -21
- package/lib/features/modeling/behavior/LabelBehavior.d.ts.map +1 -1
- package/lib/features/modeling/behavior/LabelBehavior.js +6 -96
- package/lib/features/palette/PaletteProvider.d.ts.map +1 -1
- package/lib/features/palette/PaletteProvider.js +6 -0
- package/lib/features/palette/index.d.ts +1 -0
- package/lib/features/palette/index.d.ts.map +1 -1
- package/lib/util/LineUtil.d.ts +39 -0
- package/lib/util/LineUtil.d.ts.map +1 -0
- package/lib/util/LineUtil.js +163 -0
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* bpmn-js - bpmn-modeler v18.
|
|
2
|
+
* bpmn-js - bpmn-modeler v18.27.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: 2026-
|
|
11
|
+
* Date: 2026-09-03
|
|
12
12
|
*/
|
|
13
13
|
(function (global, factory) {
|
|
14
14
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -36622,6 +36622,11 @@
|
|
|
36622
36622
|
return;
|
|
36623
36623
|
}
|
|
36624
36624
|
|
|
36625
|
+
// group labels are expected to overlap their group
|
|
36626
|
+
if (is(element, 'bpmn:Group')) {
|
|
36627
|
+
return;
|
|
36628
|
+
}
|
|
36629
|
+
|
|
36625
36630
|
var optimalPosition = getOptimalPosition(element);
|
|
36626
36631
|
|
|
36627
36632
|
// no optimal position found
|
|
@@ -40442,6 +40447,162 @@
|
|
|
40442
40447
|
return oldTRBL.top !== newTRBL.top && oldTRBL.bottom !== newTRBL.bottom;
|
|
40443
40448
|
}
|
|
40444
40449
|
|
|
40450
|
+
/**
|
|
40451
|
+
* @typedef {import('diagram-js/lib/util/Types').Point} Point
|
|
40452
|
+
* @typedef {import('diagram-js/lib/util/Types').Rect} Rect
|
|
40453
|
+
*
|
|
40454
|
+
* @typedef {Point[]} Line
|
|
40455
|
+
*/
|
|
40456
|
+
|
|
40457
|
+
/**
|
|
40458
|
+
* Generates the nearest point (reference point) for a given point
|
|
40459
|
+
* onto a given set of lines.
|
|
40460
|
+
*
|
|
40461
|
+
* The reference point is clamped to the actual line segments, i.e. it
|
|
40462
|
+
* always lies on one of the given lines (docking to a segment end /
|
|
40463
|
+
* bendpoint if necessary) instead of on the infinite line extending a
|
|
40464
|
+
* segment.
|
|
40465
|
+
*
|
|
40466
|
+
* @param {Point} point
|
|
40467
|
+
* @param {Line[]} lines
|
|
40468
|
+
*
|
|
40469
|
+
* @return {Point|undefined}
|
|
40470
|
+
*/
|
|
40471
|
+
function getReferencePoint$1(point, lines) {
|
|
40472
|
+
|
|
40473
|
+
if (!lines.length) {
|
|
40474
|
+
return;
|
|
40475
|
+
}
|
|
40476
|
+
|
|
40477
|
+
var nearestLine = getNearestLine(point, lines);
|
|
40478
|
+
|
|
40479
|
+
return getClosestPointOnLine(point, nearestLine);
|
|
40480
|
+
}
|
|
40481
|
+
|
|
40482
|
+
/**
|
|
40483
|
+
* Convert the given bounds to a lines array containing all edges.
|
|
40484
|
+
*
|
|
40485
|
+
* @param {Rect|Point} bounds
|
|
40486
|
+
*
|
|
40487
|
+
* @return {Line[]}
|
|
40488
|
+
*/
|
|
40489
|
+
function asEdges(bounds) {
|
|
40490
|
+
return [
|
|
40491
|
+
[ // top
|
|
40492
|
+
{
|
|
40493
|
+
x: bounds.x,
|
|
40494
|
+
y: bounds.y
|
|
40495
|
+
},
|
|
40496
|
+
{
|
|
40497
|
+
x: bounds.x + (bounds.width || 0),
|
|
40498
|
+
y: bounds.y
|
|
40499
|
+
}
|
|
40500
|
+
],
|
|
40501
|
+
[ // right
|
|
40502
|
+
{
|
|
40503
|
+
x: bounds.x + (bounds.width || 0),
|
|
40504
|
+
y: bounds.y
|
|
40505
|
+
},
|
|
40506
|
+
{
|
|
40507
|
+
x: bounds.x + (bounds.width || 0),
|
|
40508
|
+
y: bounds.y + (bounds.height || 0)
|
|
40509
|
+
}
|
|
40510
|
+
],
|
|
40511
|
+
[ // bottom
|
|
40512
|
+
{
|
|
40513
|
+
x: bounds.x,
|
|
40514
|
+
y: bounds.y + (bounds.height || 0)
|
|
40515
|
+
},
|
|
40516
|
+
{
|
|
40517
|
+
x: bounds.x + (bounds.width || 0),
|
|
40518
|
+
y: bounds.y + (bounds.height || 0)
|
|
40519
|
+
}
|
|
40520
|
+
],
|
|
40521
|
+
[ // left
|
|
40522
|
+
{
|
|
40523
|
+
x: bounds.x,
|
|
40524
|
+
y: bounds.y
|
|
40525
|
+
},
|
|
40526
|
+
{
|
|
40527
|
+
x: bounds.x,
|
|
40528
|
+
y: bounds.y + (bounds.height || 0)
|
|
40529
|
+
}
|
|
40530
|
+
]
|
|
40531
|
+
];
|
|
40532
|
+
}
|
|
40533
|
+
|
|
40534
|
+
/**
|
|
40535
|
+
* Convert the given waypoints to a lines array containing all segments.
|
|
40536
|
+
*
|
|
40537
|
+
* @param {Point[]} waypoints
|
|
40538
|
+
*
|
|
40539
|
+
* @return {Line[]}
|
|
40540
|
+
*/
|
|
40541
|
+
function asLines(waypoints) {
|
|
40542
|
+
var lines = [];
|
|
40543
|
+
|
|
40544
|
+
for (var i = 0; i < waypoints.length - 1; i++) {
|
|
40545
|
+
lines.push([ waypoints[i], waypoints[i + 1] ]);
|
|
40546
|
+
}
|
|
40547
|
+
|
|
40548
|
+
return lines;
|
|
40549
|
+
}
|
|
40550
|
+
|
|
40551
|
+
/**
|
|
40552
|
+
* Returns the nearest line for a given point by the distance to the
|
|
40553
|
+
* closest point on each (clamped) line segment.
|
|
40554
|
+
*
|
|
40555
|
+
* @param {Point} point
|
|
40556
|
+
* @param {Line[]} lines
|
|
40557
|
+
*
|
|
40558
|
+
* @return {Line}
|
|
40559
|
+
*/
|
|
40560
|
+
function getNearestLine(point, lines) {
|
|
40561
|
+
|
|
40562
|
+
var distances = lines.map(function(line) {
|
|
40563
|
+
return {
|
|
40564
|
+
line: line,
|
|
40565
|
+
distance: getDistancePointPoint(point, getClosestPointOnLine(point, line))
|
|
40566
|
+
};
|
|
40567
|
+
});
|
|
40568
|
+
|
|
40569
|
+
var sorted = sortBy(distances, 'distance');
|
|
40570
|
+
|
|
40571
|
+
return sorted[0].line;
|
|
40572
|
+
}
|
|
40573
|
+
|
|
40574
|
+
/**
|
|
40575
|
+
* Returns the point on a line segment that is closest to the given point,
|
|
40576
|
+
* clamped to the segment's start and end.
|
|
40577
|
+
*
|
|
40578
|
+
* @param {Point} point
|
|
40579
|
+
* @param {Line} line
|
|
40580
|
+
*
|
|
40581
|
+
* @return {Point}
|
|
40582
|
+
*/
|
|
40583
|
+
function getClosestPointOnLine(point, line) {
|
|
40584
|
+
var start = line[0],
|
|
40585
|
+
end = line[1];
|
|
40586
|
+
|
|
40587
|
+
var dx = end.x - start.x,
|
|
40588
|
+
dy = end.y - start.y;
|
|
40589
|
+
|
|
40590
|
+
var lengthSquared = dx * dx + dy * dy;
|
|
40591
|
+
|
|
40592
|
+
if (lengthSquared === 0) {
|
|
40593
|
+
return { x: start.x, y: start.y };
|
|
40594
|
+
}
|
|
40595
|
+
|
|
40596
|
+
var t = ((point.x - start.x) * dx + (point.y - start.y) * dy) / lengthSquared;
|
|
40597
|
+
|
|
40598
|
+
t = Math.max(0, Math.min(1, t));
|
|
40599
|
+
|
|
40600
|
+
return {
|
|
40601
|
+
x: start.x + t * dx,
|
|
40602
|
+
y: start.y + t * dy
|
|
40603
|
+
};
|
|
40604
|
+
}
|
|
40605
|
+
|
|
40445
40606
|
var NAME_PROPERTY = 'name';
|
|
40446
40607
|
var TEXT_PROPERTY = 'text';
|
|
40447
40608
|
|
|
@@ -40696,99 +40857,6 @@
|
|
|
40696
40857
|
return roundPoint(delta(newReferencePoint, referencePoint));
|
|
40697
40858
|
}
|
|
40698
40859
|
|
|
40699
|
-
/**
|
|
40700
|
-
* Generates the nearest point (reference point) for a given point
|
|
40701
|
-
* onto given set of lines
|
|
40702
|
-
*
|
|
40703
|
-
* @param {Point} point
|
|
40704
|
-
* @param {Line[]} lines
|
|
40705
|
-
*
|
|
40706
|
-
* @return {Point}
|
|
40707
|
-
*/
|
|
40708
|
-
function getReferencePoint$1(point, lines) {
|
|
40709
|
-
|
|
40710
|
-
if (!lines.length) {
|
|
40711
|
-
return;
|
|
40712
|
-
}
|
|
40713
|
-
|
|
40714
|
-
var nearestLine = getNearestLine(point, lines);
|
|
40715
|
-
|
|
40716
|
-
return perpendicularFoot(point, nearestLine);
|
|
40717
|
-
}
|
|
40718
|
-
|
|
40719
|
-
/**
|
|
40720
|
-
* Convert the given bounds to a lines array containing all edges
|
|
40721
|
-
*
|
|
40722
|
-
* @param {Rect|Point} bounds
|
|
40723
|
-
*
|
|
40724
|
-
* @return {Line[]}
|
|
40725
|
-
*/
|
|
40726
|
-
function asEdges(bounds) {
|
|
40727
|
-
return [
|
|
40728
|
-
[ // top
|
|
40729
|
-
{
|
|
40730
|
-
x: bounds.x,
|
|
40731
|
-
y: bounds.y
|
|
40732
|
-
},
|
|
40733
|
-
{
|
|
40734
|
-
x: bounds.x + (bounds.width || 0),
|
|
40735
|
-
y: bounds.y
|
|
40736
|
-
}
|
|
40737
|
-
],
|
|
40738
|
-
[ // right
|
|
40739
|
-
{
|
|
40740
|
-
x: bounds.x + (bounds.width || 0),
|
|
40741
|
-
y: bounds.y
|
|
40742
|
-
},
|
|
40743
|
-
{
|
|
40744
|
-
x: bounds.x + (bounds.width || 0),
|
|
40745
|
-
y: bounds.y + (bounds.height || 0)
|
|
40746
|
-
}
|
|
40747
|
-
],
|
|
40748
|
-
[ // bottom
|
|
40749
|
-
{
|
|
40750
|
-
x: bounds.x,
|
|
40751
|
-
y: bounds.y + (bounds.height || 0)
|
|
40752
|
-
},
|
|
40753
|
-
{
|
|
40754
|
-
x: bounds.x + (bounds.width || 0),
|
|
40755
|
-
y: bounds.y + (bounds.height || 0)
|
|
40756
|
-
}
|
|
40757
|
-
],
|
|
40758
|
-
[ // left
|
|
40759
|
-
{
|
|
40760
|
-
x: bounds.x,
|
|
40761
|
-
y: bounds.y
|
|
40762
|
-
},
|
|
40763
|
-
{
|
|
40764
|
-
x: bounds.x,
|
|
40765
|
-
y: bounds.y + (bounds.height || 0)
|
|
40766
|
-
}
|
|
40767
|
-
]
|
|
40768
|
-
];
|
|
40769
|
-
}
|
|
40770
|
-
|
|
40771
|
-
/**
|
|
40772
|
-
* Returns the nearest line for a given point by distance
|
|
40773
|
-
* @param {Point} point
|
|
40774
|
-
* @param {Line[]} lines
|
|
40775
|
-
*
|
|
40776
|
-
* @return {Line}
|
|
40777
|
-
*/
|
|
40778
|
-
function getNearestLine(point, lines) {
|
|
40779
|
-
|
|
40780
|
-
var distances = lines.map(function(l) {
|
|
40781
|
-
return {
|
|
40782
|
-
line: l,
|
|
40783
|
-
distance: getDistancePointLine(point, l)
|
|
40784
|
-
};
|
|
40785
|
-
});
|
|
40786
|
-
|
|
40787
|
-
var sorted = sortBy(distances, 'distance');
|
|
40788
|
-
|
|
40789
|
-
return sorted[0].line;
|
|
40790
|
-
}
|
|
40791
|
-
|
|
40792
40860
|
/**
|
|
40793
40861
|
* @typedef {import('diagram-js/lib/util/Types').Point} Point
|
|
40794
40862
|
*
|
|
@@ -62812,6 +62880,24 @@
|
|
|
62812
62880
|
];
|
|
62813
62881
|
|
|
62814
62882
|
|
|
62883
|
+
/**
|
|
62884
|
+
* The keyboard binding for each editor action: the `key` that triggers it,
|
|
62885
|
+
* optionally requiring the `cmd` modifier (CTRL/CMD).
|
|
62886
|
+
*
|
|
62887
|
+
* @type {Record<string, { key: string, modifier?: 'cmd' }>}
|
|
62888
|
+
*/
|
|
62889
|
+
var SHORTCUTS_KEY_BINDINGS = {
|
|
62890
|
+
selectElements: { key: 'A', modifier: 'cmd' },
|
|
62891
|
+
find: { key: 'F', modifier: 'cmd' },
|
|
62892
|
+
spaceTool: { key: 'S' },
|
|
62893
|
+
lassoTool: { key: 'L' },
|
|
62894
|
+
handTool: { key: 'H' },
|
|
62895
|
+
globalConnectTool: { key: 'C' },
|
|
62896
|
+
directEditing: { key: 'E' },
|
|
62897
|
+
replaceElement: { key: 'R' }
|
|
62898
|
+
};
|
|
62899
|
+
|
|
62900
|
+
|
|
62815
62901
|
/**
|
|
62816
62902
|
* Register available keyboard bindings.
|
|
62817
62903
|
*
|
|
@@ -62823,146 +62909,35 @@
|
|
|
62823
62909
|
// inherit default bindings
|
|
62824
62910
|
KeyboardBindings.prototype.registerBindings.call(this, keyboard, editorActions);
|
|
62825
62911
|
|
|
62826
|
-
|
|
62827
|
-
* Add keyboard binding if respective editor action
|
|
62828
|
-
* is registered.
|
|
62829
|
-
*
|
|
62830
|
-
* @param {string} action name
|
|
62831
|
-
* @param {Function} fn that implements the key binding
|
|
62832
|
-
*/
|
|
62833
|
-
function addListener(action, fn) {
|
|
62834
|
-
|
|
62835
|
-
if (editorActions.isRegistered(action)) {
|
|
62836
|
-
keyboard.addListener(fn);
|
|
62837
|
-
}
|
|
62838
|
-
}
|
|
62839
|
-
|
|
62840
|
-
// select all elements
|
|
62841
|
-
// CTRL + A
|
|
62842
|
-
addListener('selectElements', function(context) {
|
|
62912
|
+
forEach(SHORTCUTS_KEY_BINDINGS, function(binding, action) {
|
|
62843
62913
|
|
|
62844
|
-
|
|
62845
|
-
|
|
62846
|
-
if (keyboard.isKey([ 'a', 'A' ], event) && keyboard.isCmd(event)) {
|
|
62847
|
-
editorActions.trigger('selectElements');
|
|
62848
|
-
|
|
62849
|
-
return true;
|
|
62850
|
-
}
|
|
62851
|
-
});
|
|
62852
|
-
|
|
62853
|
-
// search labels
|
|
62854
|
-
// CTRL + F
|
|
62855
|
-
addListener('find', function(context) {
|
|
62856
|
-
|
|
62857
|
-
var event = context.keyEvent;
|
|
62858
|
-
|
|
62859
|
-
if (keyboard.isKey([ 'f', 'F' ], event) && keyboard.isCmd(event)) {
|
|
62860
|
-
editorActions.trigger('find');
|
|
62861
|
-
|
|
62862
|
-
return true;
|
|
62863
|
-
}
|
|
62864
|
-
});
|
|
62865
|
-
|
|
62866
|
-
// activate space tool
|
|
62867
|
-
// S
|
|
62868
|
-
addListener('spaceTool', function(context) {
|
|
62869
|
-
|
|
62870
|
-
var event = context.keyEvent;
|
|
62871
|
-
|
|
62872
|
-
if (keyboard.hasModifier(event)) {
|
|
62914
|
+
if (!editorActions.isRegistered(action)) {
|
|
62873
62915
|
return;
|
|
62874
62916
|
}
|
|
62875
62917
|
|
|
62876
|
-
|
|
62877
|
-
|
|
62878
|
-
|
|
62879
|
-
return true;
|
|
62880
|
-
}
|
|
62881
|
-
});
|
|
62882
|
-
|
|
62883
|
-
// activate lasso tool
|
|
62884
|
-
// L
|
|
62885
|
-
addListener('lassoTool', function(context) {
|
|
62918
|
+
var keys = [ binding.key.toLowerCase(), binding.key.toUpperCase() ],
|
|
62919
|
+
requiresCmd = binding.modifier === 'cmd';
|
|
62886
62920
|
|
|
62887
|
-
|
|
62921
|
+
keyboard.addListener(function(context) {
|
|
62888
62922
|
|
|
62889
|
-
|
|
62890
|
-
return;
|
|
62891
|
-
}
|
|
62892
|
-
|
|
62893
|
-
if (keyboard.isKey([ 'l', 'L' ], event)) {
|
|
62894
|
-
editorActions.trigger('lassoTool');
|
|
62923
|
+
var event = context.keyEvent;
|
|
62895
62924
|
|
|
62896
|
-
|
|
62897
|
-
|
|
62898
|
-
|
|
62899
|
-
|
|
62900
|
-
// activate hand tool
|
|
62901
|
-
// H
|
|
62902
|
-
addListener('handTool', function(context) {
|
|
62903
|
-
|
|
62904
|
-
var event = context.keyEvent;
|
|
62905
|
-
|
|
62906
|
-
if (keyboard.hasModifier(event)) {
|
|
62907
|
-
return;
|
|
62908
|
-
}
|
|
62909
|
-
|
|
62910
|
-
if (keyboard.isKey([ 'h', 'H' ], event)) {
|
|
62911
|
-
editorActions.trigger('handTool');
|
|
62912
|
-
|
|
62913
|
-
return true;
|
|
62914
|
-
}
|
|
62915
|
-
});
|
|
62916
|
-
|
|
62917
|
-
// activate global connect tool
|
|
62918
|
-
// C
|
|
62919
|
-
addListener('globalConnectTool', function(context) {
|
|
62920
|
-
|
|
62921
|
-
var event = context.keyEvent;
|
|
62922
|
-
|
|
62923
|
-
if (keyboard.hasModifier(event)) {
|
|
62924
|
-
return;
|
|
62925
|
-
}
|
|
62926
|
-
|
|
62927
|
-
if (keyboard.isKey([ 'c', 'C' ], event)) {
|
|
62928
|
-
editorActions.trigger('globalConnectTool');
|
|
62929
|
-
|
|
62930
|
-
return true;
|
|
62931
|
-
}
|
|
62932
|
-
});
|
|
62933
|
-
|
|
62934
|
-
// activate direct editing
|
|
62935
|
-
// E
|
|
62936
|
-
addListener('directEditing', function(context) {
|
|
62937
|
-
|
|
62938
|
-
var event = context.keyEvent;
|
|
62939
|
-
|
|
62940
|
-
if (keyboard.hasModifier(event)) {
|
|
62941
|
-
return;
|
|
62942
|
-
}
|
|
62943
|
-
|
|
62944
|
-
if (keyboard.isKey([ 'e', 'E' ], event)) {
|
|
62945
|
-
editorActions.trigger('directEditing');
|
|
62946
|
-
|
|
62947
|
-
return true;
|
|
62948
|
-
}
|
|
62949
|
-
});
|
|
62950
|
-
|
|
62951
|
-
// activate replace element
|
|
62952
|
-
// R
|
|
62953
|
-
addListener('replaceElement', function(context) {
|
|
62954
|
-
|
|
62955
|
-
var event = context.keyEvent;
|
|
62925
|
+
if (!keyboard.isKey(keys, event)) {
|
|
62926
|
+
return;
|
|
62927
|
+
}
|
|
62956
62928
|
|
|
62957
|
-
|
|
62958
|
-
|
|
62959
|
-
|
|
62929
|
+
if (requiresCmd) {
|
|
62930
|
+
if (!keyboard.isCmd(event)) {
|
|
62931
|
+
return;
|
|
62932
|
+
}
|
|
62933
|
+
} else if (keyboard.hasModifier(event)) {
|
|
62934
|
+
return;
|
|
62935
|
+
}
|
|
62960
62936
|
|
|
62961
|
-
|
|
62962
|
-
editorActions.trigger('replaceElement', event);
|
|
62937
|
+
editorActions.trigger(action, event);
|
|
62963
62938
|
|
|
62964
62939
|
return true;
|
|
62965
|
-
}
|
|
62940
|
+
});
|
|
62966
62941
|
});
|
|
62967
62942
|
|
|
62968
62943
|
};
|
|
@@ -64782,9 +64757,17 @@
|
|
|
64782
64757
|
*/
|
|
64783
64758
|
function createLink(label, target) {
|
|
64784
64759
|
|
|
64785
|
-
|
|
64760
|
+
const labelMid = getMid(label);
|
|
64761
|
+
|
|
64762
|
+
// For connections, aim at the closest point on the visible connection
|
|
64763
|
+
// instead of the geometric mid point of the whole connection.
|
|
64764
|
+
const targetReference = isConnection(target)
|
|
64765
|
+
? getReferencePoint$1(labelMid, asLines(target.waypoints))
|
|
64766
|
+
: getMid(target);
|
|
64767
|
+
|
|
64768
|
+
// Create an auxiliary line between label and target reference points
|
|
64786
64769
|
const line = createLine(
|
|
64787
|
-
[
|
|
64770
|
+
[ targetReference, labelMid ],
|
|
64788
64771
|
LINE_STYLE
|
|
64789
64772
|
);
|
|
64790
64773
|
const linePath = line.getAttribute('d');
|
|
@@ -64799,12 +64782,18 @@
|
|
|
64799
64782
|
return;
|
|
64800
64783
|
}
|
|
64801
64784
|
|
|
64802
|
-
// Calculate the intersection point between line and
|
|
64803
|
-
//
|
|
64804
|
-
//
|
|
64805
|
-
|
|
64806
|
-
|
|
64807
|
-
|
|
64785
|
+
// Calculate the intersection point between line and target.
|
|
64786
|
+
// For connections there is no shape to intersect, so we link to the
|
|
64787
|
+
// closest point on the connection computed above.
|
|
64788
|
+
let targetInter;
|
|
64789
|
+
|
|
64790
|
+
if (isConnection(target)) {
|
|
64791
|
+
targetInter = targetReference;
|
|
64792
|
+
} else {
|
|
64793
|
+
const targetSelected = selection.isSelected(target);
|
|
64794
|
+
const targetPath = targetSelected ? getElementOutlinePath(target) : getElementPath(target);
|
|
64795
|
+
targetInter = getElementLineIntersection(targetPath, linePath) || getMid(target);
|
|
64796
|
+
}
|
|
64808
64797
|
|
|
64809
64798
|
// Do not draw a link if the points are too close
|
|
64810
64799
|
const distance = getDistancePointPoint(targetInter, labelInter);
|
|
@@ -65873,6 +65862,147 @@
|
|
|
65873
65862
|
movePreview: [ 'type', MovePreview ]
|
|
65874
65863
|
};
|
|
65875
65864
|
|
|
65865
|
+
/**
|
|
65866
|
+
* @typedef {import('../../core/Canvas').default} Canvas
|
|
65867
|
+
*/
|
|
65868
|
+
|
|
65869
|
+
const SHOW_DELAY = 300;
|
|
65870
|
+
|
|
65871
|
+
/**
|
|
65872
|
+
* @typedef { import('@bpmn-io/diagram-js-ui').VNode } VNode
|
|
65873
|
+
*
|
|
65874
|
+
* @typedef { {
|
|
65875
|
+
* x: number;
|
|
65876
|
+
* y: number;
|
|
65877
|
+
* placement?: string;
|
|
65878
|
+
* } } HoverTooltipPosition
|
|
65879
|
+
*
|
|
65880
|
+
* @typedef { {
|
|
65881
|
+
* container: HTMLElement;
|
|
65882
|
+
* selector: string;
|
|
65883
|
+
* getContent: (target: HTMLElement) => VNode | null;
|
|
65884
|
+
* getPosition: (target: HTMLElement) => HoverTooltipPosition;
|
|
65885
|
+
* showDelay?: number;
|
|
65886
|
+
* } } HoverTooltipConfig
|
|
65887
|
+
*/
|
|
65888
|
+
|
|
65889
|
+
/**
|
|
65890
|
+
* Shows a styled tooltip when hovering UI controls such as palette or
|
|
65891
|
+
* context pad entries. Reusable across features; a consumer registers a
|
|
65892
|
+
* hover source via #add and provides the rendered content.
|
|
65893
|
+
*
|
|
65894
|
+
* @param {Canvas} canvas
|
|
65895
|
+
*/
|
|
65896
|
+
function HoverTooltip(canvas) {
|
|
65897
|
+
this._canvas = canvas;
|
|
65898
|
+
|
|
65899
|
+
this._mount = null;
|
|
65900
|
+
this._current = null;
|
|
65901
|
+
this._showTimer = null;
|
|
65902
|
+
}
|
|
65903
|
+
|
|
65904
|
+
HoverTooltip.$inject = [ 'canvas' ];
|
|
65905
|
+
|
|
65906
|
+
/**
|
|
65907
|
+
* Register a hover source. Hovering a `selector` match inside `container`
|
|
65908
|
+
* shows a tooltip with the content and position provided by the callbacks.
|
|
65909
|
+
*
|
|
65910
|
+
* @param {HoverTooltipConfig} config
|
|
65911
|
+
*/
|
|
65912
|
+
HoverTooltip.prototype.add = function(config) {
|
|
65913
|
+
const {
|
|
65914
|
+
container,
|
|
65915
|
+
selector,
|
|
65916
|
+
showDelay = SHOW_DELAY
|
|
65917
|
+
} = config;
|
|
65918
|
+
|
|
65919
|
+
delegate.bind(container, selector, 'mouseover',
|
|
65920
|
+
(event) => this._show(event.delegateTarget, config, showDelay));
|
|
65921
|
+
|
|
65922
|
+
delegate.bind(container, selector, 'mouseout',
|
|
65923
|
+
(event) => {
|
|
65924
|
+
const { delegateTarget, relatedTarget } = event;
|
|
65925
|
+
|
|
65926
|
+
// ignore transitions to a child element of the same target
|
|
65927
|
+
if (relatedTarget && delegateTarget.contains(relatedTarget)) {
|
|
65928
|
+
return;
|
|
65929
|
+
}
|
|
65930
|
+
|
|
65931
|
+
this._hide();
|
|
65932
|
+
});
|
|
65933
|
+
};
|
|
65934
|
+
|
|
65935
|
+
HoverTooltip.prototype._show = function(target, config, showDelay) {
|
|
65936
|
+
const content = config.getContent(target);
|
|
65937
|
+
|
|
65938
|
+
if (!content) {
|
|
65939
|
+
return;
|
|
65940
|
+
}
|
|
65941
|
+
|
|
65942
|
+
this._current = {
|
|
65943
|
+
target,
|
|
65944
|
+
content,
|
|
65945
|
+
getPosition: config.getPosition
|
|
65946
|
+
};
|
|
65947
|
+
|
|
65948
|
+
clearTimeout(this._showTimer);
|
|
65949
|
+
|
|
65950
|
+
this._showTimer = setTimeout(() => this._render(), showDelay);
|
|
65951
|
+
};
|
|
65952
|
+
|
|
65953
|
+
HoverTooltip.prototype._hide = function() {
|
|
65954
|
+
clearTimeout(this._showTimer);
|
|
65955
|
+
|
|
65956
|
+
this._current = null;
|
|
65957
|
+
|
|
65958
|
+
this._render();
|
|
65959
|
+
};
|
|
65960
|
+
|
|
65961
|
+
HoverTooltip.prototype._render = function() {
|
|
65962
|
+
const mount = this._getMount();
|
|
65963
|
+
|
|
65964
|
+
if (!this._current) {
|
|
65965
|
+
R(null, mount);
|
|
65966
|
+
|
|
65967
|
+
return;
|
|
65968
|
+
}
|
|
65969
|
+
|
|
65970
|
+
const { target, content, getPosition } = this._current;
|
|
65971
|
+
|
|
65972
|
+
const { x, y, placement = 'right' } = getPosition(target);
|
|
65973
|
+
|
|
65974
|
+
const style = {
|
|
65975
|
+
left: `${ x }px`,
|
|
65976
|
+
top: `${ y }px`
|
|
65977
|
+
};
|
|
65978
|
+
|
|
65979
|
+
R(
|
|
65980
|
+
m$1`<div
|
|
65981
|
+
class="djs-hover-tooltip djs-hover-tooltip--${ placement }"
|
|
65982
|
+
style=${ style }
|
|
65983
|
+
>${ content }</div>`,
|
|
65984
|
+
mount
|
|
65985
|
+
);
|
|
65986
|
+
};
|
|
65987
|
+
|
|
65988
|
+
HoverTooltip.prototype._getMount = function() {
|
|
65989
|
+
if (!this._mount) {
|
|
65990
|
+
this._mount = domify('<div class="djs-hover-tooltip-container"></div>');
|
|
65991
|
+
|
|
65992
|
+
this._canvas.getContainer().appendChild(this._mount);
|
|
65993
|
+
}
|
|
65994
|
+
|
|
65995
|
+
return this._mount;
|
|
65996
|
+
};
|
|
65997
|
+
|
|
65998
|
+
/**
|
|
65999
|
+
* @type { import('didi').ModuleDeclaration }
|
|
66000
|
+
*/
|
|
66001
|
+
var HoverTooltipModule = {
|
|
66002
|
+
__init__: [ 'hoverTooltip' ],
|
|
66003
|
+
hoverTooltip: [ 'type', HoverTooltip ]
|
|
66004
|
+
};
|
|
66005
|
+
|
|
65876
66006
|
/**
|
|
65877
66007
|
* @typedef {import('../../core/Canvas.js').default} Canvas
|
|
65878
66008
|
* @typedef {import('../../core/EventBus.js').default} EventBus
|
|
@@ -66116,7 +66246,8 @@
|
|
|
66116
66246
|
attr$1(control, 'data-action', id);
|
|
66117
66247
|
|
|
66118
66248
|
if (entry.title) {
|
|
66119
|
-
attr$1(control, '
|
|
66249
|
+
attr$1(control, 'aria-label', entry.title);
|
|
66250
|
+
attr$1(control, 'role', 'button');
|
|
66120
66251
|
}
|
|
66121
66252
|
|
|
66122
66253
|
if (entry.className) {
|
|
@@ -66359,12 +66490,108 @@
|
|
|
66359
66490
|
return entries;
|
|
66360
66491
|
}
|
|
66361
66492
|
|
|
66493
|
+
/**
|
|
66494
|
+
* @typedef { {
|
|
66495
|
+
* title: string;
|
|
66496
|
+
* shortcut?: string;
|
|
66497
|
+
* } } PaletteTooltipProps
|
|
66498
|
+
*/
|
|
66499
|
+
|
|
66500
|
+
/**
|
|
66501
|
+
* Renders the content of a palette entry tooltip: the entry title and,
|
|
66502
|
+
* if provided, its keyboard shortcut.
|
|
66503
|
+
*
|
|
66504
|
+
* @param {PaletteTooltipProps} props
|
|
66505
|
+
*/
|
|
66506
|
+
function PaletteTooltipComponent(props) {
|
|
66507
|
+
const {
|
|
66508
|
+
title,
|
|
66509
|
+
shortcut
|
|
66510
|
+
} = props;
|
|
66511
|
+
|
|
66512
|
+
const shortcutNode = shortcut
|
|
66513
|
+
? m$1`<kbd class="djs-palette-tooltip-shortcut">${ shortcut }</kbd>`
|
|
66514
|
+
: null;
|
|
66515
|
+
|
|
66516
|
+
return m$1`
|
|
66517
|
+
<span class="djs-palette-tooltip-label">${ title }</span>
|
|
66518
|
+
${ shortcutNode }
|
|
66519
|
+
`;
|
|
66520
|
+
}
|
|
66521
|
+
|
|
66522
|
+
/**
|
|
66523
|
+
* @typedef {import('../../core/EventBus').default} EventBus
|
|
66524
|
+
* @typedef {import('./Palette').default} Palette
|
|
66525
|
+
* @typedef {import('../hover-tooltip/HoverTooltip').default} HoverTooltip
|
|
66526
|
+
*/
|
|
66527
|
+
|
|
66528
|
+
const PALETTE_ENTRY_SELECTOR = '.djs-palette-entries .entry';
|
|
66529
|
+
|
|
66530
|
+
const ENTRY_GAP = 8;
|
|
66531
|
+
|
|
66532
|
+
/**
|
|
66533
|
+
* Shows a hover tooltip for palette entries, displaying the entry `title`
|
|
66534
|
+
* and, if the entry provides one, its keyboard `shortcut`.
|
|
66535
|
+
*
|
|
66536
|
+
* @param {EventBus} eventBus
|
|
66537
|
+
* @param {Palette} palette
|
|
66538
|
+
* @param {HoverTooltip} hoverTooltip
|
|
66539
|
+
*/
|
|
66540
|
+
function PaletteTooltip(eventBus, palette, hoverTooltip) {
|
|
66541
|
+
this._palette = palette;
|
|
66542
|
+
this._hoverTooltip = hoverTooltip;
|
|
66543
|
+
|
|
66544
|
+
this._entries = {};
|
|
66545
|
+
|
|
66546
|
+
eventBus.on('palette.create', (event) => this._init(event.container));
|
|
66547
|
+
|
|
66548
|
+
eventBus.on('palette.changed', () => this._updateEntries());
|
|
66549
|
+
}
|
|
66550
|
+
|
|
66551
|
+
PaletteTooltip.$inject = [ 'eventBus', 'palette', 'hoverTooltip' ];
|
|
66552
|
+
|
|
66553
|
+
PaletteTooltip.prototype._init = function(container) {
|
|
66554
|
+
this._updateEntries();
|
|
66555
|
+
|
|
66556
|
+
this._hoverTooltip.add({
|
|
66557
|
+
container,
|
|
66558
|
+
selector: PALETTE_ENTRY_SELECTOR,
|
|
66559
|
+
getContent: (target) => {
|
|
66560
|
+
const entry = this._entries[ attr$1(target, 'data-action') ];
|
|
66561
|
+
|
|
66562
|
+
if (!entry || !entry.title) {
|
|
66563
|
+
return null;
|
|
66564
|
+
}
|
|
66565
|
+
|
|
66566
|
+
return m$1`<${PaletteTooltipComponent}
|
|
66567
|
+
title=${ entry.title }
|
|
66568
|
+
shortcut=${ entry.shortcut }
|
|
66569
|
+
/>`;
|
|
66570
|
+
},
|
|
66571
|
+
getPosition: (target) => {
|
|
66572
|
+
const bounds = target.getBoundingClientRect();
|
|
66573
|
+
|
|
66574
|
+
return {
|
|
66575
|
+
x: bounds.right + ENTRY_GAP,
|
|
66576
|
+
y: bounds.top + bounds.height / 2,
|
|
66577
|
+
placement: 'right'
|
|
66578
|
+
};
|
|
66579
|
+
}
|
|
66580
|
+
});
|
|
66581
|
+
};
|
|
66582
|
+
|
|
66583
|
+
PaletteTooltip.prototype._updateEntries = function() {
|
|
66584
|
+
this._entries = this._palette.getEntries();
|
|
66585
|
+
};
|
|
66586
|
+
|
|
66362
66587
|
/**
|
|
66363
66588
|
* @type { import('didi').ModuleDeclaration }
|
|
66364
66589
|
*/
|
|
66365
66590
|
var PaletteModule$1 = {
|
|
66366
|
-
|
|
66367
|
-
|
|
66591
|
+
__depends__: [ HoverTooltipModule ],
|
|
66592
|
+
__init__: [ 'palette', 'paletteTooltip' ],
|
|
66593
|
+
palette: [ 'type', Palette ],
|
|
66594
|
+
paletteTooltip: [ 'type', PaletteTooltip ]
|
|
66368
66595
|
};
|
|
66369
66596
|
|
|
66370
66597
|
/**
|
|
@@ -67258,6 +67485,7 @@
|
|
|
67258
67485
|
group: 'tools',
|
|
67259
67486
|
className: 'bpmn-icon-hand-tool',
|
|
67260
67487
|
title: translate('Activate hand tool'),
|
|
67488
|
+
shortcut: SHORTCUTS_KEY_BINDINGS.handTool.key,
|
|
67261
67489
|
action: {
|
|
67262
67490
|
click: function(event) {
|
|
67263
67491
|
handTool.activateHand(event);
|
|
@@ -67268,6 +67496,7 @@
|
|
|
67268
67496
|
group: 'tools',
|
|
67269
67497
|
className: 'bpmn-icon-lasso-tool',
|
|
67270
67498
|
title: translate('Activate lasso tool'),
|
|
67499
|
+
shortcut: SHORTCUTS_KEY_BINDINGS.lassoTool.key,
|
|
67271
67500
|
action: {
|
|
67272
67501
|
click: function(event) {
|
|
67273
67502
|
lassoTool.activateSelection(event);
|
|
@@ -67278,6 +67507,7 @@
|
|
|
67278
67507
|
group: 'tools',
|
|
67279
67508
|
className: 'bpmn-icon-space-tool',
|
|
67280
67509
|
title: translate('Activate create/remove space tool'),
|
|
67510
|
+
shortcut: SHORTCUTS_KEY_BINDINGS.spaceTool.key,
|
|
67281
67511
|
action: {
|
|
67282
67512
|
click: function(event) {
|
|
67283
67513
|
spaceTool.activateSelection(event);
|
|
@@ -67288,6 +67518,7 @@
|
|
|
67288
67518
|
group: 'tools',
|
|
67289
67519
|
className: 'bpmn-icon-connection-multi',
|
|
67290
67520
|
title: translate('Activate global connect tool'),
|
|
67521
|
+
shortcut: SHORTCUTS_KEY_BINDINGS.globalConnectTool.key,
|
|
67291
67522
|
action: {
|
|
67292
67523
|
click: function(event) {
|
|
67293
67524
|
globalConnect.start(event);
|