@jabworks/condux 0.25.0 → 0.25.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jabworks/condux",
3
- "version": "0.25.0",
3
+ "version": "0.25.1",
4
4
  "description": "OpenCode plugin for the condux workflow toolkit — bundles the condux skills and injects the specialist agents (coder, explorer, planner, researcher) plus an opt-in plan-review listener.",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -106,11 +106,18 @@ const distPointToSegment = (px, py, x1, y1, x2, y2) => {
106
106
  return Math.hypot(px - nx, py - ny);
107
107
  };
108
108
 
109
+ // Distance from a point to a box: zero inside it, else to its nearest edge.
110
+ const distPointToBox = (px, py, box) =>
111
+ Math.hypot(Math.max(box.x0 - px, 0, px - box.x1), Math.max(box.y0 - py, 0, py - box.y1));
112
+
109
113
  // Distance from a box to a segment: zero when the segment enters the box,
110
- // else the nearest of the box's corners. Label attribution measures this, not
111
- // the box centre — a long start-anchored label beside a vertical edge has its
112
- // centre far from the line and its near edge right on it, and real diagrams
113
- // (the 2026-09-08 reporting one, six of seven labels) are drawn that way.
114
+ // else the nearer of two measures — a box corner to the segment, or a segment
115
+ // endpoint to the box. Label attribution measures this, not the box centre —
116
+ // a long start-anchored label beside a vertical edge has its centre far from
117
+ // the line and its near edge right on it, and real diagrams (the 2026-09-08
118
+ // reporting one, six of seven labels) are drawn that way. Corners alone miss
119
+ // the other shape: an arrow whose tip faces the middle of a wide label's side
120
+ // is far from every corner (section-loop.html's step 1: 63.1 against 7.25).
114
121
  const distBoxToSegment = (box, x1, y1, x2, y2) => {
115
122
  if (liangBarsky(x1, y1, x2, y2, box)) return 0;
116
123
 
@@ -121,7 +128,11 @@ const distBoxToSegment = (box, x1, y1, x2, y2) => {
121
128
  [box.x1, box.y1],
122
129
  ];
123
130
 
124
- return Math.min(...corners.map(([px, py]) => distPointToSegment(px, py, x1, y1, x2, y2)));
131
+ return Math.min(
132
+ ...corners.map(([px, py]) => distPointToSegment(px, py, x1, y1, x2, y2)),
133
+ distPointToBox(x1, y1, box),
134
+ distPointToBox(x2, y2, box),
135
+ );
125
136
  };
126
137
 
127
138
  const fmt = (n) => Math.round(n * 10) / 10;