@aranzatech/diagrams-bpmn 0.2.13 → 0.2.15
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-Di2nzGs9.d.ts → catalog-CK3_4cOb.d.ts} +1 -1
- package/dist/{catalog-BiLXVn-2.d.cts → catalog-xOMF2ifW.d.cts} +1 -1
- package/dist/{chunk-UAWLUDKC.js → chunk-HOWK3ZOO.js} +105 -13
- package/dist/chunk-HOWK3ZOO.js.map +1 -0
- package/dist/{chunk-O3NWJ5H7.js → chunk-QSMP34CT.js} +38 -5
- package/dist/chunk-QSMP34CT.js.map +1 -0
- package/dist/{chunk-IMW6RG6F.js → chunk-X54NHLBA.js} +43 -190
- package/dist/chunk-X54NHLBA.js.map +1 -0
- package/dist/chunk-XMVV7FRZ.js +163 -0
- package/dist/chunk-XMVV7FRZ.js.map +1 -0
- package/dist/edges/index.cjs +35 -2
- package/dist/edges/index.cjs.map +1 -1
- package/dist/edges/index.js +1 -1
- package/dist/elements/index.d.cts +4 -4
- package/dist/elements/index.d.ts +4 -4
- package/dist/elk-FSFIEL6O.js +6 -0
- package/dist/elk-FSFIEL6O.js.map +1 -0
- package/dist/{guards-DPHXfpY8.d.cts → guards-C70uIY_O.d.cts} +1 -1
- package/dist/{guards-qgSeZEU4.d.ts → guards-foB6XIfZ.d.ts} +1 -1
- package/dist/index.cjs +180 -200
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -3
- package/dist/layout/index.cjs +1428 -755
- package/dist/layout/index.cjs.map +1 -1
- package/dist/layout/index.d.cts +23 -12
- package/dist/layout/index.d.ts +23 -12
- package/dist/layout/index.js +547 -72
- package/dist/layout/index.js.map +1 -1
- package/dist/modeling/index.cjs +103 -10
- package/dist/modeling/index.cjs.map +1 -1
- package/dist/modeling/index.d.cts +23 -6
- package/dist/modeling/index.d.ts +23 -6
- package/dist/modeling/index.js +1 -1
- package/dist/nodes/index.cjs +42 -188
- package/dist/nodes/index.cjs.map +1 -1
- package/dist/nodes/index.d.cts +1 -1
- package/dist/nodes/index.d.ts +1 -1
- package/dist/nodes/index.js +1 -1
- package/dist/{types-rEfHsPr5.d.ts → types-DG5yPKld.d.ts} +1 -1
- package/dist/{types-s2_VvPGf.d.cts → types-jIDz306Y.d.cts} +1 -1
- package/dist/{types-Dfrt0wVs.d.cts → types-y-ZbX-ff.d.cts} +3 -0
- package/dist/{types-Dfrt0wVs.d.ts → types-y-ZbX-ff.d.ts} +3 -0
- package/dist/validation/index.d.cts +2 -2
- package/dist/validation/index.d.ts +2 -2
- package/dist/xml/index.d.cts +3 -3
- package/dist/xml/index.d.ts +3 -3
- package/package.json +2 -2
- package/dist/chunk-IMW6RG6F.js.map +0 -1
- package/dist/chunk-O3NWJ5H7.js.map +0 -1
- package/dist/chunk-UAWLUDKC.js.map +0 -1
package/dist/layout/index.cjs
CHANGED
|
@@ -1,626 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var layout = require('@aranzatech/diagrams-core/layout');
|
|
4
3
|
var diagramsCore = require('@aranzatech/diagrams-core');
|
|
5
4
|
require('@aranzatech/diagrams-core/serialization');
|
|
5
|
+
var layout = require('@aranzatech/diagrams-core/layout');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
+
var __esm = (fn, res) => function __init() {
|
|
10
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
|
+
};
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
8
16
|
|
|
9
17
|
// src/elements/catalog.ts
|
|
10
|
-
var BPMN_ELEMENT_CATALOG = {
|
|
11
|
-
// ─── Events ──────────────────────────────────────────────────────────────────
|
|
12
|
-
StartEvent: {
|
|
13
|
-
label: "Start Event",
|
|
14
|
-
icon: "Circle",
|
|
15
|
-
category: "event",
|
|
16
|
-
defaultWidth: 36,
|
|
17
|
-
defaultHeight: 36,
|
|
18
|
-
handlePolicy: "source",
|
|
19
|
-
orientation: "free",
|
|
20
|
-
isContainer: false,
|
|
21
|
-
acceptsBoundaryEvents: false,
|
|
22
|
-
eventSemantics: "start",
|
|
23
|
-
canBeStart: true,
|
|
24
|
-
canBeEnd: false,
|
|
25
|
-
maxIncoming: 0,
|
|
26
|
-
maxOutgoing: 1
|
|
27
|
-
},
|
|
28
|
-
EndEvent: {
|
|
29
|
-
label: "End Event",
|
|
30
|
-
icon: "CircleDot",
|
|
31
|
-
category: "event",
|
|
32
|
-
defaultWidth: 36,
|
|
33
|
-
defaultHeight: 36,
|
|
34
|
-
handlePolicy: "target",
|
|
35
|
-
orientation: "free",
|
|
36
|
-
isContainer: false,
|
|
37
|
-
acceptsBoundaryEvents: false,
|
|
38
|
-
eventSemantics: "end",
|
|
39
|
-
canBeStart: false,
|
|
40
|
-
canBeEnd: true,
|
|
41
|
-
maxOutgoing: 0
|
|
42
|
-
},
|
|
43
|
-
IntermediateCatchEvent: {
|
|
44
|
-
label: "Intermediate Catch Event",
|
|
45
|
-
icon: "Clock3",
|
|
46
|
-
category: "event",
|
|
47
|
-
defaultWidth: 36,
|
|
48
|
-
defaultHeight: 36,
|
|
49
|
-
handlePolicy: "all",
|
|
50
|
-
orientation: "free",
|
|
51
|
-
isContainer: false,
|
|
52
|
-
acceptsBoundaryEvents: false,
|
|
53
|
-
eventSemantics: "intermediateCatch",
|
|
54
|
-
canBeStart: false,
|
|
55
|
-
canBeEnd: false
|
|
56
|
-
},
|
|
57
|
-
IntermediateThrowEvent: {
|
|
58
|
-
label: "Intermediate Throw Event",
|
|
59
|
-
icon: "Send",
|
|
60
|
-
category: "event",
|
|
61
|
-
defaultWidth: 36,
|
|
62
|
-
defaultHeight: 36,
|
|
63
|
-
handlePolicy: "all",
|
|
64
|
-
orientation: "free",
|
|
65
|
-
isContainer: false,
|
|
66
|
-
acceptsBoundaryEvents: false,
|
|
67
|
-
eventSemantics: "intermediateThrow",
|
|
68
|
-
canBeStart: false,
|
|
69
|
-
canBeEnd: false
|
|
70
|
-
},
|
|
71
|
-
BoundaryEvent: {
|
|
72
|
-
label: "Boundary Event",
|
|
73
|
-
icon: "AlarmClock",
|
|
74
|
-
category: "event",
|
|
75
|
-
defaultWidth: 36,
|
|
76
|
-
defaultHeight: 36,
|
|
77
|
-
handlePolicy: "source",
|
|
78
|
-
orientation: "free",
|
|
79
|
-
isContainer: false,
|
|
80
|
-
acceptsBoundaryEvents: false,
|
|
81
|
-
eventSemantics: "boundary",
|
|
82
|
-
canBeStart: false,
|
|
83
|
-
canBeEnd: false,
|
|
84
|
-
maxIncoming: 0
|
|
85
|
-
},
|
|
86
|
-
// ─── Tasks ───────────────────────────────────────────────────────────────────
|
|
87
|
-
Task: {
|
|
88
|
-
label: "Task",
|
|
89
|
-
icon: "CheckSquare",
|
|
90
|
-
category: "task",
|
|
91
|
-
defaultWidth: 120,
|
|
92
|
-
defaultHeight: 60,
|
|
93
|
-
handlePolicy: "all",
|
|
94
|
-
orientation: "free",
|
|
95
|
-
isContainer: false,
|
|
96
|
-
acceptsBoundaryEvents: true,
|
|
97
|
-
supportsMarkers: true,
|
|
98
|
-
canBeStart: false,
|
|
99
|
-
canBeEnd: false
|
|
100
|
-
},
|
|
101
|
-
UserTask: {
|
|
102
|
-
label: "User Task",
|
|
103
|
-
icon: "UserRound",
|
|
104
|
-
category: "task",
|
|
105
|
-
defaultWidth: 120,
|
|
106
|
-
defaultHeight: 60,
|
|
107
|
-
handlePolicy: "all",
|
|
108
|
-
orientation: "free",
|
|
109
|
-
isContainer: false,
|
|
110
|
-
acceptsBoundaryEvents: true,
|
|
111
|
-
supportsMarkers: true,
|
|
112
|
-
canBeStart: false,
|
|
113
|
-
canBeEnd: false
|
|
114
|
-
},
|
|
115
|
-
ServiceTask: {
|
|
116
|
-
label: "Service Task",
|
|
117
|
-
icon: "Cog",
|
|
118
|
-
category: "task",
|
|
119
|
-
defaultWidth: 120,
|
|
120
|
-
defaultHeight: 60,
|
|
121
|
-
handlePolicy: "all",
|
|
122
|
-
orientation: "free",
|
|
123
|
-
isContainer: false,
|
|
124
|
-
acceptsBoundaryEvents: true,
|
|
125
|
-
supportsMarkers: true,
|
|
126
|
-
canBeStart: false,
|
|
127
|
-
canBeEnd: false
|
|
128
|
-
},
|
|
129
|
-
ScriptTask: {
|
|
130
|
-
label: "Script Task",
|
|
131
|
-
icon: "FileCode",
|
|
132
|
-
category: "task",
|
|
133
|
-
defaultWidth: 120,
|
|
134
|
-
defaultHeight: 60,
|
|
135
|
-
handlePolicy: "all",
|
|
136
|
-
orientation: "free",
|
|
137
|
-
isContainer: false,
|
|
138
|
-
acceptsBoundaryEvents: true,
|
|
139
|
-
supportsMarkers: true,
|
|
140
|
-
canBeStart: false,
|
|
141
|
-
canBeEnd: false
|
|
142
|
-
},
|
|
143
|
-
ManualTask: {
|
|
144
|
-
label: "Manual Task",
|
|
145
|
-
icon: "Hand",
|
|
146
|
-
category: "task",
|
|
147
|
-
defaultWidth: 120,
|
|
148
|
-
defaultHeight: 60,
|
|
149
|
-
handlePolicy: "all",
|
|
150
|
-
orientation: "free",
|
|
151
|
-
isContainer: false,
|
|
152
|
-
acceptsBoundaryEvents: true,
|
|
153
|
-
supportsMarkers: true,
|
|
154
|
-
canBeStart: false,
|
|
155
|
-
canBeEnd: false
|
|
156
|
-
},
|
|
157
|
-
BusinessRuleTask: {
|
|
158
|
-
label: "Business Rule Task",
|
|
159
|
-
icon: "Table2",
|
|
160
|
-
category: "task",
|
|
161
|
-
defaultWidth: 120,
|
|
162
|
-
defaultHeight: 60,
|
|
163
|
-
handlePolicy: "all",
|
|
164
|
-
orientation: "free",
|
|
165
|
-
isContainer: false,
|
|
166
|
-
acceptsBoundaryEvents: true,
|
|
167
|
-
supportsMarkers: true,
|
|
168
|
-
canBeStart: false,
|
|
169
|
-
canBeEnd: false
|
|
170
|
-
},
|
|
171
|
-
ReceiveTask: {
|
|
172
|
-
label: "Receive Task",
|
|
173
|
-
icon: "Inbox",
|
|
174
|
-
category: "task",
|
|
175
|
-
defaultWidth: 120,
|
|
176
|
-
defaultHeight: 60,
|
|
177
|
-
handlePolicy: "all",
|
|
178
|
-
orientation: "free",
|
|
179
|
-
isContainer: false,
|
|
180
|
-
acceptsBoundaryEvents: true,
|
|
181
|
-
supportsMarkers: true,
|
|
182
|
-
canBeStart: false,
|
|
183
|
-
canBeEnd: false
|
|
184
|
-
},
|
|
185
|
-
SendTask: {
|
|
186
|
-
label: "Send Task",
|
|
187
|
-
icon: "Send",
|
|
188
|
-
category: "task",
|
|
189
|
-
defaultWidth: 120,
|
|
190
|
-
defaultHeight: 60,
|
|
191
|
-
handlePolicy: "all",
|
|
192
|
-
orientation: "free",
|
|
193
|
-
isContainer: false,
|
|
194
|
-
acceptsBoundaryEvents: true,
|
|
195
|
-
supportsMarkers: true,
|
|
196
|
-
canBeStart: false,
|
|
197
|
-
canBeEnd: false
|
|
198
|
-
},
|
|
199
|
-
CallActivity: {
|
|
200
|
-
label: "Call Activity",
|
|
201
|
-
icon: "ExternalLink",
|
|
202
|
-
category: "task",
|
|
203
|
-
defaultWidth: 120,
|
|
204
|
-
defaultHeight: 60,
|
|
205
|
-
handlePolicy: "all",
|
|
206
|
-
orientation: "free",
|
|
207
|
-
isContainer: false,
|
|
208
|
-
acceptsBoundaryEvents: true,
|
|
209
|
-
supportsMarkers: true,
|
|
210
|
-
canBeStart: false,
|
|
211
|
-
canBeEnd: false
|
|
212
|
-
},
|
|
213
|
-
// ─── Gateways ────────────────────────────────────────────────────────────────
|
|
214
|
-
ExclusiveGateway: {
|
|
215
|
-
label: "Exclusive Gateway",
|
|
216
|
-
icon: "X",
|
|
217
|
-
category: "gateway",
|
|
218
|
-
defaultWidth: 50,
|
|
219
|
-
defaultHeight: 50,
|
|
220
|
-
handlePolicy: "all",
|
|
221
|
-
orientation: "free",
|
|
222
|
-
isContainer: false,
|
|
223
|
-
acceptsBoundaryEvents: false,
|
|
224
|
-
canBeStart: false,
|
|
225
|
-
canBeEnd: false
|
|
226
|
-
},
|
|
227
|
-
InclusiveGateway: {
|
|
228
|
-
label: "Inclusive Gateway",
|
|
229
|
-
icon: "Circle",
|
|
230
|
-
category: "gateway",
|
|
231
|
-
defaultWidth: 50,
|
|
232
|
-
defaultHeight: 50,
|
|
233
|
-
handlePolicy: "all",
|
|
234
|
-
orientation: "free",
|
|
235
|
-
isContainer: false,
|
|
236
|
-
acceptsBoundaryEvents: false,
|
|
237
|
-
canBeStart: false,
|
|
238
|
-
canBeEnd: false
|
|
239
|
-
},
|
|
240
|
-
ParallelGateway: {
|
|
241
|
-
label: "Parallel Gateway",
|
|
242
|
-
icon: "Plus",
|
|
243
|
-
category: "gateway",
|
|
244
|
-
defaultWidth: 50,
|
|
245
|
-
defaultHeight: 50,
|
|
246
|
-
handlePolicy: "all",
|
|
247
|
-
orientation: "free",
|
|
248
|
-
isContainer: false,
|
|
249
|
-
acceptsBoundaryEvents: false,
|
|
250
|
-
canBeStart: false,
|
|
251
|
-
canBeEnd: false
|
|
252
|
-
},
|
|
253
|
-
EventBasedGateway: {
|
|
254
|
-
label: "Event-Based Gateway",
|
|
255
|
-
icon: "Radio",
|
|
256
|
-
category: "gateway",
|
|
257
|
-
defaultWidth: 50,
|
|
258
|
-
defaultHeight: 50,
|
|
259
|
-
handlePolicy: "all",
|
|
260
|
-
orientation: "free",
|
|
261
|
-
isContainer: false,
|
|
262
|
-
acceptsBoundaryEvents: false,
|
|
263
|
-
canBeStart: false,
|
|
264
|
-
canBeEnd: false,
|
|
265
|
-
maxIncoming: 1
|
|
266
|
-
},
|
|
267
|
-
ComplexGateway: {
|
|
268
|
-
label: "Complex Gateway",
|
|
269
|
-
icon: "Asterisk",
|
|
270
|
-
category: "gateway",
|
|
271
|
-
defaultWidth: 50,
|
|
272
|
-
defaultHeight: 50,
|
|
273
|
-
handlePolicy: "all",
|
|
274
|
-
orientation: "free",
|
|
275
|
-
isContainer: false,
|
|
276
|
-
acceptsBoundaryEvents: false,
|
|
277
|
-
canBeStart: false,
|
|
278
|
-
canBeEnd: false
|
|
279
|
-
},
|
|
280
|
-
// ─── Containers ───────────────────────────────────────────────────────────────
|
|
281
|
-
SubProcess: {
|
|
282
|
-
label: "Sub-Process",
|
|
283
|
-
icon: "PlusSquare",
|
|
284
|
-
category: "container",
|
|
285
|
-
defaultWidth: 350,
|
|
286
|
-
defaultHeight: 200,
|
|
287
|
-
handlePolicy: "all",
|
|
288
|
-
orientation: "horizontal",
|
|
289
|
-
isContainer: true,
|
|
290
|
-
acceptsBoundaryEvents: true,
|
|
291
|
-
supportsCollapse: true,
|
|
292
|
-
supportsMarkers: true,
|
|
293
|
-
canBeStart: false,
|
|
294
|
-
canBeEnd: false
|
|
295
|
-
},
|
|
296
|
-
Transaction: {
|
|
297
|
-
label: "Transaction",
|
|
298
|
-
icon: "Receipt",
|
|
299
|
-
category: "container",
|
|
300
|
-
defaultWidth: 350,
|
|
301
|
-
defaultHeight: 200,
|
|
302
|
-
handlePolicy: "all",
|
|
303
|
-
orientation: "horizontal",
|
|
304
|
-
isContainer: true,
|
|
305
|
-
acceptsBoundaryEvents: true,
|
|
306
|
-
supportsCollapse: true,
|
|
307
|
-
supportsMarkers: true,
|
|
308
|
-
canBeStart: false,
|
|
309
|
-
canBeEnd: false
|
|
310
|
-
},
|
|
311
|
-
EventSubProcess: {
|
|
312
|
-
label: "Event Sub-Process",
|
|
313
|
-
icon: "CircleDotDashed",
|
|
314
|
-
category: "container",
|
|
315
|
-
defaultWidth: 350,
|
|
316
|
-
defaultHeight: 200,
|
|
317
|
-
handlePolicy: "all",
|
|
318
|
-
orientation: "horizontal",
|
|
319
|
-
isContainer: true,
|
|
320
|
-
acceptsBoundaryEvents: false,
|
|
321
|
-
supportsCollapse: true,
|
|
322
|
-
supportsMarkers: true,
|
|
323
|
-
canBeStart: false,
|
|
324
|
-
canBeEnd: false
|
|
325
|
-
},
|
|
326
|
-
AdHocSubProcess: {
|
|
327
|
-
label: "Ad-Hoc Sub-Process",
|
|
328
|
-
icon: "Waves",
|
|
329
|
-
category: "container",
|
|
330
|
-
defaultWidth: 350,
|
|
331
|
-
defaultHeight: 200,
|
|
332
|
-
handlePolicy: "all",
|
|
333
|
-
orientation: "horizontal",
|
|
334
|
-
isContainer: true,
|
|
335
|
-
acceptsBoundaryEvents: true,
|
|
336
|
-
supportsCollapse: true,
|
|
337
|
-
supportsMarkers: true,
|
|
338
|
-
canBeStart: false,
|
|
339
|
-
canBeEnd: false
|
|
340
|
-
},
|
|
341
|
-
Pool: {
|
|
342
|
-
label: "Pool",
|
|
343
|
-
icon: "Rows3",
|
|
344
|
-
category: "container",
|
|
345
|
-
defaultWidth: 600,
|
|
346
|
-
defaultHeight: 200,
|
|
347
|
-
handlePolicy: "none",
|
|
348
|
-
orientation: "horizontal",
|
|
349
|
-
isContainer: true,
|
|
350
|
-
acceptsBoundaryEvents: false,
|
|
351
|
-
canBeStart: false,
|
|
352
|
-
canBeEnd: false,
|
|
353
|
-
maxIncoming: 0,
|
|
354
|
-
maxOutgoing: 0
|
|
355
|
-
},
|
|
356
|
-
Lane: {
|
|
357
|
-
label: "Lane",
|
|
358
|
-
icon: "PanelTop",
|
|
359
|
-
category: "container",
|
|
360
|
-
defaultWidth: 600,
|
|
361
|
-
defaultHeight: 120,
|
|
362
|
-
handlePolicy: "none",
|
|
363
|
-
orientation: "horizontal",
|
|
364
|
-
isContainer: true,
|
|
365
|
-
acceptsBoundaryEvents: false,
|
|
366
|
-
canBeStart: false,
|
|
367
|
-
canBeEnd: false,
|
|
368
|
-
maxIncoming: 0,
|
|
369
|
-
maxOutgoing: 0
|
|
370
|
-
},
|
|
371
|
-
// ─── Artifacts ────────────────────────────────────────────────────────────────
|
|
372
|
-
Annotation: {
|
|
373
|
-
label: "Text Annotation",
|
|
374
|
-
icon: "StickyNote",
|
|
375
|
-
category: "artifact",
|
|
376
|
-
defaultWidth: 100,
|
|
377
|
-
defaultHeight: 60,
|
|
378
|
-
handlePolicy: "none",
|
|
379
|
-
orientation: "free",
|
|
380
|
-
isContainer: false,
|
|
381
|
-
acceptsBoundaryEvents: false,
|
|
382
|
-
canBeStart: false,
|
|
383
|
-
canBeEnd: false,
|
|
384
|
-
maxIncoming: 0,
|
|
385
|
-
maxOutgoing: 0
|
|
386
|
-
},
|
|
387
|
-
Group: {
|
|
388
|
-
label: "Group",
|
|
389
|
-
icon: "Group",
|
|
390
|
-
category: "artifact",
|
|
391
|
-
defaultWidth: 300,
|
|
392
|
-
defaultHeight: 200,
|
|
393
|
-
handlePolicy: "none",
|
|
394
|
-
orientation: "free",
|
|
395
|
-
isContainer: false,
|
|
396
|
-
acceptsBoundaryEvents: false,
|
|
397
|
-
canBeStart: false,
|
|
398
|
-
canBeEnd: false,
|
|
399
|
-
maxIncoming: 0,
|
|
400
|
-
maxOutgoing: 0
|
|
401
|
-
},
|
|
402
|
-
// ─── Data (BPMN 2.0 §10.3) ───────────────────────────────────────────────────
|
|
403
|
-
DataObject: {
|
|
404
|
-
label: "Data Object",
|
|
405
|
-
icon: "File",
|
|
406
|
-
category: "data",
|
|
407
|
-
defaultWidth: 36,
|
|
408
|
-
defaultHeight: 50,
|
|
409
|
-
handlePolicy: "all",
|
|
410
|
-
orientation: "free",
|
|
411
|
-
isContainer: false,
|
|
412
|
-
acceptsBoundaryEvents: false,
|
|
413
|
-
canBeStart: false,
|
|
414
|
-
canBeEnd: false,
|
|
415
|
-
maxIncoming: 0,
|
|
416
|
-
maxOutgoing: 0
|
|
417
|
-
},
|
|
418
|
-
DataObjectReference: {
|
|
419
|
-
label: "Data Object Reference",
|
|
420
|
-
icon: "FileSymlink",
|
|
421
|
-
category: "data",
|
|
422
|
-
defaultWidth: 36,
|
|
423
|
-
defaultHeight: 50,
|
|
424
|
-
handlePolicy: "all",
|
|
425
|
-
orientation: "free",
|
|
426
|
-
isContainer: false,
|
|
427
|
-
acceptsBoundaryEvents: false,
|
|
428
|
-
canBeStart: false,
|
|
429
|
-
canBeEnd: false,
|
|
430
|
-
maxIncoming: 0,
|
|
431
|
-
maxOutgoing: 0
|
|
432
|
-
},
|
|
433
|
-
DataInput: {
|
|
434
|
-
label: "Data Input",
|
|
435
|
-
icon: "FileInput",
|
|
436
|
-
category: "data",
|
|
437
|
-
defaultWidth: 36,
|
|
438
|
-
defaultHeight: 50,
|
|
439
|
-
handlePolicy: "all",
|
|
440
|
-
orientation: "free",
|
|
441
|
-
isContainer: false,
|
|
442
|
-
acceptsBoundaryEvents: false,
|
|
443
|
-
canBeStart: false,
|
|
444
|
-
canBeEnd: false,
|
|
445
|
-
maxIncoming: 0
|
|
446
|
-
},
|
|
447
|
-
DataOutput: {
|
|
448
|
-
label: "Data Output",
|
|
449
|
-
icon: "FileOutput",
|
|
450
|
-
category: "data",
|
|
451
|
-
defaultWidth: 36,
|
|
452
|
-
defaultHeight: 50,
|
|
453
|
-
handlePolicy: "all",
|
|
454
|
-
orientation: "free",
|
|
455
|
-
isContainer: false,
|
|
456
|
-
acceptsBoundaryEvents: false,
|
|
457
|
-
canBeStart: false,
|
|
458
|
-
canBeEnd: false,
|
|
459
|
-
maxOutgoing: 0
|
|
460
|
-
},
|
|
461
|
-
DataStore: {
|
|
462
|
-
label: "Data Store",
|
|
463
|
-
icon: "Database",
|
|
464
|
-
category: "data",
|
|
465
|
-
defaultWidth: 50,
|
|
466
|
-
defaultHeight: 50,
|
|
467
|
-
handlePolicy: "all",
|
|
468
|
-
orientation: "free",
|
|
469
|
-
isContainer: false,
|
|
470
|
-
acceptsBoundaryEvents: false,
|
|
471
|
-
canBeStart: false,
|
|
472
|
-
canBeEnd: false,
|
|
473
|
-
maxIncoming: 0,
|
|
474
|
-
maxOutgoing: 0
|
|
475
|
-
},
|
|
476
|
-
DataStoreReference: {
|
|
477
|
-
label: "Data Store Reference",
|
|
478
|
-
icon: "DatabaseZap",
|
|
479
|
-
category: "data",
|
|
480
|
-
defaultWidth: 50,
|
|
481
|
-
defaultHeight: 50,
|
|
482
|
-
handlePolicy: "all",
|
|
483
|
-
orientation: "free",
|
|
484
|
-
isContainer: false,
|
|
485
|
-
acceptsBoundaryEvents: false,
|
|
486
|
-
canBeStart: false,
|
|
487
|
-
canBeEnd: false,
|
|
488
|
-
maxIncoming: 0,
|
|
489
|
-
maxOutgoing: 0
|
|
490
|
-
},
|
|
491
|
-
// ─── Conversation (BPMN 2.0 §12) ─────────────────────────────────────────────
|
|
492
|
-
Conversation: {
|
|
493
|
-
label: "Conversation",
|
|
494
|
-
icon: "MessageCircle",
|
|
495
|
-
category: "conversation",
|
|
496
|
-
defaultWidth: 60,
|
|
497
|
-
defaultHeight: 52,
|
|
498
|
-
handlePolicy: "all",
|
|
499
|
-
orientation: "free",
|
|
500
|
-
isContainer: false,
|
|
501
|
-
acceptsBoundaryEvents: false,
|
|
502
|
-
canBeStart: false,
|
|
503
|
-
canBeEnd: false
|
|
504
|
-
},
|
|
505
|
-
SubConversation: {
|
|
506
|
-
label: "Sub-Conversation",
|
|
507
|
-
icon: "MessagesSquare",
|
|
508
|
-
category: "conversation",
|
|
509
|
-
defaultWidth: 60,
|
|
510
|
-
defaultHeight: 52,
|
|
511
|
-
handlePolicy: "all",
|
|
512
|
-
orientation: "free",
|
|
513
|
-
isContainer: true,
|
|
514
|
-
acceptsBoundaryEvents: false,
|
|
515
|
-
supportsCollapse: true,
|
|
516
|
-
canBeStart: false,
|
|
517
|
-
canBeEnd: false
|
|
518
|
-
},
|
|
519
|
-
CallConversation: {
|
|
520
|
-
label: "Call Conversation",
|
|
521
|
-
icon: "PhoneCall",
|
|
522
|
-
category: "conversation",
|
|
523
|
-
defaultWidth: 60,
|
|
524
|
-
defaultHeight: 52,
|
|
525
|
-
handlePolicy: "all",
|
|
526
|
-
orientation: "free",
|
|
527
|
-
isContainer: false,
|
|
528
|
-
acceptsBoundaryEvents: false,
|
|
529
|
-
canBeStart: false,
|
|
530
|
-
canBeEnd: false
|
|
531
|
-
},
|
|
532
|
-
// ─── Choreography (BPMN 2.0 §11) ─────────────────────────────────────────────
|
|
533
|
-
ChoreographyTask: {
|
|
534
|
-
label: "Choreography Task",
|
|
535
|
-
icon: "ArrowLeftRight",
|
|
536
|
-
category: "choreography",
|
|
537
|
-
defaultWidth: 120,
|
|
538
|
-
defaultHeight: 80,
|
|
539
|
-
handlePolicy: "all",
|
|
540
|
-
orientation: "horizontal",
|
|
541
|
-
isContainer: false,
|
|
542
|
-
acceptsBoundaryEvents: false,
|
|
543
|
-
canBeStart: false,
|
|
544
|
-
canBeEnd: false
|
|
545
|
-
},
|
|
546
|
-
SubChoreography: {
|
|
547
|
-
label: "Sub-Choreography",
|
|
548
|
-
icon: "BoxSelect",
|
|
549
|
-
category: "choreography",
|
|
550
|
-
defaultWidth: 120,
|
|
551
|
-
defaultHeight: 80,
|
|
552
|
-
handlePolicy: "all",
|
|
553
|
-
orientation: "horizontal",
|
|
554
|
-
isContainer: true,
|
|
555
|
-
acceptsBoundaryEvents: false,
|
|
556
|
-
supportsCollapse: true,
|
|
557
|
-
canBeStart: false,
|
|
558
|
-
canBeEnd: false
|
|
559
|
-
},
|
|
560
|
-
CallChoreography: {
|
|
561
|
-
label: "Call Choreography",
|
|
562
|
-
icon: "Phone",
|
|
563
|
-
category: "choreography",
|
|
564
|
-
defaultWidth: 120,
|
|
565
|
-
defaultHeight: 80,
|
|
566
|
-
handlePolicy: "all",
|
|
567
|
-
orientation: "horizontal",
|
|
568
|
-
isContainer: false,
|
|
569
|
-
acceptsBoundaryEvents: false,
|
|
570
|
-
canBeStart: false,
|
|
571
|
-
canBeEnd: false
|
|
572
|
-
}
|
|
573
|
-
};
|
|
574
18
|
function getElementMeta(type) {
|
|
575
19
|
return BPMN_ELEMENT_CATALOG[type];
|
|
576
20
|
}
|
|
577
|
-
var BPMN_RESIZABLE_ELEMENT_TYPES = [
|
|
578
|
-
"Task",
|
|
579
|
-
"UserTask",
|
|
580
|
-
"ServiceTask",
|
|
581
|
-
"ScriptTask",
|
|
582
|
-
"ManualTask",
|
|
583
|
-
"BusinessRuleTask",
|
|
584
|
-
"ReceiveTask",
|
|
585
|
-
"SendTask",
|
|
586
|
-
"CallActivity",
|
|
587
|
-
"SubProcess",
|
|
588
|
-
"Transaction",
|
|
589
|
-
"EventSubProcess",
|
|
590
|
-
"AdHocSubProcess",
|
|
591
|
-
"Pool",
|
|
592
|
-
"Lane",
|
|
593
|
-
"Annotation",
|
|
594
|
-
"Group",
|
|
595
|
-
"SubConversation",
|
|
596
|
-
"ChoreographyTask",
|
|
597
|
-
"SubChoreography",
|
|
598
|
-
"CallChoreography"
|
|
599
|
-
];
|
|
600
|
-
var BPMN_MIN_SIZE_OVERRIDES = {
|
|
601
|
-
Task: { minWidth: 80, minHeight: 48 },
|
|
602
|
-
UserTask: { minWidth: 80, minHeight: 48 },
|
|
603
|
-
ServiceTask: { minWidth: 80, minHeight: 48 },
|
|
604
|
-
ScriptTask: { minWidth: 80, minHeight: 48 },
|
|
605
|
-
ManualTask: { minWidth: 80, minHeight: 48 },
|
|
606
|
-
BusinessRuleTask: { minWidth: 80, minHeight: 48 },
|
|
607
|
-
ReceiveTask: { minWidth: 80, minHeight: 48 },
|
|
608
|
-
SendTask: { minWidth: 80, minHeight: 48 },
|
|
609
|
-
CallActivity: { minWidth: 80, minHeight: 48 },
|
|
610
|
-
SubProcess: { minWidth: 160, minHeight: 100 },
|
|
611
|
-
Transaction: { minWidth: 160, minHeight: 100 },
|
|
612
|
-
EventSubProcess: { minWidth: 160, minHeight: 100 },
|
|
613
|
-
AdHocSubProcess: { minWidth: 160, minHeight: 100 },
|
|
614
|
-
Pool: { minWidth: 240, minHeight: 120 },
|
|
615
|
-
Lane: { minWidth: 240, minHeight: 80 },
|
|
616
|
-
Annotation: { minWidth: 80, minHeight: 40 },
|
|
617
|
-
Group: { minWidth: 120, minHeight: 80 },
|
|
618
|
-
SubConversation: { minWidth: 60, minHeight: 52 },
|
|
619
|
-
ChoreographyTask: { minWidth: 100, minHeight: 70 },
|
|
620
|
-
SubChoreography: { minWidth: 100, minHeight: 70 },
|
|
621
|
-
CallChoreography: { minWidth: 100, minHeight: 70 }
|
|
622
|
-
};
|
|
623
|
-
var resizableTypes = new Set(BPMN_RESIZABLE_ELEMENT_TYPES);
|
|
624
21
|
function isBpmnElementResizable(type) {
|
|
625
22
|
return resizableTypes.has(type);
|
|
626
23
|
}
|
|
@@ -635,30 +32,624 @@ function getBpmnElementSize(type) {
|
|
|
635
32
|
resizable: meta.resizable ?? isBpmnElementResizable(type)
|
|
636
33
|
};
|
|
637
34
|
}
|
|
35
|
+
var BPMN_ELEMENT_CATALOG, BPMN_RESIZABLE_ELEMENT_TYPES, BPMN_MIN_SIZE_OVERRIDES, resizableTypes;
|
|
36
|
+
var init_catalog = __esm({
|
|
37
|
+
"src/elements/catalog.ts"() {
|
|
38
|
+
BPMN_ELEMENT_CATALOG = {
|
|
39
|
+
// ─── Events ──────────────────────────────────────────────────────────────────
|
|
40
|
+
StartEvent: {
|
|
41
|
+
label: "Start Event",
|
|
42
|
+
icon: "Circle",
|
|
43
|
+
category: "event",
|
|
44
|
+
defaultWidth: 36,
|
|
45
|
+
defaultHeight: 36,
|
|
46
|
+
handlePolicy: "source",
|
|
47
|
+
orientation: "free",
|
|
48
|
+
isContainer: false,
|
|
49
|
+
acceptsBoundaryEvents: false,
|
|
50
|
+
eventSemantics: "start",
|
|
51
|
+
canBeStart: true,
|
|
52
|
+
canBeEnd: false,
|
|
53
|
+
maxIncoming: 0,
|
|
54
|
+
maxOutgoing: 1
|
|
55
|
+
},
|
|
56
|
+
EndEvent: {
|
|
57
|
+
label: "End Event",
|
|
58
|
+
icon: "CircleDot",
|
|
59
|
+
category: "event",
|
|
60
|
+
defaultWidth: 36,
|
|
61
|
+
defaultHeight: 36,
|
|
62
|
+
handlePolicy: "target",
|
|
63
|
+
orientation: "free",
|
|
64
|
+
isContainer: false,
|
|
65
|
+
acceptsBoundaryEvents: false,
|
|
66
|
+
eventSemantics: "end",
|
|
67
|
+
canBeStart: false,
|
|
68
|
+
canBeEnd: true,
|
|
69
|
+
maxOutgoing: 0
|
|
70
|
+
},
|
|
71
|
+
IntermediateCatchEvent: {
|
|
72
|
+
label: "Intermediate Catch Event",
|
|
73
|
+
icon: "Clock3",
|
|
74
|
+
category: "event",
|
|
75
|
+
defaultWidth: 36,
|
|
76
|
+
defaultHeight: 36,
|
|
77
|
+
handlePolicy: "all",
|
|
78
|
+
orientation: "free",
|
|
79
|
+
isContainer: false,
|
|
80
|
+
acceptsBoundaryEvents: false,
|
|
81
|
+
eventSemantics: "intermediateCatch",
|
|
82
|
+
canBeStart: false,
|
|
83
|
+
canBeEnd: false
|
|
84
|
+
},
|
|
85
|
+
IntermediateThrowEvent: {
|
|
86
|
+
label: "Intermediate Throw Event",
|
|
87
|
+
icon: "Send",
|
|
88
|
+
category: "event",
|
|
89
|
+
defaultWidth: 36,
|
|
90
|
+
defaultHeight: 36,
|
|
91
|
+
handlePolicy: "all",
|
|
92
|
+
orientation: "free",
|
|
93
|
+
isContainer: false,
|
|
94
|
+
acceptsBoundaryEvents: false,
|
|
95
|
+
eventSemantics: "intermediateThrow",
|
|
96
|
+
canBeStart: false,
|
|
97
|
+
canBeEnd: false
|
|
98
|
+
},
|
|
99
|
+
BoundaryEvent: {
|
|
100
|
+
label: "Boundary Event",
|
|
101
|
+
icon: "AlarmClock",
|
|
102
|
+
category: "event",
|
|
103
|
+
defaultWidth: 36,
|
|
104
|
+
defaultHeight: 36,
|
|
105
|
+
handlePolicy: "source",
|
|
106
|
+
orientation: "free",
|
|
107
|
+
isContainer: false,
|
|
108
|
+
acceptsBoundaryEvents: false,
|
|
109
|
+
eventSemantics: "boundary",
|
|
110
|
+
canBeStart: false,
|
|
111
|
+
canBeEnd: false,
|
|
112
|
+
maxIncoming: 0
|
|
113
|
+
},
|
|
114
|
+
// ─── Tasks ───────────────────────────────────────────────────────────────────
|
|
115
|
+
Task: {
|
|
116
|
+
label: "Task",
|
|
117
|
+
icon: "CheckSquare",
|
|
118
|
+
category: "task",
|
|
119
|
+
defaultWidth: 120,
|
|
120
|
+
defaultHeight: 60,
|
|
121
|
+
handlePolicy: "all",
|
|
122
|
+
orientation: "free",
|
|
123
|
+
isContainer: false,
|
|
124
|
+
acceptsBoundaryEvents: true,
|
|
125
|
+
supportsMarkers: true,
|
|
126
|
+
canBeStart: false,
|
|
127
|
+
canBeEnd: false
|
|
128
|
+
},
|
|
129
|
+
UserTask: {
|
|
130
|
+
label: "User Task",
|
|
131
|
+
icon: "UserRound",
|
|
132
|
+
category: "task",
|
|
133
|
+
defaultWidth: 120,
|
|
134
|
+
defaultHeight: 60,
|
|
135
|
+
handlePolicy: "all",
|
|
136
|
+
orientation: "free",
|
|
137
|
+
isContainer: false,
|
|
138
|
+
acceptsBoundaryEvents: true,
|
|
139
|
+
supportsMarkers: true,
|
|
140
|
+
canBeStart: false,
|
|
141
|
+
canBeEnd: false
|
|
142
|
+
},
|
|
143
|
+
ServiceTask: {
|
|
144
|
+
label: "Service Task",
|
|
145
|
+
icon: "Cog",
|
|
146
|
+
category: "task",
|
|
147
|
+
defaultWidth: 120,
|
|
148
|
+
defaultHeight: 60,
|
|
149
|
+
handlePolicy: "all",
|
|
150
|
+
orientation: "free",
|
|
151
|
+
isContainer: false,
|
|
152
|
+
acceptsBoundaryEvents: true,
|
|
153
|
+
supportsMarkers: true,
|
|
154
|
+
canBeStart: false,
|
|
155
|
+
canBeEnd: false
|
|
156
|
+
},
|
|
157
|
+
ScriptTask: {
|
|
158
|
+
label: "Script Task",
|
|
159
|
+
icon: "FileCode",
|
|
160
|
+
category: "task",
|
|
161
|
+
defaultWidth: 120,
|
|
162
|
+
defaultHeight: 60,
|
|
163
|
+
handlePolicy: "all",
|
|
164
|
+
orientation: "free",
|
|
165
|
+
isContainer: false,
|
|
166
|
+
acceptsBoundaryEvents: true,
|
|
167
|
+
supportsMarkers: true,
|
|
168
|
+
canBeStart: false,
|
|
169
|
+
canBeEnd: false
|
|
170
|
+
},
|
|
171
|
+
ManualTask: {
|
|
172
|
+
label: "Manual Task",
|
|
173
|
+
icon: "Hand",
|
|
174
|
+
category: "task",
|
|
175
|
+
defaultWidth: 120,
|
|
176
|
+
defaultHeight: 60,
|
|
177
|
+
handlePolicy: "all",
|
|
178
|
+
orientation: "free",
|
|
179
|
+
isContainer: false,
|
|
180
|
+
acceptsBoundaryEvents: true,
|
|
181
|
+
supportsMarkers: true,
|
|
182
|
+
canBeStart: false,
|
|
183
|
+
canBeEnd: false
|
|
184
|
+
},
|
|
185
|
+
BusinessRuleTask: {
|
|
186
|
+
label: "Business Rule Task",
|
|
187
|
+
icon: "Table2",
|
|
188
|
+
category: "task",
|
|
189
|
+
defaultWidth: 120,
|
|
190
|
+
defaultHeight: 60,
|
|
191
|
+
handlePolicy: "all",
|
|
192
|
+
orientation: "free",
|
|
193
|
+
isContainer: false,
|
|
194
|
+
acceptsBoundaryEvents: true,
|
|
195
|
+
supportsMarkers: true,
|
|
196
|
+
canBeStart: false,
|
|
197
|
+
canBeEnd: false
|
|
198
|
+
},
|
|
199
|
+
ReceiveTask: {
|
|
200
|
+
label: "Receive Task",
|
|
201
|
+
icon: "Inbox",
|
|
202
|
+
category: "task",
|
|
203
|
+
defaultWidth: 120,
|
|
204
|
+
defaultHeight: 60,
|
|
205
|
+
handlePolicy: "all",
|
|
206
|
+
orientation: "free",
|
|
207
|
+
isContainer: false,
|
|
208
|
+
acceptsBoundaryEvents: true,
|
|
209
|
+
supportsMarkers: true,
|
|
210
|
+
canBeStart: false,
|
|
211
|
+
canBeEnd: false
|
|
212
|
+
},
|
|
213
|
+
SendTask: {
|
|
214
|
+
label: "Send Task",
|
|
215
|
+
icon: "Send",
|
|
216
|
+
category: "task",
|
|
217
|
+
defaultWidth: 120,
|
|
218
|
+
defaultHeight: 60,
|
|
219
|
+
handlePolicy: "all",
|
|
220
|
+
orientation: "free",
|
|
221
|
+
isContainer: false,
|
|
222
|
+
acceptsBoundaryEvents: true,
|
|
223
|
+
supportsMarkers: true,
|
|
224
|
+
canBeStart: false,
|
|
225
|
+
canBeEnd: false
|
|
226
|
+
},
|
|
227
|
+
CallActivity: {
|
|
228
|
+
label: "Call Activity",
|
|
229
|
+
icon: "ExternalLink",
|
|
230
|
+
category: "task",
|
|
231
|
+
defaultWidth: 120,
|
|
232
|
+
defaultHeight: 60,
|
|
233
|
+
handlePolicy: "all",
|
|
234
|
+
orientation: "free",
|
|
235
|
+
isContainer: false,
|
|
236
|
+
acceptsBoundaryEvents: true,
|
|
237
|
+
supportsMarkers: true,
|
|
238
|
+
canBeStart: false,
|
|
239
|
+
canBeEnd: false
|
|
240
|
+
},
|
|
241
|
+
// ─── Gateways ────────────────────────────────────────────────────────────────
|
|
242
|
+
ExclusiveGateway: {
|
|
243
|
+
label: "Exclusive Gateway",
|
|
244
|
+
icon: "X",
|
|
245
|
+
category: "gateway",
|
|
246
|
+
defaultWidth: 50,
|
|
247
|
+
defaultHeight: 50,
|
|
248
|
+
handlePolicy: "all",
|
|
249
|
+
orientation: "free",
|
|
250
|
+
isContainer: false,
|
|
251
|
+
acceptsBoundaryEvents: false,
|
|
252
|
+
canBeStart: false,
|
|
253
|
+
canBeEnd: false
|
|
254
|
+
},
|
|
255
|
+
InclusiveGateway: {
|
|
256
|
+
label: "Inclusive Gateway",
|
|
257
|
+
icon: "Circle",
|
|
258
|
+
category: "gateway",
|
|
259
|
+
defaultWidth: 50,
|
|
260
|
+
defaultHeight: 50,
|
|
261
|
+
handlePolicy: "all",
|
|
262
|
+
orientation: "free",
|
|
263
|
+
isContainer: false,
|
|
264
|
+
acceptsBoundaryEvents: false,
|
|
265
|
+
canBeStart: false,
|
|
266
|
+
canBeEnd: false
|
|
267
|
+
},
|
|
268
|
+
ParallelGateway: {
|
|
269
|
+
label: "Parallel Gateway",
|
|
270
|
+
icon: "Plus",
|
|
271
|
+
category: "gateway",
|
|
272
|
+
defaultWidth: 50,
|
|
273
|
+
defaultHeight: 50,
|
|
274
|
+
handlePolicy: "all",
|
|
275
|
+
orientation: "free",
|
|
276
|
+
isContainer: false,
|
|
277
|
+
acceptsBoundaryEvents: false,
|
|
278
|
+
canBeStart: false,
|
|
279
|
+
canBeEnd: false
|
|
280
|
+
},
|
|
281
|
+
EventBasedGateway: {
|
|
282
|
+
label: "Event-Based Gateway",
|
|
283
|
+
icon: "Radio",
|
|
284
|
+
category: "gateway",
|
|
285
|
+
defaultWidth: 50,
|
|
286
|
+
defaultHeight: 50,
|
|
287
|
+
handlePolicy: "all",
|
|
288
|
+
orientation: "free",
|
|
289
|
+
isContainer: false,
|
|
290
|
+
acceptsBoundaryEvents: false,
|
|
291
|
+
canBeStart: false,
|
|
292
|
+
canBeEnd: false,
|
|
293
|
+
maxIncoming: 1
|
|
294
|
+
},
|
|
295
|
+
ComplexGateway: {
|
|
296
|
+
label: "Complex Gateway",
|
|
297
|
+
icon: "Asterisk",
|
|
298
|
+
category: "gateway",
|
|
299
|
+
defaultWidth: 50,
|
|
300
|
+
defaultHeight: 50,
|
|
301
|
+
handlePolicy: "all",
|
|
302
|
+
orientation: "free",
|
|
303
|
+
isContainer: false,
|
|
304
|
+
acceptsBoundaryEvents: false,
|
|
305
|
+
canBeStart: false,
|
|
306
|
+
canBeEnd: false
|
|
307
|
+
},
|
|
308
|
+
// ─── Containers ───────────────────────────────────────────────────────────────
|
|
309
|
+
SubProcess: {
|
|
310
|
+
label: "Sub-Process",
|
|
311
|
+
icon: "PlusSquare",
|
|
312
|
+
category: "container",
|
|
313
|
+
defaultWidth: 350,
|
|
314
|
+
defaultHeight: 200,
|
|
315
|
+
handlePolicy: "all",
|
|
316
|
+
orientation: "horizontal",
|
|
317
|
+
isContainer: true,
|
|
318
|
+
acceptsBoundaryEvents: true,
|
|
319
|
+
supportsCollapse: true,
|
|
320
|
+
supportsMarkers: true,
|
|
321
|
+
canBeStart: false,
|
|
322
|
+
canBeEnd: false
|
|
323
|
+
},
|
|
324
|
+
Transaction: {
|
|
325
|
+
label: "Transaction",
|
|
326
|
+
icon: "Receipt",
|
|
327
|
+
category: "container",
|
|
328
|
+
defaultWidth: 350,
|
|
329
|
+
defaultHeight: 200,
|
|
330
|
+
handlePolicy: "all",
|
|
331
|
+
orientation: "horizontal",
|
|
332
|
+
isContainer: true,
|
|
333
|
+
acceptsBoundaryEvents: true,
|
|
334
|
+
supportsCollapse: true,
|
|
335
|
+
supportsMarkers: true,
|
|
336
|
+
canBeStart: false,
|
|
337
|
+
canBeEnd: false
|
|
338
|
+
},
|
|
339
|
+
EventSubProcess: {
|
|
340
|
+
label: "Event Sub-Process",
|
|
341
|
+
icon: "CircleDotDashed",
|
|
342
|
+
category: "container",
|
|
343
|
+
defaultWidth: 350,
|
|
344
|
+
defaultHeight: 200,
|
|
345
|
+
handlePolicy: "all",
|
|
346
|
+
orientation: "horizontal",
|
|
347
|
+
isContainer: true,
|
|
348
|
+
acceptsBoundaryEvents: false,
|
|
349
|
+
supportsCollapse: true,
|
|
350
|
+
supportsMarkers: true,
|
|
351
|
+
canBeStart: false,
|
|
352
|
+
canBeEnd: false
|
|
353
|
+
},
|
|
354
|
+
AdHocSubProcess: {
|
|
355
|
+
label: "Ad-Hoc Sub-Process",
|
|
356
|
+
icon: "Waves",
|
|
357
|
+
category: "container",
|
|
358
|
+
defaultWidth: 350,
|
|
359
|
+
defaultHeight: 200,
|
|
360
|
+
handlePolicy: "all",
|
|
361
|
+
orientation: "horizontal",
|
|
362
|
+
isContainer: true,
|
|
363
|
+
acceptsBoundaryEvents: true,
|
|
364
|
+
supportsCollapse: true,
|
|
365
|
+
supportsMarkers: true,
|
|
366
|
+
canBeStart: false,
|
|
367
|
+
canBeEnd: false
|
|
368
|
+
},
|
|
369
|
+
Pool: {
|
|
370
|
+
label: "Pool",
|
|
371
|
+
icon: "Rows3",
|
|
372
|
+
category: "container",
|
|
373
|
+
defaultWidth: 600,
|
|
374
|
+
defaultHeight: 200,
|
|
375
|
+
handlePolicy: "none",
|
|
376
|
+
orientation: "horizontal",
|
|
377
|
+
isContainer: true,
|
|
378
|
+
acceptsBoundaryEvents: false,
|
|
379
|
+
canBeStart: false,
|
|
380
|
+
canBeEnd: false,
|
|
381
|
+
maxIncoming: 0,
|
|
382
|
+
maxOutgoing: 0
|
|
383
|
+
},
|
|
384
|
+
Lane: {
|
|
385
|
+
label: "Lane",
|
|
386
|
+
icon: "PanelTop",
|
|
387
|
+
category: "container",
|
|
388
|
+
defaultWidth: 600,
|
|
389
|
+
defaultHeight: 120,
|
|
390
|
+
handlePolicy: "none",
|
|
391
|
+
orientation: "horizontal",
|
|
392
|
+
isContainer: true,
|
|
393
|
+
acceptsBoundaryEvents: false,
|
|
394
|
+
canBeStart: false,
|
|
395
|
+
canBeEnd: false,
|
|
396
|
+
maxIncoming: 0,
|
|
397
|
+
maxOutgoing: 0
|
|
398
|
+
},
|
|
399
|
+
// ─── Artifacts ────────────────────────────────────────────────────────────────
|
|
400
|
+
Annotation: {
|
|
401
|
+
label: "Text Annotation",
|
|
402
|
+
icon: "StickyNote",
|
|
403
|
+
category: "artifact",
|
|
404
|
+
defaultWidth: 100,
|
|
405
|
+
defaultHeight: 60,
|
|
406
|
+
handlePolicy: "none",
|
|
407
|
+
orientation: "free",
|
|
408
|
+
isContainer: false,
|
|
409
|
+
acceptsBoundaryEvents: false,
|
|
410
|
+
canBeStart: false,
|
|
411
|
+
canBeEnd: false,
|
|
412
|
+
maxIncoming: 0,
|
|
413
|
+
maxOutgoing: 0
|
|
414
|
+
},
|
|
415
|
+
Group: {
|
|
416
|
+
label: "Group",
|
|
417
|
+
icon: "Group",
|
|
418
|
+
category: "artifact",
|
|
419
|
+
defaultWidth: 300,
|
|
420
|
+
defaultHeight: 200,
|
|
421
|
+
handlePolicy: "none",
|
|
422
|
+
orientation: "free",
|
|
423
|
+
isContainer: false,
|
|
424
|
+
acceptsBoundaryEvents: false,
|
|
425
|
+
canBeStart: false,
|
|
426
|
+
canBeEnd: false,
|
|
427
|
+
maxIncoming: 0,
|
|
428
|
+
maxOutgoing: 0
|
|
429
|
+
},
|
|
430
|
+
// ─── Data (BPMN 2.0 §10.3) ───────────────────────────────────────────────────
|
|
431
|
+
DataObject: {
|
|
432
|
+
label: "Data Object",
|
|
433
|
+
icon: "File",
|
|
434
|
+
category: "data",
|
|
435
|
+
defaultWidth: 36,
|
|
436
|
+
defaultHeight: 50,
|
|
437
|
+
handlePolicy: "all",
|
|
438
|
+
orientation: "free",
|
|
439
|
+
isContainer: false,
|
|
440
|
+
acceptsBoundaryEvents: false,
|
|
441
|
+
canBeStart: false,
|
|
442
|
+
canBeEnd: false,
|
|
443
|
+
maxIncoming: 0,
|
|
444
|
+
maxOutgoing: 0
|
|
445
|
+
},
|
|
446
|
+
DataObjectReference: {
|
|
447
|
+
label: "Data Object Reference",
|
|
448
|
+
icon: "FileSymlink",
|
|
449
|
+
category: "data",
|
|
450
|
+
defaultWidth: 36,
|
|
451
|
+
defaultHeight: 50,
|
|
452
|
+
handlePolicy: "all",
|
|
453
|
+
orientation: "free",
|
|
454
|
+
isContainer: false,
|
|
455
|
+
acceptsBoundaryEvents: false,
|
|
456
|
+
canBeStart: false,
|
|
457
|
+
canBeEnd: false,
|
|
458
|
+
maxIncoming: 0,
|
|
459
|
+
maxOutgoing: 0
|
|
460
|
+
},
|
|
461
|
+
DataInput: {
|
|
462
|
+
label: "Data Input",
|
|
463
|
+
icon: "FileInput",
|
|
464
|
+
category: "data",
|
|
465
|
+
defaultWidth: 36,
|
|
466
|
+
defaultHeight: 50,
|
|
467
|
+
handlePolicy: "all",
|
|
468
|
+
orientation: "free",
|
|
469
|
+
isContainer: false,
|
|
470
|
+
acceptsBoundaryEvents: false,
|
|
471
|
+
canBeStart: false,
|
|
472
|
+
canBeEnd: false,
|
|
473
|
+
maxIncoming: 0
|
|
474
|
+
},
|
|
475
|
+
DataOutput: {
|
|
476
|
+
label: "Data Output",
|
|
477
|
+
icon: "FileOutput",
|
|
478
|
+
category: "data",
|
|
479
|
+
defaultWidth: 36,
|
|
480
|
+
defaultHeight: 50,
|
|
481
|
+
handlePolicy: "all",
|
|
482
|
+
orientation: "free",
|
|
483
|
+
isContainer: false,
|
|
484
|
+
acceptsBoundaryEvents: false,
|
|
485
|
+
canBeStart: false,
|
|
486
|
+
canBeEnd: false,
|
|
487
|
+
maxOutgoing: 0
|
|
488
|
+
},
|
|
489
|
+
DataStore: {
|
|
490
|
+
label: "Data Store",
|
|
491
|
+
icon: "Database",
|
|
492
|
+
category: "data",
|
|
493
|
+
defaultWidth: 50,
|
|
494
|
+
defaultHeight: 50,
|
|
495
|
+
handlePolicy: "all",
|
|
496
|
+
orientation: "free",
|
|
497
|
+
isContainer: false,
|
|
498
|
+
acceptsBoundaryEvents: false,
|
|
499
|
+
canBeStart: false,
|
|
500
|
+
canBeEnd: false,
|
|
501
|
+
maxIncoming: 0,
|
|
502
|
+
maxOutgoing: 0
|
|
503
|
+
},
|
|
504
|
+
DataStoreReference: {
|
|
505
|
+
label: "Data Store Reference",
|
|
506
|
+
icon: "DatabaseZap",
|
|
507
|
+
category: "data",
|
|
508
|
+
defaultWidth: 50,
|
|
509
|
+
defaultHeight: 50,
|
|
510
|
+
handlePolicy: "all",
|
|
511
|
+
orientation: "free",
|
|
512
|
+
isContainer: false,
|
|
513
|
+
acceptsBoundaryEvents: false,
|
|
514
|
+
canBeStart: false,
|
|
515
|
+
canBeEnd: false,
|
|
516
|
+
maxIncoming: 0,
|
|
517
|
+
maxOutgoing: 0
|
|
518
|
+
},
|
|
519
|
+
// ─── Conversation (BPMN 2.0 §12) ─────────────────────────────────────────────
|
|
520
|
+
Conversation: {
|
|
521
|
+
label: "Conversation",
|
|
522
|
+
icon: "MessageCircle",
|
|
523
|
+
category: "conversation",
|
|
524
|
+
defaultWidth: 60,
|
|
525
|
+
defaultHeight: 52,
|
|
526
|
+
handlePolicy: "all",
|
|
527
|
+
orientation: "free",
|
|
528
|
+
isContainer: false,
|
|
529
|
+
acceptsBoundaryEvents: false,
|
|
530
|
+
canBeStart: false,
|
|
531
|
+
canBeEnd: false
|
|
532
|
+
},
|
|
533
|
+
SubConversation: {
|
|
534
|
+
label: "Sub-Conversation",
|
|
535
|
+
icon: "MessagesSquare",
|
|
536
|
+
category: "conversation",
|
|
537
|
+
defaultWidth: 60,
|
|
538
|
+
defaultHeight: 52,
|
|
539
|
+
handlePolicy: "all",
|
|
540
|
+
orientation: "free",
|
|
541
|
+
isContainer: true,
|
|
542
|
+
acceptsBoundaryEvents: false,
|
|
543
|
+
supportsCollapse: true,
|
|
544
|
+
canBeStart: false,
|
|
545
|
+
canBeEnd: false
|
|
546
|
+
},
|
|
547
|
+
CallConversation: {
|
|
548
|
+
label: "Call Conversation",
|
|
549
|
+
icon: "PhoneCall",
|
|
550
|
+
category: "conversation",
|
|
551
|
+
defaultWidth: 60,
|
|
552
|
+
defaultHeight: 52,
|
|
553
|
+
handlePolicy: "all",
|
|
554
|
+
orientation: "free",
|
|
555
|
+
isContainer: false,
|
|
556
|
+
acceptsBoundaryEvents: false,
|
|
557
|
+
canBeStart: false,
|
|
558
|
+
canBeEnd: false
|
|
559
|
+
},
|
|
560
|
+
// ─── Choreography (BPMN 2.0 §11) ─────────────────────────────────────────────
|
|
561
|
+
ChoreographyTask: {
|
|
562
|
+
label: "Choreography Task",
|
|
563
|
+
icon: "ArrowLeftRight",
|
|
564
|
+
category: "choreography",
|
|
565
|
+
defaultWidth: 120,
|
|
566
|
+
defaultHeight: 80,
|
|
567
|
+
handlePolicy: "all",
|
|
568
|
+
orientation: "horizontal",
|
|
569
|
+
isContainer: false,
|
|
570
|
+
acceptsBoundaryEvents: false,
|
|
571
|
+
canBeStart: false,
|
|
572
|
+
canBeEnd: false
|
|
573
|
+
},
|
|
574
|
+
SubChoreography: {
|
|
575
|
+
label: "Sub-Choreography",
|
|
576
|
+
icon: "BoxSelect",
|
|
577
|
+
category: "choreography",
|
|
578
|
+
defaultWidth: 120,
|
|
579
|
+
defaultHeight: 80,
|
|
580
|
+
handlePolicy: "all",
|
|
581
|
+
orientation: "horizontal",
|
|
582
|
+
isContainer: true,
|
|
583
|
+
acceptsBoundaryEvents: false,
|
|
584
|
+
supportsCollapse: true,
|
|
585
|
+
canBeStart: false,
|
|
586
|
+
canBeEnd: false
|
|
587
|
+
},
|
|
588
|
+
CallChoreography: {
|
|
589
|
+
label: "Call Choreography",
|
|
590
|
+
icon: "Phone",
|
|
591
|
+
category: "choreography",
|
|
592
|
+
defaultWidth: 120,
|
|
593
|
+
defaultHeight: 80,
|
|
594
|
+
handlePolicy: "all",
|
|
595
|
+
orientation: "horizontal",
|
|
596
|
+
isContainer: false,
|
|
597
|
+
acceptsBoundaryEvents: false,
|
|
598
|
+
canBeStart: false,
|
|
599
|
+
canBeEnd: false
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
BPMN_RESIZABLE_ELEMENT_TYPES = [
|
|
603
|
+
"Task",
|
|
604
|
+
"UserTask",
|
|
605
|
+
"ServiceTask",
|
|
606
|
+
"ScriptTask",
|
|
607
|
+
"ManualTask",
|
|
608
|
+
"BusinessRuleTask",
|
|
609
|
+
"ReceiveTask",
|
|
610
|
+
"SendTask",
|
|
611
|
+
"CallActivity",
|
|
612
|
+
"SubProcess",
|
|
613
|
+
"Transaction",
|
|
614
|
+
"EventSubProcess",
|
|
615
|
+
"AdHocSubProcess",
|
|
616
|
+
"Pool",
|
|
617
|
+
"Lane",
|
|
618
|
+
"Annotation",
|
|
619
|
+
"Group",
|
|
620
|
+
"SubConversation",
|
|
621
|
+
"ChoreographyTask",
|
|
622
|
+
"SubChoreography",
|
|
623
|
+
"CallChoreography"
|
|
624
|
+
];
|
|
625
|
+
BPMN_MIN_SIZE_OVERRIDES = {
|
|
626
|
+
Task: { minWidth: 80, minHeight: 48 },
|
|
627
|
+
UserTask: { minWidth: 80, minHeight: 48 },
|
|
628
|
+
ServiceTask: { minWidth: 80, minHeight: 48 },
|
|
629
|
+
ScriptTask: { minWidth: 80, minHeight: 48 },
|
|
630
|
+
ManualTask: { minWidth: 80, minHeight: 48 },
|
|
631
|
+
BusinessRuleTask: { minWidth: 80, minHeight: 48 },
|
|
632
|
+
ReceiveTask: { minWidth: 80, minHeight: 48 },
|
|
633
|
+
SendTask: { minWidth: 80, minHeight: 48 },
|
|
634
|
+
CallActivity: { minWidth: 80, minHeight: 48 },
|
|
635
|
+
SubProcess: { minWidth: 160, minHeight: 100 },
|
|
636
|
+
Transaction: { minWidth: 160, minHeight: 100 },
|
|
637
|
+
EventSubProcess: { minWidth: 160, minHeight: 100 },
|
|
638
|
+
AdHocSubProcess: { minWidth: 160, minHeight: 100 },
|
|
639
|
+
Pool: { minWidth: 240, minHeight: 120 },
|
|
640
|
+
Lane: { minWidth: 240, minHeight: 80 },
|
|
641
|
+
Annotation: { minWidth: 80, minHeight: 40 },
|
|
642
|
+
Group: { minWidth: 120, minHeight: 80 },
|
|
643
|
+
SubConversation: { minWidth: 60, minHeight: 52 },
|
|
644
|
+
ChoreographyTask: { minWidth: 100, minHeight: 70 },
|
|
645
|
+
SubChoreography: { minWidth: 100, minHeight: 70 },
|
|
646
|
+
CallChoreography: { minWidth: 100, minHeight: 70 }
|
|
647
|
+
};
|
|
648
|
+
resizableTypes = new Set(BPMN_RESIZABLE_ELEMENT_TYPES);
|
|
649
|
+
}
|
|
650
|
+
});
|
|
638
651
|
|
|
639
652
|
// src/elements/guards.ts
|
|
640
|
-
var GATEWAY_TYPES = /* @__PURE__ */ new Set([
|
|
641
|
-
"ExclusiveGateway",
|
|
642
|
-
"InclusiveGateway",
|
|
643
|
-
"ParallelGateway",
|
|
644
|
-
"EventBasedGateway",
|
|
645
|
-
"ComplexGateway"
|
|
646
|
-
]);
|
|
647
|
-
var EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
648
|
-
"StartEvent",
|
|
649
|
-
"EndEvent",
|
|
650
|
-
"IntermediateCatchEvent",
|
|
651
|
-
"IntermediateThrowEvent",
|
|
652
|
-
"BoundaryEvent"
|
|
653
|
-
]);
|
|
654
|
-
var DATA_TYPES = /* @__PURE__ */ new Set([
|
|
655
|
-
"DataObject",
|
|
656
|
-
"DataObjectReference",
|
|
657
|
-
"DataInput",
|
|
658
|
-
"DataOutput",
|
|
659
|
-
"DataStore",
|
|
660
|
-
"DataStoreReference"
|
|
661
|
-
]);
|
|
662
653
|
function isGatewayType(type) {
|
|
663
654
|
return GATEWAY_TYPES.has(type);
|
|
664
655
|
}
|
|
@@ -674,45 +665,34 @@ function acceptsBoundaryEvents(type) {
|
|
|
674
665
|
function getHandlePolicy(type) {
|
|
675
666
|
return BPMN_ELEMENT_CATALOG[type].handlePolicy;
|
|
676
667
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
sourceCategories: ["flowNode", "data"],
|
|
704
|
-
targetCategories: ["flowNode", "data"],
|
|
705
|
-
allowSameParent: true,
|
|
706
|
-
allowDifferentParent: true
|
|
707
|
-
},
|
|
708
|
-
conversationLink: {
|
|
709
|
-
edgeType: "conversationLink",
|
|
710
|
-
sourceCategories: ["conversation", "flowNode"],
|
|
711
|
-
targetCategories: ["conversation", "flowNode"],
|
|
712
|
-
allowSameParent: true,
|
|
713
|
-
allowDifferentParent: true
|
|
668
|
+
var GATEWAY_TYPES, EVENT_TYPES, DATA_TYPES;
|
|
669
|
+
var init_guards = __esm({
|
|
670
|
+
"src/elements/guards.ts"() {
|
|
671
|
+
init_catalog();
|
|
672
|
+
GATEWAY_TYPES = /* @__PURE__ */ new Set([
|
|
673
|
+
"ExclusiveGateway",
|
|
674
|
+
"InclusiveGateway",
|
|
675
|
+
"ParallelGateway",
|
|
676
|
+
"EventBasedGateway",
|
|
677
|
+
"ComplexGateway"
|
|
678
|
+
]);
|
|
679
|
+
EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
680
|
+
"StartEvent",
|
|
681
|
+
"EndEvent",
|
|
682
|
+
"IntermediateCatchEvent",
|
|
683
|
+
"IntermediateThrowEvent",
|
|
684
|
+
"BoundaryEvent"
|
|
685
|
+
]);
|
|
686
|
+
DATA_TYPES = /* @__PURE__ */ new Set([
|
|
687
|
+
"DataObject",
|
|
688
|
+
"DataObjectReference",
|
|
689
|
+
"DataInput",
|
|
690
|
+
"DataOutput",
|
|
691
|
+
"DataStore",
|
|
692
|
+
"DataStoreReference"
|
|
693
|
+
]);
|
|
714
694
|
}
|
|
715
|
-
};
|
|
695
|
+
});
|
|
716
696
|
function inferBpmnEdgeType(state, sourceId, targetId) {
|
|
717
697
|
const source = diagramsCore.getNode(state, sourceId);
|
|
718
698
|
const target = diagramsCore.getNode(state, targetId);
|
|
@@ -807,82 +787,109 @@ function validateEdgeCardinality(state, edgeType, source, target) {
|
|
|
807
787
|
}
|
|
808
788
|
return true;
|
|
809
789
|
}
|
|
810
|
-
var bpmnConnectionValidators
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
790
|
+
var BPMN_EDGE_CONNECTION_RULES, bpmnConnectionValidators;
|
|
791
|
+
var init_modeling = __esm({
|
|
792
|
+
"src/modeling/index.ts"() {
|
|
793
|
+
init_catalog();
|
|
794
|
+
init_guards();
|
|
795
|
+
init_catalog();
|
|
796
|
+
BPMN_EDGE_CONNECTION_RULES = {
|
|
797
|
+
sequenceFlow: {
|
|
798
|
+
edgeType: "sequenceFlow",
|
|
799
|
+
sourceCategories: ["flowNode"],
|
|
800
|
+
targetCategories: ["flowNode"],
|
|
801
|
+
allowSameParent: true,
|
|
802
|
+
allowDifferentParent: false
|
|
803
|
+
},
|
|
804
|
+
messageFlow: {
|
|
805
|
+
edgeType: "messageFlow",
|
|
806
|
+
sourceCategories: ["flowNode"],
|
|
807
|
+
targetCategories: ["flowNode"],
|
|
808
|
+
allowSameParent: false,
|
|
809
|
+
allowDifferentParent: true
|
|
810
|
+
},
|
|
811
|
+
association: {
|
|
812
|
+
edgeType: "association",
|
|
813
|
+
sourceCategories: ["flowNode", "artifact", "data"],
|
|
814
|
+
targetCategories: ["flowNode", "artifact", "data"],
|
|
815
|
+
allowSameParent: true,
|
|
816
|
+
allowDifferentParent: true
|
|
817
|
+
},
|
|
818
|
+
dataAssociation: {
|
|
819
|
+
edgeType: "dataAssociation",
|
|
820
|
+
sourceCategories: ["flowNode", "data"],
|
|
821
|
+
targetCategories: ["flowNode", "data"],
|
|
822
|
+
allowSameParent: true,
|
|
823
|
+
allowDifferentParent: true
|
|
824
|
+
},
|
|
825
|
+
conversationLink: {
|
|
826
|
+
edgeType: "conversationLink",
|
|
827
|
+
sourceCategories: ["conversation", "flowNode"],
|
|
828
|
+
targetCategories: ["conversation", "flowNode"],
|
|
829
|
+
allowSameParent: true,
|
|
830
|
+
allowDifferentParent: true
|
|
844
831
|
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
832
|
+
};
|
|
833
|
+
bpmnConnectionValidators = [
|
|
834
|
+
({ state, source, target }) => {
|
|
835
|
+
if (source.id === target.id) return "BPMN self-connections are not allowed.";
|
|
836
|
+
const edgeType = inferBpmnEdgeType(state, source.id, target.id);
|
|
837
|
+
if (getHandlePolicy(source.data.elementType) === "none" || getHandlePolicy(target.data.elementType) === "none") {
|
|
838
|
+
return "Elements without BPMN connection handles cannot be directly connected.";
|
|
839
|
+
}
|
|
840
|
+
if (edgeType === "sequenceFlow") {
|
|
841
|
+
return validateBpmnConnectionForEdgeType(state, edgeType, source, target);
|
|
842
|
+
}
|
|
843
|
+
return validateBpmnConnectionForEdgeType(state, edgeType, source, target);
|
|
853
844
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
845
|
+
];
|
|
846
|
+
diagramsCore.createModelingRules({
|
|
847
|
+
connect: [
|
|
848
|
+
({ state, source, target }) => {
|
|
849
|
+
if (!source || !target) return false;
|
|
850
|
+
for (const validator of bpmnConnectionValidators) {
|
|
851
|
+
const result = validator({
|
|
852
|
+
state,
|
|
853
|
+
source,
|
|
854
|
+
target,
|
|
855
|
+
existingEdges: state.edges
|
|
856
|
+
});
|
|
857
|
+
if (result !== true) return result;
|
|
858
|
+
}
|
|
859
|
+
return true;
|
|
860
|
+
}
|
|
861
|
+
],
|
|
862
|
+
drop: [
|
|
863
|
+
({ node, parent }) => {
|
|
864
|
+
if (!node || !parent) return true;
|
|
865
|
+
if (node.data.elementType === "BoundaryEvent") {
|
|
866
|
+
return acceptsBoundaryEvents(parent.data.elementType) ? true : "Boundary events can only be attached to tasks or subprocesses.";
|
|
867
|
+
}
|
|
868
|
+
return canContainBpmnElement(parent.data.elementType, node.data.elementType);
|
|
869
|
+
}
|
|
870
|
+
],
|
|
871
|
+
reparent: [
|
|
872
|
+
({ node, parent }) => {
|
|
873
|
+
if (!node || !parent) return true;
|
|
874
|
+
if (node.data.elementType === "BoundaryEvent") {
|
|
875
|
+
return acceptsBoundaryEvents(parent.data.elementType) ? true : "Boundary events can only be reparented to tasks or subprocesses.";
|
|
876
|
+
}
|
|
877
|
+
return canContainBpmnElement(parent?.data.elementType, node.data.elementType);
|
|
878
|
+
}
|
|
879
|
+
],
|
|
880
|
+
delete: [() => true],
|
|
881
|
+
resize: [
|
|
882
|
+
({ node }) => !node || isBpmnElementResizable(node.data.elementType) ? true : `${node.data.elementType} is not resizable in BPMN.`
|
|
883
|
+
]
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
// src/layout/elk.ts
|
|
889
|
+
var elk_exports = {};
|
|
890
|
+
__export(elk_exports, {
|
|
891
|
+
bpmnElkLayout: () => bpmnElkLayout
|
|
861
892
|
});
|
|
862
|
-
var BPMN_CONTAINER_TYPES = /* @__PURE__ */ new Set([
|
|
863
|
-
"Pool",
|
|
864
|
-
"Lane",
|
|
865
|
-
"SubProcess",
|
|
866
|
-
"Transaction",
|
|
867
|
-
"EventSubProcess",
|
|
868
|
-
"AdHocSubProcess"
|
|
869
|
-
]);
|
|
870
|
-
var CONTAINER_MIN_SIZE = {
|
|
871
|
-
Pool: { w: 560, h: 160 },
|
|
872
|
-
Lane: { w: 480, h: 100 },
|
|
873
|
-
SubProcess: { w: 200, h: 120 },
|
|
874
|
-
Transaction: { w: 200, h: 120 },
|
|
875
|
-
EventSubProcess: { w: 200, h: 120 },
|
|
876
|
-
AdHocSubProcess: { w: 200, h: 120 }
|
|
877
|
-
};
|
|
878
|
-
var CONTAINER_PADDING = {
|
|
879
|
-
Pool: "[top=30,left=55,bottom=30,right=40]",
|
|
880
|
-
Lane: "[top=25,left=60,bottom=25,right=40]",
|
|
881
|
-
SubProcess: "[top=25,left=35,bottom=25,right=35]",
|
|
882
|
-
Transaction: "[top=25,left=35,bottom=25,right=35]",
|
|
883
|
-
EventSubProcess: "[top=25,left=35,bottom=25,right=35]",
|
|
884
|
-
AdHocSubProcess: "[top=25,left=35,bottom=25,right=35]"
|
|
885
|
-
};
|
|
886
893
|
async function bpmnElkLayout(nodes, edges) {
|
|
887
894
|
const poolsWithLanes = /* @__PURE__ */ new Set();
|
|
888
895
|
for (const node of nodes) {
|
|
@@ -902,13 +909,26 @@ async function bpmnElkLayout(nodes, edges) {
|
|
|
902
909
|
},
|
|
903
910
|
isContainerNode: (node) => BPMN_CONTAINER_TYPES.has(node.data.elementType),
|
|
904
911
|
getNodeLayoutOptions: (node) => {
|
|
905
|
-
const
|
|
912
|
+
const bNode = node;
|
|
913
|
+
const type = bNode.data.elementType;
|
|
906
914
|
if (!BPMN_CONTAINER_TYPES.has(type)) return void 0;
|
|
907
915
|
const min = CONTAINER_MIN_SIZE[type];
|
|
908
|
-
const
|
|
916
|
+
const isPoolWithLanes = type === "Pool" && poolsWithLanes.has(node.id);
|
|
917
|
+
const dir = isPoolWithLanes ? "DOWN" : "RIGHT";
|
|
909
918
|
return {
|
|
910
919
|
"elk.direction": dir,
|
|
911
920
|
"elk.nodeSize.constraints": "MINIMUM_SIZE",
|
|
921
|
+
// Each container handles its own layout pass so cross-lane edges
|
|
922
|
+
// participate in the internal layout without the global direction
|
|
923
|
+
// forcing Lane containers to align sideways.
|
|
924
|
+
"elk.hierarchyHandling": "INCLUDE_CHILDREN",
|
|
925
|
+
// Lanes within a Pool share a border — zero gap between them.
|
|
926
|
+
// Other containers keep the tighter inner spacing.
|
|
927
|
+
...isPoolWithLanes ? { "elk.spacing.nodeNode": "0", "elk.spacing.componentComponent": "0" } : {
|
|
928
|
+
"elk.layered.spacing.nodeNodeBetweenLayers": "100",
|
|
929
|
+
"elk.layered.spacing.edgeNodeBetweenLayers": "45",
|
|
930
|
+
"elk.spacing.nodeNode": "50"
|
|
931
|
+
},
|
|
912
932
|
...min ? { "elk.nodeSize.minimum": `[w=${min.w},h=${min.h}]` } : {},
|
|
913
933
|
...CONTAINER_PADDING[type] ? { "elk.padding": CONTAINER_PADDING[type] } : {}
|
|
914
934
|
};
|
|
@@ -916,27 +936,84 @@ async function bpmnElkLayout(nodes, edges) {
|
|
|
916
936
|
elk: {
|
|
917
937
|
"elk.algorithm": "layered",
|
|
918
938
|
"elk.direction": "RIGHT",
|
|
919
|
-
|
|
939
|
+
// INHERIT: each container handles its own INCLUDE_CHILDREN pass so
|
|
940
|
+
// the global RIGHT direction does not force Lane containers sideways.
|
|
941
|
+
"elk.hierarchyHandling": "INHERIT",
|
|
920
942
|
"elk.edgeRouting": "ORTHOGONAL",
|
|
921
|
-
|
|
922
|
-
"elk.layered.spacing.
|
|
923
|
-
"elk.spacing.
|
|
924
|
-
"elk.spacing.
|
|
943
|
+
// Global spacing — generous values for visual breathing room.
|
|
944
|
+
"elk.layered.spacing.nodeNodeBetweenLayers": "120",
|
|
945
|
+
"elk.layered.spacing.edgeNodeBetweenLayers": "50",
|
|
946
|
+
"elk.spacing.nodeNode": "70",
|
|
947
|
+
"elk.spacing.componentComponent": "100"
|
|
925
948
|
}
|
|
926
949
|
}
|
|
927
950
|
);
|
|
928
951
|
const nodeMap = new Map(result.nodes.map((n) => [n.id, n]));
|
|
929
952
|
const edgeMap = new Map(result.edges.map((e) => [e.id, e]));
|
|
953
|
+
const COMPONENT_GAP = 100;
|
|
954
|
+
const rootNodeOrder = nodes.filter((n) => !n.parentId).map((n) => n.id);
|
|
955
|
+
const rootHeights = /* @__PURE__ */ new Map();
|
|
956
|
+
for (const id of rootNodeOrder) {
|
|
957
|
+
const laid = nodeMap.get(id);
|
|
958
|
+
const orig = nodes.find((n) => n.id === id);
|
|
959
|
+
rootHeights.set(id, laid?.height ?? orig?.height ?? 200);
|
|
960
|
+
}
|
|
961
|
+
let stackY = 0;
|
|
962
|
+
const rootY = /* @__PURE__ */ new Map();
|
|
963
|
+
for (const id of rootNodeOrder) {
|
|
964
|
+
rootY.set(id, stackY);
|
|
965
|
+
stackY += (rootHeights.get(id) ?? 200) + COMPONENT_GAP;
|
|
966
|
+
}
|
|
930
967
|
const updatedNodes = nodes.map((node) => {
|
|
931
968
|
const laid = nodeMap.get(node.id);
|
|
932
969
|
if (!laid) return node;
|
|
933
|
-
|
|
970
|
+
const pos = node.parentId ? laid.position : { x: laid.position.x, y: rootY.get(node.id) ?? laid.position.y };
|
|
971
|
+
return { ...node, position: pos, width: laid.width, height: laid.height };
|
|
934
972
|
});
|
|
973
|
+
const lanesByPool = /* @__PURE__ */ new Map();
|
|
974
|
+
for (const node of updatedNodes) {
|
|
975
|
+
if (node.data.elementType === "Lane" && node.parentId) {
|
|
976
|
+
const arr = lanesByPool.get(node.parentId) ?? [];
|
|
977
|
+
arr.push(node.id);
|
|
978
|
+
lanesByPool.set(node.parentId, arr);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
const nodeIndex = new Map(updatedNodes.map((n, i) => [n.id, i]));
|
|
982
|
+
for (const laneIds of lanesByPool.values()) {
|
|
983
|
+
const widths = laneIds.map((id) => updatedNodes[nodeIndex.get(id)]?.width ?? 0);
|
|
984
|
+
const maxWidth = Math.max(...widths);
|
|
985
|
+
if (maxWidth <= 0) continue;
|
|
986
|
+
for (const id of laneIds) {
|
|
987
|
+
const idx = nodeIndex.get(id);
|
|
988
|
+
if (idx !== void 0) {
|
|
989
|
+
updatedNodes[idx] = { ...updatedNodes[idx], width: maxWidth };
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
const nodeRootContainer = /* @__PURE__ */ new Map();
|
|
994
|
+
for (const node of updatedNodes) {
|
|
995
|
+
nodeRootContainer.set(node.id, node.parentId ?? null);
|
|
996
|
+
}
|
|
997
|
+
const getRootContainer = (nodeId) => {
|
|
998
|
+
let current = nodeId;
|
|
999
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1000
|
+
while (current) {
|
|
1001
|
+
if (visited.has(current)) break;
|
|
1002
|
+
visited.add(current);
|
|
1003
|
+
const parent = nodeRootContainer.get(current);
|
|
1004
|
+
if (!parent) return current;
|
|
1005
|
+
current = parent;
|
|
1006
|
+
}
|
|
1007
|
+
return null;
|
|
1008
|
+
};
|
|
935
1009
|
const updatedEdges = edges.map((edge) => {
|
|
936
1010
|
const laid = edgeMap.get(edge.id);
|
|
937
1011
|
if (!laid) return edge;
|
|
938
1012
|
const nextData = { ...edge.data };
|
|
939
|
-
|
|
1013
|
+
const sourceRoot = getRootContainer(edge.source);
|
|
1014
|
+
const targetRoot = getRootContainer(edge.target);
|
|
1015
|
+
const isCrossPool = sourceRoot !== targetRoot;
|
|
1016
|
+
if (!isCrossPool && laid.points && laid.points.length > 0) {
|
|
940
1017
|
nextData.routingPoints = laid.points;
|
|
941
1018
|
} else {
|
|
942
1019
|
delete nextData.routingPoints;
|
|
@@ -945,6 +1022,601 @@ async function bpmnElkLayout(nodes, edges) {
|
|
|
945
1022
|
});
|
|
946
1023
|
return { nodes: updatedNodes, edges: updatedEdges };
|
|
947
1024
|
}
|
|
1025
|
+
var BPMN_CONTAINER_TYPES, CONTAINER_MIN_SIZE, CONTAINER_PADDING;
|
|
1026
|
+
var init_elk = __esm({
|
|
1027
|
+
"src/layout/elk.ts"() {
|
|
1028
|
+
init_modeling();
|
|
1029
|
+
BPMN_CONTAINER_TYPES = /* @__PURE__ */ new Set([
|
|
1030
|
+
"Pool",
|
|
1031
|
+
"Lane",
|
|
1032
|
+
"SubProcess",
|
|
1033
|
+
"Transaction",
|
|
1034
|
+
"EventSubProcess",
|
|
1035
|
+
"AdHocSubProcess"
|
|
1036
|
+
]);
|
|
1037
|
+
CONTAINER_MIN_SIZE = {
|
|
1038
|
+
Pool: { w: 720, h: 200 },
|
|
1039
|
+
Lane: { w: 600, h: 160 },
|
|
1040
|
+
SubProcess: { w: 240, h: 140 },
|
|
1041
|
+
Transaction: { w: 240, h: 140 },
|
|
1042
|
+
EventSubProcess: { w: 240, h: 140 },
|
|
1043
|
+
AdHocSubProcess: { w: 240, h: 140 }
|
|
1044
|
+
};
|
|
1045
|
+
CONTAINER_PADDING = {
|
|
1046
|
+
Pool: "[top=30,left=60,bottom=30,right=50]",
|
|
1047
|
+
Lane: "[top=40,left=70,bottom=40,right=50]",
|
|
1048
|
+
SubProcess: "[top=30,left=40,bottom=30,right=40]",
|
|
1049
|
+
Transaction: "[top=30,left=40,bottom=30,right=40]",
|
|
1050
|
+
EventSubProcess: "[top=30,left=40,bottom=30,right=40]",
|
|
1051
|
+
AdHocSubProcess: "[top=30,left=40,bottom=30,right=40]"
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
|
|
1056
|
+
// src/layout/index.ts
|
|
1057
|
+
init_modeling();
|
|
1058
|
+
init_elk();
|
|
1059
|
+
|
|
1060
|
+
// src/layout/bpmn-layout-graph.ts
|
|
1061
|
+
var LAYOUT_CONTAINER_TYPES = /* @__PURE__ */ new Set([
|
|
1062
|
+
"Pool",
|
|
1063
|
+
"Lane",
|
|
1064
|
+
"SubProcess",
|
|
1065
|
+
"Transaction",
|
|
1066
|
+
"EventSubProcess",
|
|
1067
|
+
"AdHocSubProcess"
|
|
1068
|
+
]);
|
|
1069
|
+
var LAYOUT_GATEWAY_TYPES = /* @__PURE__ */ new Set([
|
|
1070
|
+
"ExclusiveGateway",
|
|
1071
|
+
"InclusiveGateway",
|
|
1072
|
+
"ParallelGateway",
|
|
1073
|
+
"EventBasedGateway",
|
|
1074
|
+
"ComplexGateway"
|
|
1075
|
+
]);
|
|
1076
|
+
function detectBackEdges(nodeIds, seqEdges) {
|
|
1077
|
+
const backEdgeIds = /* @__PURE__ */ new Set();
|
|
1078
|
+
const state = /* @__PURE__ */ new Map();
|
|
1079
|
+
for (const id of nodeIds) state.set(id, 0);
|
|
1080
|
+
const adj = /* @__PURE__ */ new Map();
|
|
1081
|
+
for (const id of nodeIds) adj.set(id, []);
|
|
1082
|
+
for (const e of seqEdges) {
|
|
1083
|
+
adj.get(e.source)?.push({ target: e.target, edgeId: e.id });
|
|
1084
|
+
}
|
|
1085
|
+
for (const startId of nodeIds) {
|
|
1086
|
+
if (state.get(startId) !== 0) continue;
|
|
1087
|
+
const stack = [{ id: startId, idx: 0 }];
|
|
1088
|
+
state.set(startId, 1);
|
|
1089
|
+
while (stack.length > 0) {
|
|
1090
|
+
const top = stack[stack.length - 1];
|
|
1091
|
+
const neighbors = adj.get(top.id) ?? [];
|
|
1092
|
+
if (top.idx >= neighbors.length) {
|
|
1093
|
+
state.set(top.id, 2);
|
|
1094
|
+
stack.pop();
|
|
1095
|
+
continue;
|
|
1096
|
+
}
|
|
1097
|
+
const { target, edgeId } = neighbors[top.idx++];
|
|
1098
|
+
const tState = state.get(target);
|
|
1099
|
+
if (tState === 1) {
|
|
1100
|
+
backEdgeIds.add(edgeId);
|
|
1101
|
+
} else if (tState === 0) {
|
|
1102
|
+
state.set(target, 1);
|
|
1103
|
+
stack.push({ id: target, idx: 0 });
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
return backEdgeIds;
|
|
1108
|
+
}
|
|
1109
|
+
function extractSeqEdges(edges, nodeIds) {
|
|
1110
|
+
return edges.filter((e) => {
|
|
1111
|
+
const t = e.data?.edgeType ?? e.type;
|
|
1112
|
+
return t === "sequenceFlow" && nodeIds.has(e.source) && nodeIds.has(e.target);
|
|
1113
|
+
}).map((e) => ({ id: e.id, source: e.source, target: e.target, sourceHandle: e.sourceHandle ?? null }));
|
|
1114
|
+
}
|
|
1115
|
+
function topologicalSort(nodeIds, forwardEdges) {
|
|
1116
|
+
const inDeg = new Map(nodeIds.map((id) => [id, 0]));
|
|
1117
|
+
const adj = new Map(nodeIds.map((id) => [id, []]));
|
|
1118
|
+
for (const e of forwardEdges) {
|
|
1119
|
+
if (!inDeg.has(e.source) || !inDeg.has(e.target)) continue;
|
|
1120
|
+
adj.get(e.source).push(e.target);
|
|
1121
|
+
inDeg.set(e.target, (inDeg.get(e.target) ?? 0) + 1);
|
|
1122
|
+
}
|
|
1123
|
+
const queue = nodeIds.filter((id) => (inDeg.get(id) ?? 0) === 0);
|
|
1124
|
+
const result = [];
|
|
1125
|
+
while (queue.length > 0) {
|
|
1126
|
+
const id = queue.shift();
|
|
1127
|
+
result.push(id);
|
|
1128
|
+
for (const next of adj.get(id) ?? []) {
|
|
1129
|
+
const d = (inDeg.get(next) ?? 1) - 1;
|
|
1130
|
+
inDeg.set(next, d);
|
|
1131
|
+
if (d === 0) queue.push(next);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
const seen = new Set(result);
|
|
1135
|
+
for (const id of nodeIds) {
|
|
1136
|
+
if (!seen.has(id)) result.push(id);
|
|
1137
|
+
}
|
|
1138
|
+
return result;
|
|
1139
|
+
}
|
|
1140
|
+
function assignColumns(nodeIds, forwardEdges) {
|
|
1141
|
+
const order = topologicalSort(nodeIds, forwardEdges);
|
|
1142
|
+
const col = new Map(nodeIds.map((id) => [id, 0]));
|
|
1143
|
+
const preds = new Map(nodeIds.map((id) => [id, []]));
|
|
1144
|
+
for (const e of forwardEdges) {
|
|
1145
|
+
preds.get(e.target)?.push(e.source);
|
|
1146
|
+
}
|
|
1147
|
+
for (const id of order) {
|
|
1148
|
+
const predCols = (preds.get(id) ?? []).map((p) => col.get(p) ?? 0);
|
|
1149
|
+
col.set(id, predCols.length > 0 ? Math.max(...predCols) + 1 : 0);
|
|
1150
|
+
}
|
|
1151
|
+
return col;
|
|
1152
|
+
}
|
|
1153
|
+
function detectGatewayPairs(nodes, forwardEdges) {
|
|
1154
|
+
const pairs = /* @__PURE__ */ new Map();
|
|
1155
|
+
const nodeIds = nodes.map((n) => n.id);
|
|
1156
|
+
const succs = new Map(nodes.map((n) => [n.id, []]));
|
|
1157
|
+
for (const e of forwardEdges) {
|
|
1158
|
+
succs.get(e.source)?.push(e.target);
|
|
1159
|
+
}
|
|
1160
|
+
const order = topologicalSort(nodeIds, forwardEdges);
|
|
1161
|
+
const topoPos = new Map(order.map((id, i) => [id, i]));
|
|
1162
|
+
const splits = nodes.filter(
|
|
1163
|
+
(n) => LAYOUT_GATEWAY_TYPES.has(n.data.elementType) && (succs.get(n.id)?.length ?? 0) > 1
|
|
1164
|
+
);
|
|
1165
|
+
for (const split of splits) {
|
|
1166
|
+
const branches = succs.get(split.id) ?? [];
|
|
1167
|
+
if (branches.length < 2) continue;
|
|
1168
|
+
const branchSets = branches.map((start) => {
|
|
1169
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1170
|
+
const q = [start];
|
|
1171
|
+
while (q.length) {
|
|
1172
|
+
const curr = q.shift();
|
|
1173
|
+
if (visited.has(curr)) continue;
|
|
1174
|
+
visited.add(curr);
|
|
1175
|
+
for (const next of succs.get(curr) ?? []) q.push(next);
|
|
1176
|
+
}
|
|
1177
|
+
return visited;
|
|
1178
|
+
});
|
|
1179
|
+
const common = [...branchSets[0]].filter(
|
|
1180
|
+
(id) => branchSets.every((s) => s.has(id))
|
|
1181
|
+
);
|
|
1182
|
+
if (common.length === 0) continue;
|
|
1183
|
+
const merge = common.reduce(
|
|
1184
|
+
(a, b) => (topoPos.get(a) ?? Infinity) < (topoPos.get(b) ?? Infinity) ? a : b
|
|
1185
|
+
);
|
|
1186
|
+
pairs.set(split.id, merge);
|
|
1187
|
+
}
|
|
1188
|
+
return pairs;
|
|
1189
|
+
}
|
|
1190
|
+
function handleToRowBias(handle) {
|
|
1191
|
+
if (!handle) return null;
|
|
1192
|
+
if (handle.includes("top")) return -1;
|
|
1193
|
+
if (handle.includes("bottom")) return 1;
|
|
1194
|
+
if (handle.includes("right")) return 0;
|
|
1195
|
+
return null;
|
|
1196
|
+
}
|
|
1197
|
+
function buildHandleMap(edges) {
|
|
1198
|
+
const map = /* @__PURE__ */ new Map();
|
|
1199
|
+
for (const e of edges) {
|
|
1200
|
+
if (!map.has(e.source)) map.set(e.source, /* @__PURE__ */ new Map());
|
|
1201
|
+
map.get(e.source).set(e.target, e.sourceHandle ?? null);
|
|
1202
|
+
}
|
|
1203
|
+
return map;
|
|
1204
|
+
}
|
|
1205
|
+
function assignRows(nodes, forwardEdges, columns, gatewayPairs) {
|
|
1206
|
+
const rows = new Map(nodes.map((n) => [n.id, 0]));
|
|
1207
|
+
const succs = new Map(nodes.map((n) => [n.id, []]));
|
|
1208
|
+
for (const e of forwardEdges) {
|
|
1209
|
+
succs.get(e.source)?.push(e.target);
|
|
1210
|
+
}
|
|
1211
|
+
const handleMap = buildHandleMap(forwardEdges);
|
|
1212
|
+
const sortedPairs = [...gatewayPairs.entries()].sort(
|
|
1213
|
+
(a, b) => (columns.get(b[0]) ?? 0) - (columns.get(a[0]) ?? 0)
|
|
1214
|
+
);
|
|
1215
|
+
for (const [splitId, mergeId] of sortedPairs) {
|
|
1216
|
+
const branches = succs.get(splitId) ?? [];
|
|
1217
|
+
if (branches.length < 2) continue;
|
|
1218
|
+
const splitRow = rows.get(splitId) ?? 0;
|
|
1219
|
+
const getBranchNodes = (branchStart) => {
|
|
1220
|
+
const result = [];
|
|
1221
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1222
|
+
const q = [branchStart];
|
|
1223
|
+
while (q.length) {
|
|
1224
|
+
const curr = q.shift();
|
|
1225
|
+
if (visited.has(curr) || curr === mergeId) continue;
|
|
1226
|
+
visited.add(curr);
|
|
1227
|
+
result.push(curr);
|
|
1228
|
+
for (const next of succs.get(curr) ?? []) q.push(next);
|
|
1229
|
+
}
|
|
1230
|
+
return result;
|
|
1231
|
+
};
|
|
1232
|
+
const splitHandles = handleMap.get(splitId);
|
|
1233
|
+
const branchData = branches.map((start) => ({
|
|
1234
|
+
start,
|
|
1235
|
+
nodeIds: getBranchNodes(start),
|
|
1236
|
+
bias: handleToRowBias(splitHandles?.get(start) ?? null)
|
|
1237
|
+
}));
|
|
1238
|
+
const withBias = branchData.filter((b) => b.bias !== null && b.bias !== 0);
|
|
1239
|
+
const withoutBias = branchData.filter((b) => b.bias === null || b.bias === 0).sort((a, b) => b.nodeIds.length - a.nodeIds.length);
|
|
1240
|
+
const assigned = /* @__PURE__ */ new Map();
|
|
1241
|
+
for (const b of withBias) {
|
|
1242
|
+
assigned.set(b.start, splitRow + b.bias);
|
|
1243
|
+
}
|
|
1244
|
+
let nextOffset = 0;
|
|
1245
|
+
for (const b of withoutBias) {
|
|
1246
|
+
while ([...assigned.values()].includes(splitRow + nextOffset)) nextOffset++;
|
|
1247
|
+
assigned.set(b.start, splitRow + nextOffset);
|
|
1248
|
+
nextOffset++;
|
|
1249
|
+
}
|
|
1250
|
+
for (const b of branchData) {
|
|
1251
|
+
const row = assigned.get(b.start) ?? splitRow;
|
|
1252
|
+
for (const id of b.nodeIds) {
|
|
1253
|
+
rows.set(id, row);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
const pairedSplits = new Set(gatewayPairs.keys());
|
|
1258
|
+
const unpairedSplits = nodes.filter(
|
|
1259
|
+
(n) => LAYOUT_GATEWAY_TYPES.has(n.data.elementType) && !pairedSplits.has(n.id) && (succs.get(n.id)?.length ?? 0) > 1
|
|
1260
|
+
);
|
|
1261
|
+
for (const split of unpairedSplits) {
|
|
1262
|
+
const branches = succs.get(split.id) ?? [];
|
|
1263
|
+
if (branches.length < 2) continue;
|
|
1264
|
+
const splitRow = rows.get(split.id) ?? 0;
|
|
1265
|
+
const getAllReachable = (start) => {
|
|
1266
|
+
const result = [];
|
|
1267
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1268
|
+
const q = [start];
|
|
1269
|
+
while (q.length) {
|
|
1270
|
+
const curr = q.shift();
|
|
1271
|
+
if (visited.has(curr)) continue;
|
|
1272
|
+
visited.add(curr);
|
|
1273
|
+
result.push(curr);
|
|
1274
|
+
for (const next of succs.get(curr) ?? []) q.push(next);
|
|
1275
|
+
}
|
|
1276
|
+
return result;
|
|
1277
|
+
};
|
|
1278
|
+
const splitHandles2 = handleMap.get(split.id);
|
|
1279
|
+
const branchData = branches.map((start) => ({
|
|
1280
|
+
start,
|
|
1281
|
+
nodeIds: getAllReachable(start),
|
|
1282
|
+
bias: handleToRowBias(splitHandles2?.get(start) ?? null)
|
|
1283
|
+
}));
|
|
1284
|
+
const withBias2 = branchData.filter((b) => b.bias !== null && b.bias !== 0);
|
|
1285
|
+
const withoutBias2 = branchData.filter((b) => b.bias === null || b.bias === 0).sort((a, b) => b.nodeIds.length - a.nodeIds.length);
|
|
1286
|
+
const assigned2 = /* @__PURE__ */ new Map();
|
|
1287
|
+
for (const b of withBias2) assigned2.set(b.start, splitRow + b.bias);
|
|
1288
|
+
let nextOff = 0;
|
|
1289
|
+
for (const b of withoutBias2) {
|
|
1290
|
+
while ([...assigned2.values()].includes(splitRow + nextOff)) nextOff++;
|
|
1291
|
+
assigned2.set(b.start, splitRow + nextOff);
|
|
1292
|
+
nextOff++;
|
|
1293
|
+
}
|
|
1294
|
+
for (const b of branchData) {
|
|
1295
|
+
const row = assigned2.get(b.start) ?? splitRow;
|
|
1296
|
+
for (const id of b.nodeIds) rows.set(id, row);
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
return rows;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
// src/layout/bpmn-custom-layout.ts
|
|
1303
|
+
var LANE_LABEL_W = 28;
|
|
1304
|
+
var LANE_H_PAD = 20;
|
|
1305
|
+
var COL_GAP = 80;
|
|
1306
|
+
var ROW_HEIGHT = 80;
|
|
1307
|
+
var ROW_GAP = 60;
|
|
1308
|
+
var LANE_V_PAD = 50;
|
|
1309
|
+
var POOL_H_PAD = 60;
|
|
1310
|
+
var POOL_V_GAP = 50;
|
|
1311
|
+
var LANE_MIN_H = 160;
|
|
1312
|
+
var POOL_MIN_W = 720;
|
|
1313
|
+
var POOL_INNER_PAD = 8;
|
|
1314
|
+
function nW(node) {
|
|
1315
|
+
return node.width ?? node.measured?.width ?? 120;
|
|
1316
|
+
}
|
|
1317
|
+
function nH(node) {
|
|
1318
|
+
return node.height ?? node.measured?.height ?? 60;
|
|
1319
|
+
}
|
|
1320
|
+
function layoutPool(pool, lanes, content, allEdges) {
|
|
1321
|
+
if (content.length === 0) {
|
|
1322
|
+
if (lanes.length === 0) {
|
|
1323
|
+
return { nodes: [], width: 240, height: 120 };
|
|
1324
|
+
}
|
|
1325
|
+
const laneH = LANE_MIN_H;
|
|
1326
|
+
const h = POOL_INNER_PAD * 2 + lanes.length * laneH + Math.max(0, lanes.length - 1) * POOL_INNER_PAD;
|
|
1327
|
+
const w = POOL_MIN_W;
|
|
1328
|
+
return {
|
|
1329
|
+
nodes: lanes.map((lane, i) => ({
|
|
1330
|
+
...lane,
|
|
1331
|
+
position: { x: POOL_INNER_PAD, y: POOL_INNER_PAD + i * (laneH + POOL_INNER_PAD) },
|
|
1332
|
+
width: w - POOL_INNER_PAD * 2,
|
|
1333
|
+
height: laneH
|
|
1334
|
+
})),
|
|
1335
|
+
width: w,
|
|
1336
|
+
height: h
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
const contentIds = new Set(content.map((n) => n.id));
|
|
1340
|
+
const seqEdges = extractSeqEdges(allEdges, contentIds);
|
|
1341
|
+
const backIds = detectBackEdges([...contentIds], seqEdges);
|
|
1342
|
+
const fwdEdges = seqEdges.filter((e) => !backIds.has(e.id));
|
|
1343
|
+
const columns = assignColumns([...contentIds], fwdEdges);
|
|
1344
|
+
const pairs = detectGatewayPairs(content, fwdEdges);
|
|
1345
|
+
const rows = assignRows(content, fwdEdges, columns, pairs);
|
|
1346
|
+
const lanePositionsDistinct = lanes.some((l) => Math.abs(l.position.y) > 10);
|
|
1347
|
+
const sortedLanes = lanePositionsDistinct ? [...lanes].sort((a, b) => a.position.y - b.position.y) : [...lanes];
|
|
1348
|
+
const hasLanes = sortedLanes.length > 0;
|
|
1349
|
+
const nodeLaneId = /* @__PURE__ */ new Map();
|
|
1350
|
+
for (const node of content) {
|
|
1351
|
+
if (hasLanes && node.parentId && node.parentId !== pool.id) {
|
|
1352
|
+
nodeLaneId.set(node.id, node.parentId);
|
|
1353
|
+
} else {
|
|
1354
|
+
nodeLaneId.set(node.id, "_pool_");
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
const laneIds = hasLanes ? sortedLanes.map((l) => l.id) : ["_pool_"];
|
|
1358
|
+
const laneStats = /* @__PURE__ */ new Map();
|
|
1359
|
+
for (const laneId of laneIds) {
|
|
1360
|
+
const laneRows = content.filter((n) => nodeLaneId.get(n.id) === laneId).map((n) => rows.get(n.id) ?? 0);
|
|
1361
|
+
if (laneRows.length === 0) {
|
|
1362
|
+
laneStats.set(laneId, { minRow: 0, maxRow: 0, rowCount: 1, height: LANE_MIN_H });
|
|
1363
|
+
} else {
|
|
1364
|
+
const minRow = Math.min(...laneRows);
|
|
1365
|
+
const maxRow = Math.max(...laneRows);
|
|
1366
|
+
const rowCount = maxRow - minRow + 1;
|
|
1367
|
+
const contentH = rowCount * ROW_HEIGHT + Math.max(0, rowCount - 1) * ROW_GAP;
|
|
1368
|
+
const height = Math.max(LANE_MIN_H, LANE_V_PAD * 2 + contentH);
|
|
1369
|
+
laneStats.set(laneId, { minRow, maxRow, rowCount, height });
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
const maxCol = Math.max(0, ...[...columns.values()]);
|
|
1373
|
+
const colW = /* @__PURE__ */ new Map();
|
|
1374
|
+
for (let c = 0; c <= maxCol; c++) colW.set(c, 0);
|
|
1375
|
+
for (const node of content) {
|
|
1376
|
+
const c = columns.get(node.id) ?? 0;
|
|
1377
|
+
colW.set(c, Math.max(colW.get(c) ?? 0, nW(node)));
|
|
1378
|
+
}
|
|
1379
|
+
const colX = /* @__PURE__ */ new Map();
|
|
1380
|
+
let cumX = 0;
|
|
1381
|
+
for (let c = 0; c <= maxCol; c++) {
|
|
1382
|
+
colX.set(c, cumX);
|
|
1383
|
+
cumX += (colW.get(c) ?? 120) + COL_GAP;
|
|
1384
|
+
}
|
|
1385
|
+
const contentW = cumX - COL_GAP;
|
|
1386
|
+
const innerW = LANE_LABEL_W + LANE_H_PAD + contentW + LANE_H_PAD;
|
|
1387
|
+
const poolW = Math.max(POOL_MIN_W, innerW + POOL_INNER_PAD * 2);
|
|
1388
|
+
const laneW = poolW - POOL_INNER_PAD * 2;
|
|
1389
|
+
const laneY = /* @__PURE__ */ new Map();
|
|
1390
|
+
let cumY = POOL_INNER_PAD;
|
|
1391
|
+
for (let i = 0; i < laneIds.length; i++) {
|
|
1392
|
+
const laneId = laneIds[i];
|
|
1393
|
+
laneY.set(laneId, cumY);
|
|
1394
|
+
cumY += laneStats.get(laneId)?.height ?? LANE_MIN_H;
|
|
1395
|
+
if (i < laneIds.length - 1) cumY += POOL_INNER_PAD;
|
|
1396
|
+
}
|
|
1397
|
+
const poolH = cumY + POOL_INNER_PAD;
|
|
1398
|
+
const positionedContent = content.map((node) => {
|
|
1399
|
+
const c = columns.get(node.id) ?? 0;
|
|
1400
|
+
const r = rows.get(node.id) ?? 0;
|
|
1401
|
+
const laneId = nodeLaneId.get(node.id) ?? "_pool_";
|
|
1402
|
+
const stat = laneStats.get(laneId);
|
|
1403
|
+
const lYOff = laneY.get(laneId) ?? 0;
|
|
1404
|
+
const colOffset = (colX.get(c) ?? 0) + (colW.get(c) ?? 120) / 2 - nW(node) / 2;
|
|
1405
|
+
const rowOffset = (r - stat.minRow) * (ROW_HEIGHT + ROW_GAP) + ROW_HEIGHT / 2 - nH(node) / 2;
|
|
1406
|
+
const isLaneChild = hasLanes && !!node.parentId && node.parentId !== pool.id;
|
|
1407
|
+
const contentH_stat = stat.rowCount * ROW_HEIGHT + Math.max(0, stat.rowCount - 1) * ROW_GAP;
|
|
1408
|
+
const vertTopOffset = Math.max(LANE_V_PAD, (stat.height - contentH_stat) / 2);
|
|
1409
|
+
const x = isLaneChild ? LANE_LABEL_W + LANE_H_PAD + colOffset : POOL_H_PAD + colOffset;
|
|
1410
|
+
const y = isLaneChild ? vertTopOffset + rowOffset : lYOff + vertTopOffset + rowOffset;
|
|
1411
|
+
return { ...node, position: { x, y } };
|
|
1412
|
+
});
|
|
1413
|
+
const NODE_MIN_GAP = 20;
|
|
1414
|
+
const resolvedContent = [...positionedContent];
|
|
1415
|
+
for (const laneId of laneIds) {
|
|
1416
|
+
const laneNodeIndices = resolvedContent.map((n, i) => ({ n, i })).filter(({ n }) => (nodeLaneId.get(n.id) ?? "_pool_") === laneId).sort((a, b) => a.n.position.x - b.n.position.x);
|
|
1417
|
+
for (let k = 1; k < laneNodeIndices.length; k++) {
|
|
1418
|
+
const prev = resolvedContent[laneNodeIndices[k - 1].i];
|
|
1419
|
+
const curr = resolvedContent[laneNodeIndices[k].i];
|
|
1420
|
+
const prevBottom = prev.position.y + nH(prev);
|
|
1421
|
+
const currTop = curr.position.y;
|
|
1422
|
+
const prevTop = prev.position.y;
|
|
1423
|
+
const currBottom = curr.position.y + nH(curr);
|
|
1424
|
+
const yOverlap = prevBottom + NODE_MIN_GAP > currTop && currBottom + NODE_MIN_GAP > prevTop;
|
|
1425
|
+
if (!yOverlap) continue;
|
|
1426
|
+
const prevRight = prev.position.x + nW(prev);
|
|
1427
|
+
if (prevRight + NODE_MIN_GAP > curr.position.x) {
|
|
1428
|
+
resolvedContent[laneNodeIndices[k].i] = {
|
|
1429
|
+
...curr,
|
|
1430
|
+
position: {
|
|
1431
|
+
x: prevRight + NODE_MIN_GAP,
|
|
1432
|
+
y: curr.position.y
|
|
1433
|
+
}
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
const positionedLanes = hasLanes ? sortedLanes.map((lane) => ({
|
|
1439
|
+
...lane,
|
|
1440
|
+
// x: after pool label strip + left inner padding
|
|
1441
|
+
// y: laneY already includes top POOL_INNER_PAD offset
|
|
1442
|
+
position: { x: POOL_INNER_PAD, y: laneY.get(lane.id) ?? POOL_INNER_PAD },
|
|
1443
|
+
width: laneW,
|
|
1444
|
+
height: laneStats.get(lane.id)?.height ?? LANE_MIN_H
|
|
1445
|
+
})) : [];
|
|
1446
|
+
return {
|
|
1447
|
+
nodes: [...resolvedContent, ...positionedLanes],
|
|
1448
|
+
width: poolW,
|
|
1449
|
+
height: poolH
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
var BACK_EDGE_CLEARANCE = 50;
|
|
1453
|
+
var SAME_ROW_THRESHOLD = 15;
|
|
1454
|
+
function absolutePos(nodeId, byId, cache) {
|
|
1455
|
+
const cached = cache.get(nodeId);
|
|
1456
|
+
if (cached) return cached;
|
|
1457
|
+
const node = byId.get(nodeId);
|
|
1458
|
+
if (!node) return { x: 0, y: 0 };
|
|
1459
|
+
const own = { ...node.position };
|
|
1460
|
+
if (!node.parentId) {
|
|
1461
|
+
cache.set(nodeId, own);
|
|
1462
|
+
return own;
|
|
1463
|
+
}
|
|
1464
|
+
const parent = absolutePos(node.parentId, byId, cache);
|
|
1465
|
+
const abs = { x: parent.x + own.x, y: parent.y + own.y };
|
|
1466
|
+
cache.set(nodeId, abs);
|
|
1467
|
+
return abs;
|
|
1468
|
+
}
|
|
1469
|
+
function laneOf(node, laneIds) {
|
|
1470
|
+
return node.parentId && laneIds.has(node.parentId) ? node.parentId : void 0;
|
|
1471
|
+
}
|
|
1472
|
+
function routeEdges(edges, layoutNodes, backEdgeIds, laneIds, poolIds) {
|
|
1473
|
+
const byId = new Map(layoutNodes.map((n) => [n.id, n]));
|
|
1474
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1475
|
+
const abs = (id) => absolutePos(id, byId, cache);
|
|
1476
|
+
return edges.map((edge) => {
|
|
1477
|
+
const edgeType = edge.data?.edgeType ?? edge.type;
|
|
1478
|
+
if (edgeType !== "sequenceFlow") {
|
|
1479
|
+
const d = { ...edge.data };
|
|
1480
|
+
delete d.routingPoints;
|
|
1481
|
+
return { ...edge, data: d };
|
|
1482
|
+
}
|
|
1483
|
+
const src = byId.get(edge.source);
|
|
1484
|
+
const tgt = byId.get(edge.target);
|
|
1485
|
+
if (!src || !tgt) return edge;
|
|
1486
|
+
const sAbs = abs(src.id);
|
|
1487
|
+
const tAbs = abs(tgt.id);
|
|
1488
|
+
const sW = nW(src), sH = nH(src);
|
|
1489
|
+
const tW = nW(tgt), tH = nH(tgt);
|
|
1490
|
+
const sCX = sAbs.x + sW / 2, sCY = sAbs.y + sH / 2;
|
|
1491
|
+
const tCX = tAbs.x + tW / 2, tCY = tAbs.y + tH / 2;
|
|
1492
|
+
const srcPool = poolIds.has(src.parentId ?? "") ? src.parentId : poolIds.has(byId.get(src.parentId ?? "")?.parentId ?? "") ? byId.get(src.parentId ?? "")?.parentId : src.parentId;
|
|
1493
|
+
const tgtPool = poolIds.has(tgt.parentId ?? "") ? tgt.parentId : poolIds.has(byId.get(tgt.parentId ?? "")?.parentId ?? "") ? byId.get(tgt.parentId ?? "")?.parentId : tgt.parentId;
|
|
1494
|
+
if (srcPool !== tgtPool) {
|
|
1495
|
+
const d = { ...edge.data };
|
|
1496
|
+
delete d.routingPoints;
|
|
1497
|
+
return { ...edge, data: d };
|
|
1498
|
+
}
|
|
1499
|
+
let routingPoints;
|
|
1500
|
+
if (backEdgeIds.has(edge.id)) {
|
|
1501
|
+
const topY = Math.min(sAbs.y, tAbs.y) - BACK_EDGE_CLEARANCE;
|
|
1502
|
+
routingPoints = [
|
|
1503
|
+
{ x: sCX, y: sAbs.y },
|
|
1504
|
+
// [0] discarded
|
|
1505
|
+
{ x: sCX, y: topY },
|
|
1506
|
+
// [1] go up
|
|
1507
|
+
{ x: tCX, y: topY },
|
|
1508
|
+
// [2] go left/right
|
|
1509
|
+
{ x: tCX, y: tAbs.y }
|
|
1510
|
+
// [3] discarded
|
|
1511
|
+
];
|
|
1512
|
+
} else if (laneOf(src, laneIds) !== laneOf(tgt, laneIds)) {
|
|
1513
|
+
const goingDown = tAbs.y > sAbs.y;
|
|
1514
|
+
const sharedX = Math.abs(sCX - tCX) < 10 ? sCX : (sCX + tCX) / 2;
|
|
1515
|
+
const srcLane = byId.get(src.parentId ?? "");
|
|
1516
|
+
const tgtLane = byId.get(tgt.parentId ?? "");
|
|
1517
|
+
if (srcLane && tgtLane && laneIds.has(srcLane.id) && laneIds.has(tgtLane.id)) {
|
|
1518
|
+
const srcLaneAbs = abs(srcLane.id);
|
|
1519
|
+
const borderY = goingDown ? srcLaneAbs.y + (srcLane.height ?? 160) : srcLaneAbs.y;
|
|
1520
|
+
routingPoints = [
|
|
1521
|
+
{ x: sCX, y: goingDown ? sAbs.y + sH : sAbs.y },
|
|
1522
|
+
// [0] discarded
|
|
1523
|
+
{ x: sharedX, y: goingDown ? sAbs.y + sH : sAbs.y },
|
|
1524
|
+
// [1] bend: horizontal exit
|
|
1525
|
+
{ x: sharedX, y: borderY },
|
|
1526
|
+
// [2] bend: lane border
|
|
1527
|
+
{ x: sharedX, y: goingDown ? tAbs.y : tAbs.y + tH }
|
|
1528
|
+
// [3] discarded
|
|
1529
|
+
];
|
|
1530
|
+
} else {
|
|
1531
|
+
routingPoints = [
|
|
1532
|
+
{ x: sCX, y: sCY },
|
|
1533
|
+
{ x: sharedX, y: sCY },
|
|
1534
|
+
{ x: sharedX, y: tCY },
|
|
1535
|
+
{ x: tCX, y: tCY }
|
|
1536
|
+
];
|
|
1537
|
+
}
|
|
1538
|
+
} else if (Math.abs(sCY - tCY) <= SAME_ROW_THRESHOLD) {
|
|
1539
|
+
const d = { ...edge.data };
|
|
1540
|
+
delete d.routingPoints;
|
|
1541
|
+
return { ...edge, data: d };
|
|
1542
|
+
} else {
|
|
1543
|
+
const handle = edge.sourceHandle ?? "";
|
|
1544
|
+
const exitsTop = handle.includes("top");
|
|
1545
|
+
const exitsBottom = handle.includes("bottom");
|
|
1546
|
+
if (exitsTop || exitsBottom) {
|
|
1547
|
+
routingPoints = [
|
|
1548
|
+
{ x: sCX, y: exitsTop ? sAbs.y : sAbs.y + sH },
|
|
1549
|
+
// [0] discarded
|
|
1550
|
+
{ x: sCX, y: tCY },
|
|
1551
|
+
// [1] vertical to target row
|
|
1552
|
+
{ x: tCX, y: tCY },
|
|
1553
|
+
// [2] horizontal to target
|
|
1554
|
+
{ x: tCX, y: exitsTop ? tAbs.y + tH : tAbs.y }
|
|
1555
|
+
// [3] discarded
|
|
1556
|
+
];
|
|
1557
|
+
} else {
|
|
1558
|
+
const goingRight = tAbs.x >= sAbs.x;
|
|
1559
|
+
const midX = goingRight ? sAbs.x + sW + COL_GAP / 2 : sAbs.x - COL_GAP / 2;
|
|
1560
|
+
routingPoints = [
|
|
1561
|
+
{ x: sAbs.x + sW, y: sCY },
|
|
1562
|
+
// [0] discarded
|
|
1563
|
+
{ x: midX, y: sCY },
|
|
1564
|
+
// [1] horizontal exit
|
|
1565
|
+
{ x: midX, y: tCY },
|
|
1566
|
+
// [2] vertical to target row
|
|
1567
|
+
{ x: tAbs.x, y: tCY }
|
|
1568
|
+
// [3] discarded
|
|
1569
|
+
];
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
return { ...edge, data: { ...edge.data, routingPoints } };
|
|
1573
|
+
});
|
|
1574
|
+
}
|
|
1575
|
+
async function bpmnCustomLayout(nodes, edges) {
|
|
1576
|
+
const pools = nodes.filter((n) => n.data.elementType === "Pool");
|
|
1577
|
+
const lanes = nodes.filter((n) => n.data.elementType === "Lane");
|
|
1578
|
+
const content = nodes.filter((n) => !LAYOUT_CONTAINER_TYPES.has(n.data.elementType));
|
|
1579
|
+
if (pools.length === 0) {
|
|
1580
|
+
const { bpmnElkLayout: bpmnElkLayout2 } = await Promise.resolve().then(() => (init_elk(), elk_exports));
|
|
1581
|
+
return bpmnElkLayout2(nodes, edges);
|
|
1582
|
+
}
|
|
1583
|
+
const poolIds = new Set(pools.map((p) => p.id));
|
|
1584
|
+
const allLaneIds = new Set(lanes.map((l) => l.id));
|
|
1585
|
+
const allContentIds = new Set(content.map((n) => n.id));
|
|
1586
|
+
const allSeqEdges = edges.filter((e) => {
|
|
1587
|
+
const t = e.data?.edgeType ?? e.type;
|
|
1588
|
+
return t === "sequenceFlow" && allContentIds.has(e.source) && allContentIds.has(e.target);
|
|
1589
|
+
}).map((e) => ({ id: e.id, source: e.source, target: e.target }));
|
|
1590
|
+
const allBackEdgeIds = detectBackEdges([...allContentIds], allSeqEdges);
|
|
1591
|
+
const poolPositionsDistinct = pools.some((p) => Math.abs(p.position.y) > 10);
|
|
1592
|
+
const sortedPools = poolPositionsDistinct ? [...pools].sort((a, b) => a.position.y - b.position.y) : [...pools];
|
|
1593
|
+
const resultNodes = [];
|
|
1594
|
+
let stackY = 0;
|
|
1595
|
+
for (const pool of sortedPools) {
|
|
1596
|
+
const poolLanes = lanes.filter((l) => l.parentId === pool.id);
|
|
1597
|
+
const laneIds = new Set(poolLanes.map((l) => l.id));
|
|
1598
|
+
const poolContent = content.filter(
|
|
1599
|
+
(n) => n.parentId === pool.id || n.parentId != null && laneIds.has(n.parentId)
|
|
1600
|
+
);
|
|
1601
|
+
const result = layoutPool(pool, poolLanes, poolContent, edges);
|
|
1602
|
+
resultNodes.push({
|
|
1603
|
+
...pool,
|
|
1604
|
+
position: { x: 0, y: stackY },
|
|
1605
|
+
width: result.width,
|
|
1606
|
+
height: result.height
|
|
1607
|
+
});
|
|
1608
|
+
for (const node of result.nodes) {
|
|
1609
|
+
resultNodes.push(node);
|
|
1610
|
+
}
|
|
1611
|
+
stackY += result.height + POOL_V_GAP;
|
|
1612
|
+
}
|
|
1613
|
+
const layoutted = new Set(resultNodes.map((n) => n.id));
|
|
1614
|
+
for (const node of nodes) {
|
|
1615
|
+
if (!layoutted.has(node.id)) resultNodes.push(node);
|
|
1616
|
+
}
|
|
1617
|
+
const routedEdges = routeEdges(edges, resultNodes, allBackEdgeIds, allLaneIds, poolIds);
|
|
1618
|
+
return { nodes: resultNodes, edges: routedEdges };
|
|
1619
|
+
}
|
|
948
1620
|
|
|
949
1621
|
// src/layout/index.ts
|
|
950
1622
|
async function bpmnDagreLayout(nodes, edges, options = {}) {
|
|
@@ -962,6 +1634,7 @@ Object.defineProperty(exports, "applyLayoutResultToDiagram", {
|
|
|
962
1634
|
get: function () { return layout.applyLayoutResultToDiagram; }
|
|
963
1635
|
});
|
|
964
1636
|
exports.applyBpmnLayoutResult = applyBpmnLayoutResult;
|
|
1637
|
+
exports.bpmnCustomLayout = bpmnCustomLayout;
|
|
965
1638
|
exports.bpmnDagreLayout = bpmnDagreLayout;
|
|
966
1639
|
exports.bpmnElkLayout = bpmnElkLayout;
|
|
967
1640
|
//# sourceMappingURL=index.cjs.map
|