aurea-eden 1.44.2 → 1.45.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.
@@ -59644,17 +59644,15 @@ class BpmnToFluentConverter {
59644
59644
  // - Right (E) and down (S) ports for parallel/forward paths.
59645
59645
  // ─────────────────────────────────────────────────────────────
59646
59646
  _sourcePort(srcEl, tgtEl, srcOutgoingIds, primaryPathSet) {
59647
- const isEndEvent = tgtEl.type === "bpmn:endEvent" || tgtEl.type === "bpmn:terminateEndEvent";
59648
59647
  const isIteration = this.backEdges && this.backEdges.has(`${srcEl.id}->${tgtEl.id}`) || this.backwardBranchRoots && this.backwardBranchRoots.has(tgtEl.id);
59649
- if (isEndEvent || isIteration) {
59648
+ if (isIteration) {
59650
59649
  return "N";
59651
59650
  }
59652
59651
  if (!srcOutgoingIds) return "E";
59653
59652
  const forwardTargets = srcOutgoingIds.map((id) => this.elements.get(id)).filter((t2) => {
59654
59653
  if (!t2) return false;
59655
- const tIsEnd = t2.type === "bpmn:endEvent" || t2.type === "bpmn:terminateEndEvent";
59656
59654
  const tIsIter = this.backEdges && this.backEdges.has(`${srcEl.id}->${t2.id}`) || this.backwardBranchRoots && this.backwardBranchRoots.has(t2.id);
59657
- return !tIsEnd && !tIsIter;
59655
+ return !tIsIter;
59658
59656
  });
59659
59657
  if (forwardTargets.length <= 1) {
59660
59658
  return "E";
@@ -59662,7 +59660,7 @@ class BpmnToFluentConverter {
59662
59660
  const mainTarget = forwardTargets.find((t2) => primaryPathSet && primaryPathSet.has(t2.id));
59663
59661
  if (mainTarget) {
59664
59662
  if (mainTarget.id === tgtEl.id) return "E";
59665
- return "S";
59663
+ return "auto";
59666
59664
  }
59667
59665
  const sorted = forwardTargets.slice().sort((a2, b) => {
59668
59666
  return a2.id.localeCompare(b.id);
@@ -59872,12 +59870,17 @@ class BpmnToFluentConverter {
59872
59870
  if (detectedBranches.length > 0) {
59873
59871
  generatedLines.push(`
59874
59872
  // --- Stage ${stage === "lanes" ? "3" : "2"}: ${stage === "lanes" ? "Sorting and Lanes" : "Unsorted Branches"} ---`);
59873
+ for (const b of detectedBranches) {
59874
+ const firstEl = this.elements.get(b.nodes[0]);
59875
+ const isFirstElEndEvent = firstEl && (firstEl.type === "bpmn:endEvent" || firstEl.type === "bpmn:terminateEndEvent");
59876
+ b.isUpward = b.isBackward || isFirstElEndEvent;
59877
+ }
59875
59878
  if (stage === "lanes") {
59876
59879
  detectedBranches.sort((a2, b) => a2.span - b.span);
59877
- const forwardBranches = detectedBranches.filter((b) => !b.isBackward);
59878
- const backwardBranches = detectedBranches.filter((b) => b.isBackward);
59879
- if (forwardBranches.length > 0) this._assignLanes(forwardBranches, primaryPath, outgoingFlows, false);
59880
- if (backwardBranches.length > 0) this._assignLanes(backwardBranches, primaryPath, outgoingFlows, true);
59880
+ const downwardBranches = detectedBranches.filter((b) => !b.isUpward);
59881
+ const upwardBranches = detectedBranches.filter((b) => b.isUpward);
59882
+ if (downwardBranches.length > 0) this._assignLanes(downwardBranches, primaryPath, outgoingFlows, false);
59883
+ if (upwardBranches.length > 0) this._assignLanes(upwardBranches, primaryPath, outgoingFlows, true);
59881
59884
  }
59882
59885
  for (const branch of detectedBranches) {
59883
59886
  const anchorEl = this.elements.get(branch.anchor);
@@ -59890,12 +59893,7 @@ class BpmnToFluentConverter {
59890
59893
  let useShiftAndAlign = false;
59891
59894
  if (i2 === 0) {
59892
59895
  let baseAnchorId = anchorEl.id;
59893
- const isElementEndEvent = branchEl.type === "bpmn:endEvent" || branchEl.type === "bpmn:terminateEndEvent";
59894
- const isAnchorGateway = anchorEl.type.toLowerCase().includes("gateway");
59895
- if (isElementEndEvent && isAnchorGateway) {
59896
- positionMethod = "positionUpOf";
59897
- placementAnchorId = anchorEl.id;
59898
- } else if (branch.isBackward) {
59896
+ if (branch.isUpward) {
59899
59897
  placementAnchorId = anchorEl.id;
59900
59898
  if (stage === "lanes" && branch.lane > 0 && branch.laneAnchorId) {
59901
59899
  useShiftAndAlign = true;
@@ -60265,7 +60263,22 @@ SPREAD LOG: Target ${nodeId} Port ${basePort}`);
60265
60263
  }
60266
60264
  }
60267
60265
  if (allPaths.length === 0) return null;
60268
- return allPaths.reduce((longest, current) => current.length > longest.length ? current : longest, []);
60266
+ const scorePath = (path) => {
60267
+ let score = path.length * 100;
60268
+ const endNodeId = path[path.length - 1];
60269
+ const endNode = this.elements.get(endNodeId);
60270
+ if (endNode && endNode.hasName) {
60271
+ const name2 = endNode.name.toLowerCase();
60272
+ if (name2.includes("approve") || name2.includes("success") || name2.includes("complete") || name2.includes("accept") || name2.includes("yes")) {
60273
+ score += 50;
60274
+ }
60275
+ if (name2.includes("reject") || name2.includes("fail") || name2.includes("cancel") || name2.includes("error") || name2.includes("no")) {
60276
+ score -= 50;
60277
+ }
60278
+ }
60279
+ return score;
60280
+ };
60281
+ return allPaths.reduce((best, current) => scorePath(current) > scorePath(best) ? current : best, allPaths[0]);
60269
60282
  }
60270
60283
  /**
60271
60284
  * Traces a continuous branch of unplaced elements starting from a specific node.
@@ -60415,14 +60428,17 @@ SPREAD LOG: Target ${nodeId} Port ${basePort}`);
60415
60428
  const dy = tgtPos.y - srcPos.y;
60416
60429
  if (Math.abs(dy) < 10) return dx > 0 ? { srcPort: "E", tgtPort: "W" } : { srcPort: "W", tgtPort: "E" };
60417
60430
  if (Math.abs(dx) < 10) return dy > 0 ? { srcPort: "N", tgtPort: "S" } : { srcPort: "S", tgtPort: "N" };
60418
- return { srcPort: dx > 0 ? "E" : "W", tgtPort: dy > 0 ? "S" : "N" };
60431
+ if (dy > 0 && dx > 0) return { srcPort: "E", tgtPort: "S" };
60432
+ if (dy < 0 && dx > 0) return { srcPort: "S", tgtPort: "W" };
60433
+ if (dy > 0 && dx < 0) return { srcPort: "N", tgtPort: "E" };
60434
+ return { srcPort: "W", tgtPort: "N" };
60419
60435
  }
60420
60436
  _cleanText(text) {
60421
60437
  if (!text) return "";
60422
60438
  return text.replace(/\n/g, "\\n").replace(/'/g, "\\'");
60423
60439
  }
60424
60440
  }
60425
- const version = "1.44.2";
60441
+ const version = "1.45.1";
60426
60442
  var Easing = Object.freeze({
60427
60443
  Linear: Object.freeze({
60428
60444
  None: function(amount) {
@@ -66877,8 +66893,19 @@ class Element extends Mesh {
66877
66893
  finalSrc = dy > 0 ? "N" : "S";
66878
66894
  finalTgt = dy > 0 ? "S" : "N";
66879
66895
  } else {
66880
- finalSrc = dx > 0 ? "E" : "W";
66881
- finalTgt = dy > 0 ? "S" : "N";
66896
+ if (dy > 0 && dx > 0) {
66897
+ finalSrc = "E";
66898
+ finalTgt = "S";
66899
+ } else if (dy < 0 && dx > 0) {
66900
+ finalSrc = "S";
66901
+ finalTgt = "W";
66902
+ } else if (dy > 0 && dx < 0) {
66903
+ finalSrc = "N";
66904
+ finalTgt = "E";
66905
+ } else {
66906
+ finalSrc = "W";
66907
+ finalTgt = "N";
66908
+ }
66882
66909
  }
66883
66910
  return { sourcePort: finalSrc, targetPort: finalTgt };
66884
66911
  }