dsh-talk-map 0.1.46 → 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 +90 -20
- 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",
|
|
@@ -13114,13 +13114,86 @@ function StackDrawer(props) {
|
|
|
13114
13114
|
for (const box of obstacles) {
|
|
13115
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;
|
|
13116
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
|
+
}
|
|
13117
13128
|
if (point.x < 2 || point.y < 2 || point.x > boundsWidth - 2 || point.y > boundsHeight - 2) hits2 += 1;
|
|
13118
13129
|
}
|
|
13119
13130
|
}
|
|
13120
13131
|
return hits2;
|
|
13121
13132
|
};
|
|
13122
13133
|
const FACES = ["t", "r", "b", "l"];
|
|
13123
|
-
|
|
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(
|
|
13124
13197
|
fromRect,
|
|
13125
13198
|
toRect,
|
|
13126
13199
|
faces.fromHandle,
|
|
@@ -13128,28 +13201,23 @@ function StackDrawer(props) {
|
|
|
13128
13201
|
[fromRect, toRect, ...obstacles],
|
|
13129
13202
|
{ stub: 10 }
|
|
13130
13203
|
);
|
|
13131
|
-
let bestDirty = dirty(
|
|
13132
|
-
|
|
13133
|
-
|
|
13134
|
-
|
|
13135
|
-
|
|
13136
|
-
|
|
13137
|
-
|
|
13138
|
-
|
|
13139
|
-
|
|
13140
|
-
|
|
13141
|
-
bestPoints = attempt;
|
|
13142
|
-
if (bestDirty === 0) break;
|
|
13143
|
-
}
|
|
13144
|
-
}
|
|
13145
|
-
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;
|
|
13146
13214
|
}
|
|
13147
|
-
points = bestPoints;
|
|
13148
13215
|
}
|
|
13216
|
+
const points = bestPoints;
|
|
13149
13217
|
const tip = points[points.length - 1];
|
|
13150
13218
|
const prev = points[points.length - 2];
|
|
13151
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;
|
|
13152
|
-
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 });
|
|
13153
13221
|
}
|
|
13154
13222
|
setWires((current) => {
|
|
13155
13223
|
if (current.length === next.length && current.every((wire, index2) => wire.d === next[index2]?.d)) {
|
|
@@ -13347,6 +13415,8 @@ function StackDrawer(props) {
|
|
|
13347
13415
|
"path",
|
|
13348
13416
|
{
|
|
13349
13417
|
d: wire.d,
|
|
13418
|
+
"data-from": wire.from ?? "",
|
|
13419
|
+
"data-to": wire.to ?? "",
|
|
13350
13420
|
fill: "none",
|
|
13351
13421
|
stroke: "rgba(200, 206, 216, 0.42)",
|
|
13352
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",
|