@aranzatech/diagrams-bpmn 0.3.5 → 0.3.6
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-DNIyjHbl.d.ts → catalog-CYZHikuU.d.ts} +1 -1
- package/dist/{catalog-DG-sz0VM.d.cts → catalog-C_S9hyyn.d.cts} +1 -1
- package/dist/{chunk-JFYWN6QH.js → chunk-EMTO53AN.js} +52 -73
- package/dist/chunk-EMTO53AN.js.map +1 -0
- package/dist/chunk-G22XQD6H.js +64 -0
- package/dist/chunk-G22XQD6H.js.map +1 -0
- package/dist/{chunk-NYIYQUGX.js → chunk-OFOTX3LA.js} +124 -20
- package/dist/chunk-OFOTX3LA.js.map +1 -0
- package/dist/{chunk-YAYZW45I.js → chunk-SRUWPELT.js} +80 -3
- package/dist/chunk-SRUWPELT.js.map +1 -0
- package/dist/edges/index.cjs +73 -35
- package/dist/edges/index.cjs.map +1 -1
- package/dist/edges/index.js +2 -1
- 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 +194 -53
- 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 +4 -3
- package/dist/index.js.map +1 -1
- package/dist/layout/index.cjs +1146 -872
- 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 +560 -89
- package/dist/layout/index.js.map +1 -1
- package/dist/modeling/index.cjs +78 -0
- package/dist/modeling/index.cjs.map +1 -1
- package/dist/modeling/index.d.cts +10 -5
- package/dist/modeling/index.d.ts +10 -5
- package/dist/modeling/index.js +1 -1
- package/dist/{types-nvF59RGF.d.cts → types--x9aoecw.d.cts} +5 -0
- package/dist/{types-nvF59RGF.d.ts → types--x9aoecw.d.ts} +5 -0
- package/dist/{types-dQUuSnV5.d.cts → types-CrFDTGo9.d.cts} +1 -1
- package/dist/{types-CuDL2YGL.d.ts → types-DoPv3m7u.d.ts} +2 -2
- package/dist/{types-X5FyP8oS.d.ts → types-DteJykQG.d.ts} +1 -1
- package/dist/{types-CDp9kWQ4.d.cts → types-YZ4sj3Ih.d.cts} +2 -2
- package/dist/validation/index.d.cts +3 -3
- package/dist/validation/index.d.ts +3 -3
- package/dist/xml/index.cjs +162 -18
- 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 +2 -1
- package/package.json +1 -1
- package/dist/chunk-FFWJA5BV.js +0 -163
- package/dist/chunk-FFWJA5BV.js.map +0 -1
- package/dist/chunk-JFYWN6QH.js.map +0 -1
- package/dist/chunk-NYIYQUGX.js.map +0 -1
- package/dist/chunk-YAYZW45I.js.map +0 -1
- package/dist/elk-QT7H4252.js +0 -6
- package/dist/elk-QT7H4252.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as BpmnElementType, d as BpmnElementMeta, e as BpmnElementSize } from './types
|
|
1
|
+
import { f as BpmnElementType, d as BpmnElementMeta, e as BpmnElementSize } from './types--x9aoecw.js';
|
|
2
2
|
|
|
3
3
|
declare const BPMN_ELEMENT_CATALOG: Record<BpmnElementType, BpmnElementMeta>;
|
|
4
4
|
declare function getElementMeta(type: BpmnElementType): BpmnElementMeta;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as BpmnElementType, d as BpmnElementMeta, e as BpmnElementSize } from './types
|
|
1
|
+
import { f as BpmnElementType, d as BpmnElementMeta, e as BpmnElementSize } from './types--x9aoecw.cjs';
|
|
2
2
|
|
|
3
3
|
declare const BPMN_ELEMENT_CATALOG: Record<BpmnElementType, BpmnElementMeta>;
|
|
4
4
|
declare function getElementMeta(type: BpmnElementType): BpmnElementMeta;
|
|
@@ -1,57 +1,11 @@
|
|
|
1
1
|
import { BPMN_THEME } from './chunk-PDTXM32P.js';
|
|
2
|
+
import { getPreferredLabelAnchor, getDefaultFlowMarkerPath } from './chunk-G22XQD6H.js';
|
|
2
3
|
import { useRef, useCallback } from 'react';
|
|
3
4
|
import { useReactFlow, BaseEdge, EdgeLabelRenderer, getStraightPath } from '@xyflow/react';
|
|
4
5
|
import { pointsToSvgPath, getOrthogonalPath } from '@aranzatech/diagrams-core/routing';
|
|
5
6
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
function getPreferredLabelAnchor(points) {
|
|
9
|
-
if (points.length === 0) return { x: 0, y: 0 };
|
|
10
|
-
if (points.length === 1) return points[0];
|
|
11
|
-
let bestIndex = 1;
|
|
12
|
-
let bestLength = -1;
|
|
13
|
-
for (let i = 1; i < points.length; i += 1) {
|
|
14
|
-
const dx2 = points[i].x - points[i - 1].x;
|
|
15
|
-
const dy2 = points[i].y - points[i - 1].y;
|
|
16
|
-
const length = Math.hypot(dx2, dy2);
|
|
17
|
-
if (length > bestLength) {
|
|
18
|
-
bestLength = length;
|
|
19
|
-
bestIndex = i;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
const from = points[bestIndex - 1];
|
|
23
|
-
const to = points[bestIndex];
|
|
24
|
-
const midpoint = {
|
|
25
|
-
x: from.x + (to.x - from.x) / 2,
|
|
26
|
-
y: from.y + (to.y - from.y) / 2
|
|
27
|
-
};
|
|
28
|
-
const dx = to.x - from.x;
|
|
29
|
-
const dy = to.y - from.y;
|
|
30
|
-
if (Math.abs(dx) >= Math.abs(dy)) {
|
|
31
|
-
return { x: midpoint.x, y: midpoint.y - 12 };
|
|
32
|
-
}
|
|
33
|
-
return { x: midpoint.x + 12, y: midpoint.y };
|
|
34
|
-
}
|
|
35
|
-
function getSegmentAngle(points) {
|
|
36
|
-
if (points.length < 2) return 0;
|
|
37
|
-
const from = points[0];
|
|
38
|
-
const to = points[1];
|
|
39
|
-
return Math.atan2(to.y - from.y, to.x - from.x);
|
|
40
|
-
}
|
|
41
|
-
function getDefaultFlowMarkerPath(points) {
|
|
42
|
-
if (points.length < 2) return null;
|
|
43
|
-
const start = points[0];
|
|
44
|
-
const angle = getSegmentAngle(points);
|
|
45
|
-
const anchorX = start.x + Math.cos(angle) * 16;
|
|
46
|
-
const anchorY = start.y + Math.sin(angle) * 16;
|
|
47
|
-
const normalAngle = angle + Math.PI / 2;
|
|
48
|
-
const half = 7;
|
|
49
|
-
const x1 = anchorX + Math.cos(normalAngle) * half;
|
|
50
|
-
const y1 = anchorY + Math.sin(normalAngle) * half;
|
|
51
|
-
const x2 = anchorX - Math.cos(normalAngle) * half;
|
|
52
|
-
const y2 = anchorY - Math.sin(normalAngle) * half;
|
|
53
|
-
return `M ${x1} ${y1} L ${x2} ${y2}`;
|
|
54
|
-
}
|
|
8
|
+
var BPMN_EDGE_LABEL_Z_INDEX = 1e3;
|
|
55
9
|
function SequenceFlowEdge({
|
|
56
10
|
id,
|
|
57
11
|
sourceX,
|
|
@@ -74,7 +28,7 @@ function SequenceFlowEdge({
|
|
|
74
28
|
const defaultMarkerPath = d?.isDefault ? getDefaultFlowMarkerPath(polyline) : null;
|
|
75
29
|
const labelX = labelAnchor.x + (d?.labelOffsetX ?? 0);
|
|
76
30
|
const labelY = labelAnchor.y + (d?.labelOffsetY ?? 0);
|
|
77
|
-
const strokeColor = selected ? "#1a56db" : "#404040";
|
|
31
|
+
const strokeColor = d?.color?.stroke ?? (selected ? "#1a56db" : "#404040");
|
|
78
32
|
const strokeWidth = selected ? 2.25 : 1.5;
|
|
79
33
|
const haloWidth = selected ? 7 : 5;
|
|
80
34
|
const { updateEdgeData, getViewport } = useReactFlow();
|
|
@@ -122,9 +76,9 @@ function SequenceFlowEdge({
|
|
|
122
76
|
...d?.conditionExpression ? { markerStart: "url(#bpmn-diamond-open)" } : {},
|
|
123
77
|
markerEnd: markerEnd ?? "url(#bpmn-arrow)",
|
|
124
78
|
style: {
|
|
79
|
+
...style ?? {},
|
|
125
80
|
stroke: strokeColor,
|
|
126
|
-
strokeWidth
|
|
127
|
-
...style ?? {}
|
|
81
|
+
strokeWidth
|
|
128
82
|
}
|
|
129
83
|
}
|
|
130
84
|
),
|
|
@@ -150,17 +104,17 @@ function SequenceFlowEdge({
|
|
|
150
104
|
transform: `translate(-50%,-50%) translate(${labelX}px,${labelY}px)`,
|
|
151
105
|
fontSize: 11,
|
|
152
106
|
fontFamily: '"IBM Plex Sans", Inter, system-ui, sans-serif',
|
|
153
|
-
background: "rgba(255,255,255,0.96)",
|
|
154
|
-
color:
|
|
107
|
+
background: d?.color?.fill ?? "rgba(255,255,255,0.96)",
|
|
108
|
+
color: strokeColor,
|
|
155
109
|
padding: "2px 6px",
|
|
156
110
|
borderRadius: 999,
|
|
157
|
-
border:
|
|
111
|
+
border: `1px solid ${d?.color?.stroke ?? "rgba(148, 163, 184, 0.45)"}`,
|
|
158
112
|
boxShadow: "0 1px 2px rgba(15, 23, 42, 0.10)",
|
|
159
113
|
pointerEvents: "all",
|
|
160
114
|
cursor: "grab",
|
|
161
115
|
userSelect: "none",
|
|
162
116
|
whiteSpace: "nowrap",
|
|
163
|
-
zIndex:
|
|
117
|
+
zIndex: BPMN_EDGE_LABEL_Z_INDEX
|
|
164
118
|
},
|
|
165
119
|
className: "nodrag nopan",
|
|
166
120
|
children: label ?? d?.label
|
|
@@ -168,6 +122,7 @@ function SequenceFlowEdge({
|
|
|
168
122
|
) })
|
|
169
123
|
] });
|
|
170
124
|
}
|
|
125
|
+
var BPMN_EDGE_LABEL_Z_INDEX2 = 1e3;
|
|
171
126
|
function MessageFlowEdge({
|
|
172
127
|
id,
|
|
173
128
|
sourceX,
|
|
@@ -187,7 +142,7 @@ function MessageFlowEdge({
|
|
|
187
142
|
const polyline = points && points.length >= 2 ? [{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }] : [{ x: sourceX, y: sourceY }, { x: targetX, y: targetY }];
|
|
188
143
|
const path = points && points.length >= 2 ? pointsToSvgPath([{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }]) : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
189
144
|
const labelAnchor = getPreferredLabelAnchor(polyline);
|
|
190
|
-
const strokeColor = selected ? "#1a56db" : "#404040";
|
|
145
|
+
const strokeColor = d?.color?.stroke ?? (selected ? "#1a56db" : "#404040");
|
|
191
146
|
const strokeWidth = selected ? 2.25 : 1.5;
|
|
192
147
|
const haloWidth = selected ? 7 : 5;
|
|
193
148
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -210,10 +165,10 @@ function MessageFlowEdge({
|
|
|
210
165
|
markerStart: "url(#bpmn-circle-open)",
|
|
211
166
|
markerEnd: markerEnd ?? "url(#bpmn-arrow-open)",
|
|
212
167
|
style: {
|
|
213
|
-
stroke: strokeColor,
|
|
214
|
-
strokeWidth,
|
|
215
168
|
strokeDasharray: "6 3",
|
|
216
|
-
...style ?? {}
|
|
169
|
+
...style ?? {},
|
|
170
|
+
stroke: strokeColor,
|
|
171
|
+
strokeWidth
|
|
217
172
|
}
|
|
218
173
|
}
|
|
219
174
|
),
|
|
@@ -225,15 +180,15 @@ function MessageFlowEdge({
|
|
|
225
180
|
transform: `translate(-50%,-50%) translate(${labelAnchor.x}px,${labelAnchor.y}px)`,
|
|
226
181
|
fontSize: 11,
|
|
227
182
|
fontFamily: '"IBM Plex Sans", Inter, system-ui, sans-serif',
|
|
228
|
-
background: "rgba(255,255,255,0.96)",
|
|
229
|
-
color:
|
|
183
|
+
background: d?.color?.fill ?? "rgba(255,255,255,0.96)",
|
|
184
|
+
color: strokeColor,
|
|
230
185
|
padding: "2px 6px",
|
|
231
186
|
borderRadius: 999,
|
|
232
|
-
border:
|
|
187
|
+
border: `1px solid ${d?.color?.stroke ?? "rgba(148, 163, 184, 0.45)"}`,
|
|
233
188
|
boxShadow: "0 1px 2px rgba(15, 23, 42, 0.10)",
|
|
234
189
|
pointerEvents: "all",
|
|
235
190
|
whiteSpace: "nowrap",
|
|
236
|
-
zIndex:
|
|
191
|
+
zIndex: BPMN_EDGE_LABEL_Z_INDEX2
|
|
237
192
|
},
|
|
238
193
|
className: "nodrag nopan",
|
|
239
194
|
children: label ?? d?.label
|
|
@@ -256,6 +211,7 @@ function AssociationEdge({
|
|
|
256
211
|
const d = data;
|
|
257
212
|
const points = d?.routingPoints;
|
|
258
213
|
const direction = d?.associationDirection ?? "none";
|
|
214
|
+
const strokeColor = d?.color?.stroke ?? (selected ? "#1a56db" : "#888");
|
|
259
215
|
const path = points && points.length >= 2 ? pointsToSvgPath([{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }]) : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
260
216
|
return /* @__PURE__ */ jsx(
|
|
261
217
|
BaseEdge,
|
|
@@ -265,10 +221,10 @@ function AssociationEdge({
|
|
|
265
221
|
...direction === "both" ? { markerStart: "url(#bpmn-arrow-open)" } : {},
|
|
266
222
|
...direction === "one" || direction === "both" ? { markerEnd: "url(#bpmn-arrow-open)" } : {},
|
|
267
223
|
style: {
|
|
268
|
-
|
|
224
|
+
...style ?? {},
|
|
225
|
+
stroke: strokeColor,
|
|
269
226
|
strokeWidth: 1,
|
|
270
|
-
strokeDasharray: "3 3"
|
|
271
|
-
...style ?? {}
|
|
227
|
+
strokeDasharray: "3 3"
|
|
272
228
|
}
|
|
273
229
|
}
|
|
274
230
|
);
|
|
@@ -287,6 +243,7 @@ function DataAssociationEdge({
|
|
|
287
243
|
}) {
|
|
288
244
|
const d = data;
|
|
289
245
|
const points = d?.routingPoints;
|
|
246
|
+
const strokeColor = d?.color?.stroke ?? (selected ? "#1a56db" : "#888");
|
|
290
247
|
const path = points && points.length >= 2 ? pointsToSvgPath([{ x: sourceX, y: sourceY }, ...points.slice(1, -1), { x: targetX, y: targetY }]) : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
291
248
|
return /* @__PURE__ */ jsx(
|
|
292
249
|
BaseEdge,
|
|
@@ -295,14 +252,15 @@ function DataAssociationEdge({
|
|
|
295
252
|
path,
|
|
296
253
|
markerEnd: "url(#bpmn-arrow-open)",
|
|
297
254
|
style: {
|
|
298
|
-
|
|
255
|
+
...style ?? {},
|
|
256
|
+
stroke: strokeColor,
|
|
299
257
|
strokeWidth: 1,
|
|
300
|
-
strokeDasharray: "3 3"
|
|
301
|
-
...style ?? {}
|
|
258
|
+
strokeDasharray: "3 3"
|
|
302
259
|
}
|
|
303
260
|
}
|
|
304
261
|
);
|
|
305
262
|
}
|
|
263
|
+
var BPMN_EDGE_LABEL_Z_INDEX3 = 1e3;
|
|
306
264
|
function ConversationLinkEdge({
|
|
307
265
|
sourceX,
|
|
308
266
|
sourceY,
|
|
@@ -312,7 +270,7 @@ function ConversationLinkEdge({
|
|
|
312
270
|
markerEnd
|
|
313
271
|
}) {
|
|
314
272
|
const d = data;
|
|
315
|
-
const stroke = BPMN_THEME.stroke;
|
|
273
|
+
const stroke = d?.color?.stroke ?? BPMN_THEME.stroke;
|
|
316
274
|
const [path] = getStraightPath({ sourceX, sourceY, targetX, targetY });
|
|
317
275
|
return /* @__PURE__ */ jsxs("g", { children: [
|
|
318
276
|
/* @__PURE__ */ jsx(
|
|
@@ -330,7 +288,28 @@ function ConversationLinkEdge({
|
|
|
330
288
|
style: { stroke: "#ffffff", strokeWidth: 2, fill: "none" }
|
|
331
289
|
}
|
|
332
290
|
),
|
|
333
|
-
d?.label && /* @__PURE__ */ jsx(
|
|
291
|
+
d?.label && /* @__PURE__ */ jsx(EdgeLabelRenderer, { children: /* @__PURE__ */ jsx(
|
|
292
|
+
"div",
|
|
293
|
+
{
|
|
294
|
+
style: {
|
|
295
|
+
position: "absolute",
|
|
296
|
+
transform: `translate(-50%,-50%) translate(${(sourceX + targetX) / 2}px,${(sourceY + targetY) / 2}px)`,
|
|
297
|
+
fontSize: BPMN_THEME.fontSize,
|
|
298
|
+
fontFamily: BPMN_THEME.fontFamily,
|
|
299
|
+
background: d?.color?.fill ?? "rgba(255,255,255,0.96)",
|
|
300
|
+
color: stroke,
|
|
301
|
+
padding: "2px 6px",
|
|
302
|
+
borderRadius: 999,
|
|
303
|
+
border: `1px solid ${d?.color?.stroke ?? "rgba(148, 163, 184, 0.45)"}`,
|
|
304
|
+
boxShadow: "0 1px 2px rgba(15, 23, 42, 0.10)",
|
|
305
|
+
pointerEvents: "all",
|
|
306
|
+
whiteSpace: "nowrap",
|
|
307
|
+
zIndex: BPMN_EDGE_LABEL_Z_INDEX3
|
|
308
|
+
},
|
|
309
|
+
className: "nodrag nopan",
|
|
310
|
+
children: d.label
|
|
311
|
+
}
|
|
312
|
+
) })
|
|
334
313
|
] });
|
|
335
314
|
}
|
|
336
315
|
|
|
@@ -344,5 +323,5 @@ var BPMN_EDGE_TYPES = {
|
|
|
344
323
|
};
|
|
345
324
|
|
|
346
325
|
export { AssociationEdge, BPMN_EDGE_TYPES, ConversationLinkEdge, DataAssociationEdge, MessageFlowEdge, SequenceFlowEdge };
|
|
347
|
-
//# sourceMappingURL=chunk-
|
|
348
|
-
//# sourceMappingURL=chunk-
|
|
326
|
+
//# sourceMappingURL=chunk-EMTO53AN.js.map
|
|
327
|
+
//# sourceMappingURL=chunk-EMTO53AN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../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":["BPMN_EDGE_LABEL_Z_INDEX","pointsToSvgPath","getOrthogonalPath","jsxs","Fragment","jsx","BaseEdge","EdgeLabelRenderer"],"mappings":";;;;;;;AAMA,IAAM,uBAAA,GAA0B,GAAA;AAEzB,SAAS,gBAAA,CAAiB;AAAA,EAC/B,EAAA;AAAA,EACA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,EAAc,GAAA;AAAA,UACd,MAAA,EAAQ,CAAA,UAAA,EAAa,CAAA,EAAG,KAAA,EAAO,UAAU,2BAA2B,CAAA,CAAA;AAAA,UACpE,SAAA,EAAW,kCAAA;AAAA,UACX,aAAA,EAAe,KAAA;AAAA,UACf,UAAA,EAAY,QAAA;AAAA,UACZ,MAAA,EAAQL;AAAA,SACV;AAAA,QACA,SAAA,EAAU,cAAA;AAAA,QAET,QAAA,EAAA,CAAA,CAAE;AAAA;AAAA,KACL,EACF;AAAA,GAAA,EAEJ,CAAA;AAEJ;;;ACpDO,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-EMTO53AN.js","sourcesContent":["import { useCallback, useRef } from \"react\";\nimport { BaseEdge, EdgeLabelRenderer, useReactFlow, type EdgeProps } from \"@xyflow/react\";\nimport { getOrthogonalPath, pointsToSvgPath } from \"@aranzatech/diagrams-core/routing\";\nimport type { BpmnEdgeData } from \"../elements/types\";\nimport { getDefaultFlowMarkerPath, getPreferredLabelAnchor } from \"./path\";\n\nconst BPMN_EDGE_LABEL_Z_INDEX = 1000;\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 labelAnchor = getPreferredLabelAnchor(polyline);\n const defaultMarkerPath = d?.isDefault ? getDefaultFlowMarkerPath(polyline) : null;\n\n const labelX = labelAnchor.x + (d?.labelOffsetX ?? 0);\n const labelY = labelAnchor.y + (d?.labelOffsetY ?? 0);\n\n const strokeColor = d?.color?.stroke ?? (selected ? \"#1a56db\" : \"#404040\");\n const strokeWidth = selected ? 2.25 : 1.5;\n const haloWidth = selected ? 7 : 5;\n\n const { updateEdgeData, getViewport } = useReactFlow();\n const dragStartRef = useRef<{ mx: number; my: number; ox: number; oy: number } | null>(null);\n\n const handleLabelPointerDown = useCallback((e: React.PointerEvent<HTMLDivElement>) => {\n e.stopPropagation();\n e.currentTarget.setPointerCapture(e.pointerId);\n dragStartRef.current = {\n mx: e.clientX,\n my: e.clientY,\n ox: d?.labelOffsetX ?? 0,\n oy: d?.labelOffsetY ?? 0,\n };\n }, [d?.labelOffsetX, d?.labelOffsetY]);\n\n const handleLabelPointerMove = useCallback((e: React.PointerEvent<HTMLDivElement>) => {\n if (!dragStartRef.current) return;\n const { zoom } = getViewport();\n const dx = (e.clientX - dragStartRef.current.mx) / zoom;\n const dy = (e.clientY - dragStartRef.current.my) / zoom;\n updateEdgeData(id, {\n labelOffsetX: dragStartRef.current.ox + dx,\n labelOffsetY: dragStartRef.current.oy + dy,\n });\n }, [id, updateEdgeData, getViewport]);\n\n const handleLabelPointerUp = useCallback(() => {\n dragStartRef.current = null;\n }, []);\n\n return (\n <>\n <BaseEdge\n id={`${id}__halo`}\n path={path}\n style={{\n stroke: \"rgba(255,255,255,0.92)\",\n strokeWidth: haloWidth,\n }}\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 ...(style ?? {}),\n stroke: strokeColor,\n strokeWidth,\n }}\n />\n {defaultMarkerPath && (\n <path\n d={defaultMarkerPath}\n fill=\"none\"\n stroke={strokeColor}\n strokeWidth={strokeWidth}\n strokeLinecap=\"round\"\n data-testid=\"bpmn-default-flow-marker\"\n />\n )}\n {(label ?? d?.label) && (\n <EdgeLabelRenderer>\n <div\n onPointerDown={handleLabelPointerDown}\n onPointerMove={handleLabelPointerMove}\n onPointerUp={handleLabelPointerUp}\n style={{\n position: \"absolute\",\n transform: `translate(-50%,-50%) translate(${labelX}px,${labelY}px)`,\n fontSize: 11,\n fontFamily: \"\\\"IBM Plex Sans\\\", Inter, system-ui, sans-serif\",\n background: d?.color?.fill ?? \"rgba(255,255,255,0.96)\",\n color: strokeColor,\n padding: \"2px 6px\",\n borderRadius: 999,\n border: `1px solid ${d?.color?.stroke ?? \"rgba(148, 163, 184, 0.45)\"}`,\n boxShadow: \"0 1px 2px rgba(15, 23, 42, 0.10)\",\n pointerEvents: \"all\",\n cursor: \"grab\",\n userSelect: \"none\",\n whiteSpace: \"nowrap\",\n zIndex: BPMN_EDGE_LABEL_Z_INDEX,\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 { getPreferredLabelAnchor } from \"./path\";\n\nconst BPMN_EDGE_LABEL_Z_INDEX = 1000;\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 labelAnchor = getPreferredLabelAnchor(polyline);\n const strokeColor = d?.color?.stroke ?? (selected ? \"#1a56db\" : \"#404040\");\n const strokeWidth = selected ? 2.25 : 1.5;\n const haloWidth = selected ? 7 : 5;\n\n return (\n <>\n <BaseEdge\n id={`${id}__halo`}\n path={path}\n style={{\n stroke: \"rgba(255,255,255,0.92)\",\n strokeWidth: haloWidth,\n }}\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 strokeDasharray: \"6 3\",\n ...(style ?? {}),\n stroke: strokeColor,\n strokeWidth,\n }}\n />\n {(label ?? d?.label) && (\n <EdgeLabelRenderer>\n <div\n style={{\n position: \"absolute\",\n transform: `translate(-50%,-50%) translate(${labelAnchor.x}px,${labelAnchor.y}px)`,\n fontSize: 11,\n fontFamily: \"\\\"IBM Plex Sans\\\", Inter, system-ui, sans-serif\",\n background: d?.color?.fill ?? \"rgba(255,255,255,0.96)\",\n color: strokeColor,\n padding: \"2px 6px\",\n borderRadius: 999,\n border: `1px solid ${d?.color?.stroke ?? \"rgba(148, 163, 184, 0.45)\"}`,\n boxShadow: \"0 1px 2px rgba(15, 23, 42, 0.10)\",\n pointerEvents: \"all\",\n whiteSpace: \"nowrap\",\n zIndex: BPMN_EDGE_LABEL_Z_INDEX,\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 const strokeColor = d?.color?.stroke ?? (selected ? \"#1a56db\" : \"#888\");\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 ...(style ?? {}),\n stroke: strokeColor,\n strokeWidth: 1,\n strokeDasharray: \"3 3\",\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 const strokeColor = d?.color?.stroke ?? (selected ? \"#1a56db\" : \"#888\");\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 ...(style ?? {}),\n stroke: strokeColor,\n strokeWidth: 1,\n strokeDasharray: \"3 3\",\n }}\n />\n );\n}\n","import type { EdgeProps } from \"@xyflow/react\";\nimport { BaseEdge, EdgeLabelRenderer, 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\nconst BPMN_EDGE_LABEL_Z_INDEX = 1000;\n\nexport function ConversationLinkEdge({\n sourceX, sourceY, targetX, targetY,\n data, markerEnd,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const stroke = d?.color?.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 <EdgeLabelRenderer>\n <div\n style={{\n position: \"absolute\",\n transform: `translate(-50%,-50%) translate(${(sourceX + targetX) / 2}px,${(sourceY + targetY) / 2}px)`,\n fontSize: BPMN_THEME.fontSize,\n fontFamily: BPMN_THEME.fontFamily,\n background: d?.color?.fill ?? \"rgba(255,255,255,0.96)\",\n color: stroke,\n padding: \"2px 6px\",\n borderRadius: 999,\n border: `1px solid ${d?.color?.stroke ?? \"rgba(148, 163, 184, 0.45)\"}`,\n boxShadow: \"0 1px 2px rgba(15, 23, 42, 0.10)\",\n pointerEvents: \"all\",\n whiteSpace: \"nowrap\",\n zIndex: BPMN_EDGE_LABEL_Z_INDEX,\n }}\n className=\"nodrag nopan\"\n >\n {d.label}\n </div>\n </EdgeLabelRenderer>\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"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// src/edges/path.ts
|
|
2
|
+
var LABEL_MIN_SEGMENT = 40;
|
|
3
|
+
var LABEL_EXIT_DISTANCE = 28;
|
|
4
|
+
function getPreferredLabelAnchor(points) {
|
|
5
|
+
if (points.length === 0) return { x: 0, y: 0 };
|
|
6
|
+
if (points.length === 1) return points[0];
|
|
7
|
+
let bestIndex = -1;
|
|
8
|
+
for (let i = 1; i < points.length; i += 1) {
|
|
9
|
+
const length = Math.hypot(points[i].x - points[i - 1].x, points[i].y - points[i - 1].y);
|
|
10
|
+
if (length >= LABEL_MIN_SEGMENT) {
|
|
11
|
+
bestIndex = i;
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
if (bestIndex === -1) {
|
|
16
|
+
let bestLength = -1;
|
|
17
|
+
bestIndex = 1;
|
|
18
|
+
for (let i = 1; i < points.length; i += 1) {
|
|
19
|
+
const length = Math.hypot(points[i].x - points[i - 1].x, points[i].y - points[i - 1].y);
|
|
20
|
+
if (length > bestLength) {
|
|
21
|
+
bestLength = length;
|
|
22
|
+
bestIndex = i;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const from = points[bestIndex - 1];
|
|
27
|
+
const to = points[bestIndex];
|
|
28
|
+
const segLength = Math.hypot(to.x - from.x, to.y - from.y);
|
|
29
|
+
const t = segLength > 0 ? Math.min(0.5, LABEL_EXIT_DISTANCE / segLength) : 0.5;
|
|
30
|
+
const anchor = {
|
|
31
|
+
x: from.x + (to.x - from.x) * t,
|
|
32
|
+
y: from.y + (to.y - from.y) * t
|
|
33
|
+
};
|
|
34
|
+
const dx = to.x - from.x;
|
|
35
|
+
const dy = to.y - from.y;
|
|
36
|
+
if (Math.abs(dx) >= Math.abs(dy)) {
|
|
37
|
+
return { x: anchor.x, y: anchor.y - 12 };
|
|
38
|
+
}
|
|
39
|
+
return { x: anchor.x + 12, y: anchor.y };
|
|
40
|
+
}
|
|
41
|
+
function getSegmentAngle(points) {
|
|
42
|
+
if (points.length < 2) return 0;
|
|
43
|
+
const from = points[0];
|
|
44
|
+
const to = points[1];
|
|
45
|
+
return Math.atan2(to.y - from.y, to.x - from.x);
|
|
46
|
+
}
|
|
47
|
+
function getDefaultFlowMarkerPath(points) {
|
|
48
|
+
if (points.length < 2) return null;
|
|
49
|
+
const start = points[0];
|
|
50
|
+
const angle = getSegmentAngle(points);
|
|
51
|
+
const anchorX = start.x + Math.cos(angle) * 16;
|
|
52
|
+
const anchorY = start.y + Math.sin(angle) * 16;
|
|
53
|
+
const normalAngle = angle + Math.PI / 2;
|
|
54
|
+
const half = 7;
|
|
55
|
+
const x1 = anchorX + Math.cos(normalAngle) * half;
|
|
56
|
+
const y1 = anchorY + Math.sin(normalAngle) * half;
|
|
57
|
+
const x2 = anchorX - Math.cos(normalAngle) * half;
|
|
58
|
+
const y2 = anchorY - Math.sin(normalAngle) * half;
|
|
59
|
+
return `M ${x1} ${y1} L ${x2} ${y2}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { getDefaultFlowMarkerPath, getPreferredLabelAnchor };
|
|
63
|
+
//# sourceMappingURL=chunk-G22XQD6H.js.map
|
|
64
|
+
//# sourceMappingURL=chunk-G22XQD6H.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/edges/path.ts"],"names":[],"mappings":";AAkEA,IAAM,iBAAA,GAAoB,EAAA;AAC1B,IAAM,mBAAA,GAAsB,EAAA;AAErB,SAAS,wBAAwB,MAAA,EAAsC;AAC5E,EAAA,IAAI,MAAA,CAAO,WAAW,CAAA,EAAG,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AA,CAAG,CAAA,GAAI,IAAA,CAAK,CAAC,CAAA;AAChD;AAEO,SAAS,yBAAyB,MAAA,EAAoC;AAC3E,EAAA,IAAI,MAAA,CAAO,MAAA,GAAS,CAAA,EAAG,OAAO,IAAA;AAE9B,EAAA,MAAM,KAAA,GAAQ,OAAO,CAAC,CAAA;AACtB,EAAA,MAAM,KAAA,GAAQ,gBAAgB,MAAM,CAAA;AACpC,EAAA,MAAM,UAAU,KAAA,CAAM,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA,GAAI,EAAA;AAC5C,EAAA,MAAM,UAAU,KAAA,CAAM,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA,GAAI,EAAA;AAC5C,EAAA,MAAM,WAAA,GAAc,KAAA,GAAQ,IAAA,CAAK,EAAA,GAAK,CAAA;AACtC,EAAA,MAAM,IAAA,GAAO,CAAA;AAEb,EAAA,MAAM,EAAA,GAAK,OAAA,GAAU,IAAA,CAAK,GAAA,CAAI,WAAW,CAAA,GAAI,IAAA;AAC7C,EAAA,MAAM,EAAA,GAAK,OAAA,GAAU,IAAA,CAAK,GAAA,CAAI,WAAW,CAAA,GAAI,IAAA;AAC7C,EAAA,MAAM,EAAA,GAAK,OAAA,GAAU,IAAA,CAAK,GAAA,CAAI,WAAW,CAAA,GAAI,IAAA;AAC7C,EAAA,MAAM,EAAA,GAAK,OAAA,GAAU,IAAA,CAAK,GAAA,CAAI,WAAW,CAAA,GAAI,IAAA;AAE7C,EAAA,OAAO,KAAK,EAAE,CAAA,CAAA,EAAI,EAAE,CAAA,GAAA,EAAM,EAAE,IAAI,EAAE,CAAA,CAAA;AACpC","file":"chunk-G22XQD6H.js","sourcesContent":["import type { Position } from \"@xyflow/react\";\n\nexport interface EdgePoint {\n x: number;\n y: number;\n}\n\nexport interface EdgeLabelAnchor {\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\n// BPMN convention (Camunda/Bizagi): a sequence-flow label (Sí/No) belongs at\n// the SOURCE exit — where the decision is read — not at the midpoint of the\n// longest segment, which on long routes leaves the label orphaned far from\n// its gateway.\nconst LABEL_MIN_SEGMENT = 40; // first segment long enough to host a label\nconst LABEL_EXIT_DISTANCE = 28; // px along the segment, measured from the exit\n\nexport function getPreferredLabelAnchor(points: EdgePoint[]): EdgeLabelAnchor {\n if (points.length === 0) return { x: 0, y: 0 };\n if (points.length === 1) return points[0];\n\n // Prefer the first segment (closest to the source) that can host a label;\n // fall back to the longest segment when every segment is tiny.\n let bestIndex = -1;\n for (let i = 1; i < points.length; i += 1) {\n const length = Math.hypot(points[i].x - points[i - 1].x, points[i].y - points[i - 1].y);\n if (length >= LABEL_MIN_SEGMENT) {\n bestIndex = i;\n break;\n }\n }\n\n if (bestIndex === -1) {\n let bestLength = -1;\n bestIndex = 1;\n for (let i = 1; i < points.length; i += 1) {\n const length = Math.hypot(points[i].x - points[i - 1].x, points[i].y - points[i - 1].y);\n if (length > bestLength) {\n bestLength = length;\n bestIndex = i;\n }\n }\n }\n\n const from = points[bestIndex - 1];\n const to = points[bestIndex];\n const segLength = Math.hypot(to.x - from.x, to.y - from.y);\n const t = segLength > 0 ? Math.min(0.5, LABEL_EXIT_DISTANCE / segLength) : 0.5;\n const anchor = {\n x: from.x + (to.x - from.x) * t,\n y: from.y + (to.y - from.y) * t,\n };\n\n const dx = to.x - from.x;\n const dy = to.y - from.y;\n\n if (Math.abs(dx) >= Math.abs(dy)) {\n return { x: anchor.x, y: anchor.y - 12 };\n }\n\n return { x: anchor.x + 12, y: anchor.y };\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"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getPreferredLabelAnchor } from './chunk-G22XQD6H.js';
|
|
1
2
|
import { ARANZA_DESCRIPTOR, getBpmnMessageFlowExecutionExtensions, getBpmnTaskExecutionExtensions } from './chunk-TB6V4S5N.js';
|
|
2
3
|
import { BPMN_ELEMENT_CATALOG } from './chunk-L5Z22RLX.js';
|
|
3
4
|
|
|
@@ -653,10 +654,21 @@ async function parseBpmnXml(xml) {
|
|
|
653
654
|
warnings,
|
|
654
655
|
autoX: { value: 50 }
|
|
655
656
|
};
|
|
657
|
+
const participantProcessIds = /* @__PURE__ */ new Set();
|
|
658
|
+
for (const rootEl of asElements(rootElement.rootElements)) {
|
|
659
|
+
if (rootEl.$type !== "bpmn:Collaboration") continue;
|
|
660
|
+
for (const participant of asElements(rootEl.participants)) {
|
|
661
|
+
const processRef = participant.processRef;
|
|
662
|
+
const processId = processRef ? asString(processRef.id) : void 0;
|
|
663
|
+
if (processId) participantProcessIds.add(processId);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
656
666
|
for (const rootEl of asElements(rootElement.rootElements)) {
|
|
657
667
|
if (rootEl.$type === "bpmn:Collaboration") {
|
|
658
668
|
handleCollaboration(rootEl, ctx, nodes, edges);
|
|
659
669
|
} else if (rootEl.$type === "bpmn:Process") {
|
|
670
|
+
const processId = asString(rootEl.id);
|
|
671
|
+
if (processId && participantProcessIds.has(processId)) continue;
|
|
660
672
|
const laneMembership = extractLaneMembership(rootEl);
|
|
661
673
|
const laneSets = asLaneSets(rootEl.laneSets);
|
|
662
674
|
if (laneSets.length > 0) {
|
|
@@ -1306,6 +1318,24 @@ function buildEdgeElement(moddle, edge, nodeById) {
|
|
|
1306
1318
|
}
|
|
1307
1319
|
return moddle.create(moddleType, attrs);
|
|
1308
1320
|
}
|
|
1321
|
+
var DI_EXTERNAL_LABEL_TYPES = /* @__PURE__ */ new Set([
|
|
1322
|
+
"ExclusiveGateway",
|
|
1323
|
+
"InclusiveGateway",
|
|
1324
|
+
"ParallelGateway",
|
|
1325
|
+
"EventBasedGateway",
|
|
1326
|
+
"ComplexGateway",
|
|
1327
|
+
"StartEvent",
|
|
1328
|
+
"EndEvent",
|
|
1329
|
+
"IntermediateCatchEvent",
|
|
1330
|
+
"IntermediateThrowEvent",
|
|
1331
|
+
"BoundaryEvent"
|
|
1332
|
+
]);
|
|
1333
|
+
var DI_LABEL_CHAR_W = 6.5;
|
|
1334
|
+
var DI_LABEL_MAX_W = 150;
|
|
1335
|
+
var DI_LABEL_H = 14;
|
|
1336
|
+
function diLabelWidth(label) {
|
|
1337
|
+
return Math.min(Math.ceil(label.length * DI_LABEL_CHAR_W), DI_LABEL_MAX_W);
|
|
1338
|
+
}
|
|
1309
1339
|
function buildBpmnDI(moddle, definitions, nodes, edges) {
|
|
1310
1340
|
const shapes = [];
|
|
1311
1341
|
const edgeShapes = [];
|
|
@@ -1328,19 +1358,47 @@ function buildBpmnDI(moddle, definitions, nodes, edges) {
|
|
|
1328
1358
|
if (node.data.isExpanded !== void 0) {
|
|
1329
1359
|
shape.isExpanded = node.data.isExpanded;
|
|
1330
1360
|
}
|
|
1361
|
+
const nodeLabel = typeof node.data.label === "string" ? node.data.label : "";
|
|
1362
|
+
if (nodeLabel && DI_EXTERNAL_LABEL_TYPES.has(node.data.elementType)) {
|
|
1363
|
+
const absPos = absolutePositionById.get(node.id) ?? node.position;
|
|
1364
|
+
const labelW = diLabelWidth(nodeLabel);
|
|
1365
|
+
shape.label = moddle.create("bpmndi:BPMNLabel", {
|
|
1366
|
+
bounds: moddle.create("dc:Bounds", {
|
|
1367
|
+
x: absPos.x + w / 2 - labelW / 2,
|
|
1368
|
+
y: absPos.y + h + 4,
|
|
1369
|
+
width: labelW,
|
|
1370
|
+
height: DI_LABEL_H
|
|
1371
|
+
})
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1331
1374
|
shapes.push(shape);
|
|
1332
1375
|
}
|
|
1333
1376
|
for (const edge of edges) {
|
|
1334
|
-
const
|
|
1377
|
+
const waypointPts = resolveEdgeWaypoints(edge, nodes, absolutePositionById);
|
|
1378
|
+
const waypoints = waypointPts.map(
|
|
1335
1379
|
(p) => moddle.create("dc:Point", { x: p.x, y: p.y })
|
|
1336
1380
|
);
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
)
|
|
1381
|
+
const bpmnEdge = moddle.create("bpmndi:BPMNEdge", {
|
|
1382
|
+
id: uid("BPMNEdge", edge.id),
|
|
1383
|
+
bpmnElement: { id: edge.id },
|
|
1384
|
+
waypoint: waypoints
|
|
1385
|
+
});
|
|
1386
|
+
const edgeLabel = typeof edge.data?.label === "string" ? edge.data.label : "";
|
|
1387
|
+
if (edgeLabel && waypointPts.length >= 2) {
|
|
1388
|
+
const anchor = getPreferredLabelAnchor(waypointPts);
|
|
1389
|
+
const offsetX = typeof edge.data?.labelOffsetX === "number" ? edge.data.labelOffsetX : 0;
|
|
1390
|
+
const offsetY = typeof edge.data?.labelOffsetY === "number" ? edge.data.labelOffsetY : 0;
|
|
1391
|
+
const labelW = diLabelWidth(edgeLabel);
|
|
1392
|
+
bpmnEdge.label = moddle.create("bpmndi:BPMNLabel", {
|
|
1393
|
+
bounds: moddle.create("dc:Bounds", {
|
|
1394
|
+
x: anchor.x + offsetX - labelW / 2,
|
|
1395
|
+
y: anchor.y + offsetY - DI_LABEL_H / 2,
|
|
1396
|
+
width: labelW,
|
|
1397
|
+
height: DI_LABEL_H
|
|
1398
|
+
})
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
edgeShapes.push(bpmnEdge);
|
|
1344
1402
|
}
|
|
1345
1403
|
const rootEls = definitions.rootElements;
|
|
1346
1404
|
const planeElement = rootEls?.find((element) => element.$type === "bpmn:Collaboration") ?? rootEls?.find((element) => element.$type === "bpmn:Process") ?? rootEls?.[0];
|
|
@@ -1364,17 +1422,63 @@ function resolveEdgeWaypoints(edge, nodes, absolutePositionById) {
|
|
|
1364
1422
|
if (!source || !target) return [];
|
|
1365
1423
|
const sourceMeta = BPMN_ELEMENT_CATALOG[source.data.elementType];
|
|
1366
1424
|
const targetMeta = BPMN_ELEMENT_CATALOG[target.data.elementType];
|
|
1367
|
-
const
|
|
1368
|
-
const
|
|
1425
|
+
const sPos = absolutePositionById.get(source.id) ?? source.position;
|
|
1426
|
+
const tPos = absolutePositionById.get(target.id) ?? target.position;
|
|
1427
|
+
const sW = source.width ?? sourceMeta.defaultWidth;
|
|
1428
|
+
const sH = source.height ?? sourceMeta.defaultHeight;
|
|
1429
|
+
const tW = target.width ?? targetMeta.defaultWidth;
|
|
1430
|
+
const tH = target.height ?? targetMeta.defaultHeight;
|
|
1431
|
+
const sCX = sPos.x + sW / 2;
|
|
1432
|
+
const sCY = sPos.y + sH / 2;
|
|
1433
|
+
const tCX = tPos.x + tW / 2;
|
|
1434
|
+
const tCY = tPos.y + tH / 2;
|
|
1435
|
+
if (Math.abs(sCY - tCY) <= 1) {
|
|
1436
|
+
if (tPos.x >= sPos.x + sW) return [{ x: sPos.x + sW, y: sCY }, { x: tPos.x, y: sCY }];
|
|
1437
|
+
if (sPos.x >= tPos.x + tW) return [{ x: sPos.x, y: sCY }, { x: tPos.x + tW, y: sCY }];
|
|
1438
|
+
}
|
|
1439
|
+
if (Math.abs(sCX - tCX) <= 1) {
|
|
1440
|
+
if (tPos.y >= sPos.y + sH) return [{ x: sCX, y: sPos.y + sH }, { x: sCX, y: tPos.y }];
|
|
1441
|
+
if (sPos.y >= tPos.y + tH) return [{ x: sCX, y: sPos.y }, { x: sCX, y: tPos.y + tH }];
|
|
1442
|
+
}
|
|
1443
|
+
if (tPos.x >= sPos.x + sW) {
|
|
1444
|
+
const midX = (sPos.x + sW + tPos.x) / 2;
|
|
1445
|
+
return [
|
|
1446
|
+
{ x: sPos.x + sW, y: sCY },
|
|
1447
|
+
{ x: midX, y: sCY },
|
|
1448
|
+
{ x: midX, y: tCY },
|
|
1449
|
+
{ x: tPos.x, y: tCY }
|
|
1450
|
+
];
|
|
1451
|
+
}
|
|
1452
|
+
if (sPos.x >= tPos.x + tW) {
|
|
1453
|
+
const midX = (tPos.x + tW + sPos.x) / 2;
|
|
1454
|
+
return [
|
|
1455
|
+
{ x: sPos.x, y: sCY },
|
|
1456
|
+
{ x: midX, y: sCY },
|
|
1457
|
+
{ x: midX, y: tCY },
|
|
1458
|
+
{ x: tPos.x + tW, y: tCY }
|
|
1459
|
+
];
|
|
1460
|
+
}
|
|
1461
|
+
if (tPos.y >= sPos.y + sH) {
|
|
1462
|
+
const midY = (sPos.y + sH + tPos.y) / 2;
|
|
1463
|
+
return [
|
|
1464
|
+
{ x: sCX, y: sPos.y + sH },
|
|
1465
|
+
{ x: sCX, y: midY },
|
|
1466
|
+
{ x: tCX, y: midY },
|
|
1467
|
+
{ x: tCX, y: tPos.y }
|
|
1468
|
+
];
|
|
1469
|
+
}
|
|
1470
|
+
if (sPos.y >= tPos.y + tH) {
|
|
1471
|
+
const midY = (tPos.y + tH + sPos.y) / 2;
|
|
1472
|
+
return [
|
|
1473
|
+
{ x: sCX, y: sPos.y },
|
|
1474
|
+
{ x: sCX, y: midY },
|
|
1475
|
+
{ x: tCX, y: midY },
|
|
1476
|
+
{ x: tCX, y: tPos.y + tH }
|
|
1477
|
+
];
|
|
1478
|
+
}
|
|
1369
1479
|
return [
|
|
1370
|
-
{
|
|
1371
|
-
|
|
1372
|
-
y: sourcePosition.y + (source.height ?? sourceMeta.defaultHeight) / 2
|
|
1373
|
-
},
|
|
1374
|
-
{
|
|
1375
|
-
x: targetPosition.x + (target.width ?? targetMeta.defaultWidth) / 2,
|
|
1376
|
-
y: targetPosition.y + (target.height ?? targetMeta.defaultHeight) / 2
|
|
1377
|
-
}
|
|
1480
|
+
{ x: sCX, y: sCY },
|
|
1481
|
+
{ x: tCX, y: tCY }
|
|
1378
1482
|
];
|
|
1379
1483
|
}
|
|
1380
1484
|
function buildAbsolutePositionMap(nodes) {
|
|
@@ -1525,5 +1629,5 @@ async function serializeBpmnXml(nodes, edges, opts = {}) {
|
|
|
1525
1629
|
}
|
|
1526
1630
|
|
|
1527
1631
|
export { parseBpmnXml, serializeBpmnXml };
|
|
1528
|
-
//# sourceMappingURL=chunk-
|
|
1529
|
-
//# sourceMappingURL=chunk-
|
|
1632
|
+
//# sourceMappingURL=chunk-OFOTX3LA.js.map
|
|
1633
|
+
//# sourceMappingURL=chunk-OFOTX3LA.js.map
|