@aranzatech/diagrams-bpmn 0.3.1 → 0.3.3
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 +241 -95
- 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 +241 -95
- 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/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from './catalog-
|
|
1
|
+
export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from './catalog-DG-sz0VM.cjs';
|
|
2
2
|
export { GetAllowedEventTriggersOptions, acceptsBoundaryEvents, getAllowedEventTriggers, getHandlePolicy, getOrientation, isChoreographyType, isContainerType, isConversationType, isDataType, isEventType, isGatewayType, isTaskType, supportsCollapse, supportsMarkers } from './elements/index.cjs';
|
|
3
|
-
export { B as BpmnCategory, a as BpmnDefinitionsSet, b as BpmnEdgeData, c as BpmnEdgeType, d as BpmnElementMeta, e as BpmnElementSize, f as BpmnElementType, g as BpmnErrorDefinition, h as BpmnEscalationDefinition, i as BpmnEventDefinition, j as BpmnEventSemantics, k as BpmnHandlePolicy, l as BpmnMessageDefinition, m as BpmnNodeData, n as BpmnOrientation, o as BpmnProcessVariable, p as BpmnServiceTaskConfig, q as BpmnSignalDefinition, r as BpmnTimerDefinition, s as BpmnTimerKind, E as EventTrigger, S as SubProcessVariant, T as TaskMarker } from './types-
|
|
3
|
+
export { B as BpmnCategory, a as BpmnDefinitionsSet, b as BpmnEdgeData, c as BpmnEdgeType, d as BpmnElementMeta, e as BpmnElementSize, f as BpmnElementType, g as BpmnErrorDefinition, h as BpmnEscalationDefinition, i as BpmnEventDefinition, j as BpmnEventSemantics, k as BpmnHandlePolicy, l as BpmnMessageDefinition, m as BpmnNodeData, n as BpmnOrientation, o as BpmnProcessVariable, p as BpmnServiceTaskConfig, q as BpmnSignalDefinition, r as BpmnTimerDefinition, s as BpmnTimerKind, E as EventTrigger, S as SubProcessVariant, T as TaskMarker } from './types-nvF59RGF.cjs';
|
|
4
4
|
export { ARANZA_DESCRIPTOR } from './extensions/index.cjs';
|
|
5
|
-
export { B as BpmnAranzaTaskExtensions, a as BpmnExecutionEngine, b as BpmnFlowableExportOptions, c as BpmnFlowableTaskExtensions, d as BpmnMessageFlowExecutionExtensions, e as BpmnTaskExecutionExtensions, g as getBpmnMessageFlowExecutionExtensions, f as getBpmnTaskExecutionExtensions } from './types-
|
|
5
|
+
export { B as BpmnAranzaTaskExtensions, a as BpmnExecutionEngine, b as BpmnFlowableExportOptions, c as BpmnFlowableTaskExtensions, d as BpmnMessageFlowExecutionExtensions, e as BpmnTaskExecutionExtensions, g as getBpmnMessageFlowExecutionExtensions, f as getBpmnTaskExecutionExtensions } from './types-dQUuSnV5.cjs';
|
|
6
6
|
export { AnnotationNode, BPMN_NODE_TYPES, BoundaryEventNode, CallChoreographyNode, CallConversationNode, ChoreographyTaskNode, ConversationNode, DataInputNode, DataObjectNode, DataObjectReferenceNode, DataOutputNode, DataStoreNode, DataStoreReferenceNode, EndEventNode, GatewayNode, GroupNode, IntermediateCatchEventNode, IntermediateThrowEventNode, LaneNode, PoolNode, StartEventNode, SubChoreographyNode, SubConversationNode, SubProcessNode, TaskNode } from './nodes/index.cjs';
|
|
7
7
|
export { AssociationEdge, BPMN_EDGE_TYPES, ConversationLinkEdge, DataAssociationEdge, MessageFlowEdge, SequenceFlowEdge } from './edges/index.cjs';
|
|
8
8
|
export { parseBpmnXml, serializeBpmnXml } from './xml/index.cjs';
|
|
9
|
-
export { B as BpmnExportOptions, a as BpmnImportResult, b as BpmnProcessModel, c as BpmnRFEdge, d as BpmnRFNode } from './types-
|
|
9
|
+
export { B as BpmnExportOptions, a as BpmnImportResult, b as BpmnProcessModel, c as BpmnRFEdge, d as BpmnRFNode } from './types-CDp9kWQ4.cjs';
|
|
10
10
|
import { SimDiagram } from './simulation/index.cjs';
|
|
11
11
|
export { SimEdge, SimLogEntry, SimLogType, SimNode, SimStatus, SimToken, SimVariables, SimulationState, createSimulation, fire, getFireable, isCompleted, setVariable, tick } from './simulation/index.cjs';
|
|
12
12
|
export { BPMN_EDGE_CONNECTION_RULES, BPMN_MODELING_RULES, BPMN_POOL_LANE_LAYOUT, BPMN_POOL_LANE_STACK_LAYOUT, BPMN_ROUTABLE_EDGE_TYPES, BPMN_SELECTION_STYLE, BpmnBoundaryAttachment, BpmnClipboardState, BpmnConnectionResolution, BpmnConnectionRule, BpmnDiagramDocument, BpmnDiagramSnapshot, BpmnDiagramState, BpmnDropTargetResolution, BpmnEdgeLaneContext, BpmnEventBus, ConnectBpmnOptions, CreateBpmnNodeOptions, FindBpmnContainerAtOptions, GroupAsBpmnSubProcessOptions, MoveBpmnLaneOptions, PasteBpmnOptions, ReorderBpmnLaneOptions, ReparentBpmnNodeAtPositionOptions, ReparentBpmnNodeOptions, ReplaceBpmnNodeOptions, ResizeBpmnNodeByHandleOptions, ResizeBpmnNodeOptions, ResolveBpmnDropTargetOptions, RouteBpmnEdgeOptions, applyBpmnPoolLaneDimensionChange, attachBoundaryEventCommand, bpmnConnectionValidators, canContainBpmnElement, computeBpmnSmartGuides, connectBpmnCommand, copyBpmnElements, createBpmnDiagramDocument, createBpmnEventBus, createBpmnLayoutCache, createBpmnNode, createBpmnNodeCommand, deleteBpmnElementsCommand, deserializeBpmnDiagram, deserializeBpmnDiagramSnapshot, findBpmnContainerAt, getAppendedBpmnLaneFrame, getBoundaryEventAttachment, getBpmnDragHandleSelector, getBpmnEdgeLabelLayout, getBpmnEdgeLaneContext, getBpmnLaneIndexAtPosition, getBpmnNodeAbsolutePosition, getBpmnNodeCenter, getBpmnNodeSize, getBpmnNodeZIndex, getBpmnPoolLaneNodeMaxSize, getBpmnPoolLaneNodeMinSize, getBpmnPoolLanes, getBpmnPoolOrientation, getBpmnTabOrder, groupAsBpmnSubProcessCommand, inferBpmnEdgeType, isBpmnDroppableInContainer, isBpmnEdgeRoutingEditable, isBpmnProcessNode, layoutBpmnPoolLaneNodes, layoutBpmnPoolLaneNodesPreservingHeights, layoutBpmnPoolLanes, moveBpmnLaneCommand, parseBpmnDiagramDocument, pasteBpmnElementsCommand, persistBpmnHistory, reorderBpmnLane, reorderBpmnLaneAfterDrop, reorderBpmnLaneCommand, reorderBpmnPoolLaneAfterDropPreservingHeights, reparentBpmnNodeAtPosition, reparentBpmnNodeCommand, replaceBpmnNodeCommand, resizeBpmnNodeByHandleCommand, resizeBpmnNodeCommand, resolveBpmnConnection, resolveBpmnDropTarget, restoreBpmnHistory, routeBpmnEdgeCommand, runBpmnCommand, runBpmnCommands, selectBpmnElementsCommand, serializeBpmnDiagram, toBpmnRelativePosition, validateBpmnConnectionForEdgeType, withBpmnLayoutCache, withBpmnNodeZIndexes } from './modeling/index.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from './catalog-
|
|
1
|
+
export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from './catalog-DNIyjHbl.js';
|
|
2
2
|
export { GetAllowedEventTriggersOptions, acceptsBoundaryEvents, getAllowedEventTriggers, getHandlePolicy, getOrientation, isChoreographyType, isContainerType, isConversationType, isDataType, isEventType, isGatewayType, isTaskType, supportsCollapse, supportsMarkers } from './elements/index.js';
|
|
3
|
-
export { B as BpmnCategory, a as BpmnDefinitionsSet, b as BpmnEdgeData, c as BpmnEdgeType, d as BpmnElementMeta, e as BpmnElementSize, f as BpmnElementType, g as BpmnErrorDefinition, h as BpmnEscalationDefinition, i as BpmnEventDefinition, j as BpmnEventSemantics, k as BpmnHandlePolicy, l as BpmnMessageDefinition, m as BpmnNodeData, n as BpmnOrientation, o as BpmnProcessVariable, p as BpmnServiceTaskConfig, q as BpmnSignalDefinition, r as BpmnTimerDefinition, s as BpmnTimerKind, E as EventTrigger, S as SubProcessVariant, T as TaskMarker } from './types-
|
|
3
|
+
export { B as BpmnCategory, a as BpmnDefinitionsSet, b as BpmnEdgeData, c as BpmnEdgeType, d as BpmnElementMeta, e as BpmnElementSize, f as BpmnElementType, g as BpmnErrorDefinition, h as BpmnEscalationDefinition, i as BpmnEventDefinition, j as BpmnEventSemantics, k as BpmnHandlePolicy, l as BpmnMessageDefinition, m as BpmnNodeData, n as BpmnOrientation, o as BpmnProcessVariable, p as BpmnServiceTaskConfig, q as BpmnSignalDefinition, r as BpmnTimerDefinition, s as BpmnTimerKind, E as EventTrigger, S as SubProcessVariant, T as TaskMarker } from './types-nvF59RGF.js';
|
|
4
4
|
export { ARANZA_DESCRIPTOR } from './extensions/index.js';
|
|
5
|
-
export { B as BpmnAranzaTaskExtensions, a as BpmnExecutionEngine, b as BpmnFlowableExportOptions, c as BpmnFlowableTaskExtensions, d as BpmnMessageFlowExecutionExtensions, e as BpmnTaskExecutionExtensions, g as getBpmnMessageFlowExecutionExtensions, f as getBpmnTaskExecutionExtensions } from './types-
|
|
5
|
+
export { B as BpmnAranzaTaskExtensions, a as BpmnExecutionEngine, b as BpmnFlowableExportOptions, c as BpmnFlowableTaskExtensions, d as BpmnMessageFlowExecutionExtensions, e as BpmnTaskExecutionExtensions, g as getBpmnMessageFlowExecutionExtensions, f as getBpmnTaskExecutionExtensions } from './types-X5FyP8oS.js';
|
|
6
6
|
export { AnnotationNode, BPMN_NODE_TYPES, BoundaryEventNode, CallChoreographyNode, CallConversationNode, ChoreographyTaskNode, ConversationNode, DataInputNode, DataObjectNode, DataObjectReferenceNode, DataOutputNode, DataStoreNode, DataStoreReferenceNode, EndEventNode, GatewayNode, GroupNode, IntermediateCatchEventNode, IntermediateThrowEventNode, LaneNode, PoolNode, StartEventNode, SubChoreographyNode, SubConversationNode, SubProcessNode, TaskNode } from './nodes/index.js';
|
|
7
7
|
export { AssociationEdge, BPMN_EDGE_TYPES, ConversationLinkEdge, DataAssociationEdge, MessageFlowEdge, SequenceFlowEdge } from './edges/index.js';
|
|
8
8
|
export { parseBpmnXml, serializeBpmnXml } from './xml/index.js';
|
|
9
|
-
export { B as BpmnExportOptions, a as BpmnImportResult, b as BpmnProcessModel, c as BpmnRFEdge, d as BpmnRFNode } from './types-
|
|
9
|
+
export { B as BpmnExportOptions, a as BpmnImportResult, b as BpmnProcessModel, c as BpmnRFEdge, d as BpmnRFNode } from './types-CuDL2YGL.js';
|
|
10
10
|
import { SimDiagram } from './simulation/index.js';
|
|
11
11
|
export { SimEdge, SimLogEntry, SimLogType, SimNode, SimStatus, SimToken, SimVariables, SimulationState, createSimulation, fire, getFireable, isCompleted, setVariable, tick } from './simulation/index.js';
|
|
12
12
|
export { BPMN_EDGE_CONNECTION_RULES, BPMN_MODELING_RULES, BPMN_POOL_LANE_LAYOUT, BPMN_POOL_LANE_STACK_LAYOUT, BPMN_ROUTABLE_EDGE_TYPES, BPMN_SELECTION_STYLE, BpmnBoundaryAttachment, BpmnClipboardState, BpmnConnectionResolution, BpmnConnectionRule, BpmnDiagramDocument, BpmnDiagramSnapshot, BpmnDiagramState, BpmnDropTargetResolution, BpmnEdgeLaneContext, BpmnEventBus, ConnectBpmnOptions, CreateBpmnNodeOptions, FindBpmnContainerAtOptions, GroupAsBpmnSubProcessOptions, MoveBpmnLaneOptions, PasteBpmnOptions, ReorderBpmnLaneOptions, ReparentBpmnNodeAtPositionOptions, ReparentBpmnNodeOptions, ReplaceBpmnNodeOptions, ResizeBpmnNodeByHandleOptions, ResizeBpmnNodeOptions, ResolveBpmnDropTargetOptions, RouteBpmnEdgeOptions, applyBpmnPoolLaneDimensionChange, attachBoundaryEventCommand, bpmnConnectionValidators, canContainBpmnElement, computeBpmnSmartGuides, connectBpmnCommand, copyBpmnElements, createBpmnDiagramDocument, createBpmnEventBus, createBpmnLayoutCache, createBpmnNode, createBpmnNodeCommand, deleteBpmnElementsCommand, deserializeBpmnDiagram, deserializeBpmnDiagramSnapshot, findBpmnContainerAt, getAppendedBpmnLaneFrame, getBoundaryEventAttachment, getBpmnDragHandleSelector, getBpmnEdgeLabelLayout, getBpmnEdgeLaneContext, getBpmnLaneIndexAtPosition, getBpmnNodeAbsolutePosition, getBpmnNodeCenter, getBpmnNodeSize, getBpmnNodeZIndex, getBpmnPoolLaneNodeMaxSize, getBpmnPoolLaneNodeMinSize, getBpmnPoolLanes, getBpmnPoolOrientation, getBpmnTabOrder, groupAsBpmnSubProcessCommand, inferBpmnEdgeType, isBpmnDroppableInContainer, isBpmnEdgeRoutingEditable, isBpmnProcessNode, layoutBpmnPoolLaneNodes, layoutBpmnPoolLaneNodesPreservingHeights, layoutBpmnPoolLanes, moveBpmnLaneCommand, parseBpmnDiagramDocument, pasteBpmnElementsCommand, persistBpmnHistory, reorderBpmnLane, reorderBpmnLaneAfterDrop, reorderBpmnLaneCommand, reorderBpmnPoolLaneAfterDropPreservingHeights, reparentBpmnNodeAtPosition, reparentBpmnNodeCommand, replaceBpmnNodeCommand, resizeBpmnNodeByHandleCommand, resizeBpmnNodeCommand, resolveBpmnConnection, resolveBpmnDropTarget, restoreBpmnHistory, routeBpmnEdgeCommand, runBpmnCommand, runBpmnCommands, selectBpmnElementsCommand, serializeBpmnDiagram, toBpmnRelativePosition, validateBpmnConnectionForEdgeType, withBpmnLayoutCache, withBpmnNodeZIndexes } from './modeling/index.js';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { getAllowedEventTriggers } from './chunk-JEGYVEJO.js';
|
|
|
2
2
|
export { AnnotationNode, BPMN_NODE_TYPES, BoundaryEventNode, CallChoreographyNode, CallConversationNode, ChoreographyTaskNode, ConversationNode, DataInputNode, DataObjectNode, DataObjectReferenceNode, DataOutputNode, DataStoreNode, DataStoreReferenceNode, EndEventNode, GatewayNode, GroupNode, IntermediateCatchEventNode, IntermediateThrowEventNode, LaneNode, PoolNode, StartEventNode, SubChoreographyNode, SubConversationNode, SubProcessNode, TaskNode } from './chunk-X54NHLBA.js';
|
|
3
3
|
export { AssociationEdge, BPMN_EDGE_TYPES, ConversationLinkEdge, DataAssociationEdge, MessageFlowEdge, SequenceFlowEdge } from './chunk-CPFUQM6H.js';
|
|
4
4
|
import './chunk-PDTXM32P.js';
|
|
5
|
-
export { parseBpmnXml, serializeBpmnXml } from './chunk-
|
|
5
|
+
export { parseBpmnXml, serializeBpmnXml } from './chunk-NYIYQUGX.js';
|
|
6
6
|
import './chunk-77L6O76M.js';
|
|
7
7
|
export { ARANZA_DESCRIPTOR, getBpmnMessageFlowExecutionExtensions, getBpmnTaskExecutionExtensions } from './chunk-TB6V4S5N.js';
|
|
8
8
|
import { createSimulation, tick, getFireable, fire } from './chunk-M46UDUN3.js';
|
package/dist/layout/index.cjs
CHANGED
|
@@ -1197,6 +1197,17 @@ function detectGatewayPairs(nodes, forwardEdges) {
|
|
|
1197
1197
|
}
|
|
1198
1198
|
return pairs;
|
|
1199
1199
|
}
|
|
1200
|
+
function createSecondaryOffsets(count) {
|
|
1201
|
+
if (count <= 0) return [];
|
|
1202
|
+
const offsets = [];
|
|
1203
|
+
let step = 1;
|
|
1204
|
+
while (offsets.length < count) {
|
|
1205
|
+
offsets.push(-step);
|
|
1206
|
+
if (offsets.length < count) offsets.push(step);
|
|
1207
|
+
step++;
|
|
1208
|
+
}
|
|
1209
|
+
return offsets;
|
|
1210
|
+
}
|
|
1200
1211
|
function handleToRowBias(handle) {
|
|
1201
1212
|
if (!handle) return null;
|
|
1202
1213
|
if (handle.includes("top")) return -1;
|
|
@@ -1212,6 +1223,52 @@ function buildHandleMap(edges) {
|
|
|
1212
1223
|
}
|
|
1213
1224
|
return map;
|
|
1214
1225
|
}
|
|
1226
|
+
function pickMainBranch(branchData) {
|
|
1227
|
+
if (branchData.length === 0) return void 0;
|
|
1228
|
+
return [...branchData].sort((a, b) => {
|
|
1229
|
+
const aRight = a.bias === 0 ? 1 : 0;
|
|
1230
|
+
const bRight = b.bias === 0 ? 1 : 0;
|
|
1231
|
+
if (aRight !== bRight) return bRight - aRight;
|
|
1232
|
+
if (a.nodeIds.length !== b.nodeIds.length) return b.nodeIds.length - a.nodeIds.length;
|
|
1233
|
+
return a.start.localeCompare(b.start);
|
|
1234
|
+
})[0]?.start;
|
|
1235
|
+
}
|
|
1236
|
+
function resolveDirectionalRow(splitRow, preferredOffset, usedRows) {
|
|
1237
|
+
if (preferredOffset === 0 && !usedRows.has(splitRow)) return splitRow;
|
|
1238
|
+
const direction = preferredOffset < 0 ? -1 : 1;
|
|
1239
|
+
let distance = Math.max(1, Math.abs(preferredOffset));
|
|
1240
|
+
while (usedRows.has(splitRow + direction * distance)) distance++;
|
|
1241
|
+
return splitRow + direction * distance;
|
|
1242
|
+
}
|
|
1243
|
+
function assignBranchRowsAroundMain(branchData, splitRow) {
|
|
1244
|
+
const assigned = /* @__PURE__ */ new Map();
|
|
1245
|
+
const mainBranchStart = pickMainBranch(branchData);
|
|
1246
|
+
if (mainBranchStart) assigned.set(mainBranchStart, splitRow);
|
|
1247
|
+
const usedRows = new Set(assigned.values());
|
|
1248
|
+
const remaining = branchData.filter((branch) => branch.start !== mainBranchStart);
|
|
1249
|
+
const withBias = remaining.filter((branch) => branch.bias !== null && branch.bias !== 0).sort((a, b) => {
|
|
1250
|
+
const aMag = Math.abs(a.bias ?? 0);
|
|
1251
|
+
const bMag = Math.abs(b.bias ?? 0);
|
|
1252
|
+
if (aMag !== bMag) return aMag - bMag;
|
|
1253
|
+
return a.start.localeCompare(b.start);
|
|
1254
|
+
});
|
|
1255
|
+
const withoutBias = remaining.filter((branch) => branch.bias === null || branch.bias === 0).sort((a, b) => b.nodeIds.length - a.nodeIds.length || a.start.localeCompare(b.start));
|
|
1256
|
+
for (const branch of withBias) {
|
|
1257
|
+
const row = resolveDirectionalRow(splitRow, branch.bias ?? 0, usedRows);
|
|
1258
|
+
assigned.set(branch.start, row);
|
|
1259
|
+
usedRows.add(row);
|
|
1260
|
+
}
|
|
1261
|
+
const preferredOffsets = createSecondaryOffsets(withoutBias.length);
|
|
1262
|
+
for (let i = 0; i < withoutBias.length; i++) {
|
|
1263
|
+
let row = splitRow + preferredOffsets[i];
|
|
1264
|
+
if (usedRows.has(row)) {
|
|
1265
|
+
row = resolveDirectionalRow(splitRow, preferredOffsets[i], usedRows);
|
|
1266
|
+
}
|
|
1267
|
+
assigned.set(withoutBias[i].start, row);
|
|
1268
|
+
usedRows.add(row);
|
|
1269
|
+
}
|
|
1270
|
+
return assigned;
|
|
1271
|
+
}
|
|
1215
1272
|
function assignRows(nodes, forwardEdges, columns, gatewayPairs) {
|
|
1216
1273
|
const rows = new Map(nodes.map((n) => [n.id, 0]));
|
|
1217
1274
|
const succs = new Map(nodes.map((n) => [n.id, []]));
|
|
@@ -1245,24 +1302,14 @@ function assignRows(nodes, forwardEdges, columns, gatewayPairs) {
|
|
|
1245
1302
|
nodeIds: getBranchNodes(start),
|
|
1246
1303
|
bias: handleToRowBias(splitHandles?.get(start) ?? null)
|
|
1247
1304
|
}));
|
|
1248
|
-
const
|
|
1249
|
-
const withoutBias = branchData.filter((b) => b.bias === null || b.bias === 0).sort((a, b) => b.nodeIds.length - a.nodeIds.length);
|
|
1250
|
-
const assigned = /* @__PURE__ */ new Map();
|
|
1251
|
-
for (const b of withBias) {
|
|
1252
|
-
assigned.set(b.start, splitRow + b.bias);
|
|
1253
|
-
}
|
|
1254
|
-
let nextOffset = 0;
|
|
1255
|
-
for (const b of withoutBias) {
|
|
1256
|
-
while ([...assigned.values()].includes(splitRow + nextOffset)) nextOffset++;
|
|
1257
|
-
assigned.set(b.start, splitRow + nextOffset);
|
|
1258
|
-
nextOffset++;
|
|
1259
|
-
}
|
|
1305
|
+
const assigned = assignBranchRowsAroundMain(branchData, splitRow);
|
|
1260
1306
|
for (const b of branchData) {
|
|
1261
1307
|
const row = assigned.get(b.start) ?? splitRow;
|
|
1262
1308
|
for (const id of b.nodeIds) {
|
|
1263
1309
|
rows.set(id, row);
|
|
1264
1310
|
}
|
|
1265
1311
|
}
|
|
1312
|
+
rows.set(mergeId, splitRow);
|
|
1266
1313
|
}
|
|
1267
1314
|
const pairedSplits = new Set(gatewayPairs.keys());
|
|
1268
1315
|
const unpairedSplits = nodes.filter(
|
|
@@ -1291,16 +1338,7 @@ function assignRows(nodes, forwardEdges, columns, gatewayPairs) {
|
|
|
1291
1338
|
nodeIds: getAllReachable(start),
|
|
1292
1339
|
bias: handleToRowBias(splitHandles2?.get(start) ?? null)
|
|
1293
1340
|
}));
|
|
1294
|
-
const
|
|
1295
|
-
const withoutBias2 = branchData.filter((b) => b.bias === null || b.bias === 0).sort((a, b) => b.nodeIds.length - a.nodeIds.length);
|
|
1296
|
-
const assigned2 = /* @__PURE__ */ new Map();
|
|
1297
|
-
for (const b of withBias2) assigned2.set(b.start, splitRow + b.bias);
|
|
1298
|
-
let nextOff = 0;
|
|
1299
|
-
for (const b of withoutBias2) {
|
|
1300
|
-
while ([...assigned2.values()].includes(splitRow + nextOff)) nextOff++;
|
|
1301
|
-
assigned2.set(b.start, splitRow + nextOff);
|
|
1302
|
-
nextOff++;
|
|
1303
|
-
}
|
|
1341
|
+
const assigned2 = assignBranchRowsAroundMain(branchData, splitRow);
|
|
1304
1342
|
for (const b of branchData) {
|
|
1305
1343
|
const row = assigned2.get(b.start) ?? splitRow;
|
|
1306
1344
|
for (const id of b.nodeIds) rows.set(id, row);
|
|
@@ -1311,17 +1349,18 @@ function assignRows(nodes, forwardEdges, columns, gatewayPairs) {
|
|
|
1311
1349
|
|
|
1312
1350
|
// src/layout/bpmn-custom-layout.ts
|
|
1313
1351
|
var LANE_LABEL_W = 28;
|
|
1314
|
-
var LANE_H_PAD =
|
|
1315
|
-
var COL_GAP =
|
|
1316
|
-
var ROW_HEIGHT =
|
|
1317
|
-
var ROW_GAP =
|
|
1318
|
-
var LANE_V_PAD =
|
|
1319
|
-
var POOL_H_PAD =
|
|
1320
|
-
var POOL_V_GAP =
|
|
1321
|
-
var LANE_MIN_H =
|
|
1322
|
-
var POOL_MIN_W =
|
|
1352
|
+
var LANE_H_PAD = 32;
|
|
1353
|
+
var COL_GAP = 60;
|
|
1354
|
+
var ROW_HEIGHT = 90;
|
|
1355
|
+
var ROW_GAP = 50;
|
|
1356
|
+
var LANE_V_PAD = 48;
|
|
1357
|
+
var POOL_H_PAD = 64;
|
|
1358
|
+
var POOL_V_GAP = 48;
|
|
1359
|
+
var LANE_MIN_H = 180;
|
|
1360
|
+
var POOL_MIN_W = 720;
|
|
1323
1361
|
var POOL_INNER_PAD = 10;
|
|
1324
|
-
var BACK_EDGE_CLEARANCE =
|
|
1362
|
+
var BACK_EDGE_CLEARANCE = 56;
|
|
1363
|
+
var EDGE_ROUTE_PAD = 28;
|
|
1325
1364
|
var LAYOUT_ARTIFACT_TYPES = /* @__PURE__ */ new Set([
|
|
1326
1365
|
"DataObject",
|
|
1327
1366
|
"DataObjectReference",
|
|
@@ -1338,12 +1377,38 @@ var COLLAPSED_SUBPROCESS_TYPES = /* @__PURE__ */ new Set([
|
|
|
1338
1377
|
"EventSubProcess",
|
|
1339
1378
|
"AdHocSubProcess"
|
|
1340
1379
|
]);
|
|
1380
|
+
var LAYOUT_TASK_TYPES = /* @__PURE__ */ new Set([
|
|
1381
|
+
"Task",
|
|
1382
|
+
"UserTask",
|
|
1383
|
+
"ServiceTask",
|
|
1384
|
+
"ScriptTask",
|
|
1385
|
+
"ManualTask",
|
|
1386
|
+
"BusinessRuleTask",
|
|
1387
|
+
"ReceiveTask",
|
|
1388
|
+
"SendTask",
|
|
1389
|
+
"CallActivity"
|
|
1390
|
+
]);
|
|
1391
|
+
var TASK_LAYOUT_MIN_W = 130;
|
|
1392
|
+
var TASK_LAYOUT_MIN_H = 80;
|
|
1341
1393
|
function nW(node) {
|
|
1342
1394
|
return node.width ?? node.measured?.width ?? 120;
|
|
1343
1395
|
}
|
|
1344
1396
|
function nH(node) {
|
|
1345
1397
|
return node.height ?? node.measured?.height ?? 60;
|
|
1346
1398
|
}
|
|
1399
|
+
function layoutW(node) {
|
|
1400
|
+
return LAYOUT_TASK_TYPES.has(node.data.elementType) ? Math.max(nW(node), TASK_LAYOUT_MIN_W) : nW(node);
|
|
1401
|
+
}
|
|
1402
|
+
function layoutH(node) {
|
|
1403
|
+
return LAYOUT_TASK_TYPES.has(node.data.elementType) ? Math.max(nH(node), TASK_LAYOUT_MIN_H) : nH(node);
|
|
1404
|
+
}
|
|
1405
|
+
function applyLayoutMinSize(node) {
|
|
1406
|
+
if (!LAYOUT_TASK_TYPES.has(node.data.elementType)) return node;
|
|
1407
|
+
const w = layoutW(node);
|
|
1408
|
+
const h = layoutH(node);
|
|
1409
|
+
if (w === nW(node) && h === nH(node)) return node;
|
|
1410
|
+
return { ...node, width: w, height: h, measured: { width: w, height: h } };
|
|
1411
|
+
}
|
|
1347
1412
|
var BOUNDARY_SPACING = 10;
|
|
1348
1413
|
function repositionBoundaryEvents(boundaryEvents, positionedContent) {
|
|
1349
1414
|
if (boundaryEvents.length === 0) return [];
|
|
@@ -1369,8 +1434,8 @@ function repositionBoundaryEvents(boundaryEvents, positionedContent) {
|
|
|
1369
1434
|
}
|
|
1370
1435
|
const hostGroup = byHost.get(hostId);
|
|
1371
1436
|
const siblingIdx = hostGroup.findIndex((n) => n.id === be.id);
|
|
1372
|
-
const hostW =
|
|
1373
|
-
const hostH =
|
|
1437
|
+
const hostW = layoutW(host);
|
|
1438
|
+
const hostH = layoutH(host);
|
|
1374
1439
|
const beH = nH(be);
|
|
1375
1440
|
const totalGroupW = hostGroup.reduce((s, b) => s + nW(b), 0) + (hostGroup.length - 1) * BOUNDARY_SPACING;
|
|
1376
1441
|
const groupStartX = host.position.x + hostW / 2 - totalGroupW / 2;
|
|
@@ -1411,7 +1476,7 @@ function layoutSubProcess(children, edges) {
|
|
|
1411
1476
|
for (let c = 0; c <= maxCol; c++) colW.set(c, 0);
|
|
1412
1477
|
for (const node of mainChildren) {
|
|
1413
1478
|
const c = columns.get(node.id) ?? 0;
|
|
1414
|
-
colW.set(c, Math.max(colW.get(c) ?? 0,
|
|
1479
|
+
colW.set(c, Math.max(colW.get(c) ?? 0, layoutW(node)));
|
|
1415
1480
|
}
|
|
1416
1481
|
const colX = /* @__PURE__ */ new Map();
|
|
1417
1482
|
let cumX = 0;
|
|
@@ -1430,12 +1495,11 @@ function layoutSubProcess(children, edges) {
|
|
|
1430
1495
|
const positionedChildren = mainChildren.map((node) => {
|
|
1431
1496
|
const c = columns.get(node.id) ?? 0;
|
|
1432
1497
|
const r = rows.get(node.id) ?? 0;
|
|
1433
|
-
const
|
|
1434
|
-
const
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
};
|
|
1498
|
+
const lw = layoutW(node);
|
|
1499
|
+
const lh = layoutH(node);
|
|
1500
|
+
const colOffset = (colX.get(c) ?? 0) + (colW.get(c) ?? 120) / 2 - lw / 2;
|
|
1501
|
+
const rowOffset = (r - minRow) * (ROW_HEIGHT + ROW_GAP) + ROW_HEIGHT / 2 - lh / 2;
|
|
1502
|
+
return applyLayoutMinSize({ ...node, position: { x: SP_PAD + colOffset, y: SP_PAD + rowOffset } });
|
|
1439
1503
|
});
|
|
1440
1504
|
const positionedBoundaries = repositionBoundaryEvents(boundaryEvents, positionedChildren);
|
|
1441
1505
|
return {
|
|
@@ -1468,8 +1532,7 @@ function layoutPool(pool, lanes, content, allEdges) {
|
|
|
1468
1532
|
height: h
|
|
1469
1533
|
};
|
|
1470
1534
|
}
|
|
1471
|
-
const
|
|
1472
|
-
const sortedLanes = lanePositionsDistinct ? [...lanes].sort((a, b) => a.position.y - b.position.y) : [...lanes];
|
|
1535
|
+
const sortedLanes = [...lanes].sort((a, b) => a.position.y - b.position.y);
|
|
1473
1536
|
const hasLanes = sortedLanes.length > 0;
|
|
1474
1537
|
const laneIdSet = new Set(sortedLanes.map((l) => l.id));
|
|
1475
1538
|
const nodeLaneId = /* @__PURE__ */ new Map();
|
|
@@ -1518,7 +1581,7 @@ function layoutPool(pool, lanes, content, allEdges) {
|
|
|
1518
1581
|
for (let c = 0; c <= maxCol; c++) colW.set(c, 0);
|
|
1519
1582
|
for (const node of mainContent) {
|
|
1520
1583
|
const c = columns.get(node.id) ?? 0;
|
|
1521
|
-
colW.set(c, Math.max(colW.get(c) ?? 0,
|
|
1584
|
+
colW.set(c, Math.max(colW.get(c) ?? 0, layoutW(node)));
|
|
1522
1585
|
}
|
|
1523
1586
|
const colX = /* @__PURE__ */ new Map();
|
|
1524
1587
|
let cumX = 0;
|
|
@@ -1545,14 +1608,16 @@ function layoutPool(pool, lanes, content, allEdges) {
|
|
|
1545
1608
|
const laneId = nodeLaneId.get(node.id) ?? "_pool_";
|
|
1546
1609
|
const stat = laneStats.get(laneId);
|
|
1547
1610
|
const lYOff = laneY.get(laneId) ?? 0;
|
|
1548
|
-
const
|
|
1549
|
-
const
|
|
1611
|
+
const lw = layoutW(node);
|
|
1612
|
+
const lh = layoutH(node);
|
|
1613
|
+
const colOffset = (colX.get(c) ?? 0) + (colW.get(c) ?? 120) / 2 - lw / 2;
|
|
1614
|
+
const rowOffset = (r - stat.minRow) * (ROW_HEIGHT + ROW_GAP) + ROW_HEIGHT / 2 - lh / 2;
|
|
1550
1615
|
const contentH_stat = stat.rowCount * ROW_HEIGHT + Math.max(0, stat.rowCount - 1) * ROW_GAP;
|
|
1551
1616
|
const vertTopOffset = Math.max(LANE_V_PAD, (stat.height - contentH_stat) / 2);
|
|
1552
1617
|
const isLaneChild = hasLanes && !!node.parentId && node.parentId !== pool.id;
|
|
1553
1618
|
const x = isLaneChild ? LANE_LABEL_W + LANE_H_PAD + colOffset : POOL_H_PAD + colOffset;
|
|
1554
1619
|
const y = isLaneChild ? vertTopOffset + rowOffset : lYOff + vertTopOffset + rowOffset;
|
|
1555
|
-
return { ...node, position: { x, y } };
|
|
1620
|
+
return applyLayoutMinSize({ ...node, position: { x, y } });
|
|
1556
1621
|
});
|
|
1557
1622
|
const NODE_MIN_GAP = 24;
|
|
1558
1623
|
const resolvedContent = [...positionedContent];
|
|
@@ -1561,13 +1626,13 @@ function layoutPool(pool, lanes, content, allEdges) {
|
|
|
1561
1626
|
for (let k = 1; k < laneNodeIndices.length; k++) {
|
|
1562
1627
|
const prev = resolvedContent[laneNodeIndices[k - 1].i];
|
|
1563
1628
|
const curr = resolvedContent[laneNodeIndices[k].i];
|
|
1564
|
-
const prevBottom = prev.position.y +
|
|
1629
|
+
const prevBottom = prev.position.y + layoutH(prev);
|
|
1565
1630
|
const currTop = curr.position.y;
|
|
1566
1631
|
const prevTop = prev.position.y;
|
|
1567
|
-
const currBottom = curr.position.y +
|
|
1632
|
+
const currBottom = curr.position.y + layoutH(curr);
|
|
1568
1633
|
const yOverlap = prevBottom + NODE_MIN_GAP > currTop && currBottom + NODE_MIN_GAP > prevTop;
|
|
1569
1634
|
if (!yOverlap) continue;
|
|
1570
|
-
const prevRight = prev.position.x +
|
|
1635
|
+
const prevRight = prev.position.x + layoutW(prev);
|
|
1571
1636
|
if (prevRight + NODE_MIN_GAP > curr.position.x) {
|
|
1572
1637
|
resolvedContent[laneNodeIndices[k].i] = {
|
|
1573
1638
|
...curr,
|
|
@@ -1604,14 +1669,38 @@ function absolutePos(nodeId, byId, cache) {
|
|
|
1604
1669
|
cache.set(nodeId, abs);
|
|
1605
1670
|
return abs;
|
|
1606
1671
|
}
|
|
1607
|
-
function
|
|
1608
|
-
|
|
1672
|
+
function findAncestorNodeId(node, candidateIds, byId) {
|
|
1673
|
+
let current = node;
|
|
1674
|
+
while (current?.parentId) {
|
|
1675
|
+
if (candidateIds.has(current.parentId)) return current.parentId;
|
|
1676
|
+
current = byId.get(current.parentId);
|
|
1677
|
+
}
|
|
1678
|
+
return void 0;
|
|
1679
|
+
}
|
|
1680
|
+
function laneOf(node, laneIds, byId) {
|
|
1681
|
+
return findAncestorNodeId(node, laneIds, byId);
|
|
1682
|
+
}
|
|
1683
|
+
function poolOf(node, poolIds, byId) {
|
|
1684
|
+
if (poolIds.has(node.id)) return node.id;
|
|
1685
|
+
return findAncestorNodeId(node, poolIds, byId);
|
|
1686
|
+
}
|
|
1687
|
+
function nodeRect(node, byId, cache) {
|
|
1688
|
+
const pos = absolutePos(node.id, byId, cache);
|
|
1689
|
+
return { x: pos.x, y: pos.y, width: nW(node), height: nH(node) };
|
|
1690
|
+
}
|
|
1691
|
+
function rectContainsRect(outer, inner) {
|
|
1692
|
+
return inner.x >= outer.x && inner.y >= outer.y && inner.x + inner.width <= outer.x + outer.width && inner.y + inner.height <= outer.y + outer.height;
|
|
1609
1693
|
}
|
|
1610
1694
|
function gapMidX(sAbs, sW, tAbs, tW) {
|
|
1611
1695
|
const leftRightEdge = Math.min(sAbs.x + sW, tAbs.x + tW);
|
|
1612
1696
|
const rightLeftEdge = Math.max(sAbs.x, tAbs.x);
|
|
1613
1697
|
return leftRightEdge < rightLeftEdge ? (leftRightEdge + rightLeftEdge) / 2 : sAbs.x + sW / 2;
|
|
1614
1698
|
}
|
|
1699
|
+
function routeMidX(sAbs, sW, tAbs, tW) {
|
|
1700
|
+
const leftEdge = Math.min(sAbs.x + sW, tAbs.x + tW);
|
|
1701
|
+
const rightEdge = Math.max(sAbs.x, tAbs.x);
|
|
1702
|
+
return leftEdge < rightEdge ? leftEdge + (rightEdge - leftEdge) * 0.35 : sAbs.x + sW / 2;
|
|
1703
|
+
}
|
|
1615
1704
|
var SAME_ROW_THRESHOLD = 15;
|
|
1616
1705
|
function routeEdges(edges, layoutNodes, backEdgeIds, laneIds, poolIds) {
|
|
1617
1706
|
const byId = new Map(layoutNodes.map((n) => [n.id, n]));
|
|
@@ -1636,18 +1725,9 @@ function routeEdges(edges, layoutNodes, backEdgeIds, laneIds, poolIds) {
|
|
|
1636
1725
|
const tCX = tAbs.x + tW / 2;
|
|
1637
1726
|
const sCY = sAbs.y + sH / 2;
|
|
1638
1727
|
const tCY = tAbs.y + tH / 2;
|
|
1639
|
-
const
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
if (poolIds.has(nodeId)) return nodeId;
|
|
1643
|
-
if (node.parentId && poolIds.has(node.parentId)) return node.parentId;
|
|
1644
|
-
if (node.parentId) {
|
|
1645
|
-
const gp = byId.get(node.parentId)?.parentId ?? null;
|
|
1646
|
-
if (gp && poolIds.has(gp)) return gp;
|
|
1647
|
-
}
|
|
1648
|
-
return node.parentId ?? null;
|
|
1649
|
-
};
|
|
1650
|
-
if (getPool(edge.source) !== getPool(edge.target)) {
|
|
1728
|
+
const srcPool = poolOf(src, poolIds, byId) ?? null;
|
|
1729
|
+
const tgtPool = poolOf(tgt, poolIds, byId) ?? null;
|
|
1730
|
+
if (srcPool !== tgtPool) {
|
|
1651
1731
|
const d = { ...edge.data };
|
|
1652
1732
|
delete d.routingPoints;
|
|
1653
1733
|
return { ...edge, data: d };
|
|
@@ -1656,14 +1736,16 @@ function routeEdges(edges, layoutNodes, backEdgeIds, laneIds, poolIds) {
|
|
|
1656
1736
|
if (backEdgeIds.has(edge.id)) {
|
|
1657
1737
|
const topY = Math.min(sAbs.y, tAbs.y) - BACK_EDGE_CLEARANCE;
|
|
1658
1738
|
routingPoints = [
|
|
1659
|
-
{ x:
|
|
1660
|
-
{ x:
|
|
1661
|
-
{ x:
|
|
1662
|
-
{ x:
|
|
1739
|
+
{ x: sAbs.x + sW, y: sCY },
|
|
1740
|
+
{ x: sAbs.x + sW + EDGE_ROUTE_PAD, y: sCY },
|
|
1741
|
+
{ x: sAbs.x + sW + EDGE_ROUTE_PAD, y: topY },
|
|
1742
|
+
{ x: tAbs.x - EDGE_ROUTE_PAD, y: topY },
|
|
1743
|
+
{ x: tAbs.x - EDGE_ROUTE_PAD, y: tCY },
|
|
1744
|
+
{ x: tAbs.x, y: tCY }
|
|
1663
1745
|
];
|
|
1664
|
-
} else if (laneOf(src, laneIds) !== laneOf(tgt, laneIds)) {
|
|
1665
|
-
const srcLane = byId.get(src
|
|
1666
|
-
const tgtLane = byId.get(tgt
|
|
1746
|
+
} else if (laneOf(src, laneIds, byId) !== laneOf(tgt, laneIds, byId)) {
|
|
1747
|
+
const srcLane = byId.get(laneOf(src, laneIds, byId) ?? "");
|
|
1748
|
+
const tgtLane = byId.get(laneOf(tgt, laneIds, byId) ?? "");
|
|
1667
1749
|
if (srcLane && tgtLane && laneIds.has(srcLane.id) && laneIds.has(tgtLane.id)) {
|
|
1668
1750
|
const goingDown = tAbs.y > sAbs.y;
|
|
1669
1751
|
const sharedX = gapMidX(sAbs, sW, tAbs, tW);
|
|
@@ -1671,8 +1753,8 @@ function routeEdges(edges, layoutNodes, backEdgeIds, laneIds, poolIds) {
|
|
|
1671
1753
|
const tgtLaneIdx = sortedLanes.findIndex((l) => l.id === tgtLane.id);
|
|
1672
1754
|
const pts = [];
|
|
1673
1755
|
if (goingDown) {
|
|
1674
|
-
pts.push({ x:
|
|
1675
|
-
pts.push({ x: sharedX, y:
|
|
1756
|
+
pts.push({ x: sAbs.x + sW, y: sCY });
|
|
1757
|
+
pts.push({ x: sharedX, y: sCY });
|
|
1676
1758
|
const fromIdx = Math.min(srcLaneIdx, tgtLaneIdx);
|
|
1677
1759
|
const toIdx = Math.max(srcLaneIdx, tgtLaneIdx);
|
|
1678
1760
|
for (let i = fromIdx; i < toIdx; i++) {
|
|
@@ -1681,11 +1763,12 @@ function routeEdges(edges, layoutNodes, backEdgeIds, laneIds, poolIds) {
|
|
|
1681
1763
|
pts.push({ x: sharedX, y: laneBot });
|
|
1682
1764
|
}
|
|
1683
1765
|
const lastY = pts[pts.length - 1].y;
|
|
1684
|
-
pts.push({ x:
|
|
1685
|
-
pts.push({ x:
|
|
1766
|
+
pts.push({ x: tAbs.x - EDGE_ROUTE_PAD, y: lastY });
|
|
1767
|
+
pts.push({ x: tAbs.x - EDGE_ROUTE_PAD, y: tCY });
|
|
1768
|
+
pts.push({ x: tAbs.x, y: tCY });
|
|
1686
1769
|
} else {
|
|
1687
|
-
pts.push({ x:
|
|
1688
|
-
pts.push({ x: sharedX, y:
|
|
1770
|
+
pts.push({ x: sAbs.x + sW, y: sCY });
|
|
1771
|
+
pts.push({ x: sharedX, y: sCY });
|
|
1689
1772
|
const fromIdx = Math.min(srcLaneIdx, tgtLaneIdx);
|
|
1690
1773
|
const toIdx = Math.max(srcLaneIdx, tgtLaneIdx);
|
|
1691
1774
|
for (let i = toIdx; i > fromIdx; i--) {
|
|
@@ -1694,17 +1777,18 @@ function routeEdges(edges, layoutNodes, backEdgeIds, laneIds, poolIds) {
|
|
|
1694
1777
|
pts.push({ x: sharedX, y: laneTop });
|
|
1695
1778
|
}
|
|
1696
1779
|
const lastY = pts[pts.length - 1].y;
|
|
1697
|
-
pts.push({ x:
|
|
1698
|
-
pts.push({ x:
|
|
1780
|
+
pts.push({ x: tAbs.x - EDGE_ROUTE_PAD, y: lastY });
|
|
1781
|
+
pts.push({ x: tAbs.x - EDGE_ROUTE_PAD, y: tCY });
|
|
1782
|
+
pts.push({ x: tAbs.x, y: tCY });
|
|
1699
1783
|
}
|
|
1700
1784
|
routingPoints = pts;
|
|
1701
1785
|
} else {
|
|
1702
1786
|
const sharedX = gapMidX(sAbs, sW, tAbs, tW);
|
|
1703
1787
|
routingPoints = [
|
|
1704
|
-
{ x:
|
|
1788
|
+
{ x: sAbs.x + sW, y: sCY },
|
|
1705
1789
|
{ x: sharedX, y: sCY },
|
|
1706
1790
|
{ x: sharedX, y: tCY },
|
|
1707
|
-
{ x:
|
|
1791
|
+
{ x: tAbs.x, y: tCY }
|
|
1708
1792
|
];
|
|
1709
1793
|
}
|
|
1710
1794
|
} else if (Math.abs(sCY - tCY) <= SAME_ROW_THRESHOLD) {
|
|
@@ -1716,19 +1800,25 @@ function routeEdges(edges, layoutNodes, backEdgeIds, laneIds, poolIds) {
|
|
|
1716
1800
|
const exitsTop = handle.includes("top");
|
|
1717
1801
|
const exitsBottom = handle.includes("bottom");
|
|
1718
1802
|
if (exitsTop || exitsBottom) {
|
|
1803
|
+
const exitY = exitsTop ? sAbs.y : sAbs.y + sH;
|
|
1804
|
+
const entryY = exitsTop ? tAbs.y + tH : tAbs.y;
|
|
1805
|
+
const corridorY = exitsTop ? Math.min(exitY, entryY) - EDGE_ROUTE_PAD : Math.max(exitY, entryY) + EDGE_ROUTE_PAD;
|
|
1719
1806
|
routingPoints = [
|
|
1720
|
-
{ x: sCX, y:
|
|
1721
|
-
{ x: sCX, y:
|
|
1722
|
-
{ x: tCX, y:
|
|
1723
|
-
{ x: tCX, y:
|
|
1807
|
+
{ x: sCX, y: exitY },
|
|
1808
|
+
{ x: sCX, y: corridorY },
|
|
1809
|
+
{ x: tCX, y: corridorY },
|
|
1810
|
+
{ x: tCX, y: entryY }
|
|
1724
1811
|
];
|
|
1725
1812
|
} else {
|
|
1726
|
-
const midX =
|
|
1813
|
+
const midX = routeMidX(sAbs, sW, tAbs, tW);
|
|
1814
|
+
const exitX = sAbs.x + sW;
|
|
1815
|
+
const entryX = tAbs.x;
|
|
1816
|
+
const corridorX = Math.max(midX, exitX + EDGE_ROUTE_PAD);
|
|
1727
1817
|
routingPoints = [
|
|
1728
|
-
{ x:
|
|
1729
|
-
{ x:
|
|
1730
|
-
{ x:
|
|
1731
|
-
{ x:
|
|
1818
|
+
{ x: exitX, y: sCY },
|
|
1819
|
+
{ x: corridorX, y: sCY },
|
|
1820
|
+
{ x: corridorX, y: tCY },
|
|
1821
|
+
{ x: entryX, y: tCY }
|
|
1732
1822
|
];
|
|
1733
1823
|
}
|
|
1734
1824
|
}
|
|
@@ -1737,16 +1827,19 @@ function routeEdges(edges, layoutNodes, backEdgeIds, laneIds, poolIds) {
|
|
|
1737
1827
|
}
|
|
1738
1828
|
var ARTIFACT_ABOVE_GAP = 16;
|
|
1739
1829
|
var ARTIFACT_H_SPACING = 12;
|
|
1740
|
-
function positionArtifacts(artifacts, resultNodes, edges) {
|
|
1830
|
+
function positionArtifacts(artifacts, resultNodes, edges, originalNodes) {
|
|
1741
1831
|
if (artifacts.length === 0) return [];
|
|
1742
1832
|
const byId = new Map(resultNodes.map((n) => [n.id, n]));
|
|
1743
1833
|
const cache = /* @__PURE__ */ new Map();
|
|
1744
1834
|
const absPos = (id) => absolutePos(id, byId, cache);
|
|
1835
|
+
const originalById = new Map(originalNodes.map((n) => [n.id, n]));
|
|
1836
|
+
const originalCache = /* @__PURE__ */ new Map();
|
|
1745
1837
|
const artifactsByNode = /* @__PURE__ */ new Map();
|
|
1746
1838
|
const ungrouped = [];
|
|
1839
|
+
const groups = [];
|
|
1747
1840
|
for (const artifact of artifacts) {
|
|
1748
1841
|
if (artifact.data.elementType === "Group") {
|
|
1749
|
-
|
|
1842
|
+
groups.push(artifact);
|
|
1750
1843
|
continue;
|
|
1751
1844
|
}
|
|
1752
1845
|
const connEdge = edges.find((e) => {
|
|
@@ -1784,6 +1877,58 @@ function positionArtifacts(artifacts, resultNodes, edges) {
|
|
|
1784
1877
|
desiredAbsX += nW(artifact) + ARTIFACT_H_SPACING;
|
|
1785
1878
|
}
|
|
1786
1879
|
}
|
|
1880
|
+
const nonArtifactOriginalNodes = originalNodes.filter(
|
|
1881
|
+
(node) => !LAYOUT_ARTIFACT_TYPES.has(node.data.elementType)
|
|
1882
|
+
);
|
|
1883
|
+
for (const group of groups) {
|
|
1884
|
+
const originalGroup = originalById.get(group.id);
|
|
1885
|
+
if (!originalGroup) {
|
|
1886
|
+
positioned.push(group);
|
|
1887
|
+
continue;
|
|
1888
|
+
}
|
|
1889
|
+
const groupRect = nodeRect(originalGroup, originalById, originalCache);
|
|
1890
|
+
const containedOriginalIds = nonArtifactOriginalNodes.filter((node) => node.id !== group.id).filter((node) => {
|
|
1891
|
+
if (node.parentId !== group.parentId) return false;
|
|
1892
|
+
return rectContainsRect(groupRect, nodeRect(node, originalById, originalCache));
|
|
1893
|
+
}).map((node) => node.id);
|
|
1894
|
+
if (containedOriginalIds.length === 0) {
|
|
1895
|
+
positioned.push(group);
|
|
1896
|
+
continue;
|
|
1897
|
+
}
|
|
1898
|
+
const containedLaidOut = containedOriginalIds.map((id) => byId.get(id)).filter((node) => !!node);
|
|
1899
|
+
if (containedLaidOut.length === 0) {
|
|
1900
|
+
positioned.push(group);
|
|
1901
|
+
continue;
|
|
1902
|
+
}
|
|
1903
|
+
const GROUP_PAD_X = 24;
|
|
1904
|
+
const GROUP_PAD_Y = 20;
|
|
1905
|
+
const bounds = containedLaidOut.reduce(
|
|
1906
|
+
(acc, node) => {
|
|
1907
|
+
const rect = nodeRect(node, byId, cache);
|
|
1908
|
+
return {
|
|
1909
|
+
left: Math.min(acc.left, rect.x),
|
|
1910
|
+
top: Math.min(acc.top, rect.y),
|
|
1911
|
+
right: Math.max(acc.right, rect.x + rect.width),
|
|
1912
|
+
bottom: Math.max(acc.bottom, rect.y + rect.height)
|
|
1913
|
+
};
|
|
1914
|
+
},
|
|
1915
|
+
{ left: Number.POSITIVE_INFINITY, top: Number.POSITIVE_INFINITY, right: Number.NEGATIVE_INFINITY, bottom: Number.NEGATIVE_INFINITY }
|
|
1916
|
+
);
|
|
1917
|
+
const parentAbsP = group.parentId ? absPos(group.parentId) : { x: 0, y: 0 };
|
|
1918
|
+
positioned.push({
|
|
1919
|
+
...group,
|
|
1920
|
+
position: {
|
|
1921
|
+
x: bounds.left - GROUP_PAD_X - parentAbsP.x,
|
|
1922
|
+
y: bounds.top - GROUP_PAD_Y - parentAbsP.y
|
|
1923
|
+
},
|
|
1924
|
+
width: bounds.right - bounds.left + GROUP_PAD_X * 2,
|
|
1925
|
+
height: bounds.bottom - bounds.top + GROUP_PAD_Y * 2,
|
|
1926
|
+
measured: {
|
|
1927
|
+
width: bounds.right - bounds.left + GROUP_PAD_X * 2,
|
|
1928
|
+
height: bounds.bottom - bounds.top + GROUP_PAD_Y * 2
|
|
1929
|
+
}
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1787
1932
|
return positioned;
|
|
1788
1933
|
}
|
|
1789
1934
|
async function bpmnCustomLayout(nodes, edges) {
|
|
@@ -1818,7 +1963,7 @@ async function bpmnCustomLayout(nodes, edges) {
|
|
|
1818
1963
|
if (pools.length === 0) {
|
|
1819
1964
|
const { bpmnElkLayout: bpmnElkLayout2 } = await Promise.resolve().then(() => (init_elk(), elk_exports));
|
|
1820
1965
|
const elkResult = await bpmnElkLayout2(nodes.filter((n) => !LAYOUT_ARTIFACT_TYPES.has(n.data.elementType)), edges);
|
|
1821
|
-
const posArtifacts = positionArtifacts(artifacts, elkResult.nodes, edges);
|
|
1966
|
+
const posArtifacts = positionArtifacts(artifacts, elkResult.nodes, edges, nodes);
|
|
1822
1967
|
return { nodes: [...elkResult.nodes, ...posArtifacts], edges: elkResult.edges };
|
|
1823
1968
|
}
|
|
1824
1969
|
const poolIds = new Set(pools.map((p) => p.id));
|
|
@@ -1862,8 +2007,9 @@ async function bpmnCustomLayout(nodes, edges) {
|
|
|
1862
2007
|
const layoutted = new Set(resultNodes.map((n) => n.id));
|
|
1863
2008
|
const freeNodes = workingMainNodes.filter((n) => !layoutted.has(n.id));
|
|
1864
2009
|
if (freeNodes.length > 0) {
|
|
2010
|
+
const freeNodeIds = new Set(freeNodes.map((n) => n.id));
|
|
1865
2011
|
const freeEdges = edges.filter(
|
|
1866
|
-
(e) =>
|
|
2012
|
+
(e) => freeNodeIds.has(e.source) && freeNodeIds.has(e.target)
|
|
1867
2013
|
);
|
|
1868
2014
|
try {
|
|
1869
2015
|
const { bpmnElkLayout: bpmnElkLayout2 } = await Promise.resolve().then(() => (init_elk(), elk_exports));
|
|
@@ -1887,7 +2033,7 @@ async function bpmnCustomLayout(nodes, edges) {
|
|
|
1887
2033
|
}
|
|
1888
2034
|
}
|
|
1889
2035
|
const routedEdges = routeEdges(edges, resultNodes, allBackEdgeIds, allLaneIds, poolIds);
|
|
1890
|
-
const positionedArtifacts = positionArtifacts(artifacts, resultNodes, edges);
|
|
2036
|
+
const positionedArtifacts = positionArtifacts(artifacts, resultNodes, edges, nodes);
|
|
1891
2037
|
return {
|
|
1892
2038
|
nodes: [...resultNodes, ...positionedArtifacts],
|
|
1893
2039
|
edges: routedEdges
|