@aranzatech/diagrams-bpmn 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/{catalog-DNIyjHbl.d.ts → catalog-CYZHikuU.d.ts} +1 -1
  2. package/dist/{catalog-DG-sz0VM.d.cts → catalog-C_S9hyyn.d.cts} +1 -1
  3. package/dist/{chunk-CPFUQM6H.js → chunk-EMTO53AN.js} +54 -73
  4. package/dist/chunk-EMTO53AN.js.map +1 -0
  5. package/dist/chunk-G22XQD6H.js +64 -0
  6. package/dist/chunk-G22XQD6H.js.map +1 -0
  7. package/dist/{chunk-NYIYQUGX.js → chunk-OFOTX3LA.js} +124 -20
  8. package/dist/chunk-OFOTX3LA.js.map +1 -0
  9. package/dist/{chunk-YAYZW45I.js → chunk-SRUWPELT.js} +80 -3
  10. package/dist/chunk-SRUWPELT.js.map +1 -0
  11. package/dist/edges/index.cjs +75 -35
  12. package/dist/edges/index.cjs.map +1 -1
  13. package/dist/edges/index.js +2 -1
  14. package/dist/elements/index.d.cts +3 -3
  15. package/dist/elements/index.d.ts +3 -3
  16. package/dist/extensions/index.d.cts +2 -2
  17. package/dist/extensions/index.d.ts +2 -2
  18. package/dist/index.cjs +196 -53
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +4 -4
  21. package/dist/index.d.ts +4 -4
  22. package/dist/index.js +4 -3
  23. package/dist/index.js.map +1 -1
  24. package/dist/layout/index.cjs +1280 -889
  25. package/dist/layout/index.cjs.map +1 -1
  26. package/dist/layout/index.d.cts +4 -4
  27. package/dist/layout/index.d.ts +4 -4
  28. package/dist/layout/index.js +694 -106
  29. package/dist/layout/index.js.map +1 -1
  30. package/dist/modeling/index.cjs +78 -0
  31. package/dist/modeling/index.cjs.map +1 -1
  32. package/dist/modeling/index.d.cts +10 -5
  33. package/dist/modeling/index.d.ts +10 -5
  34. package/dist/modeling/index.js +1 -1
  35. package/dist/{types-nvF59RGF.d.cts → types--x9aoecw.d.cts} +5 -0
  36. package/dist/{types-nvF59RGF.d.ts → types--x9aoecw.d.ts} +5 -0
  37. package/dist/{types-dQUuSnV5.d.cts → types-CrFDTGo9.d.cts} +1 -1
  38. package/dist/{types-CuDL2YGL.d.ts → types-DoPv3m7u.d.ts} +2 -2
  39. package/dist/{types-X5FyP8oS.d.ts → types-DteJykQG.d.ts} +1 -1
  40. package/dist/{types-CDp9kWQ4.d.cts → types-YZ4sj3Ih.d.cts} +2 -2
  41. package/dist/validation/index.d.cts +3 -3
  42. package/dist/validation/index.d.ts +3 -3
  43. package/dist/xml/index.cjs +162 -18
  44. package/dist/xml/index.cjs.map +1 -1
  45. package/dist/xml/index.d.cts +4 -4
  46. package/dist/xml/index.d.ts +4 -4
  47. package/dist/xml/index.js +2 -1
  48. package/package.json +1 -1
  49. package/dist/chunk-CPFUQM6H.js.map +0 -1
  50. package/dist/chunk-FFWJA5BV.js +0 -163
  51. package/dist/chunk-FFWJA5BV.js.map +0 -1
  52. package/dist/chunk-NYIYQUGX.js.map +0 -1
  53. package/dist/chunk-YAYZW45I.js.map +0 -1
  54. package/dist/elk-QT7H4252.js +0 -6
  55. package/dist/elk-QT7H4252.js.map +0 -1
@@ -1151,6 +1151,83 @@ function applyBpmnPoolLaneDimensionChange(nodes, previousNodes, nodeId, width, h
1151
1151
  }
1152
1152
  return nodes;
1153
1153
  }
1154
+ var BPMN_CONTAINER_GROW_PAD = 24;
1155
+ function growBpmnContainersToFit(nodes, options = {}) {
1156
+ const growPad = options.growPad ?? BPMN_CONTAINER_GROW_PAD;
1157
+ const pad = BPMN_POOL_LANE_STACK_LAYOUT.poolInnerPad;
1158
+ const gap = BPMN_POOL_LANE_STACK_LAYOUT.laneGap;
1159
+ const updated = /* @__PURE__ */ new Map();
1160
+ const contentExtent = (parentId) => {
1161
+ let right = 0;
1162
+ let bottom = 0;
1163
+ for (const node of nodes) {
1164
+ if (node.parentId !== parentId) continue;
1165
+ if (node.data.elementType === "Lane") continue;
1166
+ const size = getBpmnNodeSize(node);
1167
+ right = Math.max(right, node.position.x + size.width);
1168
+ bottom = Math.max(bottom, node.position.y + size.height);
1169
+ }
1170
+ return { right, bottom };
1171
+ };
1172
+ for (const pool of nodes) {
1173
+ if (pool.data.elementType !== "Pool") continue;
1174
+ if (getBpmnPoolOrientation(pool) === "vertical") continue;
1175
+ const poolSize = getBpmnNodeSize(pool);
1176
+ const lanes = getBpmnPoolLanesOrderedByStack(nodes, pool.id, "horizontal");
1177
+ if (lanes.length === 0) {
1178
+ const extent = contentExtent(pool.id);
1179
+ if (extent.right === 0 && extent.bottom === 0) continue;
1180
+ const poolW2 = Math.max(poolSize.width, extent.right + growPad);
1181
+ const poolH2 = Math.max(poolSize.height, extent.bottom + growPad);
1182
+ if (poolW2 === poolSize.width && poolH2 === poolSize.height) continue;
1183
+ updated.set(pool.id, {
1184
+ ...pool,
1185
+ width: poolW2,
1186
+ height: poolH2,
1187
+ measured: { width: poolW2, height: poolH2 }
1188
+ });
1189
+ continue;
1190
+ }
1191
+ let requiredLaneW = Math.max(...lanes.map((l) => getBpmnNodeSize(l).width));
1192
+ const laneHeights = /* @__PURE__ */ new Map();
1193
+ let anyLaneGrew = false;
1194
+ for (const laneNode of lanes) {
1195
+ const laneSize = getBpmnNodeSize(laneNode);
1196
+ const extent = contentExtent(laneNode.id);
1197
+ const newH = Math.max(laneSize.height, extent.bottom + growPad);
1198
+ laneHeights.set(laneNode.id, newH);
1199
+ requiredLaneW = Math.max(requiredLaneW, extent.right + growPad);
1200
+ if (newH !== laneSize.height) anyLaneGrew = true;
1201
+ }
1202
+ const laneW = requiredLaneW;
1203
+ const laneWGrew = lanes.some((l) => getBpmnNodeSize(l).width !== laneW);
1204
+ if (!anyLaneGrew && !laneWGrew) continue;
1205
+ let cumY = pad;
1206
+ for (const laneNode of lanes) {
1207
+ const laneH = laneHeights.get(laneNode.id);
1208
+ updated.set(laneNode.id, {
1209
+ ...laneNode,
1210
+ position: { x: pad, y: cumY },
1211
+ width: laneW,
1212
+ height: laneH,
1213
+ measured: { width: laneW, height: laneH }
1214
+ });
1215
+ cumY += laneH + gap;
1216
+ }
1217
+ const poolW = Math.max(poolSize.width, laneW + pad * 2);
1218
+ const poolH = Math.max(poolSize.height, cumY - gap + pad);
1219
+ if (poolW !== poolSize.width || poolH !== poolSize.height) {
1220
+ updated.set(pool.id, {
1221
+ ...pool,
1222
+ width: poolW,
1223
+ height: poolH,
1224
+ measured: { width: poolW, height: poolH }
1225
+ });
1226
+ }
1227
+ }
1228
+ if (updated.size === 0) return nodes;
1229
+ return nodes.map((node) => updated.get(node.id) ?? node);
1230
+ }
1154
1231
  function resizeHorizontalBpmnLanes(lanes, pool) {
1155
1232
  const pad = BPMN_POOL_LANE_LAYOUT.poolPad;
1156
1233
  const poolSize = getBpmnNodeSize(pool);
@@ -2011,6 +2088,7 @@ exports.getBpmnPoolLanes = getBpmnPoolLanes;
2011
2088
  exports.getBpmnPoolOrientation = getBpmnPoolOrientation;
2012
2089
  exports.getBpmnTabOrder = getBpmnTabOrder;
2013
2090
  exports.groupAsBpmnSubProcessCommand = groupAsBpmnSubProcessCommand;
2091
+ exports.growBpmnContainersToFit = growBpmnContainersToFit;
2014
2092
  exports.inferBpmnEdgeType = inferBpmnEdgeType;
2015
2093
  exports.isBpmnDroppableInContainer = isBpmnDroppableInContainer;
2016
2094
  exports.isBpmnEdgeRoutingEditable = isBpmnEdgeRoutingEditable;