dsh-talk-map 0.1.38 → 0.1.41

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 (2) hide show
  1. package/client/client.js +45 -1
  2. package/package.json +1 -1
package/client/client.js CHANGED
@@ -13103,13 +13103,53 @@ function StackDrawer(props) {
13103
13103
  cardsInDrawer.map((card) => ({ id: card.id, x: card.x, y: card.y })),
13104
13104
  { cardWidth: fromRect.w, cardHeight: fromRect.h }
13105
13105
  );
13106
- const points = routeEdge(
13106
+ const contentWidth = scroller.scrollWidth;
13107
+ const contentHeight = scroller.scrollHeight;
13108
+ const boundsWidth = scroller.scrollWidth;
13109
+ const boundsHeight = scroller.scrollHeight;
13110
+ const dirty = (candidate) => {
13111
+ let hits2 = 0;
13112
+ for (let index2 = 1; index2 < candidate.length; index2 += 1) {
13113
+ const a = candidate[index2 - 1];
13114
+ const b = candidate[index2];
13115
+ const steps = Math.max(2, Math.ceil((Math.abs(b.x - a.x) + Math.abs(b.y - a.y)) / 2));
13116
+ for (let step2 = 0; step2 <= steps; step2 += 1) {
13117
+ const ratio = step2 / steps;
13118
+ const point = { x: a.x + (b.x - a.x) * ratio, y: a.y + (b.y - a.y) * ratio };
13119
+ for (const box of obstacles) {
13120
+ if (point.x > box.x + 1 && point.x < box.x + box.w - 1 && point.y > box.y + 1 && point.y < box.y + box.h - 1) hits2 += 1;
13121
+ }
13122
+ if (point.x < 2 || point.y < 2 || point.x > boundsWidth - 2 || point.y > boundsHeight - 2) hits2 += 1;
13123
+ }
13124
+ }
13125
+ return hits2;
13126
+ };
13127
+ const FACES = ["t", "r", "b", "l"];
13128
+ let points = routeEdge(
13107
13129
  fromRect,
13108
13130
  toRect,
13109
13131
  faces.fromHandle,
13110
13132
  faces.toHandle,
13111
13133
  [fromRect, toRect, ...obstacles]
13112
13134
  );
13135
+ let bestDirty = dirty(points);
13136
+ if (bestDirty > 0) {
13137
+ let bestPoints = points;
13138
+ for (const fromFace of FACES) {
13139
+ for (const toFace of FACES) {
13140
+ if (fromFace === faces.fromHandle && toFace === faces.toHandle) continue;
13141
+ const attempt = routeEdge(fromRect, toRect, fromFace, toFace, [fromRect, toRect, ...obstacles]);
13142
+ const attemptDirty = dirty(attempt);
13143
+ if (attemptDirty < bestDirty) {
13144
+ bestDirty = attemptDirty;
13145
+ bestPoints = attempt;
13146
+ if (bestDirty === 0) break;
13147
+ }
13148
+ }
13149
+ if (bestDirty === 0) break;
13150
+ }
13151
+ points = bestPoints;
13152
+ }
13113
13153
  const tip = points[points.length - 1];
13114
13154
  const prev = points[points.length - 2];
13115
13155
  const angle = Math.abs(tip.x - prev.x) >= Math.abs(tip.y - prev.y) ? tip.x >= prev.x ? 0 : 180 : tip.y >= prev.y ? 90 : -90;
@@ -13130,8 +13170,12 @@ function StackDrawer(props) {
13130
13170
  measure();
13131
13171
  });
13132
13172
  observer.observe(scroller);
13173
+ const settle = [60, 160, 320, 600].map((delay) => window.setTimeout(() => {
13174
+ measure();
13175
+ }, delay));
13133
13176
  return () => {
13134
13177
  observer.disconnect();
13178
+ for (const timer4 of settle) window.clearTimeout(timer4);
13135
13179
  };
13136
13180
  }, [props.links, props.items, query, visibleItems.length]);
13137
13181
  (0, import_react10.useEffect)(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-talk-map",
3
- "version": "0.1.38",
3
+ "version": "0.1.41",
4
4
  "description": "Visual conversation map for DeepSeek Harness: an infinite whiteboard where every session is a card — drag to arrange, double-click to start a chat in place, draw an edge to fork a new session with injected context. Built for ADHD-friendly spatial memory. · DSH 可视化对话地图:会话即卡片,双击即聊,连线分叉带上下文的新对话。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",