dsh-talk-map 0.1.20 → 0.1.21

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 +20 -24
  2. package/package.json +1 -1
package/client/client.js CHANGED
@@ -448,7 +448,7 @@ var zh = {
448
448
  "digest.empty": "这条对话还没有摘要,先刷新摘要再来看。",
449
449
  "digest.copy": "复制",
450
450
  "digest.close": "关闭",
451
- "global.searchPlaceholder": "搜地图上的卡片(标题/正文)· v0.1.20",
451
+ "global.searchPlaceholder": "搜地图上的卡片(标题/正文)· v0.1.21",
452
452
  "global.searchRun": "搜索",
453
453
  "global.searchTitle": "搜索地图",
454
454
  "font.group": "文字大小",
@@ -599,7 +599,7 @@ var en = {
599
599
  "menu.noGroup": "Remove from group (free card)",
600
600
  "menu.open": "Open conversation",
601
601
  "menu.markUnread": "Mark as unread",
602
- "global.searchPlaceholder": "Search cards on the map · v0.1.20",
602
+ "global.searchPlaceholder": "Search cards on the map · v0.1.21",
603
603
  "global.searchRun": "Search",
604
604
  "global.searchTitle": "Search the map",
605
605
  "font.group": "Text size",
@@ -11998,7 +11998,7 @@ function routeBetween(ends, from, to, obstacles, options = {}) {
11998
11998
  };
11999
11999
  const sameRect = (a, b) => Math.abs(a.x - b.x) < 0.5 && Math.abs(a.y - b.y) < 0.5 && Math.abs(a.w - b.w) < 0.5 && Math.abs(a.h - b.h) < 0.5;
12000
12000
  const overlaps = (a, b) => a.x < b.x + b.w && b.x < a.x + a.w && a.y < b.y + b.h && b.y < a.y + a.h;
12001
- const blocked = obstacles.filter((rect) => !sameRect(rect, from) && !sameRect(rect, to)).filter((rect) => !overlaps(rect, from) && !overlaps(rect, to)).map((rect) => expand(rect, margin));
12001
+ const blocked = obstacles.filter((rect) => !sameRect(rect, from) && !sameRect(rect, to)).map((rect) => expand(rect, margin));
12002
12002
  const fallback = simplify([start2, startStub, { x: endStub.x, y: startStub.y }, endStub, end]);
12003
12003
  __routeDebug.last = { usedFallback: true };
12004
12004
  const pad = 260;
@@ -12150,28 +12150,23 @@ var boardCache = { at: 0, boxes: [] };
12150
12150
  function boardBoxes() {
12151
12151
  if (typeof document === "undefined") return [];
12152
12152
  const now2 = Date.now();
12153
- if (now2 - boardCache.at < 80) return boardCache.boxes;
12153
+ if (now2 - boardCache.at < 60) return boardCache.boxes;
12154
12154
  const viewport = document.querySelector(".react-flow__viewport");
12155
- const viewportRect = viewport?.getBoundingClientRect();
12156
- let scale = 1;
12157
- if (viewport !== null) {
12158
- const matrix = getComputedStyle(viewport).transform;
12159
- const parsed = /matrix\(([^)]+)\)/.exec(matrix);
12160
- if (parsed !== null) {
12161
- const values = parsed[1].split(",").map(Number);
12162
- scale = values[0] === void 0 || values[0] === 0 ? 1 : values[0];
12163
- }
12164
- }
12155
+ if (viewport === null) return boardCache.boxes;
12165
12156
  const boxes = [];
12166
12157
  for (const element of document.querySelectorAll("[data-talkmap-session]")) {
12167
- const rect = element.getBoundingClientRect();
12168
- if (rect.width < 8 || rect.height < 8) continue;
12169
- boxes.push({
12170
- x: (rect.left - (viewportRect?.left ?? 0)) / scale,
12171
- y: (rect.top - (viewportRect?.top ?? 0)) / scale,
12172
- w: rect.width / scale,
12173
- h: rect.height / scale
12174
- });
12158
+ const node = element;
12159
+ let x = 0;
12160
+ let y = 0;
12161
+ let cursor = node;
12162
+ while (cursor !== null && cursor !== viewport) {
12163
+ x += cursor.offsetLeft;
12164
+ y += cursor.offsetTop;
12165
+ cursor = cursor.offsetParent;
12166
+ }
12167
+ if (cursor === null) continue;
12168
+ if (node.offsetWidth < 8 || node.offsetHeight < 8) continue;
12169
+ boxes.push({ x, y, w: node.offsetWidth, h: node.offsetHeight });
12175
12170
  }
12176
12171
  if (boxes.length > 0) {
12177
12172
  boardCache.at = now2;
@@ -12195,8 +12190,9 @@ function TalkMapEdge(props) {
12195
12190
  return "l";
12196
12191
  };
12197
12192
  const obstacles = data.obstacles;
12198
- const sameCorner = (box, other) => other !== void 0 && Math.abs(box.x - other.x) < 3 && Math.abs(box.y - other.y) < 3;
12199
- const merged = obstacles ?? [].filter((box) => !sameCorner(box, data.fromRect)).filter((box) => !sameCorner(box, data.toRect)).filter((box) => !containsPoint(box, props.sourceX, props.sourceY)).filter((box) => !containsPoint(box, props.targetX, props.targetY));
12193
+ const measuredBoxes = boardBoxes();
12194
+ const sameCorner = (box, other) => other !== void 0 && Math.abs(box.x - other.x) < 6 && Math.abs(box.y - other.y) < 6;
12195
+ const merged = (measuredBoxes.length > 0 ? measuredBoxes : obstacles ?? []).filter((box) => !sameCorner(box, data.fromRect)).filter((box) => !sameCorner(box, data.toRect)).filter((box) => !sameCorner(box, data.fromRect)).filter((box) => !sameCorner(box, data.toRect)).filter((box) => !containsPoint(box, props.sourceX, props.sourceY)).filter((box) => !containsPoint(box, props.targetX, props.targetY));
12200
12196
  const route = merged.length === 0 ? void 0 : routeBetween(
12201
12197
  {
12202
12198
  start: { x: props.sourceX, y: props.sourceY },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-talk-map",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
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",