@bpmnkit/core 0.0.27 → 0.1.1
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/bpmn/auto-layout.js +39 -126
- package/dist/bpmn/bpmn-builder.d.ts +30 -0
- package/dist/bpmn/bpmn-builder.js +350 -31
- package/dist/bpmn/bpmn-model.d.ts +35 -2
- package/dist/bpmn/bpmn-parser.js +39 -1
- package/dist/bpmn/bpmn-serializer.js +27 -0
- package/dist/bpmn/compact.js +11 -1
- package/dist/bpmn/di-check.d.ts +14 -0
- package/dist/bpmn/di-check.js +51 -0
- package/dist/bpmn/di-planes.d.ts +13 -0
- package/dist/bpmn/di-planes.js +20 -0
- package/dist/bpmn/optimize/tasks.js +1 -0
- package/dist/bpmn/svg.js +36 -4
- package/dist/bpmn/type-guards.d.ts +7 -1
- package/dist/bpmn/type-guards.js +13 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +3 -1
- package/dist/layout/annotations.d.ts +27 -0
- package/dist/layout/annotations.js +251 -0
- package/dist/layout/grid/edge-labels.d.ts +8 -0
- package/dist/layout/grid/edge-labels.js +126 -0
- package/dist/layout/grid/flow-graph.d.ts +25 -0
- package/dist/layout/grid/flow-graph.js +99 -0
- package/dist/layout/grid/grid-engine.d.ts +4 -0
- package/dist/layout/grid/grid-engine.js +214 -0
- package/dist/layout/grid/grid-router.d.ts +36 -0
- package/dist/layout/grid/grid-router.js +190 -0
- package/dist/layout/grid/grid.d.ts +43 -0
- package/dist/layout/grid/grid.js +174 -0
- package/dist/layout/grid/walker.d.ts +11 -0
- package/dist/layout/grid/walker.js +126 -0
- package/dist/layout/index.d.ts +2 -5
- package/dist/layout/index.js +1 -4
- package/dist/layout/layout-engine.d.ts +5 -15
- package/dist/layout/layout-engine.js +8 -486
- package/dist/layout/types.js +4 -0
- package/dist/xml/xml-parser.js +5 -0
- package/package.json +1 -1
- package/dist/layout/astar.d.ts +0 -15
- package/dist/layout/astar.js +0 -191
- package/dist/layout/block-builder.d.ts +0 -37
- package/dist/layout/block-builder.js +0 -154
- package/dist/layout/block-layout.d.ts +0 -9
- package/dist/layout/block-layout.js +0 -163
- package/dist/layout/coordinates.d.ts +0 -85
- package/dist/layout/coordinates.js +0 -1392
- package/dist/layout/crossing.d.ts +0 -8
- package/dist/layout/crossing.js +0 -60
- package/dist/layout/graph.d.ts +0 -28
- package/dist/layout/graph.js +0 -126
- package/dist/layout/layers.d.ts +0 -13
- package/dist/layout/layers.js +0 -49
- package/dist/layout/routing.d.ts +0 -33
- package/dist/layout/routing.js +0 -622
- package/dist/layout/subprocess.d.ts +0 -14
- package/dist/layout/subprocess.js +0 -115
package/dist/bpmn/bpmn-parser.js
CHANGED
|
@@ -59,6 +59,10 @@ const KNOWN_ATTRS = new Set([
|
|
|
59
59
|
"exporter",
|
|
60
60
|
"exporterVersion",
|
|
61
61
|
"processRef",
|
|
62
|
+
"dataObjectRef",
|
|
63
|
+
"dataStoreRef",
|
|
64
|
+
"isCollection",
|
|
65
|
+
"categoryValueRef",
|
|
62
66
|
]);
|
|
63
67
|
/** Extract unknown (namespace-qualified) attributes from an element. */
|
|
64
68
|
function unknownAttrs(element) {
|
|
@@ -261,6 +265,9 @@ const FLOW_ELEMENT_TYPES = new Set([
|
|
|
261
265
|
"inclusiveGateway",
|
|
262
266
|
"eventBasedGateway",
|
|
263
267
|
"complexGateway",
|
|
268
|
+
"dataObject",
|
|
269
|
+
"dataObjectReference",
|
|
270
|
+
"dataStoreReference",
|
|
264
271
|
]);
|
|
265
272
|
function parseFlowElement(element) {
|
|
266
273
|
const ln = localName(element.name);
|
|
@@ -361,6 +368,25 @@ function parseFlowElement(element) {
|
|
|
361
368
|
return { ...base, type: "eventBasedGateway" };
|
|
362
369
|
case "complexGateway":
|
|
363
370
|
return { ...base, type: "complexGateway", default: attr(element, "default") };
|
|
371
|
+
case "dataObject":
|
|
372
|
+
return {
|
|
373
|
+
...base,
|
|
374
|
+
type: "dataObject",
|
|
375
|
+
...(attr(element, "isCollection") === "true" ? { isCollection: true } : {}),
|
|
376
|
+
};
|
|
377
|
+
case "dataObjectReference":
|
|
378
|
+
return {
|
|
379
|
+
...base,
|
|
380
|
+
type: "dataObjectReference",
|
|
381
|
+
dataObjectRef: attr(element, "dataObjectRef"),
|
|
382
|
+
...(attr(element, "isCollection") === "true" ? { isCollection: true } : {}),
|
|
383
|
+
};
|
|
384
|
+
case "dataStoreReference":
|
|
385
|
+
return {
|
|
386
|
+
...base,
|
|
387
|
+
type: "dataStoreReference",
|
|
388
|
+
dataStoreRef: attr(element, "dataStoreRef"),
|
|
389
|
+
};
|
|
364
390
|
default:
|
|
365
391
|
return undefined;
|
|
366
392
|
}
|
|
@@ -407,6 +433,13 @@ function parseAssociation(element) {
|
|
|
407
433
|
unknownAttributes: unknownAttrs(element),
|
|
408
434
|
};
|
|
409
435
|
}
|
|
436
|
+
function parseGroup(element) {
|
|
437
|
+
return {
|
|
438
|
+
id: requiredAttr(element, "id"),
|
|
439
|
+
categoryValueRef: attr(element, "categoryValueRef"),
|
|
440
|
+
unknownAttributes: unknownAttrs(element),
|
|
441
|
+
};
|
|
442
|
+
}
|
|
410
443
|
// ---------------------------------------------------------------------------
|
|
411
444
|
// Process contents (shared between process and adHocSubProcess)
|
|
412
445
|
// ---------------------------------------------------------------------------
|
|
@@ -415,6 +448,7 @@ function parseProcessContents(element) {
|
|
|
415
448
|
const sequenceFlows = [];
|
|
416
449
|
const textAnnotations = [];
|
|
417
450
|
const associations = [];
|
|
451
|
+
const groups = [];
|
|
418
452
|
for (const child of element.children) {
|
|
419
453
|
const ln = localName(child.name);
|
|
420
454
|
if (FLOW_ELEMENT_TYPES.has(ln)) {
|
|
@@ -431,8 +465,11 @@ function parseProcessContents(element) {
|
|
|
431
465
|
else if (ln === "association") {
|
|
432
466
|
associations.push(parseAssociation(child));
|
|
433
467
|
}
|
|
468
|
+
else if (ln === "group") {
|
|
469
|
+
groups.push(parseGroup(child));
|
|
470
|
+
}
|
|
434
471
|
}
|
|
435
|
-
return { flowElements, sequenceFlows, textAnnotations, associations };
|
|
472
|
+
return { flowElements, sequenceFlows, textAnnotations, associations, groups };
|
|
436
473
|
}
|
|
437
474
|
// ---------------------------------------------------------------------------
|
|
438
475
|
// Lanes
|
|
@@ -498,6 +535,7 @@ function parseCollaboration(element) {
|
|
|
498
535
|
messageFlows: findChildren(element, "messageFlow").map(parseMessageFlow),
|
|
499
536
|
textAnnotations: findChildren(element, "textAnnotation").map(parseTextAnnotation),
|
|
500
537
|
associations: findChildren(element, "association").map(parseAssociation),
|
|
538
|
+
groups: findChildren(element, "group").map(parseGroup),
|
|
501
539
|
extensionElements: parseExtensionElements(element),
|
|
502
540
|
unknownAttributes: unknownAttrs(element),
|
|
503
541
|
};
|
|
@@ -233,6 +233,20 @@ function serializeFlowElement(fe, ns) {
|
|
|
233
233
|
case "parallelGateway":
|
|
234
234
|
case "eventBasedGateway":
|
|
235
235
|
break;
|
|
236
|
+
case "dataObject":
|
|
237
|
+
if (fe.isCollection)
|
|
238
|
+
attrs.isCollection = "true";
|
|
239
|
+
break;
|
|
240
|
+
case "dataObjectReference":
|
|
241
|
+
if (fe.dataObjectRef !== undefined)
|
|
242
|
+
attrs.dataObjectRef = fe.dataObjectRef;
|
|
243
|
+
if (fe.isCollection)
|
|
244
|
+
attrs.isCollection = "true";
|
|
245
|
+
break;
|
|
246
|
+
case "dataStoreReference":
|
|
247
|
+
if (fe.dataStoreRef !== undefined)
|
|
248
|
+
attrs.dataStoreRef = fe.dataStoreRef;
|
|
249
|
+
break;
|
|
236
250
|
}
|
|
237
251
|
return el(`${bp}:${fe.type}`, attrs, children);
|
|
238
252
|
}
|
|
@@ -276,6 +290,12 @@ function serializeAssociation(a, bp) {
|
|
|
276
290
|
attrs.associationDirection = a.associationDirection;
|
|
277
291
|
return el(`${bp}:association`, attrs, []);
|
|
278
292
|
}
|
|
293
|
+
function serializeGroup(g, bp) {
|
|
294
|
+
const attrs = { id: g.id, ...g.unknownAttributes };
|
|
295
|
+
if (g.categoryValueRef !== undefined)
|
|
296
|
+
attrs.categoryValueRef = g.categoryValueRef;
|
|
297
|
+
return el(`${bp}:group`, attrs, []);
|
|
298
|
+
}
|
|
279
299
|
// ---------------------------------------------------------------------------
|
|
280
300
|
// Process contents
|
|
281
301
|
// ---------------------------------------------------------------------------
|
|
@@ -294,6 +314,10 @@ function serializeProcessContents(p, ns) {
|
|
|
294
314
|
for (const a of p.associations) {
|
|
295
315
|
children.push(serializeAssociation(a, bp));
|
|
296
316
|
}
|
|
317
|
+
// `groups` may be absent on hand-constructed partial models.
|
|
318
|
+
for (const g of p.groups ?? []) {
|
|
319
|
+
children.push(serializeGroup(g, bp));
|
|
320
|
+
}
|
|
297
321
|
return children;
|
|
298
322
|
}
|
|
299
323
|
// ---------------------------------------------------------------------------
|
|
@@ -370,6 +394,9 @@ function serializeCollaboration(c, ns) {
|
|
|
370
394
|
for (const a of c.associations) {
|
|
371
395
|
children.push(serializeAssociation(a, bp));
|
|
372
396
|
}
|
|
397
|
+
for (const g of c.groups ?? []) {
|
|
398
|
+
children.push(serializeGroup(g, bp));
|
|
399
|
+
}
|
|
373
400
|
return el(`${bp}:collaboration`, { id: c.id, ...c.unknownAttributes }, children);
|
|
374
401
|
}
|
|
375
402
|
// ---------------------------------------------------------------------------
|
package/dist/bpmn/compact.js
CHANGED
|
@@ -192,7 +192,13 @@ function makeExtensions(el) {
|
|
|
192
192
|
}
|
|
193
193
|
function buildSubContent(children) {
|
|
194
194
|
if (!children || children.elements.length === 0) {
|
|
195
|
-
return {
|
|
195
|
+
return {
|
|
196
|
+
flowElements: [],
|
|
197
|
+
sequenceFlows: [],
|
|
198
|
+
textAnnotations: [],
|
|
199
|
+
associations: [],
|
|
200
|
+
groups: [],
|
|
201
|
+
};
|
|
196
202
|
}
|
|
197
203
|
const inc = new Map();
|
|
198
204
|
const out = new Map();
|
|
@@ -217,6 +223,7 @@ function buildSubContent(children) {
|
|
|
217
223
|
})),
|
|
218
224
|
textAnnotations: [],
|
|
219
225
|
associations: [],
|
|
226
|
+
groups: [],
|
|
220
227
|
};
|
|
221
228
|
}
|
|
222
229
|
function buildFlowElement(el, incoming, outgoing) {
|
|
@@ -284,6 +291,8 @@ function buildFlowElement(el, incoming, outgoing) {
|
|
|
284
291
|
return { ...base, type: "eventBasedGateway" };
|
|
285
292
|
case "complexGateway":
|
|
286
293
|
return { ...base, type: "complexGateway" };
|
|
294
|
+
default:
|
|
295
|
+
return { ...base, type: "task" };
|
|
287
296
|
}
|
|
288
297
|
}
|
|
289
298
|
function buildDiagram(processId, process) {
|
|
@@ -342,6 +351,7 @@ function expandProcess(compact) {
|
|
|
342
351
|
sequenceFlows,
|
|
343
352
|
textAnnotations: [],
|
|
344
353
|
associations: [],
|
|
354
|
+
groups: [],
|
|
345
355
|
unknownAttributes: {},
|
|
346
356
|
};
|
|
347
357
|
return { process, diagram: buildDiagram(compact.id, process) };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BpmnDefinitions } from "./bpmn-model.js";
|
|
2
|
+
export interface DiCompleteness {
|
|
3
|
+
missingShapes: string[];
|
|
4
|
+
missingEdges: string[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Assert the diagram DI is complete: every flow node (recursively, incl.
|
|
8
|
+
* subprocess children and boundary events) and text annotation has a
|
|
9
|
+
* BPMNShape; every sequence flow, association and message flow has a
|
|
10
|
+
* BPMNEdge. Lanes are ignored (no reliable lane DI — matches the
|
|
11
|
+
* tmp/02-di-check.cjs rule this ports).
|
|
12
|
+
*/
|
|
13
|
+
export declare function checkDiCompleteness(defs: BpmnDefinitions): DiCompleteness;
|
|
14
|
+
//# sourceMappingURL=di-check.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assert the diagram DI is complete: every flow node (recursively, incl.
|
|
3
|
+
* subprocess children and boundary events) and text annotation has a
|
|
4
|
+
* BPMNShape; every sequence flow, association and message flow has a
|
|
5
|
+
* BPMNEdge. Lanes are ignored (no reliable lane DI — matches the
|
|
6
|
+
* tmp/02-di-check.cjs rule this ports).
|
|
7
|
+
*/
|
|
8
|
+
export function checkDiCompleteness(defs) {
|
|
9
|
+
const shapes = new Set();
|
|
10
|
+
const edges = new Set();
|
|
11
|
+
for (const d of defs.diagrams) {
|
|
12
|
+
for (const s of d.plane.shapes)
|
|
13
|
+
shapes.add(s.bpmnElement);
|
|
14
|
+
for (const e of d.plane.edges)
|
|
15
|
+
edges.add(e.bpmnElement);
|
|
16
|
+
}
|
|
17
|
+
const missingShapes = [];
|
|
18
|
+
const missingEdges = [];
|
|
19
|
+
function walkElements(els, flows) {
|
|
20
|
+
for (const el of els) {
|
|
21
|
+
if (!shapes.has(el.id))
|
|
22
|
+
missingShapes.push(el.id);
|
|
23
|
+
const sub = el;
|
|
24
|
+
if (sub.flowElements?.length)
|
|
25
|
+
walkElements(sub.flowElements, sub.sequenceFlows ?? []);
|
|
26
|
+
}
|
|
27
|
+
for (const f of flows) {
|
|
28
|
+
if (!edges.has(f.id))
|
|
29
|
+
missingEdges.push(f.id);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
for (const p of defs.processes) {
|
|
33
|
+
walkElements(p.flowElements, p.sequenceFlows);
|
|
34
|
+
for (const ta of p.textAnnotations)
|
|
35
|
+
if (!shapes.has(ta.id))
|
|
36
|
+
missingShapes.push(ta.id);
|
|
37
|
+
for (const a of p.associations)
|
|
38
|
+
if (!edges.has(a.id))
|
|
39
|
+
missingEdges.push(a.id);
|
|
40
|
+
}
|
|
41
|
+
for (const c of defs.collaborations) {
|
|
42
|
+
for (const part of c.participants)
|
|
43
|
+
if (!shapes.has(part.id))
|
|
44
|
+
missingShapes.push(part.id);
|
|
45
|
+
for (const mf of c.messageFlows)
|
|
46
|
+
if (!edges.has(mf.id))
|
|
47
|
+
missingEdges.push(mf.id);
|
|
48
|
+
}
|
|
49
|
+
return { missingShapes, missingEdges };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=di-check.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BpmnDefinitions, BpmnDiPlane } from "./bpmn-model.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the DI plane whose `bpmnElement` matches `elementId`, if any.
|
|
4
|
+
*
|
|
5
|
+
* The primary plane's `bpmnElement` is a process or collaboration id; a
|
|
6
|
+
* collapsed sub-process that carries its own layout has a separate
|
|
7
|
+
* `BPMNDiagram` whose plane `bpmnElement` is the sub-process id. This resolves
|
|
8
|
+
* either.
|
|
9
|
+
*/
|
|
10
|
+
export declare function planeForElement(defs: BpmnDefinitions, elementId: string): BpmnDiPlane | undefined;
|
|
11
|
+
/** Lists every DI plane's `bpmnElement` id, in document order. */
|
|
12
|
+
export declare function listPlaneElementIds(defs: BpmnDefinitions): string[];
|
|
13
|
+
//# sourceMappingURL=di-planes.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the DI plane whose `bpmnElement` matches `elementId`, if any.
|
|
3
|
+
*
|
|
4
|
+
* The primary plane's `bpmnElement` is a process or collaboration id; a
|
|
5
|
+
* collapsed sub-process that carries its own layout has a separate
|
|
6
|
+
* `BPMNDiagram` whose plane `bpmnElement` is the sub-process id. This resolves
|
|
7
|
+
* either.
|
|
8
|
+
*/
|
|
9
|
+
export function planeForElement(defs, elementId) {
|
|
10
|
+
for (const diagram of defs.diagrams) {
|
|
11
|
+
if (diagram.plane.bpmnElement === elementId)
|
|
12
|
+
return diagram.plane;
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
/** Lists every DI plane's `bpmnElement` id, in document order. */
|
|
17
|
+
export function listPlaneElementIds(defs) {
|
|
18
|
+
return defs.diagrams.map((d) => d.plane.bpmnElement);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=di-planes.js.map
|
package/dist/bpmn/svg.js
CHANGED
|
@@ -119,6 +119,9 @@ export function exportSvg(defs, options) {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
// ── Shapes ────────────────────────────────────────────────────────────────
|
|
122
|
+
// Pool/lane backgrounds are opaque and must render first, or they paint over
|
|
123
|
+
// the flow-node shapes and edges nested inside them.
|
|
124
|
+
const containerParts = [];
|
|
122
125
|
const shapeParts = [];
|
|
123
126
|
const labelParts = [];
|
|
124
127
|
for (const shape of plane.shapes) {
|
|
@@ -126,6 +129,7 @@ export function exportSvg(defs, options) {
|
|
|
126
129
|
const el = idx.elements.get(shape.bpmnElement);
|
|
127
130
|
const type = el?.type ?? "";
|
|
128
131
|
let inner;
|
|
132
|
+
let isContainer = false;
|
|
129
133
|
if (isEvent(type)) {
|
|
130
134
|
inner = renderEvent(el, width, height, t);
|
|
131
135
|
}
|
|
@@ -140,19 +144,38 @@ export function exportSvg(defs, options) {
|
|
|
140
144
|
}
|
|
141
145
|
else if (idx.participants.has(shape.bpmnElement)) {
|
|
142
146
|
inner = renderPool(idx.participants.get(shape.bpmnElement), width, height, t);
|
|
147
|
+
isContainer = true;
|
|
143
148
|
}
|
|
144
149
|
else if (idx.lanes.has(shape.bpmnElement)) {
|
|
145
150
|
inner = renderLane(idx.lanes.get(shape.bpmnElement), width, height, t);
|
|
151
|
+
isContainer = true;
|
|
146
152
|
}
|
|
147
153
|
else {
|
|
148
154
|
inner = "";
|
|
149
155
|
}
|
|
150
156
|
}
|
|
151
157
|
else {
|
|
152
|
-
|
|
158
|
+
// An expanded sub-process/transaction draws an opaque body rect that must
|
|
159
|
+
// render before (under) its own internal edges and child shapes, the same
|
|
160
|
+
// reason pools/lanes are treated as containers above — otherwise the body
|
|
161
|
+
// paints over everything nested inside it.
|
|
162
|
+
const isExpandedContainer = (type === "subProcess" ||
|
|
163
|
+
type === "adHocSubProcess" ||
|
|
164
|
+
type === "eventSubProcess" ||
|
|
165
|
+
type === "transaction") &&
|
|
166
|
+
shape.isExpanded === true;
|
|
167
|
+
inner = renderTask(el, width, height, t, { expanded: isExpandedContainer });
|
|
168
|
+
if (isExpandedContainer)
|
|
169
|
+
isContainer = true;
|
|
153
170
|
}
|
|
154
171
|
if (inner) {
|
|
155
|
-
|
|
172
|
+
const g = `<g transform="translate(${x} ${y})">${inner}</g>`;
|
|
173
|
+
if (isContainer) {
|
|
174
|
+
containerParts.push(g);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
shapeParts.push(g);
|
|
178
|
+
}
|
|
156
179
|
}
|
|
157
180
|
// External labels for events and gateways
|
|
158
181
|
const isExtLabel = isEvent(type) || isGateway(type);
|
|
@@ -177,6 +200,7 @@ export function exportSvg(defs, options) {
|
|
|
177
200
|
` <path d="M0,0 L8,3 L0,6 Z" fill="${arrowFill}"/>`,
|
|
178
201
|
" </marker>",
|
|
179
202
|
"</defs>",
|
|
203
|
+
...containerParts,
|
|
180
204
|
...edgeParts,
|
|
181
205
|
...shapeParts,
|
|
182
206
|
...labelParts,
|
|
@@ -429,7 +453,7 @@ function renderEvent(el, width, height, t) {
|
|
|
429
453
|
}
|
|
430
454
|
return out;
|
|
431
455
|
}
|
|
432
|
-
function renderTask(el, width, height, t) {
|
|
456
|
+
function renderTask(el, width, height, t, options) {
|
|
433
457
|
const type = el?.type ?? "";
|
|
434
458
|
let sw = 1.5;
|
|
435
459
|
let dash;
|
|
@@ -448,7 +472,15 @@ function renderTask(el, width, height, t) {
|
|
|
448
472
|
out += iconGroup(icon, 4, 4, t);
|
|
449
473
|
}
|
|
450
474
|
if (el?.name) {
|
|
451
|
-
|
|
475
|
+
// An expanded container's name sits in a top label, like a modeler's pool/
|
|
476
|
+
// subprocess header, so it doesn't collide with the child shapes drawn
|
|
477
|
+
// inside it (a centered label would land right where children are placed).
|
|
478
|
+
if (options?.expanded) {
|
|
479
|
+
out += labelSvg(el.name, width / 2, 14, width - 16, t, true);
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
out += labelSvg(el.name, width / 2, height / 2, width - 16, t);
|
|
483
|
+
}
|
|
452
484
|
}
|
|
453
485
|
if (type === "subProcess" ||
|
|
454
486
|
type === "adHocSubProcess" ||
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BpmnAdHocSubProcess, BpmnBoundaryEvent, BpmnBusinessRuleTask, BpmnCallActivity, BpmnComplexGateway, BpmnEndEvent, BpmnEventBasedGateway, BpmnEventSubProcess, BpmnExclusiveGateway, BpmnFlowElement, BpmnInclusiveGateway, BpmnIntermediateCatchEvent, BpmnIntermediateThrowEvent, BpmnManualTask, BpmnParallelGateway, BpmnReceiveTask, BpmnScriptTask, BpmnSendTask, BpmnServiceTask, BpmnStartEvent, BpmnSubProcess, BpmnTask, BpmnTransaction, BpmnUserTask } from "./bpmn-model.js";
|
|
1
|
+
import type { BpmnAdHocSubProcess, BpmnBoundaryEvent, BpmnBusinessRuleTask, BpmnCallActivity, BpmnComplexGateway, BpmnDataObject, BpmnDataObjectReference, BpmnDataStoreReference, BpmnEndEvent, BpmnEventBasedGateway, BpmnEventSubProcess, BpmnExclusiveGateway, BpmnFlowElement, BpmnInclusiveGateway, BpmnIntermediateCatchEvent, BpmnIntermediateThrowEvent, BpmnManualTask, BpmnParallelGateway, BpmnReceiveTask, BpmnScriptTask, BpmnSendTask, BpmnServiceTask, BpmnStartEvent, BpmnSubProcess, BpmnTask, BpmnTransaction, BpmnUserTask } from "./bpmn-model.js";
|
|
2
2
|
/**
|
|
3
3
|
* Narrows a flow element to {@link BpmnStartEvent}.
|
|
4
4
|
*
|
|
@@ -133,4 +133,10 @@ export declare function isBpmnComplexGateway(el: BpmnFlowElement): el is BpmnCom
|
|
|
133
133
|
* ```
|
|
134
134
|
*/
|
|
135
135
|
export declare function isBpmnGateway(el: BpmnFlowElement): el is BpmnExclusiveGateway | BpmnParallelGateway | BpmnInclusiveGateway | BpmnEventBasedGateway | BpmnComplexGateway;
|
|
136
|
+
/** Narrows a flow element to {@link BpmnDataObject}. */
|
|
137
|
+
export declare function isBpmnDataObject(el: BpmnFlowElement): el is BpmnDataObject;
|
|
138
|
+
/** Narrows a flow element to {@link BpmnDataObjectReference}. */
|
|
139
|
+
export declare function isBpmnDataObjectReference(el: BpmnFlowElement): el is BpmnDataObjectReference;
|
|
140
|
+
/** Narrows a flow element to {@link BpmnDataStoreReference}. */
|
|
141
|
+
export declare function isBpmnDataStoreReference(el: BpmnFlowElement): el is BpmnDataStoreReference;
|
|
136
142
|
//# sourceMappingURL=type-guards.d.ts.map
|
package/dist/bpmn/type-guards.js
CHANGED
|
@@ -208,4 +208,17 @@ export function isBpmnGateway(el) {
|
|
|
208
208
|
el.type === "eventBasedGateway" ||
|
|
209
209
|
el.type === "complexGateway");
|
|
210
210
|
}
|
|
211
|
+
// ── Data ──────────────────────────────────────────────────────────────────────
|
|
212
|
+
/** Narrows a flow element to {@link BpmnDataObject}. */
|
|
213
|
+
export function isBpmnDataObject(el) {
|
|
214
|
+
return el.type === "dataObject";
|
|
215
|
+
}
|
|
216
|
+
/** Narrows a flow element to {@link BpmnDataObjectReference}. */
|
|
217
|
+
export function isBpmnDataObjectReference(el) {
|
|
218
|
+
return el.type === "dataObjectReference";
|
|
219
|
+
}
|
|
220
|
+
/** Narrows a flow element to {@link BpmnDataStoreReference}. */
|
|
221
|
+
export function isBpmnDataStoreReference(el) {
|
|
222
|
+
return el.type === "dataStoreReference";
|
|
223
|
+
}
|
|
211
224
|
//# sourceMappingURL=type-guards.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
export { BpmnSdkError, ParseError, ValidationError } from "./errors.js";
|
|
2
2
|
export type { ErrorCode } from "./errors.js";
|
|
3
|
-
export { isBpmnActivity, isBpmnAdHocSubProcess, isBpmnBoundaryEvent, isBpmnBusinessRuleTask, isBpmnCallActivity, isBpmnComplexGateway, isBpmnEndEvent, isBpmnEvent, isBpmnEventBasedGateway, isBpmnEventSubProcess, isBpmnExclusiveGateway, isBpmnGateway, isBpmnInclusiveGateway, isBpmnIntermediateCatchEvent, isBpmnIntermediateThrowEvent, isBpmnManualTask, isBpmnParallelGateway, isBpmnReceiveTask, isBpmnScriptTask, isBpmnSendTask, isBpmnServiceTask, isBpmnStartEvent, isBpmnSubProcess, isBpmnTask, isBpmnTransaction, isBpmnUserTask, } from "./bpmn/type-guards.js";
|
|
3
|
+
export { isBpmnActivity, isBpmnAdHocSubProcess, isBpmnBoundaryEvent, isBpmnBusinessRuleTask, isBpmnCallActivity, isBpmnComplexGateway, isBpmnDataObject, isBpmnDataObjectReference, isBpmnDataStoreReference, isBpmnEndEvent, isBpmnEvent, isBpmnEventBasedGateway, isBpmnEventSubProcess, isBpmnExclusiveGateway, isBpmnGateway, isBpmnInclusiveGateway, isBpmnIntermediateCatchEvent, isBpmnIntermediateThrowEvent, isBpmnManualTask, isBpmnParallelGateway, isBpmnReceiveTask, isBpmnScriptTask, isBpmnSendTask, isBpmnServiceTask, isBpmnStartEvent, isBpmnSubProcess, isBpmnTask, isBpmnTransaction, isBpmnUserTask, } from "./bpmn/type-guards.js";
|
|
4
4
|
export { findElement, findElementInProcess, findProcess, findSequenceFlow, getAllElements, getElementType, getZeebeExtensions, } from "./bpmn/utils.js";
|
|
5
5
|
export { Bpmn, SAMPLE_BPMN_XML } from "./bpmn/index.js";
|
|
6
6
|
export { applyAutoLayout } from "./bpmn/auto-layout.js";
|
|
7
|
+
export { checkDiCompleteness } from "./bpmn/di-check.js";
|
|
8
|
+
export type { DiCompleteness } from "./bpmn/di-check.js";
|
|
9
|
+
export { planeForElement, listPlaneElementIds } from "./bpmn/di-planes.js";
|
|
7
10
|
export { DiagramBuilder } from "./bpmn/bpmn-builder.js";
|
|
8
11
|
export type { ProcessBuilder, BranchBuilder, SubProcessContentBuilder, ServiceTaskOptions, ScriptTaskOptions, UserTaskOptions, CallActivityOptions, BusinessRuleTaskOptions, ElementOptions, GatewayOptions, MultiInstanceOptions, SubProcessOptions, StartEventOptions, IntermediateCatchEventOptions, IntermediateThrowEventOptions, EndEventOptions, BoundaryEventOptions, AdHocSubProcessOptions, } from "./bpmn/bpmn-builder.js";
|
|
9
|
-
export type { BpmnDefinitions, BpmnProcess, BpmnFlowNode, BpmnFlowElement, BpmnSequenceFlow, BpmnBoundaryEvent, BpmnElementType, BpmnStartEvent, BpmnEndEvent, BpmnIntermediateCatchEvent, BpmnIntermediateThrowEvent, BpmnTask, BpmnServiceTask, BpmnScriptTask, BpmnUserTask, BpmnSendTask, BpmnReceiveTask, BpmnBusinessRuleTask, BpmnManualTask, BpmnCallActivity, BpmnSubProcess, BpmnAdHocSubProcess, BpmnEventSubProcess, BpmnTransaction, BpmnExclusiveGateway, BpmnParallelGateway, BpmnInclusiveGateway, BpmnEventBasedGateway, BpmnComplexGateway, BpmnCollaboration, BpmnParticipant, BpmnMessageFlow, BpmnLane, BpmnLaneSet, BpmnError, BpmnEscalation, BpmnMessage, BpmnSignal, BpmnTextAnnotation, BpmnAssociation, BpmnConditionExpression, BpmnEventDefinition, BpmnTimerEventDefinition, BpmnErrorEventDefinition, BpmnEscalationEventDefinition, BpmnMessageEventDefinition, BpmnSignalEventDefinition, BpmnConditionalEventDefinition, BpmnLinkEventDefinition, BpmnCancelEventDefinition, BpmnTerminateEventDefinition, BpmnCompensateEventDefinition, BpmnMultiInstanceLoopCharacteristics, BpmnDiagram, BpmnDiPlane, BpmnDiShape, BpmnDiEdge, BpmnDiLabel, BpmnBounds, BpmnWaypoint, } from "./bpmn/bpmn-model.js";
|
|
12
|
+
export type { BpmnDefinitions, BpmnProcess, BpmnFlowNode, BpmnFlowElement, BpmnSequenceFlow, BpmnBoundaryEvent, BpmnElementType, BpmnStartEvent, BpmnEndEvent, BpmnIntermediateCatchEvent, BpmnIntermediateThrowEvent, BpmnTask, BpmnServiceTask, BpmnScriptTask, BpmnUserTask, BpmnSendTask, BpmnReceiveTask, BpmnBusinessRuleTask, BpmnManualTask, BpmnCallActivity, BpmnSubProcess, BpmnAdHocSubProcess, BpmnEventSubProcess, BpmnTransaction, BpmnExclusiveGateway, BpmnParallelGateway, BpmnInclusiveGateway, BpmnEventBasedGateway, BpmnComplexGateway, BpmnCollaboration, BpmnParticipant, BpmnMessageFlow, BpmnLane, BpmnLaneSet, BpmnError, BpmnEscalation, BpmnMessage, BpmnSignal, BpmnTextAnnotation, BpmnAssociation, BpmnGroup, BpmnDataObject, BpmnDataObjectReference, BpmnDataStoreReference, BpmnConditionExpression, BpmnEventDefinition, BpmnTimerEventDefinition, BpmnErrorEventDefinition, BpmnEscalationEventDefinition, BpmnMessageEventDefinition, BpmnSignalEventDefinition, BpmnConditionalEventDefinition, BpmnLinkEventDefinition, BpmnCancelEventDefinition, BpmnTerminateEventDefinition, BpmnCompensateEventDefinition, BpmnMultiInstanceLoopCharacteristics, BpmnDiagram, BpmnDiPlane, BpmnDiShape, BpmnDiEdge, BpmnDiLabel, BpmnBounds, BpmnWaypoint, } from "./bpmn/bpmn-model.js";
|
|
10
13
|
export type { RestConnectorConfig, RestAuthentication, HttpMethod, } from "./bpmn/rest-connector.js";
|
|
11
14
|
export type { ZeebeExtensions, ZeebeTaskDefinition, ZeebeIoMapping, ZeebeIoMappingEntry, ZeebeTaskHeaders, ZeebeTaskHeaderEntry, ZeebeProperties, ZeebePropertyEntry, ZeebeFormDefinition, ZeebeCalledDecision, } from "./bpmn/zeebe-extensions.js";
|
|
12
15
|
export { zeebeExtensionsToXmlElements } from "./bpmn/zeebe-extensions.js";
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { BpmnSdkError, ParseError, ValidationError } from "./errors.js";
|
|
2
|
-
export { isBpmnActivity, isBpmnAdHocSubProcess, isBpmnBoundaryEvent, isBpmnBusinessRuleTask, isBpmnCallActivity, isBpmnComplexGateway, isBpmnEndEvent, isBpmnEvent, isBpmnEventBasedGateway, isBpmnEventSubProcess, isBpmnExclusiveGateway, isBpmnGateway, isBpmnInclusiveGateway, isBpmnIntermediateCatchEvent, isBpmnIntermediateThrowEvent, isBpmnManualTask, isBpmnParallelGateway, isBpmnReceiveTask, isBpmnScriptTask, isBpmnSendTask, isBpmnServiceTask, isBpmnStartEvent, isBpmnSubProcess, isBpmnTask, isBpmnTransaction, isBpmnUserTask, } from "./bpmn/type-guards.js";
|
|
2
|
+
export { isBpmnActivity, isBpmnAdHocSubProcess, isBpmnBoundaryEvent, isBpmnBusinessRuleTask, isBpmnCallActivity, isBpmnComplexGateway, isBpmnDataObject, isBpmnDataObjectReference, isBpmnDataStoreReference, isBpmnEndEvent, isBpmnEvent, isBpmnEventBasedGateway, isBpmnEventSubProcess, isBpmnExclusiveGateway, isBpmnGateway, isBpmnInclusiveGateway, isBpmnIntermediateCatchEvent, isBpmnIntermediateThrowEvent, isBpmnManualTask, isBpmnParallelGateway, isBpmnReceiveTask, isBpmnScriptTask, isBpmnSendTask, isBpmnServiceTask, isBpmnStartEvent, isBpmnSubProcess, isBpmnTask, isBpmnTransaction, isBpmnUserTask, } from "./bpmn/type-guards.js";
|
|
3
3
|
export { findElement, findElementInProcess, findProcess, findSequenceFlow, getAllElements, getElementType, getZeebeExtensions, } from "./bpmn/utils.js";
|
|
4
4
|
export { Bpmn, SAMPLE_BPMN_XML } from "./bpmn/index.js";
|
|
5
5
|
export { applyAutoLayout } from "./bpmn/auto-layout.js";
|
|
6
|
+
export { checkDiCompleteness } from "./bpmn/di-check.js";
|
|
7
|
+
export { planeForElement, listPlaneElementIds } from "./bpmn/di-planes.js";
|
|
6
8
|
export { DiagramBuilder } from "./bpmn/bpmn-builder.js";
|
|
7
9
|
export { zeebeExtensionsToXmlElements } from "./bpmn/zeebe-extensions.js";
|
|
8
10
|
export { Dmn, layoutDmn, benchmarkDmnLayout, compactifyDmn, expandDmn } from "./dmn/index.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text-annotation packer. Port of the layout phase of
|
|
3
|
+
* tmp/01-annotation-layouting.cjs (lines 96-389), adapted to operate on
|
|
4
|
+
* already-parsed LayoutNode[] / Bounds instead of regex-parsed BPMN DI
|
|
5
|
+
* shapes. Constants, formulas and control flow match the reference exactly.
|
|
6
|
+
*/
|
|
7
|
+
import type { BpmnProcess } from "../bpmn/bpmn-model.js";
|
|
8
|
+
import type { Bounds, LayoutNode, Waypoint } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Sizes and packs text annotations around their linked elements without
|
|
11
|
+
* overlapping each other or any other layout node (incl. node labels).
|
|
12
|
+
* Returns final Bounds per annotation id; annotations with no resolvable
|
|
13
|
+
* association target (no association at all, or the linked element isn't
|
|
14
|
+
* in `layoutNodes`) still get an entry — they're placed at a fixed fallback
|
|
15
|
+
* origin and pushed clear of everything else already placed, mirroring the
|
|
16
|
+
* pre-port fallback in auto-layout.ts's computeAnnotationLocalBounds.
|
|
17
|
+
*/
|
|
18
|
+
export declare function packAnnotations(process: BpmnProcess, layoutNodes: LayoutNode[]): Map<string, Bounds>;
|
|
19
|
+
/**
|
|
20
|
+
* Edge-to-edge, clamped association waypoints between a linked element and
|
|
21
|
+
* its annotation. Port of `chooseWaypoints` (tmp/01-annotation-layouting.cjs:365-389).
|
|
22
|
+
*/
|
|
23
|
+
export declare function associationWaypoints(elementBounds: Bounds, annotationBounds: Bounds): {
|
|
24
|
+
pElem: Waypoint;
|
|
25
|
+
pAnn: Waypoint;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=annotations.d.ts.map
|