@bpmnkit/core 1.16.0 → 1.17.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/bpmn/auto-layout.d.ts +0 -8
- package/dist/bpmn/auto-layout.js +432 -59
- package/dist/bpmn/make-room.js +114 -0
- package/dist/bpmn/place-new-shapes.js +4 -2
- package/dist/layout/collaboration/crossings.d.ts +13 -0
- package/dist/layout/collaboration/crossings.js +37 -0
- package/dist/layout/collaboration/docked-labels.d.ts +21 -0
- package/dist/layout/collaboration/docked-labels.js +65 -0
- package/dist/layout/collaboration/message-tracks.d.ts +20 -0
- package/dist/layout/collaboration/message-tracks.js +78 -0
- package/dist/layout/collaboration/stack-crossings.d.ts +38 -0
- package/dist/layout/collaboration/stack-crossings.js +155 -0
- package/dist/layout/grid/edge-labels.js +21 -10
- package/dist/layout/layered/coords.d.ts +13 -0
- package/dist/layout/layered/coords.js +211 -0
- package/dist/layout/layered/index.d.ts +21 -0
- package/dist/layout/layered/index.js +288 -0
- package/dist/layout/layered/layers.d.ts +60 -0
- package/dist/layout/layered/layers.js +374 -0
- package/dist/layout/layered/route.d.ts +66 -0
- package/dist/layout/layered/route.js +369 -0
- package/dist/layout/layout-engine.d.ts +6 -2
- package/dist/layout/layout-engine.js +4 -2
- package/dist/layout/semantic/bands.js +8 -2
- package/dist/layout/semantic/graph.d.ts +33 -1
- package/dist/layout/semantic/graph.js +200 -4
- package/dist/layout/semantic/index.d.ts +8 -2
- package/dist/layout/semantic/index.js +114 -14
- package/dist/layout/semantic/lanes.d.ts +40 -0
- package/dist/layout/semantic/lanes.js +198 -0
- package/dist/layout/semantic/place.d.ts +44 -2
- package/dist/layout/semantic/place.js +220 -21
- package/dist/layout/semantic/route.js +35 -2
- package/dist/layout/types.d.ts +0 -8
- package/package.json +1 -1
|
@@ -82,6 +82,13 @@ export function routeFlows(graph, flows, bounds, bandLayout, gutterX) {
|
|
|
82
82
|
};
|
|
83
83
|
const routed = new Map();
|
|
84
84
|
const pending = [];
|
|
85
|
+
// A boundary handler leaving a host has to get past the host's column; a
|
|
86
|
+
// join template from that column would close the row it passes through.
|
|
87
|
+
const handlerRanks = new Set();
|
|
88
|
+
for (const [host, events] of graph.attachers) {
|
|
89
|
+
if (events.length > 0)
|
|
90
|
+
handlerRanks.add(graph.ranks.get(host) ?? -1);
|
|
91
|
+
}
|
|
85
92
|
for (const flow of flows) {
|
|
86
93
|
const source = bounds.get(flow.sourceRef);
|
|
87
94
|
const target = bounds.get(flow.targetRef);
|
|
@@ -95,7 +102,9 @@ export function routeFlows(graph, flows, bounds, bandLayout, gutterX) {
|
|
|
95
102
|
? []
|
|
96
103
|
: fromBoundary
|
|
97
104
|
? fromBoundaryCandidates(ctx, source, bounds.get(hostOf(graph, flow.sourceRef)), target, targetRank)
|
|
98
|
-
: forwardCandidates(ctx, source, target, sourceRank, targetRank)
|
|
105
|
+
: forwardCandidates(ctx, source, target, sourceRank, targetRank, isJoinGateway(graph, flow.targetRef) &&
|
|
106
|
+
!isSplitGateway(graph, flow.sourceRef) &&
|
|
107
|
+
!handlerRanks.has(sourceRank ?? -1));
|
|
99
108
|
const clear = pick(direct, ctx, flow.sourceRef, flow.targetRef);
|
|
100
109
|
if (clear && clear.crossings <= CROSSING_TOLERANCE) {
|
|
101
110
|
commit(ctx, routed, flow, clear.waypoints);
|
|
@@ -195,6 +204,19 @@ function commit(ctx, routed, flow, waypoints) {
|
|
|
195
204
|
}
|
|
196
205
|
}
|
|
197
206
|
}
|
|
207
|
+
const GATEWAYS = new Set([
|
|
208
|
+
"exclusiveGateway",
|
|
209
|
+
"parallelGateway",
|
|
210
|
+
"inclusiveGateway",
|
|
211
|
+
"eventBasedGateway",
|
|
212
|
+
"complexGateway",
|
|
213
|
+
]);
|
|
214
|
+
function isJoinGateway(graph, id) {
|
|
215
|
+
return GATEWAYS.has(graph.byId.get(id)?.type ?? "") && (graph.incoming.get(id) ?? []).length > 1;
|
|
216
|
+
}
|
|
217
|
+
function isSplitGateway(graph, id) {
|
|
218
|
+
return GATEWAYS.has(graph.byId.get(id)?.type ?? "") && (graph.outgoing.get(id) ?? []).length > 1;
|
|
219
|
+
}
|
|
198
220
|
function hostOf(graph, eventId) {
|
|
199
221
|
for (const [hostId, events] of graph.attachers) {
|
|
200
222
|
if (events.some((e) => e.id === eventId))
|
|
@@ -307,7 +329,9 @@ function blocked(ctx, waypoints, sourceId, targetId) {
|
|
|
307
329
|
* Candidates for a normal forward flow, best first: a straight spine segment,
|
|
308
330
|
* a branch leaving through the source's top or bottom, then the gutter turn.
|
|
309
331
|
*/
|
|
310
|
-
function forwardCandidates(ctx, source, target, sourceRank, targetRank
|
|
332
|
+
function forwardCandidates(ctx, source, target, sourceRank, targetRank,
|
|
333
|
+
/** The target is a join gateway reached from something other than a split. */
|
|
334
|
+
intoJoin = false) {
|
|
311
335
|
const from = centre(source);
|
|
312
336
|
const to = centre(target);
|
|
313
337
|
const rightOf = target.x >= source.x + source.width;
|
|
@@ -367,6 +391,15 @@ function forwardCandidates(ctx, source, target, sourceRank, targetRank) {
|
|
|
367
391
|
{ x: target.x, y: to.y },
|
|
368
392
|
],
|
|
369
393
|
];
|
|
394
|
+
// A join is reached the way its split was left, mirrored: along the
|
|
395
|
+
// branch's own row, then up or down into the gateway at its centre-x.
|
|
396
|
+
if (intoJoin) {
|
|
397
|
+
candidates.unshift([
|
|
398
|
+
{ x: source.x + source.width, y: from.y },
|
|
399
|
+
{ x: to.x, y: from.y },
|
|
400
|
+
{ x: to.x, y: down ? target.y : target.y + target.height },
|
|
401
|
+
]);
|
|
402
|
+
}
|
|
370
403
|
// Turning in the gutter right behind the source instead reaches the target
|
|
371
404
|
// band early; which of the two crosses less depends on what is already
|
|
372
405
|
// routed, so both are offered.
|
package/dist/layout/types.d.ts
CHANGED
|
@@ -63,14 +63,6 @@ export interface LayoutEdge {
|
|
|
63
63
|
/** Label bounds for overlap checking. */
|
|
64
64
|
labelBounds?: Bounds;
|
|
65
65
|
}
|
|
66
|
-
/** Result of laying out a sub-process's children, linked to its parent. */
|
|
67
|
-
export interface SubProcessChildResult {
|
|
68
|
-
parentId: string;
|
|
69
|
-
result: LayoutResult;
|
|
70
|
-
/** Subprocess position at the time children were translated to absolute coordinates. */
|
|
71
|
-
parentX: number;
|
|
72
|
-
parentY: number;
|
|
73
|
-
}
|
|
74
66
|
/** How the unconnected children of an ad-hoc sub-process are arranged in their grid. */
|
|
75
67
|
export interface GridHint {
|
|
76
68
|
/** Columns in the grid; defaults to `ceil(sqrt(n))`. */
|