@aranzatech/diagrams-bpmn 0.2.13 → 0.2.14

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.
Files changed (34) hide show
  1. package/dist/{catalog-Di2nzGs9.d.ts → catalog-CK3_4cOb.d.ts} +1 -1
  2. package/dist/{catalog-BiLXVn-2.d.cts → catalog-xOMF2ifW.d.cts} +1 -1
  3. package/dist/{chunk-O3NWJ5H7.js → chunk-QSMP34CT.js} +38 -5
  4. package/dist/chunk-QSMP34CT.js.map +1 -0
  5. package/dist/edges/index.cjs +35 -2
  6. package/dist/edges/index.cjs.map +1 -1
  7. package/dist/edges/index.js +1 -1
  8. package/dist/elements/index.d.cts +4 -4
  9. package/dist/elements/index.d.ts +4 -4
  10. package/dist/{guards-DPHXfpY8.d.cts → guards-C70uIY_O.d.cts} +1 -1
  11. package/dist/{guards-qgSeZEU4.d.ts → guards-foB6XIfZ.d.ts} +1 -1
  12. package/dist/index.cjs +35 -2
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +4 -4
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.js +1 -1
  17. package/dist/layout/index.cjs +55 -19
  18. package/dist/layout/index.cjs.map +1 -1
  19. package/dist/layout/index.d.cts +17 -11
  20. package/dist/layout/index.d.ts +17 -11
  21. package/dist/layout/index.js +55 -19
  22. package/dist/layout/index.js.map +1 -1
  23. package/dist/modeling/index.d.cts +3 -3
  24. package/dist/modeling/index.d.ts +3 -3
  25. package/dist/{types-rEfHsPr5.d.ts → types-DG5yPKld.d.ts} +1 -1
  26. package/dist/{types-s2_VvPGf.d.cts → types-jIDz306Y.d.cts} +1 -1
  27. package/dist/{types-Dfrt0wVs.d.cts → types-y-ZbX-ff.d.cts} +3 -0
  28. package/dist/{types-Dfrt0wVs.d.ts → types-y-ZbX-ff.d.ts} +3 -0
  29. package/dist/validation/index.d.cts +2 -2
  30. package/dist/validation/index.d.ts +2 -2
  31. package/dist/xml/index.d.cts +3 -3
  32. package/dist/xml/index.d.ts +3 -3
  33. package/package.json +2 -2
  34. package/dist/chunk-O3NWJ5H7.js.map +0 -1
@@ -1,25 +1,31 @@
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-rEfHsPr5.js';
3
+ import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-DG5yPKld.js';
4
4
  import { BpmnDiagramState } from '../modeling/index.js';
5
5
  import '@xyflow/react';
6
- import '../types-Dfrt0wVs.js';
6
+ import '../types-y-ZbX-ff.js';
7
7
  import '@aranzatech/diagrams-core';
8
8
  import '@aranzatech/diagrams-core/serialization';
9
- import '../catalog-Di2nzGs9.js';
9
+ import '../catalog-CK3_4cOb.js';
10
10
 
11
11
  /**
12
12
  * ELK-based auto-layout for BPMN diagrams.
13
13
  *
14
- * Direction policy always LEFT-TO-RIGHT to match screen anatomy:
14
+ * Spacing philosophy: fixed, generous values that scale consistently
15
+ * regardless of diagram size. "Air" between elements is not waste —
16
+ * it is what makes the flow readable to the human eye.
17
+ *
18
+ * Direction policy:
15
19
  * - Root: RIGHT — free nodes and pools flow LR on the canvas.
16
- * - Pool that contains Lanes: DOWN internally so lanes stack top-to-bottom
17
- * (standard horizontal-pool anatomy); the pool itself is still placed LR.
18
- * - Pool without lanes, Lane, SubProcess, Transaction, AdHoc: RIGHT — content
19
- * flows left-to-right inside the container.
20
- * - All edges get ORTHOGONAL routing in a single INCLUDE_CHILDREN pass so
21
- * cross-pool and cross-lane edges are routed correctly.
22
- * - Containers auto-resize to fit their children.
20
+ * - Pool with Lanes: DOWN internally so lanes stack top-to-bottom;
21
+ * the pool itself is placed LR on the canvas.
22
+ * - Lane / SubProcess / Pool-without-lanes: RIGHT — content flows LR.
23
+ * - Each container runs its own INCLUDE_CHILDREN pass (per-container
24
+ * hierarchyHandling) so cross-lane edges are routed correctly without
25
+ * the global RIGHT direction forcing Lane containers sideways.
26
+ * - Root uses INHERIT so each pool is laid out independently.
27
+ * - Post-processing equalises Lane widths within each Pool so all Lanes
28
+ * span the full Pool width.
23
29
  */
24
30
  declare function bpmnElkLayout(nodes: BpmnRFNode[], edges: BpmnRFEdge[]): Promise<{
25
31
  nodes: BpmnRFNode[];
@@ -13,20 +13,20 @@ var BPMN_CONTAINER_TYPES = /* @__PURE__ */ new Set([
13
13
  "AdHocSubProcess"
14
14
  ]);
15
15
  var CONTAINER_MIN_SIZE = {
16
- Pool: { w: 560, h: 160 },
17
- Lane: { w: 480, h: 100 },
18
- SubProcess: { w: 200, h: 120 },
19
- Transaction: { w: 200, h: 120 },
20
- EventSubProcess: { w: 200, h: 120 },
21
- AdHocSubProcess: { w: 200, h: 120 }
16
+ Pool: { w: 720, h: 200 },
17
+ Lane: { w: 600, h: 160 },
18
+ SubProcess: { w: 240, h: 140 },
19
+ Transaction: { w: 240, h: 140 },
20
+ EventSubProcess: { w: 240, h: 140 },
21
+ AdHocSubProcess: { w: 240, h: 140 }
22
22
  };
23
23
  var CONTAINER_PADDING = {
24
- Pool: "[top=30,left=55,bottom=30,right=40]",
25
- Lane: "[top=25,left=60,bottom=25,right=40]",
26
- SubProcess: "[top=25,left=35,bottom=25,right=35]",
27
- Transaction: "[top=25,left=35,bottom=25,right=35]",
28
- EventSubProcess: "[top=25,left=35,bottom=25,right=35]",
29
- AdHocSubProcess: "[top=25,left=35,bottom=25,right=35]"
24
+ Pool: "[top=30,left=60,bottom=30,right=50]",
25
+ Lane: "[top=40,left=70,bottom=40,right=50]",
26
+ SubProcess: "[top=30,left=40,bottom=30,right=40]",
27
+ Transaction: "[top=30,left=40,bottom=30,right=40]",
28
+ EventSubProcess: "[top=30,left=40,bottom=30,right=40]",
29
+ AdHocSubProcess: "[top=30,left=40,bottom=30,right=40]"
30
30
  };
31
31
  async function bpmnElkLayout(nodes, edges) {
32
32
  const poolsWithLanes = /* @__PURE__ */ new Set();
@@ -47,13 +47,26 @@ async function bpmnElkLayout(nodes, edges) {
47
47
  },
48
48
  isContainerNode: (node) => BPMN_CONTAINER_TYPES.has(node.data.elementType),
49
49
  getNodeLayoutOptions: (node) => {
50
- const type = node.data.elementType;
50
+ const bNode = node;
51
+ const type = bNode.data.elementType;
51
52
  if (!BPMN_CONTAINER_TYPES.has(type)) return void 0;
52
53
  const min = CONTAINER_MIN_SIZE[type];
53
- const dir = type === "Pool" && poolsWithLanes.has(node.id) ? "DOWN" : "RIGHT";
54
+ const isPoolWithLanes = type === "Pool" && poolsWithLanes.has(node.id);
55
+ const dir = isPoolWithLanes ? "DOWN" : "RIGHT";
54
56
  return {
55
57
  "elk.direction": dir,
56
58
  "elk.nodeSize.constraints": "MINIMUM_SIZE",
59
+ // Each container handles its own layout pass so cross-lane edges
60
+ // participate in the internal layout without the global direction
61
+ // forcing Lane containers to align sideways.
62
+ "elk.hierarchyHandling": "INCLUDE_CHILDREN",
63
+ // Lanes within a Pool share a border — zero gap between them.
64
+ // Other containers keep the tighter inner spacing.
65
+ ...isPoolWithLanes ? { "elk.spacing.nodeNode": "0", "elk.spacing.componentComponent": "0" } : {
66
+ "elk.layered.spacing.nodeNodeBetweenLayers": "100",
67
+ "elk.layered.spacing.edgeNodeBetweenLayers": "45",
68
+ "elk.spacing.nodeNode": "50"
69
+ },
57
70
  ...min ? { "elk.nodeSize.minimum": `[w=${min.w},h=${min.h}]` } : {},
58
71
  ...CONTAINER_PADDING[type] ? { "elk.padding": CONTAINER_PADDING[type] } : {}
59
72
  };
@@ -61,12 +74,15 @@ async function bpmnElkLayout(nodes, edges) {
61
74
  elk: {
62
75
  "elk.algorithm": "layered",
63
76
  "elk.direction": "RIGHT",
64
- "elk.hierarchyHandling": "INCLUDE_CHILDREN",
77
+ // INHERIT: each container handles its own INCLUDE_CHILDREN pass so
78
+ // the global RIGHT direction does not force Lane containers sideways.
79
+ "elk.hierarchyHandling": "INHERIT",
65
80
  "elk.edgeRouting": "ORTHOGONAL",
66
- "elk.layered.spacing.nodeNodeBetweenLayers": "100",
67
- "elk.layered.spacing.edgeNodeBetweenLayers": "40",
68
- "elk.spacing.nodeNode": "60",
69
- "elk.spacing.componentComponent": "80"
81
+ // Global spacing — generous values for visual breathing room.
82
+ "elk.layered.spacing.nodeNodeBetweenLayers": "120",
83
+ "elk.layered.spacing.edgeNodeBetweenLayers": "50",
84
+ "elk.spacing.nodeNode": "70",
85
+ "elk.spacing.componentComponent": "100"
70
86
  }
71
87
  }
72
88
  );
@@ -77,6 +93,26 @@ async function bpmnElkLayout(nodes, edges) {
77
93
  if (!laid) return node;
78
94
  return { ...node, position: laid.position, width: laid.width, height: laid.height };
79
95
  });
96
+ const lanesByPool = /* @__PURE__ */ new Map();
97
+ for (const node of updatedNodes) {
98
+ if (node.data.elementType === "Lane" && node.parentId) {
99
+ const arr = lanesByPool.get(node.parentId) ?? [];
100
+ arr.push(node.id);
101
+ lanesByPool.set(node.parentId, arr);
102
+ }
103
+ }
104
+ const nodeIndex = new Map(updatedNodes.map((n, i) => [n.id, i]));
105
+ for (const laneIds of lanesByPool.values()) {
106
+ const widths = laneIds.map((id) => updatedNodes[nodeIndex.get(id)]?.width ?? 0);
107
+ const maxWidth = Math.max(...widths);
108
+ if (maxWidth <= 0) continue;
109
+ for (const id of laneIds) {
110
+ const idx = nodeIndex.get(id);
111
+ if (idx !== void 0) {
112
+ updatedNodes[idx] = { ...updatedNodes[idx], width: maxWidth };
113
+ }
114
+ }
115
+ }
80
116
  const updatedEdges = edges.map((edge) => {
81
117
  const laid = edgeMap.get(edge.id);
82
118
  if (!laid) return edge;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/layout/elk.ts","../../src/layout/index.ts"],"names":[],"mappings":";;;;;;AAOA,IAAM,oBAAA,uBAA2B,GAAA,CAAqB;AAAA,EACpD,MAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF,CAAC,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A,EAAc,KAAA,EAAO,YAAA,EAA6B;AACpE;;;AC3GA,eAAsB,eAAA,CACpB,KAAA,EACA,KAAA,EACA,OAAA,GAAyB,EAAC,EACH;AACvB,EAAA,OAAO,WAAA,CAAY,OAAwB,KAAA,EAAwB;AAAA,IACjE,GAAG,OAAA;AAAA,IACH,WAAA,EAAa,CAAC,IAAA,KAAS,eAAA,CAAgB,IAAkB;AAAA,GAC1D,CAAA;AACH;AAMO,SAAS,qBAAA,CACd,OACA,MAAA,EACkB;AAClB,EAAA,OAAO,0BAAA,CAA2B,OAAO,MAAM,CAAA;AACjD","file":"index.js","sourcesContent":["import { elkLayout } from \"@aranzatech/diagrams-core/layout\";\nimport type { DiagramNode, DiagramEdge } from \"@aranzatech/diagrams-core/types\";\nimport type { BpmnRFNode, BpmnRFEdge } from \"../xml/types\";\nimport type { BpmnElementType } from \"../elements/types\";\nimport { getBpmnNodeSize } from \"../modeling\";\n\n// Container types that ELK auto-sizes based on their children.\nconst BPMN_CONTAINER_TYPES = new Set<BpmnElementType>([\n \"Pool\",\n \"Lane\",\n \"SubProcess\",\n \"Transaction\",\n \"EventSubProcess\",\n \"AdHocSubProcess\",\n]);\n\nconst CONTAINER_MIN_SIZE: Partial<Record<BpmnElementType, { w: number; h: number }>> = {\n Pool: { w: 560, h: 160 },\n Lane: { w: 480, h: 100 },\n SubProcess: { w: 200, h: 120 },\n Transaction: { w: 200, h: 120 },\n EventSubProcess: { w: 200, h: 120 },\n AdHocSubProcess: { w: 200, h: 120 },\n};\n\n// Left padding: label strip (≈30 px) + breathing room before first node.\nconst CONTAINER_PADDING: Partial<Record<BpmnElementType, string>> = {\n Pool: \"[top=30,left=55,bottom=30,right=40]\",\n Lane: \"[top=25,left=60,bottom=25,right=40]\",\n SubProcess: \"[top=25,left=35,bottom=25,right=35]\",\n Transaction: \"[top=25,left=35,bottom=25,right=35]\",\n EventSubProcess: \"[top=25,left=35,bottom=25,right=35]\",\n AdHocSubProcess: \"[top=25,left=35,bottom=25,right=35]\",\n};\n\n/**\n * ELK-based auto-layout for BPMN diagrams.\n *\n * Direction policy — always LEFT-TO-RIGHT to match screen anatomy:\n * - Root: RIGHT — free nodes and pools flow LR on the canvas.\n * - Pool that contains Lanes: DOWN internally so lanes stack top-to-bottom\n * (standard horizontal-pool anatomy); the pool itself is still placed LR.\n * - Pool without lanes, Lane, SubProcess, Transaction, AdHoc: RIGHT — content\n * flows left-to-right inside the container.\n * - All edges get ORTHOGONAL routing in a single INCLUDE_CHILDREN pass so\n * cross-pool and cross-lane edges are routed correctly.\n * - Containers auto-resize to fit their children.\n */\nexport async function bpmnElkLayout(\n nodes: BpmnRFNode[],\n edges: BpmnRFEdge[],\n): Promise<{ nodes: BpmnRFNode[]; edges: BpmnRFEdge[] }> {\n // Pools that contain at least one Lane child need DOWN internal direction so\n // the lanes stack vertically (standard horizontal BPMN pool).\n const poolsWithLanes = new Set<string>();\n for (const node of nodes) {\n if (node.data.elementType === \"Lane\" && node.parentId) {\n poolsWithLanes.add(node.parentId);\n }\n }\n\n const result = await elkLayout(\n nodes as unknown as DiagramNode[],\n edges as unknown as DiagramEdge[],\n {\n direction: \"LR\",\n getNodeSize: (node) => {\n const bNode = node as unknown as BpmnRFNode;\n if (BPMN_CONTAINER_TYPES.has(bNode.data.elementType)) return undefined;\n return getBpmnNodeSize(bNode);\n },\n isContainerNode: (node) =>\n BPMN_CONTAINER_TYPES.has((node as unknown as BpmnRFNode).data.elementType),\n getNodeLayoutOptions: (node) => {\n const type = (node as unknown as BpmnRFNode).data.elementType;\n if (!BPMN_CONTAINER_TYPES.has(type)) return undefined;\n const min = CONTAINER_MIN_SIZE[type];\n // Pool with Lanes: DOWN so lanes stack top-to-bottom inside the pool.\n // Everything else (Lane content, SubProcess, free tasks): RIGHT (LR).\n const dir = type === \"Pool\" && poolsWithLanes.has(node.id) ? \"DOWN\" : \"RIGHT\";\n return {\n \"elk.direction\": dir,\n \"elk.nodeSize.constraints\": \"MINIMUM_SIZE\",\n ...(min ? { \"elk.nodeSize.minimum\": `[w=${min.w},h=${min.h}]` } : {}),\n ...(CONTAINER_PADDING[type] ? { \"elk.padding\": CONTAINER_PADDING[type] } : {}),\n };\n },\n elk: {\n \"elk.algorithm\": \"layered\",\n \"elk.direction\": \"RIGHT\",\n \"elk.hierarchyHandling\": \"INCLUDE_CHILDREN\",\n \"elk.edgeRouting\": \"ORTHOGONAL\",\n \"elk.layered.spacing.nodeNodeBetweenLayers\": \"100\",\n \"elk.layered.spacing.edgeNodeBetweenLayers\": \"40\",\n \"elk.spacing.nodeNode\": \"60\",\n \"elk.spacing.componentComponent\": \"80\",\n },\n },\n );\n\n const nodeMap = new Map(result.nodes.map((n) => [n.id, n]));\n const edgeMap = new Map(result.edges.map((e) => [e.id, e]));\n\n const updatedNodes = nodes.map((node) => {\n const laid = nodeMap.get(node.id);\n if (!laid) return node;\n return { ...node, position: laid.position, width: laid.width, height: laid.height };\n });\n\n const updatedEdges = edges.map((edge) => {\n const laid = edgeMap.get(edge.id);\n if (!laid) return edge;\n const nextData = { ...edge.data };\n if (laid.points && laid.points.length > 0) {\n nextData.routingPoints = laid.points;\n } else {\n delete nextData.routingPoints;\n }\n return { ...edge, data: nextData };\n });\n\n return { nodes: updatedNodes, edges: updatedEdges as BpmnRFEdge[] };\n}\n","import type { DiagramEdge, LayoutOptions, LayoutResult } from \"@aranzatech/diagrams-core/types\";\nimport { dagreLayout, applyLayoutResultToDiagram } from \"@aranzatech/diagrams-core/layout\";\nimport type { DiagramNode } from \"@aranzatech/diagrams-core/types\";\nimport type { BpmnRFNode, BpmnRFEdge } from \"../xml/types\";\nimport { getBpmnNodeSize } from \"../modeling\";\nimport type { BpmnDiagramState } from \"../modeling\";\n\nexport { applyLayoutResultToDiagram };\nexport { bpmnElkLayout } from \"./elk\";\n\n/**\n * Dagre layout pre-configured for BPMN diagrams.\n * Uses BPMN-specific node sizes (events 52×52, gateways 64×64, tasks 192×64, etc.)\n * instead of the generic fallback, which prevents overlaps and poor spacing.\n */\nexport async function bpmnDagreLayout(\n nodes: BpmnRFNode[],\n edges: BpmnRFEdge[],\n options: LayoutOptions = {},\n): Promise<LayoutResult> {\n return dagreLayout(nodes as DiagramNode[], edges as DiagramEdge[], {\n ...options,\n getNodeSize: (node) => getBpmnNodeSize(node as BpmnRFNode),\n });\n}\n\n/**\n * Applies a bpmn dagre layout result back to the diagram state.\n * Convenience wrapper so callers only need one import.\n */\nexport function applyBpmnLayoutResult(\n state: BpmnDiagramState,\n result: LayoutResult,\n): BpmnDiagramState {\n return applyLayoutResultToDiagram(state, result) as BpmnDiagramState;\n}\n"]}
1
+ {"version":3,"sources":["../../src/layout/elk.ts","../../src/layout/index.ts"],"names":[],"mappings":";;;;;;AAOA,IAAM,oBAAA,uBAA2B,GAAA,CAAqB;AAAA,EACpD,MAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF,CAAC,CAAA;AAED,IAAM,kBAAA,GAAiF;AAAA,EACrF,IAAA,EAAM,EAAE,CAAA,EAAG,GAAA,EAAK,GAAG,GAAA,EAAI;AAAA,EACvB,IAAA,EAAM,EAAE,CAAA,EAAG,GAAA,EAAK,GAAG,GAAA,EAAI;AAAA,EACvB,UAAA,EAAY,EAAE,CAAA,EAAG,GAAA,EAAK,GAAG,GAAA,EAAI;AAAA,EAC7B,WAAA,EAAa,EAAE,CAAA,EAAG,GAAA,EAAK,GAAG,GAAA,EAAI;AAAA,EAC9B,eAAA,EAAiB,EAAE,CAAA,EAAG,GAAA,EAAK,GAAG,GAAA,EAAI;AAAA,EAClC,eAAA,EAAiB,EAAE,CAAA,EAAG,GAAA,EAAK,GAAG,GAAA;AAChC,CAAA;AAIA,IAAM,iBAAA,GAA8D;AAAA,EAClE,IAAA,EAAM,qCAAA;AAAA,EACN,IAAA,EAAM,qCAAA;AAAA,EACN,UAAA,EAAY,qCAAA;AAAA,EACZ,WAAA,EAAa,qCAAA;AAAA,EACb,eAAA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MAAM,CAAA;AACjD","file":"index.js","sourcesContent":["import { elkLayout } from \"@aranzatech/diagrams-core/layout\";\nimport type { DiagramNode, DiagramEdge } from \"@aranzatech/diagrams-core/types\";\nimport type { BpmnRFNode, BpmnRFEdge } from \"../xml/types\";\nimport type { BpmnElementType } from \"../elements/types\";\nimport { getBpmnNodeSize } from \"../modeling\";\n\n// Container types that ELK auto-sizes based on their children.\nconst BPMN_CONTAINER_TYPES = new Set<BpmnElementType>([\n \"Pool\",\n \"Lane\",\n \"SubProcess\",\n \"Transaction\",\n \"EventSubProcess\",\n \"AdHocSubProcess\",\n]);\n\nconst CONTAINER_MIN_SIZE: Partial<Record<BpmnElementType, { w: number; h: number }>> = {\n Pool: { w: 720, h: 200 },\n Lane: { w: 600, h: 160 },\n SubProcess: { w: 240, h: 140 },\n Transaction: { w: 240, h: 140 },\n EventSubProcess: { w: 240, h: 140 },\n AdHocSubProcess: { w: 240, h: 140 },\n};\n\n// Padding inside each container type.\n// Left padding for Pool/Lane accounts for the vertical label strip (~30px) + breathing room.\nconst CONTAINER_PADDING: Partial<Record<BpmnElementType, string>> = {\n Pool: \"[top=30,left=60,bottom=30,right=50]\",\n Lane: \"[top=40,left=70,bottom=40,right=50]\",\n SubProcess: \"[top=30,left=40,bottom=30,right=40]\",\n Transaction: \"[top=30,left=40,bottom=30,right=40]\",\n EventSubProcess: \"[top=30,left=40,bottom=30,right=40]\",\n AdHocSubProcess: \"[top=30,left=40,bottom=30,right=40]\",\n};\n\n/**\n * ELK-based auto-layout for BPMN diagrams.\n *\n * Spacing philosophy: fixed, generous values that scale consistently\n * regardless of diagram size. \"Air\" between elements is not waste —\n * it is what makes the flow readable to the human eye.\n *\n * Direction policy:\n * - Root: RIGHT — free nodes and pools flow LR on the canvas.\n * - Pool with Lanes: DOWN internally so lanes stack top-to-bottom;\n * the pool itself is placed LR on the canvas.\n * - Lane / SubProcess / Pool-without-lanes: RIGHT — content flows LR.\n * - Each container runs its own INCLUDE_CHILDREN pass (per-container\n * hierarchyHandling) so cross-lane edges are routed correctly without\n * the global RIGHT direction forcing Lane containers sideways.\n * - Root uses INHERIT so each pool is laid out independently.\n * - Post-processing equalises Lane widths within each Pool so all Lanes\n * span the full Pool width.\n */\nexport async function bpmnElkLayout(\n nodes: BpmnRFNode[],\n edges: BpmnRFEdge[],\n): Promise<{ nodes: BpmnRFNode[]; edges: BpmnRFEdge[] }> {\n // Pools that directly contain at least one Lane.\n const poolsWithLanes = new Set<string>();\n for (const node of nodes) {\n if (node.data.elementType === \"Lane\" && node.parentId) {\n poolsWithLanes.add(node.parentId);\n }\n }\n\n const result = await elkLayout(\n nodes as unknown as DiagramNode[],\n edges as unknown as DiagramEdge[],\n {\n direction: \"LR\",\n getNodeSize: (node) => {\n const bNode = node as unknown as BpmnRFNode;\n if (BPMN_CONTAINER_TYPES.has(bNode.data.elementType)) return undefined;\n return getBpmnNodeSize(bNode);\n },\n isContainerNode: (node) =>\n BPMN_CONTAINER_TYPES.has((node as unknown as BpmnRFNode).data.elementType),\n getNodeLayoutOptions: (node) => {\n const bNode = node as unknown as BpmnRFNode;\n const type = bNode.data.elementType;\n if (!BPMN_CONTAINER_TYPES.has(type)) return undefined;\n\n const min = CONTAINER_MIN_SIZE[type];\n const isPoolWithLanes = type === \"Pool\" && poolsWithLanes.has(node.id);\n\n // Pool with Lanes stacks Lanes top-to-bottom (standard horizontal BPMN).\n // Everything else flows left-to-right.\n const dir = isPoolWithLanes ? \"DOWN\" : \"RIGHT\";\n\n return {\n \"elk.direction\": dir,\n \"elk.nodeSize.constraints\": \"MINIMUM_SIZE\",\n // Each container handles its own layout pass so cross-lane edges\n // participate in the internal layout without the global direction\n // forcing Lane containers to align sideways.\n \"elk.hierarchyHandling\": \"INCLUDE_CHILDREN\",\n // Lanes within a Pool share a border — zero gap between them.\n // Other containers keep the tighter inner spacing.\n ...(isPoolWithLanes\n ? { \"elk.spacing.nodeNode\": \"0\", \"elk.spacing.componentComponent\": \"0\" }\n : {\n \"elk.layered.spacing.nodeNodeBetweenLayers\": \"100\",\n \"elk.layered.spacing.edgeNodeBetweenLayers\": \"45\",\n \"elk.spacing.nodeNode\": \"50\",\n }),\n ...(min ? { \"elk.nodeSize.minimum\": `[w=${min.w},h=${min.h}]` } : {}),\n ...(CONTAINER_PADDING[type] ? { \"elk.padding\": CONTAINER_PADDING[type] } : {}),\n };\n },\n elk: {\n \"elk.algorithm\": \"layered\",\n \"elk.direction\": \"RIGHT\",\n // INHERIT: each container handles its own INCLUDE_CHILDREN pass so\n // the global RIGHT direction does not force Lane containers sideways.\n \"elk.hierarchyHandling\": \"INHERIT\",\n \"elk.edgeRouting\": \"ORTHOGONAL\",\n // Global spacing — generous values for visual breathing room.\n \"elk.layered.spacing.nodeNodeBetweenLayers\": \"120\",\n \"elk.layered.spacing.edgeNodeBetweenLayers\": \"50\",\n \"elk.spacing.nodeNode\": \"70\",\n \"elk.spacing.componentComponent\": \"100\",\n },\n },\n );\n\n const nodeMap = new Map(result.nodes.map((n) => [n.id, n]));\n const edgeMap = new Map(result.edges.map((e) => [e.id, e]));\n\n const updatedNodes = nodes.map((node) => {\n const laid = nodeMap.get(node.id);\n if (!laid) return node;\n return { ...node, position: laid.position, width: laid.width, height: laid.height };\n });\n\n // Post-processing: equalise Lane widths within each Pool so all Lanes\n // span the full Pool width regardless of their individual content width.\n const lanesByPool = new Map<string, string[]>();\n for (const node of updatedNodes) {\n if (node.data.elementType === \"Lane\" && node.parentId) {\n const arr = lanesByPool.get(node.parentId) ?? [];\n arr.push(node.id);\n lanesByPool.set(node.parentId, arr);\n }\n }\n const nodeIndex = new Map(updatedNodes.map((n, i) => [n.id, i]));\n for (const laneIds of lanesByPool.values()) {\n const widths = laneIds.map((id) => updatedNodes[nodeIndex.get(id)!]?.width ?? 0);\n const maxWidth = Math.max(...widths);\n if (maxWidth <= 0) continue;\n for (const id of laneIds) {\n const idx = nodeIndex.get(id);\n if (idx !== undefined) {\n updatedNodes[idx] = { ...updatedNodes[idx], width: maxWidth };\n }\n }\n }\n\n const updatedEdges = edges.map((edge) => {\n const laid = edgeMap.get(edge.id);\n if (!laid) return edge;\n const nextData = { ...edge.data };\n if (laid.points && laid.points.length > 0) {\n nextData.routingPoints = laid.points;\n } else {\n delete nextData.routingPoints;\n }\n return { ...edge, data: nextData };\n });\n\n return { nodes: updatedNodes, edges: updatedEdges as BpmnRFEdge[] };\n}\n","import type { DiagramEdge, LayoutOptions, LayoutResult } from \"@aranzatech/diagrams-core/types\";\nimport { dagreLayout, applyLayoutResultToDiagram } from \"@aranzatech/diagrams-core/layout\";\nimport type { DiagramNode } from \"@aranzatech/diagrams-core/types\";\nimport type { BpmnRFNode, BpmnRFEdge } from \"../xml/types\";\nimport { getBpmnNodeSize } from \"../modeling\";\nimport type { BpmnDiagramState } from \"../modeling\";\n\nexport { applyLayoutResultToDiagram };\nexport { bpmnElkLayout } from \"./elk\";\n\n/**\n * Dagre layout pre-configured for BPMN diagrams.\n * Uses BPMN-specific node sizes (events 52×52, gateways 64×64, tasks 192×64, etc.)\n * instead of the generic fallback, which prevents overlaps and poor spacing.\n */\nexport async function bpmnDagreLayout(\n nodes: BpmnRFNode[],\n edges: BpmnRFEdge[],\n options: LayoutOptions = {},\n): Promise<LayoutResult> {\n return dagreLayout(nodes as DiagramNode[], edges as DiagramEdge[], {\n ...options,\n getNodeSize: (node) => getBpmnNodeSize(node as BpmnRFNode),\n });\n}\n\n/**\n * Applies a bpmn dagre layout result back to the diagram state.\n * Convenience wrapper so callers only need one import.\n */\nexport function applyBpmnLayoutResult(\n state: BpmnDiagramState,\n result: LayoutResult,\n): BpmnDiagramState {\n return applyLayoutResultToDiagram(state, result) as BpmnDiagramState;\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import { ModelingRules, ClipboardState, DiagramSnapshot, DiagramState, DiagramEventBus, ResizeHandlePosition, DiagramCommand, ConnectionValidator, SmartGuideResult, SelectionState, LayoutCacheOptions, LayoutCache, EdgeLabelOffsetOptions, EdgeLabelLayout, CommandStackState, Viewport, LayoutFn } from '@aranzatech/diagrams-core';
2
2
  import { DiagramDocument, CreateDiagramDocumentOptions } from '@aranzatech/diagrams-core/serialization';
3
- import { c as BpmnEdgeType, b as BpmnEdgeData, f as BpmnElementType, m as BpmnNodeData } from '../types-Dfrt0wVs.cjs';
4
- import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-s2_VvPGf.cjs';
5
- export { g as getBpmnElementSize, i as isBpmnElementResizable } from '../catalog-BiLXVn-2.cjs';
3
+ import { c as BpmnEdgeType, b as BpmnEdgeData, f as BpmnElementType, m as BpmnNodeData } from '../types-y-ZbX-ff.cjs';
4
+ import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-jIDz306Y.cjs';
5
+ export { g as getBpmnElementSize, i as isBpmnElementResizable } from '../catalog-xOMF2ifW.cjs';
6
6
  import '@xyflow/react';
7
7
 
8
8
  type BpmnDiagramState = DiagramState<BpmnRFNode, BpmnRFEdge>;
@@ -1,8 +1,8 @@
1
1
  import { ModelingRules, ClipboardState, DiagramSnapshot, DiagramState, DiagramEventBus, ResizeHandlePosition, DiagramCommand, ConnectionValidator, SmartGuideResult, SelectionState, LayoutCacheOptions, LayoutCache, EdgeLabelOffsetOptions, EdgeLabelLayout, CommandStackState, Viewport, LayoutFn } from '@aranzatech/diagrams-core';
2
2
  import { DiagramDocument, CreateDiagramDocumentOptions } from '@aranzatech/diagrams-core/serialization';
3
- import { c as BpmnEdgeType, b as BpmnEdgeData, f as BpmnElementType, m as BpmnNodeData } from '../types-Dfrt0wVs.js';
4
- import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-rEfHsPr5.js';
5
- export { g as getBpmnElementSize, i as isBpmnElementResizable } from '../catalog-Di2nzGs9.js';
3
+ import { c as BpmnEdgeType, b as BpmnEdgeData, f as BpmnElementType, m as BpmnNodeData } from '../types-y-ZbX-ff.js';
4
+ import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-DG5yPKld.js';
5
+ export { g as getBpmnElementSize, i as isBpmnElementResizable } from '../catalog-CK3_4cOb.js';
6
6
  import '@xyflow/react';
7
7
 
8
8
  type BpmnDiagramState = DiagramState<BpmnRFNode, BpmnRFEdge>;
@@ -1,5 +1,5 @@
1
1
  import { Node, Edge } from '@xyflow/react';
2
- import { m as BpmnNodeData, b as BpmnEdgeData, a as BpmnDefinitionsSet } from './types-Dfrt0wVs.js';
2
+ import { m as BpmnNodeData, b as BpmnEdgeData, a as BpmnDefinitionsSet } from './types-y-ZbX-ff.js';
3
3
 
4
4
  type BpmnRFNode = Node<BpmnNodeData>;
5
5
  type BpmnRFEdge = Edge<BpmnEdgeData>;
@@ -1,5 +1,5 @@
1
1
  import { Node, Edge } from '@xyflow/react';
2
- import { m as BpmnNodeData, b as BpmnEdgeData, a as BpmnDefinitionsSet } from './types-Dfrt0wVs.cjs';
2
+ import { m as BpmnNodeData, b as BpmnEdgeData, a as BpmnDefinitionsSet } from './types-y-ZbX-ff.cjs';
3
3
 
4
4
  type BpmnRFNode = Node<BpmnNodeData>;
5
5
  type BpmnRFEdge = Edge<BpmnEdgeData>;
@@ -230,6 +230,9 @@ interface BpmnEdgeData extends Record<string, unknown> {
230
230
  x: number;
231
231
  y: number;
232
232
  }>;
233
+ /** Manual label offset from the auto-computed midpoint (px). Set by dragging the label. */
234
+ labelOffsetX?: number;
235
+ labelOffsetY?: number;
233
236
  /** MessageFlow: free-text description or JSON schema of the message payload. */
234
237
  payloadSchema?: string;
235
238
  /** MessageFlow: FEEL/JSONPath correlation key expression, e.g. $.orderId. */
@@ -230,6 +230,9 @@ interface BpmnEdgeData extends Record<string, unknown> {
230
230
  x: number;
231
231
  y: number;
232
232
  }>;
233
+ /** Manual label offset from the auto-computed midpoint (px). Set by dragging the label. */
234
+ labelOffsetX?: number;
235
+ labelOffsetY?: number;
233
236
  /** MessageFlow: free-text description or JSON schema of the message payload. */
234
237
  payloadSchema?: string;
235
238
  /** MessageFlow: FEEL/JSONPath correlation key expression, e.g. $.orderId. */
@@ -1,6 +1,6 @@
1
- import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-s2_VvPGf.cjs';
1
+ import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-jIDz306Y.cjs';
2
2
  import '@xyflow/react';
3
- import '../types-Dfrt0wVs.cjs';
3
+ import '../types-y-ZbX-ff.cjs';
4
4
 
5
5
  type BpmnValidationSeverity = "error" | "warning" | "info";
6
6
  interface BpmnValidationIssue {
@@ -1,6 +1,6 @@
1
- import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-rEfHsPr5.js';
1
+ import { d as BpmnRFNode, c as BpmnRFEdge } from '../types-DG5yPKld.js';
2
2
  import '@xyflow/react';
3
- import '../types-Dfrt0wVs.js';
3
+ import '../types-y-ZbX-ff.js';
4
4
 
5
5
  type BpmnValidationSeverity = "error" | "warning" | "info";
6
6
  interface BpmnValidationIssue {
@@ -1,7 +1,7 @@
1
- import { a as BpmnImportResult, d as BpmnRFNode, c as BpmnRFEdge, B as BpmnExportOptions } from '../types-s2_VvPGf.cjs';
2
- export { b as BpmnProcessModel } from '../types-s2_VvPGf.cjs';
1
+ import { a as BpmnImportResult, d as BpmnRFNode, c as BpmnRFEdge, B as BpmnExportOptions } from '../types-jIDz306Y.cjs';
2
+ export { b as BpmnProcessModel } from '../types-jIDz306Y.cjs';
3
3
  import '@xyflow/react';
4
- import '../types-Dfrt0wVs.cjs';
4
+ import '../types-y-ZbX-ff.cjs';
5
5
 
6
6
  /**
7
7
  * Parse a BPMN 2.0 XML string into a ReactFlow-compatible node/edge graph.
@@ -1,7 +1,7 @@
1
- import { a as BpmnImportResult, d as BpmnRFNode, c as BpmnRFEdge, B as BpmnExportOptions } from '../types-rEfHsPr5.js';
2
- export { b as BpmnProcessModel } from '../types-rEfHsPr5.js';
1
+ import { a as BpmnImportResult, d as BpmnRFNode, c as BpmnRFEdge, B as BpmnExportOptions } from '../types-DG5yPKld.js';
2
+ export { b as BpmnProcessModel } from '../types-DG5yPKld.js';
3
3
  import '@xyflow/react';
4
- import '../types-Dfrt0wVs.js';
4
+ import '../types-y-ZbX-ff.js';
5
5
 
6
6
  /**
7
7
  * Parse a BPMN 2.0 XML string into a ReactFlow-compatible node/edge graph.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aranzatech/diagrams-bpmn",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "description": "BPMN 2.0 elements, nodes, edges, XML import/export, token simulation",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -73,7 +73,7 @@
73
73
  "deploy:npm": "npm install && npm run build && npm publish --access public"
74
74
  },
75
75
  "dependencies": {
76
- "@aranzatech/diagrams-core": "^0.2.7",
76
+ "@aranzatech/diagrams-core": "^0.2.8",
77
77
  "bpmn-moddle": "^10.0.0"
78
78
  },
79
79
  "peerDependencies": {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/edges/path.ts","../src/edges/SequenceFlowEdge.tsx","../src/edges/MessageFlowEdge.tsx","../src/edges/AssociationEdge.tsx","../src/edges/DataAssociationEdge.tsx","../src/edges/ConversationLinkEdge.tsx","../src/edges/edgeTypes.ts"],"names":["pointsToSvgPath","getOrthogonalPath","jsxs","Fragment","jsx","BaseEdge","EdgeLabelRenderer"],"mappings":";;;;;;AAwBO,SAAS,oBAAoB,MAAA,EAAgC;AAClE,EAAA,IAAI,MAAA,CAAO,WAAW,CAAA,EAAG,OAAO,EAAE,CAAA,EAAG,CAAA,EAAG,GAAG,CAAA,EAAE;AAC7C,EAAA,IAAI,MAAA,CAAO,MAAA,KAAW,CAAA,EAAG,OAAO,OAAO,CAAC,CAAA;AAExC,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,MAAM,UAAoB,EAAC;AAE3B,EAAA,KAAA,IAAS,IAAI,CAAA,EAAG,CAAA,GAAI,MAAA,CAAO,MAAA,EAAQ,KAAK,CAAA,EAAG;AACzC,IAAA,MAAM,EAAA,GAAK,OAAO,CAAC,CAAA,CAAE,IAAI,MAAA,CAAO,CA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;AAAO;AAAA,KAChD;AAAA,oBAEAD,GAAAA;AAAA,MAACC,QAAAA;AAAA,MAAA;AAAA,QACC,IAAA;AAAA,QACA,OAAO,EAAE,MAAA,EAAQ,WAAW,WAAA,EAAa,CAAA,EAAG,MAAM,MAAA;AAAO;AAAA,KAC3D;AAAA,IAEC,CAAA,EAAG,KAAA,oBACFD,GAAAA,CAAC,MAAA,EAAA,EAAK,QAAA,EAAU,UAAA,CAAW,QAAA,EAAU,UAAA,EAAY,UAAA,CAAW,UAAA,EAAY,IAAA,EAAM,MAAA,EAC5E,0BAAAA,GAAAA,CAAC,UAAA,EAAA,EAAS,IAAA,EAAM,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,EAAI,WAAA,EAAY,KAAA,EAAM,UAAA,EAAW,QAAA,EACtD,QAAA,EAAA,CAAA,CAAE,KAAA,EACL,CAAA,EACF;AAAA,GAAA,EAEJ,CAAA;AAEJ;;;ACjCO,IAAM,eAAA,GAA6B;AAAA,EACxC,YAAA,EAAc,gBAAA;AAAA,EACd,WAAA,EAAa,eAAA;AAAA,EACb,WAAA,EAAa,eAAA;AAAA,EACb,eAAA,EAAiB,mBAAA;AAAA,EACjB,gBAAA,EAAkB;AACpB","file":"chunk-O3NWJ5H7.js","sourcesContent":["import type { Position } from \"@xyflow/react\";\n\nexport interface EdgePoint {\n x: number;\n y: number;\n}\n\nexport function getEdgePoints(\n sourceX: number,\n sourceY: number,\n targetX: number,\n targetY: number,\n routingPoints?: EdgePoint[],\n): EdgePoint[] {\n if (routingPoints && routingPoints.length >= 2) {\n return routingPoints;\n }\n\n return [\n { x: sourceX, y: sourceY },\n { x: targetX, y: targetY },\n ];\n}\n\nexport function getPolylineMidpoint(points: EdgePoint[]): EdgePoint {\n if (points.length === 0) return { x: 0, y: 0 };\n if (points.length === 1) return points[0];\n\n let total = 0;\n const lengths: number[] = [];\n\n for (let i = 1; i < points.length; i += 1) {\n const dx = points[i].x - points[i - 1].x;\n const dy = points[i].y - points[i - 1].y;\n const length = Math.hypot(dx, dy);\n lengths.push(length);\n total += length;\n }\n\n const halfway = total / 2;\n let traversed = 0;\n\n for (let i = 1; i < points.length; i += 1) {\n const length = lengths[i - 1];\n if (traversed + length >= halfway) {\n const ratio = length === 0 ? 0 : (halfway - traversed) / length;\n return {\n x: points[i - 1].x + (points[i].x - points[i - 1].x) * ratio,\n y: points[i - 1].y + (points[i].y - points[i - 1].y) * ratio,\n };\n }\n traversed += length;\n }\n\n return points[points.length - 1];\n}\n\nexport function getSegmentAngle(points: EdgePoint[]): number {\n if (points.length < 2) return 0;\n const from = points[0];\n const to = points[1];\n return Math.atan2(to.y - from.y, to.x - from.x);\n}\n\nexport function getDefaultFlowMarkerPath(points: EdgePoint[]): string | null {\n if (points.length < 2) return null;\n\n const start = points[0];\n const angle = getSegmentAngle(points);\n const anchorX = start.x + Math.cos(angle) * 16;\n const anchorY = start.y + Math.sin(angle) * 16;\n const normalAngle = angle + Math.PI / 2;\n const half = 7;\n\n const x1 = anchorX + Math.cos(normalAngle) * half;\n const y1 = anchorY + Math.sin(normalAngle) * half;\n const x2 = anchorX - Math.cos(normalAngle) * half;\n const y2 = anchorY - Math.sin(normalAngle) * half;\n\n return `M ${x1} ${y1} L ${x2} ${y2}`;\n}\n\nexport function fallbackAssociationDirection(\n sourcePosition?: Position,\n targetPosition?: Position,\n): \"horizontal\" | \"vertical\" {\n if (sourcePosition === \"left\" || sourcePosition === \"right\" || targetPosition === \"left\" || targetPosition === \"right\") {\n return \"horizontal\";\n }\n\n return \"vertical\";\n}\n","import { BaseEdge, EdgeLabelRenderer, type EdgeProps } from \"@xyflow/react\";\nimport { getOrthogonalPath, pointsToSvgPath } from \"@aranzatech/diagrams-core/routing\";\nimport type { BpmnEdgeData } from \"../elements/types\";\nimport { getDefaultFlowMarkerPath, getPolylineMidpoint } from \"./path\";\n\nexport function SequenceFlowEdge({\n id,\n sourceX, sourceY, targetX, targetY,\n sourcePosition, targetPosition,\n data, label, markerEnd, style, selected,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const points = d?.routingPoints;\n const polyline = points && points.length >= 2\n ? [{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }]\n : [{ x: sourceX, y: sourceY }, { x: targetX, y: targetY }];\n\n const path = points && points.length >= 2\n ? pointsToSvgPath([{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }])\n : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);\n\n const midpoint = getPolylineMidpoint(polyline);\n const defaultMarkerPath = d?.isDefault ? getDefaultFlowMarkerPath(polyline) : null;\n\n return (\n <>\n <BaseEdge\n id={id}\n path={path}\n {...(d?.conditionExpression ? { markerStart: \"url(#bpmn-diamond-open)\" } : {})}\n markerEnd={markerEnd ?? \"url(#bpmn-arrow)\"}\n style={{\n stroke: selected ? \"#1a56db\" : \"#404040\",\n strokeWidth: selected ? 2 : 1.5,\n ...(style ?? {}),\n }}\n />\n {defaultMarkerPath && (\n <path\n d={defaultMarkerPath}\n fill=\"none\"\n stroke={selected ? \"#1a56db\" : \"#404040\"}\n strokeWidth={selected ? 2 : 1.5}\n strokeLinecap=\"round\"\n data-testid=\"bpmn-default-flow-marker\"\n />\n )}\n {(label ?? d?.label) && (\n <EdgeLabelRenderer>\n <div\n style={{\n position: \"absolute\",\n transform: `translate(-50%,-50%) translate(${midpoint.x}px,${midpoint.y}px)`,\n fontSize: 11,\n fontFamily: \"Inter, system-ui, sans-serif\",\n background: \"rgba(255,255,255,0.85)\",\n padding: \"1px 4px\",\n borderRadius: 2,\n pointerEvents: \"all\",\n }}\n className=\"nodrag nopan\"\n >\n {label ?? d?.label}\n </div>\n </EdgeLabelRenderer>\n )}\n </>\n );\n}\n","import { BaseEdge, EdgeLabelRenderer, type EdgeProps } from \"@xyflow/react\";\nimport { getOrthogonalPath, pointsToSvgPath } from \"@aranzatech/diagrams-core/routing\";\nimport type { BpmnEdgeData } from \"../elements/types\";\nimport { getPolylineMidpoint } from \"./path\";\n\nexport function MessageFlowEdge({\n id,\n sourceX, sourceY, targetX, targetY,\n sourcePosition, targetPosition,\n data, label, markerEnd, style, selected,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const points = d?.routingPoints;\n const polyline = points && points.length >= 2\n ? [{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }]\n : [{ x: sourceX, y: sourceY }, { x: targetX, y: targetY }];\n\n const path = points && points.length >= 2\n ? pointsToSvgPath([{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }])\n : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);\n\n const midpoint = getPolylineMidpoint(polyline);\n\n return (\n <>\n <BaseEdge\n id={id}\n path={path}\n markerStart=\"url(#bpmn-circle-open)\"\n markerEnd={markerEnd ?? \"url(#bpmn-arrow-open)\"}\n style={{\n stroke: selected ? \"#1a56db\" : \"#404040\",\n strokeWidth: selected ? 2 : 1.5,\n strokeDasharray: \"6 3\",\n ...(style ?? {}),\n }}\n />\n {(label ?? d?.label) && (\n <EdgeLabelRenderer>\n <div\n style={{\n position: \"absolute\",\n transform: `translate(-50%,-50%) translate(${midpoint.x}px,${midpoint.y}px)`,\n fontSize: 11,\n fontFamily: \"Inter, system-ui, sans-serif\",\n background: \"rgba(255,255,255,0.85)\",\n padding: \"1px 4px\",\n borderRadius: 2,\n pointerEvents: \"all\",\n }}\n className=\"nodrag nopan\"\n >\n {label ?? d?.label}\n </div>\n </EdgeLabelRenderer>\n )}\n </>\n );\n}\n","import { BaseEdge, type EdgeProps } from \"@xyflow/react\";\nimport { getOrthogonalPath, pointsToSvgPath } from \"@aranzatech/diagrams-core/routing\";\nimport type { BpmnEdgeData } from \"../elements/types\";\n\nexport function AssociationEdge({\n id,\n sourceX, sourceY, targetX, targetY,\n sourcePosition, targetPosition,\n data, style, selected,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const points = d?.routingPoints;\n const direction = d?.associationDirection ?? \"none\";\n\n const path = points && points.length >= 2\n ? pointsToSvgPath([{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }])\n : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);\n\n return (\n <BaseEdge\n id={id}\n path={path}\n {...(direction === \"both\" ? { markerStart: \"url(#bpmn-arrow-open)\" } : {})}\n {...(direction === \"one\" || direction === \"both\" ? { markerEnd: \"url(#bpmn-arrow-open)\" } : {})}\n style={{\n stroke: selected ? \"#1a56db\" : \"#888\",\n strokeWidth: 1,\n strokeDasharray: \"3 3\",\n ...(style ?? {}),\n }}\n />\n );\n}\n","import { BaseEdge, type EdgeProps } from \"@xyflow/react\";\nimport { getOrthogonalPath, pointsToSvgPath } from \"@aranzatech/diagrams-core/routing\";\nimport type { BpmnEdgeData } from \"../elements/types\";\n\nexport function DataAssociationEdge({\n id,\n sourceX, sourceY, targetX, targetY,\n sourcePosition, targetPosition,\n data, style, selected,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const points = d?.routingPoints;\n\n const path = points && points.length >= 2\n ? pointsToSvgPath([{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }])\n : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);\n\n return (\n <BaseEdge\n id={id}\n path={path}\n markerEnd=\"url(#bpmn-arrow-open)\"\n style={{\n stroke: selected ? \"#1a56db\" : \"#888\",\n strokeWidth: 1,\n strokeDasharray: \"3 3\",\n ...(style ?? {}),\n }}\n />\n );\n}\n","import type { EdgeProps } from \"@xyflow/react\";\nimport { BaseEdge, getStraightPath } from \"@xyflow/react\";\nimport type { BpmnEdgeData } from \"../elements/types\";\nimport { BPMN_THEME } from \"../nodes/shared/theme\";\n\n// BPMN 2.0 §12.2 — ConversationLink is rendered as a double line.\n// Technique: draw the path twice — wide stroke then narrower background —\n// to produce a parallel-line effect without complex path offsets.\n\nexport function ConversationLinkEdge({\n sourceX, sourceY, targetX, targetY,\n data, markerEnd,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const stroke = BPMN_THEME.stroke;\n\n const [path] = getStraightPath({ sourceX, sourceY, targetX, targetY });\n\n return (\n <g>\n {/* Outer (wide) stroke */}\n <BaseEdge\n path={path}\n {...(markerEnd ? { markerEnd } : {})}\n style={{ stroke, strokeWidth: 5, fill: \"none\" }}\n />\n {/* Inner white gap — creates double-line visual */}\n <BaseEdge\n path={path}\n style={{ stroke: \"#ffffff\", strokeWidth: 2, fill: \"none\" }}\n />\n {/* Label */}\n {d?.label && (\n <text fontSize={BPMN_THEME.fontSize} fontFamily={BPMN_THEME.fontFamily} fill={stroke}>\n <textPath href={`#${path}`} startOffset=\"50%\" textAnchor=\"middle\">\n {d.label}\n </textPath>\n </text>\n )}\n </g>\n );\n}\n","import type { EdgeTypes } from \"@xyflow/react\";\nimport { SequenceFlowEdge } from \"./SequenceFlowEdge\";\nimport { MessageFlowEdge } from \"./MessageFlowEdge\";\nimport { AssociationEdge } from \"./AssociationEdge\";\nimport { DataAssociationEdge } from \"./DataAssociationEdge\";\nimport { ConversationLinkEdge } from \"./ConversationLinkEdge\";\n\n/** Pass this object to `DiagramCanvas` as `edgeTypes`. */\nexport const BPMN_EDGE_TYPES: EdgeTypes = {\n sequenceFlow: SequenceFlowEdge,\n messageFlow: MessageFlowEdge,\n association: AssociationEdge,\n dataAssociation: DataAssociationEdge,\n conversationLink: ConversationLinkEdge,\n};\n"]}