dsh-talk-map 0.1.23 → 0.1.25

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 +52 -6
  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.23",
451
+ "global.searchPlaceholder": "搜地图上的卡片(标题/正文)· v0.1.25",
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.23",
602
+ "global.searchPlaceholder": "Search cards on the map · v0.1.25",
603
603
  "global.searchRun": "Search",
604
604
  "global.searchTitle": "Search the map",
605
605
  "font.group": "Text size",
@@ -11985,8 +11985,9 @@ function routeBetween(ends, from, to, obstacles, options = {}) {
11985
11985
  const half = Math.max(0, (space - margin * 2) / 2);
11986
11986
  return Math.max(4, Math.min(stub, half));
11987
11987
  };
11988
- const startStubLength = stubFor(spaceAhead(start2, startNormal));
11989
- const endStubLength = stubFor(spaceAhead(end, endNormal));
11988
+ const minStub = margin + 3;
11989
+ const startStubLength = Math.max(stubFor(spaceAhead(start2, startNormal)), minStub);
11990
+ const endStubLength = Math.max(stubFor(spaceAhead(end, endNormal)), minStub);
11990
11991
  const startStub = {
11991
11992
  x: start2.x + startNormal.x * startStubLength,
11992
11993
  y: start2.y + startNormal.y * startStubLength
@@ -11997,7 +11998,7 @@ function routeBetween(ends, from, to, obstacles, options = {}) {
11997
11998
  };
11998
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;
11999
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;
12000
- const blocked = obstacles.filter((rect) => !sameRect(rect, from) && !sameRect(rect, to)).map((rect) => expand(rect, margin));
12001
+ const blocked = [...obstacles, ...sameRect(from, to) ? [] : [from, to]].map((rect) => expand(rect, margin));
12001
12002
  __routeDebug.blockedCount = blocked.length;
12002
12003
  __routeDebug.blockedFirst = blocked.slice(0, 2);
12003
12004
  const makeFallback = () => {
@@ -12187,6 +12188,50 @@ function roundedPath(points, radius = 10) {
12187
12188
  function round(value) {
12188
12189
  return Math.round(value * 100) / 100;
12189
12190
  }
12191
+ function clipToRects(points, rects) {
12192
+ if (points.length < 2) return [points];
12193
+ const insideAny = (point) => rects.some((rect) => point.x > rect.x + 1.5 && point.x < rect.x + rect.w - 1.5 && point.y > rect.y + 1.5 && point.y < rect.y + rect.h - 1.5);
12194
+ const subpaths = [];
12195
+ let current = [];
12196
+ const flush = () => {
12197
+ if (current.length >= 2) subpaths.push(current);
12198
+ current = [];
12199
+ };
12200
+ for (let index2 = 1; index2 < points.length; index2 += 1) {
12201
+ const a = points[index2 - 1];
12202
+ const b = points[index2];
12203
+ const steps = Math.max(2, Math.ceil((Math.abs(b.x - a.x) + Math.abs(b.y - a.y)) / 2));
12204
+ for (let step2 = 0; step2 <= steps; step2 += 1) {
12205
+ const t2 = step2 / steps;
12206
+ const point = { x: a.x + (b.x - a.x) * t2, y: a.y + (b.y - a.y) * t2 };
12207
+ if (insideAny(point)) {
12208
+ flush();
12209
+ } else {
12210
+ const last = current[current.length - 1];
12211
+ if (last === void 0 || Math.abs(last.x - point.x) > 0.4 || Math.abs(last.y - point.y) > 0.4) {
12212
+ current.push(point);
12213
+ }
12214
+ }
12215
+ }
12216
+ }
12217
+ flush();
12218
+ if (subpaths.length === 0) return [points];
12219
+ return subpaths.map((subpath) => {
12220
+ const rounded = subpath.map((point) => ({ x: Math.round(point.x * 2) / 2, y: Math.round(point.y * 2) / 2 }));
12221
+ const out = [];
12222
+ for (const point of rounded) {
12223
+ const last = out[out.length - 1];
12224
+ if (last !== void 0 && last.x === point.x && last.y === point.y) continue;
12225
+ const before = out[out.length - 2];
12226
+ if (before !== void 0 && last !== void 0 && (before.x === last.x && last.x === point.x || before.y === last.y && last.y === point.y)) {
12227
+ out[out.length - 1] = point;
12228
+ continue;
12229
+ }
12230
+ out.push(point);
12231
+ }
12232
+ return out;
12233
+ }).filter((subpath) => subpath.length >= 2);
12234
+ }
12190
12235
 
12191
12236
  // src/client/TalkMapEdge.tsx
12192
12237
  var import_jsx_runtime8 = require("react/jsx-runtime");
@@ -12302,7 +12347,8 @@ function TalkMapEdge(props) {
12302
12347
  const p2 = { x: props.targetX + b.x * length, y: props.targetY + b.y * length };
12303
12348
  return `M ${props.sourceX} ${props.sourceY} L ${p1.x} ${p1.y} M ${props.targetX} ${props.targetY} L ${p2.x} ${p2.y}`;
12304
12349
  })();
12305
- const path = safeRoute !== void 0 ? roundedPath(safeRoute, 10) : blockedRoute ? stubPath : smoothPath;
12350
+ const endpointBoxes = [data.fromRect, data.toRect].filter((box) => box !== void 0);
12351
+ const path = safeRoute !== void 0 ? endpointBoxes.length === 0 ? roundedPath(safeRoute, 10) : clipToRects(safeRoute, endpointBoxes).map((subpath) => roundedPath(subpath, 10)).join(" ") : blockedRoute ? stubPath : smoothPath;
12306
12352
  const arrowAngle = (() => {
12307
12353
  if (routed) {
12308
12354
  const end = route[route.length - 1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-talk-map",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
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",