dsh-talk-map 0.1.45 → 0.1.48
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.
- package/client/client.js +122 -22
- 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": "
|
|
451
|
+
"global.searchPlaceholder": "b48 · 搜地图上的卡片(标题/正文)",
|
|
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
|
|
602
|
+
"global.searchPlaceholder": "b48 · Search cards on the map",
|
|
603
603
|
"global.searchRun": "Search",
|
|
604
604
|
"global.searchTitle": "Search the map",
|
|
605
605
|
"font.group": "Text size",
|
|
@@ -10791,7 +10791,36 @@ function pickFaces(from, to, obstacles, options) {
|
|
|
10791
10791
|
const gapX = Math.abs(dx) - options.cardWidth;
|
|
10792
10792
|
const gapY = Math.abs(dy) - options.cardHeight;
|
|
10793
10793
|
const horizontalDominant = Math.abs(dx) >= Math.abs(dy);
|
|
10794
|
-
|
|
10794
|
+
const approachClear = (rect, side) => {
|
|
10795
|
+
const band = 30;
|
|
10796
|
+
return !obstacles.some((other) => {
|
|
10797
|
+
if (other.id === rect.id || other.id === from.id || other.id === to.id) return false;
|
|
10798
|
+
const ox = Math.abs(other.x - rect.x);
|
|
10799
|
+
const oy = Math.abs(other.y - rect.y);
|
|
10800
|
+
if (side === "r") return other.x > rect.x && other.x - rect.x < options.cardWidth + band && oy < options.cardHeight * 0.9;
|
|
10801
|
+
if (side === "l") return other.x < rect.x && rect.x - other.x < options.cardWidth + band && oy < options.cardHeight * 0.9;
|
|
10802
|
+
if (side === "b") return other.y > rect.y && other.y - rect.y < options.cardHeight + band && ox < options.cardWidth * 0.9;
|
|
10803
|
+
return other.y < rect.y && rect.y - other.y < options.cardHeight + band && ox < options.cardWidth * 0.9;
|
|
10804
|
+
});
|
|
10805
|
+
};
|
|
10806
|
+
if (horizontalDominant) {
|
|
10807
|
+
const fromSide2 = dx >= 0 ? "r" : "l";
|
|
10808
|
+
const toSide2 = dx >= 0 ? "l" : "r";
|
|
10809
|
+
if (approachClear(from, fromSide2) && approachClear(to, toSide2)) {
|
|
10810
|
+
return { fromHandle: fromSide2, toHandle: toSide2 };
|
|
10811
|
+
}
|
|
10812
|
+
const freeFrom2 = approachClear(from, "b") ? "b" : "t";
|
|
10813
|
+
const freeTo2 = approachClear(to, "b") ? "b" : "t";
|
|
10814
|
+
return { fromHandle: freeFrom2, toHandle: freeTo2 };
|
|
10815
|
+
}
|
|
10816
|
+
const fromSide = dy >= 0 ? "b" : "t";
|
|
10817
|
+
const toSide = dy >= 0 ? "t" : "b";
|
|
10818
|
+
if (approachClear(from, fromSide) && approachClear(to, toSide)) {
|
|
10819
|
+
return { fromHandle: fromSide, toHandle: toSide };
|
|
10820
|
+
}
|
|
10821
|
+
const freeFrom = approachClear(from, "r") ? "r" : "l";
|
|
10822
|
+
const freeTo = approachClear(to, "r") ? "r" : "l";
|
|
10823
|
+
return { fromHandle: freeFrom, toHandle: freeTo };
|
|
10795
10824
|
}
|
|
10796
10825
|
|
|
10797
10826
|
// src/client/push-log.ts
|
|
@@ -13085,41 +13114,110 @@ function StackDrawer(props) {
|
|
|
13085
13114
|
for (const box of obstacles) {
|
|
13086
13115
|
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;
|
|
13087
13116
|
}
|
|
13117
|
+
for (const endpoint of [fromRect, toRect]) {
|
|
13118
|
+
if (point.x <= endpoint.x + 1 || point.x >= endpoint.x + endpoint.w - 1) continue;
|
|
13119
|
+
if (point.y <= endpoint.y + 1 || point.y >= endpoint.y + endpoint.h - 1) continue;
|
|
13120
|
+
const away = Math.min(
|
|
13121
|
+
Math.hypot(point.x - (endpoint.x + endpoint.w / 2), point.y - endpoint.y),
|
|
13122
|
+
Math.hypot(point.x - (endpoint.x + endpoint.w / 2), point.y - (endpoint.y + endpoint.h)),
|
|
13123
|
+
Math.hypot(point.x - endpoint.x, point.y - (endpoint.y + endpoint.h / 2)),
|
|
13124
|
+
Math.hypot(point.x - (endpoint.x + endpoint.w), point.y - (endpoint.y + endpoint.h / 2))
|
|
13125
|
+
);
|
|
13126
|
+
if (away > 14) hits2 += 1;
|
|
13127
|
+
}
|
|
13088
13128
|
if (point.x < 2 || point.y < 2 || point.x > boundsWidth - 2 || point.y > boundsHeight - 2) hits2 += 1;
|
|
13089
13129
|
}
|
|
13090
13130
|
}
|
|
13091
13131
|
return hits2;
|
|
13092
13132
|
};
|
|
13093
13133
|
const FACES = ["t", "r", "b", "l"];
|
|
13094
|
-
|
|
13134
|
+
const anchorOn = (rect, face) => face === "t" ? { x: rect.x + rect.w / 2, y: rect.y } : face === "b" ? { x: rect.x + rect.w / 2, y: rect.y + rect.h } : face === "l" ? { x: rect.x, y: rect.y + rect.h / 2 } : { x: rect.x + rect.w, y: rect.y + rect.h / 2 };
|
|
13135
|
+
const normalOf2 = (face) => face === "t" ? { x: 0, y: -1 } : face === "b" ? { x: 0, y: 1 } : face === "l" ? { x: -1, y: 0 } : { x: 1, y: 0 };
|
|
13136
|
+
const bandCentres = (values, size) => {
|
|
13137
|
+
const unique = [...new Set(values.map((value) => Math.round(value)))].sort((a, b) => a - b);
|
|
13138
|
+
const lanes = [];
|
|
13139
|
+
for (let index2 = 1; index2 < unique.length; index2 += 1) {
|
|
13140
|
+
const left = unique[index2 - 1];
|
|
13141
|
+
const right = unique[index2];
|
|
13142
|
+
if (right - left > size + 2) lanes.push((left + size + right) / 2);
|
|
13143
|
+
else lanes.push((left + size / 2 + right + size / 2) / 2);
|
|
13144
|
+
}
|
|
13145
|
+
const first = unique[0];
|
|
13146
|
+
const last = unique[unique.length - 1];
|
|
13147
|
+
if (first !== void 0) lanes.unshift(first - 14);
|
|
13148
|
+
if (last !== void 0) lanes.push(last + size + 14);
|
|
13149
|
+
return lanes;
|
|
13150
|
+
};
|
|
13151
|
+
const lanesY = bandCentres(cardsInDrawer.map((card) => card.y), 104);
|
|
13152
|
+
const lanesX = bandCentres(cardsInDrawer.map((card) => card.x), 224);
|
|
13153
|
+
const lengthOf = (candidate) => {
|
|
13154
|
+
let total = 0;
|
|
13155
|
+
for (let index2 = 1; index2 < candidate.length; index2 += 1) {
|
|
13156
|
+
total += Math.abs(candidate[index2].x - candidate[index2 - 1].x) + Math.abs(candidate[index2].y - candidate[index2 - 1].y);
|
|
13157
|
+
}
|
|
13158
|
+
return total;
|
|
13159
|
+
};
|
|
13160
|
+
const candidates = [];
|
|
13161
|
+
for (const fromFace of FACES) {
|
|
13162
|
+
for (const toFace of FACES) {
|
|
13163
|
+
candidates.push(routeEdge(fromRect, toRect, fromFace, toFace, [fromRect, toRect, ...obstacles], { stub: 10 }));
|
|
13164
|
+
const start2 = anchorOn(fromRect, fromFace);
|
|
13165
|
+
const end = anchorOn(toRect, toFace);
|
|
13166
|
+
const startNormal = normalOf2(fromFace);
|
|
13167
|
+
const endNormal = normalOf2(toFace);
|
|
13168
|
+
const startStub = { x: start2.x + startNormal.x * 10, y: start2.y + startNormal.y * 10 };
|
|
13169
|
+
const endStub = { x: end.x + endNormal.x * 10, y: end.y + endNormal.y * 10 };
|
|
13170
|
+
for (const lane of lanesY) {
|
|
13171
|
+
candidates.push([start2, startStub, { x: startStub.x, y: lane }, { x: endStub.x, y: lane }, endStub, end]);
|
|
13172
|
+
candidates.push([
|
|
13173
|
+
start2,
|
|
13174
|
+
startStub,
|
|
13175
|
+
{ x: startStub.x, y: lane },
|
|
13176
|
+
{ x: endStub.x, y: lane },
|
|
13177
|
+
{ x: endStub.x, y: endStub.y },
|
|
13178
|
+
endStub,
|
|
13179
|
+
end
|
|
13180
|
+
]);
|
|
13181
|
+
}
|
|
13182
|
+
for (const lane of lanesX) {
|
|
13183
|
+
candidates.push([start2, startStub, { x: lane, y: startStub.y }, { x: lane, y: endStub.y }, endStub, end]);
|
|
13184
|
+
candidates.push([
|
|
13185
|
+
start2,
|
|
13186
|
+
startStub,
|
|
13187
|
+
{ x: lane, y: startStub.y },
|
|
13188
|
+
{ x: lane, y: endStub.y },
|
|
13189
|
+
{ x: endStub.x, y: endStub.y },
|
|
13190
|
+
endStub,
|
|
13191
|
+
end
|
|
13192
|
+
]);
|
|
13193
|
+
}
|
|
13194
|
+
}
|
|
13195
|
+
}
|
|
13196
|
+
let bestPoints = candidates[0] ?? routeEdge(
|
|
13095
13197
|
fromRect,
|
|
13096
13198
|
toRect,
|
|
13097
13199
|
faces.fromHandle,
|
|
13098
13200
|
faces.toHandle,
|
|
13099
|
-
[fromRect, toRect, ...obstacles]
|
|
13201
|
+
[fromRect, toRect, ...obstacles],
|
|
13202
|
+
{ stub: 10 }
|
|
13100
13203
|
);
|
|
13101
|
-
let bestDirty = dirty(
|
|
13102
|
-
|
|
13103
|
-
|
|
13104
|
-
|
|
13105
|
-
|
|
13106
|
-
|
|
13107
|
-
|
|
13108
|
-
|
|
13109
|
-
|
|
13110
|
-
|
|
13111
|
-
bestPoints = attempt;
|
|
13112
|
-
if (bestDirty === 0) break;
|
|
13113
|
-
}
|
|
13114
|
-
}
|
|
13115
|
-
if (bestDirty === 0) break;
|
|
13204
|
+
let bestDirty = dirty(bestPoints);
|
|
13205
|
+
let bestLength = lengthOf(bestPoints);
|
|
13206
|
+
for (const candidate of candidates) {
|
|
13207
|
+
const cost = dirty(candidate);
|
|
13208
|
+
const length = lengthOf(candidate);
|
|
13209
|
+
if (cost < bestDirty || cost === bestDirty && length < bestLength) {
|
|
13210
|
+
bestDirty = cost;
|
|
13211
|
+
bestLength = length;
|
|
13212
|
+
bestPoints = candidate;
|
|
13213
|
+
if (cost === 0 && length <= 220) break;
|
|
13116
13214
|
}
|
|
13117
|
-
points = bestPoints;
|
|
13118
13215
|
}
|
|
13216
|
+
const points = bestPoints;
|
|
13119
13217
|
const tip = points[points.length - 1];
|
|
13120
13218
|
const prev = points[points.length - 2];
|
|
13121
13219
|
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;
|
|
13122
|
-
next.push({ d: roundedPath(points, 8), ax: tip.x, ay: tip.y, angle });
|
|
13220
|
+
next.push({ d: roundedPath(points, 8), ax: tip.x, ay: tip.y, angle, from: link2.from, to: link2.to });
|
|
13123
13221
|
}
|
|
13124
13222
|
setWires((current) => {
|
|
13125
13223
|
if (current.length === next.length && current.every((wire, index2) => wire.d === next[index2]?.d)) {
|
|
@@ -13317,6 +13415,8 @@ function StackDrawer(props) {
|
|
|
13317
13415
|
"path",
|
|
13318
13416
|
{
|
|
13319
13417
|
d: wire.d,
|
|
13418
|
+
"data-from": wire.from ?? "",
|
|
13419
|
+
"data-to": wire.to ?? "",
|
|
13320
13420
|
fill: "none",
|
|
13321
13421
|
stroke: "rgba(200, 206, 216, 0.42)",
|
|
13322
13422
|
strokeWidth: 1.4,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-talk-map",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.48",
|
|
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",
|