dsh-talk-map 0.1.49 → 0.1.50

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 +38 -16
  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": "b49 · 搜地图上的卡片(标题/正文)",
451
+ "global.searchPlaceholder": "b50 · 搜地图上的卡片(标题/正文)",
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": "b49 · Search cards on the map",
602
+ "global.searchPlaceholder": "b50 · Search cards on the map",
603
603
  "global.searchRun": "Search",
604
604
  "global.searchTitle": "Search the map",
605
605
  "font.group": "Text size",
@@ -13143,6 +13143,7 @@ function StackDrawer(props) {
13143
13143
  };
13144
13144
  let bestD;
13145
13145
  let bestCost = Number.POSITIVE_INFINITY;
13146
+ let arrival = { x: endPoint.x - startPoint.x, y: endPoint.y - startPoint.y };
13146
13147
  const tryCurve = (control1, control2) => {
13147
13148
  const u1 = (t2) => (1 - t2) * (1 - t2) * (1 - t2);
13148
13149
  const u2 = (t2) => 3 * (1 - t2) * (1 - t2) * t2;
@@ -13156,6 +13157,7 @@ function StackDrawer(props) {
13156
13157
  if (cost < bestCost) {
13157
13158
  bestCost = cost;
13158
13159
  bestD = "M " + startPoint.x + " " + startPoint.y + " C " + control1.x + " " + control1.y + ", " + control2.x + " " + control2.y + ", " + endPoint.x + " " + endPoint.y;
13160
+ arrival = { x: endPoint.x - control2.x, y: endPoint.y - control2.y };
13159
13161
  }
13160
13162
  };
13161
13163
  for (const bow of [0.15, 0.3, 0.5, 0.75, 1.1]) {
@@ -13185,16 +13187,18 @@ function StackDrawer(props) {
13185
13187
  }
13186
13188
  }
13187
13189
  if (bestCost > 0) {
13188
- const bands2 = (values, size) => {
13189
- const unique = [...new Set(values.map((value) => Math.round(value)))].sort((a, b) => a - b);
13190
+ const bands2 = (edges) => {
13191
+ const sorted = [...edges].sort((a, b) => a.start - b.start);
13190
13192
  const lanes = [];
13191
- for (let index2 = 1; index2 < unique.length; index2 += 1) {
13192
- lanes.push((unique[index2 - 1] + size + unique[index2]) / 2);
13193
+ let reach = Number.NEGATIVE_INFINITY;
13194
+ for (const edge of sorted) {
13195
+ if (edge.start > reach && Number.isFinite(reach)) lanes.push((reach + edge.start) / 2);
13196
+ reach = Math.max(reach, edge.end);
13197
+ }
13198
+ if (sorted.length > 0) {
13199
+ lanes.unshift(Math.max(8, sorted[0].start - 14));
13200
+ lanes.push(reach + 14);
13193
13201
  }
13194
- const first = unique[0];
13195
- const last = unique[unique.length - 1];
13196
- if (first !== void 0) lanes.unshift(Math.max(8, first - 14));
13197
- if (last !== void 0) lanes.push(last + size + 14);
13198
13202
  return lanes;
13199
13203
  };
13200
13204
  const samplePolyline = (points) => (t2) => {
@@ -13218,30 +13222,48 @@ function StackDrawer(props) {
13218
13222
  };
13219
13223
  const midY = (startPoint.y + endPoint.y) / 2;
13220
13224
  const midX = (startPoint.x + endPoint.x) / 2;
13221
- const lanesY = bands2(cardsInDrawer.map((card) => card.y), 104).sort((a, b) => Math.abs(a - midY) - Math.abs(b - midY));
13222
- const lanesX = bands2(cardsInDrawer.map((card) => card.x), 224).sort((a, b) => Math.abs(a - midX) - Math.abs(b - midX));
13225
+ const lanesY = bands2(cardsInDrawer.map((card) => ({ start: card.y, end: card.y + card.h }))).sort((a, b) => Math.abs(a - midY) - Math.abs(b - midY));
13226
+ const lanesX = bands2(cardsInDrawer.map((card) => ({ start: card.x, end: card.x + card.w }))).sort((a, b) => Math.abs(a - midX) - Math.abs(b - midX));
13227
+ const startStub = { x: startPoint.x + startNormal.x * 12, y: startPoint.y + startNormal.y * 12 };
13228
+ const endStub = { x: endPoint.x + endNormal.x * 12, y: endPoint.y + endNormal.y * 12 };
13223
13229
  const shapes = [];
13224
13230
  for (const lane of lanesY) {
13225
- shapes.push([startPoint, { x: startPoint.x, y: lane }, { x: endPoint.x, y: lane }, endPoint]);
13231
+ shapes.push([
13232
+ startPoint,
13233
+ startStub,
13234
+ { x: startStub.x, y: lane },
13235
+ { x: endStub.x, y: lane },
13236
+ endStub,
13237
+ endPoint
13238
+ ]);
13226
13239
  }
13227
13240
  for (const lane of lanesX) {
13228
- shapes.push([startPoint, { x: lane, y: startPoint.y }, { x: lane, y: endPoint.y }, endPoint]);
13241
+ shapes.push([
13242
+ startPoint,
13243
+ startStub,
13244
+ { x: lane, y: startStub.y },
13245
+ { x: lane, y: endStub.y },
13246
+ endStub,
13247
+ endPoint
13248
+ ]);
13229
13249
  }
13230
13250
  for (const shape of shapes) {
13231
13251
  const cost = badness(samplePolyline(shape));
13232
13252
  if (cost < bestCost) {
13233
13253
  bestCost = cost;
13234
13254
  bestD = roundedPath(shape, 10);
13255
+ arrival = { x: endPoint.x - endStub.x, y: endPoint.y - endStub.y };
13235
13256
  if (cost === 0) break;
13236
13257
  }
13237
13258
  }
13238
13259
  }
13239
- const angle = toSide === "l" ? 180 : toSide === "r" ? 0 : toSide === "t" ? -90 : 90;
13260
+ const angle = Math.abs(arrival.x) < 0.5 && Math.abs(arrival.y) < 0.5 ? toSide === "l" ? 180 : toSide === "r" ? 0 : toSide === "t" ? -90 : 90 : Math.abs(arrival.x) >= Math.abs(arrival.y) ? arrival.x >= 0 ? 0 : 180 : arrival.y >= 0 ? 90 : -90;
13261
+ const arrowAngle = angle;
13240
13262
  next.push({
13241
13263
  d: bestD ?? "M " + startPoint.x + " " + startPoint.y + " L " + endPoint.x + " " + endPoint.y,
13242
13264
  ax: endPoint.x,
13243
13265
  ay: endPoint.y,
13244
- angle,
13266
+ angle: arrowAngle,
13245
13267
  from: link2.from,
13246
13268
  to: link2.to
13247
13269
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-talk-map",
3
- "version": "0.1.49",
3
+ "version": "0.1.50",
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",