dsh-talk-map 0.1.6 → 0.1.7
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 +47 -3
- package/package.json +1 -1
package/client/client.js
CHANGED
|
@@ -11739,7 +11739,7 @@ function ContextMenu(props) {
|
|
|
11739
11739
|
}
|
|
11740
11740
|
|
|
11741
11741
|
// src/client/edge-route.ts
|
|
11742
|
-
var DEFAULTS = { margin:
|
|
11742
|
+
var DEFAULTS = { margin: 14, stub: 14, minCorridor: 28 };
|
|
11743
11743
|
function anchorOf(rect, face) {
|
|
11744
11744
|
switch (face) {
|
|
11745
11745
|
case "r":
|
|
@@ -11894,6 +11894,46 @@ function routeEdge(from, to, fromFace, toFace, obstacles, options = {}) {
|
|
|
11894
11894
|
options
|
|
11895
11895
|
);
|
|
11896
11896
|
}
|
|
11897
|
+
function snapToChannels(points, obstacles, margin) {
|
|
11898
|
+
if (points.length < 3) return points;
|
|
11899
|
+
const out = points.map((point) => ({ ...point }));
|
|
11900
|
+
const rowBands = bands(obstacles, "y");
|
|
11901
|
+
const colBands = bands(obstacles, "x");
|
|
11902
|
+
const channelFor = (value, bandsList) => {
|
|
11903
|
+
for (let index2 = 1; index2 < bandsList.length; index2 += 1) {
|
|
11904
|
+
const lo = bandsList[index2 - 1].end;
|
|
11905
|
+
const hi = bandsList[index2].start;
|
|
11906
|
+
if (hi - lo < margin * 2 + 8) continue;
|
|
11907
|
+
if (value > lo && value < hi) return (lo + hi) / 2;
|
|
11908
|
+
}
|
|
11909
|
+
return void 0;
|
|
11910
|
+
};
|
|
11911
|
+
const last = out.length - 1;
|
|
11912
|
+
const horizontalSegment = (index2) => Math.abs(out[index2 - 1].y - out[index2].y) < 0.6;
|
|
11913
|
+
const fromStubHorizontal = horizontalSegment(1);
|
|
11914
|
+
const toStubHorizontal = horizontalSegment(last);
|
|
11915
|
+
for (let index2 = 1; index2 < last; index2 += 1) {
|
|
11916
|
+
const a = out[index2 - 1];
|
|
11917
|
+
const b = out[index2];
|
|
11918
|
+
const horizontalRun = Math.abs(a.y - b.y) < 0.6;
|
|
11919
|
+
if (index2 === 1 && horizontalRun === fromStubHorizontal) continue;
|
|
11920
|
+
if (index2 === last - 1 && horizontalRun === toStubHorizontal) continue;
|
|
11921
|
+
if (horizontalRun) {
|
|
11922
|
+
const centre = channelFor(a.y, rowBands);
|
|
11923
|
+
if (centre !== void 0 && Math.abs(centre - a.y) > 0.6) {
|
|
11924
|
+
a.y = centre;
|
|
11925
|
+
b.y = centre;
|
|
11926
|
+
}
|
|
11927
|
+
} else {
|
|
11928
|
+
const centre = channelFor(a.x, colBands);
|
|
11929
|
+
if (centre !== void 0 && Math.abs(centre - a.x) > 0.6) {
|
|
11930
|
+
a.x = centre;
|
|
11931
|
+
b.x = centre;
|
|
11932
|
+
}
|
|
11933
|
+
}
|
|
11934
|
+
}
|
|
11935
|
+
return simplify(out);
|
|
11936
|
+
}
|
|
11897
11937
|
function routeBetween(ends, from, to, obstacles, options = {}) {
|
|
11898
11938
|
const margin = options.margin ?? DEFAULTS.margin;
|
|
11899
11939
|
const stub = options.stub ?? DEFAULTS.stub;
|
|
@@ -11959,7 +11999,11 @@ function routeBetween(ends, from, to, obstacles, options = {}) {
|
|
|
11959
11999
|
cursor = cameFrom.get(cursor);
|
|
11960
12000
|
}
|
|
11961
12001
|
path.reverse();
|
|
11962
|
-
return
|
|
12002
|
+
return snapToChannels(
|
|
12003
|
+
simplify([start2, startStub, ...path.slice(1), endStub, end]),
|
|
12004
|
+
obstacles,
|
|
12005
|
+
margin
|
|
12006
|
+
);
|
|
11963
12007
|
}
|
|
11964
12008
|
const [ix, iy] = node.split(",").map(Number);
|
|
11965
12009
|
const here = pointAt(node);
|
|
@@ -11981,7 +12025,7 @@ function routeBetween(ends, from, to, obstacles, options = {}) {
|
|
|
11981
12025
|
const distance2 = Math.abs(next.x - here.x) + Math.abs(next.y - here.y);
|
|
11982
12026
|
const onCorridor = step2.axis === "x" ? corridorY.has(Math.round(here.y)) : corridorX.has(Math.round(here.x));
|
|
11983
12027
|
const turn = dir === step2.axis ? 0 : 18;
|
|
11984
|
-
const prefer = onCorridor ? 0 :
|
|
12028
|
+
const prefer = onCorridor ? 0 : 40;
|
|
11985
12029
|
const nextCost = cost + distance2 + turn + prefer;
|
|
11986
12030
|
const nextState = withDir(nextNode, step2.axis);
|
|
11987
12031
|
const known = best.get(nextState);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-talk-map",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
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",
|