@aranzatech/diagrams-bpmn 0.3.1 → 0.3.2
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/{catalog-DAGDhO-D.d.cts → catalog-DG-sz0VM.d.cts} +1 -1
- package/dist/{catalog-Q1QmKLDD.d.ts → catalog-DNIyjHbl.d.ts} +1 -1
- package/dist/{chunk-334WN4JZ.js → chunk-NYIYQUGX.js} +104 -23
- package/dist/chunk-NYIYQUGX.js.map +1 -0
- package/dist/elements/index.d.cts +3 -3
- package/dist/elements/index.d.ts +3 -3
- package/dist/extensions/index.d.cts +2 -2
- package/dist/extensions/index.d.ts +2 -2
- package/dist/index.cjs +102 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/layout/index.cjs +60 -29
- package/dist/layout/index.cjs.map +1 -1
- package/dist/layout/index.d.cts +4 -4
- package/dist/layout/index.d.ts +4 -4
- package/dist/layout/index.js +60 -29
- package/dist/layout/index.js.map +1 -1
- package/dist/modeling/index.d.cts +4 -4
- package/dist/modeling/index.d.ts +4 -4
- package/dist/{types-CggktCqr.d.cts → types-CDp9kWQ4.d.cts} +2 -2
- package/dist/{types-DmDODKlh.d.ts → types-CuDL2YGL.d.ts} +2 -2
- package/dist/{types-D7zel9dq.d.ts → types-X5FyP8oS.d.ts} +1 -1
- package/dist/{types-BX_o95GC.d.cts → types-dQUuSnV5.d.cts} +1 -1
- package/dist/{types-BYN4Zuee.d.cts → types-nvF59RGF.d.cts} +12 -0
- package/dist/{types-BYN4Zuee.d.ts → types-nvF59RGF.d.ts} +12 -0
- package/dist/validation/index.d.cts +3 -3
- package/dist/validation/index.d.ts +3 -3
- package/dist/xml/index.cjs +102 -21
- package/dist/xml/index.cjs.map +1 -1
- package/dist/xml/index.d.cts +4 -4
- package/dist/xml/index.d.ts +4 -4
- package/dist/xml/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-334WN4JZ.js.map +0 -1
package/dist/layout/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { LayoutResult, LayoutOptions } from '@aranzatech/diagrams-core/types';
|
|
2
2
|
export { applyLayoutResultToDiagram } from '@aranzatech/diagrams-core/layout';
|
|
3
|
-
import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-
|
|
3
|
+
import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-CDp9kWQ4.cjs';
|
|
4
4
|
import { BpmnDiagramState } from '../modeling/index.cjs';
|
|
5
5
|
import '@xyflow/react';
|
|
6
|
-
import '../types-
|
|
7
|
-
import '../types-
|
|
6
|
+
import '../types-nvF59RGF.cjs';
|
|
7
|
+
import '../types-dQUuSnV5.cjs';
|
|
8
8
|
import '@aranzatech/diagrams-core';
|
|
9
9
|
import '@aranzatech/diagrams-core/serialization';
|
|
10
|
-
import '../catalog-
|
|
10
|
+
import '../catalog-DG-sz0VM.cjs';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* ELK-based auto-layout for BPMN diagrams.
|
package/dist/layout/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { LayoutResult, LayoutOptions } from '@aranzatech/diagrams-core/types';
|
|
2
2
|
export { applyLayoutResultToDiagram } from '@aranzatech/diagrams-core/layout';
|
|
3
|
-
import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-
|
|
3
|
+
import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-CuDL2YGL.js';
|
|
4
4
|
import { BpmnDiagramState } from '../modeling/index.js';
|
|
5
5
|
import '@xyflow/react';
|
|
6
|
-
import '../types-
|
|
7
|
-
import '../types-
|
|
6
|
+
import '../types-nvF59RGF.js';
|
|
7
|
+
import '../types-X5FyP8oS.js';
|
|
8
8
|
import '@aranzatech/diagrams-core';
|
|
9
9
|
import '@aranzatech/diagrams-core/serialization';
|
|
10
|
-
import '../catalog-
|
|
10
|
+
import '../catalog-DNIyjHbl.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* ELK-based auto-layout for BPMN diagrams.
|
package/dist/layout/index.js
CHANGED
|
@@ -249,17 +249,17 @@ function assignRows(nodes, forwardEdges, columns, gatewayPairs) {
|
|
|
249
249
|
|
|
250
250
|
// src/layout/bpmn-custom-layout.ts
|
|
251
251
|
var LANE_LABEL_W = 28;
|
|
252
|
-
var LANE_H_PAD =
|
|
253
|
-
var COL_GAP =
|
|
254
|
-
var ROW_HEIGHT =
|
|
255
|
-
var ROW_GAP =
|
|
256
|
-
var LANE_V_PAD =
|
|
257
|
-
var POOL_H_PAD =
|
|
258
|
-
var POOL_V_GAP =
|
|
259
|
-
var LANE_MIN_H =
|
|
260
|
-
var POOL_MIN_W =
|
|
252
|
+
var LANE_H_PAD = 32;
|
|
253
|
+
var COL_GAP = 60;
|
|
254
|
+
var ROW_HEIGHT = 90;
|
|
255
|
+
var ROW_GAP = 50;
|
|
256
|
+
var LANE_V_PAD = 48;
|
|
257
|
+
var POOL_H_PAD = 64;
|
|
258
|
+
var POOL_V_GAP = 48;
|
|
259
|
+
var LANE_MIN_H = 180;
|
|
260
|
+
var POOL_MIN_W = 720;
|
|
261
261
|
var POOL_INNER_PAD = 10;
|
|
262
|
-
var BACK_EDGE_CLEARANCE =
|
|
262
|
+
var BACK_EDGE_CLEARANCE = 56;
|
|
263
263
|
var LAYOUT_ARTIFACT_TYPES = /* @__PURE__ */ new Set([
|
|
264
264
|
"DataObject",
|
|
265
265
|
"DataObjectReference",
|
|
@@ -276,12 +276,38 @@ var COLLAPSED_SUBPROCESS_TYPES = /* @__PURE__ */ new Set([
|
|
|
276
276
|
"EventSubProcess",
|
|
277
277
|
"AdHocSubProcess"
|
|
278
278
|
]);
|
|
279
|
+
var LAYOUT_TASK_TYPES = /* @__PURE__ */ new Set([
|
|
280
|
+
"Task",
|
|
281
|
+
"UserTask",
|
|
282
|
+
"ServiceTask",
|
|
283
|
+
"ScriptTask",
|
|
284
|
+
"ManualTask",
|
|
285
|
+
"BusinessRuleTask",
|
|
286
|
+
"ReceiveTask",
|
|
287
|
+
"SendTask",
|
|
288
|
+
"CallActivity"
|
|
289
|
+
]);
|
|
290
|
+
var TASK_LAYOUT_MIN_W = 130;
|
|
291
|
+
var TASK_LAYOUT_MIN_H = 80;
|
|
279
292
|
function nW(node) {
|
|
280
293
|
return node.width ?? node.measured?.width ?? 120;
|
|
281
294
|
}
|
|
282
295
|
function nH(node) {
|
|
283
296
|
return node.height ?? node.measured?.height ?? 60;
|
|
284
297
|
}
|
|
298
|
+
function layoutW(node) {
|
|
299
|
+
return LAYOUT_TASK_TYPES.has(node.data.elementType) ? Math.max(nW(node), TASK_LAYOUT_MIN_W) : nW(node);
|
|
300
|
+
}
|
|
301
|
+
function layoutH(node) {
|
|
302
|
+
return LAYOUT_TASK_TYPES.has(node.data.elementType) ? Math.max(nH(node), TASK_LAYOUT_MIN_H) : nH(node);
|
|
303
|
+
}
|
|
304
|
+
function applyLayoutMinSize(node) {
|
|
305
|
+
if (!LAYOUT_TASK_TYPES.has(node.data.elementType)) return node;
|
|
306
|
+
const w = layoutW(node);
|
|
307
|
+
const h = layoutH(node);
|
|
308
|
+
if (w === nW(node) && h === nH(node)) return node;
|
|
309
|
+
return { ...node, width: w, height: h, measured: { width: w, height: h } };
|
|
310
|
+
}
|
|
285
311
|
var BOUNDARY_SPACING = 10;
|
|
286
312
|
function repositionBoundaryEvents(boundaryEvents, positionedContent) {
|
|
287
313
|
if (boundaryEvents.length === 0) return [];
|
|
@@ -307,8 +333,8 @@ function repositionBoundaryEvents(boundaryEvents, positionedContent) {
|
|
|
307
333
|
}
|
|
308
334
|
const hostGroup = byHost.get(hostId);
|
|
309
335
|
const siblingIdx = hostGroup.findIndex((n) => n.id === be.id);
|
|
310
|
-
const hostW =
|
|
311
|
-
const hostH =
|
|
336
|
+
const hostW = layoutW(host);
|
|
337
|
+
const hostH = layoutH(host);
|
|
312
338
|
const beH = nH(be);
|
|
313
339
|
const totalGroupW = hostGroup.reduce((s, b) => s + nW(b), 0) + (hostGroup.length - 1) * BOUNDARY_SPACING;
|
|
314
340
|
const groupStartX = host.position.x + hostW / 2 - totalGroupW / 2;
|
|
@@ -349,7 +375,7 @@ function layoutSubProcess(children, edges) {
|
|
|
349
375
|
for (let c = 0; c <= maxCol; c++) colW.set(c, 0);
|
|
350
376
|
for (const node of mainChildren) {
|
|
351
377
|
const c = columns.get(node.id) ?? 0;
|
|
352
|
-
colW.set(c, Math.max(colW.get(c) ?? 0,
|
|
378
|
+
colW.set(c, Math.max(colW.get(c) ?? 0, layoutW(node)));
|
|
353
379
|
}
|
|
354
380
|
const colX = /* @__PURE__ */ new Map();
|
|
355
381
|
let cumX = 0;
|
|
@@ -368,12 +394,11 @@ function layoutSubProcess(children, edges) {
|
|
|
368
394
|
const positionedChildren = mainChildren.map((node) => {
|
|
369
395
|
const c = columns.get(node.id) ?? 0;
|
|
370
396
|
const r = rows.get(node.id) ?? 0;
|
|
371
|
-
const
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
};
|
|
397
|
+
const lw = layoutW(node);
|
|
398
|
+
const lh = layoutH(node);
|
|
399
|
+
const colOffset = (colX.get(c) ?? 0) + (colW.get(c) ?? 120) / 2 - lw / 2;
|
|
400
|
+
const rowOffset = (r - minRow) * (ROW_HEIGHT + ROW_GAP) + ROW_HEIGHT / 2 - lh / 2;
|
|
401
|
+
return applyLayoutMinSize({ ...node, position: { x: SP_PAD + colOffset, y: SP_PAD + rowOffset } });
|
|
377
402
|
});
|
|
378
403
|
const positionedBoundaries = repositionBoundaryEvents(boundaryEvents, positionedChildren);
|
|
379
404
|
return {
|
|
@@ -406,8 +431,7 @@ function layoutPool(pool, lanes, content, allEdges) {
|
|
|
406
431
|
height: h
|
|
407
432
|
};
|
|
408
433
|
}
|
|
409
|
-
const
|
|
410
|
-
const sortedLanes = lanePositionsDistinct ? [...lanes].sort((a, b) => a.position.y - b.position.y) : [...lanes];
|
|
434
|
+
const sortedLanes = [...lanes].sort((a, b) => a.position.y - b.position.y);
|
|
411
435
|
const hasLanes = sortedLanes.length > 0;
|
|
412
436
|
const laneIdSet = new Set(sortedLanes.map((l) => l.id));
|
|
413
437
|
const nodeLaneId = /* @__PURE__ */ new Map();
|
|
@@ -456,7 +480,7 @@ function layoutPool(pool, lanes, content, allEdges) {
|
|
|
456
480
|
for (let c = 0; c <= maxCol; c++) colW.set(c, 0);
|
|
457
481
|
for (const node of mainContent) {
|
|
458
482
|
const c = columns.get(node.id) ?? 0;
|
|
459
|
-
colW.set(c, Math.max(colW.get(c) ?? 0,
|
|
483
|
+
colW.set(c, Math.max(colW.get(c) ?? 0, layoutW(node)));
|
|
460
484
|
}
|
|
461
485
|
const colX = /* @__PURE__ */ new Map();
|
|
462
486
|
let cumX = 0;
|
|
@@ -483,14 +507,16 @@ function layoutPool(pool, lanes, content, allEdges) {
|
|
|
483
507
|
const laneId = nodeLaneId.get(node.id) ?? "_pool_";
|
|
484
508
|
const stat = laneStats.get(laneId);
|
|
485
509
|
const lYOff = laneY.get(laneId) ?? 0;
|
|
486
|
-
const
|
|
487
|
-
const
|
|
510
|
+
const lw = layoutW(node);
|
|
511
|
+
const lh = layoutH(node);
|
|
512
|
+
const colOffset = (colX.get(c) ?? 0) + (colW.get(c) ?? 120) / 2 - lw / 2;
|
|
513
|
+
const rowOffset = (r - stat.minRow) * (ROW_HEIGHT + ROW_GAP) + ROW_HEIGHT / 2 - lh / 2;
|
|
488
514
|
const contentH_stat = stat.rowCount * ROW_HEIGHT + Math.max(0, stat.rowCount - 1) * ROW_GAP;
|
|
489
515
|
const vertTopOffset = Math.max(LANE_V_PAD, (stat.height - contentH_stat) / 2);
|
|
490
516
|
const isLaneChild = hasLanes && !!node.parentId && node.parentId !== pool.id;
|
|
491
517
|
const x = isLaneChild ? LANE_LABEL_W + LANE_H_PAD + colOffset : POOL_H_PAD + colOffset;
|
|
492
518
|
const y = isLaneChild ? vertTopOffset + rowOffset : lYOff + vertTopOffset + rowOffset;
|
|
493
|
-
return { ...node, position: { x, y } };
|
|
519
|
+
return applyLayoutMinSize({ ...node, position: { x, y } });
|
|
494
520
|
});
|
|
495
521
|
const NODE_MIN_GAP = 24;
|
|
496
522
|
const resolvedContent = [...positionedContent];
|
|
@@ -499,13 +525,13 @@ function layoutPool(pool, lanes, content, allEdges) {
|
|
|
499
525
|
for (let k = 1; k < laneNodeIndices.length; k++) {
|
|
500
526
|
const prev = resolvedContent[laneNodeIndices[k - 1].i];
|
|
501
527
|
const curr = resolvedContent[laneNodeIndices[k].i];
|
|
502
|
-
const prevBottom = prev.position.y +
|
|
528
|
+
const prevBottom = prev.position.y + layoutH(prev);
|
|
503
529
|
const currTop = curr.position.y;
|
|
504
530
|
const prevTop = prev.position.y;
|
|
505
|
-
const currBottom = curr.position.y +
|
|
531
|
+
const currBottom = curr.position.y + layoutH(curr);
|
|
506
532
|
const yOverlap = prevBottom + NODE_MIN_GAP > currTop && currBottom + NODE_MIN_GAP > prevTop;
|
|
507
533
|
if (!yOverlap) continue;
|
|
508
|
-
const prevRight = prev.position.x +
|
|
534
|
+
const prevRight = prev.position.x + layoutW(prev);
|
|
509
535
|
if (prevRight + NODE_MIN_GAP > curr.position.x) {
|
|
510
536
|
resolvedContent[laneNodeIndices[k].i] = {
|
|
511
537
|
...curr,
|
|
@@ -550,6 +576,11 @@ function gapMidX(sAbs, sW, tAbs, tW) {
|
|
|
550
576
|
const rightLeftEdge = Math.max(sAbs.x, tAbs.x);
|
|
551
577
|
return leftRightEdge < rightLeftEdge ? (leftRightEdge + rightLeftEdge) / 2 : sAbs.x + sW / 2;
|
|
552
578
|
}
|
|
579
|
+
function routeMidX(sAbs, sW, tAbs, tW) {
|
|
580
|
+
const leftEdge = Math.min(sAbs.x + sW, tAbs.x + tW);
|
|
581
|
+
const rightEdge = Math.max(sAbs.x, tAbs.x);
|
|
582
|
+
return leftEdge < rightEdge ? leftEdge + (rightEdge - leftEdge) * 0.35 : sAbs.x + sW / 2;
|
|
583
|
+
}
|
|
553
584
|
var SAME_ROW_THRESHOLD = 15;
|
|
554
585
|
function routeEdges(edges, layoutNodes, backEdgeIds, laneIds, poolIds) {
|
|
555
586
|
const byId = new Map(layoutNodes.map((n) => [n.id, n]));
|
|
@@ -661,7 +692,7 @@ function routeEdges(edges, layoutNodes, backEdgeIds, laneIds, poolIds) {
|
|
|
661
692
|
{ x: tCX, y: exitsTop ? tAbs.y + tH : tAbs.y }
|
|
662
693
|
];
|
|
663
694
|
} else {
|
|
664
|
-
const midX =
|
|
695
|
+
const midX = routeMidX(sAbs, sW, tAbs, tW);
|
|
665
696
|
routingPoints = [
|
|
666
697
|
{ x: sAbs.x + sW, y: sCY },
|
|
667
698
|
{ x: midX, y: sCY },
|