bpmn-js 18.26.0 → 18.27.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.
- package/dist/assets/diagram-js.css +52 -0
- package/dist/bpmn-modeler.development.js +461 -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/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.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-
|
|
11
|
+
* Date: 2026-08-31
|
|
12
12
|
*/
|
|
13
13
|
(function (global, factory) {
|
|
14
14
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -40442,6 +40442,162 @@
|
|
|
40442
40442
|
return oldTRBL.top !== newTRBL.top && oldTRBL.bottom !== newTRBL.bottom;
|
|
40443
40443
|
}
|
|
40444
40444
|
|
|
40445
|
+
/**
|
|
40446
|
+
* @typedef {import('diagram-js/lib/util/Types').Point} Point
|
|
40447
|
+
* @typedef {import('diagram-js/lib/util/Types').Rect} Rect
|
|
40448
|
+
*
|
|
40449
|
+
* @typedef {Point[]} Line
|
|
40450
|
+
*/
|
|
40451
|
+
|
|
40452
|
+
/**
|
|
40453
|
+
* Generates the nearest point (reference point) for a given point
|
|
40454
|
+
* onto a given set of lines.
|
|
40455
|
+
*
|
|
40456
|
+
* The reference point is clamped to the actual line segments, i.e. it
|
|
40457
|
+
* always lies on one of the given lines (docking to a segment end /
|
|
40458
|
+
* bendpoint if necessary) instead of on the infinite line extending a
|
|
40459
|
+
* segment.
|
|
40460
|
+
*
|
|
40461
|
+
* @param {Point} point
|
|
40462
|
+
* @param {Line[]} lines
|
|
40463
|
+
*
|
|
40464
|
+
* @return {Point|undefined}
|
|
40465
|
+
*/
|
|
40466
|
+
function getReferencePoint$1(point, lines) {
|
|
40467
|
+
|
|
40468
|
+
if (!lines.length) {
|
|
40469
|
+
return;
|
|
40470
|
+
}
|
|
40471
|
+
|
|
40472
|
+
var nearestLine = getNearestLine(point, lines);
|
|
40473
|
+
|
|
40474
|
+
return getClosestPointOnLine(point, nearestLine);
|
|
40475
|
+
}
|
|
40476
|
+
|
|
40477
|
+
/**
|
|
40478
|
+
* Convert the given bounds to a lines array containing all edges.
|
|
40479
|
+
*
|
|
40480
|
+
* @param {Rect|Point} bounds
|
|
40481
|
+
*
|
|
40482
|
+
* @return {Line[]}
|
|
40483
|
+
*/
|
|
40484
|
+
function asEdges(bounds) {
|
|
40485
|
+
return [
|
|
40486
|
+
[ // top
|
|
40487
|
+
{
|
|
40488
|
+
x: bounds.x,
|
|
40489
|
+
y: bounds.y
|
|
40490
|
+
},
|
|
40491
|
+
{
|
|
40492
|
+
x: bounds.x + (bounds.width || 0),
|
|
40493
|
+
y: bounds.y
|
|
40494
|
+
}
|
|
40495
|
+
],
|
|
40496
|
+
[ // right
|
|
40497
|
+
{
|
|
40498
|
+
x: bounds.x + (bounds.width || 0),
|
|
40499
|
+
y: bounds.y
|
|
40500
|
+
},
|
|
40501
|
+
{
|
|
40502
|
+
x: bounds.x + (bounds.width || 0),
|
|
40503
|
+
y: bounds.y + (bounds.height || 0)
|
|
40504
|
+
}
|
|
40505
|
+
],
|
|
40506
|
+
[ // bottom
|
|
40507
|
+
{
|
|
40508
|
+
x: bounds.x,
|
|
40509
|
+
y: bounds.y + (bounds.height || 0)
|
|
40510
|
+
},
|
|
40511
|
+
{
|
|
40512
|
+
x: bounds.x + (bounds.width || 0),
|
|
40513
|
+
y: bounds.y + (bounds.height || 0)
|
|
40514
|
+
}
|
|
40515
|
+
],
|
|
40516
|
+
[ // left
|
|
40517
|
+
{
|
|
40518
|
+
x: bounds.x,
|
|
40519
|
+
y: bounds.y
|
|
40520
|
+
},
|
|
40521
|
+
{
|
|
40522
|
+
x: bounds.x,
|
|
40523
|
+
y: bounds.y + (bounds.height || 0)
|
|
40524
|
+
}
|
|
40525
|
+
]
|
|
40526
|
+
];
|
|
40527
|
+
}
|
|
40528
|
+
|
|
40529
|
+
/**
|
|
40530
|
+
* Convert the given waypoints to a lines array containing all segments.
|
|
40531
|
+
*
|
|
40532
|
+
* @param {Point[]} waypoints
|
|
40533
|
+
*
|
|
40534
|
+
* @return {Line[]}
|
|
40535
|
+
*/
|
|
40536
|
+
function asLines(waypoints) {
|
|
40537
|
+
var lines = [];
|
|
40538
|
+
|
|
40539
|
+
for (var i = 0; i < waypoints.length - 1; i++) {
|
|
40540
|
+
lines.push([ waypoints[i], waypoints[i + 1] ]);
|
|
40541
|
+
}
|
|
40542
|
+
|
|
40543
|
+
return lines;
|
|
40544
|
+
}
|
|
40545
|
+
|
|
40546
|
+
/**
|
|
40547
|
+
* Returns the nearest line for a given point by the distance to the
|
|
40548
|
+
* closest point on each (clamped) line segment.
|
|
40549
|
+
*
|
|
40550
|
+
* @param {Point} point
|
|
40551
|
+
* @param {Line[]} lines
|
|
40552
|
+
*
|
|
40553
|
+
* @return {Line}
|
|
40554
|
+
*/
|
|
40555
|
+
function getNearestLine(point, lines) {
|
|
40556
|
+
|
|
40557
|
+
var distances = lines.map(function(line) {
|
|
40558
|
+
return {
|
|
40559
|
+
line: line,
|
|
40560
|
+
distance: getDistancePointPoint(point, getClosestPointOnLine(point, line))
|
|
40561
|
+
};
|
|
40562
|
+
});
|
|
40563
|
+
|
|
40564
|
+
var sorted = sortBy(distances, 'distance');
|
|
40565
|
+
|
|
40566
|
+
return sorted[0].line;
|
|
40567
|
+
}
|
|
40568
|
+
|
|
40569
|
+
/**
|
|
40570
|
+
* Returns the point on a line segment that is closest to the given point,
|
|
40571
|
+
* clamped to the segment's start and end.
|
|
40572
|
+
*
|
|
40573
|
+
* @param {Point} point
|
|
40574
|
+
* @param {Line} line
|
|
40575
|
+
*
|
|
40576
|
+
* @return {Point}
|
|
40577
|
+
*/
|
|
40578
|
+
function getClosestPointOnLine(point, line) {
|
|
40579
|
+
var start = line[0],
|
|
40580
|
+
end = line[1];
|
|
40581
|
+
|
|
40582
|
+
var dx = end.x - start.x,
|
|
40583
|
+
dy = end.y - start.y;
|
|
40584
|
+
|
|
40585
|
+
var lengthSquared = dx * dx + dy * dy;
|
|
40586
|
+
|
|
40587
|
+
if (lengthSquared === 0) {
|
|
40588
|
+
return { x: start.x, y: start.y };
|
|
40589
|
+
}
|
|
40590
|
+
|
|
40591
|
+
var t = ((point.x - start.x) * dx + (point.y - start.y) * dy) / lengthSquared;
|
|
40592
|
+
|
|
40593
|
+
t = Math.max(0, Math.min(1, t));
|
|
40594
|
+
|
|
40595
|
+
return {
|
|
40596
|
+
x: start.x + t * dx,
|
|
40597
|
+
y: start.y + t * dy
|
|
40598
|
+
};
|
|
40599
|
+
}
|
|
40600
|
+
|
|
40445
40601
|
var NAME_PROPERTY = 'name';
|
|
40446
40602
|
var TEXT_PROPERTY = 'text';
|
|
40447
40603
|
|
|
@@ -40696,99 +40852,6 @@
|
|
|
40696
40852
|
return roundPoint(delta(newReferencePoint, referencePoint));
|
|
40697
40853
|
}
|
|
40698
40854
|
|
|
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
40855
|
/**
|
|
40793
40856
|
* @typedef {import('diagram-js/lib/util/Types').Point} Point
|
|
40794
40857
|
*
|
|
@@ -62812,6 +62875,24 @@
|
|
|
62812
62875
|
];
|
|
62813
62876
|
|
|
62814
62877
|
|
|
62878
|
+
/**
|
|
62879
|
+
* The keyboard binding for each editor action: the `key` that triggers it,
|
|
62880
|
+
* optionally requiring the `cmd` modifier (CTRL/CMD).
|
|
62881
|
+
*
|
|
62882
|
+
* @type {Record<string, { key: string, modifier?: 'cmd' }>}
|
|
62883
|
+
*/
|
|
62884
|
+
var SHORTCUTS_KEY_BINDINGS = {
|
|
62885
|
+
selectElements: { key: 'A', modifier: 'cmd' },
|
|
62886
|
+
find: { key: 'F', modifier: 'cmd' },
|
|
62887
|
+
spaceTool: { key: 'S' },
|
|
62888
|
+
lassoTool: { key: 'L' },
|
|
62889
|
+
handTool: { key: 'H' },
|
|
62890
|
+
globalConnectTool: { key: 'C' },
|
|
62891
|
+
directEditing: { key: 'E' },
|
|
62892
|
+
replaceElement: { key: 'R' }
|
|
62893
|
+
};
|
|
62894
|
+
|
|
62895
|
+
|
|
62815
62896
|
/**
|
|
62816
62897
|
* Register available keyboard bindings.
|
|
62817
62898
|
*
|
|
@@ -62823,146 +62904,35 @@
|
|
|
62823
62904
|
// inherit default bindings
|
|
62824
62905
|
KeyboardBindings.prototype.registerBindings.call(this, keyboard, editorActions);
|
|
62825
62906
|
|
|
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) {
|
|
62843
|
-
|
|
62844
|
-
var event = context.keyEvent;
|
|
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)) {
|
|
62873
|
-
return;
|
|
62874
|
-
}
|
|
62875
|
-
|
|
62876
|
-
if (keyboard.isKey([ 's', 'S' ], event)) {
|
|
62877
|
-
editorActions.trigger('spaceTool');
|
|
62878
|
-
|
|
62879
|
-
return true;
|
|
62880
|
-
}
|
|
62881
|
-
});
|
|
62882
|
-
|
|
62883
|
-
// activate lasso tool
|
|
62884
|
-
// L
|
|
62885
|
-
addListener('lassoTool', function(context) {
|
|
62886
|
-
|
|
62887
|
-
var event = context.keyEvent;
|
|
62888
|
-
|
|
62889
|
-
if (keyboard.hasModifier(event)) {
|
|
62890
|
-
return;
|
|
62891
|
-
}
|
|
62892
|
-
|
|
62893
|
-
if (keyboard.isKey([ 'l', 'L' ], event)) {
|
|
62894
|
-
editorActions.trigger('lassoTool');
|
|
62895
|
-
|
|
62896
|
-
return true;
|
|
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) {
|
|
62907
|
+
forEach(SHORTCUTS_KEY_BINDINGS, function(binding, action) {
|
|
62920
62908
|
|
|
62921
|
-
|
|
62922
|
-
|
|
62923
|
-
if (keyboard.hasModifier(event)) {
|
|
62909
|
+
if (!editorActions.isRegistered(action)) {
|
|
62924
62910
|
return;
|
|
62925
62911
|
}
|
|
62926
62912
|
|
|
62927
|
-
|
|
62928
|
-
|
|
62913
|
+
var keys = [ binding.key.toLowerCase(), binding.key.toUpperCase() ],
|
|
62914
|
+
requiresCmd = binding.modifier === 'cmd';
|
|
62929
62915
|
|
|
62930
|
-
|
|
62931
|
-
}
|
|
62932
|
-
});
|
|
62933
|
-
|
|
62934
|
-
// activate direct editing
|
|
62935
|
-
// E
|
|
62936
|
-
addListener('directEditing', function(context) {
|
|
62916
|
+
keyboard.addListener(function(context) {
|
|
62937
62917
|
|
|
62938
|
-
|
|
62918
|
+
var event = context.keyEvent;
|
|
62939
62919
|
|
|
62940
|
-
|
|
62941
|
-
|
|
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;
|
|
62920
|
+
if (!keyboard.isKey(keys, event)) {
|
|
62921
|
+
return;
|
|
62922
|
+
}
|
|
62956
62923
|
|
|
62957
|
-
|
|
62958
|
-
|
|
62959
|
-
|
|
62924
|
+
if (requiresCmd) {
|
|
62925
|
+
if (!keyboard.isCmd(event)) {
|
|
62926
|
+
return;
|
|
62927
|
+
}
|
|
62928
|
+
} else if (keyboard.hasModifier(event)) {
|
|
62929
|
+
return;
|
|
62930
|
+
}
|
|
62960
62931
|
|
|
62961
|
-
|
|
62962
|
-
editorActions.trigger('replaceElement', event);
|
|
62932
|
+
editorActions.trigger(action, event);
|
|
62963
62933
|
|
|
62964
62934
|
return true;
|
|
62965
|
-
}
|
|
62935
|
+
});
|
|
62966
62936
|
});
|
|
62967
62937
|
|
|
62968
62938
|
};
|
|
@@ -64782,9 +64752,17 @@
|
|
|
64782
64752
|
*/
|
|
64783
64753
|
function createLink(label, target) {
|
|
64784
64754
|
|
|
64785
|
-
|
|
64755
|
+
const labelMid = getMid(label);
|
|
64756
|
+
|
|
64757
|
+
// For connections, aim at the closest point on the visible connection
|
|
64758
|
+
// instead of the geometric mid point of the whole connection.
|
|
64759
|
+
const targetReference = isConnection(target)
|
|
64760
|
+
? getReferencePoint$1(labelMid, asLines(target.waypoints))
|
|
64761
|
+
: getMid(target);
|
|
64762
|
+
|
|
64763
|
+
// Create an auxiliary line between label and target reference points
|
|
64786
64764
|
const line = createLine(
|
|
64787
|
-
[
|
|
64765
|
+
[ targetReference, labelMid ],
|
|
64788
64766
|
LINE_STYLE
|
|
64789
64767
|
);
|
|
64790
64768
|
const linePath = line.getAttribute('d');
|
|
@@ -64799,12 +64777,18 @@
|
|
|
64799
64777
|
return;
|
|
64800
64778
|
}
|
|
64801
64779
|
|
|
64802
|
-
// Calculate the intersection point between line and
|
|
64803
|
-
//
|
|
64804
|
-
//
|
|
64805
|
-
|
|
64806
|
-
|
|
64807
|
-
|
|
64780
|
+
// Calculate the intersection point between line and target.
|
|
64781
|
+
// For connections there is no shape to intersect, so we link to the
|
|
64782
|
+
// closest point on the connection computed above.
|
|
64783
|
+
let targetInter;
|
|
64784
|
+
|
|
64785
|
+
if (isConnection(target)) {
|
|
64786
|
+
targetInter = targetReference;
|
|
64787
|
+
} else {
|
|
64788
|
+
const targetSelected = selection.isSelected(target);
|
|
64789
|
+
const targetPath = targetSelected ? getElementOutlinePath(target) : getElementPath(target);
|
|
64790
|
+
targetInter = getElementLineIntersection(targetPath, linePath) || getMid(target);
|
|
64791
|
+
}
|
|
64808
64792
|
|
|
64809
64793
|
// Do not draw a link if the points are too close
|
|
64810
64794
|
const distance = getDistancePointPoint(targetInter, labelInter);
|
|
@@ -65873,6 +65857,147 @@
|
|
|
65873
65857
|
movePreview: [ 'type', MovePreview ]
|
|
65874
65858
|
};
|
|
65875
65859
|
|
|
65860
|
+
/**
|
|
65861
|
+
* @typedef {import('../../core/Canvas').default} Canvas
|
|
65862
|
+
*/
|
|
65863
|
+
|
|
65864
|
+
const SHOW_DELAY = 300;
|
|
65865
|
+
|
|
65866
|
+
/**
|
|
65867
|
+
* @typedef { import('@bpmn-io/diagram-js-ui').VNode } VNode
|
|
65868
|
+
*
|
|
65869
|
+
* @typedef { {
|
|
65870
|
+
* x: number;
|
|
65871
|
+
* y: number;
|
|
65872
|
+
* placement?: string;
|
|
65873
|
+
* } } HoverTooltipPosition
|
|
65874
|
+
*
|
|
65875
|
+
* @typedef { {
|
|
65876
|
+
* container: HTMLElement;
|
|
65877
|
+
* selector: string;
|
|
65878
|
+
* getContent: (target: HTMLElement) => VNode | null;
|
|
65879
|
+
* getPosition: (target: HTMLElement) => HoverTooltipPosition;
|
|
65880
|
+
* showDelay?: number;
|
|
65881
|
+
* } } HoverTooltipConfig
|
|
65882
|
+
*/
|
|
65883
|
+
|
|
65884
|
+
/**
|
|
65885
|
+
* Shows a styled tooltip when hovering UI controls such as palette or
|
|
65886
|
+
* context pad entries. Reusable across features; a consumer registers a
|
|
65887
|
+
* hover source via #add and provides the rendered content.
|
|
65888
|
+
*
|
|
65889
|
+
* @param {Canvas} canvas
|
|
65890
|
+
*/
|
|
65891
|
+
function HoverTooltip(canvas) {
|
|
65892
|
+
this._canvas = canvas;
|
|
65893
|
+
|
|
65894
|
+
this._mount = null;
|
|
65895
|
+
this._current = null;
|
|
65896
|
+
this._showTimer = null;
|
|
65897
|
+
}
|
|
65898
|
+
|
|
65899
|
+
HoverTooltip.$inject = [ 'canvas' ];
|
|
65900
|
+
|
|
65901
|
+
/**
|
|
65902
|
+
* Register a hover source. Hovering a `selector` match inside `container`
|
|
65903
|
+
* shows a tooltip with the content and position provided by the callbacks.
|
|
65904
|
+
*
|
|
65905
|
+
* @param {HoverTooltipConfig} config
|
|
65906
|
+
*/
|
|
65907
|
+
HoverTooltip.prototype.add = function(config) {
|
|
65908
|
+
const {
|
|
65909
|
+
container,
|
|
65910
|
+
selector,
|
|
65911
|
+
showDelay = SHOW_DELAY
|
|
65912
|
+
} = config;
|
|
65913
|
+
|
|
65914
|
+
delegate.bind(container, selector, 'mouseover',
|
|
65915
|
+
(event) => this._show(event.delegateTarget, config, showDelay));
|
|
65916
|
+
|
|
65917
|
+
delegate.bind(container, selector, 'mouseout',
|
|
65918
|
+
(event) => {
|
|
65919
|
+
const { delegateTarget, relatedTarget } = event;
|
|
65920
|
+
|
|
65921
|
+
// ignore transitions to a child element of the same target
|
|
65922
|
+
if (relatedTarget && delegateTarget.contains(relatedTarget)) {
|
|
65923
|
+
return;
|
|
65924
|
+
}
|
|
65925
|
+
|
|
65926
|
+
this._hide();
|
|
65927
|
+
});
|
|
65928
|
+
};
|
|
65929
|
+
|
|
65930
|
+
HoverTooltip.prototype._show = function(target, config, showDelay) {
|
|
65931
|
+
const content = config.getContent(target);
|
|
65932
|
+
|
|
65933
|
+
if (!content) {
|
|
65934
|
+
return;
|
|
65935
|
+
}
|
|
65936
|
+
|
|
65937
|
+
this._current = {
|
|
65938
|
+
target,
|
|
65939
|
+
content,
|
|
65940
|
+
getPosition: config.getPosition
|
|
65941
|
+
};
|
|
65942
|
+
|
|
65943
|
+
clearTimeout(this._showTimer);
|
|
65944
|
+
|
|
65945
|
+
this._showTimer = setTimeout(() => this._render(), showDelay);
|
|
65946
|
+
};
|
|
65947
|
+
|
|
65948
|
+
HoverTooltip.prototype._hide = function() {
|
|
65949
|
+
clearTimeout(this._showTimer);
|
|
65950
|
+
|
|
65951
|
+
this._current = null;
|
|
65952
|
+
|
|
65953
|
+
this._render();
|
|
65954
|
+
};
|
|
65955
|
+
|
|
65956
|
+
HoverTooltip.prototype._render = function() {
|
|
65957
|
+
const mount = this._getMount();
|
|
65958
|
+
|
|
65959
|
+
if (!this._current) {
|
|
65960
|
+
R(null, mount);
|
|
65961
|
+
|
|
65962
|
+
return;
|
|
65963
|
+
}
|
|
65964
|
+
|
|
65965
|
+
const { target, content, getPosition } = this._current;
|
|
65966
|
+
|
|
65967
|
+
const { x, y, placement = 'right' } = getPosition(target);
|
|
65968
|
+
|
|
65969
|
+
const style = {
|
|
65970
|
+
left: `${ x }px`,
|
|
65971
|
+
top: `${ y }px`
|
|
65972
|
+
};
|
|
65973
|
+
|
|
65974
|
+
R(
|
|
65975
|
+
m$1`<div
|
|
65976
|
+
class="djs-hover-tooltip djs-hover-tooltip--${ placement }"
|
|
65977
|
+
style=${ style }
|
|
65978
|
+
>${ content }</div>`,
|
|
65979
|
+
mount
|
|
65980
|
+
);
|
|
65981
|
+
};
|
|
65982
|
+
|
|
65983
|
+
HoverTooltip.prototype._getMount = function() {
|
|
65984
|
+
if (!this._mount) {
|
|
65985
|
+
this._mount = domify('<div class="djs-hover-tooltip-container"></div>');
|
|
65986
|
+
|
|
65987
|
+
this._canvas.getContainer().appendChild(this._mount);
|
|
65988
|
+
}
|
|
65989
|
+
|
|
65990
|
+
return this._mount;
|
|
65991
|
+
};
|
|
65992
|
+
|
|
65993
|
+
/**
|
|
65994
|
+
* @type { import('didi').ModuleDeclaration }
|
|
65995
|
+
*/
|
|
65996
|
+
var HoverTooltipModule = {
|
|
65997
|
+
__init__: [ 'hoverTooltip' ],
|
|
65998
|
+
hoverTooltip: [ 'type', HoverTooltip ]
|
|
65999
|
+
};
|
|
66000
|
+
|
|
65876
66001
|
/**
|
|
65877
66002
|
* @typedef {import('../../core/Canvas.js').default} Canvas
|
|
65878
66003
|
* @typedef {import('../../core/EventBus.js').default} EventBus
|
|
@@ -66116,7 +66241,8 @@
|
|
|
66116
66241
|
attr$1(control, 'data-action', id);
|
|
66117
66242
|
|
|
66118
66243
|
if (entry.title) {
|
|
66119
|
-
attr$1(control, '
|
|
66244
|
+
attr$1(control, 'aria-label', entry.title);
|
|
66245
|
+
attr$1(control, 'role', 'button');
|
|
66120
66246
|
}
|
|
66121
66247
|
|
|
66122
66248
|
if (entry.className) {
|
|
@@ -66359,12 +66485,108 @@
|
|
|
66359
66485
|
return entries;
|
|
66360
66486
|
}
|
|
66361
66487
|
|
|
66488
|
+
/**
|
|
66489
|
+
* @typedef { {
|
|
66490
|
+
* title: string;
|
|
66491
|
+
* shortcut?: string;
|
|
66492
|
+
* } } PaletteTooltipProps
|
|
66493
|
+
*/
|
|
66494
|
+
|
|
66495
|
+
/**
|
|
66496
|
+
* Renders the content of a palette entry tooltip: the entry title and,
|
|
66497
|
+
* if provided, its keyboard shortcut.
|
|
66498
|
+
*
|
|
66499
|
+
* @param {PaletteTooltipProps} props
|
|
66500
|
+
*/
|
|
66501
|
+
function PaletteTooltipComponent(props) {
|
|
66502
|
+
const {
|
|
66503
|
+
title,
|
|
66504
|
+
shortcut
|
|
66505
|
+
} = props;
|
|
66506
|
+
|
|
66507
|
+
const shortcutNode = shortcut
|
|
66508
|
+
? m$1`<kbd class="djs-palette-tooltip-shortcut">${ shortcut }</kbd>`
|
|
66509
|
+
: null;
|
|
66510
|
+
|
|
66511
|
+
return m$1`
|
|
66512
|
+
<span class="djs-palette-tooltip-label">${ title }</span>
|
|
66513
|
+
${ shortcutNode }
|
|
66514
|
+
`;
|
|
66515
|
+
}
|
|
66516
|
+
|
|
66517
|
+
/**
|
|
66518
|
+
* @typedef {import('../../core/EventBus').default} EventBus
|
|
66519
|
+
* @typedef {import('./Palette').default} Palette
|
|
66520
|
+
* @typedef {import('../hover-tooltip/HoverTooltip').default} HoverTooltip
|
|
66521
|
+
*/
|
|
66522
|
+
|
|
66523
|
+
const PALETTE_ENTRY_SELECTOR = '.djs-palette-entries .entry';
|
|
66524
|
+
|
|
66525
|
+
const ENTRY_GAP = 8;
|
|
66526
|
+
|
|
66527
|
+
/**
|
|
66528
|
+
* Shows a hover tooltip for palette entries, displaying the entry `title`
|
|
66529
|
+
* and, if the entry provides one, its keyboard `shortcut`.
|
|
66530
|
+
*
|
|
66531
|
+
* @param {EventBus} eventBus
|
|
66532
|
+
* @param {Palette} palette
|
|
66533
|
+
* @param {HoverTooltip} hoverTooltip
|
|
66534
|
+
*/
|
|
66535
|
+
function PaletteTooltip(eventBus, palette, hoverTooltip) {
|
|
66536
|
+
this._palette = palette;
|
|
66537
|
+
this._hoverTooltip = hoverTooltip;
|
|
66538
|
+
|
|
66539
|
+
this._entries = {};
|
|
66540
|
+
|
|
66541
|
+
eventBus.on('palette.create', (event) => this._init(event.container));
|
|
66542
|
+
|
|
66543
|
+
eventBus.on('palette.changed', () => this._updateEntries());
|
|
66544
|
+
}
|
|
66545
|
+
|
|
66546
|
+
PaletteTooltip.$inject = [ 'eventBus', 'palette', 'hoverTooltip' ];
|
|
66547
|
+
|
|
66548
|
+
PaletteTooltip.prototype._init = function(container) {
|
|
66549
|
+
this._updateEntries();
|
|
66550
|
+
|
|
66551
|
+
this._hoverTooltip.add({
|
|
66552
|
+
container,
|
|
66553
|
+
selector: PALETTE_ENTRY_SELECTOR,
|
|
66554
|
+
getContent: (target) => {
|
|
66555
|
+
const entry = this._entries[ attr$1(target, 'data-action') ];
|
|
66556
|
+
|
|
66557
|
+
if (!entry || !entry.title) {
|
|
66558
|
+
return null;
|
|
66559
|
+
}
|
|
66560
|
+
|
|
66561
|
+
return m$1`<${PaletteTooltipComponent}
|
|
66562
|
+
title=${ entry.title }
|
|
66563
|
+
shortcut=${ entry.shortcut }
|
|
66564
|
+
/>`;
|
|
66565
|
+
},
|
|
66566
|
+
getPosition: (target) => {
|
|
66567
|
+
const bounds = target.getBoundingClientRect();
|
|
66568
|
+
|
|
66569
|
+
return {
|
|
66570
|
+
x: bounds.right + ENTRY_GAP,
|
|
66571
|
+
y: bounds.top + bounds.height / 2,
|
|
66572
|
+
placement: 'right'
|
|
66573
|
+
};
|
|
66574
|
+
}
|
|
66575
|
+
});
|
|
66576
|
+
};
|
|
66577
|
+
|
|
66578
|
+
PaletteTooltip.prototype._updateEntries = function() {
|
|
66579
|
+
this._entries = this._palette.getEntries();
|
|
66580
|
+
};
|
|
66581
|
+
|
|
66362
66582
|
/**
|
|
66363
66583
|
* @type { import('didi').ModuleDeclaration }
|
|
66364
66584
|
*/
|
|
66365
66585
|
var PaletteModule$1 = {
|
|
66366
|
-
|
|
66367
|
-
|
|
66586
|
+
__depends__: [ HoverTooltipModule ],
|
|
66587
|
+
__init__: [ 'palette', 'paletteTooltip' ],
|
|
66588
|
+
palette: [ 'type', Palette ],
|
|
66589
|
+
paletteTooltip: [ 'type', PaletteTooltip ]
|
|
66368
66590
|
};
|
|
66369
66591
|
|
|
66370
66592
|
/**
|
|
@@ -67258,6 +67480,7 @@
|
|
|
67258
67480
|
group: 'tools',
|
|
67259
67481
|
className: 'bpmn-icon-hand-tool',
|
|
67260
67482
|
title: translate('Activate hand tool'),
|
|
67483
|
+
shortcut: SHORTCUTS_KEY_BINDINGS.handTool.key,
|
|
67261
67484
|
action: {
|
|
67262
67485
|
click: function(event) {
|
|
67263
67486
|
handTool.activateHand(event);
|
|
@@ -67268,6 +67491,7 @@
|
|
|
67268
67491
|
group: 'tools',
|
|
67269
67492
|
className: 'bpmn-icon-lasso-tool',
|
|
67270
67493
|
title: translate('Activate lasso tool'),
|
|
67494
|
+
shortcut: SHORTCUTS_KEY_BINDINGS.lassoTool.key,
|
|
67271
67495
|
action: {
|
|
67272
67496
|
click: function(event) {
|
|
67273
67497
|
lassoTool.activateSelection(event);
|
|
@@ -67278,6 +67502,7 @@
|
|
|
67278
67502
|
group: 'tools',
|
|
67279
67503
|
className: 'bpmn-icon-space-tool',
|
|
67280
67504
|
title: translate('Activate create/remove space tool'),
|
|
67505
|
+
shortcut: SHORTCUTS_KEY_BINDINGS.spaceTool.key,
|
|
67281
67506
|
action: {
|
|
67282
67507
|
click: function(event) {
|
|
67283
67508
|
spaceTool.activateSelection(event);
|
|
@@ -67288,6 +67513,7 @@
|
|
|
67288
67513
|
group: 'tools',
|
|
67289
67514
|
className: 'bpmn-icon-connection-multi',
|
|
67290
67515
|
title: translate('Activate global connect tool'),
|
|
67516
|
+
shortcut: SHORTCUTS_KEY_BINDINGS.globalConnectTool.key,
|
|
67291
67517
|
action: {
|
|
67292
67518
|
click: function(event) {
|
|
67293
67519
|
globalConnect.start(event);
|