@aranzatech/diagrams-bpmn 0.1.0
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/chunk-23B2IGK5.js +24 -0
- package/dist/chunk-23B2IGK5.js.map +1 -0
- package/dist/chunk-3AFZDIMQ.js +286 -0
- package/dist/chunk-3AFZDIMQ.js.map +1 -0
- package/dist/chunk-4OAEWYYU.js +579 -0
- package/dist/chunk-4OAEWYYU.js.map +1 -0
- package/dist/chunk-57LA2WSJ.js +476 -0
- package/dist/chunk-57LA2WSJ.js.map +1 -0
- package/dist/chunk-6TUC5QX5.js +491 -0
- package/dist/chunk-6TUC5QX5.js.map +1 -0
- package/dist/chunk-MLUJKUTG.js +86 -0
- package/dist/chunk-MLUJKUTG.js.map +1 -0
- package/dist/chunk-NXMUX67A.js +1443 -0
- package/dist/chunk-NXMUX67A.js.map +1 -0
- package/dist/edges/index.cjs +300 -0
- package/dist/edges/index.cjs.map +1 -0
- package/dist/edges/index.d.cts +17 -0
- package/dist/edges/index.d.ts +17 -0
- package/dist/edges/index.js +4 -0
- package/dist/edges/index.js.map +1 -0
- package/dist/elements/index.cjs +587 -0
- package/dist/elements/index.cjs.map +1 -0
- package/dist/elements/index.d.cts +20 -0
- package/dist/elements/index.d.ts +20 -0
- package/dist/elements/index.js +4 -0
- package/dist/elements/index.js.map +1 -0
- package/dist/index.cjs +3442 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +67 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/nodes/index.cjs +1487 -0
- package/dist/nodes/index.cjs.map +1 -0
- package/dist/nodes/index.d.cts +45 -0
- package/dist/nodes/index.d.ts +45 -0
- package/dist/nodes/index.js +4 -0
- package/dist/nodes/index.js.map +1 -0
- package/dist/simulation/index.cjs +483 -0
- package/dist/simulation/index.cjs.map +1 -0
- package/dist/simulation/index.d.cts +62 -0
- package/dist/simulation/index.d.ts +62 -0
- package/dist/simulation/index.js +3 -0
- package/dist/simulation/index.js.map +1 -0
- package/dist/types-CxzazgBX.d.cts +111 -0
- package/dist/types-CxzazgBX.d.ts +111 -0
- package/dist/xml/index.cjs +1068 -0
- package/dist/xml/index.cjs.map +1 -0
- package/dist/xml/index.d.cts +24 -0
- package/dist/xml/index.d.ts +24 -0
- package/dist/xml/index.js +4 -0
- package/dist/xml/index.js.map +1 -0
- package/package.json +84 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,3442 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('@xyflow/react');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var routing = require('@aranzatech/diagrams-core/routing');
|
|
6
|
+
var bpmnModdle = require('bpmn-moddle');
|
|
7
|
+
|
|
8
|
+
// src/elements/catalog.ts
|
|
9
|
+
var BPMN_ELEMENT_CATALOG = {
|
|
10
|
+
// ─── Events ──────────────────────────────────────────────────────────────────
|
|
11
|
+
StartEvent: {
|
|
12
|
+
label: "Start Event",
|
|
13
|
+
category: "event",
|
|
14
|
+
defaultWidth: 36,
|
|
15
|
+
defaultHeight: 36,
|
|
16
|
+
handlePolicy: "source",
|
|
17
|
+
orientation: "free",
|
|
18
|
+
isContainer: false,
|
|
19
|
+
acceptsBoundaryEvents: false,
|
|
20
|
+
eventSemantics: "start",
|
|
21
|
+
canBeStart: true,
|
|
22
|
+
canBeEnd: false,
|
|
23
|
+
maxIncoming: 0,
|
|
24
|
+
maxOutgoing: 1
|
|
25
|
+
},
|
|
26
|
+
EndEvent: {
|
|
27
|
+
label: "End Event",
|
|
28
|
+
category: "event",
|
|
29
|
+
defaultWidth: 36,
|
|
30
|
+
defaultHeight: 36,
|
|
31
|
+
handlePolicy: "target",
|
|
32
|
+
orientation: "free",
|
|
33
|
+
isContainer: false,
|
|
34
|
+
acceptsBoundaryEvents: false,
|
|
35
|
+
eventSemantics: "end",
|
|
36
|
+
canBeStart: false,
|
|
37
|
+
canBeEnd: true,
|
|
38
|
+
maxOutgoing: 0
|
|
39
|
+
},
|
|
40
|
+
IntermediateCatchEvent: {
|
|
41
|
+
label: "Intermediate Catch Event",
|
|
42
|
+
category: "event",
|
|
43
|
+
defaultWidth: 36,
|
|
44
|
+
defaultHeight: 36,
|
|
45
|
+
handlePolicy: "all",
|
|
46
|
+
orientation: "free",
|
|
47
|
+
isContainer: false,
|
|
48
|
+
acceptsBoundaryEvents: false,
|
|
49
|
+
eventSemantics: "intermediateCatch",
|
|
50
|
+
canBeStart: false,
|
|
51
|
+
canBeEnd: false
|
|
52
|
+
},
|
|
53
|
+
IntermediateThrowEvent: {
|
|
54
|
+
label: "Intermediate Throw Event",
|
|
55
|
+
category: "event",
|
|
56
|
+
defaultWidth: 36,
|
|
57
|
+
defaultHeight: 36,
|
|
58
|
+
handlePolicy: "all",
|
|
59
|
+
orientation: "free",
|
|
60
|
+
isContainer: false,
|
|
61
|
+
acceptsBoundaryEvents: false,
|
|
62
|
+
eventSemantics: "intermediateThrow",
|
|
63
|
+
canBeStart: false,
|
|
64
|
+
canBeEnd: false
|
|
65
|
+
},
|
|
66
|
+
BoundaryEvent: {
|
|
67
|
+
label: "Boundary Event",
|
|
68
|
+
category: "event",
|
|
69
|
+
defaultWidth: 36,
|
|
70
|
+
defaultHeight: 36,
|
|
71
|
+
handlePolicy: "source",
|
|
72
|
+
orientation: "free",
|
|
73
|
+
isContainer: false,
|
|
74
|
+
acceptsBoundaryEvents: false,
|
|
75
|
+
eventSemantics: "boundary",
|
|
76
|
+
canBeStart: false,
|
|
77
|
+
canBeEnd: false,
|
|
78
|
+
maxIncoming: 0
|
|
79
|
+
},
|
|
80
|
+
// ─── Tasks ───────────────────────────────────────────────────────────────────
|
|
81
|
+
Task: {
|
|
82
|
+
label: "Task",
|
|
83
|
+
category: "task",
|
|
84
|
+
defaultWidth: 120,
|
|
85
|
+
defaultHeight: 60,
|
|
86
|
+
handlePolicy: "all",
|
|
87
|
+
orientation: "free",
|
|
88
|
+
isContainer: false,
|
|
89
|
+
acceptsBoundaryEvents: true,
|
|
90
|
+
supportsMarkers: true,
|
|
91
|
+
canBeStart: false,
|
|
92
|
+
canBeEnd: false
|
|
93
|
+
},
|
|
94
|
+
UserTask: {
|
|
95
|
+
label: "User Task",
|
|
96
|
+
category: "task",
|
|
97
|
+
defaultWidth: 120,
|
|
98
|
+
defaultHeight: 60,
|
|
99
|
+
handlePolicy: "all",
|
|
100
|
+
orientation: "free",
|
|
101
|
+
isContainer: false,
|
|
102
|
+
acceptsBoundaryEvents: true,
|
|
103
|
+
supportsMarkers: true,
|
|
104
|
+
canBeStart: false,
|
|
105
|
+
canBeEnd: false
|
|
106
|
+
},
|
|
107
|
+
ServiceTask: {
|
|
108
|
+
label: "Service Task",
|
|
109
|
+
category: "task",
|
|
110
|
+
defaultWidth: 120,
|
|
111
|
+
defaultHeight: 60,
|
|
112
|
+
handlePolicy: "all",
|
|
113
|
+
orientation: "free",
|
|
114
|
+
isContainer: false,
|
|
115
|
+
acceptsBoundaryEvents: true,
|
|
116
|
+
supportsMarkers: true,
|
|
117
|
+
canBeStart: false,
|
|
118
|
+
canBeEnd: false
|
|
119
|
+
},
|
|
120
|
+
ScriptTask: {
|
|
121
|
+
label: "Script Task",
|
|
122
|
+
category: "task",
|
|
123
|
+
defaultWidth: 120,
|
|
124
|
+
defaultHeight: 60,
|
|
125
|
+
handlePolicy: "all",
|
|
126
|
+
orientation: "free",
|
|
127
|
+
isContainer: false,
|
|
128
|
+
acceptsBoundaryEvents: true,
|
|
129
|
+
supportsMarkers: true,
|
|
130
|
+
canBeStart: false,
|
|
131
|
+
canBeEnd: false
|
|
132
|
+
},
|
|
133
|
+
ManualTask: {
|
|
134
|
+
label: "Manual Task",
|
|
135
|
+
category: "task",
|
|
136
|
+
defaultWidth: 120,
|
|
137
|
+
defaultHeight: 60,
|
|
138
|
+
handlePolicy: "all",
|
|
139
|
+
orientation: "free",
|
|
140
|
+
isContainer: false,
|
|
141
|
+
acceptsBoundaryEvents: true,
|
|
142
|
+
supportsMarkers: true,
|
|
143
|
+
canBeStart: false,
|
|
144
|
+
canBeEnd: false
|
|
145
|
+
},
|
|
146
|
+
BusinessRuleTask: {
|
|
147
|
+
label: "Business Rule Task",
|
|
148
|
+
category: "task",
|
|
149
|
+
defaultWidth: 120,
|
|
150
|
+
defaultHeight: 60,
|
|
151
|
+
handlePolicy: "all",
|
|
152
|
+
orientation: "free",
|
|
153
|
+
isContainer: false,
|
|
154
|
+
acceptsBoundaryEvents: true,
|
|
155
|
+
supportsMarkers: true,
|
|
156
|
+
canBeStart: false,
|
|
157
|
+
canBeEnd: false
|
|
158
|
+
},
|
|
159
|
+
ReceiveTask: {
|
|
160
|
+
label: "Receive Task",
|
|
161
|
+
category: "task",
|
|
162
|
+
defaultWidth: 120,
|
|
163
|
+
defaultHeight: 60,
|
|
164
|
+
handlePolicy: "all",
|
|
165
|
+
orientation: "free",
|
|
166
|
+
isContainer: false,
|
|
167
|
+
acceptsBoundaryEvents: true,
|
|
168
|
+
supportsMarkers: true,
|
|
169
|
+
canBeStart: false,
|
|
170
|
+
canBeEnd: false
|
|
171
|
+
},
|
|
172
|
+
SendTask: {
|
|
173
|
+
label: "Send Task",
|
|
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
|
+
CallActivity: {
|
|
186
|
+
label: "Call Activity",
|
|
187
|
+
category: "task",
|
|
188
|
+
defaultWidth: 120,
|
|
189
|
+
defaultHeight: 60,
|
|
190
|
+
handlePolicy: "all",
|
|
191
|
+
orientation: "free",
|
|
192
|
+
isContainer: false,
|
|
193
|
+
acceptsBoundaryEvents: true,
|
|
194
|
+
supportsMarkers: true,
|
|
195
|
+
canBeStart: false,
|
|
196
|
+
canBeEnd: false
|
|
197
|
+
},
|
|
198
|
+
// ─── Gateways ────────────────────────────────────────────────────────────────
|
|
199
|
+
ExclusiveGateway: {
|
|
200
|
+
label: "Exclusive Gateway",
|
|
201
|
+
category: "gateway",
|
|
202
|
+
defaultWidth: 50,
|
|
203
|
+
defaultHeight: 50,
|
|
204
|
+
handlePolicy: "all",
|
|
205
|
+
orientation: "free",
|
|
206
|
+
isContainer: false,
|
|
207
|
+
acceptsBoundaryEvents: false,
|
|
208
|
+
canBeStart: false,
|
|
209
|
+
canBeEnd: false
|
|
210
|
+
},
|
|
211
|
+
InclusiveGateway: {
|
|
212
|
+
label: "Inclusive Gateway",
|
|
213
|
+
category: "gateway",
|
|
214
|
+
defaultWidth: 50,
|
|
215
|
+
defaultHeight: 50,
|
|
216
|
+
handlePolicy: "all",
|
|
217
|
+
orientation: "free",
|
|
218
|
+
isContainer: false,
|
|
219
|
+
acceptsBoundaryEvents: false,
|
|
220
|
+
canBeStart: false,
|
|
221
|
+
canBeEnd: false
|
|
222
|
+
},
|
|
223
|
+
ParallelGateway: {
|
|
224
|
+
label: "Parallel Gateway",
|
|
225
|
+
category: "gateway",
|
|
226
|
+
defaultWidth: 50,
|
|
227
|
+
defaultHeight: 50,
|
|
228
|
+
handlePolicy: "all",
|
|
229
|
+
orientation: "free",
|
|
230
|
+
isContainer: false,
|
|
231
|
+
acceptsBoundaryEvents: false,
|
|
232
|
+
canBeStart: false,
|
|
233
|
+
canBeEnd: false
|
|
234
|
+
},
|
|
235
|
+
EventBasedGateway: {
|
|
236
|
+
label: "Event-Based Gateway",
|
|
237
|
+
category: "gateway",
|
|
238
|
+
defaultWidth: 50,
|
|
239
|
+
defaultHeight: 50,
|
|
240
|
+
handlePolicy: "all",
|
|
241
|
+
orientation: "free",
|
|
242
|
+
isContainer: false,
|
|
243
|
+
acceptsBoundaryEvents: false,
|
|
244
|
+
canBeStart: false,
|
|
245
|
+
canBeEnd: false,
|
|
246
|
+
maxIncoming: 1
|
|
247
|
+
},
|
|
248
|
+
ComplexGateway: {
|
|
249
|
+
label: "Complex Gateway",
|
|
250
|
+
category: "gateway",
|
|
251
|
+
defaultWidth: 50,
|
|
252
|
+
defaultHeight: 50,
|
|
253
|
+
handlePolicy: "all",
|
|
254
|
+
orientation: "free",
|
|
255
|
+
isContainer: false,
|
|
256
|
+
acceptsBoundaryEvents: false,
|
|
257
|
+
canBeStart: false,
|
|
258
|
+
canBeEnd: false
|
|
259
|
+
},
|
|
260
|
+
// ─── Containers ───────────────────────────────────────────────────────────────
|
|
261
|
+
SubProcess: {
|
|
262
|
+
label: "Sub-Process",
|
|
263
|
+
category: "container",
|
|
264
|
+
defaultWidth: 350,
|
|
265
|
+
defaultHeight: 200,
|
|
266
|
+
handlePolicy: "all",
|
|
267
|
+
orientation: "horizontal",
|
|
268
|
+
isContainer: true,
|
|
269
|
+
acceptsBoundaryEvents: true,
|
|
270
|
+
supportsCollapse: true,
|
|
271
|
+
supportsMarkers: true,
|
|
272
|
+
canBeStart: false,
|
|
273
|
+
canBeEnd: false
|
|
274
|
+
},
|
|
275
|
+
Pool: {
|
|
276
|
+
label: "Pool",
|
|
277
|
+
category: "container",
|
|
278
|
+
defaultWidth: 600,
|
|
279
|
+
defaultHeight: 200,
|
|
280
|
+
handlePolicy: "none",
|
|
281
|
+
orientation: "horizontal",
|
|
282
|
+
isContainer: true,
|
|
283
|
+
acceptsBoundaryEvents: false,
|
|
284
|
+
canBeStart: false,
|
|
285
|
+
canBeEnd: false,
|
|
286
|
+
maxIncoming: 0,
|
|
287
|
+
maxOutgoing: 0
|
|
288
|
+
},
|
|
289
|
+
Lane: {
|
|
290
|
+
label: "Lane",
|
|
291
|
+
category: "container",
|
|
292
|
+
defaultWidth: 600,
|
|
293
|
+
defaultHeight: 120,
|
|
294
|
+
handlePolicy: "none",
|
|
295
|
+
orientation: "horizontal",
|
|
296
|
+
isContainer: true,
|
|
297
|
+
acceptsBoundaryEvents: false,
|
|
298
|
+
canBeStart: false,
|
|
299
|
+
canBeEnd: false,
|
|
300
|
+
maxIncoming: 0,
|
|
301
|
+
maxOutgoing: 0
|
|
302
|
+
},
|
|
303
|
+
// ─── Artifacts ────────────────────────────────────────────────────────────────
|
|
304
|
+
Annotation: {
|
|
305
|
+
label: "Text Annotation",
|
|
306
|
+
category: "artifact",
|
|
307
|
+
defaultWidth: 100,
|
|
308
|
+
defaultHeight: 60,
|
|
309
|
+
handlePolicy: "none",
|
|
310
|
+
orientation: "free",
|
|
311
|
+
isContainer: false,
|
|
312
|
+
acceptsBoundaryEvents: false,
|
|
313
|
+
canBeStart: false,
|
|
314
|
+
canBeEnd: false,
|
|
315
|
+
maxIncoming: 0,
|
|
316
|
+
maxOutgoing: 0
|
|
317
|
+
},
|
|
318
|
+
Group: {
|
|
319
|
+
label: "Group",
|
|
320
|
+
category: "artifact",
|
|
321
|
+
defaultWidth: 300,
|
|
322
|
+
defaultHeight: 200,
|
|
323
|
+
handlePolicy: "none",
|
|
324
|
+
orientation: "free",
|
|
325
|
+
isContainer: false,
|
|
326
|
+
acceptsBoundaryEvents: false,
|
|
327
|
+
canBeStart: false,
|
|
328
|
+
canBeEnd: false,
|
|
329
|
+
maxIncoming: 0,
|
|
330
|
+
maxOutgoing: 0
|
|
331
|
+
},
|
|
332
|
+
// ─── Data (BPMN 2.0 §10.3) ───────────────────────────────────────────────────
|
|
333
|
+
DataObject: {
|
|
334
|
+
label: "Data Object",
|
|
335
|
+
category: "data",
|
|
336
|
+
defaultWidth: 36,
|
|
337
|
+
defaultHeight: 50,
|
|
338
|
+
handlePolicy: "all",
|
|
339
|
+
orientation: "free",
|
|
340
|
+
isContainer: false,
|
|
341
|
+
acceptsBoundaryEvents: false,
|
|
342
|
+
canBeStart: false,
|
|
343
|
+
canBeEnd: false,
|
|
344
|
+
maxIncoming: 0,
|
|
345
|
+
maxOutgoing: 0
|
|
346
|
+
},
|
|
347
|
+
DataObjectReference: {
|
|
348
|
+
label: "Data Object Reference",
|
|
349
|
+
category: "data",
|
|
350
|
+
defaultWidth: 36,
|
|
351
|
+
defaultHeight: 50,
|
|
352
|
+
handlePolicy: "all",
|
|
353
|
+
orientation: "free",
|
|
354
|
+
isContainer: false,
|
|
355
|
+
acceptsBoundaryEvents: false,
|
|
356
|
+
canBeStart: false,
|
|
357
|
+
canBeEnd: false,
|
|
358
|
+
maxIncoming: 0,
|
|
359
|
+
maxOutgoing: 0
|
|
360
|
+
},
|
|
361
|
+
DataInput: {
|
|
362
|
+
label: "Data Input",
|
|
363
|
+
category: "data",
|
|
364
|
+
defaultWidth: 36,
|
|
365
|
+
defaultHeight: 50,
|
|
366
|
+
handlePolicy: "all",
|
|
367
|
+
orientation: "free",
|
|
368
|
+
isContainer: false,
|
|
369
|
+
acceptsBoundaryEvents: false,
|
|
370
|
+
canBeStart: false,
|
|
371
|
+
canBeEnd: false,
|
|
372
|
+
maxIncoming: 0
|
|
373
|
+
},
|
|
374
|
+
DataOutput: {
|
|
375
|
+
label: "Data Output",
|
|
376
|
+
category: "data",
|
|
377
|
+
defaultWidth: 36,
|
|
378
|
+
defaultHeight: 50,
|
|
379
|
+
handlePolicy: "all",
|
|
380
|
+
orientation: "free",
|
|
381
|
+
isContainer: false,
|
|
382
|
+
acceptsBoundaryEvents: false,
|
|
383
|
+
canBeStart: false,
|
|
384
|
+
canBeEnd: false,
|
|
385
|
+
maxOutgoing: 0
|
|
386
|
+
},
|
|
387
|
+
DataStore: {
|
|
388
|
+
label: "Data Store",
|
|
389
|
+
category: "data",
|
|
390
|
+
defaultWidth: 50,
|
|
391
|
+
defaultHeight: 50,
|
|
392
|
+
handlePolicy: "all",
|
|
393
|
+
orientation: "free",
|
|
394
|
+
isContainer: false,
|
|
395
|
+
acceptsBoundaryEvents: false,
|
|
396
|
+
canBeStart: false,
|
|
397
|
+
canBeEnd: false,
|
|
398
|
+
maxIncoming: 0,
|
|
399
|
+
maxOutgoing: 0
|
|
400
|
+
},
|
|
401
|
+
DataStoreReference: {
|
|
402
|
+
label: "Data Store Reference",
|
|
403
|
+
category: "data",
|
|
404
|
+
defaultWidth: 50,
|
|
405
|
+
defaultHeight: 50,
|
|
406
|
+
handlePolicy: "all",
|
|
407
|
+
orientation: "free",
|
|
408
|
+
isContainer: false,
|
|
409
|
+
acceptsBoundaryEvents: false,
|
|
410
|
+
canBeStart: false,
|
|
411
|
+
canBeEnd: false,
|
|
412
|
+
maxIncoming: 0,
|
|
413
|
+
maxOutgoing: 0
|
|
414
|
+
},
|
|
415
|
+
// ─── Conversation (BPMN 2.0 §12) ─────────────────────────────────────────────
|
|
416
|
+
Conversation: {
|
|
417
|
+
label: "Conversation",
|
|
418
|
+
category: "conversation",
|
|
419
|
+
defaultWidth: 60,
|
|
420
|
+
defaultHeight: 52,
|
|
421
|
+
handlePolicy: "all",
|
|
422
|
+
orientation: "free",
|
|
423
|
+
isContainer: false,
|
|
424
|
+
acceptsBoundaryEvents: false,
|
|
425
|
+
canBeStart: false,
|
|
426
|
+
canBeEnd: false
|
|
427
|
+
},
|
|
428
|
+
SubConversation: {
|
|
429
|
+
label: "Sub-Conversation",
|
|
430
|
+
category: "conversation",
|
|
431
|
+
defaultWidth: 60,
|
|
432
|
+
defaultHeight: 52,
|
|
433
|
+
handlePolicy: "all",
|
|
434
|
+
orientation: "free",
|
|
435
|
+
isContainer: true,
|
|
436
|
+
acceptsBoundaryEvents: false,
|
|
437
|
+
supportsCollapse: true,
|
|
438
|
+
canBeStart: false,
|
|
439
|
+
canBeEnd: false
|
|
440
|
+
},
|
|
441
|
+
CallConversation: {
|
|
442
|
+
label: "Call Conversation",
|
|
443
|
+
category: "conversation",
|
|
444
|
+
defaultWidth: 60,
|
|
445
|
+
defaultHeight: 52,
|
|
446
|
+
handlePolicy: "all",
|
|
447
|
+
orientation: "free",
|
|
448
|
+
isContainer: false,
|
|
449
|
+
acceptsBoundaryEvents: false,
|
|
450
|
+
canBeStart: false,
|
|
451
|
+
canBeEnd: false
|
|
452
|
+
},
|
|
453
|
+
// ─── Choreography (BPMN 2.0 §11) ─────────────────────────────────────────────
|
|
454
|
+
ChoreographyTask: {
|
|
455
|
+
label: "Choreography Task",
|
|
456
|
+
category: "choreography",
|
|
457
|
+
defaultWidth: 120,
|
|
458
|
+
defaultHeight: 80,
|
|
459
|
+
handlePolicy: "all",
|
|
460
|
+
orientation: "horizontal",
|
|
461
|
+
isContainer: false,
|
|
462
|
+
acceptsBoundaryEvents: false,
|
|
463
|
+
canBeStart: false,
|
|
464
|
+
canBeEnd: false
|
|
465
|
+
},
|
|
466
|
+
SubChoreography: {
|
|
467
|
+
label: "Sub-Choreography",
|
|
468
|
+
category: "choreography",
|
|
469
|
+
defaultWidth: 120,
|
|
470
|
+
defaultHeight: 80,
|
|
471
|
+
handlePolicy: "all",
|
|
472
|
+
orientation: "horizontal",
|
|
473
|
+
isContainer: true,
|
|
474
|
+
acceptsBoundaryEvents: false,
|
|
475
|
+
supportsCollapse: true,
|
|
476
|
+
canBeStart: false,
|
|
477
|
+
canBeEnd: false
|
|
478
|
+
},
|
|
479
|
+
CallChoreography: {
|
|
480
|
+
label: "Call Choreography",
|
|
481
|
+
category: "choreography",
|
|
482
|
+
defaultWidth: 120,
|
|
483
|
+
defaultHeight: 80,
|
|
484
|
+
handlePolicy: "all",
|
|
485
|
+
orientation: "horizontal",
|
|
486
|
+
isContainer: false,
|
|
487
|
+
acceptsBoundaryEvents: false,
|
|
488
|
+
canBeStart: false,
|
|
489
|
+
canBeEnd: false
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
function getElementMeta(type) {
|
|
493
|
+
return BPMN_ELEMENT_CATALOG[type];
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// src/elements/guards.ts
|
|
497
|
+
var TASK_TYPES = /* @__PURE__ */ new Set([
|
|
498
|
+
"Task",
|
|
499
|
+
"UserTask",
|
|
500
|
+
"ServiceTask",
|
|
501
|
+
"ScriptTask",
|
|
502
|
+
"ManualTask",
|
|
503
|
+
"BusinessRuleTask",
|
|
504
|
+
"ReceiveTask",
|
|
505
|
+
"SendTask",
|
|
506
|
+
"CallActivity"
|
|
507
|
+
]);
|
|
508
|
+
var GATEWAY_TYPES = /* @__PURE__ */ new Set([
|
|
509
|
+
"ExclusiveGateway",
|
|
510
|
+
"InclusiveGateway",
|
|
511
|
+
"ParallelGateway",
|
|
512
|
+
"EventBasedGateway",
|
|
513
|
+
"ComplexGateway"
|
|
514
|
+
]);
|
|
515
|
+
var EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
516
|
+
"StartEvent",
|
|
517
|
+
"EndEvent",
|
|
518
|
+
"IntermediateCatchEvent",
|
|
519
|
+
"IntermediateThrowEvent",
|
|
520
|
+
"BoundaryEvent"
|
|
521
|
+
]);
|
|
522
|
+
var DATA_TYPES = /* @__PURE__ */ new Set([
|
|
523
|
+
"DataObject",
|
|
524
|
+
"DataObjectReference",
|
|
525
|
+
"DataInput",
|
|
526
|
+
"DataOutput",
|
|
527
|
+
"DataStore",
|
|
528
|
+
"DataStoreReference"
|
|
529
|
+
]);
|
|
530
|
+
var CONVERSATION_TYPES = /* @__PURE__ */ new Set([
|
|
531
|
+
"Conversation",
|
|
532
|
+
"SubConversation",
|
|
533
|
+
"CallConversation"
|
|
534
|
+
]);
|
|
535
|
+
var CHOREOGRAPHY_TYPES = /* @__PURE__ */ new Set([
|
|
536
|
+
"ChoreographyTask",
|
|
537
|
+
"SubChoreography",
|
|
538
|
+
"CallChoreography"
|
|
539
|
+
]);
|
|
540
|
+
function isTaskType(type) {
|
|
541
|
+
return TASK_TYPES.has(type);
|
|
542
|
+
}
|
|
543
|
+
function isGatewayType(type) {
|
|
544
|
+
return GATEWAY_TYPES.has(type);
|
|
545
|
+
}
|
|
546
|
+
function isEventType(type) {
|
|
547
|
+
return EVENT_TYPES.has(type);
|
|
548
|
+
}
|
|
549
|
+
function isDataType(type) {
|
|
550
|
+
return DATA_TYPES.has(type);
|
|
551
|
+
}
|
|
552
|
+
function isConversationType(type) {
|
|
553
|
+
return CONVERSATION_TYPES.has(type);
|
|
554
|
+
}
|
|
555
|
+
function isChoreographyType(type) {
|
|
556
|
+
return CHOREOGRAPHY_TYPES.has(type);
|
|
557
|
+
}
|
|
558
|
+
function isContainerType(type) {
|
|
559
|
+
return BPMN_ELEMENT_CATALOG[type].isContainer;
|
|
560
|
+
}
|
|
561
|
+
function acceptsBoundaryEvents(type) {
|
|
562
|
+
return BPMN_ELEMENT_CATALOG[type].acceptsBoundaryEvents;
|
|
563
|
+
}
|
|
564
|
+
function getHandlePolicy(type) {
|
|
565
|
+
return BPMN_ELEMENT_CATALOG[type].handlePolicy;
|
|
566
|
+
}
|
|
567
|
+
function getOrientation(type) {
|
|
568
|
+
return BPMN_ELEMENT_CATALOG[type].orientation;
|
|
569
|
+
}
|
|
570
|
+
function supportsCollapse(type) {
|
|
571
|
+
return BPMN_ELEMENT_CATALOG[type].supportsCollapse ?? false;
|
|
572
|
+
}
|
|
573
|
+
function supportsMarkers(type) {
|
|
574
|
+
return BPMN_ELEMENT_CATALOG[type].supportsMarkers ?? false;
|
|
575
|
+
}
|
|
576
|
+
var ALL_POSITIONS = [
|
|
577
|
+
react.Position.Top,
|
|
578
|
+
react.Position.Right,
|
|
579
|
+
react.Position.Bottom,
|
|
580
|
+
react.Position.Left
|
|
581
|
+
];
|
|
582
|
+
var HANDLE_STYLE = {
|
|
583
|
+
width: 8,
|
|
584
|
+
height: 8,
|
|
585
|
+
background: "#8c8c8c",
|
|
586
|
+
border: "1.5px solid #fff"
|
|
587
|
+
};
|
|
588
|
+
function BpmnHandles({ variant = "all" }) {
|
|
589
|
+
const src = variant === "all" || variant === "source";
|
|
590
|
+
const tgt = variant === "all" || variant === "target";
|
|
591
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
592
|
+
tgt && ALL_POSITIONS.map((position) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
593
|
+
react.Handle,
|
|
594
|
+
{
|
|
595
|
+
type: "target",
|
|
596
|
+
position,
|
|
597
|
+
id: `target-${position}`,
|
|
598
|
+
style: HANDLE_STYLE
|
|
599
|
+
},
|
|
600
|
+
`target-${position}`
|
|
601
|
+
)),
|
|
602
|
+
src && ALL_POSITIONS.map((position) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
603
|
+
react.Handle,
|
|
604
|
+
{
|
|
605
|
+
type: "source",
|
|
606
|
+
position,
|
|
607
|
+
id: `source-${position}`,
|
|
608
|
+
style: HANDLE_STYLE
|
|
609
|
+
},
|
|
610
|
+
`source-${position}`
|
|
611
|
+
))
|
|
612
|
+
] });
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
// src/nodes/shared/theme.ts
|
|
616
|
+
var BPMN_THEME = {
|
|
617
|
+
fill: "#ffffff",
|
|
618
|
+
stroke: "#404040",
|
|
619
|
+
strokeSelected: "#1a56db",
|
|
620
|
+
strokeWidth: 1.5,
|
|
621
|
+
strokeWidthSelected: 2.5,
|
|
622
|
+
fontFamily: "Inter, system-ui, sans-serif",
|
|
623
|
+
fontSize: 11,
|
|
624
|
+
labelColor: "#1a1a1a"};
|
|
625
|
+
function resolveStroke(selected, override) {
|
|
626
|
+
if (selected) return BPMN_THEME.strokeSelected;
|
|
627
|
+
return override ?? BPMN_THEME.stroke;
|
|
628
|
+
}
|
|
629
|
+
function resolveStrokeWidth(selected) {
|
|
630
|
+
return selected ? BPMN_THEME.strokeWidthSelected : BPMN_THEME.strokeWidth;
|
|
631
|
+
}
|
|
632
|
+
var EXTERNAL_STYLE = {
|
|
633
|
+
position: "absolute",
|
|
634
|
+
top: "100%",
|
|
635
|
+
left: "50%",
|
|
636
|
+
transform: "translateX(-50%)",
|
|
637
|
+
marginTop: 4,
|
|
638
|
+
fontSize: BPMN_THEME.fontSize,
|
|
639
|
+
fontFamily: BPMN_THEME.fontFamily,
|
|
640
|
+
color: BPMN_THEME.labelColor,
|
|
641
|
+
textAlign: "center",
|
|
642
|
+
whiteSpace: "nowrap",
|
|
643
|
+
maxWidth: 100,
|
|
644
|
+
overflow: "hidden",
|
|
645
|
+
textOverflow: "ellipsis",
|
|
646
|
+
pointerEvents: "none",
|
|
647
|
+
lineHeight: 1.3
|
|
648
|
+
};
|
|
649
|
+
var INTERNAL_STYLE = {
|
|
650
|
+
fontSize: BPMN_THEME.fontSize,
|
|
651
|
+
fontFamily: BPMN_THEME.fontFamily,
|
|
652
|
+
color: BPMN_THEME.labelColor,
|
|
653
|
+
textAlign: "center",
|
|
654
|
+
lineHeight: 1.3,
|
|
655
|
+
overflow: "hidden",
|
|
656
|
+
wordBreak: "break-word"
|
|
657
|
+
};
|
|
658
|
+
function BpmnLabel({ children, external = false, style }) {
|
|
659
|
+
if (!children) return null;
|
|
660
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...external ? EXTERNAL_STYLE : INTERNAL_STYLE, ...style }, children });
|
|
661
|
+
}
|
|
662
|
+
function pentagon(r) {
|
|
663
|
+
const pts = Array.from({ length: 5 }, (_, i) => {
|
|
664
|
+
const a = (i * 72 - 90) * (Math.PI / 180);
|
|
665
|
+
return `${(r * Math.cos(a)).toFixed(2)},${(r * Math.sin(a)).toFixed(2)}`;
|
|
666
|
+
});
|
|
667
|
+
return `M ${pts.join(" L ")} Z`;
|
|
668
|
+
}
|
|
669
|
+
function EventMarker({ cx, cy, trigger, filled = false, stroke, bg, r = 10 }) {
|
|
670
|
+
const s = r * 0.6;
|
|
671
|
+
const f = filled ? stroke : "none";
|
|
672
|
+
const sw = 1.4;
|
|
673
|
+
if (trigger === "none" || !trigger) return null;
|
|
674
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${cx},${cy})`, strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
675
|
+
trigger === "message" && /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: f, stroke, strokeWidth: sw, children: [
|
|
676
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: -s, y: -s * 0.65, width: s * 2, height: s * 1.3, rx: 0.5 }),
|
|
677
|
+
/* @__PURE__ */ jsxRuntime.jsx("polyline", { fill: "none", points: `${-s},${-s * 0.65} 0,${s * 0.2} ${s},${-s * 0.65}` })
|
|
678
|
+
] }),
|
|
679
|
+
trigger === "timer" && /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: f, stroke, strokeWidth: sw, children: [
|
|
680
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { r: s, fill: bg, stroke, strokeWidth: sw }),
|
|
681
|
+
Array.from({ length: 12 }, (_, i) => {
|
|
682
|
+
const a = (i * 30 - 90) * (Math.PI / 180);
|
|
683
|
+
const len = i % 3 === 0 ? 0.25 : 0.15;
|
|
684
|
+
const x1 = Math.cos(a) * s * 0.75;
|
|
685
|
+
const y1 = Math.sin(a) * s * 0.75;
|
|
686
|
+
const x2 = Math.cos(a) * s * (0.75 + len);
|
|
687
|
+
const y2 = Math.sin(a) * s * (0.75 + len);
|
|
688
|
+
return /* @__PURE__ */ jsxRuntime.jsx("line", { x1, y1, x2, y2, stroke, strokeWidth: sw * 0.8 }, i);
|
|
689
|
+
}),
|
|
690
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: 0, y1: 0, x2: 0, y2: -s * 0.5, stroke, strokeWidth: sw }),
|
|
691
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: 0, y1: 0, x2: s * 0.4, y2: 0, stroke, strokeWidth: sw })
|
|
692
|
+
] }),
|
|
693
|
+
trigger === "error" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
694
|
+
"path",
|
|
695
|
+
{
|
|
696
|
+
d: `M ${s * 0.35},${-s} L ${-s * 0.15},${-s * 0.05} L ${s * 0.35},${s * 0.05} L ${-s * 0.35},${s} L ${s * 0.15},${s * 0.05} L ${-s * 0.35},${-s * 0.05} Z`,
|
|
697
|
+
fill: f,
|
|
698
|
+
stroke,
|
|
699
|
+
strokeWidth: sw
|
|
700
|
+
}
|
|
701
|
+
),
|
|
702
|
+
trigger === "escalation" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
703
|
+
"path",
|
|
704
|
+
{
|
|
705
|
+
d: `M 0,${-s} L ${s * 0.8},${s * 0.7} L 0,${s * 0.2} L ${-s * 0.8},${s * 0.7} Z`,
|
|
706
|
+
fill: f,
|
|
707
|
+
stroke,
|
|
708
|
+
strokeWidth: sw
|
|
709
|
+
}
|
|
710
|
+
),
|
|
711
|
+
trigger === "conditional" && // Three horizontal lines (document/list)
|
|
712
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { stroke, strokeWidth: sw, fill: "none", children: [
|
|
713
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: -s * 0.75, y: -s * 0.9, width: s * 1.5, height: s * 1.8, rx: 1, fill: bg, stroke, strokeWidth: sw }),
|
|
714
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: -s * 0.45, y1: -s * 0.4, x2: s * 0.45, y2: -s * 0.4 }),
|
|
715
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: -s * 0.45, y1: 0, x2: s * 0.45, y2: 0 }),
|
|
716
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: -s * 0.45, y1: s * 0.4, x2: s * 0.45, y2: s * 0.4 })
|
|
717
|
+
] }),
|
|
718
|
+
trigger === "link" && // Arrow pointing right
|
|
719
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
720
|
+
"path",
|
|
721
|
+
{
|
|
722
|
+
d: `M ${-s * 0.9},${-s * 0.35} L ${s * 0.1},${-s * 0.35} L ${s * 0.1},${-s * 0.65} L ${s},0 L ${s * 0.1},${s * 0.65} L ${s * 0.1},${s * 0.35} L ${-s * 0.9},${s * 0.35} Z`,
|
|
723
|
+
fill: f,
|
|
724
|
+
stroke,
|
|
725
|
+
strokeWidth: sw
|
|
726
|
+
}
|
|
727
|
+
),
|
|
728
|
+
trigger === "compensation" && // Two left-pointing chevrons <<
|
|
729
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { fill: f, stroke, strokeWidth: sw, children: [
|
|
730
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
731
|
+
"polyline",
|
|
732
|
+
{
|
|
733
|
+
fill: f,
|
|
734
|
+
strokeLinejoin: "round",
|
|
735
|
+
points: `${s * 0.5},${-s * 0.7} ${-s * 0.1},0 ${s * 0.5},${s * 0.7}`
|
|
736
|
+
}
|
|
737
|
+
),
|
|
738
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
739
|
+
"polyline",
|
|
740
|
+
{
|
|
741
|
+
fill: f,
|
|
742
|
+
strokeLinejoin: "round",
|
|
743
|
+
points: `${s},${-s * 0.7} ${s * 0.4},0 ${s},${s * 0.7}`
|
|
744
|
+
}
|
|
745
|
+
),
|
|
746
|
+
filled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
747
|
+
/* @__PURE__ */ jsxRuntime.jsx("polygon", { fill: stroke, points: `${s * 0.5},${-s * 0.7} ${-s * 0.1},0 ${s * 0.5},${s * 0.7}` }),
|
|
748
|
+
/* @__PURE__ */ jsxRuntime.jsx("polygon", { fill: stroke, points: `${s},${-s * 0.7} ${s * 0.4},0 ${s},${s * 0.7}` })
|
|
749
|
+
] })
|
|
750
|
+
] }),
|
|
751
|
+
trigger === "signal" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
752
|
+
"polygon",
|
|
753
|
+
{
|
|
754
|
+
points: `0,${-s} ${s * 0.9},${s * 0.7} ${-s * 0.9},${s * 0.7}`,
|
|
755
|
+
fill: f,
|
|
756
|
+
stroke,
|
|
757
|
+
strokeWidth: sw
|
|
758
|
+
}
|
|
759
|
+
),
|
|
760
|
+
trigger === "cancel" && // X mark
|
|
761
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { stroke, strokeWidth: sw * 1.5, strokeLinecap: "round", fill: "none", children: [
|
|
762
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: -s * 0.7, y1: -s * 0.7, x2: s * 0.7, y2: s * 0.7 }),
|
|
763
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: s * 0.7, y1: -s * 0.7, x2: -s * 0.7, y2: s * 0.7 })
|
|
764
|
+
] }),
|
|
765
|
+
trigger === "terminate" && /* @__PURE__ */ jsxRuntime.jsx("circle", { r: s * 0.8, fill: stroke, stroke, strokeWidth: sw }),
|
|
766
|
+
trigger === "multiple" && /* @__PURE__ */ jsxRuntime.jsx("path", { d: pentagon(s * 0.9), fill: f, stroke, strokeWidth: sw }),
|
|
767
|
+
trigger === "parallelMultiple" && /* @__PURE__ */ jsxRuntime.jsxs("g", { stroke, strokeWidth: sw * 1.5, strokeLinecap: "round", fill: "none", children: [
|
|
768
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: 0, y1: -s * 0.8, x2: 0, y2: s * 0.8 }),
|
|
769
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: -s * 0.8, y1: 0, x2: s * 0.8, y2: 0 })
|
|
770
|
+
] })
|
|
771
|
+
] });
|
|
772
|
+
}
|
|
773
|
+
var SIZE = 36;
|
|
774
|
+
var CX = SIZE / 2;
|
|
775
|
+
var R = CX - 2;
|
|
776
|
+
function StartEventNode({ data, selected }) {
|
|
777
|
+
const d = data;
|
|
778
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
779
|
+
const sw = resolveStrokeWidth(selected);
|
|
780
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
781
|
+
const trigger = d.trigger ?? "none";
|
|
782
|
+
const dashArray = d.isNonInterrupting ? "4 2" : void 0;
|
|
783
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: SIZE, height: SIZE, position: "relative" }, children: [
|
|
784
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE, height: SIZE, style: { overflow: "visible", display: "block" }, children: [
|
|
785
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
786
|
+
"circle",
|
|
787
|
+
{
|
|
788
|
+
cx: CX,
|
|
789
|
+
cy: CX,
|
|
790
|
+
r: R,
|
|
791
|
+
fill,
|
|
792
|
+
stroke,
|
|
793
|
+
strokeWidth: sw,
|
|
794
|
+
strokeDasharray: dashArray
|
|
795
|
+
}
|
|
796
|
+
),
|
|
797
|
+
/* @__PURE__ */ jsxRuntime.jsx(EventMarker, { cx: CX, cy: CX, trigger, filled: false, stroke, bg: fill, r: R * 0.55 })
|
|
798
|
+
] }),
|
|
799
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "source" }),
|
|
800
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { external: true, children: d.label })
|
|
801
|
+
] });
|
|
802
|
+
}
|
|
803
|
+
var SIZE2 = 36;
|
|
804
|
+
var CX2 = SIZE2 / 2;
|
|
805
|
+
var R2 = CX2 - 2;
|
|
806
|
+
function EndEventNode({ data, selected }) {
|
|
807
|
+
const d = data;
|
|
808
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
809
|
+
const sw = resolveStrokeWidth(selected);
|
|
810
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
811
|
+
const trigger = d.trigger ?? "none";
|
|
812
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: SIZE2, height: SIZE2, position: "relative" }, children: [
|
|
813
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE2, height: SIZE2, style: { overflow: "visible", display: "block" }, children: [
|
|
814
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
815
|
+
"circle",
|
|
816
|
+
{
|
|
817
|
+
cx: CX2,
|
|
818
|
+
cy: CX2,
|
|
819
|
+
r: R2,
|
|
820
|
+
fill,
|
|
821
|
+
stroke,
|
|
822
|
+
strokeWidth: sw + 2
|
|
823
|
+
}
|
|
824
|
+
),
|
|
825
|
+
/* @__PURE__ */ jsxRuntime.jsx(EventMarker, { cx: CX2, cy: CX2, trigger, filled: true, stroke, bg: fill, r: R2 * 0.55 })
|
|
826
|
+
] }),
|
|
827
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "target" }),
|
|
828
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { external: true, children: d.label })
|
|
829
|
+
] });
|
|
830
|
+
}
|
|
831
|
+
var SIZE3 = 36;
|
|
832
|
+
var CX3 = SIZE3 / 2;
|
|
833
|
+
var R_OUTER = CX3 - 2;
|
|
834
|
+
var R_INNER = R_OUTER - 3;
|
|
835
|
+
var ICON_R = R_INNER * 0.65;
|
|
836
|
+
function IntermediateCatchEventNode({ data, selected }) {
|
|
837
|
+
const d = data;
|
|
838
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
839
|
+
const sw = resolveStrokeWidth(selected);
|
|
840
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
841
|
+
const trigger = d.trigger ?? "none";
|
|
842
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: SIZE3, height: SIZE3, position: "relative" }, children: [
|
|
843
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE3, height: SIZE3, style: { overflow: "visible", display: "block" }, children: [
|
|
844
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: CX3, cy: CX3, r: R_OUTER, fill, stroke, strokeWidth: sw }),
|
|
845
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: CX3, cy: CX3, r: R_INNER, fill: "none", stroke, strokeWidth: sw }),
|
|
846
|
+
/* @__PURE__ */ jsxRuntime.jsx(EventMarker, { cx: CX3, cy: CX3, trigger, filled: false, stroke, bg: fill, r: ICON_R })
|
|
847
|
+
] }),
|
|
848
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" }),
|
|
849
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { external: true, children: d.label })
|
|
850
|
+
] });
|
|
851
|
+
}
|
|
852
|
+
function IntermediateThrowEventNode({ data, selected }) {
|
|
853
|
+
const d = data;
|
|
854
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
855
|
+
const sw = resolveStrokeWidth(selected);
|
|
856
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
857
|
+
const trigger = d.trigger ?? "none";
|
|
858
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: SIZE3, height: SIZE3, position: "relative" }, children: [
|
|
859
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE3, height: SIZE3, style: { overflow: "visible", display: "block" }, children: [
|
|
860
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: CX3, cy: CX3, r: R_OUTER, fill, stroke, strokeWidth: sw }),
|
|
861
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: CX3, cy: CX3, r: R_INNER, fill: stroke, stroke, strokeWidth: sw }),
|
|
862
|
+
/* @__PURE__ */ jsxRuntime.jsx(EventMarker, { cx: CX3, cy: CX3, trigger, filled: true, stroke: fill, bg: stroke, r: ICON_R })
|
|
863
|
+
] }),
|
|
864
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" }),
|
|
865
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { external: true, children: d.label })
|
|
866
|
+
] });
|
|
867
|
+
}
|
|
868
|
+
function BoundaryEventNode({ data, selected }) {
|
|
869
|
+
const d = data;
|
|
870
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
871
|
+
const sw = resolveStrokeWidth(selected);
|
|
872
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
873
|
+
const trigger = d.trigger ?? "none";
|
|
874
|
+
const dashArray = d.isNonInterrupting ? "4 2" : void 0;
|
|
875
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: SIZE3, height: SIZE3, position: "relative" }, children: [
|
|
876
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE3, height: SIZE3, style: { overflow: "visible", display: "block" }, children: [
|
|
877
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
878
|
+
"circle",
|
|
879
|
+
{
|
|
880
|
+
cx: CX3,
|
|
881
|
+
cy: CX3,
|
|
882
|
+
r: R_OUTER,
|
|
883
|
+
fill,
|
|
884
|
+
stroke,
|
|
885
|
+
strokeWidth: sw,
|
|
886
|
+
strokeDasharray: dashArray
|
|
887
|
+
}
|
|
888
|
+
),
|
|
889
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
890
|
+
"circle",
|
|
891
|
+
{
|
|
892
|
+
cx: CX3,
|
|
893
|
+
cy: CX3,
|
|
894
|
+
r: R_INNER,
|
|
895
|
+
fill: "none",
|
|
896
|
+
stroke,
|
|
897
|
+
strokeWidth: sw,
|
|
898
|
+
strokeDasharray: dashArray
|
|
899
|
+
}
|
|
900
|
+
),
|
|
901
|
+
/* @__PURE__ */ jsxRuntime.jsx(EventMarker, { cx: CX3, cy: CX3, trigger, filled: false, stroke, bg: fill, r: ICON_R })
|
|
902
|
+
] }),
|
|
903
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "source" }),
|
|
904
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { external: true, children: d.label })
|
|
905
|
+
] });
|
|
906
|
+
}
|
|
907
|
+
function TaskIcon({ type, size = 14, color = "#404040" }) {
|
|
908
|
+
const s = size;
|
|
909
|
+
const c = color;
|
|
910
|
+
switch (type) {
|
|
911
|
+
case "UserTask":
|
|
912
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: s, height: s, viewBox: "0 0 16 16", fill: "none", children: [
|
|
913
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "5", r: "3", stroke: c, strokeWidth: "1.5" }),
|
|
914
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 14c0-3.3 2.7-6 6-6s6 2.7 6 6", stroke: c, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
915
|
+
] });
|
|
916
|
+
case "ServiceTask":
|
|
917
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: s, height: s, viewBox: "0 0 16 16", fill: "none", children: [
|
|
918
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "2.5", stroke: c, strokeWidth: "1.5" }),
|
|
919
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
920
|
+
"path",
|
|
921
|
+
{
|
|
922
|
+
d: "M8 1v2M8 13v2M1 8h2M13 8h2M3.2 3.2l1.4 1.4M11.4 11.4l1.4 1.4M3.2 12.8l1.4-1.4M11.4 4.6l1.4-1.4",
|
|
923
|
+
stroke: c,
|
|
924
|
+
strokeWidth: "1.5",
|
|
925
|
+
strokeLinecap: "round"
|
|
926
|
+
}
|
|
927
|
+
)
|
|
928
|
+
] });
|
|
929
|
+
case "ScriptTask":
|
|
930
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: s, height: s, viewBox: "0 0 16 16", fill: "none", children: [
|
|
931
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "3", y: "2", width: "10", height: "12", rx: "1", stroke: c, strokeWidth: "1.5" }),
|
|
932
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 6h4M6 9h4M6 12h2", stroke: c, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
933
|
+
] });
|
|
934
|
+
case "ManualTask":
|
|
935
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: s, height: s, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
936
|
+
"path",
|
|
937
|
+
{
|
|
938
|
+
d: "M5 10V6a1 1 0 0 1 2 0v2a1 1 0 0 1 2 0v1a1 1 0 0 1 2 0v2c0 1.7-1.3 3-3 3H6a3 3 0 0 1-3-3V9.5",
|
|
939
|
+
stroke: c,
|
|
940
|
+
strokeWidth: "1.5",
|
|
941
|
+
strokeLinecap: "round",
|
|
942
|
+
strokeLinejoin: "round"
|
|
943
|
+
}
|
|
944
|
+
) });
|
|
945
|
+
case "BusinessRuleTask":
|
|
946
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: s, height: s, viewBox: "0 0 16 16", fill: "none", children: [
|
|
947
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "2", y: "3", width: "12", height: "10", rx: "1", stroke: c, strokeWidth: "1.5" }),
|
|
948
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 7h12M6 3v10", stroke: c, strokeWidth: "1.5" })
|
|
949
|
+
] });
|
|
950
|
+
case "ReceiveTask":
|
|
951
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: s, height: s, viewBox: "0 0 16 16", fill: "none", children: [
|
|
952
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "2", y: "4", width: "12", height: "8", rx: "1", stroke: c, strokeWidth: "1.5" }),
|
|
953
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 4l6 5 6-5", stroke: c, strokeWidth: "1.5", strokeLinecap: "round" })
|
|
954
|
+
] });
|
|
955
|
+
case "SendTask":
|
|
956
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: s, height: s, viewBox: "0 0 16 16", fill: c, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4zm1 0l5 4.5L13 4H3z" }) });
|
|
957
|
+
case "CallActivity":
|
|
958
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: s, height: s, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "3", y: "5", width: "10", height: "6", rx: "1", stroke: c, strokeWidth: "2" }) });
|
|
959
|
+
default:
|
|
960
|
+
return null;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
var MARKER_SIZE = 12;
|
|
964
|
+
var GAP = 3;
|
|
965
|
+
function TaskMarkers({ markers, stroke, size = MARKER_SIZE }) {
|
|
966
|
+
if (!markers || markers.length === 0) return null;
|
|
967
|
+
const total = markers.length * size + (markers.length - 1) * GAP;
|
|
968
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
969
|
+
"div",
|
|
970
|
+
{
|
|
971
|
+
style: {
|
|
972
|
+
position: "absolute",
|
|
973
|
+
bottom: 5,
|
|
974
|
+
left: "50%",
|
|
975
|
+
transform: "translateX(-50%)",
|
|
976
|
+
display: "flex",
|
|
977
|
+
alignItems: "center",
|
|
978
|
+
gap: GAP,
|
|
979
|
+
width: total
|
|
980
|
+
},
|
|
981
|
+
children: markers.map((m) => /* @__PURE__ */ jsxRuntime.jsx(MarkerIcon, { marker: m, stroke, size }, m))
|
|
982
|
+
}
|
|
983
|
+
);
|
|
984
|
+
}
|
|
985
|
+
function MarkerIcon({ marker, stroke, size }) {
|
|
986
|
+
const s = size / 2;
|
|
987
|
+
const sw = 1.3;
|
|
988
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
989
|
+
"svg",
|
|
990
|
+
{
|
|
991
|
+
width: size,
|
|
992
|
+
height: size,
|
|
993
|
+
viewBox: `${-s} ${-s} ${size} ${size}`,
|
|
994
|
+
style: { overflow: "visible", display: "block" },
|
|
995
|
+
children: [
|
|
996
|
+
marker === "loop" && // Circular arrow (↻)
|
|
997
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke, strokeWidth: sw, strokeLinecap: "round", children: [
|
|
998
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: `M 0,${-s * 0.85} A ${s * 0.85},${s * 0.85} 0 1 1 ${s * 0.6},${s * 0.6}` }),
|
|
999
|
+
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: `${s * 0.2},${s * 0.9} ${s * 0.6},${s * 0.6} ${s * 0.95},${s}` })
|
|
1000
|
+
] }),
|
|
1001
|
+
marker === "parallelMultiple" && // Three vertical bars |||
|
|
1002
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { stroke, strokeWidth: sw, strokeLinecap: "round", children: [
|
|
1003
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: -s * 0.55, y1: -s * 0.75, x2: -s * 0.55, y2: s * 0.75 }),
|
|
1004
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: 0, y1: -s * 0.75, x2: 0, y2: s * 0.75 }),
|
|
1005
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: s * 0.55, y1: -s * 0.75, x2: s * 0.55, y2: s * 0.75 })
|
|
1006
|
+
] }),
|
|
1007
|
+
marker === "sequentialMultiple" && // Three horizontal bars ≡
|
|
1008
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { stroke, strokeWidth: sw, strokeLinecap: "round", children: [
|
|
1009
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: -s * 0.75, y1: -s * 0.55, x2: s * 0.75, y2: -s * 0.55 }),
|
|
1010
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: -s * 0.75, y1: 0, x2: s * 0.75, y2: 0 }),
|
|
1011
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: -s * 0.75, y1: s * 0.55, x2: s * 0.75, y2: s * 0.55 })
|
|
1012
|
+
] }),
|
|
1013
|
+
marker === "compensation" && // Two left-pointing triangles <<
|
|
1014
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { fill: stroke, stroke, strokeWidth: 0.5, strokeLinejoin: "round", children: [
|
|
1015
|
+
/* @__PURE__ */ jsxRuntime.jsx("polygon", { points: `${s * 0.4},${-s * 0.7} ${-s * 0.2},0 ${s * 0.4},${s * 0.7}` }),
|
|
1016
|
+
/* @__PURE__ */ jsxRuntime.jsx("polygon", { points: `${s},${-s * 0.7} ${s * 0.4},0 ${s},${s * 0.7}` })
|
|
1017
|
+
] })
|
|
1018
|
+
]
|
|
1019
|
+
}
|
|
1020
|
+
);
|
|
1021
|
+
}
|
|
1022
|
+
function AdhocMarker({ stroke, size = MARKER_SIZE }) {
|
|
1023
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1024
|
+
"div",
|
|
1025
|
+
{
|
|
1026
|
+
style: {
|
|
1027
|
+
position: "absolute",
|
|
1028
|
+
bottom: 5,
|
|
1029
|
+
left: "50%",
|
|
1030
|
+
transform: "translateX(-50%)",
|
|
1031
|
+
color: stroke,
|
|
1032
|
+
fontSize: size,
|
|
1033
|
+
lineHeight: 1,
|
|
1034
|
+
fontFamily: "serif",
|
|
1035
|
+
userSelect: "none"
|
|
1036
|
+
},
|
|
1037
|
+
children: "~"
|
|
1038
|
+
}
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
function TaskNode({ data, selected }) {
|
|
1042
|
+
const d = data;
|
|
1043
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1044
|
+
const sw = resolveStrokeWidth(selected);
|
|
1045
|
+
const hasMarkers = d.markers && d.markers.length > 0;
|
|
1046
|
+
const borderWidth = d.elementType === "CallActivity" ? sw + 2 : sw;
|
|
1047
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1048
|
+
"div",
|
|
1049
|
+
{
|
|
1050
|
+
style: {
|
|
1051
|
+
width: "100%",
|
|
1052
|
+
height: "100%",
|
|
1053
|
+
background: d.color?.fill ?? BPMN_THEME.fill,
|
|
1054
|
+
border: `${borderWidth}px solid ${stroke}`,
|
|
1055
|
+
borderRadius: 6,
|
|
1056
|
+
boxSizing: "border-box",
|
|
1057
|
+
display: "flex",
|
|
1058
|
+
flexDirection: "column",
|
|
1059
|
+
alignItems: "center",
|
|
1060
|
+
justifyContent: "center",
|
|
1061
|
+
padding: hasMarkers ? "4px 8px 22px" : "4px 8px",
|
|
1062
|
+
position: "relative",
|
|
1063
|
+
fontFamily: BPMN_THEME.fontFamily
|
|
1064
|
+
},
|
|
1065
|
+
children: [
|
|
1066
|
+
d.elementType && d.elementType !== "Task" && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", top: 5, left: 5 }, children: /* @__PURE__ */ jsxRuntime.jsx(TaskIcon, { type: d.elementType, size: 14, color: stroke }) }),
|
|
1067
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { style: { width: "100%" }, children: d.label ?? d.elementType }),
|
|
1068
|
+
d.priority && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1069
|
+
"div",
|
|
1070
|
+
{
|
|
1071
|
+
title: d.priority,
|
|
1072
|
+
style: {
|
|
1073
|
+
position: "absolute",
|
|
1074
|
+
top: 5,
|
|
1075
|
+
right: 5,
|
|
1076
|
+
width: 8,
|
|
1077
|
+
height: 8,
|
|
1078
|
+
borderRadius: "50%",
|
|
1079
|
+
background: PRIORITY_COLOR[d.priority]
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
),
|
|
1083
|
+
hasMarkers && /* @__PURE__ */ jsxRuntime.jsx(TaskMarkers, { markers: d.markers, stroke }),
|
|
1084
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" })
|
|
1085
|
+
]
|
|
1086
|
+
}
|
|
1087
|
+
);
|
|
1088
|
+
}
|
|
1089
|
+
var PRIORITY_COLOR = {
|
|
1090
|
+
critical: "#ef4444",
|
|
1091
|
+
high: "#f97316",
|
|
1092
|
+
medium: "#eab308",
|
|
1093
|
+
low: "#22c55e"
|
|
1094
|
+
};
|
|
1095
|
+
var SIZE4 = 50;
|
|
1096
|
+
var H = SIZE4 / 2;
|
|
1097
|
+
var DIAMOND = `${H},2 ${SIZE4 - 2},${H} ${H},${SIZE4 - 2} 2,${H}`;
|
|
1098
|
+
function GatewaySymbol({ type, stroke }) {
|
|
1099
|
+
const c = H;
|
|
1100
|
+
switch (type) {
|
|
1101
|
+
case "ExclusiveGateway":
|
|
1102
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { stroke, strokeWidth: "2.5", strokeLinecap: "round", children: [
|
|
1103
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: c - 7, y1: c - 7, x2: c + 7, y2: c + 7 }),
|
|
1104
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: c + 7, y1: c - 7, x2: c - 7, y2: c + 7 })
|
|
1105
|
+
] });
|
|
1106
|
+
case "InclusiveGateway":
|
|
1107
|
+
return /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: c, cy: c, r: 8, fill: "none", stroke, strokeWidth: "2" });
|
|
1108
|
+
case "ParallelGateway":
|
|
1109
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { stroke, strokeWidth: "2.5", strokeLinecap: "round", children: [
|
|
1110
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: c, y1: c - 9, x2: c, y2: c + 9 }),
|
|
1111
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: c - 9, y1: c, x2: c + 9, y2: c })
|
|
1112
|
+
] });
|
|
1113
|
+
case "EventBasedGateway":
|
|
1114
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
1115
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: c, cy: c, r: 9, fill: "none", stroke, strokeWidth: "1.5" }),
|
|
1116
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: c, cy: c, r: 6, fill: "none", stroke, strokeWidth: "1.2" }),
|
|
1117
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1118
|
+
"polygon",
|
|
1119
|
+
{
|
|
1120
|
+
points: `${c},${c - 5.5} ${c + 5.2},${c - 1.7} ${c + 3.2},${c + 4.8} ${c - 3.2},${c + 4.8} ${c - 5.2},${c - 1.7}`,
|
|
1121
|
+
fill: "none",
|
|
1122
|
+
stroke,
|
|
1123
|
+
strokeWidth: "1.4",
|
|
1124
|
+
strokeLinejoin: "round"
|
|
1125
|
+
}
|
|
1126
|
+
)
|
|
1127
|
+
] });
|
|
1128
|
+
case "ComplexGateway":
|
|
1129
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { stroke, strokeWidth: "2", strokeLinecap: "round", children: [
|
|
1130
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: c, y1: c - 9, x2: c, y2: c + 9 }),
|
|
1131
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: c - 9, y1: c, x2: c + 9, y2: c }),
|
|
1132
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: c - 6, y1: c - 6, x2: c + 6, y2: c + 6 }),
|
|
1133
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: c + 6, y1: c - 6, x2: c - 6, y2: c + 6 })
|
|
1134
|
+
] });
|
|
1135
|
+
default:
|
|
1136
|
+
return null;
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
function GatewayNode({ data, selected }) {
|
|
1140
|
+
const d = data;
|
|
1141
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1142
|
+
const sw = resolveStrokeWidth(selected);
|
|
1143
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: SIZE4, height: SIZE4, position: "relative" }, children: [
|
|
1144
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: SIZE4, height: SIZE4, style: { overflow: "visible", display: "block" }, children: [
|
|
1145
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1146
|
+
"polygon",
|
|
1147
|
+
{
|
|
1148
|
+
points: DIAMOND,
|
|
1149
|
+
fill: d.color?.fill ?? BPMN_THEME.fill,
|
|
1150
|
+
stroke,
|
|
1151
|
+
strokeWidth: sw
|
|
1152
|
+
}
|
|
1153
|
+
),
|
|
1154
|
+
/* @__PURE__ */ jsxRuntime.jsx(GatewaySymbol, { type: d.elementType, stroke })
|
|
1155
|
+
] }),
|
|
1156
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" }),
|
|
1157
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { external: true, children: d.label })
|
|
1158
|
+
] });
|
|
1159
|
+
}
|
|
1160
|
+
function SubProcessNode({ data, selected }) {
|
|
1161
|
+
const d = data;
|
|
1162
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1163
|
+
const sw = resolveStrokeWidth(selected);
|
|
1164
|
+
const variant = d.subProcessVariant ?? "embedded";
|
|
1165
|
+
const isExpanded = d.isExpanded ?? true;
|
|
1166
|
+
const hasMarkers = d.markers && d.markers.length > 0;
|
|
1167
|
+
const borderStyle = variant === "event" ? "dashed" : "solid";
|
|
1168
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1169
|
+
"div",
|
|
1170
|
+
{
|
|
1171
|
+
style: {
|
|
1172
|
+
width: "100%",
|
|
1173
|
+
height: "100%",
|
|
1174
|
+
background: d.color?.fill ?? "#f8faff",
|
|
1175
|
+
border: `${sw}px ${borderStyle} ${stroke}`,
|
|
1176
|
+
borderRadius: 6,
|
|
1177
|
+
boxSizing: "border-box",
|
|
1178
|
+
position: "relative",
|
|
1179
|
+
fontFamily: BPMN_THEME.fontFamily
|
|
1180
|
+
},
|
|
1181
|
+
children: [
|
|
1182
|
+
variant === "transaction" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1183
|
+
"div",
|
|
1184
|
+
{
|
|
1185
|
+
style: {
|
|
1186
|
+
position: "absolute",
|
|
1187
|
+
inset: 4,
|
|
1188
|
+
border: `${sw}px solid ${stroke}`,
|
|
1189
|
+
borderRadius: 4,
|
|
1190
|
+
pointerEvents: "none"
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
),
|
|
1194
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { style: { padding: "4px 8px" }, children: d.label }),
|
|
1195
|
+
!isExpanded && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1196
|
+
"div",
|
|
1197
|
+
{
|
|
1198
|
+
"aria-label": "collapsed-subprocess-marker",
|
|
1199
|
+
style: {
|
|
1200
|
+
position: "absolute",
|
|
1201
|
+
bottom: 6,
|
|
1202
|
+
left: "50%",
|
|
1203
|
+
transform: "translateX(-50%)",
|
|
1204
|
+
width: 16,
|
|
1205
|
+
height: 16,
|
|
1206
|
+
border: `1.5px solid ${stroke}`,
|
|
1207
|
+
borderRadius: 2,
|
|
1208
|
+
display: "flex",
|
|
1209
|
+
alignItems: "center",
|
|
1210
|
+
justifyContent: "center",
|
|
1211
|
+
fontSize: 12,
|
|
1212
|
+
color: stroke,
|
|
1213
|
+
background: BPMN_THEME.fill,
|
|
1214
|
+
zIndex: 1
|
|
1215
|
+
},
|
|
1216
|
+
children: "+"
|
|
1217
|
+
}
|
|
1218
|
+
),
|
|
1219
|
+
variant === "adhoc" && /* @__PURE__ */ jsxRuntime.jsx(AdhocMarker, { stroke }),
|
|
1220
|
+
hasMarkers && /* @__PURE__ */ jsxRuntime.jsx(TaskMarkers, { markers: d.markers, stroke }),
|
|
1221
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" })
|
|
1222
|
+
]
|
|
1223
|
+
}
|
|
1224
|
+
);
|
|
1225
|
+
}
|
|
1226
|
+
var HEADER_WIDTH = 30;
|
|
1227
|
+
var HEADER_HEIGHT = 28;
|
|
1228
|
+
function PoolNode({ data, selected }) {
|
|
1229
|
+
const d = data;
|
|
1230
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1231
|
+
const sw = resolveStrokeWidth(selected);
|
|
1232
|
+
const orientation = d.orientation ?? "horizontal";
|
|
1233
|
+
const fill = d.color?.fill ?? "#f5f7ff";
|
|
1234
|
+
const headerFill = d.color?.fill ?? "#edf0ff";
|
|
1235
|
+
if (orientation === "vertical") {
|
|
1236
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1237
|
+
"div",
|
|
1238
|
+
{
|
|
1239
|
+
style: {
|
|
1240
|
+
width: "100%",
|
|
1241
|
+
height: "100%",
|
|
1242
|
+
display: "flex",
|
|
1243
|
+
flexDirection: "column",
|
|
1244
|
+
border: `${sw}px solid ${stroke}`,
|
|
1245
|
+
borderRadius: 4,
|
|
1246
|
+
boxSizing: "border-box",
|
|
1247
|
+
background: fill,
|
|
1248
|
+
overflow: "hidden",
|
|
1249
|
+
fontFamily: BPMN_THEME.fontFamily
|
|
1250
|
+
},
|
|
1251
|
+
children: [
|
|
1252
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1253
|
+
"div",
|
|
1254
|
+
{
|
|
1255
|
+
"aria-label": "pool-header",
|
|
1256
|
+
style: {
|
|
1257
|
+
height: HEADER_HEIGHT,
|
|
1258
|
+
minHeight: HEADER_HEIGHT,
|
|
1259
|
+
borderBottom: `${sw}px solid ${stroke}`,
|
|
1260
|
+
display: "flex",
|
|
1261
|
+
alignItems: "center",
|
|
1262
|
+
justifyContent: "center",
|
|
1263
|
+
background: headerFill,
|
|
1264
|
+
padding: "0 8px"
|
|
1265
|
+
},
|
|
1266
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1267
|
+
"span",
|
|
1268
|
+
{
|
|
1269
|
+
style: {
|
|
1270
|
+
fontSize: BPMN_THEME.fontSize,
|
|
1271
|
+
fontWeight: 600,
|
|
1272
|
+
color: BPMN_THEME.labelColor,
|
|
1273
|
+
whiteSpace: "nowrap",
|
|
1274
|
+
overflow: "hidden",
|
|
1275
|
+
textOverflow: "ellipsis"
|
|
1276
|
+
},
|
|
1277
|
+
children: d.label
|
|
1278
|
+
}
|
|
1279
|
+
)
|
|
1280
|
+
}
|
|
1281
|
+
),
|
|
1282
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, position: "relative" } })
|
|
1283
|
+
]
|
|
1284
|
+
}
|
|
1285
|
+
);
|
|
1286
|
+
}
|
|
1287
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1288
|
+
"div",
|
|
1289
|
+
{
|
|
1290
|
+
style: {
|
|
1291
|
+
width: "100%",
|
|
1292
|
+
height: "100%",
|
|
1293
|
+
display: "flex",
|
|
1294
|
+
border: `${sw}px solid ${stroke}`,
|
|
1295
|
+
borderRadius: 4,
|
|
1296
|
+
boxSizing: "border-box",
|
|
1297
|
+
background: fill,
|
|
1298
|
+
overflow: "hidden",
|
|
1299
|
+
fontFamily: BPMN_THEME.fontFamily
|
|
1300
|
+
},
|
|
1301
|
+
children: [
|
|
1302
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1303
|
+
"div",
|
|
1304
|
+
{
|
|
1305
|
+
"aria-label": "pool-header",
|
|
1306
|
+
style: {
|
|
1307
|
+
width: HEADER_WIDTH,
|
|
1308
|
+
minWidth: HEADER_WIDTH,
|
|
1309
|
+
borderRight: `${sw}px solid ${stroke}`,
|
|
1310
|
+
display: "flex",
|
|
1311
|
+
alignItems: "center",
|
|
1312
|
+
justifyContent: "center",
|
|
1313
|
+
background: headerFill
|
|
1314
|
+
},
|
|
1315
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1316
|
+
"span",
|
|
1317
|
+
{
|
|
1318
|
+
style: {
|
|
1319
|
+
writingMode: "vertical-rl",
|
|
1320
|
+
transform: "rotate(180deg)",
|
|
1321
|
+
fontSize: BPMN_THEME.fontSize,
|
|
1322
|
+
fontWeight: 600,
|
|
1323
|
+
color: BPMN_THEME.labelColor,
|
|
1324
|
+
whiteSpace: "nowrap",
|
|
1325
|
+
overflow: "hidden",
|
|
1326
|
+
textOverflow: "ellipsis",
|
|
1327
|
+
maxHeight: "90%"
|
|
1328
|
+
},
|
|
1329
|
+
children: d.label
|
|
1330
|
+
}
|
|
1331
|
+
)
|
|
1332
|
+
}
|
|
1333
|
+
),
|
|
1334
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, position: "relative" } })
|
|
1335
|
+
]
|
|
1336
|
+
}
|
|
1337
|
+
);
|
|
1338
|
+
}
|
|
1339
|
+
var HEADER_HEIGHT2 = 24;
|
|
1340
|
+
var HEADER_WIDTH2 = 28;
|
|
1341
|
+
function LaneNode({ data, selected }) {
|
|
1342
|
+
const d = data;
|
|
1343
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1344
|
+
const sw = resolveStrokeWidth(selected);
|
|
1345
|
+
const orientation = d.orientation ?? "horizontal";
|
|
1346
|
+
const fill = d.color?.fill ?? "#fafbff";
|
|
1347
|
+
const headerFill = d.color?.fill ?? "#f0f3ff";
|
|
1348
|
+
if (orientation === "vertical") {
|
|
1349
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1350
|
+
"div",
|
|
1351
|
+
{
|
|
1352
|
+
style: {
|
|
1353
|
+
width: "100%",
|
|
1354
|
+
height: "100%",
|
|
1355
|
+
display: "flex",
|
|
1356
|
+
border: `${sw}px solid ${stroke}`,
|
|
1357
|
+
borderRadius: 2,
|
|
1358
|
+
boxSizing: "border-box",
|
|
1359
|
+
background: fill,
|
|
1360
|
+
overflow: "hidden",
|
|
1361
|
+
fontFamily: BPMN_THEME.fontFamily
|
|
1362
|
+
},
|
|
1363
|
+
children: [
|
|
1364
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1365
|
+
"div",
|
|
1366
|
+
{
|
|
1367
|
+
"aria-label": "lane-header",
|
|
1368
|
+
style: {
|
|
1369
|
+
width: HEADER_WIDTH2,
|
|
1370
|
+
minWidth: HEADER_WIDTH2,
|
|
1371
|
+
borderRight: `1px solid ${stroke}`,
|
|
1372
|
+
display: "flex",
|
|
1373
|
+
alignItems: "center",
|
|
1374
|
+
justifyContent: "center",
|
|
1375
|
+
background: headerFill,
|
|
1376
|
+
padding: "6px 0"
|
|
1377
|
+
},
|
|
1378
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1379
|
+
"span",
|
|
1380
|
+
{
|
|
1381
|
+
style: {
|
|
1382
|
+
writingMode: "vertical-rl",
|
|
1383
|
+
transform: "rotate(180deg)",
|
|
1384
|
+
fontSize: BPMN_THEME.fontSize,
|
|
1385
|
+
fontWeight: 500,
|
|
1386
|
+
color: BPMN_THEME.labelColor,
|
|
1387
|
+
whiteSpace: "nowrap",
|
|
1388
|
+
overflow: "hidden",
|
|
1389
|
+
textOverflow: "ellipsis",
|
|
1390
|
+
maxHeight: "90%"
|
|
1391
|
+
},
|
|
1392
|
+
children: d.label
|
|
1393
|
+
}
|
|
1394
|
+
)
|
|
1395
|
+
}
|
|
1396
|
+
),
|
|
1397
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, position: "relative" } })
|
|
1398
|
+
]
|
|
1399
|
+
}
|
|
1400
|
+
);
|
|
1401
|
+
}
|
|
1402
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1403
|
+
"div",
|
|
1404
|
+
{
|
|
1405
|
+
style: {
|
|
1406
|
+
width: "100%",
|
|
1407
|
+
height: "100%",
|
|
1408
|
+
display: "flex",
|
|
1409
|
+
flexDirection: "column",
|
|
1410
|
+
border: `${sw}px solid ${stroke}`,
|
|
1411
|
+
borderRadius: 2,
|
|
1412
|
+
boxSizing: "border-box",
|
|
1413
|
+
background: fill,
|
|
1414
|
+
overflow: "hidden",
|
|
1415
|
+
fontFamily: BPMN_THEME.fontFamily
|
|
1416
|
+
},
|
|
1417
|
+
children: [
|
|
1418
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1419
|
+
"div",
|
|
1420
|
+
{
|
|
1421
|
+
"aria-label": "lane-header",
|
|
1422
|
+
style: {
|
|
1423
|
+
height: HEADER_HEIGHT2,
|
|
1424
|
+
minHeight: HEADER_HEIGHT2,
|
|
1425
|
+
borderBottom: `1px solid ${stroke}`,
|
|
1426
|
+
display: "flex",
|
|
1427
|
+
alignItems: "center",
|
|
1428
|
+
paddingLeft: 8,
|
|
1429
|
+
background: headerFill,
|
|
1430
|
+
fontSize: BPMN_THEME.fontSize,
|
|
1431
|
+
fontWeight: 500,
|
|
1432
|
+
color: BPMN_THEME.labelColor
|
|
1433
|
+
},
|
|
1434
|
+
children: d.label
|
|
1435
|
+
}
|
|
1436
|
+
),
|
|
1437
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, position: "relative" } })
|
|
1438
|
+
]
|
|
1439
|
+
}
|
|
1440
|
+
);
|
|
1441
|
+
}
|
|
1442
|
+
var HANDLE_STYLE2 = { opacity: 0, width: 6, height: 6 };
|
|
1443
|
+
function AnnotationNode({ data, selected }) {
|
|
1444
|
+
const d = data;
|
|
1445
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1446
|
+
const sw = resolveStrokeWidth(selected);
|
|
1447
|
+
const orientation = d.orientation ?? "vertical";
|
|
1448
|
+
if (orientation === "horizontal") {
|
|
1449
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1450
|
+
"div",
|
|
1451
|
+
{
|
|
1452
|
+
style: {
|
|
1453
|
+
width: "100%",
|
|
1454
|
+
height: "100%",
|
|
1455
|
+
boxSizing: "border-box",
|
|
1456
|
+
borderTop: `${sw + 1}px solid ${stroke}`,
|
|
1457
|
+
borderLeft: `${sw}px solid ${stroke}`,
|
|
1458
|
+
borderRight: `${sw}px solid ${stroke}`,
|
|
1459
|
+
padding: "8px 6px",
|
|
1460
|
+
background: "transparent",
|
|
1461
|
+
fontFamily: BPMN_THEME.fontFamily,
|
|
1462
|
+
fontSize: BPMN_THEME.fontSize,
|
|
1463
|
+
color: BPMN_THEME.labelColor,
|
|
1464
|
+
lineHeight: 1.4
|
|
1465
|
+
},
|
|
1466
|
+
children: [
|
|
1467
|
+
d.label,
|
|
1468
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Handle, { type: "target", position: react.Position.Left, id: "target-left", style: HANDLE_STYLE2 }),
|
|
1469
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Handle, { type: "target", position: react.Position.Right, id: "target-right", style: HANDLE_STYLE2 }),
|
|
1470
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Handle, { type: "source", position: react.Position.Left, id: "source-left", style: HANDLE_STYLE2 }),
|
|
1471
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Handle, { type: "source", position: react.Position.Right, id: "source-right", style: HANDLE_STYLE2 })
|
|
1472
|
+
]
|
|
1473
|
+
}
|
|
1474
|
+
);
|
|
1475
|
+
}
|
|
1476
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1477
|
+
"div",
|
|
1478
|
+
{
|
|
1479
|
+
style: {
|
|
1480
|
+
width: "100%",
|
|
1481
|
+
height: "100%",
|
|
1482
|
+
boxSizing: "border-box",
|
|
1483
|
+
borderLeft: `${sw + 1}px solid ${stroke}`,
|
|
1484
|
+
borderTop: `${sw}px solid ${stroke}`,
|
|
1485
|
+
borderBottom: `${sw}px solid ${stroke}`,
|
|
1486
|
+
padding: "4px 8px",
|
|
1487
|
+
background: "transparent",
|
|
1488
|
+
fontFamily: BPMN_THEME.fontFamily,
|
|
1489
|
+
fontSize: BPMN_THEME.fontSize,
|
|
1490
|
+
color: BPMN_THEME.labelColor,
|
|
1491
|
+
lineHeight: 1.4
|
|
1492
|
+
},
|
|
1493
|
+
children: [
|
|
1494
|
+
d.label,
|
|
1495
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Handle, { type: "target", position: react.Position.Top, id: "target-top", style: HANDLE_STYLE2 }),
|
|
1496
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Handle, { type: "target", position: react.Position.Bottom, id: "target-bottom", style: HANDLE_STYLE2 }),
|
|
1497
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Handle, { type: "source", position: react.Position.Top, id: "source-top", style: HANDLE_STYLE2 }),
|
|
1498
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Handle, { type: "source", position: react.Position.Bottom, id: "source-bottom", style: HANDLE_STYLE2 })
|
|
1499
|
+
]
|
|
1500
|
+
}
|
|
1501
|
+
);
|
|
1502
|
+
}
|
|
1503
|
+
function GroupNode({ data, selected }) {
|
|
1504
|
+
const d = data;
|
|
1505
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1506
|
+
const sw = resolveStrokeWidth(selected);
|
|
1507
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1508
|
+
"div",
|
|
1509
|
+
{
|
|
1510
|
+
style: {
|
|
1511
|
+
width: "100%",
|
|
1512
|
+
height: "100%",
|
|
1513
|
+
border: `${sw}px dashed ${stroke}`,
|
|
1514
|
+
borderRadius: 8,
|
|
1515
|
+
boxSizing: "border-box",
|
|
1516
|
+
background: "transparent",
|
|
1517
|
+
padding: "4px 8px",
|
|
1518
|
+
fontFamily: BPMN_THEME.fontFamily,
|
|
1519
|
+
fontSize: BPMN_THEME.fontSize,
|
|
1520
|
+
color: BPMN_THEME.labelColor,
|
|
1521
|
+
fontStyle: "italic"
|
|
1522
|
+
},
|
|
1523
|
+
children: d.label
|
|
1524
|
+
}
|
|
1525
|
+
);
|
|
1526
|
+
}
|
|
1527
|
+
var W = 36;
|
|
1528
|
+
var H2 = 50;
|
|
1529
|
+
var FOLD = 10;
|
|
1530
|
+
function DataObjectNode({ data, selected }) {
|
|
1531
|
+
const d = data;
|
|
1532
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1533
|
+
const sw = resolveStrokeWidth(selected);
|
|
1534
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1535
|
+
const path = [
|
|
1536
|
+
`M 0 0`,
|
|
1537
|
+
`L ${W - FOLD} 0`,
|
|
1538
|
+
`L ${W} ${FOLD}`,
|
|
1539
|
+
`L ${W} ${H2}`,
|
|
1540
|
+
`L 0 ${H2}`,
|
|
1541
|
+
`Z`
|
|
1542
|
+
].join(" ");
|
|
1543
|
+
const foldPath2 = [
|
|
1544
|
+
`M ${W - FOLD} 0`,
|
|
1545
|
+
`L ${W - FOLD} ${FOLD}`,
|
|
1546
|
+
`L ${W} ${FOLD}`
|
|
1547
|
+
].join(" ");
|
|
1548
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: W, height: H2, position: "relative" }, children: [
|
|
1549
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: W, height: H2, style: { overflow: "visible", display: "block" }, children: [
|
|
1550
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: path, fill, stroke, strokeWidth: sw }),
|
|
1551
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: foldPath2, fill: "none", stroke, strokeWidth: sw })
|
|
1552
|
+
] }),
|
|
1553
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" }),
|
|
1554
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { external: true, children: d.label })
|
|
1555
|
+
] });
|
|
1556
|
+
}
|
|
1557
|
+
var DS_W = 50;
|
|
1558
|
+
var DS_H = 50;
|
|
1559
|
+
var RX = DS_W / 2;
|
|
1560
|
+
var RY = 7;
|
|
1561
|
+
function DataStoreNode({ data, selected }) {
|
|
1562
|
+
const d = data;
|
|
1563
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1564
|
+
const sw = resolveStrokeWidth(selected);
|
|
1565
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1566
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: DS_W, height: DS_H, position: "relative" }, children: [
|
|
1567
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: DS_W, height: DS_H, style: { overflow: "visible", display: "block" }, children: [
|
|
1568
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1569
|
+
"path",
|
|
1570
|
+
{
|
|
1571
|
+
d: `M 0 ${RY} Q 0 0 ${RX} 0 Q ${DS_W} 0 ${DS_W} ${RY} L ${DS_W} ${DS_H - RY} Q ${DS_W} ${DS_H} ${RX} ${DS_H} Q 0 ${DS_H} 0 ${DS_H - RY} Z`,
|
|
1572
|
+
fill,
|
|
1573
|
+
stroke,
|
|
1574
|
+
strokeWidth: sw
|
|
1575
|
+
}
|
|
1576
|
+
),
|
|
1577
|
+
/* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: RX, cy: RY, rx: RX, ry: RY, fill, stroke, strokeWidth: sw })
|
|
1578
|
+
] }),
|
|
1579
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" }),
|
|
1580
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { external: true, children: d.label })
|
|
1581
|
+
] });
|
|
1582
|
+
}
|
|
1583
|
+
var W2 = 36;
|
|
1584
|
+
var H3 = 50;
|
|
1585
|
+
var FOLD2 = 10;
|
|
1586
|
+
function documentPath() {
|
|
1587
|
+
return [
|
|
1588
|
+
`M 0 0`,
|
|
1589
|
+
`L ${W2 - FOLD2} 0`,
|
|
1590
|
+
`L ${W2} ${FOLD2}`,
|
|
1591
|
+
`L ${W2} ${H3}`,
|
|
1592
|
+
`L 0 ${H3}`,
|
|
1593
|
+
`Z`
|
|
1594
|
+
].join(" ");
|
|
1595
|
+
}
|
|
1596
|
+
function foldPath() {
|
|
1597
|
+
return [`M ${W2 - FOLD2} 0`, `L ${W2 - FOLD2} ${FOLD2}`, `L ${W2} ${FOLD2}`].join(" ");
|
|
1598
|
+
}
|
|
1599
|
+
function collectionLines(stroke, sw) {
|
|
1600
|
+
const y = H3 - 8;
|
|
1601
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { stroke, strokeWidth: sw * 0.7, strokeLinecap: "round", children: [
|
|
1602
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: W2 * 0.25, y1: y, x2: W2 * 0.75, y2: y }),
|
|
1603
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: W2 * 0.25, y1: y + 3, x2: W2 * 0.75, y2: y + 3 }),
|
|
1604
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: W2 * 0.25, y1: y + 6, x2: W2 * 0.75, y2: y + 6 })
|
|
1605
|
+
] });
|
|
1606
|
+
}
|
|
1607
|
+
function DataObjectReferenceNode({ data, selected }) {
|
|
1608
|
+
const d = data;
|
|
1609
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1610
|
+
const sw = resolveStrokeWidth(selected);
|
|
1611
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1612
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: W2, height: H3, position: "relative" }, children: [
|
|
1613
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: W2, height: H3, style: { overflow: "visible", display: "block" }, children: [
|
|
1614
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: documentPath(), fill, stroke, strokeWidth: sw }),
|
|
1615
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: foldPath(), fill: "none", stroke, strokeWidth: sw }),
|
|
1616
|
+
d.isCollection && collectionLines(stroke, sw)
|
|
1617
|
+
] }),
|
|
1618
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" }),
|
|
1619
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { external: true, children: d.label })
|
|
1620
|
+
] });
|
|
1621
|
+
}
|
|
1622
|
+
function DataInputNode({ data, selected }) {
|
|
1623
|
+
const d = data;
|
|
1624
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1625
|
+
const sw = resolveStrokeWidth(selected);
|
|
1626
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1627
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: W2, height: H3, position: "relative" }, children: [
|
|
1628
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: W2, height: H3, style: { overflow: "visible", display: "block" }, children: [
|
|
1629
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: documentPath(), fill, stroke, strokeWidth: sw }),
|
|
1630
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: foldPath(), fill: "none", stroke, strokeWidth: sw }),
|
|
1631
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1632
|
+
"polygon",
|
|
1633
|
+
{
|
|
1634
|
+
points: `2,4 8,8 2,12`,
|
|
1635
|
+
fill: "none",
|
|
1636
|
+
stroke,
|
|
1637
|
+
strokeWidth: sw * 0.8
|
|
1638
|
+
}
|
|
1639
|
+
),
|
|
1640
|
+
d.isCollection && collectionLines(stroke, sw)
|
|
1641
|
+
] }),
|
|
1642
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "target" }),
|
|
1643
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { external: true, children: d.label })
|
|
1644
|
+
] });
|
|
1645
|
+
}
|
|
1646
|
+
function DataOutputNode({ data, selected }) {
|
|
1647
|
+
const d = data;
|
|
1648
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1649
|
+
const sw = resolveStrokeWidth(selected);
|
|
1650
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1651
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: W2, height: H3, position: "relative" }, children: [
|
|
1652
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: W2, height: H3, style: { overflow: "visible", display: "block" }, children: [
|
|
1653
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: documentPath(), fill, stroke, strokeWidth: sw }),
|
|
1654
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: foldPath(), fill: "none", stroke, strokeWidth: sw }),
|
|
1655
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1656
|
+
"polygon",
|
|
1657
|
+
{
|
|
1658
|
+
points: `2,4 8,8 2,12`,
|
|
1659
|
+
fill: stroke,
|
|
1660
|
+
stroke,
|
|
1661
|
+
strokeWidth: sw * 0.8
|
|
1662
|
+
}
|
|
1663
|
+
),
|
|
1664
|
+
d.isCollection && collectionLines(stroke, sw)
|
|
1665
|
+
] }),
|
|
1666
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "source" }),
|
|
1667
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { external: true, children: d.label })
|
|
1668
|
+
] });
|
|
1669
|
+
}
|
|
1670
|
+
var DS_W2 = 50;
|
|
1671
|
+
var DS_H2 = 50;
|
|
1672
|
+
var RX2 = DS_W2 / 2;
|
|
1673
|
+
var RY2 = 7;
|
|
1674
|
+
function DataStoreReferenceNode({ data, selected }) {
|
|
1675
|
+
const d = data;
|
|
1676
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1677
|
+
const sw = resolveStrokeWidth(selected);
|
|
1678
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1679
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: DS_W2, height: DS_H2, position: "relative" }, children: [
|
|
1680
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: DS_W2, height: DS_H2, style: { overflow: "visible", display: "block" }, children: [
|
|
1681
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1682
|
+
"path",
|
|
1683
|
+
{
|
|
1684
|
+
d: `M 0 ${RY2} Q 0 0 ${RX2} 0 Q ${DS_W2} 0 ${DS_W2} ${RY2} L ${DS_W2} ${DS_H2 - RY2} Q ${DS_W2} ${DS_H2} ${RX2} ${DS_H2} Q 0 ${DS_H2} 0 ${DS_H2 - RY2} Z`,
|
|
1685
|
+
fill,
|
|
1686
|
+
stroke,
|
|
1687
|
+
strokeWidth: sw
|
|
1688
|
+
}
|
|
1689
|
+
),
|
|
1690
|
+
/* @__PURE__ */ jsxRuntime.jsx("ellipse", { cx: RX2, cy: RY2, rx: RX2, ry: RY2, fill, stroke, strokeWidth: sw })
|
|
1691
|
+
] }),
|
|
1692
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" }),
|
|
1693
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { external: true, children: d.label })
|
|
1694
|
+
] });
|
|
1695
|
+
}
|
|
1696
|
+
var W3 = 60;
|
|
1697
|
+
var H4 = 52;
|
|
1698
|
+
var INDENT = W3 / 4;
|
|
1699
|
+
function hexPoints() {
|
|
1700
|
+
return [
|
|
1701
|
+
`0,${H4 / 2}`,
|
|
1702
|
+
`${INDENT},0`,
|
|
1703
|
+
`${W3 - INDENT},0`,
|
|
1704
|
+
`${W3},${H4 / 2}`,
|
|
1705
|
+
`${W3 - INDENT},${H4}`,
|
|
1706
|
+
`${INDENT},${H4}`
|
|
1707
|
+
].join(" ");
|
|
1708
|
+
}
|
|
1709
|
+
function HexShell({
|
|
1710
|
+
fill,
|
|
1711
|
+
stroke,
|
|
1712
|
+
sw,
|
|
1713
|
+
thick = false
|
|
1714
|
+
}) {
|
|
1715
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1716
|
+
"polygon",
|
|
1717
|
+
{
|
|
1718
|
+
points: hexPoints(),
|
|
1719
|
+
fill,
|
|
1720
|
+
stroke,
|
|
1721
|
+
strokeWidth: thick ? sw + 2 : sw
|
|
1722
|
+
}
|
|
1723
|
+
);
|
|
1724
|
+
}
|
|
1725
|
+
function ConversationNode({ data, selected }) {
|
|
1726
|
+
const d = data;
|
|
1727
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1728
|
+
const sw = resolveStrokeWidth(selected);
|
|
1729
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1730
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: W3, height: H4, position: "relative" }, children: [
|
|
1731
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: W3, height: H4, style: { overflow: "visible", display: "block" }, children: /* @__PURE__ */ jsxRuntime.jsx(HexShell, { fill, stroke, sw }) }),
|
|
1732
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" }),
|
|
1733
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { style: { textAlign: "center" }, children: d.label })
|
|
1734
|
+
] });
|
|
1735
|
+
}
|
|
1736
|
+
function SubConversationNode({ data, selected }) {
|
|
1737
|
+
const d = data;
|
|
1738
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1739
|
+
const sw = resolveStrokeWidth(selected);
|
|
1740
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1741
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: W3, height: H4, position: "relative" }, children: [
|
|
1742
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: W3, height: H4, style: { overflow: "visible", display: "block" }, children: [
|
|
1743
|
+
/* @__PURE__ */ jsxRuntime.jsx(HexShell, { fill, stroke, sw }),
|
|
1744
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1745
|
+
"rect",
|
|
1746
|
+
{
|
|
1747
|
+
x: W3 / 2 - 7,
|
|
1748
|
+
y: H4 - 15,
|
|
1749
|
+
width: 14,
|
|
1750
|
+
height: 12,
|
|
1751
|
+
rx: 2,
|
|
1752
|
+
fill,
|
|
1753
|
+
stroke,
|
|
1754
|
+
strokeWidth: sw * 0.8
|
|
1755
|
+
}
|
|
1756
|
+
),
|
|
1757
|
+
/* @__PURE__ */ jsxRuntime.jsx("text", { x: W3 / 2, y: H4 - 6, textAnchor: "middle", fontSize: 10, fill: stroke, fontFamily: BPMN_THEME.fontFamily, children: "+" })
|
|
1758
|
+
] }),
|
|
1759
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" }),
|
|
1760
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { style: { textAlign: "center" }, children: d.label })
|
|
1761
|
+
] });
|
|
1762
|
+
}
|
|
1763
|
+
function CallConversationNode({ data, selected }) {
|
|
1764
|
+
const d = data;
|
|
1765
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1766
|
+
const sw = resolveStrokeWidth(selected);
|
|
1767
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1768
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: W3, height: H4, position: "relative" }, children: [
|
|
1769
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: W3, height: H4, style: { overflow: "visible", display: "block" }, children: [
|
|
1770
|
+
/* @__PURE__ */ jsxRuntime.jsx(HexShell, { fill, stroke, sw, thick: true }),
|
|
1771
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1772
|
+
"rect",
|
|
1773
|
+
{
|
|
1774
|
+
x: W3 / 2 - 7,
|
|
1775
|
+
y: H4 - 15,
|
|
1776
|
+
width: 14,
|
|
1777
|
+
height: 12,
|
|
1778
|
+
rx: 2,
|
|
1779
|
+
fill,
|
|
1780
|
+
stroke,
|
|
1781
|
+
strokeWidth: sw * 0.8
|
|
1782
|
+
}
|
|
1783
|
+
),
|
|
1784
|
+
/* @__PURE__ */ jsxRuntime.jsx("text", { x: W3 / 2, y: H4 - 6, textAnchor: "middle", fontSize: 10, fill: stroke, fontFamily: BPMN_THEME.fontFamily, children: "+" })
|
|
1785
|
+
] }),
|
|
1786
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" }),
|
|
1787
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnLabel, { style: { textAlign: "center" }, children: d.label })
|
|
1788
|
+
] });
|
|
1789
|
+
}
|
|
1790
|
+
var BAND_H = 20;
|
|
1791
|
+
var RADIUS = 6;
|
|
1792
|
+
function ChoreographyShell({ d, stroke, sw, thick = false, collapsed = false }) {
|
|
1793
|
+
const participants = d.participants ?? [
|
|
1794
|
+
{ name: "Initiator", isInitiating: true },
|
|
1795
|
+
{ name: "Responder", isInitiating: false }
|
|
1796
|
+
];
|
|
1797
|
+
const fill = d.color?.fill ?? BPMN_THEME.fill;
|
|
1798
|
+
const respondFill = "#c8d8e8";
|
|
1799
|
+
const bw = thick ? sw + 2 : sw;
|
|
1800
|
+
const [topParticipant, ...rest] = participants;
|
|
1801
|
+
const bottomParticipants = rest;
|
|
1802
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1803
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1804
|
+
"rect",
|
|
1805
|
+
{
|
|
1806
|
+
x: 0,
|
|
1807
|
+
y: 0,
|
|
1808
|
+
width: "100%",
|
|
1809
|
+
height: BAND_H,
|
|
1810
|
+
fill: topParticipant.isInitiating ? fill : respondFill,
|
|
1811
|
+
stroke,
|
|
1812
|
+
strokeWidth: bw,
|
|
1813
|
+
rx: RADIUS,
|
|
1814
|
+
ry: RADIUS
|
|
1815
|
+
}
|
|
1816
|
+
),
|
|
1817
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1818
|
+
"rect",
|
|
1819
|
+
{
|
|
1820
|
+
x: 0,
|
|
1821
|
+
y: BAND_H / 2,
|
|
1822
|
+
width: "100%",
|
|
1823
|
+
height: BAND_H / 2,
|
|
1824
|
+
fill: topParticipant.isInitiating ? fill : respondFill,
|
|
1825
|
+
stroke: "none"
|
|
1826
|
+
}
|
|
1827
|
+
),
|
|
1828
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1829
|
+
"rect",
|
|
1830
|
+
{
|
|
1831
|
+
x: 0,
|
|
1832
|
+
y: BAND_H,
|
|
1833
|
+
width: "100%",
|
|
1834
|
+
height: `calc(100% - ${BAND_H * (1 + bottomParticipants.length)}px)`,
|
|
1835
|
+
fill,
|
|
1836
|
+
stroke,
|
|
1837
|
+
strokeWidth: bw
|
|
1838
|
+
}
|
|
1839
|
+
),
|
|
1840
|
+
bottomParticipants.map((p, i) => {
|
|
1841
|
+
const y = `calc(100% - ${BAND_H * (bottomParticipants.length - i)}px)`;
|
|
1842
|
+
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1843
|
+
"rect",
|
|
1844
|
+
{
|
|
1845
|
+
x: 0,
|
|
1846
|
+
y,
|
|
1847
|
+
width: "100%",
|
|
1848
|
+
height: BAND_H,
|
|
1849
|
+
fill: p.isInitiating ? fill : respondFill,
|
|
1850
|
+
stroke,
|
|
1851
|
+
strokeWidth: bw
|
|
1852
|
+
}
|
|
1853
|
+
) }, i);
|
|
1854
|
+
}),
|
|
1855
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1856
|
+
"rect",
|
|
1857
|
+
{
|
|
1858
|
+
x: bw / 2,
|
|
1859
|
+
y: bw / 2,
|
|
1860
|
+
width: `calc(100% - ${bw}px)`,
|
|
1861
|
+
height: `calc(100% - ${bw}px)`,
|
|
1862
|
+
fill: "none",
|
|
1863
|
+
stroke,
|
|
1864
|
+
strokeWidth: bw,
|
|
1865
|
+
rx: RADIUS,
|
|
1866
|
+
ry: RADIUS
|
|
1867
|
+
}
|
|
1868
|
+
),
|
|
1869
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1870
|
+
"foreignObject",
|
|
1871
|
+
{
|
|
1872
|
+
x: 4,
|
|
1873
|
+
y: BAND_H,
|
|
1874
|
+
width: "calc(100% - 8px)",
|
|
1875
|
+
height: `calc(100% - ${BAND_H * (1 + bottomParticipants.length)}px)`,
|
|
1876
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1877
|
+
"div",
|
|
1878
|
+
{
|
|
1879
|
+
style: {
|
|
1880
|
+
width: "100%",
|
|
1881
|
+
height: "100%",
|
|
1882
|
+
display: "flex",
|
|
1883
|
+
alignItems: "center",
|
|
1884
|
+
justifyContent: "center",
|
|
1885
|
+
fontSize: BPMN_THEME.fontSize,
|
|
1886
|
+
fontFamily: BPMN_THEME.fontFamily,
|
|
1887
|
+
color: stroke,
|
|
1888
|
+
textAlign: "center",
|
|
1889
|
+
padding: "2px 4px",
|
|
1890
|
+
boxSizing: "border-box",
|
|
1891
|
+
overflow: "hidden"
|
|
1892
|
+
},
|
|
1893
|
+
children: d.label ?? ""
|
|
1894
|
+
}
|
|
1895
|
+
)
|
|
1896
|
+
}
|
|
1897
|
+
),
|
|
1898
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1899
|
+
"text",
|
|
1900
|
+
{
|
|
1901
|
+
x: "50%",
|
|
1902
|
+
y: BAND_H * 0.65,
|
|
1903
|
+
textAnchor: "middle",
|
|
1904
|
+
fontSize: BPMN_THEME.fontSize - 1,
|
|
1905
|
+
fontFamily: BPMN_THEME.fontFamily,
|
|
1906
|
+
fill: stroke,
|
|
1907
|
+
clipPath: void 0,
|
|
1908
|
+
children: topParticipant.name
|
|
1909
|
+
}
|
|
1910
|
+
),
|
|
1911
|
+
bottomParticipants.map((p, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1912
|
+
"text",
|
|
1913
|
+
{
|
|
1914
|
+
x: "50%",
|
|
1915
|
+
y: `calc(100% - ${BAND_H * (bottomParticipants.length - i) - BAND_H * 0.35}px)`,
|
|
1916
|
+
textAnchor: "middle",
|
|
1917
|
+
fontSize: BPMN_THEME.fontSize - 1,
|
|
1918
|
+
fontFamily: BPMN_THEME.fontFamily,
|
|
1919
|
+
fill: stroke,
|
|
1920
|
+
children: p.name
|
|
1921
|
+
},
|
|
1922
|
+
i
|
|
1923
|
+
)),
|
|
1924
|
+
collapsed && /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
1925
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1926
|
+
"rect",
|
|
1927
|
+
{
|
|
1928
|
+
x: "50%",
|
|
1929
|
+
y: "calc(100% - 22px)",
|
|
1930
|
+
width: 14,
|
|
1931
|
+
height: 12,
|
|
1932
|
+
transform: "translate(-7, 0)",
|
|
1933
|
+
rx: 2,
|
|
1934
|
+
fill,
|
|
1935
|
+
stroke,
|
|
1936
|
+
strokeWidth: sw * 0.8
|
|
1937
|
+
}
|
|
1938
|
+
),
|
|
1939
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1940
|
+
"text",
|
|
1941
|
+
{
|
|
1942
|
+
x: "50%",
|
|
1943
|
+
y: "calc(100% - 13px)",
|
|
1944
|
+
textAnchor: "middle",
|
|
1945
|
+
fontSize: 10,
|
|
1946
|
+
fill: stroke,
|
|
1947
|
+
fontFamily: BPMN_THEME.fontFamily,
|
|
1948
|
+
children: "+"
|
|
1949
|
+
}
|
|
1950
|
+
)
|
|
1951
|
+
] })
|
|
1952
|
+
] });
|
|
1953
|
+
}
|
|
1954
|
+
function ChoreographyTaskNode({ data, selected }) {
|
|
1955
|
+
const d = data;
|
|
1956
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1957
|
+
const sw = resolveStrokeWidth(selected);
|
|
1958
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", height: "100%", position: "relative" }, children: [
|
|
1959
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "100%", height: "100%", style: { overflow: "visible", display: "block" }, children: /* @__PURE__ */ jsxRuntime.jsx(ChoreographyShell, { d, stroke, sw }) }),
|
|
1960
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" })
|
|
1961
|
+
] });
|
|
1962
|
+
}
|
|
1963
|
+
function SubChoreographyNode({ data, selected }) {
|
|
1964
|
+
const d = data;
|
|
1965
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1966
|
+
const sw = resolveStrokeWidth(selected);
|
|
1967
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", height: "100%", position: "relative" }, children: [
|
|
1968
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "100%", height: "100%", style: { overflow: "visible", display: "block" }, children: /* @__PURE__ */ jsxRuntime.jsx(ChoreographyShell, { d, stroke, sw, collapsed: true }) }),
|
|
1969
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" })
|
|
1970
|
+
] });
|
|
1971
|
+
}
|
|
1972
|
+
function CallChoreographyNode({ data, selected }) {
|
|
1973
|
+
const d = data;
|
|
1974
|
+
const stroke = resolveStroke(selected, d.color?.stroke);
|
|
1975
|
+
const sw = resolveStrokeWidth(selected);
|
|
1976
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", height: "100%", position: "relative" }, children: [
|
|
1977
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "100%", height: "100%", style: { overflow: "visible", display: "block" }, children: /* @__PURE__ */ jsxRuntime.jsx(ChoreographyShell, { d, stroke, sw, thick: true, collapsed: true }) }),
|
|
1978
|
+
/* @__PURE__ */ jsxRuntime.jsx(BpmnHandles, { variant: "all" })
|
|
1979
|
+
] });
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
// src/nodes/nodeTypes.ts
|
|
1983
|
+
var BPMN_NODE_TYPES = {
|
|
1984
|
+
// Events
|
|
1985
|
+
StartEvent: StartEventNode,
|
|
1986
|
+
EndEvent: EndEventNode,
|
|
1987
|
+
IntermediateCatchEvent: IntermediateCatchEventNode,
|
|
1988
|
+
IntermediateThrowEvent: IntermediateThrowEventNode,
|
|
1989
|
+
BoundaryEvent: BoundaryEventNode,
|
|
1990
|
+
// Tasks — differentiated by data.elementType
|
|
1991
|
+
Task: TaskNode,
|
|
1992
|
+
UserTask: TaskNode,
|
|
1993
|
+
ServiceTask: TaskNode,
|
|
1994
|
+
ScriptTask: TaskNode,
|
|
1995
|
+
ManualTask: TaskNode,
|
|
1996
|
+
BusinessRuleTask: TaskNode,
|
|
1997
|
+
ReceiveTask: TaskNode,
|
|
1998
|
+
SendTask: TaskNode,
|
|
1999
|
+
CallActivity: TaskNode,
|
|
2000
|
+
// Gateways — differentiated by data.elementType
|
|
2001
|
+
ExclusiveGateway: GatewayNode,
|
|
2002
|
+
InclusiveGateway: GatewayNode,
|
|
2003
|
+
ParallelGateway: GatewayNode,
|
|
2004
|
+
EventBasedGateway: GatewayNode,
|
|
2005
|
+
ComplexGateway: GatewayNode,
|
|
2006
|
+
// Containers
|
|
2007
|
+
SubProcess: SubProcessNode,
|
|
2008
|
+
Pool: PoolNode,
|
|
2009
|
+
Lane: LaneNode,
|
|
2010
|
+
// Artifacts
|
|
2011
|
+
Annotation: AnnotationNode,
|
|
2012
|
+
Group: GroupNode,
|
|
2013
|
+
// Data
|
|
2014
|
+
DataObject: DataObjectNode,
|
|
2015
|
+
DataObjectReference: DataObjectReferenceNode,
|
|
2016
|
+
DataInput: DataInputNode,
|
|
2017
|
+
DataOutput: DataOutputNode,
|
|
2018
|
+
DataStore: DataStoreNode,
|
|
2019
|
+
DataStoreReference: DataStoreReferenceNode,
|
|
2020
|
+
// Conversation (§12)
|
|
2021
|
+
Conversation: ConversationNode,
|
|
2022
|
+
SubConversation: SubConversationNode,
|
|
2023
|
+
CallConversation: CallConversationNode,
|
|
2024
|
+
// Choreography (§11)
|
|
2025
|
+
ChoreographyTask: ChoreographyTaskNode,
|
|
2026
|
+
SubChoreography: SubChoreographyNode,
|
|
2027
|
+
CallChoreography: CallChoreographyNode
|
|
2028
|
+
};
|
|
2029
|
+
|
|
2030
|
+
// src/edges/path.ts
|
|
2031
|
+
function getEdgePoints(sourceX, sourceY, targetX, targetY, routingPoints) {
|
|
2032
|
+
if (routingPoints && routingPoints.length >= 2) {
|
|
2033
|
+
return routingPoints;
|
|
2034
|
+
}
|
|
2035
|
+
return [
|
|
2036
|
+
{ x: sourceX, y: sourceY },
|
|
2037
|
+
{ x: targetX, y: targetY }
|
|
2038
|
+
];
|
|
2039
|
+
}
|
|
2040
|
+
function getPolylineMidpoint(points) {
|
|
2041
|
+
if (points.length === 0) return { x: 0, y: 0 };
|
|
2042
|
+
if (points.length === 1) return points[0];
|
|
2043
|
+
let total = 0;
|
|
2044
|
+
const lengths = [];
|
|
2045
|
+
for (let i = 1; i < points.length; i += 1) {
|
|
2046
|
+
const dx = points[i].x - points[i - 1].x;
|
|
2047
|
+
const dy = points[i].y - points[i - 1].y;
|
|
2048
|
+
const length = Math.hypot(dx, dy);
|
|
2049
|
+
lengths.push(length);
|
|
2050
|
+
total += length;
|
|
2051
|
+
}
|
|
2052
|
+
const halfway = total / 2;
|
|
2053
|
+
let traversed = 0;
|
|
2054
|
+
for (let i = 1; i < points.length; i += 1) {
|
|
2055
|
+
const length = lengths[i - 1];
|
|
2056
|
+
if (traversed + length >= halfway) {
|
|
2057
|
+
const ratio = length === 0 ? 0 : (halfway - traversed) / length;
|
|
2058
|
+
return {
|
|
2059
|
+
x: points[i - 1].x + (points[i].x - points[i - 1].x) * ratio,
|
|
2060
|
+
y: points[i - 1].y + (points[i].y - points[i - 1].y) * ratio
|
|
2061
|
+
};
|
|
2062
|
+
}
|
|
2063
|
+
traversed += length;
|
|
2064
|
+
}
|
|
2065
|
+
return points[points.length - 1];
|
|
2066
|
+
}
|
|
2067
|
+
function getSegmentAngle(points) {
|
|
2068
|
+
if (points.length < 2) return 0;
|
|
2069
|
+
const from = points[0];
|
|
2070
|
+
const to = points[1];
|
|
2071
|
+
return Math.atan2(to.y - from.y, to.x - from.x);
|
|
2072
|
+
}
|
|
2073
|
+
function getDefaultFlowMarkerPath(points) {
|
|
2074
|
+
if (points.length < 2) return null;
|
|
2075
|
+
const start = points[0];
|
|
2076
|
+
const angle = getSegmentAngle(points);
|
|
2077
|
+
const anchorX = start.x + Math.cos(angle) * 16;
|
|
2078
|
+
const anchorY = start.y + Math.sin(angle) * 16;
|
|
2079
|
+
const normalAngle = angle + Math.PI / 2;
|
|
2080
|
+
const half = 7;
|
|
2081
|
+
const x1 = anchorX + Math.cos(normalAngle) * half;
|
|
2082
|
+
const y1 = anchorY + Math.sin(normalAngle) * half;
|
|
2083
|
+
const x2 = anchorX - Math.cos(normalAngle) * half;
|
|
2084
|
+
const y2 = anchorY - Math.sin(normalAngle) * half;
|
|
2085
|
+
return `M ${x1} ${y1} L ${x2} ${y2}`;
|
|
2086
|
+
}
|
|
2087
|
+
function SequenceFlowEdge({
|
|
2088
|
+
id,
|
|
2089
|
+
sourceX,
|
|
2090
|
+
sourceY,
|
|
2091
|
+
targetX,
|
|
2092
|
+
targetY,
|
|
2093
|
+
sourcePosition,
|
|
2094
|
+
targetPosition,
|
|
2095
|
+
data,
|
|
2096
|
+
label,
|
|
2097
|
+
markerEnd,
|
|
2098
|
+
style,
|
|
2099
|
+
selected
|
|
2100
|
+
}) {
|
|
2101
|
+
const d = data;
|
|
2102
|
+
const points = d?.routingPoints;
|
|
2103
|
+
const polyline = getEdgePoints(sourceX, sourceY, targetX, targetY, points);
|
|
2104
|
+
const path = points && points.length >= 2 ? routing.pointsToSvgPath(points) : routing.getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
2105
|
+
const midpoint = getPolylineMidpoint(polyline);
|
|
2106
|
+
const defaultMarkerPath = d?.isDefault ? getDefaultFlowMarkerPath(polyline) : null;
|
|
2107
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2108
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2109
|
+
react.BaseEdge,
|
|
2110
|
+
{
|
|
2111
|
+
id,
|
|
2112
|
+
path,
|
|
2113
|
+
...d?.conditionExpression ? { markerStart: "url(#bpmn-diamond-open)" } : {},
|
|
2114
|
+
markerEnd: markerEnd ?? "url(#bpmn-arrow)",
|
|
2115
|
+
style: {
|
|
2116
|
+
stroke: selected ? "#1a56db" : "#404040",
|
|
2117
|
+
strokeWidth: selected ? 2 : 1.5,
|
|
2118
|
+
...style ?? {}
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
),
|
|
2122
|
+
defaultMarkerPath && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2123
|
+
"path",
|
|
2124
|
+
{
|
|
2125
|
+
d: defaultMarkerPath,
|
|
2126
|
+
fill: "none",
|
|
2127
|
+
stroke: selected ? "#1a56db" : "#404040",
|
|
2128
|
+
strokeWidth: selected ? 2 : 1.5,
|
|
2129
|
+
strokeLinecap: "round",
|
|
2130
|
+
"data-testid": "bpmn-default-flow-marker"
|
|
2131
|
+
}
|
|
2132
|
+
),
|
|
2133
|
+
(label ?? d?.label) && /* @__PURE__ */ jsxRuntime.jsx(react.EdgeLabelRenderer, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2134
|
+
"div",
|
|
2135
|
+
{
|
|
2136
|
+
style: {
|
|
2137
|
+
position: "absolute",
|
|
2138
|
+
transform: `translate(-50%,-50%) translate(${midpoint.x}px,${midpoint.y}px)`,
|
|
2139
|
+
fontSize: 11,
|
|
2140
|
+
fontFamily: "Inter, system-ui, sans-serif",
|
|
2141
|
+
background: "rgba(255,255,255,0.85)",
|
|
2142
|
+
padding: "1px 4px",
|
|
2143
|
+
borderRadius: 2,
|
|
2144
|
+
pointerEvents: "all"
|
|
2145
|
+
},
|
|
2146
|
+
className: "nodrag nopan",
|
|
2147
|
+
children: label ?? d?.label
|
|
2148
|
+
}
|
|
2149
|
+
) })
|
|
2150
|
+
] });
|
|
2151
|
+
}
|
|
2152
|
+
function MessageFlowEdge({
|
|
2153
|
+
id,
|
|
2154
|
+
sourceX,
|
|
2155
|
+
sourceY,
|
|
2156
|
+
targetX,
|
|
2157
|
+
targetY,
|
|
2158
|
+
sourcePosition,
|
|
2159
|
+
targetPosition,
|
|
2160
|
+
data,
|
|
2161
|
+
label,
|
|
2162
|
+
markerEnd,
|
|
2163
|
+
style,
|
|
2164
|
+
selected
|
|
2165
|
+
}) {
|
|
2166
|
+
const d = data;
|
|
2167
|
+
const points = d?.routingPoints;
|
|
2168
|
+
const polyline = getEdgePoints(sourceX, sourceY, targetX, targetY, points);
|
|
2169
|
+
const path = points && points.length >= 2 ? routing.pointsToSvgPath(points) : routing.getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
2170
|
+
const midpoint = getPolylineMidpoint(polyline);
|
|
2171
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2172
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2173
|
+
react.BaseEdge,
|
|
2174
|
+
{
|
|
2175
|
+
id,
|
|
2176
|
+
path,
|
|
2177
|
+
markerStart: "url(#bpmn-circle-open)",
|
|
2178
|
+
markerEnd: markerEnd ?? "url(#bpmn-arrow-open)",
|
|
2179
|
+
style: {
|
|
2180
|
+
stroke: selected ? "#1a56db" : "#404040",
|
|
2181
|
+
strokeWidth: selected ? 2 : 1.5,
|
|
2182
|
+
strokeDasharray: "6 3",
|
|
2183
|
+
...style ?? {}
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
),
|
|
2187
|
+
(label ?? d?.label) && /* @__PURE__ */ jsxRuntime.jsx(react.EdgeLabelRenderer, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2188
|
+
"div",
|
|
2189
|
+
{
|
|
2190
|
+
style: {
|
|
2191
|
+
position: "absolute",
|
|
2192
|
+
transform: `translate(-50%,-50%) translate(${midpoint.x}px,${midpoint.y}px)`,
|
|
2193
|
+
fontSize: 11,
|
|
2194
|
+
fontFamily: "Inter, system-ui, sans-serif",
|
|
2195
|
+
background: "rgba(255,255,255,0.85)",
|
|
2196
|
+
padding: "1px 4px",
|
|
2197
|
+
borderRadius: 2,
|
|
2198
|
+
pointerEvents: "all"
|
|
2199
|
+
},
|
|
2200
|
+
className: "nodrag nopan",
|
|
2201
|
+
children: label ?? d?.label
|
|
2202
|
+
}
|
|
2203
|
+
) })
|
|
2204
|
+
] });
|
|
2205
|
+
}
|
|
2206
|
+
function AssociationEdge({
|
|
2207
|
+
id,
|
|
2208
|
+
sourceX,
|
|
2209
|
+
sourceY,
|
|
2210
|
+
targetX,
|
|
2211
|
+
targetY,
|
|
2212
|
+
sourcePosition,
|
|
2213
|
+
targetPosition,
|
|
2214
|
+
data,
|
|
2215
|
+
style,
|
|
2216
|
+
selected
|
|
2217
|
+
}) {
|
|
2218
|
+
const d = data;
|
|
2219
|
+
const points = d?.routingPoints;
|
|
2220
|
+
const direction = d?.associationDirection ?? "none";
|
|
2221
|
+
const path = points && points.length >= 2 ? routing.pointsToSvgPath(points) : routing.getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
2222
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2223
|
+
react.BaseEdge,
|
|
2224
|
+
{
|
|
2225
|
+
id,
|
|
2226
|
+
path,
|
|
2227
|
+
...direction === "both" ? { markerStart: "url(#bpmn-arrow-open)" } : {},
|
|
2228
|
+
...direction === "one" || direction === "both" ? { markerEnd: "url(#bpmn-arrow-open)" } : {},
|
|
2229
|
+
style: {
|
|
2230
|
+
stroke: selected ? "#1a56db" : "#888",
|
|
2231
|
+
strokeWidth: 1,
|
|
2232
|
+
strokeDasharray: "3 3",
|
|
2233
|
+
...style ?? {}
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
);
|
|
2237
|
+
}
|
|
2238
|
+
function DataAssociationEdge({
|
|
2239
|
+
id,
|
|
2240
|
+
sourceX,
|
|
2241
|
+
sourceY,
|
|
2242
|
+
targetX,
|
|
2243
|
+
targetY,
|
|
2244
|
+
sourcePosition,
|
|
2245
|
+
targetPosition,
|
|
2246
|
+
data,
|
|
2247
|
+
style,
|
|
2248
|
+
selected
|
|
2249
|
+
}) {
|
|
2250
|
+
const d = data;
|
|
2251
|
+
const points = d?.routingPoints;
|
|
2252
|
+
const path = points && points.length >= 2 ? routing.pointsToSvgPath(points) : routing.getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);
|
|
2253
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2254
|
+
react.BaseEdge,
|
|
2255
|
+
{
|
|
2256
|
+
id,
|
|
2257
|
+
path,
|
|
2258
|
+
markerEnd: "url(#bpmn-arrow-open)",
|
|
2259
|
+
style: {
|
|
2260
|
+
stroke: selected ? "#1a56db" : "#888",
|
|
2261
|
+
strokeWidth: 1,
|
|
2262
|
+
strokeDasharray: "3 3",
|
|
2263
|
+
...style ?? {}
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
);
|
|
2267
|
+
}
|
|
2268
|
+
function ConversationLinkEdge({
|
|
2269
|
+
sourceX,
|
|
2270
|
+
sourceY,
|
|
2271
|
+
targetX,
|
|
2272
|
+
targetY,
|
|
2273
|
+
data,
|
|
2274
|
+
markerEnd
|
|
2275
|
+
}) {
|
|
2276
|
+
const d = data;
|
|
2277
|
+
const stroke = BPMN_THEME.stroke;
|
|
2278
|
+
const [path] = react.getStraightPath({ sourceX, sourceY, targetX, targetY });
|
|
2279
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
2280
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2281
|
+
react.BaseEdge,
|
|
2282
|
+
{
|
|
2283
|
+
path,
|
|
2284
|
+
...markerEnd ? { markerEnd } : {},
|
|
2285
|
+
style: { stroke, strokeWidth: 5, fill: "none" }
|
|
2286
|
+
}
|
|
2287
|
+
),
|
|
2288
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2289
|
+
react.BaseEdge,
|
|
2290
|
+
{
|
|
2291
|
+
path,
|
|
2292
|
+
style: { stroke: "#ffffff", strokeWidth: 2, fill: "none" }
|
|
2293
|
+
}
|
|
2294
|
+
),
|
|
2295
|
+
d?.label && /* @__PURE__ */ jsxRuntime.jsx("text", { fontSize: BPMN_THEME.fontSize, fontFamily: BPMN_THEME.fontFamily, fill: stroke, children: /* @__PURE__ */ jsxRuntime.jsx("textPath", { href: `#${path}`, startOffset: "50%", textAnchor: "middle", children: d.label }) })
|
|
2296
|
+
] });
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
// src/edges/edgeTypes.ts
|
|
2300
|
+
var BPMN_EDGE_TYPES = {
|
|
2301
|
+
sequenceFlow: SequenceFlowEdge,
|
|
2302
|
+
messageFlow: MessageFlowEdge,
|
|
2303
|
+
association: AssociationEdge,
|
|
2304
|
+
dataAssociation: DataAssociationEdge,
|
|
2305
|
+
conversationLink: ConversationLinkEdge
|
|
2306
|
+
};
|
|
2307
|
+
|
|
2308
|
+
// src/xml/mapper.ts
|
|
2309
|
+
var MODDLE_TO_ELEMENT_TYPE = {
|
|
2310
|
+
"bpmn:StartEvent": "StartEvent",
|
|
2311
|
+
"bpmn:EndEvent": "EndEvent",
|
|
2312
|
+
"bpmn:IntermediateCatchEvent": "IntermediateCatchEvent",
|
|
2313
|
+
"bpmn:IntermediateThrowEvent": "IntermediateThrowEvent",
|
|
2314
|
+
"bpmn:BoundaryEvent": "BoundaryEvent",
|
|
2315
|
+
"bpmn:Task": "Task",
|
|
2316
|
+
"bpmn:UserTask": "UserTask",
|
|
2317
|
+
"bpmn:ServiceTask": "ServiceTask",
|
|
2318
|
+
"bpmn:ScriptTask": "ScriptTask",
|
|
2319
|
+
"bpmn:ManualTask": "ManualTask",
|
|
2320
|
+
"bpmn:BusinessRuleTask": "BusinessRuleTask",
|
|
2321
|
+
"bpmn:ReceiveTask": "ReceiveTask",
|
|
2322
|
+
"bpmn:SendTask": "SendTask",
|
|
2323
|
+
"bpmn:CallActivity": "CallActivity",
|
|
2324
|
+
"bpmn:ExclusiveGateway": "ExclusiveGateway",
|
|
2325
|
+
"bpmn:InclusiveGateway": "InclusiveGateway",
|
|
2326
|
+
"bpmn:ParallelGateway": "ParallelGateway",
|
|
2327
|
+
"bpmn:EventBasedGateway": "EventBasedGateway",
|
|
2328
|
+
"bpmn:ComplexGateway": "ComplexGateway",
|
|
2329
|
+
"bpmn:SubProcess": "SubProcess",
|
|
2330
|
+
"bpmn:AdHocSubProcess": "SubProcess",
|
|
2331
|
+
"bpmn:Transaction": "SubProcess",
|
|
2332
|
+
"bpmn:TextAnnotation": "Annotation",
|
|
2333
|
+
"bpmn:Group": "Group",
|
|
2334
|
+
"bpmn:DataObject": "DataObject",
|
|
2335
|
+
"bpmn:DataObjectReference": "DataObjectReference",
|
|
2336
|
+
"bpmn:DataInput": "DataInput",
|
|
2337
|
+
"bpmn:DataOutput": "DataOutput",
|
|
2338
|
+
"bpmn:DataStore": "DataStore",
|
|
2339
|
+
"bpmn:DataStoreReference": "DataStoreReference",
|
|
2340
|
+
"bpmn:Conversation": "Conversation",
|
|
2341
|
+
"bpmn:SubConversation": "SubConversation",
|
|
2342
|
+
"bpmn:CallConversation": "CallConversation",
|
|
2343
|
+
"bpmn:ChoreographyTask": "ChoreographyTask",
|
|
2344
|
+
"bpmn:SubChoreography": "SubChoreography",
|
|
2345
|
+
"bpmn:CallChoreography": "CallChoreography",
|
|
2346
|
+
"bpmn:Lane": "Lane"
|
|
2347
|
+
};
|
|
2348
|
+
var ELEMENT_TYPE_TO_MODDLE = {
|
|
2349
|
+
StartEvent: "bpmn:StartEvent",
|
|
2350
|
+
EndEvent: "bpmn:EndEvent",
|
|
2351
|
+
IntermediateCatchEvent: "bpmn:IntermediateCatchEvent",
|
|
2352
|
+
IntermediateThrowEvent: "bpmn:IntermediateThrowEvent",
|
|
2353
|
+
BoundaryEvent: "bpmn:BoundaryEvent",
|
|
2354
|
+
Task: "bpmn:Task",
|
|
2355
|
+
UserTask: "bpmn:UserTask",
|
|
2356
|
+
ServiceTask: "bpmn:ServiceTask",
|
|
2357
|
+
ScriptTask: "bpmn:ScriptTask",
|
|
2358
|
+
ManualTask: "bpmn:ManualTask",
|
|
2359
|
+
BusinessRuleTask: "bpmn:BusinessRuleTask",
|
|
2360
|
+
ReceiveTask: "bpmn:ReceiveTask",
|
|
2361
|
+
SendTask: "bpmn:SendTask",
|
|
2362
|
+
CallActivity: "bpmn:CallActivity",
|
|
2363
|
+
ExclusiveGateway: "bpmn:ExclusiveGateway",
|
|
2364
|
+
InclusiveGateway: "bpmn:InclusiveGateway",
|
|
2365
|
+
ParallelGateway: "bpmn:ParallelGateway",
|
|
2366
|
+
EventBasedGateway: "bpmn:EventBasedGateway",
|
|
2367
|
+
ComplexGateway: "bpmn:ComplexGateway",
|
|
2368
|
+
SubProcess: "bpmn:SubProcess",
|
|
2369
|
+
Pool: "bpmn:Participant",
|
|
2370
|
+
Lane: "bpmn:Lane",
|
|
2371
|
+
Annotation: "bpmn:TextAnnotation",
|
|
2372
|
+
Group: "bpmn:Group",
|
|
2373
|
+
DataObject: "bpmn:DataObject",
|
|
2374
|
+
DataObjectReference: "bpmn:DataObjectReference",
|
|
2375
|
+
DataInput: "bpmn:DataInput",
|
|
2376
|
+
DataOutput: "bpmn:DataOutput",
|
|
2377
|
+
DataStore: "bpmn:DataStore",
|
|
2378
|
+
DataStoreReference: "bpmn:DataStoreReference",
|
|
2379
|
+
Conversation: "bpmn:Conversation",
|
|
2380
|
+
SubConversation: "bpmn:SubConversation",
|
|
2381
|
+
CallConversation: "bpmn:CallConversation",
|
|
2382
|
+
ChoreographyTask: "bpmn:ChoreographyTask",
|
|
2383
|
+
SubChoreography: "bpmn:SubChoreography",
|
|
2384
|
+
CallChoreography: "bpmn:CallChoreography"
|
|
2385
|
+
};
|
|
2386
|
+
var MODDLE_TO_EDGE_TYPE = {
|
|
2387
|
+
"bpmn:SequenceFlow": "sequenceFlow",
|
|
2388
|
+
"bpmn:MessageFlow": "messageFlow",
|
|
2389
|
+
"bpmn:Association": "association",
|
|
2390
|
+
"bpmn:DataInputAssociation": "dataAssociation",
|
|
2391
|
+
"bpmn:DataOutputAssociation": "dataAssociation",
|
|
2392
|
+
"bpmn:ConversationLink": "conversationLink"
|
|
2393
|
+
};
|
|
2394
|
+
var EDGE_TYPE_TO_MODDLE = {
|
|
2395
|
+
sequenceFlow: "bpmn:SequenceFlow",
|
|
2396
|
+
messageFlow: "bpmn:MessageFlow",
|
|
2397
|
+
association: "bpmn:Association",
|
|
2398
|
+
dataAssociation: "bpmn:DataInputAssociation",
|
|
2399
|
+
conversationLink: "bpmn:ConversationLink"
|
|
2400
|
+
};
|
|
2401
|
+
var EVENT_DEF_TO_TRIGGER = {
|
|
2402
|
+
"bpmn:MessageEventDefinition": "message",
|
|
2403
|
+
"bpmn:TimerEventDefinition": "timer",
|
|
2404
|
+
"bpmn:EscalationEventDefinition": "escalation",
|
|
2405
|
+
"bpmn:ConditionalEventDefinition": "conditional",
|
|
2406
|
+
"bpmn:ErrorEventDefinition": "error",
|
|
2407
|
+
"bpmn:CancelEventDefinition": "cancel",
|
|
2408
|
+
"bpmn:CompensateEventDefinition": "compensation",
|
|
2409
|
+
"bpmn:SignalEventDefinition": "signal",
|
|
2410
|
+
"bpmn:LinkEventDefinition": "link",
|
|
2411
|
+
"bpmn:TerminateEventDefinition": "terminate"
|
|
2412
|
+
};
|
|
2413
|
+
var TRIGGER_TO_EVENT_DEF = {
|
|
2414
|
+
message: "bpmn:MessageEventDefinition",
|
|
2415
|
+
timer: "bpmn:TimerEventDefinition",
|
|
2416
|
+
escalation: "bpmn:EscalationEventDefinition",
|
|
2417
|
+
conditional: "bpmn:ConditionalEventDefinition",
|
|
2418
|
+
error: "bpmn:ErrorEventDefinition",
|
|
2419
|
+
cancel: "bpmn:CancelEventDefinition",
|
|
2420
|
+
compensation: "bpmn:CompensateEventDefinition",
|
|
2421
|
+
signal: "bpmn:SignalEventDefinition",
|
|
2422
|
+
link: "bpmn:LinkEventDefinition",
|
|
2423
|
+
terminate: "bpmn:TerminateEventDefinition"
|
|
2424
|
+
};
|
|
2425
|
+
|
|
2426
|
+
// src/xml/importer.ts
|
|
2427
|
+
function asElements(v) {
|
|
2428
|
+
return Array.isArray(v) ? v : [];
|
|
2429
|
+
}
|
|
2430
|
+
function asString(v) {
|
|
2431
|
+
return typeof v === "string" && v.trim() ? v.trim() : void 0;
|
|
2432
|
+
}
|
|
2433
|
+
function extractDiagramInfo(definitions) {
|
|
2434
|
+
const shapes = /* @__PURE__ */ new Map();
|
|
2435
|
+
const waypoints = /* @__PURE__ */ new Map();
|
|
2436
|
+
for (const diagram of asElements(definitions.diagrams)) {
|
|
2437
|
+
const plane = diagram.plane;
|
|
2438
|
+
if (!plane) continue;
|
|
2439
|
+
for (const el of asElements(plane.planeElement)) {
|
|
2440
|
+
const bpmnEl = el.bpmnElement;
|
|
2441
|
+
if (!bpmnEl?.id) continue;
|
|
2442
|
+
const id = bpmnEl.id;
|
|
2443
|
+
if (el.$type === "bpmndi:BPMNShape") {
|
|
2444
|
+
const b = el.bounds;
|
|
2445
|
+
if (b) {
|
|
2446
|
+
shapes.set(id, {
|
|
2447
|
+
x: b.x,
|
|
2448
|
+
y: b.y,
|
|
2449
|
+
width: b.width,
|
|
2450
|
+
height: b.height,
|
|
2451
|
+
...typeof el.isExpanded === "boolean" ? { isExpanded: el.isExpanded } : {}
|
|
2452
|
+
});
|
|
2453
|
+
}
|
|
2454
|
+
} else if (el.$type === "bpmndi:BPMNEdge") {
|
|
2455
|
+
const pts = el.waypoint ?? [];
|
|
2456
|
+
if (pts.length) waypoints.set(id, pts);
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
return { shapes, waypoints };
|
|
2461
|
+
}
|
|
2462
|
+
function extractLaneMembership(process) {
|
|
2463
|
+
const map = /* @__PURE__ */ new Map();
|
|
2464
|
+
function walkLaneSet(laneSet2) {
|
|
2465
|
+
for (const lane of asElements(laneSet2.lanes)) {
|
|
2466
|
+
const laneId = lane.id;
|
|
2467
|
+
if (!laneId) continue;
|
|
2468
|
+
for (const ref of asElements(lane.flowNodeRef)) {
|
|
2469
|
+
if (ref.id) map.set(ref.id, laneId);
|
|
2470
|
+
}
|
|
2471
|
+
const child = lane.childLaneSet;
|
|
2472
|
+
if (child) walkLaneSet(child);
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
const laneSet = process.laneSet;
|
|
2476
|
+
if (laneSet) walkLaneSet(laneSet);
|
|
2477
|
+
return map;
|
|
2478
|
+
}
|
|
2479
|
+
function extractTrigger(el) {
|
|
2480
|
+
const defs = asElements(el.eventDefinitions);
|
|
2481
|
+
if (defs.length === 0) return void 0;
|
|
2482
|
+
if (defs.length > 1) return el.$type.includes("Parallel") ? "parallelMultiple" : "multiple";
|
|
2483
|
+
return EVENT_DEF_TO_TRIGGER[defs[0].$type];
|
|
2484
|
+
}
|
|
2485
|
+
function extractSubProcessVariant(el) {
|
|
2486
|
+
if (el.$type === "bpmn:Transaction") return "transaction";
|
|
2487
|
+
if (el.$type === "bpmn:AdHocSubProcess") return "adhoc";
|
|
2488
|
+
if (el.triggeredByEvent === true) return "event";
|
|
2489
|
+
return "embedded";
|
|
2490
|
+
}
|
|
2491
|
+
function walkFlowElements(elements, parentId, ctx, nodes, edges) {
|
|
2492
|
+
for (const el of elements) {
|
|
2493
|
+
const { $type, id } = el;
|
|
2494
|
+
if (!id) continue;
|
|
2495
|
+
const edgeType = MODDLE_TO_EDGE_TYPE[$type];
|
|
2496
|
+
if (edgeType !== void 0) {
|
|
2497
|
+
buildEdge(el, edgeType, ctx, edges);
|
|
2498
|
+
continue;
|
|
2499
|
+
}
|
|
2500
|
+
if ($type === "bpmn:LaneSet") continue;
|
|
2501
|
+
const elementType = MODDLE_TO_ELEMENT_TYPE[$type];
|
|
2502
|
+
if (!elementType) {
|
|
2503
|
+
ctx.warnings.push(`Unknown element type "${$type}" (id=${id}) \u2014 skipped.`);
|
|
2504
|
+
continue;
|
|
2505
|
+
}
|
|
2506
|
+
buildNode(el, elementType, parentId, ctx, nodes);
|
|
2507
|
+
if ($type === "bpmn:SubProcess" || $type === "bpmn:Transaction" || $type === "bpmn:AdHocSubProcess") {
|
|
2508
|
+
const children = asElements(el.flowElements);
|
|
2509
|
+
const laneMembership = extractLaneMembership(el);
|
|
2510
|
+
walkFlowElements(children, id, { ...ctx, laneMembership }, nodes, edges);
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
function buildNode(el, elementType, parentId, ctx, nodes) {
|
|
2515
|
+
const id = el.id;
|
|
2516
|
+
const meta = BPMN_ELEMENT_CATALOG[elementType];
|
|
2517
|
+
const shape = ctx.shapes.get(id);
|
|
2518
|
+
const x = shape?.x ?? ctx.autoX.value;
|
|
2519
|
+
const y = shape?.y ?? 100;
|
|
2520
|
+
if (!shape) ctx.autoX.value += (meta?.defaultWidth ?? 120) + 20;
|
|
2521
|
+
const label = asString(el.name);
|
|
2522
|
+
const trigger = extractTrigger(el);
|
|
2523
|
+
const isNonInterrupting = el.cancelActivity === false;
|
|
2524
|
+
const data = {
|
|
2525
|
+
elementType,
|
|
2526
|
+
...label ? { label } : {},
|
|
2527
|
+
...trigger ? { trigger } : {},
|
|
2528
|
+
...isNonInterrupting ? { isNonInterrupting: true } : {}
|
|
2529
|
+
};
|
|
2530
|
+
if (elementType === "SubProcess") {
|
|
2531
|
+
const variant = extractSubProcessVariant(el);
|
|
2532
|
+
if (variant) data.subProcessVariant = variant;
|
|
2533
|
+
const isExpanded = shape?.isExpanded ?? true;
|
|
2534
|
+
data.isExpanded = isExpanded;
|
|
2535
|
+
}
|
|
2536
|
+
const laneId = ctx.laneMembership.get(id);
|
|
2537
|
+
const effectiveParentId = laneId ?? parentId;
|
|
2538
|
+
const node = {
|
|
2539
|
+
id,
|
|
2540
|
+
type: elementType,
|
|
2541
|
+
position: { x, y },
|
|
2542
|
+
data,
|
|
2543
|
+
width: shape?.width ?? meta?.defaultWidth,
|
|
2544
|
+
height: shape?.height ?? meta?.defaultHeight,
|
|
2545
|
+
...effectiveParentId ? { parentId: effectiveParentId } : {}
|
|
2546
|
+
};
|
|
2547
|
+
nodes.push(node);
|
|
2548
|
+
}
|
|
2549
|
+
function buildEdge(el, edgeType, ctx, edges) {
|
|
2550
|
+
const id = el.id;
|
|
2551
|
+
const source = el.sourceRef?.id;
|
|
2552
|
+
const target = el.targetRef?.id;
|
|
2553
|
+
if (!source || !target) {
|
|
2554
|
+
ctx.warnings.push(`Edge "${id}" missing source or target \u2014 skipped.`);
|
|
2555
|
+
return;
|
|
2556
|
+
}
|
|
2557
|
+
const label = asString(el.name);
|
|
2558
|
+
const condExpr = el.conditionExpression;
|
|
2559
|
+
const data = {
|
|
2560
|
+
edgeType,
|
|
2561
|
+
...label ? { label } : {},
|
|
2562
|
+
...condExpr?.body ? { conditionExpression: condExpr.body } : {}
|
|
2563
|
+
};
|
|
2564
|
+
const waypoints = ctx.waypoints.get(id);
|
|
2565
|
+
if (waypoints?.length) data.routingPoints = waypoints;
|
|
2566
|
+
edges.push({ id, type: edgeType, source, target, data });
|
|
2567
|
+
}
|
|
2568
|
+
function handleCollaboration(collaboration, ctx, nodes, edges) {
|
|
2569
|
+
for (const participant of asElements(collaboration.participants)) {
|
|
2570
|
+
const id = participant.id;
|
|
2571
|
+
if (!id) continue;
|
|
2572
|
+
const label = asString(participant.name);
|
|
2573
|
+
const shape = ctx.shapes.get(id);
|
|
2574
|
+
const poolNode = {
|
|
2575
|
+
id,
|
|
2576
|
+
type: "Pool",
|
|
2577
|
+
position: { x: shape?.x ?? 0, y: shape?.y ?? 0 },
|
|
2578
|
+
data: { elementType: "Pool", ...label ? { label } : {} },
|
|
2579
|
+
width: shape?.width ?? 600,
|
|
2580
|
+
height: shape?.height ?? 200
|
|
2581
|
+
};
|
|
2582
|
+
nodes.push(poolNode);
|
|
2583
|
+
const processRef = participant.processRef;
|
|
2584
|
+
if (processRef) {
|
|
2585
|
+
const laneMembership = extractLaneMembership(processRef);
|
|
2586
|
+
walkFlowElements(
|
|
2587
|
+
asElements(processRef.flowElements),
|
|
2588
|
+
id,
|
|
2589
|
+
{ ...ctx, laneMembership },
|
|
2590
|
+
nodes,
|
|
2591
|
+
edges
|
|
2592
|
+
);
|
|
2593
|
+
const laneSet = processRef.laneSet;
|
|
2594
|
+
if (laneSet) {
|
|
2595
|
+
addLaneNodes(laneSet, id, ctx, nodes);
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
for (const mf of asElements(collaboration.messageFlows)) {
|
|
2600
|
+
buildEdge(mf, "messageFlow", ctx, edges);
|
|
2601
|
+
}
|
|
2602
|
+
for (const cl of asElements(collaboration.conversationLinks)) {
|
|
2603
|
+
buildEdge(cl, "conversationLink", ctx, edges);
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
function addLaneNodes(laneSet, poolId, ctx, nodes) {
|
|
2607
|
+
for (const lane of asElements(laneSet.lanes)) {
|
|
2608
|
+
const id = lane.id;
|
|
2609
|
+
if (!id) continue;
|
|
2610
|
+
const label = asString(lane.name);
|
|
2611
|
+
const shape = ctx.shapes.get(id);
|
|
2612
|
+
nodes.push({
|
|
2613
|
+
id,
|
|
2614
|
+
type: "Lane",
|
|
2615
|
+
position: { x: shape?.x ?? 30, y: shape?.y ?? 0 },
|
|
2616
|
+
data: { elementType: "Lane", ...label ? { label } : {} },
|
|
2617
|
+
width: shape?.width ?? 570,
|
|
2618
|
+
height: shape?.height ?? 120,
|
|
2619
|
+
parentId: poolId
|
|
2620
|
+
});
|
|
2621
|
+
const child = lane.childLaneSet;
|
|
2622
|
+
if (child) addLaneNodes(child, poolId, ctx, nodes);
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
async function parseBpmnXml(xml) {
|
|
2626
|
+
const moddle = new bpmnModdle.BpmnModdle();
|
|
2627
|
+
const warnings = [];
|
|
2628
|
+
let rootElement;
|
|
2629
|
+
try {
|
|
2630
|
+
const result = await moddle.fromXML(xml);
|
|
2631
|
+
rootElement = result.rootElement;
|
|
2632
|
+
for (const w of result.warnings) warnings.push(w.message);
|
|
2633
|
+
} catch (err) {
|
|
2634
|
+
throw new Error(`Failed to parse BPMN XML: ${String(err)}`);
|
|
2635
|
+
}
|
|
2636
|
+
const nodes = [];
|
|
2637
|
+
const edges = [];
|
|
2638
|
+
const { shapes, waypoints } = extractDiagramInfo(rootElement);
|
|
2639
|
+
const ctx = {
|
|
2640
|
+
shapes,
|
|
2641
|
+
waypoints,
|
|
2642
|
+
laneMembership: /* @__PURE__ */ new Map(),
|
|
2643
|
+
warnings,
|
|
2644
|
+
autoX: { value: 50 }
|
|
2645
|
+
};
|
|
2646
|
+
for (const rootEl of asElements(rootElement.rootElements)) {
|
|
2647
|
+
if (rootEl.$type === "bpmn:Collaboration") {
|
|
2648
|
+
handleCollaboration(rootEl, ctx, nodes, edges);
|
|
2649
|
+
} else if (rootEl.$type === "bpmn:Process") {
|
|
2650
|
+
const laneMembership = extractLaneMembership(rootEl);
|
|
2651
|
+
const laneSet = rootEl.laneSet;
|
|
2652
|
+
if (laneSet) addLaneNodes(laneSet, "", ctx, nodes);
|
|
2653
|
+
walkFlowElements(
|
|
2654
|
+
asElements(rootEl.flowElements),
|
|
2655
|
+
void 0,
|
|
2656
|
+
{ ...ctx, laneMembership },
|
|
2657
|
+
nodes,
|
|
2658
|
+
edges
|
|
2659
|
+
);
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
return { nodes, edges, warnings };
|
|
2663
|
+
}
|
|
2664
|
+
function uid(prefix, id) {
|
|
2665
|
+
return `${prefix}_${id}`;
|
|
2666
|
+
}
|
|
2667
|
+
function asNodes(nodes, types) {
|
|
2668
|
+
return nodes.filter((n) => types.includes(n.data.elementType));
|
|
2669
|
+
}
|
|
2670
|
+
function buildFlowableAttrs(data) {
|
|
2671
|
+
const attrs = {};
|
|
2672
|
+
if (data.flowableAssignee) attrs["flowable:assignee"] = data.flowableAssignee;
|
|
2673
|
+
if (data.flowableCandidateGroups) attrs["flowable:candidateGroups"] = data.flowableCandidateGroups;
|
|
2674
|
+
if (data.flowableCandidateUsers) attrs["flowable:candidateUsers"] = data.flowableCandidateUsers;
|
|
2675
|
+
if (data.flowableFormKey) attrs["flowable:formKey"] = data.flowableFormKey;
|
|
2676
|
+
if (data.flowableDueDate) attrs["flowable:dueDate"] = data.flowableDueDate;
|
|
2677
|
+
if (data.flowableType) attrs["flowable:type"] = data.flowableType;
|
|
2678
|
+
if (data.flowableExpression) attrs["flowable:expression"] = data.flowableExpression;
|
|
2679
|
+
if (data.flowableClass) attrs["flowable:class"] = data.flowableClass;
|
|
2680
|
+
if (data.flowableDelegateExpression) attrs["flowable:delegateExpression"] = data.flowableDelegateExpression;
|
|
2681
|
+
return attrs;
|
|
2682
|
+
}
|
|
2683
|
+
function buildSemanticModel(moddle, nodes, edges, opts) {
|
|
2684
|
+
const defId = opts.id ?? "Definitions_1";
|
|
2685
|
+
const defName = opts.name;
|
|
2686
|
+
const poolNodes = asNodes(nodes, ["Pool"]);
|
|
2687
|
+
const laneNodes = asNodes(nodes, ["Lane"]);
|
|
2688
|
+
const isCollaboration = poolNodes.length > 0;
|
|
2689
|
+
const definitions = moddle.create("bpmn:Definitions", {
|
|
2690
|
+
id: defId,
|
|
2691
|
+
targetNamespace: "http://bpmn.io/schema/bpmn",
|
|
2692
|
+
...defName ? { name: defName } : {}
|
|
2693
|
+
});
|
|
2694
|
+
const rootElements = [];
|
|
2695
|
+
if (isCollaboration) {
|
|
2696
|
+
const participants = [];
|
|
2697
|
+
const processes = [];
|
|
2698
|
+
for (const pool of poolNodes) {
|
|
2699
|
+
const processId = `Process_${pool.id}`;
|
|
2700
|
+
const process = buildProcess(moddle, nodes, edges, pool.id, laneNodes, processId);
|
|
2701
|
+
processes.push(process);
|
|
2702
|
+
const participant = moddle.create("bpmn:Participant", {
|
|
2703
|
+
id: pool.id,
|
|
2704
|
+
name: pool.data.label ?? "",
|
|
2705
|
+
processRef: process
|
|
2706
|
+
});
|
|
2707
|
+
participants.push(participant);
|
|
2708
|
+
}
|
|
2709
|
+
const messageFlowEdges = edges.filter((e) => e.data?.edgeType === "messageFlow");
|
|
2710
|
+
const conversationLinkEdges = edges.filter((e) => e.data?.edgeType === "conversationLink");
|
|
2711
|
+
const messageFlows = messageFlowEdges.map(
|
|
2712
|
+
(e) => moddle.create("bpmn:MessageFlow", {
|
|
2713
|
+
id: e.id,
|
|
2714
|
+
name: e.data?.label ?? "",
|
|
2715
|
+
sourceRef: { id: e.source },
|
|
2716
|
+
targetRef: { id: e.target }
|
|
2717
|
+
})
|
|
2718
|
+
);
|
|
2719
|
+
const conversationLinks = conversationLinkEdges.map(
|
|
2720
|
+
(e) => moddle.create("bpmn:ConversationLink", {
|
|
2721
|
+
id: e.id,
|
|
2722
|
+
sourceRef: { id: e.source },
|
|
2723
|
+
targetRef: { id: e.target }
|
|
2724
|
+
})
|
|
2725
|
+
);
|
|
2726
|
+
const collaboration = moddle.create("bpmn:Collaboration", {
|
|
2727
|
+
id: `Collaboration_${defId}`,
|
|
2728
|
+
participants,
|
|
2729
|
+
messageFlows,
|
|
2730
|
+
conversationLinks
|
|
2731
|
+
});
|
|
2732
|
+
rootElements.push(collaboration, ...processes);
|
|
2733
|
+
} else {
|
|
2734
|
+
const process = buildProcess(moddle, nodes, edges, void 0, laneNodes, "Process_1");
|
|
2735
|
+
rootElements.push(process);
|
|
2736
|
+
}
|
|
2737
|
+
definitions.rootElements = rootElements;
|
|
2738
|
+
return definitions;
|
|
2739
|
+
}
|
|
2740
|
+
function buildProcess(moddle, allNodes, allEdges, poolId, laneNodes, processId) {
|
|
2741
|
+
const myNodes = poolId ? allNodes.filter(
|
|
2742
|
+
(n) => n.parentId === poolId || laneNodes.some((l) => l.id === n.parentId && l.parentId === poolId)
|
|
2743
|
+
) : allNodes.filter((n) => n.data.elementType !== "Pool" && n.data.elementType !== "Lane");
|
|
2744
|
+
const myLanes = laneNodes.filter((l) => poolId ? l.parentId === poolId : true);
|
|
2745
|
+
const flowElements = [];
|
|
2746
|
+
for (const node of myNodes) {
|
|
2747
|
+
const el = buildFlowElement(moddle, node);
|
|
2748
|
+
if (el) flowElements.push(el);
|
|
2749
|
+
}
|
|
2750
|
+
const myNodeIds = new Set(myNodes.map((n) => n.id));
|
|
2751
|
+
const myEdges = allEdges.filter(
|
|
2752
|
+
(e) => (e.data?.edgeType === "sequenceFlow" || e.data?.edgeType === "association" || e.data?.edgeType === "dataAssociation") && myNodeIds.has(e.source) && myNodeIds.has(e.target)
|
|
2753
|
+
);
|
|
2754
|
+
for (const edge of myEdges) {
|
|
2755
|
+
const edgeMeta = buildEdgeElement(moddle, edge);
|
|
2756
|
+
if (edgeMeta) flowElements.push(edgeMeta);
|
|
2757
|
+
}
|
|
2758
|
+
const process = moddle.create("bpmn:Process", {
|
|
2759
|
+
id: processId,
|
|
2760
|
+
isExecutable: true,
|
|
2761
|
+
flowElements
|
|
2762
|
+
});
|
|
2763
|
+
if (myLanes.length > 0) {
|
|
2764
|
+
const laneElements = myLanes.map(
|
|
2765
|
+
(l) => moddle.create("bpmn:Lane", {
|
|
2766
|
+
id: l.id,
|
|
2767
|
+
name: l.data.label ?? "",
|
|
2768
|
+
flowNodeRef: myNodes.filter((n) => n.parentId === l.id).map((n) => ({ id: n.id }))
|
|
2769
|
+
})
|
|
2770
|
+
);
|
|
2771
|
+
process.laneSet = moddle.create("bpmn:LaneSet", {
|
|
2772
|
+
id: `LaneSet_${processId}`,
|
|
2773
|
+
lanes: laneElements
|
|
2774
|
+
});
|
|
2775
|
+
}
|
|
2776
|
+
return process;
|
|
2777
|
+
}
|
|
2778
|
+
function buildFlowElement(moddle, node, _allNodes, _allEdges) {
|
|
2779
|
+
const { elementType, label, trigger } = node.data;
|
|
2780
|
+
if (elementType === "Pool" || elementType === "Lane") return null;
|
|
2781
|
+
const moddleType = ELEMENT_TYPE_TO_MODDLE[elementType];
|
|
2782
|
+
if (!moddleType) return null;
|
|
2783
|
+
const attrs = {
|
|
2784
|
+
id: node.id,
|
|
2785
|
+
name: label ?? ""
|
|
2786
|
+
};
|
|
2787
|
+
if (trigger && trigger !== "none") {
|
|
2788
|
+
const defType = TRIGGER_TO_EVENT_DEF[trigger];
|
|
2789
|
+
if (defType) {
|
|
2790
|
+
attrs.eventDefinitions = [moddle.create(defType, { id: uid("EventDef", node.id) })];
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
if (elementType === "SubProcess" && node.data.subProcessVariant === "transaction") {
|
|
2794
|
+
return moddle.create("bpmn:Transaction", attrs);
|
|
2795
|
+
}
|
|
2796
|
+
if (elementType === "SubProcess" && node.data.subProcessVariant === "adhoc") {
|
|
2797
|
+
return moddle.create("bpmn:AdHocSubProcess", attrs);
|
|
2798
|
+
}
|
|
2799
|
+
const element = moddle.create(moddleType, attrs);
|
|
2800
|
+
const flowableAttrs = buildFlowableAttrs(node.data);
|
|
2801
|
+
if (Object.keys(flowableAttrs).length > 0) {
|
|
2802
|
+
element.$attrs = flowableAttrs;
|
|
2803
|
+
}
|
|
2804
|
+
return element;
|
|
2805
|
+
}
|
|
2806
|
+
function buildEdgeElement(moddle, edge) {
|
|
2807
|
+
if (!edge.data) return null;
|
|
2808
|
+
const moddleType = EDGE_TYPE_TO_MODDLE[edge.data.edgeType];
|
|
2809
|
+
if (!moddleType) return null;
|
|
2810
|
+
const attrs = {
|
|
2811
|
+
id: edge.id,
|
|
2812
|
+
name: edge.data.label ?? "",
|
|
2813
|
+
sourceRef: { id: edge.source },
|
|
2814
|
+
targetRef: { id: edge.target }
|
|
2815
|
+
};
|
|
2816
|
+
if (edge.data.conditionExpression) {
|
|
2817
|
+
attrs.conditionExpression = moddle.create("bpmn:FormalExpression", {
|
|
2818
|
+
body: edge.data.conditionExpression
|
|
2819
|
+
});
|
|
2820
|
+
}
|
|
2821
|
+
return moddle.create(moddleType, attrs);
|
|
2822
|
+
}
|
|
2823
|
+
function buildBpmnDI(moddle, definitions, nodes, edges) {
|
|
2824
|
+
const shapes = [];
|
|
2825
|
+
const edgeShapes = [];
|
|
2826
|
+
for (const node of nodes) {
|
|
2827
|
+
const meta = BPMN_ELEMENT_CATALOG[node.data.elementType];
|
|
2828
|
+
const w = node.width ?? meta?.defaultWidth ?? 120;
|
|
2829
|
+
const h = node.height ?? meta?.defaultHeight ?? 60;
|
|
2830
|
+
const bounds = moddle.create("dc:Bounds", {
|
|
2831
|
+
x: node.position.x,
|
|
2832
|
+
y: node.position.y,
|
|
2833
|
+
width: w,
|
|
2834
|
+
height: h
|
|
2835
|
+
});
|
|
2836
|
+
const shape = moddle.create("bpmndi:BPMNShape", {
|
|
2837
|
+
id: uid("BPMNShape", node.id),
|
|
2838
|
+
bpmnElement: { id: node.id },
|
|
2839
|
+
bounds
|
|
2840
|
+
});
|
|
2841
|
+
if (node.data.isExpanded !== void 0) {
|
|
2842
|
+
shape.isExpanded = node.data.isExpanded;
|
|
2843
|
+
}
|
|
2844
|
+
shapes.push(shape);
|
|
2845
|
+
}
|
|
2846
|
+
for (const edge of edges) {
|
|
2847
|
+
const waypoints = edge.data?.routingPoints?.map(
|
|
2848
|
+
(p) => moddle.create("dc:Point", { x: p.x, y: p.y })
|
|
2849
|
+
) ?? [];
|
|
2850
|
+
edgeShapes.push(
|
|
2851
|
+
moddle.create("bpmndi:BPMNEdge", {
|
|
2852
|
+
id: uid("BPMNEdge", edge.id),
|
|
2853
|
+
bpmnElement: { id: edge.id },
|
|
2854
|
+
waypoint: waypoints
|
|
2855
|
+
})
|
|
2856
|
+
);
|
|
2857
|
+
}
|
|
2858
|
+
const rootEls = definitions.rootElements;
|
|
2859
|
+
const planeElement = rootEls?.[0];
|
|
2860
|
+
const plane = moddle.create("bpmndi:BPMNPlane", {
|
|
2861
|
+
id: "BPMNPlane_1",
|
|
2862
|
+
bpmnElement: planeElement ?? { id: "unknown" },
|
|
2863
|
+
planeElement: [...shapes, ...edgeShapes]
|
|
2864
|
+
});
|
|
2865
|
+
const diagram = moddle.create("bpmndi:BPMNDiagram", {
|
|
2866
|
+
id: "BPMNDiagram_1",
|
|
2867
|
+
plane
|
|
2868
|
+
});
|
|
2869
|
+
definitions.diagrams = [diagram];
|
|
2870
|
+
}
|
|
2871
|
+
async function serializeBpmnXml(nodes, edges, opts = {}) {
|
|
2872
|
+
const moddle = new bpmnModdle.BpmnModdle();
|
|
2873
|
+
const definitions = buildSemanticModel(moddle, nodes, edges, opts);
|
|
2874
|
+
buildBpmnDI(moddle, definitions, nodes, edges);
|
|
2875
|
+
const { xml } = await moddle.toXML(definitions, {
|
|
2876
|
+
format: opts.format ?? true
|
|
2877
|
+
});
|
|
2878
|
+
return xml;
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
// src/simulation/evaluator.ts
|
|
2882
|
+
function parseValue(raw) {
|
|
2883
|
+
if (raw === "true") return true;
|
|
2884
|
+
if (raw === "false") return false;
|
|
2885
|
+
if (raw.startsWith("'") && raw.endsWith("'") || raw.startsWith('"') && raw.endsWith('"'))
|
|
2886
|
+
return raw.slice(1, -1);
|
|
2887
|
+
const n = Number(raw);
|
|
2888
|
+
return isNaN(n) ? raw : n;
|
|
2889
|
+
}
|
|
2890
|
+
function evalCondition(expr, variables) {
|
|
2891
|
+
const body = expr.trim().replace(/^\$\{|\}$/g, "").trim();
|
|
2892
|
+
if (!body) return false;
|
|
2893
|
+
if (body.startsWith("!")) {
|
|
2894
|
+
const inner = body.slice(1).trim();
|
|
2895
|
+
return !Boolean(variables[inner]);
|
|
2896
|
+
}
|
|
2897
|
+
const neq = body.match(/^(\w+)\s*!=\s*(.+)$/);
|
|
2898
|
+
if (neq) return String(variables[neq[1].trim()]) !== String(parseValue(neq[2].trim()));
|
|
2899
|
+
const eq = body.match(/^(\w+)\s*==\s*(.+)$/);
|
|
2900
|
+
if (eq) {
|
|
2901
|
+
const lhs = variables[eq[1].trim()];
|
|
2902
|
+
const rhs = parseValue(eq[2].trim());
|
|
2903
|
+
return lhs == rhs;
|
|
2904
|
+
}
|
|
2905
|
+
const gte = body.match(/^(\w+)\s*>=\s*(-?\d+\.?\d*)$/);
|
|
2906
|
+
if (gte) return Number(variables[gte[1].trim()]) >= Number(gte[2]);
|
|
2907
|
+
const lte = body.match(/^(\w+)\s*<=\s*(-?\d+\.?\d*)$/);
|
|
2908
|
+
if (lte) return Number(variables[lte[1].trim()]) <= Number(lte[2]);
|
|
2909
|
+
const gt = body.match(/^(\w+)\s*>\s*(-?\d+\.?\d*)$/);
|
|
2910
|
+
if (gt) return Number(variables[gt[1].trim()]) > Number(gt[2]);
|
|
2911
|
+
const lt = body.match(/^(\w+)\s*<\s*(-?\d+\.?\d*)$/);
|
|
2912
|
+
if (lt) return Number(variables[lt[1].trim()]) < Number(lt[2]);
|
|
2913
|
+
return Boolean(variables[body]);
|
|
2914
|
+
}
|
|
2915
|
+
|
|
2916
|
+
// src/simulation/index.ts
|
|
2917
|
+
function seqOut(diagram, nodeId) {
|
|
2918
|
+
return diagram.edges.filter((e) => e.type === "sequenceFlow" && e.source === nodeId);
|
|
2919
|
+
}
|
|
2920
|
+
function seqIn(diagram, nodeId) {
|
|
2921
|
+
return diagram.edges.filter((e) => e.type === "sequenceFlow" && e.target === nodeId);
|
|
2922
|
+
}
|
|
2923
|
+
function nodeById(diagram, id) {
|
|
2924
|
+
return diagram.nodes.find((n) => n.id === id);
|
|
2925
|
+
}
|
|
2926
|
+
function boundaryEventsOf(diagram, hostId) {
|
|
2927
|
+
return diagram.nodes.filter((n) => n.type === "BoundaryEvent" && n.attachedToRef === hostId);
|
|
2928
|
+
}
|
|
2929
|
+
var _tokenCounter = 0;
|
|
2930
|
+
function nextTokenId() {
|
|
2931
|
+
return `tok_${++_tokenCounter}`;
|
|
2932
|
+
}
|
|
2933
|
+
var GATEWAY_TYPES2 = /* @__PURE__ */ new Set([
|
|
2934
|
+
"ExclusiveGateway",
|
|
2935
|
+
"InclusiveGateway",
|
|
2936
|
+
"ParallelGateway",
|
|
2937
|
+
"ComplexGateway",
|
|
2938
|
+
"EventBasedGateway"
|
|
2939
|
+
]);
|
|
2940
|
+
var TASK_TYPES2 = /* @__PURE__ */ new Set([
|
|
2941
|
+
"Task",
|
|
2942
|
+
"UserTask",
|
|
2943
|
+
"ServiceTask",
|
|
2944
|
+
"ScriptTask",
|
|
2945
|
+
"ManualTask",
|
|
2946
|
+
"BusinessRuleTask",
|
|
2947
|
+
"ReceiveTask",
|
|
2948
|
+
"SendTask",
|
|
2949
|
+
"CallActivity"
|
|
2950
|
+
]);
|
|
2951
|
+
function isAutomatic(nodeType) {
|
|
2952
|
+
return nodeType === "StartEvent" || nodeType === "EndEvent" || nodeType === "IntermediateThrowEvent" || GATEWAY_TYPES2.has(nodeType);
|
|
2953
|
+
}
|
|
2954
|
+
function isManual(nodeType) {
|
|
2955
|
+
return TASK_TYPES2.has(nodeType) || nodeType === "IntermediateCatchEvent" || nodeType === "BoundaryEvent";
|
|
2956
|
+
}
|
|
2957
|
+
function isSubProcess(nodeType) {
|
|
2958
|
+
return nodeType === "SubProcess" || nodeType === "Transaction" || nodeType === "AdHocSubProcess";
|
|
2959
|
+
}
|
|
2960
|
+
function getScopeId(diagram, nodeId) {
|
|
2961
|
+
const node = nodeById(diagram, nodeId);
|
|
2962
|
+
if (!node?.parentId) return "root";
|
|
2963
|
+
const parent = nodeById(diagram, node.parentId);
|
|
2964
|
+
return parent && isSubProcess(parent.type) ? node.parentId : "root";
|
|
2965
|
+
}
|
|
2966
|
+
function withLog(state, entry) {
|
|
2967
|
+
return { ...state, log: [...state.log, { ...entry, step: state.step }] };
|
|
2968
|
+
}
|
|
2969
|
+
function disperseToTargets(diagram, state, sourceId, consumedTokenId) {
|
|
2970
|
+
const outEdges = seqOut(diagram, sourceId);
|
|
2971
|
+
if (outEdges.length === 0) return state;
|
|
2972
|
+
let next = {
|
|
2973
|
+
...state,
|
|
2974
|
+
tokens: consumedTokenId !== null ? state.tokens.filter((t) => t.id !== consumedTokenId) : state.tokens
|
|
2975
|
+
};
|
|
2976
|
+
for (const edge of outEdges) {
|
|
2977
|
+
const target = nodeById(diagram, edge.target);
|
|
2978
|
+
if (!target) continue;
|
|
2979
|
+
const newToken = {
|
|
2980
|
+
id: nextTokenId(),
|
|
2981
|
+
elementId: edge.target,
|
|
2982
|
+
scopeId: getScopeId(diagram, edge.target)
|
|
2983
|
+
};
|
|
2984
|
+
next = {
|
|
2985
|
+
...next,
|
|
2986
|
+
tokens: [...next.tokens, newToken]
|
|
2987
|
+
};
|
|
2988
|
+
next = withLog(next, {
|
|
2989
|
+
type: "created",
|
|
2990
|
+
elementId: edge.target,
|
|
2991
|
+
tokenId: newToken.id,
|
|
2992
|
+
message: `Token created at "${target.name ?? edge.target}".`
|
|
2993
|
+
});
|
|
2994
|
+
}
|
|
2995
|
+
return next;
|
|
2996
|
+
}
|
|
2997
|
+
function enterSubProcess(diagram, state, subProcNode) {
|
|
2998
|
+
const childStarts = diagram.nodes.filter(
|
|
2999
|
+
(n) => n.type === "StartEvent" && n.parentId === subProcNode.id
|
|
3000
|
+
);
|
|
3001
|
+
let next = {
|
|
3002
|
+
...state,
|
|
3003
|
+
enteredScopes: [...state.enteredScopes, subProcNode.id]
|
|
3004
|
+
};
|
|
3005
|
+
for (const startNode of childStarts) {
|
|
3006
|
+
const newToken = {
|
|
3007
|
+
id: nextTokenId(),
|
|
3008
|
+
elementId: startNode.id,
|
|
3009
|
+
scopeId: subProcNode.id
|
|
3010
|
+
};
|
|
3011
|
+
next = {
|
|
3012
|
+
...next,
|
|
3013
|
+
tokens: [...next.tokens, newToken]
|
|
3014
|
+
};
|
|
3015
|
+
next = withLog(next, {
|
|
3016
|
+
type: "created",
|
|
3017
|
+
elementId: startNode.id,
|
|
3018
|
+
tokenId: newToken.id,
|
|
3019
|
+
message: `SubProcess "${subProcNode.name ?? subProcNode.id}" entered \u2014 token at "${startNode.name ?? startNode.id}".`
|
|
3020
|
+
});
|
|
3021
|
+
}
|
|
3022
|
+
return next;
|
|
3023
|
+
}
|
|
3024
|
+
function fireAutomatic(diagram, state, token) {
|
|
3025
|
+
const node = nodeById(diagram, token.elementId);
|
|
3026
|
+
if (!node) return state;
|
|
3027
|
+
const { type } = node;
|
|
3028
|
+
const vars = state.variables;
|
|
3029
|
+
if (type === "EndEvent") {
|
|
3030
|
+
let next = {
|
|
3031
|
+
...state,
|
|
3032
|
+
tokens: state.tokens.filter((t) => t.id !== token.id)
|
|
3033
|
+
};
|
|
3034
|
+
next = withLog(next, {
|
|
3035
|
+
type: "consumed",
|
|
3036
|
+
elementId: node.id,
|
|
3037
|
+
tokenId: token.id,
|
|
3038
|
+
message: `Token consumed at end event "${node.name ?? node.id}".`
|
|
3039
|
+
});
|
|
3040
|
+
return next;
|
|
3041
|
+
}
|
|
3042
|
+
if (type === "StartEvent" || type === "IntermediateThrowEvent") {
|
|
3043
|
+
let next = withLog(state, {
|
|
3044
|
+
type: "fired",
|
|
3045
|
+
elementId: node.id,
|
|
3046
|
+
tokenId: token.id,
|
|
3047
|
+
message: `"${node.name ?? node.id}" (${type}) fired.`
|
|
3048
|
+
});
|
|
3049
|
+
return disperseToTargets(diagram, next, node.id, token.id);
|
|
3050
|
+
}
|
|
3051
|
+
if (type === "ExclusiveGateway") {
|
|
3052
|
+
const incoming = seqIn(diagram, node.id);
|
|
3053
|
+
if (incoming.length >= 2) {
|
|
3054
|
+
let next2 = withLog(state, {
|
|
3055
|
+
type: "joined",
|
|
3056
|
+
elementId: node.id,
|
|
3057
|
+
tokenId: token.id,
|
|
3058
|
+
message: `ExclusiveGateway "${node.name ?? node.id}" join \u2014 token passes through.`
|
|
3059
|
+
});
|
|
3060
|
+
return disperseToTargets(diagram, next2, node.id, token.id);
|
|
3061
|
+
}
|
|
3062
|
+
const outEdges = seqOut(diagram, node.id);
|
|
3063
|
+
const chosen = outEdges.find(
|
|
3064
|
+
(e) => e.conditionExpression && !e.isDefault && evalCondition(e.conditionExpression, vars)
|
|
3065
|
+
) ?? outEdges.find((e) => e.isDefault) ?? outEdges[0];
|
|
3066
|
+
if (!chosen) return state;
|
|
3067
|
+
const target = nodeById(diagram, chosen.target);
|
|
3068
|
+
if (!target) return state;
|
|
3069
|
+
const newToken = {
|
|
3070
|
+
id: nextTokenId(),
|
|
3071
|
+
elementId: chosen.target,
|
|
3072
|
+
scopeId: getScopeId(diagram, chosen.target)
|
|
3073
|
+
};
|
|
3074
|
+
let next = {
|
|
3075
|
+
...state,
|
|
3076
|
+
tokens: [...state.tokens.filter((t) => t.id !== token.id), newToken]
|
|
3077
|
+
};
|
|
3078
|
+
next = withLog(next, {
|
|
3079
|
+
type: "fired",
|
|
3080
|
+
elementId: node.id,
|
|
3081
|
+
tokenId: token.id,
|
|
3082
|
+
message: `ExclusiveGateway "${node.name ?? node.id}" split \u2192 "${target.name ?? chosen.target}".`
|
|
3083
|
+
});
|
|
3084
|
+
return next;
|
|
3085
|
+
}
|
|
3086
|
+
if (type === "InclusiveGateway") {
|
|
3087
|
+
const incoming = seqIn(diagram, node.id);
|
|
3088
|
+
if (incoming.length >= 2) {
|
|
3089
|
+
let next2 = withLog(state, {
|
|
3090
|
+
type: "joined",
|
|
3091
|
+
elementId: node.id,
|
|
3092
|
+
tokenId: token.id,
|
|
3093
|
+
message: `InclusiveGateway "${node.name ?? node.id}" join.`
|
|
3094
|
+
});
|
|
3095
|
+
return disperseToTargets(diagram, next2, node.id, token.id);
|
|
3096
|
+
}
|
|
3097
|
+
const outEdges = seqOut(diagram, node.id);
|
|
3098
|
+
const matching = outEdges.filter(
|
|
3099
|
+
(e) => e.conditionExpression && !e.isDefault && evalCondition(e.conditionExpression, vars)
|
|
3100
|
+
);
|
|
3101
|
+
const activePaths = matching.length > 0 ? matching : outEdges.filter((e) => e.isDefault);
|
|
3102
|
+
const paths = activePaths.length > 0 ? activePaths : outEdges;
|
|
3103
|
+
let next = withLog(state, {
|
|
3104
|
+
type: "split",
|
|
3105
|
+
elementId: node.id,
|
|
3106
|
+
tokenId: token.id,
|
|
3107
|
+
message: `InclusiveGateway "${node.name ?? node.id}" split \u2192 ${paths.length} path(s).`
|
|
3108
|
+
});
|
|
3109
|
+
next = { ...next, tokens: next.tokens.filter((t) => t.id !== token.id) };
|
|
3110
|
+
for (const edge of paths) {
|
|
3111
|
+
const tgt = nodeById(diagram, edge.target);
|
|
3112
|
+
if (!tgt) continue;
|
|
3113
|
+
const newToken = {
|
|
3114
|
+
id: nextTokenId(),
|
|
3115
|
+
elementId: edge.target,
|
|
3116
|
+
scopeId: getScopeId(diagram, edge.target)
|
|
3117
|
+
};
|
|
3118
|
+
next = { ...next, tokens: [...next.tokens, newToken] };
|
|
3119
|
+
next = withLog(next, {
|
|
3120
|
+
type: "created",
|
|
3121
|
+
elementId: edge.target,
|
|
3122
|
+
tokenId: newToken.id,
|
|
3123
|
+
message: `Token created at "${tgt.name ?? edge.target}".`
|
|
3124
|
+
});
|
|
3125
|
+
}
|
|
3126
|
+
return next;
|
|
3127
|
+
}
|
|
3128
|
+
if (type === "ParallelGateway") {
|
|
3129
|
+
const incoming = seqIn(diagram, node.id);
|
|
3130
|
+
if (incoming.length >= 2) {
|
|
3131
|
+
const atGateway = state.tokens.filter((t) => t.elementId === node.id);
|
|
3132
|
+
if (atGateway.length < incoming.length) {
|
|
3133
|
+
return withLog(state, {
|
|
3134
|
+
type: "blocked",
|
|
3135
|
+
elementId: node.id,
|
|
3136
|
+
tokenId: token.id,
|
|
3137
|
+
message: `ParallelGateway "${node.name ?? node.id}" waiting for ${incoming.length - atGateway.length} more token(s).`
|
|
3138
|
+
});
|
|
3139
|
+
}
|
|
3140
|
+
const consumeIds = new Set(atGateway.map((t) => t.id));
|
|
3141
|
+
let next2 = {
|
|
3142
|
+
...state,
|
|
3143
|
+
tokens: state.tokens.filter((t) => !consumeIds.has(t.id))
|
|
3144
|
+
};
|
|
3145
|
+
next2 = withLog(next2, {
|
|
3146
|
+
type: "joined",
|
|
3147
|
+
elementId: node.id,
|
|
3148
|
+
message: `ParallelGateway "${node.name ?? node.id}" join fired \u2014 all paths synchronized.`
|
|
3149
|
+
});
|
|
3150
|
+
return disperseToTargets(diagram, next2, node.id, null);
|
|
3151
|
+
}
|
|
3152
|
+
let next = withLog(state, {
|
|
3153
|
+
type: "split",
|
|
3154
|
+
elementId: node.id,
|
|
3155
|
+
tokenId: token.id,
|
|
3156
|
+
message: `ParallelGateway "${node.name ?? node.id}" split \u2192 ${seqOut(diagram, node.id).length} paths.`
|
|
3157
|
+
});
|
|
3158
|
+
return disperseToTargets(diagram, next, node.id, token.id);
|
|
3159
|
+
}
|
|
3160
|
+
if (type === "EventBasedGateway") {
|
|
3161
|
+
let next = withLog(state, {
|
|
3162
|
+
type: "split",
|
|
3163
|
+
elementId: node.id,
|
|
3164
|
+
tokenId: token.id,
|
|
3165
|
+
message: `EventBasedGateway "${node.name ?? node.id}" waiting \u2014 ${seqOut(diagram, node.id).length} competing event(s).`
|
|
3166
|
+
});
|
|
3167
|
+
return disperseToTargets(diagram, next, node.id, token.id);
|
|
3168
|
+
}
|
|
3169
|
+
if (type === "ComplexGateway") {
|
|
3170
|
+
const outEdges = seqOut(diagram, node.id);
|
|
3171
|
+
const chosen = outEdges[0];
|
|
3172
|
+
if (!chosen) return state;
|
|
3173
|
+
const newToken = {
|
|
3174
|
+
id: nextTokenId(),
|
|
3175
|
+
elementId: chosen.target,
|
|
3176
|
+
scopeId: getScopeId(diagram, chosen.target)
|
|
3177
|
+
};
|
|
3178
|
+
let next = {
|
|
3179
|
+
...state,
|
|
3180
|
+
tokens: [...state.tokens.filter((t) => t.id !== token.id), newToken]
|
|
3181
|
+
};
|
|
3182
|
+
next = withLog(next, {
|
|
3183
|
+
type: "fired",
|
|
3184
|
+
elementId: node.id,
|
|
3185
|
+
tokenId: token.id,
|
|
3186
|
+
message: `ComplexGateway "${node.name ?? node.id}" fired \u2192 "${chosen.target}".`
|
|
3187
|
+
});
|
|
3188
|
+
return next;
|
|
3189
|
+
}
|
|
3190
|
+
return state;
|
|
3191
|
+
}
|
|
3192
|
+
function createSimulation(diagram, initialVariables = {}) {
|
|
3193
|
+
_tokenCounter = 0;
|
|
3194
|
+
const startEvents = diagram.nodes.filter(
|
|
3195
|
+
(n) => n.type === "StartEvent" && !n.parentId
|
|
3196
|
+
);
|
|
3197
|
+
const tokens = startEvents.map((n) => ({
|
|
3198
|
+
id: nextTokenId(),
|
|
3199
|
+
elementId: n.id,
|
|
3200
|
+
scopeId: "root"
|
|
3201
|
+
}));
|
|
3202
|
+
const log = startEvents.map((n, i) => ({
|
|
3203
|
+
step: 0,
|
|
3204
|
+
type: "created",
|
|
3205
|
+
elementId: n.id,
|
|
3206
|
+
tokenId: tokens[i]?.id,
|
|
3207
|
+
message: `Simulation started \u2014 token placed at "${n.name ?? n.id}".`
|
|
3208
|
+
}));
|
|
3209
|
+
return {
|
|
3210
|
+
tokens,
|
|
3211
|
+
step: 0,
|
|
3212
|
+
status: startEvents.length > 0 ? "running" : "idle",
|
|
3213
|
+
log,
|
|
3214
|
+
variables: initialVariables,
|
|
3215
|
+
enteredScopes: []
|
|
3216
|
+
};
|
|
3217
|
+
}
|
|
3218
|
+
function tick(diagram, state) {
|
|
3219
|
+
if (state.status !== "running") return state;
|
|
3220
|
+
let current = { ...state, step: state.step + 1 };
|
|
3221
|
+
let changed = true;
|
|
3222
|
+
let guard = 0;
|
|
3223
|
+
while (changed && guard < 1e3) {
|
|
3224
|
+
guard++;
|
|
3225
|
+
changed = false;
|
|
3226
|
+
for (const token of current.tokens) {
|
|
3227
|
+
const node = nodeById(diagram, token.elementId);
|
|
3228
|
+
if (!node) continue;
|
|
3229
|
+
if (isSubProcess(node.type)) {
|
|
3230
|
+
if (!current.enteredScopes.includes(node.id)) {
|
|
3231
|
+
const childStarts = diagram.nodes.filter(
|
|
3232
|
+
(n) => n.type === "StartEvent" && n.parentId === node.id
|
|
3233
|
+
);
|
|
3234
|
+
if (childStarts.length > 0) {
|
|
3235
|
+
current = enterSubProcess(diagram, current, node);
|
|
3236
|
+
changed = true;
|
|
3237
|
+
break;
|
|
3238
|
+
}
|
|
3239
|
+
} else {
|
|
3240
|
+
const scopeTokens = current.tokens.filter((t) => t.scopeId === node.id);
|
|
3241
|
+
if (scopeTokens.length === 0) {
|
|
3242
|
+
let next = withLog(current, {
|
|
3243
|
+
type: "fired",
|
|
3244
|
+
elementId: node.id,
|
|
3245
|
+
tokenId: token.id,
|
|
3246
|
+
message: `SubProcess "${node.name ?? node.id}" completed.`
|
|
3247
|
+
});
|
|
3248
|
+
current = disperseToTargets(diagram, next, node.id, token.id);
|
|
3249
|
+
changed = true;
|
|
3250
|
+
break;
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
continue;
|
|
3254
|
+
}
|
|
3255
|
+
if (node.type === "ParallelGateway") {
|
|
3256
|
+
const incoming = seqIn(diagram, node.id);
|
|
3257
|
+
const atGateway = current.tokens.filter((t) => t.elementId === node.id);
|
|
3258
|
+
if (incoming.length >= 2 && atGateway.length < incoming.length) continue;
|
|
3259
|
+
}
|
|
3260
|
+
if (!isAutomatic(node.type)) continue;
|
|
3261
|
+
const prevLen = current.tokens.length;
|
|
3262
|
+
const prevIds = new Set(current.tokens.map((t) => t.id));
|
|
3263
|
+
current = fireAutomatic(diagram, current, token);
|
|
3264
|
+
const same = current.tokens.length === prevLen && [...prevIds].every((id) => current.tokens.some((t) => t.id === id));
|
|
3265
|
+
if (!same) {
|
|
3266
|
+
changed = true;
|
|
3267
|
+
break;
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
if (current.tokens.length === 0) {
|
|
3272
|
+
current = { ...current, status: "completed" };
|
|
3273
|
+
}
|
|
3274
|
+
return current;
|
|
3275
|
+
}
|
|
3276
|
+
function fire(diagram, state, elementId, variables) {
|
|
3277
|
+
if (state.status !== "running") return state;
|
|
3278
|
+
const node = nodeById(diagram, elementId);
|
|
3279
|
+
if (!node) return state;
|
|
3280
|
+
const mergedVars = variables ? { ...state.variables, ...variables } : state.variables;
|
|
3281
|
+
if (node.type === "BoundaryEvent") {
|
|
3282
|
+
const hostId = node.attachedToRef;
|
|
3283
|
+
if (!hostId) return state;
|
|
3284
|
+
const hostToken = state.tokens.find((t) => t.elementId === hostId);
|
|
3285
|
+
if (!hostToken) return state;
|
|
3286
|
+
const isInterrupting = node.isInterrupting !== false;
|
|
3287
|
+
let next2 = { ...state, variables: mergedVars, step: state.step + 1 };
|
|
3288
|
+
next2 = withLog(next2, {
|
|
3289
|
+
type: isInterrupting ? "interrupted" : "fired",
|
|
3290
|
+
elementId,
|
|
3291
|
+
tokenId: hostToken.id,
|
|
3292
|
+
message: `BoundaryEvent "${node.name ?? elementId}" fired (${isInterrupting ? "interrupting" : "non-interrupting"}).`
|
|
3293
|
+
});
|
|
3294
|
+
if (isInterrupting) {
|
|
3295
|
+
next2 = { ...next2, tokens: next2.tokens.filter((t) => t.id !== hostToken.id) };
|
|
3296
|
+
}
|
|
3297
|
+
next2 = disperseToTargets(diagram, next2, elementId, null);
|
|
3298
|
+
return tick(diagram, { ...next2, step: next2.step - 1 });
|
|
3299
|
+
}
|
|
3300
|
+
const token = state.tokens.find((t) => t.elementId === elementId);
|
|
3301
|
+
if (!token) return state;
|
|
3302
|
+
if (node.type === "IntermediateCatchEvent") {
|
|
3303
|
+
const gwEdge = seqIn(diagram, elementId).find((e) => {
|
|
3304
|
+
const src = nodeById(diagram, e.source);
|
|
3305
|
+
return src?.type === "EventBasedGateway";
|
|
3306
|
+
});
|
|
3307
|
+
if (gwEdge) {
|
|
3308
|
+
const gw = nodeById(diagram, gwEdge.source);
|
|
3309
|
+
if (gw) {
|
|
3310
|
+
const siblingTargets = new Set(
|
|
3311
|
+
seqOut(diagram, gw.id).map((e) => e.target).filter((id) => id !== elementId)
|
|
3312
|
+
);
|
|
3313
|
+
state = {
|
|
3314
|
+
...state,
|
|
3315
|
+
tokens: state.tokens.filter((t) => !siblingTargets.has(t.elementId))
|
|
3316
|
+
};
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
let next = { ...state, variables: mergedVars, step: state.step + 1 };
|
|
3321
|
+
next = withLog(next, {
|
|
3322
|
+
type: "fired",
|
|
3323
|
+
elementId,
|
|
3324
|
+
tokenId: token.id,
|
|
3325
|
+
message: `"${node.name ?? elementId}" (${node.type}) manually fired.`
|
|
3326
|
+
});
|
|
3327
|
+
next = disperseToTargets(diagram, next, elementId, token.id);
|
|
3328
|
+
return tick(diagram, { ...next, step: next.step - 1 });
|
|
3329
|
+
}
|
|
3330
|
+
function getFireable(diagram, state) {
|
|
3331
|
+
if (state.status !== "running") return [];
|
|
3332
|
+
const fireable = /* @__PURE__ */ new Set();
|
|
3333
|
+
for (const token of state.tokens) {
|
|
3334
|
+
const node = nodeById(diagram, token.elementId);
|
|
3335
|
+
if (!node) continue;
|
|
3336
|
+
if (isManual(node.type)) {
|
|
3337
|
+
fireable.add(node.id);
|
|
3338
|
+
}
|
|
3339
|
+
if (TASK_TYPES2.has(node.type)) {
|
|
3340
|
+
for (const be of boundaryEventsOf(diagram, node.id)) {
|
|
3341
|
+
fireable.add(be.id);
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
return [...fireable];
|
|
3346
|
+
}
|
|
3347
|
+
function isCompleted(state) {
|
|
3348
|
+
return state.status === "completed";
|
|
3349
|
+
}
|
|
3350
|
+
function setVariable(state, key, value) {
|
|
3351
|
+
return { ...state, variables: { ...state.variables, [key]: value } };
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3354
|
+
// src/flowable/adapter.ts
|
|
3355
|
+
var PreviewAdapter = class {
|
|
3356
|
+
constructor(diagram, initialVariables = {}) {
|
|
3357
|
+
this.diagram = diagram;
|
|
3358
|
+
this.mode = "preview";
|
|
3359
|
+
this.state = createSimulation(diagram, initialVariables);
|
|
3360
|
+
}
|
|
3361
|
+
async start(variables) {
|
|
3362
|
+
this.state = tick(this.diagram, createSimulation(this.diagram, variables ?? {}));
|
|
3363
|
+
return this.state;
|
|
3364
|
+
}
|
|
3365
|
+
async tick() {
|
|
3366
|
+
this.state = tick(this.diagram, this.state);
|
|
3367
|
+
return this.state;
|
|
3368
|
+
}
|
|
3369
|
+
async fire(elementId, variables) {
|
|
3370
|
+
this.state = fire(this.diagram, this.state, elementId, variables);
|
|
3371
|
+
return this.state;
|
|
3372
|
+
}
|
|
3373
|
+
async getFireable() {
|
|
3374
|
+
return getFireable(this.diagram, this.state);
|
|
3375
|
+
}
|
|
3376
|
+
getState() {
|
|
3377
|
+
return this.state;
|
|
3378
|
+
}
|
|
3379
|
+
isCompleted() {
|
|
3380
|
+
return isCompleted(this.state);
|
|
3381
|
+
}
|
|
3382
|
+
};
|
|
3383
|
+
function createPreviewAdapter(diagram, initialVariables) {
|
|
3384
|
+
return new PreviewAdapter(diagram, initialVariables);
|
|
3385
|
+
}
|
|
3386
|
+
|
|
3387
|
+
exports.AnnotationNode = AnnotationNode;
|
|
3388
|
+
exports.AssociationEdge = AssociationEdge;
|
|
3389
|
+
exports.BPMN_EDGE_TYPES = BPMN_EDGE_TYPES;
|
|
3390
|
+
exports.BPMN_ELEMENT_CATALOG = BPMN_ELEMENT_CATALOG;
|
|
3391
|
+
exports.BPMN_NODE_TYPES = BPMN_NODE_TYPES;
|
|
3392
|
+
exports.BoundaryEventNode = BoundaryEventNode;
|
|
3393
|
+
exports.CallChoreographyNode = CallChoreographyNode;
|
|
3394
|
+
exports.CallConversationNode = CallConversationNode;
|
|
3395
|
+
exports.ChoreographyTaskNode = ChoreographyTaskNode;
|
|
3396
|
+
exports.ConversationLinkEdge = ConversationLinkEdge;
|
|
3397
|
+
exports.ConversationNode = ConversationNode;
|
|
3398
|
+
exports.DataAssociationEdge = DataAssociationEdge;
|
|
3399
|
+
exports.DataInputNode = DataInputNode;
|
|
3400
|
+
exports.DataObjectNode = DataObjectNode;
|
|
3401
|
+
exports.DataObjectReferenceNode = DataObjectReferenceNode;
|
|
3402
|
+
exports.DataOutputNode = DataOutputNode;
|
|
3403
|
+
exports.DataStoreNode = DataStoreNode;
|
|
3404
|
+
exports.DataStoreReferenceNode = DataStoreReferenceNode;
|
|
3405
|
+
exports.EndEventNode = EndEventNode;
|
|
3406
|
+
exports.GatewayNode = GatewayNode;
|
|
3407
|
+
exports.GroupNode = GroupNode;
|
|
3408
|
+
exports.IntermediateCatchEventNode = IntermediateCatchEventNode;
|
|
3409
|
+
exports.IntermediateThrowEventNode = IntermediateThrowEventNode;
|
|
3410
|
+
exports.LaneNode = LaneNode;
|
|
3411
|
+
exports.MessageFlowEdge = MessageFlowEdge;
|
|
3412
|
+
exports.PoolNode = PoolNode;
|
|
3413
|
+
exports.SequenceFlowEdge = SequenceFlowEdge;
|
|
3414
|
+
exports.StartEventNode = StartEventNode;
|
|
3415
|
+
exports.SubChoreographyNode = SubChoreographyNode;
|
|
3416
|
+
exports.SubConversationNode = SubConversationNode;
|
|
3417
|
+
exports.SubProcessNode = SubProcessNode;
|
|
3418
|
+
exports.TaskNode = TaskNode;
|
|
3419
|
+
exports.acceptsBoundaryEvents = acceptsBoundaryEvents;
|
|
3420
|
+
exports.createPreviewAdapter = createPreviewAdapter;
|
|
3421
|
+
exports.createSimulation = createSimulation;
|
|
3422
|
+
exports.fire = fire;
|
|
3423
|
+
exports.getElementMeta = getElementMeta;
|
|
3424
|
+
exports.getFireable = getFireable;
|
|
3425
|
+
exports.getHandlePolicy = getHandlePolicy;
|
|
3426
|
+
exports.getOrientation = getOrientation;
|
|
3427
|
+
exports.isChoreographyType = isChoreographyType;
|
|
3428
|
+
exports.isCompleted = isCompleted;
|
|
3429
|
+
exports.isContainerType = isContainerType;
|
|
3430
|
+
exports.isConversationType = isConversationType;
|
|
3431
|
+
exports.isDataType = isDataType;
|
|
3432
|
+
exports.isEventType = isEventType;
|
|
3433
|
+
exports.isGatewayType = isGatewayType;
|
|
3434
|
+
exports.isTaskType = isTaskType;
|
|
3435
|
+
exports.parseBpmnXml = parseBpmnXml;
|
|
3436
|
+
exports.serializeBpmnXml = serializeBpmnXml;
|
|
3437
|
+
exports.setVariable = setVariable;
|
|
3438
|
+
exports.supportsCollapse = supportsCollapse;
|
|
3439
|
+
exports.supportsMarkers = supportsMarkers;
|
|
3440
|
+
exports.tick = tick;
|
|
3441
|
+
//# sourceMappingURL=index.cjs.map
|
|
3442
|
+
//# sourceMappingURL=index.cjs.map
|