dsh-talk-map 0.1.10 → 0.1.11

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 +62 -9
  2. package/package.json +1 -1
package/client/client.js CHANGED
@@ -11740,7 +11740,7 @@ function ContextMenu(props) {
11740
11740
 
11741
11741
  // src/client/edge-route.ts
11742
11742
  var __routeDebug = {};
11743
- var DEFAULTS = { margin: 14, stub: 22, minCorridor: 28 };
11743
+ var DEFAULTS = { margin: 8, stub: 22, minCorridor: 18 };
11744
11744
  function anchorOf(rect, face) {
11745
11745
  switch (face) {
11746
11746
  case "r":
@@ -11963,8 +11963,36 @@ function routeBetween(ends, from, to, obstacles, options = {}) {
11963
11963
  const end = ends.end;
11964
11964
  const startNormal = normalOf(ends.startFace);
11965
11965
  const endNormal = normalOf(ends.endFace);
11966
- const startStub = { x: start2.x + startNormal.x * stub, y: start2.y + startNormal.y * stub };
11967
- const endStub = { x: end.x + endNormal.x * stub, y: end.y + endNormal.y * stub };
11966
+ const spaceAhead = (point, normal) => {
11967
+ let best2 = 240;
11968
+ for (const raw of obstacles) {
11969
+ const rect = expand(raw, margin);
11970
+ if (normal.x !== 0) {
11971
+ if (point.y <= rect.y || point.y >= rect.y + rect.h) continue;
11972
+ if (normal.x > 0 && rect.x >= point.x) best2 = Math.min(best2, rect.x - point.x);
11973
+ if (normal.x < 0 && rect.x + rect.w <= point.x) best2 = Math.min(best2, point.x - (rect.x + rect.w));
11974
+ } else {
11975
+ if (point.x <= rect.x || point.x >= rect.x + rect.w) continue;
11976
+ if (normal.y > 0 && rect.y >= point.y) best2 = Math.min(best2, rect.y - point.y);
11977
+ if (normal.y < 0 && rect.y + rect.h <= point.y) best2 = Math.min(best2, point.y - (rect.y + rect.h));
11978
+ }
11979
+ }
11980
+ return best2;
11981
+ };
11982
+ const stubFor = (space) => {
11983
+ const half = Math.max(0, (space - margin * 2) / 2);
11984
+ return Math.max(4, Math.min(stub, half));
11985
+ };
11986
+ const startStubLength = stubFor(spaceAhead(start2, startNormal));
11987
+ const endStubLength = stubFor(spaceAhead(end, { x: -endNormal.x, y: -endNormal.y }));
11988
+ const startStub = {
11989
+ x: start2.x + startNormal.x * startStubLength,
11990
+ y: start2.y + startNormal.y * startStubLength
11991
+ };
11992
+ const endStub = {
11993
+ x: end.x + endNormal.x * endStubLength,
11994
+ y: end.y + endNormal.y * endStubLength
11995
+ };
11968
11996
  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;
11969
11997
  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;
11970
11998
  const blocked = obstacles.filter((rect) => !sameRect(rect, from) && !sameRect(rect, to)).filter((rect) => !overlaps(rect, from) && !overlaps(rect, to)).map((rect) => expand(rect, margin));
@@ -11984,7 +12012,7 @@ function routeBetween(ends, from, to, obstacles, options = {}) {
11984
12012
  const ys = corridors(near, "y", minCorridor).filter(withinY);
11985
12013
  const xOuter = outerLines(near, "x", margin + 6).filter(withinX);
11986
12014
  const yOuter = outerLines(near, "y", margin + 6).filter(withinY);
11987
- const hug = margin + 10;
12015
+ const hug = margin + 6;
11988
12016
  const xHug = near.flatMap((rect) => [rect.x - hug, rect.x + rect.w + hug]);
11989
12017
  const yHug = near.flatMap((rect) => [rect.y - hug, rect.y + rect.h + hug]);
11990
12018
  const xCands = dedupe([start2.x, end.x, startStub.x, endStub.x, ...xs, ...xOuter, ...xHug]);
@@ -12133,12 +12161,27 @@ function TalkMapEdge(props) {
12133
12161
  end: { x: props.targetX, y: props.targetY },
12134
12162
  endFace: faceOf(props.targetPosition)
12135
12163
  },
12136
- // Endpoint bodies for the corridor maths; the router skips them by value.
12137
- { x: props.sourceX, y: props.sourceY, w: 0, h: 0 },
12138
- { x: props.targetX, y: props.targetY, w: 0, h: 0 },
12164
+ // The endpoints' real boxes: the router excludes them from the obstacle
12165
+ // set by geometry. A degenerate 0×0 box never matches, so the endpoints
12166
+ // used to block their own handles and every line fell back to a straight L.
12167
+ data.fromRect ?? { x: props.sourceX, y: props.sourceY, w: 0, h: 0 },
12168
+ data.toRect ?? { x: props.targetX, y: props.targetY, w: 0, h: 0 },
12139
12169
  obstacles
12140
12170
  );
12141
12171
  const routed = route !== void 0 && route.length > 1;
12172
+ if (typeof window !== "undefined") {
12173
+ const w = window;
12174
+ w.__edgeDebug = w.__edgeDebug ?? [];
12175
+ w.__edgeDebug.push({
12176
+ id: props.id,
12177
+ obstacles: obstacles?.length ?? null,
12178
+ fromRect: data.fromRect ?? null,
12179
+ toRect: data.toRect ?? null,
12180
+ src: { x: props.sourceX, y: props.sourceY, pos: String(props.sourcePosition) },
12181
+ dst: { x: props.targetX, y: props.targetY, pos: String(props.targetPosition) },
12182
+ points: route ?? null
12183
+ });
12184
+ }
12142
12185
  const [smoothPath] = getSmoothStepPath({
12143
12186
  sourceX: props.sourceX,
12144
12187
  sourceY: props.sourceY,
@@ -13954,6 +13997,12 @@ function CanvasInner(props) {
13954
13997
  return sessions.byId[card.sessionId]?.updatedAt;
13955
13998
  };
13956
13999
  const obstaclesFor = (fromCardId, toCardId) => Object.entries(canvasState.cards).filter(([id2]) => id2 !== fromCardId && id2 !== toCardId).filter(([id2]) => !foldedSet.has(id2)).map(([, card]) => ({ x: card.x, y: card.y, w: CARD_W, h: CARD_H }));
14000
+ const boxOf = (cardId) => {
14001
+ const card = canvasState.cards[cardId];
14002
+ if (card === void 0) return void 0;
14003
+ const slot = cardLayout[cardId];
14004
+ return { x: slot?.x ?? card.x, y: slot?.y ?? card.y, w: CARD_W, h: CARD_H };
14005
+ };
13957
14006
  const routingObstacles = () => Object.entries(canvasState.cards).map(([id2, card]) => ({
13958
14007
  id: id2,
13959
14008
  x: card.x,
@@ -14007,7 +14056,9 @@ function CanvasInner(props) {
14007
14056
  fromCardId: edge.fromCardId,
14008
14057
  toCardId: edge.toCardId,
14009
14058
  sync,
14010
- obstacles: obstaclesFor(edge.fromCardId, edge.toCardId)
14059
+ obstacles: obstaclesFor(edge.fromCardId, edge.toCardId),
14060
+ ...boxOf(edge.fromCardId) !== void 0 ? { fromRect: boxOf(edge.fromCardId) } : {},
14061
+ ...boxOf(edge.toCardId) !== void 0 ? { toRect: boxOf(edge.toCardId) } : {}
14011
14062
  },
14012
14063
  // Every line carries its direction now: 「推送摘要」 always travels
14013
14064
  // source → target, so a link edge gets a lighter arrow instead of none.
@@ -14062,7 +14113,9 @@ function CanvasInner(props) {
14062
14113
  toCardId: cardId,
14063
14114
  sync: lineageSync,
14064
14115
  structural: true,
14065
- obstacles: obstaclesFor(parentCardId, cardId)
14116
+ obstacles: obstaclesFor(parentCardId, cardId),
14117
+ ...boxOf(parentCardId) !== void 0 ? { fromRect: boxOf(parentCardId) } : {},
14118
+ ...boxOf(cardId) !== void 0 ? { toRect: boxOf(cardId) } : {}
14066
14119
  },
14067
14120
  // No inline stroke: inline style beats everything the renderer draws.
14068
14121
  style: { opacity: 0.85 }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-talk-map",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
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",