@aranzatech/diagrams-bpmn 0.2.0 → 0.2.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/catalog-OVnBDD8R.d.ts +9 -0
  3. package/dist/catalog-OWfI_yHU.d.cts +9 -0
  4. package/dist/{chunk-MF2WE3OM.js → chunk-33AR3PXF.js} +36 -8
  5. package/dist/chunk-33AR3PXF.js.map +1 -0
  6. package/dist/{chunk-3AFZDIMQ.js → chunk-ECTJRD7Z.js} +3 -3
  7. package/dist/{chunk-3AFZDIMQ.js.map → chunk-ECTJRD7Z.js.map} +1 -1
  8. package/dist/{chunk-S3GGEEA5.js → chunk-H3YMTGFG.js} +50 -32
  9. package/dist/chunk-H3YMTGFG.js.map +1 -0
  10. package/dist/chunk-KALSGH4D.js +36 -0
  11. package/dist/chunk-KALSGH4D.js.map +1 -0
  12. package/dist/{chunk-DNR5WBQH.js → chunk-L5Z22RLX.js} +81 -20
  13. package/dist/chunk-L5Z22RLX.js.map +1 -0
  14. package/dist/{chunk-5GRCJ5X6.js → chunk-RLAJNRF2.js} +3 -3
  15. package/dist/{chunk-5GRCJ5X6.js.map → chunk-RLAJNRF2.js.map} +1 -1
  16. package/dist/chunk-YQTIODXH.js +532 -0
  17. package/dist/chunk-YQTIODXH.js.map +1 -0
  18. package/dist/chunk-ZFGQVLHB.js +226 -0
  19. package/dist/chunk-ZFGQVLHB.js.map +1 -0
  20. package/dist/edges/index.cjs +1 -1
  21. package/dist/edges/index.cjs.map +1 -1
  22. package/dist/edges/index.js +2 -2
  23. package/dist/elements/index.cjs +81 -17
  24. package/dist/elements/index.cjs.map +1 -1
  25. package/dist/elements/index.d.cts +4 -6
  26. package/dist/elements/index.d.ts +4 -6
  27. package/dist/elements/index.js +2 -2
  28. package/dist/index.cjs +689 -75
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +6 -4
  31. package/dist/index.d.ts +6 -4
  32. package/dist/index.js +8 -7
  33. package/dist/modeling/index.cjs +383 -36
  34. package/dist/modeling/index.cjs.map +1 -1
  35. package/dist/modeling/index.d.cts +61 -3
  36. package/dist/modeling/index.d.ts +61 -3
  37. package/dist/modeling/index.js +3 -3
  38. package/dist/nodes/index.cjs +62 -32
  39. package/dist/nodes/index.cjs.map +1 -1
  40. package/dist/nodes/index.js +2 -2
  41. package/dist/{types-hj621ZRJ.d.ts → types-BxjCV2oX.d.ts} +1 -1
  42. package/dist/{types-BKA0GZz5.d.cts → types-DznxZxpV.d.cts} +11 -1
  43. package/dist/{types-BKA0GZz5.d.ts → types-DznxZxpV.d.ts} +11 -1
  44. package/dist/{types-CCkHqtC_.d.cts → types-vVi5T7qj.d.cts} +1 -1
  45. package/dist/validation/index.cjs +848 -0
  46. package/dist/validation/index.cjs.map +1 -0
  47. package/dist/validation/index.d.cts +25 -0
  48. package/dist/validation/index.d.ts +25 -0
  49. package/dist/validation/index.js +5 -0
  50. package/dist/validation/index.js.map +1 -0
  51. package/dist/xml/index.cjs +74 -22
  52. package/dist/xml/index.cjs.map +1 -1
  53. package/dist/xml/index.d.cts +2 -2
  54. package/dist/xml/index.d.ts +2 -2
  55. package/dist/xml/index.js +2 -2
  56. package/package.json +8 -3
  57. package/dist/chunk-23B2IGK5.js +0 -24
  58. package/dist/chunk-23B2IGK5.js.map +0 -1
  59. package/dist/chunk-DNR5WBQH.js.map +0 -1
  60. package/dist/chunk-G5S4ASP3.js +0 -277
  61. package/dist/chunk-G5S4ASP3.js.map +0 -1
  62. package/dist/chunk-MF2WE3OM.js.map +0 -1
  63. package/dist/chunk-S3GGEEA5.js.map +0 -1
@@ -0,0 +1,226 @@
1
+ import { isDataType, isGatewayType, isEventType } from './chunk-RLAJNRF2.js';
2
+ import { BPMN_ELEMENT_CATALOG } from './chunk-L5Z22RLX.js';
3
+
4
+ // src/validation/index.ts
5
+ function isFlowNode(type) {
6
+ return isEventType(type) || isGatewayType(type) || type.includes("Task") || type === "CallActivity" || type === "SubProcess" || type === "Transaction" || type === "EventSubProcess" || type === "AdHocSubProcess" || type === "ChoreographyTask" || type === "SubChoreography" || type === "CallChoreography";
7
+ }
8
+ function isProcessNode(type) {
9
+ return isFlowNode(type) && type !== "BoundaryEvent";
10
+ }
11
+ function isSubProcess(type) {
12
+ return type === "SubProcess" || type === "Transaction" || type === "EventSubProcess" || type === "AdHocSubProcess";
13
+ }
14
+ function isCatchTarget(type) {
15
+ return type === "IntermediateCatchEvent" || type === "ReceiveTask";
16
+ }
17
+ function poolAncestor(node, nodeById) {
18
+ let current = node;
19
+ const visited = /* @__PURE__ */ new Set();
20
+ while (current?.parentId && !visited.has(current.id)) {
21
+ visited.add(current.id);
22
+ const parent = nodeById.get(current.parentId);
23
+ if (parent?.data.elementType === "Pool") return parent.id;
24
+ current = parent;
25
+ }
26
+ return void 0;
27
+ }
28
+ function countSequenceEdges(edges, nodeId, direction) {
29
+ return edges.filter((edge) => {
30
+ if (edge.data?.edgeType !== "sequenceFlow") return false;
31
+ return direction === "in" ? edge.target === nodeId : edge.source === nodeId;
32
+ }).length;
33
+ }
34
+ function sequenceEdges(edges) {
35
+ return edges.filter((edge) => (edge.data?.edgeType ?? edge.type) === "sequenceFlow");
36
+ }
37
+ function sequenceOut(edges, nodeId) {
38
+ return sequenceEdges(edges).filter((edge) => edge.source === nodeId);
39
+ }
40
+ function sequenceIn(edges, nodeId) {
41
+ return sequenceEdges(edges).filter((edge) => edge.target === nodeId);
42
+ }
43
+ function issue(code, severity, message, elementId, relatedElementIds) {
44
+ return {
45
+ id: `${code}:${elementId ?? relatedElementIds?.join(",") ?? "diagram"}`,
46
+ code,
47
+ severity,
48
+ message,
49
+ ...elementId ? { elementId } : {},
50
+ ...relatedElementIds ? { relatedElementIds } : {}
51
+ };
52
+ }
53
+ function validateBpmnDiagram(nodes, edges, options = {}) {
54
+ const opts = {
55
+ requireStartEvent: true,
56
+ requireEndEvent: true,
57
+ strictNames: false,
58
+ ...options
59
+ };
60
+ const issues = [];
61
+ const nodeById = new Map(nodes.map((node) => [node.id, node]));
62
+ const seqEdges = sequenceEdges(edges);
63
+ const processNodes = nodes.filter((node) => isProcessNode(node.data.elementType));
64
+ if (opts.requireStartEvent && !processNodes.some((node) => node.data.elementType === "StartEvent")) {
65
+ issues.push(issue("bpmn/start-event-required", "error", "The diagram must contain at least one start event."));
66
+ }
67
+ if (opts.requireEndEvent && !processNodes.some((node) => node.data.elementType === "EndEvent")) {
68
+ issues.push(issue("bpmn/end-event-required", "error", "The diagram must contain at least one end event."));
69
+ }
70
+ for (const edge of edges) {
71
+ const edgeType = edge.data?.edgeType ?? edge.type;
72
+ const source = nodeById.get(edge.source);
73
+ const target = nodeById.get(edge.target);
74
+ if (!source || !target) {
75
+ issues.push(issue(
76
+ "bpmn/no-orphan-edges",
77
+ "error",
78
+ `Edge "${edge.id}" references a missing ${!source ? "source" : "target"} node.`,
79
+ edge.id,
80
+ [edge.source, edge.target]
81
+ ));
82
+ continue;
83
+ }
84
+ if (edge.source === edge.target) {
85
+ issues.push(issue("bpmn/no-self-loop", "error", "BPMN edges cannot connect an element to itself.", edge.id, [edge.source]));
86
+ }
87
+ if (edgeType === "sequenceFlow") {
88
+ if (!isFlowNode(source.data.elementType) || !isFlowNode(target.data.elementType) || isDataType(source.data.elementType) || isDataType(target.data.elementType)) {
89
+ issues.push(issue("bpmn/sequence-flow-valid-endpoints", "error", "Sequence flows must connect BPMN flow nodes.", edge.id, [source.id, target.id]));
90
+ }
91
+ const sourcePool = poolAncestor(source, nodeById);
92
+ const targetPool = poolAncestor(target, nodeById);
93
+ if (sourcePool && targetPool && sourcePool !== targetPool) {
94
+ issues.push(issue("bpmn/sequence-flow-no-cross-pool", "error", "Sequence flows cannot cross pools. Use message flow between participants.", edge.id, [source.id, target.id]));
95
+ }
96
+ }
97
+ if (edgeType === "messageFlow") {
98
+ const sourcePool = poolAncestor(source, nodeById);
99
+ const targetPool = poolAncestor(target, nodeById);
100
+ if (!sourcePool || !targetPool || sourcePool === targetPool) {
101
+ issues.push(issue("bpmn/message-flow-valid-endpoints", "error", "Message flows must connect flow nodes in different pools.", edge.id, [source.id, target.id]));
102
+ }
103
+ if (!isFlowNode(source.data.elementType) || !isFlowNode(target.data.elementType)) {
104
+ issues.push(issue("bpmn/message-flow-valid-endpoints", "error", "Message flows must connect BPMN flow nodes, not containers.", edge.id, [source.id, target.id]));
105
+ }
106
+ }
107
+ if (edgeType === "dataAssociation") {
108
+ const hasDataEndpoint = isDataType(source.data.elementType) || isDataType(target.data.elementType);
109
+ const hasFlowEndpoint = isFlowNode(source.data.elementType) || isFlowNode(target.data.elementType);
110
+ if (!hasDataEndpoint || !hasFlowEndpoint) {
111
+ issues.push(issue("bpmn/data-association-valid-endpoints", "error", "Data associations must connect data elements with flow nodes.", edge.id, [source.id, target.id]));
112
+ }
113
+ }
114
+ }
115
+ const duplicateSequenceKeys = /* @__PURE__ */ new Set();
116
+ const reportedDuplicateKeys = /* @__PURE__ */ new Set();
117
+ for (const edge of seqEdges) {
118
+ const key = `${edge.source}->${edge.target}`;
119
+ if (duplicateSequenceKeys.has(key) && !reportedDuplicateKeys.has(key)) {
120
+ reportedDuplicateKeys.add(key);
121
+ issues.push(issue("bpmn/no-duplicate-sequence-flow", "error", "Only one sequence flow is allowed between the same source and target.", edge.id, [edge.source, edge.target]));
122
+ }
123
+ duplicateSequenceKeys.add(key);
124
+ }
125
+ for (const node of nodes) {
126
+ const type = node.data.elementType;
127
+ const incoming = countSequenceEdges(edges, node.id, "in");
128
+ const outgoing = countSequenceEdges(edges, node.id, "out");
129
+ const meta = BPMN_ELEMENT_CATALOG[type];
130
+ if (type === "StartEvent" && incoming > 0) {
131
+ issues.push(issue("bpmn/start-event-no-incoming", "error", "Start events cannot have incoming sequence flows.", node.id));
132
+ }
133
+ if (type === "EndEvent") {
134
+ if (outgoing > 0) issues.push(issue("bpmn/no-outgoing-from-end-event", "error", "End events cannot have outgoing sequence flows.", node.id));
135
+ if (incoming === 0) issues.push(issue("bpmn/end-event-has-incoming", "error", "End events should have at least one incoming sequence flow.", node.id));
136
+ }
137
+ if ((type === "IntermediateCatchEvent" || type === "IntermediateThrowEvent") && (incoming === 0 || outgoing === 0)) {
138
+ issues.push(issue("bpmn/intermediate-event-both-flows", "error", "Intermediate events should have both incoming and outgoing sequence flows.", node.id));
139
+ }
140
+ if (type === "BoundaryEvent") {
141
+ const hostId = node.data.attachedToRef ?? node.parentId;
142
+ const host = hostId ? nodeById.get(hostId) : void 0;
143
+ if (!host || !BPMN_ELEMENT_CATALOG[host.data.elementType]?.acceptsBoundaryEvents) {
144
+ issues.push(issue("bpmn/boundary-event-attached", "error", "Boundary events must be attached to an activity or subprocess.", node.id, hostId ? [hostId] : void 0));
145
+ }
146
+ if (sequenceIn(edges, node.id).length > 0) {
147
+ issues.push(issue("bpmn/boundary-no-incoming", "error", "Boundary events cannot have incoming sequence flows.", node.id));
148
+ }
149
+ if (sequenceOut(edges, node.id).length === 0) {
150
+ issues.push(issue("bpmn/boundary-has-outgoing", "warning", "Boundary events should define an outgoing exception path.", node.id));
151
+ }
152
+ }
153
+ if (isGatewayType(type)) {
154
+ if (incoming === 0) issues.push(issue("bpmn/gateway-has-incoming", "error", "Gateways should have at least one incoming sequence flow.", node.id));
155
+ if (outgoing === 0) issues.push(issue("bpmn/gateway-has-outgoing", "error", "Gateways should have at least one outgoing sequence flow.", node.id));
156
+ }
157
+ if (type === "ExclusiveGateway" || type === "InclusiveGateway" || type === "ComplexGateway") {
158
+ const outgoingEdges = sequenceOut(edges, node.id);
159
+ const defaults = outgoingEdges.filter((edge) => edge.data?.isDefault);
160
+ if (defaults.length > 1) {
161
+ issues.push(issue("bpmn/gateway-single-default", "error", "Gateways can have at most one default sequence flow.", node.id, defaults.map((edge) => edge.id)));
162
+ }
163
+ if (outgoingEdges.length >= 2) {
164
+ for (const edge of outgoingEdges) {
165
+ if (!edge.data?.isDefault && !edge.data?.conditionExpression) {
166
+ issues.push(issue("bpmn/gateway-condition", "error", "Conditional gateway branches should have a condition or be marked as default.", edge.id, [node.id, edge.target]));
167
+ }
168
+ }
169
+ }
170
+ }
171
+ if (type === "EventBasedGateway") {
172
+ const outgoingEdges = edges.filter((edge) => edge.data?.edgeType === "sequenceFlow" && edge.source === node.id);
173
+ if (outgoingEdges.length < 2) {
174
+ issues.push(issue("bpmn/event-based-gateway-min-outgoing", "error", "Event-based gateways should have at least two outgoing sequence flows.", node.id));
175
+ }
176
+ for (const edge of outgoingEdges) {
177
+ const target = nodeById.get(edge.target);
178
+ if (target && !isCatchTarget(target.data.elementType)) {
179
+ issues.push(issue("bpmn/event-based-gateway-valid-targets", "error", "Event-based gateways must target catch events or receive tasks.", edge.id, [node.id, target.id]));
180
+ }
181
+ }
182
+ }
183
+ if (meta.maxIncoming !== void 0 && incoming > meta.maxIncoming) {
184
+ issues.push(issue("bpmn/max-incoming", "error", `${type} cannot have more than ${meta.maxIncoming} incoming sequence flow(s).`, node.id));
185
+ }
186
+ if (meta.maxOutgoing !== void 0 && outgoing > meta.maxOutgoing) {
187
+ issues.push(issue("bpmn/max-outgoing", "error", `${type} cannot have more than ${meta.maxOutgoing} outgoing sequence flow(s).`, node.id));
188
+ }
189
+ if (opts.strictNames && (type.includes("Task") || isGatewayType(type)) && !node.data.label) {
190
+ issues.push(issue("bpmn/name-required", "warning", `${type} should have a label.`, node.id));
191
+ }
192
+ if (isSubProcess(type)) {
193
+ const childNodes = nodes.filter((child) => child.parentId === node.id);
194
+ if (childNodes.length > 0) {
195
+ if (!childNodes.some((child) => child.data.elementType === "StartEvent")) {
196
+ issues.push(issue("bpmn/subprocess-has-start-end", "error", "Expanded subprocesses should contain a start event.", node.id));
197
+ }
198
+ if (!childNodes.some((child) => child.data.elementType === "EndEvent")) {
199
+ issues.push(issue("bpmn/subprocess-has-start-end", "error", "Expanded subprocesses should contain an end event.", node.id));
200
+ }
201
+ }
202
+ if (type === "EventSubProcess") {
203
+ const starts = childNodes.filter((child) => child.data.elementType === "StartEvent");
204
+ for (const start of starts) {
205
+ if (!start.data.trigger || start.data.trigger === "none") {
206
+ issues.push(issue("bpmn/event-subprocess-triggered-start", "error", "Event subprocess start events must define an event trigger.", start.id, [node.id]));
207
+ }
208
+ }
209
+ }
210
+ }
211
+ if (type === "Lane") {
212
+ const parent = node.parentId ? nodeById.get(node.parentId) : void 0;
213
+ if (parent?.data.elementType !== "Pool") {
214
+ issues.push(issue("bpmn/lane-parent-pool", "error", "Lanes must be contained by a pool.", node.id));
215
+ }
216
+ }
217
+ }
218
+ return {
219
+ valid: issues.every((item) => item.severity !== "error"),
220
+ issues
221
+ };
222
+ }
223
+
224
+ export { validateBpmnDiagram };
225
+ //# sourceMappingURL=chunk-ZFGQVLHB.js.map
226
+ //# sourceMappingURL=chunk-ZFGQVLHB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/validation/index.ts"],"names":[],"mappings":";;;;AA+BA,SAAS,WAAW,IAAA,EAAgC;AAClD,EAAA,OACE,WAAA,CAAY,IAAI,CAAA,IAChB,aAAA,CAAc,IAAI,KAClB,IAAA,CAAK,QAAA,CAAS,MAAM,CAAA,IACpB,IAAA,KAAS,cAAA,IACT,SAAS,YAAA,IACT,IAAA,KAAS,aAAA,IACT,IAAA,KAAS,iBAAA,IACT,IAAA,KAAS,qBACT,IAAA,KAAS,kBAAA,IACT,IAAA,KAAS,iBAAA,IACT,IAAA,KAAS,kBAAA;AAEb;AAEA,SAAS,cAAc,IAAA,EAAgC;AACrD,EAAA,OAAO,UAAA,CAAW,IAAI,CAAA,IAAK,IAAA,KAAS,eAAA;AACtC;AAEA,SAAS,aAAa,IAAA,EAAgC;AACpD,EAAA,OACE,SAAS,YAAA,IACT,IAAA,KAAS,aAAA,IACT,IAAA,KAAS,qBACT,IAAA,KAAS,iBAAA;AAEb;AAEA,SAAS,cAAc,IAAA,EAAgC;AACrD,EAAA,OAAO,IAAA,KAAS,4BAA4B,IAAA,KAAS,aAAA;AACvD;AAEA,SA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AAA,CAAM,IAAA,CAAK,WAAW,KAAA,CAAM,IAAA,CAAK,YAAY,MAAA,EAAQ;AACxD,YAAA,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,uCAAA,EAAyC,OAAA,EAAS,6DAAA,EAA+D,KAAA,CAAM,EAAA,EAAI,CAAC,IAAA,CAAK,EAAE,CAAC,CAAC,CAAA;AAAA,UACzJ;AAAA,QACF;AAAA,MACF;AAAA,IACF;AACA,IAAA,IAAI,SAAS,MAAA,EAAQ;AACnB,MAAA,MAAM,SAAS,IAAA,CAAK,QAAA,GAAW,SAAS,GAAA,CAAI,IAAA,CAAK,QAAQ,CAAA,GAAI,MAAA;AAC7D,MAAA,IAAI,MAAA,EAAQ,IAAA,CAAK,WAAA,KAAgB,MAAA,EAAQ;AACvC,QAAA,MAAA,CAAO,KAAK,KAAA,CAAM,uBAAA,EAAyB,SAAS,oCAAA,EAAsC,IAAA,CAAK,EAAE,CAAC,CAAA;AAAA,MACpG;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,OAAO,MAAA,CAAO,KAAA,CAAM,CAAC,IAAA,KAAS,IAAA,CAAK,aAAa,OAAO,CAAA;AAAA,IACvD;AAAA,GACF;AACF","file":"chunk-ZFGQVLHB.js","sourcesContent":["import { BPMN_ELEMENT_CATALOG } from \"../elements/catalog\";\nimport {\n isDataType,\n isEventType,\n isGatewayType,\n} from \"../elements/guards\";\nimport type { BpmnElementType } from \"../elements/types\";\nimport type { BpmnRFEdge, BpmnRFNode } from \"../xml/types\";\n\nexport type BpmnValidationSeverity = \"error\" | \"warning\" | \"info\";\n\nexport interface BpmnValidationIssue {\n id: string;\n severity: BpmnValidationSeverity;\n code: string;\n message: string;\n elementId?: string;\n relatedElementIds?: string[];\n}\n\nexport interface BpmnValidationResult {\n valid: boolean;\n issues: BpmnValidationIssue[];\n}\n\nexport interface BpmnValidationOptions {\n requireStartEvent?: boolean;\n requireEndEvent?: boolean;\n strictNames?: boolean;\n}\n\nfunction isFlowNode(type: BpmnElementType): boolean {\n return (\n isEventType(type) ||\n isGatewayType(type) ||\n type.includes(\"Task\") ||\n type === \"CallActivity\" ||\n type === \"SubProcess\" ||\n type === \"Transaction\" ||\n type === \"EventSubProcess\" ||\n type === \"AdHocSubProcess\" ||\n type === \"ChoreographyTask\" ||\n type === \"SubChoreography\" ||\n type === \"CallChoreography\"\n );\n}\n\nfunction isProcessNode(type: BpmnElementType): boolean {\n return isFlowNode(type) && type !== \"BoundaryEvent\";\n}\n\nfunction isSubProcess(type: BpmnElementType): boolean {\n return (\n type === \"SubProcess\" ||\n type === \"Transaction\" ||\n type === \"EventSubProcess\" ||\n type === \"AdHocSubProcess\"\n );\n}\n\nfunction isCatchTarget(type: BpmnElementType): boolean {\n return type === \"IntermediateCatchEvent\" || type === \"ReceiveTask\";\n}\n\nfunction poolAncestor(\n node: BpmnRFNode | undefined,\n nodeById: Map<string, BpmnRFNode>,\n): string | undefined {\n let current = node;\n const visited = new Set<string>();\n while (current?.parentId && !visited.has(current.id)) {\n visited.add(current.id);\n const parent = nodeById.get(current.parentId);\n if (parent?.data.elementType === \"Pool\") return parent.id;\n current = parent;\n }\n return undefined;\n}\n\nfunction countSequenceEdges(edges: BpmnRFEdge[], nodeId: string, direction: \"in\" | \"out\"): number {\n return edges.filter((edge) => {\n if (edge.data?.edgeType !== \"sequenceFlow\") return false;\n return direction === \"in\" ? edge.target === nodeId : edge.source === nodeId;\n }).length;\n}\n\nfunction sequenceEdges(edges: BpmnRFEdge[]): BpmnRFEdge[] {\n return edges.filter((edge) => (edge.data?.edgeType ?? edge.type) === \"sequenceFlow\");\n}\n\nfunction sequenceOut(edges: BpmnRFEdge[], nodeId: string): BpmnRFEdge[] {\n return sequenceEdges(edges).filter((edge) => edge.source === nodeId);\n}\n\nfunction sequenceIn(edges: BpmnRFEdge[], nodeId: string): BpmnRFEdge[] {\n return sequenceEdges(edges).filter((edge) => edge.target === nodeId);\n}\n\nfunction issue(\n code: string,\n severity: BpmnValidationSeverity,\n message: string,\n elementId?: string,\n relatedElementIds?: string[],\n): BpmnValidationIssue {\n return {\n id: `${code}:${elementId ?? relatedElementIds?.join(\",\") ?? \"diagram\"}`,\n code,\n severity,\n message,\n ...(elementId ? { elementId } : {}),\n ...(relatedElementIds ? { relatedElementIds } : {}),\n };\n}\n\nexport function validateBpmnDiagram(\n nodes: BpmnRFNode[],\n edges: BpmnRFEdge[],\n options: BpmnValidationOptions = {},\n): BpmnValidationResult {\n const opts = {\n requireStartEvent: true,\n requireEndEvent: true,\n strictNames: false,\n ...options,\n };\n const issues: BpmnValidationIssue[] = [];\n const nodeById = new Map(nodes.map((node) => [node.id, node]));\n const seqEdges = sequenceEdges(edges);\n\n const processNodes = nodes.filter((node) => isProcessNode(node.data.elementType));\n if (opts.requireStartEvent && !processNodes.some((node) => node.data.elementType === \"StartEvent\")) {\n issues.push(issue(\"bpmn/start-event-required\", \"error\", \"The diagram must contain at least one start event.\"));\n }\n if (opts.requireEndEvent && !processNodes.some((node) => node.data.elementType === \"EndEvent\")) {\n issues.push(issue(\"bpmn/end-event-required\", \"error\", \"The diagram must contain at least one end event.\"));\n }\n\n for (const edge of edges) {\n const edgeType = edge.data?.edgeType ?? edge.type;\n const source = nodeById.get(edge.source);\n const target = nodeById.get(edge.target);\n\n if (!source || !target) {\n issues.push(issue(\n \"bpmn/no-orphan-edges\",\n \"error\",\n `Edge \"${edge.id}\" references a missing ${!source ? \"source\" : \"target\"} node.`,\n edge.id,\n [edge.source, edge.target],\n ));\n continue;\n }\n\n if (edge.source === edge.target) {\n issues.push(issue(\"bpmn/no-self-loop\", \"error\", \"BPMN edges cannot connect an element to itself.\", edge.id, [edge.source]));\n }\n\n if (edgeType === \"sequenceFlow\") {\n if (!isFlowNode(source.data.elementType) || !isFlowNode(target.data.elementType) || isDataType(source.data.elementType) || isDataType(target.data.elementType)) {\n issues.push(issue(\"bpmn/sequence-flow-valid-endpoints\", \"error\", \"Sequence flows must connect BPMN flow nodes.\", edge.id, [source.id, target.id]));\n }\n const sourcePool = poolAncestor(source, nodeById);\n const targetPool = poolAncestor(target, nodeById);\n if (sourcePool && targetPool && sourcePool !== targetPool) {\n issues.push(issue(\"bpmn/sequence-flow-no-cross-pool\", \"error\", \"Sequence flows cannot cross pools. Use message flow between participants.\", edge.id, [source.id, target.id]));\n }\n }\n\n if (edgeType === \"messageFlow\") {\n const sourcePool = poolAncestor(source, nodeById);\n const targetPool = poolAncestor(target, nodeById);\n if (!sourcePool || !targetPool || sourcePool === targetPool) {\n issues.push(issue(\"bpmn/message-flow-valid-endpoints\", \"error\", \"Message flows must connect flow nodes in different pools.\", edge.id, [source.id, target.id]));\n }\n if (!isFlowNode(source.data.elementType) || !isFlowNode(target.data.elementType)) {\n issues.push(issue(\"bpmn/message-flow-valid-endpoints\", \"error\", \"Message flows must connect BPMN flow nodes, not containers.\", edge.id, [source.id, target.id]));\n }\n }\n\n if (edgeType === \"dataAssociation\") {\n const hasDataEndpoint = isDataType(source.data.elementType) || isDataType(target.data.elementType);\n const hasFlowEndpoint = isFlowNode(source.data.elementType) || isFlowNode(target.data.elementType);\n if (!hasDataEndpoint || !hasFlowEndpoint) {\n issues.push(issue(\"bpmn/data-association-valid-endpoints\", \"error\", \"Data associations must connect data elements with flow nodes.\", edge.id, [source.id, target.id]));\n }\n }\n }\n\n const duplicateSequenceKeys = new Set<string>();\n const reportedDuplicateKeys = new Set<string>();\n for (const edge of seqEdges) {\n const key = `${edge.source}->${edge.target}`;\n if (duplicateSequenceKeys.has(key) && !reportedDuplicateKeys.has(key)) {\n reportedDuplicateKeys.add(key);\n issues.push(issue(\"bpmn/no-duplicate-sequence-flow\", \"error\", \"Only one sequence flow is allowed between the same source and target.\", edge.id, [edge.source, edge.target]));\n }\n duplicateSequenceKeys.add(key);\n }\n\n for (const node of nodes) {\n const type = node.data.elementType;\n const incoming = countSequenceEdges(edges, node.id, \"in\");\n const outgoing = countSequenceEdges(edges, node.id, \"out\");\n const meta = BPMN_ELEMENT_CATALOG[type];\n\n if (type === \"StartEvent\" && incoming > 0) {\n issues.push(issue(\"bpmn/start-event-no-incoming\", \"error\", \"Start events cannot have incoming sequence flows.\", node.id));\n }\n if (type === \"EndEvent\") {\n if (outgoing > 0) issues.push(issue(\"bpmn/no-outgoing-from-end-event\", \"error\", \"End events cannot have outgoing sequence flows.\", node.id));\n if (incoming === 0) issues.push(issue(\"bpmn/end-event-has-incoming\", \"error\", \"End events should have at least one incoming sequence flow.\", node.id));\n }\n if ((type === \"IntermediateCatchEvent\" || type === \"IntermediateThrowEvent\") && (incoming === 0 || outgoing === 0)) {\n issues.push(issue(\"bpmn/intermediate-event-both-flows\", \"error\", \"Intermediate events should have both incoming and outgoing sequence flows.\", node.id));\n }\n if (type === \"BoundaryEvent\") {\n const hostId = node.data.attachedToRef ?? node.parentId;\n const host = hostId ? nodeById.get(hostId) : undefined;\n if (!host || !BPMN_ELEMENT_CATALOG[host.data.elementType]?.acceptsBoundaryEvents) {\n issues.push(issue(\"bpmn/boundary-event-attached\", \"error\", \"Boundary events must be attached to an activity or subprocess.\", node.id, hostId ? [hostId] : undefined));\n }\n if (sequenceIn(edges, node.id).length > 0) {\n issues.push(issue(\"bpmn/boundary-no-incoming\", \"error\", \"Boundary events cannot have incoming sequence flows.\", node.id));\n }\n if (sequenceOut(edges, node.id).length === 0) {\n issues.push(issue(\"bpmn/boundary-has-outgoing\", \"warning\", \"Boundary events should define an outgoing exception path.\", node.id));\n }\n }\n if (isGatewayType(type)) {\n if (incoming === 0) issues.push(issue(\"bpmn/gateway-has-incoming\", \"error\", \"Gateways should have at least one incoming sequence flow.\", node.id));\n if (outgoing === 0) issues.push(issue(\"bpmn/gateway-has-outgoing\", \"error\", \"Gateways should have at least one outgoing sequence flow.\", node.id));\n }\n if (type === \"ExclusiveGateway\" || type === \"InclusiveGateway\" || type === \"ComplexGateway\") {\n const outgoingEdges = sequenceOut(edges, node.id);\n const defaults = outgoingEdges.filter((edge) => edge.data?.isDefault);\n if (defaults.length > 1) {\n issues.push(issue(\"bpmn/gateway-single-default\", \"error\", \"Gateways can have at most one default sequence flow.\", node.id, defaults.map((edge) => edge.id)));\n }\n if (outgoingEdges.length >= 2) {\n for (const edge of outgoingEdges) {\n if (!edge.data?.isDefault && !edge.data?.conditionExpression) {\n issues.push(issue(\"bpmn/gateway-condition\", \"error\", \"Conditional gateway branches should have a condition or be marked as default.\", edge.id, [node.id, edge.target]));\n }\n }\n }\n }\n if (type === \"EventBasedGateway\") {\n const outgoingEdges = edges.filter((edge) => edge.data?.edgeType === \"sequenceFlow\" && edge.source === node.id);\n if (outgoingEdges.length < 2) {\n issues.push(issue(\"bpmn/event-based-gateway-min-outgoing\", \"error\", \"Event-based gateways should have at least two outgoing sequence flows.\", node.id));\n }\n for (const edge of outgoingEdges) {\n const target = nodeById.get(edge.target);\n if (target && !isCatchTarget(target.data.elementType)) {\n issues.push(issue(\"bpmn/event-based-gateway-valid-targets\", \"error\", \"Event-based gateways must target catch events or receive tasks.\", edge.id, [node.id, target.id]));\n }\n }\n }\n if (meta.maxIncoming !== undefined && incoming > meta.maxIncoming) {\n issues.push(issue(\"bpmn/max-incoming\", \"error\", `${type} cannot have more than ${meta.maxIncoming} incoming sequence flow(s).`, node.id));\n }\n if (meta.maxOutgoing !== undefined && outgoing > meta.maxOutgoing) {\n issues.push(issue(\"bpmn/max-outgoing\", \"error\", `${type} cannot have more than ${meta.maxOutgoing} outgoing sequence flow(s).`, node.id));\n }\n if (opts.strictNames && (type.includes(\"Task\") || isGatewayType(type)) && !node.data.label) {\n issues.push(issue(\"bpmn/name-required\", \"warning\", `${type} should have a label.`, node.id));\n }\n if (isSubProcess(type)) {\n const childNodes = nodes.filter((child) => child.parentId === node.id);\n if (childNodes.length > 0) {\n if (!childNodes.some((child) => child.data.elementType === \"StartEvent\")) {\n issues.push(issue(\"bpmn/subprocess-has-start-end\", \"error\", \"Expanded subprocesses should contain a start event.\", node.id));\n }\n if (!childNodes.some((child) => child.data.elementType === \"EndEvent\")) {\n issues.push(issue(\"bpmn/subprocess-has-start-end\", \"error\", \"Expanded subprocesses should contain an end event.\", node.id));\n }\n }\n if (type === \"EventSubProcess\") {\n const starts = childNodes.filter((child) => child.data.elementType === \"StartEvent\");\n for (const start of starts) {\n if (!start.data.trigger || start.data.trigger === \"none\") {\n issues.push(issue(\"bpmn/event-subprocess-triggered-start\", \"error\", \"Event subprocess start events must define an event trigger.\", start.id, [node.id]));\n }\n }\n }\n }\n if (type === \"Lane\") {\n const parent = node.parentId ? nodeById.get(node.parentId) : undefined;\n if (parent?.data.elementType !== \"Pool\") {\n issues.push(issue(\"bpmn/lane-parent-pool\", \"error\", \"Lanes must be contained by a pool.\", node.id));\n }\n }\n }\n\n return {\n valid: issues.every((item) => item.severity !== \"error\"),\n issues,\n };\n}\n"]}
@@ -247,7 +247,7 @@ function DataAssociationEdge({
247
247
 
248
248
  // src/nodes/shared/theme.ts
249
249
  var BPMN_THEME = {
250
- stroke: "#404040",
250
+ stroke: "#334155",
251
251
  fontFamily: "Inter, system-ui, sans-serif",
252
252
  fontSize: 11};
253
253
  function ConversationLinkEdge({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/edges/path.ts","../../src/edges/SequenceFlowEdge.tsx","../../src/edges/MessageFlowEdge.tsx","../../src/edges/AssociationEdge.tsx","../../src/edges/DataAssociationEdge.tsx","../../src/nodes/shared/theme.ts","../../src/edges/ConversationLinkEdge.tsx","../../src/edges/edgeTypes.ts"],"names":["pointsToSvgPath","getOrthogonalPath","jsxs","Fragment","jsx","BaseEdge","EdgeLabelRenderer","getStraightPath"],"mappings":";;;;;;;;;AAOO,SAAS,aAAA,CACd,OAAA,EACA,OAAA,EACA,OAAA,EACA,SACA,aAAA,EACa;AACb,EAAA,IAAI,aAAA,IAAiB,aAAA,CAAc,MAAA,IAAU,CAAA,EAAG;AAC9C,IAAA,OAAO,aAAA;AAAA,EACT;AAEA,EAAA,OAAO;AAAA,IACL,EAAE,CAAA,EAAG,OAAA,EAAS,CAAA,E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A,CAAE,KAAA,EACL,CAAA,EACF;AAAA,GAAA,EAEJ,CAAA;AAEJ;;;ACjCO,IAAM,eAAA,GAA6B;AAAA,EACxC,YAAA,EAAc,gBAAA;AAAA,EACd,WAAA,EAAa,eAAA;AAAA,EACb,WAAA,EAAa,eAAA;AAAA,EACb,eAAA,EAAiB,mBAAA;AAAA,EACjB,gBAAA,EAAkB;AACpB","file":"index.cjs","sourcesContent":["import type { Position } from \"@xyflow/react\";\n\nexport interface EdgePoint {\n x: number;\n y: number;\n}\n\nexport function getEdgePoints(\n sourceX: number,\n sourceY: number,\n targetX: number,\n targetY: number,\n routingPoints?: EdgePoint[],\n): EdgePoint[] {\n if (routingPoints && routingPoints.length >= 2) {\n return routingPoints;\n }\n\n return [\n { x: sourceX, y: sourceY },\n { x: targetX, y: targetY },\n ];\n}\n\nexport function getPolylineMidpoint(points: EdgePoint[]): EdgePoint {\n if (points.length === 0) return { x: 0, y: 0 };\n if (points.length === 1) return points[0];\n\n let total = 0;\n const lengths: number[] = [];\n\n for (let i = 1; i < points.length; i += 1) {\n const dx = points[i].x - points[i - 1].x;\n const dy = points[i].y - points[i - 1].y;\n const length = Math.hypot(dx, dy);\n lengths.push(length);\n total += length;\n }\n\n const halfway = total / 2;\n let traversed = 0;\n\n for (let i = 1; i < points.length; i += 1) {\n const length = lengths[i - 1];\n if (traversed + length >= halfway) {\n const ratio = length === 0 ? 0 : (halfway - traversed) / length;\n return {\n x: points[i - 1].x + (points[i].x - points[i - 1].x) * ratio,\n y: points[i - 1].y + (points[i].y - points[i - 1].y) * ratio,\n };\n }\n traversed += length;\n }\n\n return points[points.length - 1];\n}\n\nexport function getSegmentAngle(points: EdgePoint[]): number {\n if (points.length < 2) return 0;\n const from = points[0];\n const to = points[1];\n return Math.atan2(to.y - from.y, to.x - from.x);\n}\n\nexport function getDefaultFlowMarkerPath(points: EdgePoint[]): string | null {\n if (points.length < 2) return null;\n\n const start = points[0];\n const angle = getSegmentAngle(points);\n const anchorX = start.x + Math.cos(angle) * 16;\n const anchorY = start.y + Math.sin(angle) * 16;\n const normalAngle = angle + Math.PI / 2;\n const half = 7;\n\n const x1 = anchorX + Math.cos(normalAngle) * half;\n const y1 = anchorY + Math.sin(normalAngle) * half;\n const x2 = anchorX - Math.cos(normalAngle) * half;\n const y2 = anchorY - Math.sin(normalAngle) * half;\n\n return `M ${x1} ${y1} L ${x2} ${y2}`;\n}\n\nexport function fallbackAssociationDirection(\n sourcePosition?: Position,\n targetPosition?: Position,\n): \"horizontal\" | \"vertical\" {\n if (sourcePosition === \"left\" || sourcePosition === \"right\" || targetPosition === \"left\" || targetPosition === \"right\") {\n return \"horizontal\";\n }\n\n return \"vertical\";\n}\n","import { BaseEdge, EdgeLabelRenderer, type EdgeProps } from \"@xyflow/react\";\nimport { getOrthogonalPath, pointsToSvgPath } from \"@aranzatech/diagrams-core/routing\";\nimport type { BpmnEdgeData } from \"../elements/types\";\nimport { getDefaultFlowMarkerPath, getEdgePoints, getPolylineMidpoint } from \"./path\";\n\nexport function SequenceFlowEdge({\n id,\n sourceX, sourceY, targetX, targetY,\n sourcePosition, targetPosition,\n data, label, markerEnd, style, selected,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const points = d?.routingPoints;\n const polyline = getEdgePoints(sourceX, sourceY, targetX, targetY, points);\n\n const path = points && points.length >= 2\n ? pointsToSvgPath(points)\n : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);\n\n const midpoint = getPolylineMidpoint(polyline);\n const defaultMarkerPath = d?.isDefault ? getDefaultFlowMarkerPath(polyline) : null;\n\n return (\n <>\n <BaseEdge\n id={id}\n path={path}\n {...(d?.conditionExpression ? { markerStart: \"url(#bpmn-diamond-open)\" } : {})}\n markerEnd={markerEnd ?? \"url(#bpmn-arrow)\"}\n style={{\n stroke: selected ? \"#1a56db\" : \"#404040\",\n strokeWidth: selected ? 2 : 1.5,\n ...(style ?? {}),\n }}\n />\n {defaultMarkerPath && (\n <path\n d={defaultMarkerPath}\n fill=\"none\"\n stroke={selected ? \"#1a56db\" : \"#404040\"}\n strokeWidth={selected ? 2 : 1.5}\n strokeLinecap=\"round\"\n data-testid=\"bpmn-default-flow-marker\"\n />\n )}\n {(label ?? d?.label) && (\n <EdgeLabelRenderer>\n <div\n style={{\n position: \"absolute\",\n transform: `translate(-50%,-50%) translate(${midpoint.x}px,${midpoint.y}px)`,\n fontSize: 11,\n fontFamily: \"Inter, system-ui, sans-serif\",\n background: \"rgba(255,255,255,0.85)\",\n padding: \"1px 4px\",\n borderRadius: 2,\n pointerEvents: \"all\",\n }}\n className=\"nodrag nopan\"\n >\n {label ?? d?.label}\n </div>\n </EdgeLabelRenderer>\n )}\n </>\n );\n}\n","import { BaseEdge, EdgeLabelRenderer, type EdgeProps } from \"@xyflow/react\";\nimport { getOrthogonalPath, pointsToSvgPath } from \"@aranzatech/diagrams-core/routing\";\nimport type { BpmnEdgeData } from \"../elements/types\";\nimport { getEdgePoints, getPolylineMidpoint } from \"./path\";\n\nexport function MessageFlowEdge({\n id,\n sourceX, sourceY, targetX, targetY,\n sourcePosition, targetPosition,\n data, label, markerEnd, style, selected,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const points = d?.routingPoints;\n const polyline = getEdgePoints(sourceX, sourceY, targetX, targetY, points);\n\n const path = points && points.length >= 2\n ? pointsToSvgPath(points)\n : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);\n\n const midpoint = getPolylineMidpoint(polyline);\n\n return (\n <>\n <BaseEdge\n id={id}\n path={path}\n markerStart=\"url(#bpmn-circle-open)\"\n markerEnd={markerEnd ?? \"url(#bpmn-arrow-open)\"}\n style={{\n stroke: selected ? \"#1a56db\" : \"#404040\",\n strokeWidth: selected ? 2 : 1.5,\n strokeDasharray: \"6 3\",\n ...(style ?? {}),\n }}\n />\n {(label ?? d?.label) && (\n <EdgeLabelRenderer>\n <div\n style={{\n position: \"absolute\",\n transform: `translate(-50%,-50%) translate(${midpoint.x}px,${midpoint.y}px)`,\n fontSize: 11,\n fontFamily: \"Inter, system-ui, sans-serif\",\n background: \"rgba(255,255,255,0.85)\",\n padding: \"1px 4px\",\n borderRadius: 2,\n pointerEvents: \"all\",\n }}\n className=\"nodrag nopan\"\n >\n {label ?? d?.label}\n </div>\n </EdgeLabelRenderer>\n )}\n </>\n );\n}\n","import { BaseEdge, type EdgeProps } from \"@xyflow/react\";\nimport { getOrthogonalPath, pointsToSvgPath } from \"@aranzatech/diagrams-core/routing\";\nimport type { BpmnEdgeData } from \"../elements/types\";\n\nexport function AssociationEdge({\n id,\n sourceX, sourceY, targetX, targetY,\n sourcePosition, targetPosition,\n data, style, selected,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const points = d?.routingPoints;\n const direction = d?.associationDirection ?? \"none\";\n\n const path = points && points.length >= 2\n ? pointsToSvgPath(points)\n : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);\n\n return (\n <BaseEdge\n id={id}\n path={path}\n {...(direction === \"both\" ? { markerStart: \"url(#bpmn-arrow-open)\" } : {})}\n {...(direction === \"one\" || direction === \"both\" ? { markerEnd: \"url(#bpmn-arrow-open)\" } : {})}\n style={{\n stroke: selected ? \"#1a56db\" : \"#888\",\n strokeWidth: 1,\n strokeDasharray: \"3 3\",\n ...(style ?? {}),\n }}\n />\n );\n}\n","import { BaseEdge, type EdgeProps } from \"@xyflow/react\";\nimport { getOrthogonalPath, pointsToSvgPath } from \"@aranzatech/diagrams-core/routing\";\nimport type { BpmnEdgeData } from \"../elements/types\";\n\nexport function DataAssociationEdge({\n id,\n sourceX, sourceY, targetX, targetY,\n sourcePosition, targetPosition,\n data, style, selected,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const points = d?.routingPoints;\n\n const path = points && points.length >= 2\n ? pointsToSvgPath(points)\n : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);\n\n return (\n <BaseEdge\n id={id}\n path={path}\n markerEnd=\"url(#bpmn-arrow-open)\"\n style={{\n stroke: selected ? \"#1a56db\" : \"#888\",\n strokeWidth: 1,\n strokeDasharray: \"3 3\",\n ...(style ?? {}),\n }}\n />\n );\n}\n","export const BPMN_THEME = {\n fill: \"#ffffff\",\n stroke: \"#404040\",\n strokeSelected: \"#1a56db\",\n strokeWidth: 1.5,\n strokeWidthSelected: 2.5,\n fontFamily: \"Inter, system-ui, sans-serif\",\n fontSize: 11,\n labelColor: \"#1a1a1a\",\n handleColor: \"#8c8c8c\",\n handleColorSelected: \"#1a56db\",\n} as const;\n\nexport function resolveStroke(selected: boolean | undefined, override?: string): string {\n if (selected) return BPMN_THEME.strokeSelected;\n return override ?? BPMN_THEME.stroke;\n}\n\nexport function resolveStrokeWidth(selected: boolean | undefined): number {\n return selected ? BPMN_THEME.strokeWidthSelected : BPMN_THEME.strokeWidth;\n}\n","import type { EdgeProps } from \"@xyflow/react\";\nimport { BaseEdge, getStraightPath } from \"@xyflow/react\";\nimport type { BpmnEdgeData } from \"../elements/types\";\nimport { BPMN_THEME } from \"../nodes/shared/theme\";\n\n// BPMN 2.0 §12.2 — ConversationLink is rendered as a double line.\n// Technique: draw the path twice — wide stroke then narrower background —\n// to produce a parallel-line effect without complex path offsets.\n\nexport function ConversationLinkEdge({\n sourceX, sourceY, targetX, targetY,\n data, markerEnd,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const stroke = BPMN_THEME.stroke;\n\n const [path] = getStraightPath({ sourceX, sourceY, targetX, targetY });\n\n return (\n <g>\n {/* Outer (wide) stroke */}\n <BaseEdge\n path={path}\n {...(markerEnd ? { markerEnd } : {})}\n style={{ stroke, strokeWidth: 5, fill: \"none\" }}\n />\n {/* Inner white gap — creates double-line visual */}\n <BaseEdge\n path={path}\n style={{ stroke: \"#ffffff\", strokeWidth: 2, fill: \"none\" }}\n />\n {/* Label */}\n {d?.label && (\n <text fontSize={BPMN_THEME.fontSize} fontFamily={BPMN_THEME.fontFamily} fill={stroke}>\n <textPath href={`#${path}`} startOffset=\"50%\" textAnchor=\"middle\">\n {d.label}\n </textPath>\n </text>\n )}\n </g>\n );\n}\n","import type { EdgeTypes } from \"@xyflow/react\";\nimport { SequenceFlowEdge } from \"./SequenceFlowEdge\";\nimport { MessageFlowEdge } from \"./MessageFlowEdge\";\nimport { AssociationEdge } from \"./AssociationEdge\";\nimport { DataAssociationEdge } from \"./DataAssociationEdge\";\nimport { ConversationLinkEdge } from \"./ConversationLinkEdge\";\n\n/** Pass this object to `DiagramCanvas` as `edgeTypes`. */\nexport const BPMN_EDGE_TYPES: EdgeTypes = {\n sequenceFlow: SequenceFlowEdge,\n messageFlow: MessageFlowEdge,\n association: AssociationEdge,\n dataAssociation: DataAssociationEdge,\n conversationLink: ConversationLinkEdge,\n};\n"]}
1
+ {"version":3,"sources":["../../src/edges/path.ts","../../src/edges/SequenceFlowEdge.tsx","../../src/edges/MessageFlowEdge.tsx","../../src/edges/AssociationEdge.tsx","../../src/edges/DataAssociationEdge.tsx","../../src/nodes/shared/theme.ts","../../src/edges/ConversationLinkEdge.tsx","../../src/edges/edgeTypes.ts"],"names":["pointsToSvgPath","getOrthogonalPath","jsxs","Fragment","jsx","BaseEdge","EdgeLabelRenderer","getStraightPath"],"mappings":";;;;;;;;;AAOO,SAAS,aAAA,CACd,OAAA,EACA,OAAA,EACA,OAAA,EACA,SACA,aAAA,EACa;AACb,EAAA,IAAI,aAAA,IAAiB,aAAA,CAAc,MAAA,IAAU,CAAA,EAAG;AAC9C,IAAA,OAAO,aAAA;AAAA,EACT;AAEA,EAAA,OAAO;AAAA,IACL,EAAE,CAAA,EAAG,OAAA,EAAS,CAAA,EAAG,OAAA,EAAQ;AAAA,IACzB,EAAE,CAAA,EAAG,OAAA,EAAS,CAAA,EAAG,OAAA;AAAQ,GAC3B;AACF;AAEO,SAAS,oBAAoB,MAAA,EAAgC;AAClE,EAAA,IAAI,MAAA,CAAO,WAAW,CAAA,EAAG,OAAO,EAAE,C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eAAA,EAAiB,mBAAA;AAAA,EACjB,gBAAA,EAAkB;AACpB","file":"index.cjs","sourcesContent":["import type { Position } from \"@xyflow/react\";\n\nexport interface EdgePoint {\n x: number;\n y: number;\n}\n\nexport function getEdgePoints(\n sourceX: number,\n sourceY: number,\n targetX: number,\n targetY: number,\n routingPoints?: EdgePoint[],\n): EdgePoint[] {\n if (routingPoints && routingPoints.length >= 2) {\n return routingPoints;\n }\n\n return [\n { x: sourceX, y: sourceY },\n { x: targetX, y: targetY },\n ];\n}\n\nexport function getPolylineMidpoint(points: EdgePoint[]): EdgePoint {\n if (points.length === 0) return { x: 0, y: 0 };\n if (points.length === 1) return points[0];\n\n let total = 0;\n const lengths: number[] = [];\n\n for (let i = 1; i < points.length; i += 1) {\n const dx = points[i].x - points[i - 1].x;\n const dy = points[i].y - points[i - 1].y;\n const length = Math.hypot(dx, dy);\n lengths.push(length);\n total += length;\n }\n\n const halfway = total / 2;\n let traversed = 0;\n\n for (let i = 1; i < points.length; i += 1) {\n const length = lengths[i - 1];\n if (traversed + length >= halfway) {\n const ratio = length === 0 ? 0 : (halfway - traversed) / length;\n return {\n x: points[i - 1].x + (points[i].x - points[i - 1].x) * ratio,\n y: points[i - 1].y + (points[i].y - points[i - 1].y) * ratio,\n };\n }\n traversed += length;\n }\n\n return points[points.length - 1];\n}\n\nexport function getSegmentAngle(points: EdgePoint[]): number {\n if (points.length < 2) return 0;\n const from = points[0];\n const to = points[1];\n return Math.atan2(to.y - from.y, to.x - from.x);\n}\n\nexport function getDefaultFlowMarkerPath(points: EdgePoint[]): string | null {\n if (points.length < 2) return null;\n\n const start = points[0];\n const angle = getSegmentAngle(points);\n const anchorX = start.x + Math.cos(angle) * 16;\n const anchorY = start.y + Math.sin(angle) * 16;\n const normalAngle = angle + Math.PI / 2;\n const half = 7;\n\n const x1 = anchorX + Math.cos(normalAngle) * half;\n const y1 = anchorY + Math.sin(normalAngle) * half;\n const x2 = anchorX - Math.cos(normalAngle) * half;\n const y2 = anchorY - Math.sin(normalAngle) * half;\n\n return `M ${x1} ${y1} L ${x2} ${y2}`;\n}\n\nexport function fallbackAssociationDirection(\n sourcePosition?: Position,\n targetPosition?: Position,\n): \"horizontal\" | \"vertical\" {\n if (sourcePosition === \"left\" || sourcePosition === \"right\" || targetPosition === \"left\" || targetPosition === \"right\") {\n return \"horizontal\";\n }\n\n return \"vertical\";\n}\n","import { BaseEdge, EdgeLabelRenderer, type EdgeProps } from \"@xyflow/react\";\nimport { getOrthogonalPath, pointsToSvgPath } from \"@aranzatech/diagrams-core/routing\";\nimport type { BpmnEdgeData } from \"../elements/types\";\nimport { getDefaultFlowMarkerPath, getEdgePoints, getPolylineMidpoint } from \"./path\";\n\nexport function SequenceFlowEdge({\n id,\n sourceX, sourceY, targetX, targetY,\n sourcePosition, targetPosition,\n data, label, markerEnd, style, selected,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const points = d?.routingPoints;\n const polyline = getEdgePoints(sourceX, sourceY, targetX, targetY, points);\n\n const path = points && points.length >= 2\n ? pointsToSvgPath(points)\n : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);\n\n const midpoint = getPolylineMidpoint(polyline);\n const defaultMarkerPath = d?.isDefault ? getDefaultFlowMarkerPath(polyline) : null;\n\n return (\n <>\n <BaseEdge\n id={id}\n path={path}\n {...(d?.conditionExpression ? { markerStart: \"url(#bpmn-diamond-open)\" } : {})}\n markerEnd={markerEnd ?? \"url(#bpmn-arrow)\"}\n style={{\n stroke: selected ? \"#1a56db\" : \"#404040\",\n strokeWidth: selected ? 2 : 1.5,\n ...(style ?? {}),\n }}\n />\n {defaultMarkerPath && (\n <path\n d={defaultMarkerPath}\n fill=\"none\"\n stroke={selected ? \"#1a56db\" : \"#404040\"}\n strokeWidth={selected ? 2 : 1.5}\n strokeLinecap=\"round\"\n data-testid=\"bpmn-default-flow-marker\"\n />\n )}\n {(label ?? d?.label) && (\n <EdgeLabelRenderer>\n <div\n style={{\n position: \"absolute\",\n transform: `translate(-50%,-50%) translate(${midpoint.x}px,${midpoint.y}px)`,\n fontSize: 11,\n fontFamily: \"Inter, system-ui, sans-serif\",\n background: \"rgba(255,255,255,0.85)\",\n padding: \"1px 4px\",\n borderRadius: 2,\n pointerEvents: \"all\",\n }}\n className=\"nodrag nopan\"\n >\n {label ?? d?.label}\n </div>\n </EdgeLabelRenderer>\n )}\n </>\n );\n}\n","import { BaseEdge, EdgeLabelRenderer, type EdgeProps } from \"@xyflow/react\";\nimport { getOrthogonalPath, pointsToSvgPath } from \"@aranzatech/diagrams-core/routing\";\nimport type { BpmnEdgeData } from \"../elements/types\";\nimport { getEdgePoints, getPolylineMidpoint } from \"./path\";\n\nexport function MessageFlowEdge({\n id,\n sourceX, sourceY, targetX, targetY,\n sourcePosition, targetPosition,\n data, label, markerEnd, style, selected,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const points = d?.routingPoints;\n const polyline = getEdgePoints(sourceX, sourceY, targetX, targetY, points);\n\n const path = points && points.length >= 2\n ? pointsToSvgPath(points)\n : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);\n\n const midpoint = getPolylineMidpoint(polyline);\n\n return (\n <>\n <BaseEdge\n id={id}\n path={path}\n markerStart=\"url(#bpmn-circle-open)\"\n markerEnd={markerEnd ?? \"url(#bpmn-arrow-open)\"}\n style={{\n stroke: selected ? \"#1a56db\" : \"#404040\",\n strokeWidth: selected ? 2 : 1.5,\n strokeDasharray: \"6 3\",\n ...(style ?? {}),\n }}\n />\n {(label ?? d?.label) && (\n <EdgeLabelRenderer>\n <div\n style={{\n position: \"absolute\",\n transform: `translate(-50%,-50%) translate(${midpoint.x}px,${midpoint.y}px)`,\n fontSize: 11,\n fontFamily: \"Inter, system-ui, sans-serif\",\n background: \"rgba(255,255,255,0.85)\",\n padding: \"1px 4px\",\n borderRadius: 2,\n pointerEvents: \"all\",\n }}\n className=\"nodrag nopan\"\n >\n {label ?? d?.label}\n </div>\n </EdgeLabelRenderer>\n )}\n </>\n );\n}\n","import { BaseEdge, type EdgeProps } from \"@xyflow/react\";\nimport { getOrthogonalPath, pointsToSvgPath } from \"@aranzatech/diagrams-core/routing\";\nimport type { BpmnEdgeData } from \"../elements/types\";\n\nexport function AssociationEdge({\n id,\n sourceX, sourceY, targetX, targetY,\n sourcePosition, targetPosition,\n data, style, selected,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const points = d?.routingPoints;\n const direction = d?.associationDirection ?? \"none\";\n\n const path = points && points.length >= 2\n ? pointsToSvgPath(points)\n : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);\n\n return (\n <BaseEdge\n id={id}\n path={path}\n {...(direction === \"both\" ? { markerStart: \"url(#bpmn-arrow-open)\" } : {})}\n {...(direction === \"one\" || direction === \"both\" ? { markerEnd: \"url(#bpmn-arrow-open)\" } : {})}\n style={{\n stroke: selected ? \"#1a56db\" : \"#888\",\n strokeWidth: 1,\n strokeDasharray: \"3 3\",\n ...(style ?? {}),\n }}\n />\n );\n}\n","import { BaseEdge, type EdgeProps } from \"@xyflow/react\";\nimport { getOrthogonalPath, pointsToSvgPath } from \"@aranzatech/diagrams-core/routing\";\nimport type { BpmnEdgeData } from \"../elements/types\";\n\nexport function DataAssociationEdge({\n id,\n sourceX, sourceY, targetX, targetY,\n sourcePosition, targetPosition,\n data, style, selected,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const points = d?.routingPoints;\n\n const path = points && points.length >= 2\n ? pointsToSvgPath(points)\n : getOrthogonalPath(sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition);\n\n return (\n <BaseEdge\n id={id}\n path={path}\n markerEnd=\"url(#bpmn-arrow-open)\"\n style={{\n stroke: selected ? \"#1a56db\" : \"#888\",\n strokeWidth: 1,\n strokeDasharray: \"3 3\",\n ...(style ?? {}),\n }}\n />\n );\n}\n","export const BPMN_THEME = {\n fill: \"#ffffff\",\n fillSoft: \"#f8fbff\",\n fillSubtle: \"#eef6ff\",\n stroke: \"#334155\",\n strokeMuted: \"#64748b\",\n strokeSelected: \"#2563eb\",\n strokeWidth: 1.5,\n strokeWidthSelected: 2.5,\n fontFamily: \"Inter, system-ui, sans-serif\",\n fontSize: 11,\n labelColor: \"#0f172a\",\n handleColor: \"#94a3b8\",\n handleColorSelected: \"#2563eb\",\n shadow: \"0 4px 12px rgba(15, 23, 42, 0.08)\",\n shadowSelected: \"0 0 0 4px rgba(37, 99, 235, 0.14), 0 8px 18px rgba(15, 23, 42, 0.12)\",\n transition: \"box-shadow 140ms ease, filter 140ms ease, transform 140ms ease\",\n} as const;\n\nexport function resolveStroke(selected: boolean | undefined, override?: string): string {\n if (selected) return BPMN_THEME.strokeSelected;\n return override ?? BPMN_THEME.stroke;\n}\n\nexport function resolveStrokeWidth(selected: boolean | undefined): number {\n return selected ? BPMN_THEME.strokeWidthSelected : BPMN_THEME.strokeWidth;\n}\n\nexport function resolveShapeFilter(selected: boolean | undefined): string | undefined {\n return selected\n ? \"drop-shadow(0 0 0 rgba(37,99,235,0.2)) drop-shadow(0 8px 14px rgba(15,23,42,0.12))\"\n : \"drop-shadow(0 4px 10px rgba(15,23,42,0.08))\";\n}\n\nexport function resolveNodeShadow(selected: boolean | undefined): string {\n return selected ? BPMN_THEME.shadowSelected : BPMN_THEME.shadow;\n}\n","import type { EdgeProps } from \"@xyflow/react\";\nimport { BaseEdge, getStraightPath } from \"@xyflow/react\";\nimport type { BpmnEdgeData } from \"../elements/types\";\nimport { BPMN_THEME } from \"../nodes/shared/theme\";\n\n// BPMN 2.0 §12.2 — ConversationLink is rendered as a double line.\n// Technique: draw the path twice — wide stroke then narrower background —\n// to produce a parallel-line effect without complex path offsets.\n\nexport function ConversationLinkEdge({\n sourceX, sourceY, targetX, targetY,\n data, markerEnd,\n}: EdgeProps) {\n const d = data as BpmnEdgeData | undefined;\n const stroke = BPMN_THEME.stroke;\n\n const [path] = getStraightPath({ sourceX, sourceY, targetX, targetY });\n\n return (\n <g>\n {/* Outer (wide) stroke */}\n <BaseEdge\n path={path}\n {...(markerEnd ? { markerEnd } : {})}\n style={{ stroke, strokeWidth: 5, fill: \"none\" }}\n />\n {/* Inner white gap — creates double-line visual */}\n <BaseEdge\n path={path}\n style={{ stroke: \"#ffffff\", strokeWidth: 2, fill: \"none\" }}\n />\n {/* Label */}\n {d?.label && (\n <text fontSize={BPMN_THEME.fontSize} fontFamily={BPMN_THEME.fontFamily} fill={stroke}>\n <textPath href={`#${path}`} startOffset=\"50%\" textAnchor=\"middle\">\n {d.label}\n </textPath>\n </text>\n )}\n </g>\n );\n}\n","import type { EdgeTypes } from \"@xyflow/react\";\nimport { SequenceFlowEdge } from \"./SequenceFlowEdge\";\nimport { MessageFlowEdge } from \"./MessageFlowEdge\";\nimport { AssociationEdge } from \"./AssociationEdge\";\nimport { DataAssociationEdge } from \"./DataAssociationEdge\";\nimport { ConversationLinkEdge } from \"./ConversationLinkEdge\";\n\n/** Pass this object to `DiagramCanvas` as `edgeTypes`. */\nexport const BPMN_EDGE_TYPES: EdgeTypes = {\n sequenceFlow: SequenceFlowEdge,\n messageFlow: MessageFlowEdge,\n association: AssociationEdge,\n dataAssociation: DataAssociationEdge,\n conversationLink: ConversationLinkEdge,\n};\n"]}
@@ -1,4 +1,4 @@
1
- export { AssociationEdge, BPMN_EDGE_TYPES, ConversationLinkEdge, DataAssociationEdge, MessageFlowEdge, SequenceFlowEdge } from '../chunk-3AFZDIMQ.js';
2
- import '../chunk-23B2IGK5.js';
1
+ export { AssociationEdge, BPMN_EDGE_TYPES, ConversationLinkEdge, DataAssociationEdge, MessageFlowEdge, SequenceFlowEdge } from '../chunk-ECTJRD7Z.js';
2
+ import '../chunk-KALSGH4D.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -36,7 +36,7 @@ var BPMN_ELEMENT_CATALOG = {
36
36
  },
37
37
  IntermediateCatchEvent: {
38
38
  label: "Intermediate Catch Event",
39
- icon: "Clock",
39
+ icon: "Clock3",
40
40
  category: "event",
41
41
  defaultWidth: 36,
42
42
  defaultHeight: 36,
@@ -50,7 +50,7 @@ var BPMN_ELEMENT_CATALOG = {
50
50
  },
51
51
  IntermediateThrowEvent: {
52
52
  label: "Intermediate Throw Event",
53
- icon: "Zap",
53
+ icon: "Send",
54
54
  category: "event",
55
55
  defaultWidth: 36,
56
56
  defaultHeight: 36,
@@ -64,7 +64,7 @@ var BPMN_ELEMENT_CATALOG = {
64
64
  },
65
65
  BoundaryEvent: {
66
66
  label: "Boundary Event",
67
- icon: "AlertCircle",
67
+ icon: "AlarmClock",
68
68
  category: "event",
69
69
  defaultWidth: 36,
70
70
  defaultHeight: 36,
@@ -80,7 +80,7 @@ var BPMN_ELEMENT_CATALOG = {
80
80
  // ─── Tasks ───────────────────────────────────────────────────────────────────
81
81
  Task: {
82
82
  label: "Task",
83
- icon: "Square",
83
+ icon: "CheckSquare",
84
84
  category: "task",
85
85
  defaultWidth: 120,
86
86
  defaultHeight: 60,
@@ -94,7 +94,7 @@ var BPMN_ELEMENT_CATALOG = {
94
94
  },
95
95
  UserTask: {
96
96
  label: "User Task",
97
- icon: "User",
97
+ icon: "UserRound",
98
98
  category: "task",
99
99
  defaultWidth: 120,
100
100
  defaultHeight: 60,
@@ -108,7 +108,7 @@ var BPMN_ELEMENT_CATALOG = {
108
108
  },
109
109
  ServiceTask: {
110
110
  label: "Service Task",
111
- icon: "Settings",
111
+ icon: "Cog",
112
112
  category: "task",
113
113
  defaultWidth: 120,
114
114
  defaultHeight: 60,
@@ -150,7 +150,7 @@ var BPMN_ELEMENT_CATALOG = {
150
150
  },
151
151
  BusinessRuleTask: {
152
152
  label: "Business Rule Task",
153
- icon: "Scale",
153
+ icon: "Table2",
154
154
  category: "task",
155
155
  defaultWidth: 120,
156
156
  defaultHeight: 60,
@@ -164,7 +164,7 @@ var BPMN_ELEMENT_CATALOG = {
164
164
  },
165
165
  ReceiveTask: {
166
166
  label: "Receive Task",
167
- icon: "Mail",
167
+ icon: "Inbox",
168
168
  category: "task",
169
169
  defaultWidth: 120,
170
170
  defaultHeight: 60,
@@ -207,7 +207,7 @@ var BPMN_ELEMENT_CATALOG = {
207
207
  // ─── Gateways ────────────────────────────────────────────────────────────────
208
208
  ExclusiveGateway: {
209
209
  label: "Exclusive Gateway",
210
- icon: "GitBranch",
210
+ icon: "X",
211
211
  category: "gateway",
212
212
  defaultWidth: 50,
213
213
  defaultHeight: 50,
@@ -220,7 +220,7 @@ var BPMN_ELEMENT_CATALOG = {
220
220
  },
221
221
  InclusiveGateway: {
222
222
  label: "Inclusive Gateway",
223
- icon: "GitMerge",
223
+ icon: "Circle",
224
224
  category: "gateway",
225
225
  defaultWidth: 50,
226
226
  defaultHeight: 50,
@@ -233,7 +233,7 @@ var BPMN_ELEMENT_CATALOG = {
233
233
  },
234
234
  ParallelGateway: {
235
235
  label: "Parallel Gateway",
236
- icon: "GitFork",
236
+ icon: "Plus",
237
237
  category: "gateway",
238
238
  defaultWidth: 50,
239
239
  defaultHeight: 50,
@@ -274,7 +274,7 @@ var BPMN_ELEMENT_CATALOG = {
274
274
  // ─── Containers ───────────────────────────────────────────────────────────────
275
275
  SubProcess: {
276
276
  label: "Sub-Process",
277
- icon: "Layout",
277
+ icon: "PlusSquare",
278
278
  category: "container",
279
279
  defaultWidth: 350,
280
280
  defaultHeight: 200,
@@ -289,7 +289,7 @@ var BPMN_ELEMENT_CATALOG = {
289
289
  },
290
290
  Transaction: {
291
291
  label: "Transaction",
292
- icon: "CreditCard",
292
+ icon: "Receipt",
293
293
  category: "container",
294
294
  defaultWidth: 350,
295
295
  defaultHeight: 200,
@@ -304,7 +304,7 @@ var BPMN_ELEMENT_CATALOG = {
304
304
  },
305
305
  EventSubProcess: {
306
306
  label: "Event Sub-Process",
307
- icon: "Workflow",
307
+ icon: "CircleDotDashed",
308
308
  category: "container",
309
309
  defaultWidth: 350,
310
310
  defaultHeight: 200,
@@ -319,7 +319,7 @@ var BPMN_ELEMENT_CATALOG = {
319
319
  },
320
320
  AdHocSubProcess: {
321
321
  label: "Ad-Hoc Sub-Process",
322
- icon: "Shuffle",
322
+ icon: "Waves",
323
323
  category: "container",
324
324
  defaultWidth: 350,
325
325
  defaultHeight: 200,
@@ -334,7 +334,7 @@ var BPMN_ELEMENT_CATALOG = {
334
334
  },
335
335
  Pool: {
336
336
  label: "Pool",
337
- icon: "Columns",
337
+ icon: "Rows3",
338
338
  category: "container",
339
339
  defaultWidth: 600,
340
340
  defaultHeight: 200,
@@ -349,7 +349,7 @@ var BPMN_ELEMENT_CATALOG = {
349
349
  },
350
350
  Lane: {
351
351
  label: "Lane",
352
- icon: "AlignJustify",
352
+ icon: "PanelTop",
353
353
  category: "container",
354
354
  defaultWidth: 600,
355
355
  defaultHeight: 120,
@@ -568,6 +568,67 @@ var BPMN_ELEMENT_CATALOG = {
568
568
  function getElementMeta(type) {
569
569
  return BPMN_ELEMENT_CATALOG[type];
570
570
  }
571
+ var BPMN_RESIZABLE_ELEMENT_TYPES = [
572
+ "Task",
573
+ "UserTask",
574
+ "ServiceTask",
575
+ "ScriptTask",
576
+ "ManualTask",
577
+ "BusinessRuleTask",
578
+ "ReceiveTask",
579
+ "SendTask",
580
+ "CallActivity",
581
+ "SubProcess",
582
+ "Transaction",
583
+ "EventSubProcess",
584
+ "AdHocSubProcess",
585
+ "Pool",
586
+ "Lane",
587
+ "Annotation",
588
+ "Group",
589
+ "SubConversation",
590
+ "ChoreographyTask",
591
+ "SubChoreography",
592
+ "CallChoreography"
593
+ ];
594
+ var BPMN_MIN_SIZE_OVERRIDES = {
595
+ Task: { minWidth: 80, minHeight: 48 },
596
+ UserTask: { minWidth: 80, minHeight: 48 },
597
+ ServiceTask: { minWidth: 80, minHeight: 48 },
598
+ ScriptTask: { minWidth: 80, minHeight: 48 },
599
+ ManualTask: { minWidth: 80, minHeight: 48 },
600
+ BusinessRuleTask: { minWidth: 80, minHeight: 48 },
601
+ ReceiveTask: { minWidth: 80, minHeight: 48 },
602
+ SendTask: { minWidth: 80, minHeight: 48 },
603
+ CallActivity: { minWidth: 80, minHeight: 48 },
604
+ SubProcess: { minWidth: 160, minHeight: 100 },
605
+ Transaction: { minWidth: 160, minHeight: 100 },
606
+ EventSubProcess: { minWidth: 160, minHeight: 100 },
607
+ AdHocSubProcess: { minWidth: 160, minHeight: 100 },
608
+ Pool: { minWidth: 240, minHeight: 120 },
609
+ Lane: { minWidth: 240, minHeight: 80 },
610
+ Annotation: { minWidth: 80, minHeight: 40 },
611
+ Group: { minWidth: 120, minHeight: 80 },
612
+ SubConversation: { minWidth: 60, minHeight: 52 },
613
+ ChoreographyTask: { minWidth: 100, minHeight: 70 },
614
+ SubChoreography: { minWidth: 100, minHeight: 70 },
615
+ CallChoreography: { minWidth: 100, minHeight: 70 }
616
+ };
617
+ var resizableTypes = new Set(BPMN_RESIZABLE_ELEMENT_TYPES);
618
+ function isBpmnElementResizable(type) {
619
+ return resizableTypes.has(type);
620
+ }
621
+ function getBpmnElementSize(type) {
622
+ const meta = getElementMeta(type);
623
+ const min = BPMN_MIN_SIZE_OVERRIDES[type];
624
+ return {
625
+ width: meta.defaultWidth,
626
+ height: meta.defaultHeight,
627
+ minWidth: meta.minWidth ?? min?.minWidth ?? meta.defaultWidth,
628
+ minHeight: meta.minHeight ?? min?.minHeight ?? meta.defaultHeight,
629
+ resizable: meta.resizable ?? isBpmnElementResizable(type)
630
+ };
631
+ }
571
632
 
572
633
  // src/elements/guards.ts
573
634
  var TASK_TYPES = /* @__PURE__ */ new Set([
@@ -651,10 +712,13 @@ function supportsMarkers(type) {
651
712
  }
652
713
 
653
714
  exports.BPMN_ELEMENT_CATALOG = BPMN_ELEMENT_CATALOG;
715
+ exports.BPMN_RESIZABLE_ELEMENT_TYPES = BPMN_RESIZABLE_ELEMENT_TYPES;
654
716
  exports.acceptsBoundaryEvents = acceptsBoundaryEvents;
717
+ exports.getBpmnElementSize = getBpmnElementSize;
655
718
  exports.getElementMeta = getElementMeta;
656
719
  exports.getHandlePolicy = getHandlePolicy;
657
720
  exports.getOrientation = getOrientation;
721
+ exports.isBpmnElementResizable = isBpmnElementResizable;
658
722
  exports.isChoreographyType = isChoreographyType;
659
723
  exports.isContainerType = isContainerType;
660
724
  exports.isConversationType = isConversationType;