dsh-talk-map 0.1.37 → 0.1.39

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 +41 -2
  2. package/package.json +1 -1
package/client/client.js CHANGED
@@ -12208,7 +12208,7 @@ function routeBetween(ends, from, to, obstacles, options = {}) {
12208
12208
  }
12209
12209
  return count;
12210
12210
  };
12211
- if (hits(raw, [from, to]) === 0) return raw;
12211
+ if (hits(raw, [from, to, ...obstacles]) === 0) return raw;
12212
12212
  const spread = margin + 24;
12213
12213
  const boxTop = Math.min(from.y, to.y) - spread;
12214
12214
  const boxBottom = Math.max(from.y + from.h, to.y + to.h) + spread;
@@ -13103,13 +13103,48 @@ 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 dirty = (candidate) => {
13107
+ let hits2 = 0;
13108
+ for (let index2 = 1; index2 < candidate.length; index2 += 1) {
13109
+ const a = candidate[index2 - 1];
13110
+ const b = candidate[index2];
13111
+ const steps = Math.max(2, Math.ceil((Math.abs(b.x - a.x) + Math.abs(b.y - a.y)) / 2));
13112
+ for (let step2 = 0; step2 <= steps; step2 += 1) {
13113
+ const ratio = step2 / steps;
13114
+ const point = { x: a.x + (b.x - a.x) * ratio, y: a.y + (b.y - a.y) * ratio };
13115
+ for (const box of obstacles) {
13116
+ 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;
13117
+ }
13118
+ }
13119
+ }
13120
+ return hits2;
13121
+ };
13122
+ const FACES = ["t", "r", "b", "l"];
13123
+ let points = routeEdge(
13107
13124
  fromRect,
13108
13125
  toRect,
13109
13126
  faces.fromHandle,
13110
13127
  faces.toHandle,
13111
13128
  [fromRect, toRect, ...obstacles]
13112
13129
  );
13130
+ let bestDirty = dirty(points);
13131
+ if (bestDirty > 0) {
13132
+ let bestPoints = points;
13133
+ for (const fromFace of FACES) {
13134
+ for (const toFace of FACES) {
13135
+ if (fromFace === faces.fromHandle && toFace === faces.toHandle) continue;
13136
+ const attempt = routeEdge(fromRect, toRect, fromFace, toFace, [fromRect, toRect, ...obstacles]);
13137
+ const attemptDirty = dirty(attempt);
13138
+ if (attemptDirty < bestDirty) {
13139
+ bestDirty = attemptDirty;
13140
+ bestPoints = attempt;
13141
+ if (bestDirty === 0) break;
13142
+ }
13143
+ }
13144
+ if (bestDirty === 0) break;
13145
+ }
13146
+ points = bestPoints;
13147
+ }
13113
13148
  const tip = points[points.length - 1];
13114
13149
  const prev = points[points.length - 2];
13115
13150
  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 +13165,12 @@ function StackDrawer(props) {
13130
13165
  measure();
13131
13166
  });
13132
13167
  observer.observe(scroller);
13168
+ const settle = [60, 160, 320, 600].map((delay) => window.setTimeout(() => {
13169
+ measure();
13170
+ }, delay));
13133
13171
  return () => {
13134
13172
  observer.disconnect();
13173
+ for (const timer4 of settle) window.clearTimeout(timer4);
13135
13174
  };
13136
13175
  }, [props.links, props.items, query, visibleItems.length]);
13137
13176
  (0, import_react10.useEffect)(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-talk-map",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
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",